typebulb 0.48.0 → 0.49.0

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.
@@ -5,6 +5,7 @@ export * from './config.js';
5
5
  export * from './detection.js';
6
6
  export * from './chunks.js';
7
7
  export * from './slug.js';
8
+ export * from './mode.js';
8
9
  export * from './pageShell.js';
9
10
  export { escapeYamlString, unescapeYamlString } from './yaml.js';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
@@ -5,6 +5,7 @@ export * from './config.js';
5
5
  export * from './detection.js';
6
6
  export * from './chunks.js';
7
7
  export * from './slug.js';
8
+ export * from './mode.js';
8
9
  export * from './pageShell.js';
9
10
  export { escapeYamlString, unescapeYamlString } from './yaml.js';
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The `tb.mode` values, owned in one place (TB-Mode.md). Every producer emits mode as a
3
+ * *string* baked into a sandbox page, so a hand-typed copy compiles clean and fails only at
4
+ * runtime inside the frame; producers interpolate `MODE` instead. It lives in `format`
5
+ * because the client and the CLI both import `typebulb/format`, and runtime imports neither.
6
+ *
7
+ * Mode names the host surface, never the capability — `'local'` spans Restricted and Trusted.
8
+ * Bulbs ask for capability directly (`tb.aiAccess()`).
9
+ */
10
+ export declare const MODE: {
11
+ /** The user's machine, via the CLI. */
12
+ readonly local: "local";
13
+ /** typebulb.com's editor, in a frame beside the code. */
14
+ readonly ide: "ide";
15
+ /** The bulb's own page on typebulb.com. */
16
+ readonly published: "published";
17
+ /** Inline in an agent's transcript, rendered by the mirror (bulb-in-a-bulb). */
18
+ readonly inline: "inline";
19
+ };
20
+ export type TbMode = (typeof MODE)[keyof typeof MODE];
21
+ /** The union as it appears in the emitted `tb` typings — generated, so the `.d.ts` can't drift from MODE. */
22
+ export declare const modeUnion: string;
23
+ //# sourceMappingURL=mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../../format/src/mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,IAAI;IACf,uCAAuC;;IAEvC,yDAAyD;;IAEzD,2CAA2C;;IAE3C,gFAAgF;;CAExE,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,CAAC,CAAA;AAErD,6GAA6G;AAC7G,eAAO,MAAM,SAAS,EAAE,MAA2D,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The `tb.mode` values, owned in one place (TB-Mode.md). Every producer emits mode as a
3
+ * *string* baked into a sandbox page, so a hand-typed copy compiles clean and fails only at
4
+ * runtime inside the frame; producers interpolate `MODE` instead. It lives in `format`
5
+ * because the client and the CLI both import `typebulb/format`, and runtime imports neither.
6
+ *
7
+ * Mode names the host surface, never the capability — `'local'` spans Restricted and Trusted.
8
+ * Bulbs ask for capability directly (`tb.aiAccess()`).
9
+ */
10
+ export const MODE = {
11
+ /** The user's machine, via the CLI. */
12
+ local: 'local',
13
+ /** typebulb.com's editor, in a frame beside the code. */
14
+ ide: 'ide',
15
+ /** The bulb's own page on typebulb.com. */
16
+ published: 'published',
17
+ /** Inline in an agent's transcript, rendered by the mirror (bulb-in-a-bulb). */
18
+ inline: 'inline',
19
+ };
20
+ /** The union as it appears in the emitted `tb` typings — generated, so the `.d.ts` can't drift from MODE. */
21
+ export const modeUnion = Object.values(MODE).map(v => `'${v}'`).join(' | ');
22
+ //# sourceMappingURL=mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mode.js","sourceRoot":"","sources":["../../format/src/mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,uCAAuC;IACvC,KAAK,EAAE,OAAO;IACd,yDAAyD;IACzD,GAAG,EAAE,KAAK;IACV,2CAA2C;IAC3C,SAAS,EAAE,WAAW;IACtB,gFAAgF;IAChF,MAAM,EAAE,QAAQ;CACR,CAAA;AAIV,6GAA6G;AAC7G,MAAM,CAAC,MAAM,SAAS,GAAW,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA"}
@@ -12,9 +12,9 @@
12
12
  *
13
13
  * `body { display: flow-root }` makes body a block formatting context so a first/
14
14
  * last child's vertical margin (author's, or a UA default like `<h1>`'s) can't
