Lines 305-367javascript
305window.location.reload()
306window.location.href = "..."
310**Fix:** Remove the navigation call. To "restart", reset your state variables instead.`:`CommonJS \`require()\` is not supported! Found on line ${e}.
312**CRITICAL**: Use ES6 \`import\` statements at the TOP of the file:
314\u2705 CORRECT - ES6 import:
316import { something } from 'module-name'
319\u274C WRONG - CommonJS require:
321const something = require('module-name') // NOT SUPPORTED!
324**Fix:** Replace all \`require()\` calls with ES6 \`import\` statements at the top of the file.`}var dt,pt,tS,rS,Os=R(()=>{dt=["client"],pt=["client","server"],tS=[{type:"DYNAMIC_IMPORT",pattern:/\bimport\s*\(\s*['"`]/,targets:dt},{type:"COMMONJS_REQUIRE",pattern:/\brequire\s
326`){let n=e.filter(s=>s.role==="system").map(s=>s.content);return{system:n.length?n.join(t):void 0,conversationMessages:e.filter(s=>s.role!=="system")}}parseJsonError(e,t){if(!e)return{message:`HTTP ${t}`};try{let n=JSON.parse(e);return n.error&&typeof n.error=="object"?{message:n.error.message||`HTTP ${t}`,type:n.error.type}:n.message?{message:n.message}:{message:e}}catch{return{message:e}}}checkAndThrowError(e){if(typeof e!="object"||e===null)return;let t=e;if(t.type==="error"&&"message"in t){let n=t.code||"unknown";throw new pe(t.message,n,!!t.retryable)}if(t.error)throw new pe(this.extractE ...
327`)),!t&&s.type==="message"&&s.content&&(t=s.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:t,reasoning:n}}parseProviderStreamChunk(e){if(!this.isResponsesApiEvent(e))return null;switch(e.type){case"response.failed":{let n=e.response?.error,s=n?.message||"Response failed",i=n?.code
329`)}isResponsesApiEvent(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}isResponsesApiResponse(e){return typeof e=="object"&&e!==null&&e.object==="response"}}});var Xt,Zs=R(()=>{Qt();Xt=class extends me{parseNonStreamingResponse(e){if(!this.hasChoices(e))return{text:""};let t=e,n=t.choices[0],s=n?.message,i=s?.content??n?.text??"",o=s?.reasoning??s?.reasoning_content??t.reasoning;return{text:i,reasoning:o}}parseProviderStreamChunk(e){if(!this.hasChoices(e))return null;let t=e.choices[0];if(!t)return null;let n=t.delta||t.message;if(!n)return null;let s=n.content||voi ...
331`);return{text:t,reasoning:n||void 0}}parseProviderStreamChunk(e){return this.isAnthropicEvent(e)&&e.type==="content_block_delta"?e.delta.type==="text_delta"?{text:e.delta.text||""}:e.delta.type==="thinking_delta"?{reasoning:e.delta.thinking||""}:null:null}withLastMessageCached(e){let t=e.length-1;return e.map((n,s)
332`),c={contents:o.map(f=>({role:f.role==="assistant"?"model":"user",parts:[{text:f.content}]}))};n?.webSearch!==!1&&(c.tools=[{google_search:{}}]),i&&(c.systemInstruction={role:"system",parts:[{text:i}]});let l=n?.effort;if(l!==void 0){let u={0:0,1:1024,2:8192,3:-1}[l];c.generationConfig={thinkingConfig:u===0?{thinkingBudget:0}:{includeThoughts:!0,thinkingBudget:u}}}return c}parseError(e,t){if(!e)return{message:`HTTP ${t}`};try{let n=JSON.parse(e),s=Array.isArray(n)?n[0]?.error:n?.error;return s&&typeof s=="object"?{message:(s.message||`HTTP ${t}`).split(`
333`)[0],type:s.status,code:s.code?.toString()}:n.message?{message:n.message}:{message:e}}catch{return{message:e}}}parseNonStreamingResponse(e){if(this.checkAndThrowError(e),this.checkGeminiError(e),!this.isGeminiResponse(e))return{text:"",status:"failed",error:"Invalid response format"};let t=this.extractParts(e).text||"",n=e.candidates?.[0]?.finishReason,s="complete";return n==="MAX_TOKENS"?s="interrupted":(n==="SAFETY"||n==="RECITATION")&&(s="failed"),{text:t,status:s}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return null;let t=this.extractParts(e);retur ...
337`);return e!==-1&&(t===-1||e<t)?{pos:e,len:4}:t!==-1?{pos:t,len:2}:{pos:-1,len:0}}function ic(r){let t=r.split(/\r?\n/).filter(
338`).trim();if(!n)return null;if(n==="[DONE]")return"done";try{return JSON.parse(n)}catch{return null}}async function*fp(r,e,t){let n=new TextDecoder,s=
339`)}var rr,US,JS,KS,tr,si,nr=R(()=>{rr={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};US="https://api.typebulb.com/api/models",JS=1440*60*1e3,KS=60*1e3,tr=null,si=null});function wt(r,e){let t=r??process.env.TB_AI_PROVIDER,n=e??process.env.TB_AI_MODEL;if(!t)return"No provider specified. Set TB_AI_PROVIDER in your .env file or pass provider in the tb.ai() call.";if(!n)return"No model specified. Set TB_AI_MODEL in your .env file or pass model in the tb.ai() call.";let s;try{s=yt(t)}catch{return`Unknown provider '${t}'.`}if(t==="olla ...
340`),n=[];if(t.forEach((o,a)=>{let c=_k(o);c!==void 0&&n.push({id:c,idx:a})}),!n.length)return e==="latest"?r:"";let s=e==="latest"?n[n.length-1]:n.find
341`)}function vc(r){try{return process.kill(r,0),!0}catch(e){return e.code==="EPERM"}}async function yi(r){await Tk(Ie(),{recursive:!0}),await Lp(gc(r.pid),JSON
342\u2026[${r.length-5e4} more characters truncated]`:r}function Me(r){let e=r.replace($k,"").split(`
343`).map(i=>i.trim()).filter(Boolean),t=e[0];if(!t)return"";let n=t.length>300?t.slice(0,300).trimEnd()+"\u2026":t,s=e.length-1;return s>0?`${n} (+${s} line${s===1?"":"s"})`:n}var $k,wi,vi=R(()=>{$k=/\u001b\[[0-9;]*m/g;wi=(r,e)=>``});import{existsSync as Mk,readdirSync as Dk,statSync as Bk}from"fs";import{join as jk}from"path";function Si(r){if(!Mk(r))return[];let e;try{e=Dk(r)}catch{return[]}let t=[];for(let n of e){if(!n.endsWith(".jsonl"))continue;let s=jk(r,n);try{let i=Bk(s);i.isFile()&&t.push({sessionId:n.slice(0,-6),file:s,mtime:i.mtimeMs ...
344`):r==null?"":Se(JSON.stringify(r))}function Gk(r){let e=r.trim();return!!e&&Hp.some(t=>t.test(e))}function zk(r){let e=r.trim();return e?
345`).length,"line")}`;if(t.mode==="content")return ge(t.numLines??0,"line");if(t.mode==="count")return`${ge(t.numMatches??0,"match","matches")} (${ge(t.numFiles??0,"file")})`;if(t.mode==="files_with_matches"
346`)){if(!p.includes(`"${f}"`))continue;let b;try{b=JSON.parse(p)}catch{continue}let m=b?.[u];b?.type===f&&typeof m=="string"&&m&&(d=m)}return d},o=s(0,Math.min(65536,n)),a=n>65536?s(n-65536,65536):"",c=i(a,"custom-title","customTitle")||i(o,"custom-title","customTitle")||i(a,"ai-title","aiTitle")||i(o,"ai-title","aiTitle");if(c)return c.replace(/\s+/g," ").trim().slice(0,200);for(let l of o.split(`
347`)){if(!l.trim())continue;let f;try{f=JSON.parse(l)}catch{continue}if(!f||mn(f)||f.type!=="user")continue;let u=f.message?.content,d="";typeof u=="string"?d=rt(u):Array.isArray(u)&&(d=u.map(Tc).filter(Boolean).join(" "));let p=d.replace(/\s+/g," ").trim();if(p)return(p.replace(/^Continuing from a prior session\. Here is the summary of our work so far:\s*/i,"").trim()||p).slice(0,200)}return""}finally{Uk(e)}}function tx(r){let e;try{e=Kk(Wp)}catch{return!1}for(let t of e)if(t.endsWith(".json"))try{let n=JSON.parse(Wk(hn(Wp,t),"utf8"));if(n?.sessionId!==r)continue;return process.kill(n.pid,0),!0 ...
348`),c=i.filter(u=>u.type==="tool_use").map(u=>({id:u.id??"",name:u.name??"",input:u.input??{}}));if(o||a||c.length){let u=Date.parse(e.timestamp??""),d=!isNaN(u)&&u>=t;n.push({type:"assistant"
350description: ${JSON.stringify(e)}
352---`}function gx(r){return`> Generated from typebulb v${r}. If \`npx typebulb --version\` reports a newer version, re-run \`npx typebulb skill\` to refresh this file.`}function tm(r,e){return`${hx(e)}
357`}var Ti=R(()=>{});var gn=R(()=>{$e();Gp();zp();_c();Qp();Zp();fn();nr();oi();Ti()});import{copyFileSync as yx,existsSync as rm,mkdirSync as nm,rmSync as bx,writeFileSync as wx}from"fs"
358import { spawn } from "node:child_process";
360function logErr(...a) { try { console.error("[typebulb]", ...a); } catch (e) {} }
362// Matches "typebulb wait", "npx typebulb wait", "/path/to/typebulb wait", "pnpm exec typebulb wait", etc.
363function isWaitCommand(command) { return /\btypebulb\s+wait\b/.test(String(command || "")); }
365// Resolved at shim-write time to this install's absolute skill-part paths (same files
366// commands/agent.ts prints — readable without a permission prompt, unlike the npx command).
367var TB_DESCRIPTION_PATH = "__TB_DESCRIPTION_PATH__";
Long lines were clipped for display.