typebulb 0.55.0 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +2 -2
- package/dist/agents/claude/styles.css +4 -0
- package/dist/agents/codex/styles.css +4 -0
- package/dist/agents/pi/styles.css +4 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: typebulb
|
|
3
3
|
description: "Author and run Typebulb bulbs — single-file markdown apps (TypeScript/TSX) that run locally via `npx typebulb` (full power: filesystem, database, `server.ts`, `tb.ai`) or render live inline in your coding agent's session through Typebulb's agent mirror (sandboxed, client-only). A bulb can be a visual widget (chart, simulation, diagram, calculator, UI), a full-stack tool with a Node backend, or an AI app that calls models at runtime. Covers the bulb format, the `tb.*` API, trust, and the local run/inline workflow. Use when the user wants a bulb, a quick local tool (visual, backend-backed, or AI-powered), or something visual rendered inline in the conversation."
|
|
4
|
-
version: 0.55.
|
|
4
|
+
version: 0.55.1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
> Generated from typebulb v0.55.
|
|
7
|
+
> Generated from typebulb v0.55.1. `npx typebulb agent` prints the running version alongside the path to its packaged SKILL.md: if that version is newer than this one, replace this file with that one.
|
|
8
8
|
|
|
9
9
|
# typebulb
|
|
10
10
|
|
|
@@ -1439,6 +1439,10 @@ html[data-theme="dark"] .masthead-logo.dark { display: block; }
|
|
|
1439
1439
|
width: var(--lane-w);
|
|
1440
1440
|
margin-left: var(--lane-ml);
|
|
1441
1441
|
margin-right: auto;
|
|
1442
|
+
/* Zero the `.embed` inset: spread makes the border box the lane, so a 1rem left padding would
|
|
1443
|
+
leave the scroller 1rem narrower than the table's own lane cap — a capped table then overflows
|
|
1444
|
+
by exactly that inset at every window width, which is the permanent 16px-of-travel scrollbar. */
|
|
1445
|
+
padding-left: 0;
|
|
1442
1446
|
}
|
|
1443
1447
|
|
|
1444
1448
|
/* ````bulb```` inline bulbs: a sandboxed nested app. createBulbFrame owns the iframe (auto-height,
|
|
@@ -1439,6 +1439,10 @@ html[data-theme="dark"] .masthead-logo.dark { display: block; }
|
|
|
1439
1439
|
width: var(--lane-w);
|
|
1440
1440
|
margin-left: var(--lane-ml);
|
|
1441
1441
|
margin-right: auto;
|
|
1442
|
+
/* Zero the `.embed` inset: spread makes the border box the lane, so a 1rem left padding would
|
|
1443
|
+
leave the scroller 1rem narrower than the table's own lane cap — a capped table then overflows
|
|
1444
|
+
by exactly that inset at every window width, which is the permanent 16px-of-travel scrollbar. */
|
|
1445
|
+
padding-left: 0;
|
|
1442
1446
|
}
|
|
1443
1447
|
|
|
1444
1448
|
/* ````bulb```` inline bulbs: a sandboxed nested app. createBulbFrame owns the iframe (auto-height,
|
|
@@ -1439,6 +1439,10 @@ html[data-theme="dark"] .masthead-logo.dark { display: block; }
|
|
|
1439
1439
|
width: var(--lane-w);
|
|
1440
1440
|
margin-left: var(--lane-ml);
|
|
1441
1441
|
margin-right: auto;
|
|
1442
|
+
/* Zero the `.embed` inset: spread makes the border box the lane, so a 1rem left padding would
|
|
1443
|
+
leave the scroller 1rem narrower than the table's own lane cap — a capped table then overflows
|
|
1444
|
+
by exactly that inset at every window width, which is the permanent 16px-of-travel scrollbar. */
|
|
1445
|
+
padding-left: 0;
|
|
1442
1446
|
}
|
|
1443
1447
|
|
|
1444
1448
|
/* ````bulb```` inline bulbs: a sandboxed nested app. createBulbFrame owns the iframe (auto-height,
|
package/dist/index.js
CHANGED
|
@@ -180,7 +180,7 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
180
180
|
`),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;r.push({type:"assistant",text:o,thinking:a,tools:c,live:d})}let l=e.message?.usage??e.usage,f=l&&{in:l.input_tokens??0,out:l.output_tokens??0,cached:l.cache_read_input_tokens??0,cacheCreate:l.cache_creation_input_tokens??0};return{events:r,usage:f,model:e.message?.model}}return{events:r}}chainWorking(e){let t;for(let o of e)(o.type==="user"||o.type==="assistant")&&(t=o);if(!t)return!1;if(t.type==="user"){try{let o=t.message?.content,a=typeof o=="string"?o:Array.isArray(o)?o.filter(l=>l&&l.type==="text").map(l=>l.text??"").join(""):"";if(!(Array.isArray(o)&&o.some(l=>l&&l.type==="tool_result"))&&a.trim()&&xt(a)==="")return!1}catch{}return!0}let s=(Array.isArray(t.message?.content)?t.message.content:[]).filter(o=>o.type==="tool_use").map(o=>o.id);if(s.length===0)return!1;let i=new Set;for(let o of e){let a=o.message?.content;if(Array.isArray(a))for(let c of a)c.type==="tool_result"&&c.tool_use_id&&i.add(c.tool_use_id)}return s.some(o=>o&&!i.has(o))}sessionAlive(e){return HE(e)}readPreview(e){return WE(e)}searchText(e){if(!e||Hr(e)||e.type!=="user"&&e.type!=="assistant")return"";let t=e.message?.content,r="";if(typeof t=="string")r=xt(t);else if(Array.isArray(t)){let s=t;r=e.type==="user"?s.map(Ll).filter(Boolean).join(" "):s.filter(i=>i.type==="text"&&typeof i.text=="string").map(i=>i.text).join(" ")}return r.replace(/\s+/g," ").trim()}}});import{statSync as YE,readdirSync as VE,openSync as zE,readSync as GE,closeSync as XE,existsSync as QE}from"fs";import{basename as ZE,join as Dl,resolve as eA}from"path";import{homedir as Fm}from"os";function nA(n){let e=n.trimStart();return tA.some(t=>e.startsWith(t))}function Vr(n,e){return Array.isArray(n)?n.map(t=>typeof t?.text=="string"?e&&nA(t.text)?"":be(t.text):t?.type==="input_image"&&typeof t.image_url=="string"&&t.image_url.startsWith("data:")?``:"").filter(Boolean).join(`
|
|
181
181
|
`):""}function rA(n){return typeof n=="string"?be(n):Vr(n,!1)}function sA(n){let e=n??"";for(let t of[/tools\.shell_command\((\{[\s\S]*?\})\)/,/tools\.shell_command\((\{[\s\S]*\})\)/]){let r=t.exec(e);if(r)try{return JSON.parse(r[1])}catch{}}return{script:e}}function iA(n){if(typeof n=="string"&&n)try{let e=JSON.parse(n);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{arguments:n??""}}function qm(n,e){let t;try{t=zE(n,"r")}catch{return}try{let r=Buffer.alloc(e),s=GE(t,r,0,e,0);return{text:r.subarray(0,s).toString("utf8"),bytes:s}}finally{XE(t)}}function oA(n){let t=qm(n,65536);if(t===void 0)return;let r=t.text.indexOf(`
|
|
182
182
|
`);if(r<0)return t.bytes>=65536?"":void 0;try{let s=JSON.parse(t.text.slice(0,r));return s?.type==="session_meta"&&typeof s.payload?.cwd=="string"?s.payload.cwd:""}catch{return""}}var tA,Um,_n,jl=v(()=>{"use strict";Wr();Wi();tA=["<permissions instructions>","<apps_instructions>","<plugins_instructions>","<skills_instructions>","<recommended_plugins>","<environment_context>","<user_instructions>"];Um=n=>{let e=eA(n);return process.platform==="win32"?e.toLowerCase():e},_n=class extends kt{constructor(t=Dl(Fm(),".codex","sessions")){super();this.root=t}displayName="Codex Mirror";#e=0;#s;#t=new Map;detectsSelf(){return!!process.env.CODEX_THREAD_ID}detectsInstalled(){return QE(Dl(Fm(),".codex"))}sessionsDir(t){return this.root}listSessionFiles(t){let r=Um(t),s=[];for(let i of this.#r()){let o;try{let c=YE(i);if(!c.isFile())continue;o=c.mtimeMs}catch{continue}let a=this.#t.get(i);if(a===void 0){if(a=oA(i),a===void 0)continue;this.#t.set(i,a)}Um(a)===r&&s.push({sessionId:ZE(i,".jsonl"),file:i,mtime:o})}return s}#r(){let t=[],r=s=>{try{return VE(s).map(i=>Dl(s,i))}catch{return[]}};for(let s of r(this.root))for(let i of r(s))for(let o of r(i))for(let a of r(o))a.endsWith(".jsonl")&&t.push(a);return t}parseEntry(t){let r;try{r=JSON.parse(t)}catch{return null}return!r||typeof r.type!="string"?null:r}idOf(t){return t.ord===void 0&&(t.ord=String(this.#e++),t.parent=this.#s,this.#s=t.ord),t.ord}parentOf(t){return t.parent}timestampOf(t){return t.timestamp}isSidechain(t){return!1}isLeafType(t){return!0}isRecoveryNoise(t){return!1}apply(t,r){let s=[],i=t.payload;if(!i)return{events:s};let o=()=>{let a=Date.parse(t.timestamp??"");return!isNaN(a)&&a>=r};if(t.type==="response_item"){if(i.type==="message"){if(i.role==="user"){let a=Vr(i.content,!0).trim();a&&s.push({type:"user",text:a})}else if(i.role==="assistant"){let a=Vr(i.content,!1);a&&s.push({type:"assistant",text:a,thinking:"",tools:[],live:o()})}return{events:s}}if(i.type==="reasoning"){let a=Vr(i.summary,!1);return a&&s.push({type:"assistant",text:"",thinking:a,tools:[],live:o()}),{events:s}}if(i.type==="custom_tool_call"||i.type==="function_call"){let a=i.type==="custom_tool_call"?sA(i.input):iA(i.arguments);return s.push({type:"assistant",text:"",thinking:"",tools:[{id:i.call_id??"",name:i.name??"",input:a}],live:o()}),{events:s}}if(i.type==="custom_tool_call_output"||i.type==="function_call_output"){let a=rA(i.output);return s.push({type:"tool_result",id:i.call_id??"",content:a,isError:!1,digest:Le(a)}),{events:s}}return{events:s}}if(t.type==="event_msg"){if(i.type==="token_count"){let a=i.info?.last_token_usage;if(!a)return{events:s};let c={in:Math.max(0,(a.input_tokens??0)-(a.cached_input_tokens??0)),out:a.output_tokens??0,cached:a.cached_input_tokens??0,cacheCreate:a.cache_write_input_tokens??0};return{events:s,usage:c}}return{events:s}}return t.type==="turn_context"?{events:s,model:i.model}:{events:s}}chainWorking(t){let r=!1;for(let s of t){if(s.type!=="event_msg")continue;let i=s.payload?.type;i==="task_started"?r=!0:(i==="task_complete"||i==="turn_aborted")&&(r=!1)}return r}sessionAlive(){}readPreview(t){for(let r of(qm(t,256*1024)?.text??"").split(`
|
|
183
|
-
`))if(r.includes('"user_message"'))try{let s=JSON.parse(r);if(s?.type==="event_msg"&&s.payload?.type==="user_message"&&typeof s.payload.message=="string"){let i=s.payload.message.replace(/\s+/g," ").trim();if(i)return i.slice(0,200)}}catch{}return""}searchText(t){if(t?.type!=="response_item"||t.payload?.type!=="message")return"";let r=t.payload.role;return r!=="user"&&r!=="assistant"?"":Vr(t.payload.content,r==="user").replace(/\s+/g," ").trim()}}});import{realpathSync as aA}from"fs";import{createHash as cA}from"crypto";import{join as Vi,resolve as lA}from"path";import{homedir as uA}from"os";function Et(){let n=process.env.TYPEBULB_SERVERS_DIR;return n?Vi(n,".."):Vi(uA(),".typebulb")}function et(){Jm||(Jm=!0,console.error(`${Et()} not writable \u2014 continuing stateless: ports won't stick, caches stay cold, and typebulb logs/wait/send/stop may not see this run`))}function tt(){return process.env.TYPEBULB_SERVERS_DIR||Vi(Et(),"servers")}function Km(n){let e=X(n),t=cA("sha1").update(e).digest("hex").slice(0,8),r=e.slice(e.lastIndexOf("/")+1).replace(/\.bulb\.md$/,"");return Vi(Et(),"canvas",`${r}-${t}.png`)}function X(n){let e=lA(n),t=e;try{t=aA.native(e)}catch{}return(process.platform==="win32"?t.toLowerCase():t).replace(/\\/g,"/")}function Wm(n,e){let t=X(n),r=X(e);return t.startsWith(r.endsWith("/")?r:r+"/")?!t.includes("/node_modules/"):!1}var Jm,At=v(()=>{"use strict";Jm=!1});var Be,zi=v(()=>{"use strict";Be="0.55.
|
|
183
|
+
`))if(r.includes('"user_message"'))try{let s=JSON.parse(r);if(s?.type==="event_msg"&&s.payload?.type==="user_message"&&typeof s.payload.message=="string"){let i=s.payload.message.replace(/\s+/g," ").trim();if(i)return i.slice(0,200)}}catch{}return""}searchText(t){if(t?.type!=="response_item"||t.payload?.type!=="message")return"";let r=t.payload.role;return r!=="user"&&r!=="assistant"?"":Vr(t.payload.content,r==="user").replace(/\s+/g," ").trim()}}});import{realpathSync as aA}from"fs";import{createHash as cA}from"crypto";import{join as Vi,resolve as lA}from"path";import{homedir as uA}from"os";function Et(){let n=process.env.TYPEBULB_SERVERS_DIR;return n?Vi(n,".."):Vi(uA(),".typebulb")}function et(){Jm||(Jm=!0,console.error(`${Et()} not writable \u2014 continuing stateless: ports won't stick, caches stay cold, and typebulb logs/wait/send/stop may not see this run`))}function tt(){return process.env.TYPEBULB_SERVERS_DIR||Vi(Et(),"servers")}function Km(n){let e=X(n),t=cA("sha1").update(e).digest("hex").slice(0,8),r=e.slice(e.lastIndexOf("/")+1).replace(/\.bulb\.md$/,"");return Vi(Et(),"canvas",`${r}-${t}.png`)}function X(n){let e=lA(n),t=e;try{t=aA.native(e)}catch{}return(process.platform==="win32"?t.toLowerCase():t).replace(/\\/g,"/")}function Wm(n,e){let t=X(n),r=X(e);return t.startsWith(r.endsWith("/")?r:r+"/")?!t.includes("/node_modules/"):!1}var Jm,At=v(()=>{"use strict";Jm=!1});var Be,zi=v(()=>{"use strict";Be="0.55.1"});import{spawn as Hm}from"child_process";import{readdir as dA,readFile as Vm,writeFile as zm,unlink as Fl,mkdir as fA}from"fs/promises";import{mkdirSync as Gm,writeFileSync as Gi,appendFileSync as pA,readFileSync as Ul}from"fs";import*as xe from"path";import{fileURLToPath as hA}from"url";function ql(n){return xe.join(tt(),`${n}.json`)}function Gr(n){return xe.join(tt(),`${n}.log`)}function Jl(n){return xe.join(tt(),`${n}.wait.json`)}function Xm(n){try{let e=JSON.parse(Ul(Jl(n),"utf8"));return e.cursors&&typeof e.cursors=="object"?e.cursors:{}}catch{return{}}}function Kl(n,e=""){let t=Xm(n)[e];return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:void 0}function Xi(n,e,t=""){try{Gm(tt(),{recursive:!0});let r=Xm(n);r[t]=e,Gi(Jl(n),JSON.stringify({cursors:r}))}catch{}}function Qi(n){let e=Gr(n);try{Gm(tt(),{recursive:!0}),Gi(e,"")}catch{return()=>{}}let t=process.stdout.write.bind(process.stdout),r=process.stderr.write.bind(process.stderr),s=0,i=!1,o=a=>{if(!i)try{let c=typeof a=="string"?Buffer.from(a,"utf8"):Buffer.from(a);if(pA(e,c),s+=c.length,s>2*Ym){let l=Ul(e),f=l.subarray(Math.max(0,l.length-Ym));Gi(e,f),s=f.length}}catch{i=!0}};return process.stdout.write=((a,...c)=>(o(a),t(a,...c))),process.stderr.write=((a,...c)=>(o(a),r(a,...c))),()=>{process.stdout.write=t,process.stderr.write=r}}function Qm(n){try{Gi(Gr(n),"")}catch{}}function He(n,e=0){try{let t=Ul(Gr(n)),r=e>=0&&e<=t.length?e:0;return{text:t.subarray(r).toString("utf8"),offset:t.length}}catch{return{text:"",offset:0}}}function Wl(n){return`\u2500\u2500 run ${n} \u2500\u2500 ${new Date().toTimeString().slice(0,8)}`}function gA(n){let e=mA.exec(n);return e?Number(e[1]):void 0}function Zm(n,e){let t=n.split(`
|
|
184
184
|
`),r=[];if(t.forEach((o,a)=>{let c=gA(o);c!==void 0&&r.push({id:c,idx:a})}),!r.length)return e==="latest"?n:"";let s=e==="latest"?r[r.length-1]:r.find(o=>o.id===e);if(!s)return"";let i=r.find(o=>o.idx>s.idx);return t.slice(s.idx,i?i.idx:t.length).join(`
|
|
185
185
|
`)}function Hl(n){try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function eg(n){try{await fA(tt(),{recursive:!0}),await zm(ql(n.pid),JSON.stringify({version:Be,...n}))}catch{et()}}async function tg(n,e){let t=ql(n);try{let r=JSON.parse(await Vm(t,"utf8"));if(r.denied===e)return;r.denied=e,await zm(t,JSON.stringify(r))}catch{}}async function zr(n){await Fl(ql(n)).catch(()=>{}),await Fl(Gr(n)).catch(()=>{}),await Fl(Jl(n)).catch(()=>{})}async function Q(n){let e;try{e=await dA(tt())}catch{return[]}let t=[];return await Promise.all(e.map(async s=>{if(!/^\d+\.json$/.test(s))return;let i=parseInt(s,10),o;try{o=JSON.parse(await Vm(xe.join(tt(),s),"utf8"))}catch{await zr(i);return}o&&typeof o.pid=="number"&&Hl(o.pid)?t.push(o):await zr(i)})),(n?t.filter(s=>s.agent==null&&Wm(s.file,n)):t).sort((s,i)=>s.startedAt-i.startedAt)}async function Yl(n,e){let t=X(n);return(await Q()).find(r=>r.cwd!=null&&X(r.cwd)===t&&(e?r.agent===e:r.agent!=null))}async function Yt(n){try{process.kill(n,"SIGTERM")}catch{}await zr(n)}function Rn(n,e){let t=X(e);return n.filter(r=>r.agent==null&&r.pid!==process.pid&&X(r.file)===t)}async function Vl(n){let e=Rn(await Q(),n);for(let t of e)await Yt(t.pid);return e}function bA(n,e,t){(process.platform==="win32"?Hm("cmd",["/c","start","","/b",n,...e],{cwd:t,stdio:"ignore",windowsHide:!0}):Hm(n,e,{cwd:t,detached:!0,stdio:"ignore"})).unref()}function Xr(){return xe.join(xe.dirname(hA(import.meta.url)),"index.js")}function wA(n,e={}){return{command:process.execPath,args:[Xr(),...e.trust?["--trust"]:[],...e.batch?["--batch",e.batch]:[],...e.mode?["--mode",e.mode]:[],n,...e.open===!1?["--no-open"]:[]]}}function vA(n){return{command:process.execPath,args:[Xr(),`agent:${n}`,"--no-open"]}}async function ng(n,e,t,r){let s=await n();if(s)return s;bA(e.command,e.args,t);let i=Date.now()+2e4;for(;Date.now()<i;){await yA(150);let o=await n();if(o)return o}throw new Error(`Launched ${r} but it did not register within 20s.`)}async function Zi(n,e={}){let t=e.cwd??process.cwd(),r=xe.resolve(t,n),[s]=await Vl(r),i={...e,batch:e.batch??s?.batch,mode:e.mode??s?.mode};return ng(async()=>Rn(await Q(),r)[0],wA(n,i),t,xe.basename(n))}async function rg(n,e=process.cwd()){return ng(()=>Yl(e,n),vA(n),e,`the ${n} mirror`)}var Ym,mA,yA,Ee=v(()=>{"use strict";At();zi();Ym=1e6;mA=/^── run (\d+) ── /;yA=n=>new Promise(e=>setTimeout(e,n))});function In(n){return{...pf(n),server:n.files.get("server.ts")??""}}function eo(n){return!!n.server&&!n.code}var Qr=v(()=>{"use strict";ne();ne()});function to(n){let e=/^---[^\n]*\n([\s\S]*?)\n---/.exec(n),t=e?/^\s*name:\s*(.+?)\s*$/m.exec(e[1]):null;return t?t[1].replace(/^["']|["']$/g,""):void 0}function zl(n){return On(to(n)??"bulb")||"bulb"}var Gl=v(()=>{"use strict";ne()});import{transform as SA}from"sucrase";function Xl(n,e={}){let t=e.serverOnly?["typescript"]:["typescript","jsx"];try{let{code:r}=SA(n,{transforms:t,jsxRuntime:"automatic",jsxImportSource:e.jsxImportSource||"react",production:!0});return{code:r}}catch(r){return{code:"",error:String(r)}}}var sg=v(()=>{});function Ql(n){let e=n.split(""),t=(i,o)=>{for(let a=i;a<o&&a<e.length;a++)e[a]!==`
|
|
186
186
|
`&&(e[a]=" ")},r=0,s="";for(;r<n.length;){let i=n[r],o=n[r+1];if(i==="/"&&o==="/"){let a=r;for(;a<n.length&&n[a]!==`
|