typebulb 0.45.1 → 0.45.2

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 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 (embedded, 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/embed 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.45.1
4
+ version: 0.45.2
5
5
  ---
6
6
 
7
- > Generated from typebulb v0.45.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.
7
+ > Generated from typebulb v0.45.2. `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
 
@@ -1494,9 +1494,12 @@ const something = require('module-name') // NOT SUPPORTED!
1494
1494
  const el = resolveTarget(t.role, t.name);
1495
1495
  const r = el.getBoundingClientRect();
1496
1496
  const de = document.scrollingElement || document.documentElement;
1497
+ // Edges round, dimensions derive: x + width IS the rounded true right edge (same vertically),
1498
+ // so controls truly sharing an edge always read equal \u2014 per-field rounding could put them 1px apart.
1499
+ const x = Math.round(r.left), y = Math.round(r.top);
1497
1500
  return {
1498
- x: Math.round(r.x), y: Math.round(r.y),
1499
- width: Math.round(r.width), height: Math.round(r.height),
1501
+ x, y,
1502
+ width: Math.round(r.right) - x, height: Math.round(r.bottom) - y,
1500
1503
  viewport: { width: de.clientWidth, height: de.clientHeight }
1501
1504
  };
1502
1505
  };
@@ -1494,9 +1494,12 @@ const something = require('module-name') // NOT SUPPORTED!
1494
1494
  const el = resolveTarget(t.role, t.name);
1495
1495
  const r = el.getBoundingClientRect();
1496
1496
  const de = document.scrollingElement || document.documentElement;
1497
+ // Edges round, dimensions derive: x + width IS the rounded true right edge (same vertically),
1498
+ // so controls truly sharing an edge always read equal \u2014 per-field rounding could put them 1px apart.
1499
+ const x = Math.round(r.left), y = Math.round(r.top);
1497
1500
  return {
1498
- x: Math.round(r.x), y: Math.round(r.y),
1499
- width: Math.round(r.width), height: Math.round(r.height),
1501
+ x, y,
1502
+ width: Math.round(r.right) - x, height: Math.round(r.bottom) - y,
1500
1503
  viewport: { width: de.clientWidth, height: de.clientHeight }
1501
1504
  };
1502
1505
  };
@@ -2440,7 +2440,7 @@ var Patcher = class {
2440
2440
 
2441
2441
  // cli/agents/pi/server/piPatcherExtension.ts
2442
2442
  var DESCRIPTION = true ? "Apply unified diffs to files \u2014 tolerant of form, strict about intent. Repairs sloppy AI-generated diffs (mangled headers, whitespace drift, missing prefixes; line numbers can be wrong or absent \u2014 hunks anchor by fuzzy-matched context lines) and applies all hunks atomically when the intent is unambiguous; fails with a precise, typed error when it isn't. Use for multi-hunk edits in one step, or when exact string-replacement editing fails on whitespace or invisible characters." : "Apply unified diffs to files.";
2443
- var BUILD_TAG = true ? "matchu-patchu-pi 0.3.5, built 2026-07-30 18:56:04" : "matchu-patchu-pi dev";
2443
+ var BUILD_TAG = true ? "matchu-patchu-pi 0.3.5, built 2026-07-30 19:16:27" : "matchu-patchu-pi dev";
2444
2444
  var errorBlocks = (errors) => {
2445
2445
  const parts = [`Patch failed with ${errors.length} error(s):`];
2446
2446
  for (const e of errors) parts.push("", e.toString());
package/dist/index.js CHANGED
@@ -987,9 +987,12 @@ ${bE(t)}`)}var bh=v(()=>{Di()});var wt,qn,Il,Un=v(()=>{wt="https://esm.sh",qn="h
987
987
  const el = resolveTarget(t.role, t.name);
988
988
  const r = el.getBoundingClientRect();
989
989
  const de = document.scrollingElement || document.documentElement;
990
+ // Edges round, dimensions derive: x + width IS the rounded true right edge (same vertically),
991
+ // so controls truly sharing an edge always read equal \u2014 per-field rounding could put them 1px apart.
992
+ const x = Math.round(r.left), y = Math.round(r.top);
990
993
  return {
991
- x: Math.round(r.x), y: Math.round(r.y),
992
- width: Math.round(r.width), height: Math.round(r.height),
994
+ x, y,
995
+ width: Math.round(r.right) - x, height: Math.round(r.bottom) - y,
993
996
  viewport: { width: de.clientWidth, height: de.clientHeight }
994
997
  };
995
998
  };
@@ -2200,5 +2203,5 @@ ${OC}
2200
2203
  `);let c=0,l=Promise.resolve();Nt({target:r,onChange:()=>{let d=++c;l=l.then(async()=>{if(d===c)try{console.log("Re-running..."),await a()}catch(u){console.error("Error:",u)}})}})}}Ot();Ke();import{Console as NC}from"node:console";Ie();async function sw(r,e,t,n,s){BC();try{let p=kr(await Q(),r)[0];p&&(Ii(p.pid,Je(p.pid).offset),console.error(`note: 'call' boots a fresh server.ts instance; the running server (${p.url}) is not contacted \u2014 state shared with it must live on disk.`))}catch{}let i=Ae(t),{bulb:o,config:a}=await De(r);o.server||vs("This bulb has no **server.ts** block; nothing to call."),Tt(i,r,o.server),s&&await Mr(r,s);let c;try{c=await ts(o.server,r,n,a.dependencies,s)}catch(p){vs(p instanceof Error?p.message:String(p))}let l=ca(c,e.fn);if(!l){let p=[...Object.keys(c).filter(h=>typeof c[h]=="function"),...Object.keys(aa)];vs(`Function '${e.fn}' not found. Available: ${p.length?p.join(", "):"(none)"}.`)}let d=await IC(e);if(la(l)){try{for await(let p of l(...d))await nw(JSON.stringify(p,iw)+`
2201
2204
  `)}catch(p){vs(p instanceof Error?p.stack??p.message:String(p))}return rw(0)}let u;try{u=await l(...d)}catch(p){vs(p instanceof Error?p.stack??p.message:String(p))}let f=MC(u);f!==void 0&&await nw(f+`
2202
2205
  `),rw(0)}function rw(r){process.exitCode=r,setTimeout(()=>process.exit(r),2e3).unref?.()}async function IC(r){if(r.hasArgsFlag){let e=r.argsJson??"";return e==="-"&&(e=await DC()),LC(e)}return $C(r.positional)}function $C(r){return r.map(e=>{try{return JSON.parse(e)}catch{return e}})}function LC(r){let e;try{e=JSON.parse(r)}catch(t){throw new Error(`--args must be a JSON array: ${t instanceof Error?t.message:String(t)}`)}if(!Array.isArray(e))throw new Error(`--args must be a JSON array, got ${e===null?"null":typeof e}`);return e}function MC(r){if(r!==void 0)return JSON.stringify(r,iw,2)}function iw(r,e){return typeof e=="bigint"?e.toString():e}function vs(r){process.stderr.write(r+`
2203
- `),process.exit(1)}function BC(){let r=new NC(process.stderr,process.stderr);console.log=r.log.bind(r),console.info=r.info.bind(r),console.debug=r.debug.bind(r),console.dir=r.dir.bind(r)}function nw(r){return new Promise((e,t)=>{process.stdout.write(r,n=>n?t(n):e())})}async function DC(){let r=[];for await(let e of process.stdin)r.push(e);return Buffer.concat(r).toString("utf-8")}var ow="0.45.1";for(let r of[process.stdout,process.stderr])r.on("error",e=>{if(e?.code!=="EPIPE")throw e});function aw(r,e){r||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
2206
+ `),process.exit(1)}function BC(){let r=new NC(process.stderr,process.stderr);console.log=r.log.bind(r),console.info=r.info.bind(r),console.debug=r.debug.bind(r),console.dir=r.dir.bind(r)}function nw(r){return new Promise((e,t)=>{process.stdout.write(r,n=>n?t(n):e())})}async function DC(){let r=[];for await(let e of process.stdin)r.push(e);return Buffer.concat(r).toString("utf-8")}var ow="0.45.2";for(let r of[process.stdout,process.stderr])r.on("error",e=>{if(e?.code!=="EPIPE")throw e});function aw(r,e){r||(console.error(`This bulb runs server-side Node code (server.ts), which --trust must authorize:
2204
2207
  ${e}`),process.exit(1))}async function jC(){let r=tb(process.argv.slice(2));if(r.version&&(console.log(`typebulb ${ow}`),process.exit(0)),r.help&&(rb(),process.exit(0)),Zy(),r.subcommand==="logs"){await Rb(r.file||void 0,{follow:r.follow,clear:r.clear,run:r.run,lines:r.lines});return}if(r.subcommand==="wait"){await _b(r.file||void 0,{match:r.match,timeoutSec:r.timeoutSec});return}if(r.subcommand==="stop"){r.stopScope?await Ib(r.stopScope):await Nb(r.file||void 0);return}if(r.subcommand==="send"){await Mb(r.file,r.sendMessage,r.sendWaitMs??0);return}if(r.subcommand==="models"){await Tb(r.mode);return}if(r.subcommand==="slug"){Ob(r.slugName);return}if(r.subcommand==="pull"){await Eg(r.file||void 0,{force:r.force,mode:r.mode});return}if(r.subcommand==="push"){await Tg(r.file||void 0,{force:r.force,mode:r.mode});return}if(r.subcommand==="agent"){await(r.agentTarget?Zb(r):Ab(ow));return}if(r.subcommand==="trust"||r.subcommand==="untrust"){await kb(r.file||void 0,r.subcommand==="trust");return}let e;if(!r.file||r.file==="."){let c=await rg(process.cwd());c||(console.error("No .bulb.md file found in current directory"),process.exit(1)),e=c}else e=ir.resolve(r.file);if(await cw.access(e).then(()=>!0,()=>!1)||(Vr().includes(r.file)&&(console.error(`To open the ${r.file} agent mirror, run: npx typebulb agent:${r.file}`),process.exit(1)),console.error(`File not found: ${e}`),process.exit(1)),e.endsWith(".bulb.md")||(console.error("File must have .bulb.md extension"),process.exit(1)),r.subcommand==="get"){await Db(e,r.blockKind);return}if(r.subcommand==="put"){await qb(e,r.blockPairs);return}let n=r.file&&r.file!=="."?r.file:ir.relative(process.cwd(),e)||ir.basename(e),s=`npx typebulb --trust ${n.includes(" ")?`"${n}"`:n}`;if(r.subcommand==="predict"){await Sb(e,s);return}let i=!r.noTrust&&Qt(e);i&&!r.trust&&console.error("trust: granted from memory (run `typebulb untrust` to revoke)"),r.trust=r.noTrust?!1:r.trust||i;let o;try{o=await De(e)}catch{}let a;if(r.local){o&&!(r.local.name in(o.config.dependencies??{}))&&(console.error(`--replace: '${r.local.name}' is not a dependency in this bulb's config.json; nothing to replace.`),process.exit(1)),o&&r.subcommand!=="call"&&(!o.bulb.code||r.server)&&console.warn("warning: --replace has no effect in server mode (the override is client-only).");try{a=await wd(r.local)}catch(c){console.error(c instanceof Error?c.message:String(c)),process.exit(1)}console.error(`replace: ${a.name} \u2192 ${ir.relative(process.cwd(),a.dir)||"."}`)}if(r.subcommand==="check"){await vb(e,a);return}if(r.subcommand==="call"){aw(r.trust,s),await sw(e,{fn:r.fn,positional:r.callArgs,argsJson:r.argsJson,hasArgsFlag:r.hasArgsFlag},r.mode,a,r.batch);return}if(o&&o.bulb.server&&(Mi(o.bulb)||r.server)){aw(r.trust,s),await tw(e,r.watch,r.mode,a,r.batch);return}await zb(e,r,s,a)}jC().catch(r=>{console.error("Error:",r.message),process.exit(1)});