15
- * collapse out through body — the embed auto-height reports `body.scrollHeight`
15
+ * collapse out through body — the inline bulb auto-height reports `body.scrollHeight`
16
16
  * (cli/bulb/template.ts), and an escaped margin sizes the frame short → clipped
17
- * content + premature scrollbar (TB-Agent-Mirror-Embed.md Invariant 3). Don't drop it.
17
+ * content + premature scrollbar (TB-Agent-Mirror-Inline.md Invariant 3). Don't drop it.
18
18
  *
19
19
  * `canvas { max-width: 100% }` keeps a canvas inside its container the way
20
20
  * responsive `img` does: a canvas's backing store is `devicePixelRatio`-scaled, so
@@ -26,8 +26,8 @@ export declare const baseResetStyle = " *, *::before, *::after { box-sizing:
26
26
  /** The definite-height chain, for pages whose frame has a definite height — the CLI's
27
27
  * standalone page and every typebulb.com context (all frame-sized iframes) — so a
28
28
  * fill bulb (`height: 100%` root) resolves against the window instead of collapsing
29
- * to zero. NEVER for a content-measured embed: there `body` must stay content-height
29
+ * to zero. NEVER for a content-measured inline bulb: there `body` must stay content-height
30
30
  * or the auto-height protocol's `body.scrollHeight` can no longer shrink the frame
31
- * (TB-Agent-Mirror-Embed.md). */
31
+ * (TB-Agent-Mirror-Inline.md). */
32
32
  export declare const pageHeightStyle = " html, body { height: 100%; }";
33
33
  //# sourceMappingURL=pageShell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pageShell.d.ts","sourceRoot":"","sources":["../../format/src/pageShell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;qFAgBqF;AACrF,eAAO,MAAM,cAAc,6SAI2B,CAAA;AAEtD;;;;;kCAKkC;AAClC,eAAO,MAAM,eAAe,qCAAqC,CAAA"}
1
+ {"version":3,"file":"pageShell.d.ts","sourceRoot":"","sources":["../../format/src/pageShell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;qFAgBqF;AACrF,eAAO,MAAM,cAAc,6SAI2B,CAAA;AAEtD;;;;;mCAKmC;AACnC,eAAO,MAAM,eAAe,qCAAqC,CAAA"}
@@ -12,9 +12,9 @@
12
12
  *
13
13
  * `body { display: flow-root }` makes body a block formatting context so a first/
14
14
  * last child's vertical margin (author's, or a UA default like `<h1>`'s) can't
15
- * collapse out through body — the embed auto-height reports `body.scrollHeight`
15
+ * collapse out through body — the inline bulb auto-height reports `body.scrollHeight`
16
16
  * (cli/bulb/template.ts), and an escaped margin sizes the frame short → clipped
17
- * content + premature scrollbar (TB-Agent-Mirror-Embed.md Invariant 3). Don't drop it.
17
+ * content + premature scrollbar (TB-Agent-Mirror-Inline.md Invariant 3). Don't drop it.
18
18
  *
19
19
  * `canvas { max-width: 100% }` keeps a canvas inside its container the way
20
20
  * responsive `img` does: a canvas's backing store is `devicePixelRatio`-scaled, so
@@ -30,8 +30,8 @@ export const baseResetStyle = ` *, *::before, *::after { box-sizing: border-b
30
30
  /** The definite-height chain, for pages whose frame has a definite height — the CLI's
31
31
  * standalone page and every typebulb.com context (all frame-sized iframes) — so a
32
32
  * fill bulb (`height: 100%` root) resolves against the window instead of collapsing
33
- * to zero. NEVER for a content-measured embed: there `body` must stay content-height
33
+ * to zero. NEVER for a content-measured inline bulb: there `body` must stay content-height
34
34
  * or the auto-height protocol's `body.scrollHeight` can no longer shrink the frame
35
- * (TB-Agent-Mirror-Embed.md). */
35
+ * (TB-Agent-Mirror-Inline.md). */
36
36
  export const pageHeightStyle = ` html, body { height: 100%; }`;
37
37
  //# sourceMappingURL=pageShell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pageShell.js","sourceRoot":"","sources":["../../format/src/pageShell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;qFAgBqF;AACrF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;sDAIwB,CAAA;AAEtD;;;;;kCAKkC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAA"}
1
+ {"version":3,"file":"pageShell.js","sourceRoot":"","sources":["../../format/src/pageShell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;qFAgBqF;AACrF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;sDAIwB,CAAA;AAEtD;;;;;mCAKmC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAA"}
@@ -25,7 +25,7 @@ export interface ParsedBulb {
25
25
  * closing fence — i.e. where the bulb's body ends. NOT end-of-content: trailing lines that set no block
26
26
  * (prose, a stray `---`) sit beyond it. Equals the line after the frontmatter when no block was captured.
27
27
  * Lets a caller slice a bulb out of surrounding prose without swallowing what follows it (see
28
- * `findEmbeddedBulbs`).
28
+ * `findUnfencedBulbs`).
29
29
  */
30
30
  bodyEndLine: number;
31
31
  }
@@ -46,13 +46,13 @@ export declare function validateBulbStructure(content: string): string[];
46
46
  /** A bulb found sitting "naked" in prose — frontmatter and blocks dumped straight into the text with no
47
47
  * enclosing ````bulb```` fence. `start`/`end` are the half-open `[start, end)` line range (0-based, into
48
48
  * `content.split('\n')`); `source` is that slice, ready to feed back to `parseBulb` or a renderer. */
49
- export interface EmbeddedBulb {
49
+ export interface UnfencedBulb {
50
50
  start: number;
51
51
  end: number;
52
52
  source: string;
53
53
  }
54
54
  /**
55
- * Find bulbs embedded unfenced in arbitrary prose. The normal path wraps a bulb in a ````bulb```` fence
55
+ * Find bulbs inline unfenced in arbitrary prose. The normal path wraps a bulb in a ````bulb```` fence
56
56
  * (and the mislabel-tolerant host promotes a fence whose body parses); but some non-SOTA models — Kimi
57
57
  * notably — skip the fence entirely and dump the raw frontmatter + blocks into the message, using `---`
58
58
  * thematic breaks as ad-hoc delimiters, so no fence token ever wraps the bulb. This scans for that.
@@ -61,10 +61,10 @@ export interface EmbeddedBulb {
61
61
  * mislabel tolerance leans on, so we anchor on a `---` line, run `parseBulb` from there, and accept it
62
62
  * only if it yields at least one real block. The extent is `parseBulb`'s own `bodyEndLine` (just past the
63
63
  * last captured block) — NOT end-of-text — so trailing prose after the bulb (Kimi's closing `---`, a
64
- * follow-up paragraph) stays prose instead of being swallowed into the embed. Returned spans are
64
+ * follow-up paragraph) stays prose instead of being swallowed into the inline bulb. Returned spans are
65
65
  * non-overlapping and in document order; the caller slices the surrounding prose around them.
66
66
  */
67
- export declare function findEmbeddedBulbs(content: string): EmbeddedBulb[];
67
+ export declare function findUnfencedBulbs(content: string): UnfencedBulb[];
68
68
  /** Convert a parsed bulb to a structured per-kind object (missing blocks become ''). */
69
69
  export declare function toBulbData(parsed: ParsedBulb): BulbData;
70
70
  //# sourceMappingURL=parse.d.ts.map
@@ -137,7 +137,7 @@ export function validateBulbStructure(content) {
137
137
  return parseBulb(content)?.warnings ?? [];
138
138
  }
139
139
  /**
140
- * Find bulbs embedded unfenced in arbitrary prose. The normal path wraps a bulb in a ````bulb```` fence
140
+ * Find bulbs inline unfenced in arbitrary prose. The normal path wraps a bulb in a ````bulb```` fence
141
141
  * (and the mislabel-tolerant host promotes a fence whose body parses); but some non-SOTA models — Kimi
142
142
  * notably — skip the fence entirely and dump the raw frontmatter + blocks into the message, using `---`
143
143
  * thematic breaks as ad-hoc delimiters, so no fence token ever wraps the bulb. This scans for that.
@@ -146,10 +146,10 @@ export function validateBulbStructure(content) {
146
146
  * mislabel tolerance leans on, so we anchor on a `---` line, run `parseBulb` from there, and accept it
147
147
  * only if it yields at least one real block. The extent is `parseBulb`'s own `bodyEndLine` (just past the
148
148
  * last captured block) — NOT end-of-text — so trailing prose after the bulb (Kimi's closing `---`, a
149
- * follow-up paragraph) stays prose instead of being swallowed into the embed. Returned spans are
149
+ * follow-up paragraph) stays prose instead of being swallowed into the inline bulb. Returned spans are
150
150
  * non-overlapping and in document order; the caller slices the surrounding prose around them.
151
151
  */
152
- export function findEmbeddedBulbs(content) {
152
+ export function findUnfencedBulbs(content) {
153
153
  const lines = content.split('\n');
154
154
  const found = [];
155
155
  let i = 0;