package/dist/render.js CHANGED
@@ -1086,9 +1086,12 @@ const something = require('module-name') // NOT SUPPORTED!
1086
1086
  const el = resolveTarget(t.role, t.name);
1087
1087
  const r = el.getBoundingClientRect();
1088
1088
  const de = document.scrollingElement || document.documentElement;
1089
+ // Edges round, dimensions derive: x + width IS the rounded true right edge (same vertically),
1090
+ // so controls truly sharing an edge always read equal \u2014 per-field rounding could put them 1px apart.
1091
+ const x = Math.round(r.left), y = Math.round(r.top);
1089
1092
  return {
1090
- x: Math.round(r.x), y: Math.round(r.y),
1091
- width: Math.round(r.width), height: Math.round(r.height),
1093
+ x, y,
1094
+ width: Math.round(r.right) - x, height: Math.round(r.bottom) - y,
1092
1095
  viewport: { width: de.clientWidth, height: de.clientHeight }
1093
1096
  };
1094
1097
  };
package/dist/servers.js CHANGED
@@ -883,9 +883,12 @@ ${s}`}function Hd(t){let e=ur.filter(n=>t[n]).map(n=>i0(n,t[n]));return["---",`f
883
883
  const el = resolveTarget(t.role, t.name);
884
884
  const r = el.getBoundingClientRect();
885
885
  const de = document.scrollingElement || document.documentElement;
886
+ // Edges round, dimensions derive: x + width IS the rounded true right edge (same vertically),
887
+ // so controls truly sharing an edge always read equal \u2014 per-field rounding could put them 1px apart.
888
+ const x = Math.round(r.left), y = Math.round(r.top);
886
889
  return {
887
- x: Math.round(r.x), y: Math.round(r.y),
888
- width: Math.round(r.width), height: Math.round(r.height),
890
+ x, y,
891
+ width: Math.round(r.right) - x, height: Math.round(r.bottom) - y,
889
892
  viewport: { width: de.clientWidth, height: de.clientHeight }
890
893
  };
891
894
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typebulb",
3
- "version": "0.45.1",
3
+ "version": "0.45.2",
4
4
  "description": "Typebulb CLI to run single-file markdown apps called bulbs, either as standalone web apps or embedded in agent responses.",
5
5
  "keywords": [
6
6
  "bulb",