typebulb 0.47.2 → 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.
- package/README.md +42 -36
- package/SKILL.md +45 -39
- package/dist/agents/claude/client.js +197 -197
- package/dist/agents/claude/styles.css +1886 -1886
- package/dist/agents/codex/client.js +1912 -0
- package/dist/agents/codex/index.html +2 -0
- package/dist/agents/codex/styles.css +1887 -0
- package/dist/agents/codex/typebulb-inv.png +0 -0
- package/dist/agents/codex/typebulb.png +0 -0
- package/dist/agents/pi/client.js +198 -198
- package/dist/agents/pi/matchu-patchu.ts +1 -1
- package/dist/agents/pi/styles.css +1886 -1886
- package/dist/dts/tbTypings.d.ts +2 -2
- package/dist/dts/tbTypings.d.ts.map +1 -1
- package/dist/dts/tbTypings.js +265 -264
- package/dist/dts/tbTypings.js.map +1 -1
- package/dist/format/index.d.ts +1 -0
- package/dist/format/index.d.ts.map +1 -1
- package/dist/format/index.js +1 -0
- package/dist/format/index.js.map +1 -1
- package/dist/format/mode.d.ts +23 -0
- package/dist/format/mode.d.ts.map +1 -0
- package/dist/format/mode.js +22 -0
- package/dist/format/mode.js.map +1 -0
- package/dist/format/pageShell.d.ts +4 -4
- package/dist/format/pageShell.d.ts.map +1 -1
- package/dist/format/pageShell.js +4 -4
- package/dist/format/pageShell.js.map +1 -1
- package/dist/format/parse.d.ts +5 -5
- package/dist/format/parse.js +3 -3
- package/dist/index.js +325 -323
- package/dist/render.js +126 -126
- package/dist/servers.js +125 -125
- package/package.json +1 -1
package/dist/dts/tbTypings.d.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* TypeChecker, and the CLI's emitted typecheck dirs.
|
|
10
10
|
*/
|
|
11
11
|
/** Typebulb globals available in browser-side code (code.tsx). */
|
|
12
|
-
export declare const clientTbTypings = "\n/** A single streamed delta from `tb.ai.stream()`. Discriminated by `kind`. */\ntype AiChunk =\n | { kind: \"text\"; text: string }\n | { kind: \"reasoning\"; text: string };\n\n/** What backs `tb.ai`: the user's own keys, the quota-limited courtesy model, or nothing. */\ntype AiAccess = \"own\" | \"courtesy\" | \"none\";\n\n/**\n * Typebulb utilities namespace.\n * Type `tb.` to discover available helpers.\n */\ndeclare const tb: {\n /**\n * Get raw data chunk from the Data tab.\n * @param index - Chunk index (0-based). Separate chunks with 2 blank lines.\n */\n data(index: number): string;\n /**\n * Get data chunk parsed as JSON (handles JSON-ish with unquoted keys).\n * @param index - Chunk index (0-based)\n * @throws If chunk is not valid JSON/JSON-ish\n */\n json<T = unknown>(index: number): T;\n /**\n * Async value inspector for tensor-like objects.\n *\n * Materializes lazy values (like GPU tensors) and logs them with metadata.\n * Handles objects with `.js()`, `.data()`, `.array()`, `.arraySync()`, etc.\n *\n * @remarks\n * - Always use `await` - materialization may be async (GPU\u2192CPU readback)\n * - Large values are truncated (max 1000 elements)\n * - Promises are logged as `[Promise]` (not awaited - could hang)\n */\n dump(...args: any[]): Promise<void>;\n /**\n * Trigger inference to generate new insight data.\n *\n * Opens a confirmation modal showing the data to be analyzed, then streams\n * the inference result. On success, updates the insight so subsequent\n * `tb.insight()` calls return the new value.\n *\n * @param opts - Options for inference\n * @param opts.data - Data to pre-populate in the modal (string or array of strings). If omitted, modal opens with empty textarea for user to paste.\n * @returns Promise that resolves with the parsed insight JSON\n * @throws If inference is already in progress, or on network/parse/rate limit errors\n */\n infer<T = unknown>(opts?: { data?: string | string[] }): Promise<T>;\n /**\n * Get the current inference state.\n *\n * @returns 'idle' | 'running' | 'complete' | 'error'\n */\n inferenceState(): 'idle' | 'running' | 'complete' | 'error';\n /**\n * Set a data chunk for the next inference call.\n *\n * Use this to programmatically set data that will be sent when `tb.infer()` is called\n * without the `data` option.\n *\n * @param index - The chunk index (0-based)\n * @param content - The content for this chunk\n */\n setData(index: number, content: string): void;\n /**\n * Proxy a CDN URL through the sandbox origin for Web Worker/WASM same-origin loading.\n *\n * In the sandbox, prepends `/proxy/` so the URL is served from the same origin.\n * Outside the sandbox (exported HTML, CLI), returns the URL unchanged.\n *\n * @param url - Full HTTPS URL to an allowlisted CDN (esm.sh, unpkg.com, cdn.jsdelivr.net, cdnjs.cloudflare.com)\n * @returns The proxied URL (sandbox) or the original URL (standalone/CLI)\n */\n proxy(url: string): string;\n /**\n * Copy text to clipboard.\n * Must be called synchronously within a user gesture (click/keydown).\n * @returns true if successful, false otherwise\n */\n copy(text: string): Promise<boolean>;\n /**\n * Get the canonical URL of this bulb.\n *\n * Returns the parent typebulb.com URL (including path, query, and `#tb=` fragment),\n * resolving correctly from inside the cross-origin sandbox iframe.\n * Use this instead of `location.href` or `document.referrer`.\n *\n * @returns The full canonical URL\n */\n url(): Promise<string>;\n /**\n * Get the insight data produced by the inference layer.\n *\n * Returns the parsed JSON from insight.json, populated by the inference LLM.\n * Use a type parameter to get typed access to the insight data.\n *\n * @returns The parsed insight JSON, or undefined if no insight is available\n */\n insight<T = unknown>(): T | undefined;\n /**\n * Print to the CLI's stdout \u2014 the bulb's log channel, read back with `typebulb logs <file>`.\n *\n * Ungated: needs no `server.ts` block and no `--trust`, so a Restricted client-only bulb can\n * instrument itself. Args cross to the CLI as JSON; where no CLI serves the page (web, embedded,\n * or a transport failure) it falls back to the browser console. Works in `server.ts` too (same\n * as `console.log` there).\n */\n log(...args: any[]): void;\n /**\n * Server-side function proxy.\n *\n * In the CLI, calls exported functions from the `**server.ts**` section.\n *\n * A normal export is awaited for its result (`await tb.server.fn()`). An `async function*`\n * export streams: `for await (const chunk of tb.server.gen())`. The call object supports both;\n * break the `for await` to cancel and tear down the server generator.\n */\n server: Record<string, (...args: any[]) => Promise<any> & AsyncIterable<any>>;\n /**\n * Subscribe to a value pushed from the terminal via `typebulb send <file> [message]`.\n *\n * The dual of `tb.log` (data out): a value sent *in* from the CLI, no `--trust` required.\n * Use it to start expensive work on demand instead of on load \u2014 e.g. `tb.onMessage(() => start())`\n * \u2014 so hot reloads don't re-trigger it while you edit, and an agent kicks off one run when ready.\n *\n * The message is the JSON-parsed value of what `send` was given (or the raw string if it isn't\n * JSON; `undefined` for a bare `typebulb send <file>`). A non-`undefined` return value (awaited)\n * becomes the reply `send --wait` prints on stdout \u2014 JSON-serializable, at most one handler\n * replying \u2014 the structured read-back for self-tests. Returns an unsubscribe function. Inert in\n * an embedded bulb (no sender) \u2014 the handler is registered but never fires.\n *\n * @param handler - Called with each pushed message; may return a JSON-serializable reply.\n * @returns An unsubscribe function.\n */\n onMessage(handler: (message: any) => unknown): () => void;\n /**\n * General-purpose AI call. `tb.ai(opts)` resolves with the full text; `tb.ai.stream(opts)`\n * returns an async iterable of {@link AiChunk} deltas you consume with `for await`.\n *\n * @returns Promise resolving to { text: string }\n * @throws On rate limit, network error, or provider error\n */\n ai: {\n (options: {\n messages: Array<{ role: \"user\" | \"assistant\"; content: string }>;\n system?: string;\n /** Reasoning effort hint: 0=minimal, 1=low, 2=med, 3=high. Mapped to each provider's native mechanism (OpenAI/OpenRouter reasoning effort, Gemini thinking budget, Anthropic adaptive thinking). 0 minimizes reasoning \u2014 a floor, not a guaranteed \"off\": some models still think a little at 0, and adaptive models already self-skip at 1 (low). Level 1 (low) is the sensible default for most work; reach for 0 only when you truly want minimal deliberation. Omit for the model's own default. */\n effort?: 0 | 1 | 2 | 3;\n provider?: string;\n model?: string;\n /** Enable/disable web search. Default: on for BYOK, always off for free model. */\n webSearch?: boolean;\n /** Abort the request. On abort the promise rejects / the stream ends. */\n signal?: AbortSignal;\n }): Promise<{ text: string }>;\n /**\n * Streaming counterpart of `tb.ai()`. Yields `{ kind: \"text\" | \"reasoning\", text }` deltas\n * as they arrive; break the loop (or abort `signal`) to cancel and stop the upstream.\n *\n * `kind: \"reasoning\"` deltas only arrive when you pass `effort: 1-3` AND use a\n * thinking-capable model; otherwise the stream is `text`-only.\n *\n * @example\n * let answer = \"\";\n * for await (const c of tb.ai.stream({ messages })) {\n * if (c.kind === \"text\") answer += c.text;\n * }\n */\n stream(options: {\n messages: Array<{ role: \"user\" | \"assistant\"; content: string }>;\n system?: string;\n /** Reasoning effort hint: 0=minimal, 1=low, 2=med, 3=high. Mapped to each provider's native mechanism (OpenAI/OpenRouter reasoning effort, Gemini thinking budget, Anthropic adaptive thinking). 0 minimizes reasoning \u2014 a floor, not a guaranteed \"off\": some models still think a little at 0, and adaptive models already self-skip at 1 (low). Level 1 (low) is the sensible default for most work; reach for 0 only when you truly want minimal deliberation. Omit for the model's own default. */\n effort?: 0 | 1 | 2 | 3;\n provider?: string;\n model?: string;\n /** Enable/disable web search. Default: on for BYOK, always off for free model. */\n webSearch?: boolean;\n /** Abort the request. On abort the promise rejects / the stream ends. */\n signal?: AbortSignal;\n }): AsyncIterable<AiChunk>;\n };\n /**\n * Local filesystem access (CLI only).\n *\n * Relative paths resolve against the bulb's folder (`tb.dir` \u2014\n * `<bulb-dir>/<filename-stem>/`, created on demand), so\n * `tb.fs.write('results.json')` lands beside the bulb. `../` reaches sibling\n * bulbs' folders; everything stays confined to the project (the launch cwd).\n * Throws in editor/published mode.\n */\n fs: {\n /** Read a file as UTF-8 text. Throws if the file is not valid UTF-8 \u2014 use readBytes for binary. */\n read(path: string): Promise<string>;\n /** Read a file as raw bytes. */\n readBytes(path: string): Promise<Uint8Array>;\n /** Write text or raw bytes to a file. Creates parent directories if needed. */\n write(path: string, content: string | Uint8Array): Promise<boolean>;\n };\n /**\n * The bulb's folder \u2014 absolute path to `<bulb-dir>/<filename-stem>/`\n * (or its `batches/<name>/` folder when the run is scoped with `--batch`).\n *\n * For interop only (handing a path to `server.ts` or a spawned tool):\n * `tb.fs` already resolves relative paths against it, so bulb code writing\n * its own files never needs it. CLI only \u2014 throws in editor/published/embedded mode.\n */\n readonly dir: string;\n /**\n * Returns AI models available to the current user.\n * Models are filtered by the user's configured API keys.\n * If no keys are configured, returns only the courtesy model.\n */\n models(): Promise<Array<{\n /** Provider protocol: \"anthropic\", \"openai\", \"gemini\", \"openrouter\" */\n provider: string;\n /** Model identifier, e.g. \"claude-sonnet-4-6\" */\n name: string;\n /** Human-readable display name, e.g. \"Sonnet 4.6\" */\n friendlyName: string;\n /** Provider display name, e.g. \"Anthropic\" */\n providerName: string;\n /** True on the .env-configured default model (TB_AI_PROVIDER + TB_AI_MODEL); absent otherwise */\n default?: boolean;\n }>>;\n /**\n * What backs `tb.ai` right now:\n *\n * - `'own'` \u2014 the user's own API keys (or their own local model server)\n * - `'courtesy'` \u2014 the quota-limited courtesy model, fine for a call or two\n * - `'none'` \u2014 no AI at all (the CLI with no keys, an embedded bulb)\n *\n * A bulb making many AI calls should show a \"use your own keys\" notice\n * instead of running unless this is `'own'`. Never derive it from\n * `tb.mode` or the length of `tb.models()` \u2014 which hosts offer a courtesy\n * model is the host's business and changes without your bulb changing.\n */\n aiAccess(): Promise<AiAccess>;\n /**\n * The bulb's theme override (`<html data-theme>`).\n *\n * - Get: the current override \u2014 `'dark'` | `'light'`, or `undefined` when\n * following the OS preference.\n * - Set `'dark'`/`'light'` to force and persist it (per-bulb); set\n * `undefined` to clear the override and follow the OS again.\n *\n * Drives `<html data-theme>`, so render off `html[data-theme=\"\u2026\"]` selectors\n * (or observe the attribute) rather than reading `tb.theme`.\n */\n theme: 'light' | 'dark' | undefined;\n /**\n * The mode this bulb is running in.\n *\n * - `'local'` \u2014 Running via the typebulb CLI\n * - `'editor'` \u2014 Running in the typebulb.com editor\n * - `'published'` \u2014 Running as a published/standalone bulb on typebulb.com\n * - `'embedded'` \u2014 Running as a bulb embedded inside another bulb (sandboxed,\n * client-only: AI, filesystem, and server RPC are unavailable)\n */\n mode: 'local' | 'editor' | 'published' | 'embedded';\n};\n";
|
|
12
|
+
export declare const clientTbTypings: string;
|
|
13
13
|
/** Typebulb globals available in Node-side code (server.ts).
|
|
14
14
|
* Only what carries a bulb-specific rule Node can't know — tb.ai, tb.fs, tb.dir (TB-FS.md);
|
|
15
15
|
* plus the tb.log uniformity exception (serverTb.ts). The browser-only helpers are intentionally
|
|
16
16
|
* absent. Must match serverTb.ts's runtime surface. */
|
|
17
|
-
export declare const serverTbTypings
|
|
17
|
+
export declare const serverTbTypings: string;
|
|
18
18
|
//# sourceMappingURL=tbTypings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tbTypings.d.ts","sourceRoot":"","sources":["../../dts/src/tbTypings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"tbTypings.d.ts","sourceRoot":"","sources":["../../dts/src/tbTypings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyRH,kEAAkE;AAClE,eAAO,MAAM,eAAe,QAO3B,CAAA;AASD;;;wDAGwD;AACxD,eAAO,MAAM,eAAe,QAO3B,CAAA"}
|
package/dist/dts/tbTypings.js
CHANGED
|
@@ -8,293 +8,294 @@
|
|
|
8
8
|
* Single source of truth for Monaco IntelliSense (web client), the standalone
|
|
9
9
|
* TypeChecker, and the CLI's emitted typecheck dirs.
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
21
|
-
|
|
11
|
+
import { modeUnion } from 'typebulb/format';
|
|
12
|
+
const dataAndJson = `
|
|
13
|
+
/**
|
|
14
|
+
* Get raw data chunk from the Data tab.
|
|
15
|
+
* @param index - Chunk index (0-based). Separate chunks with 2 blank lines.
|
|
16
|
+
*/
|
|
17
|
+
data(index: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get data chunk parsed as JSON (handles JSON-ish with unquoted keys).
|
|
20
|
+
* @param index - Chunk index (0-based)
|
|
21
|
+
* @throws If chunk is not valid JSON/JSON-ish
|
|
22
|
+
*/
|
|
22
23
|
json<T = unknown>(index: number): T;`;
|
|
23
|
-
const insight = `
|
|
24
|
-
/**
|
|
25
|
-
* Get the insight data produced by the inference layer.
|
|
26
|
-
*
|
|
27
|
-
* Returns the parsed JSON from insight.json, populated by the inference LLM.
|
|
28
|
-
* Use a type parameter to get typed access to the insight data.
|
|
29
|
-
*
|
|
30
|
-
* @returns The parsed insight JSON, or undefined if no insight is available
|
|
31
|
-
*/
|
|
24
|
+
const insight = `
|
|
25
|
+
/**
|
|
26
|
+
* Get the insight data produced by the inference layer.
|
|
27
|
+
*
|
|
28
|
+
* Returns the parsed JSON from insight.json, populated by the inference LLM.
|
|
29
|
+
* Use a type parameter to get typed access to the insight data.
|
|
30
|
+
*
|
|
31
|
+
* @returns The parsed insight JSON, or undefined if no insight is available
|
|
32
|
+
*/
|
|
32
33
|
insight<T = unknown>(): T | undefined;`;
|
|
33
34
|
// One options shape, reused by tb.ai() and tb.ai.stream().
|
|
34
|
-
const aiOptions = `options: {
|
|
35
|
-
messages: Array<{ role: "user" | "assistant"; content: string }>;
|
|
36
|
-
system?: string;
|
|
37
|
-
/** Reasoning effort hint: 0=minimal, 1=low, 2=med, 3=high. Mapped to each provider's native mechanism (OpenAI/OpenRouter reasoning effort, Gemini thinking budget, Anthropic adaptive thinking). 0 minimizes reasoning — a floor, not a guaranteed "off": some models still think a little at 0, and adaptive models already self-skip at 1 (low). Level 1 (low) is the sensible default for most work; reach for 0 only when you truly want minimal deliberation. Omit for the model's own default. */
|
|
38
|
-
effort?: 0 | 1 | 2 | 3;
|
|
39
|
-
provider?: string;
|
|
40
|
-
model?: string;
|
|
41
|
-
/** Enable/disable web search. Default: on for BYOK, always off for free model. */
|
|
42
|
-
webSearch?: boolean;
|
|
43
|
-
/** Abort the request. On abort the promise rejects / the stream ends. */
|
|
44
|
-
signal?: AbortSignal;
|
|
35
|
+
const aiOptions = `options: {
|
|
36
|
+
messages: Array<{ role: "user" | "assistant"; content: string }>;
|
|
37
|
+
system?: string;
|
|
38
|
+
/** Reasoning effort hint: 0=minimal, 1=low, 2=med, 3=high. Mapped to each provider's native mechanism (OpenAI/OpenRouter reasoning effort, Gemini thinking budget, Anthropic adaptive thinking). 0 minimizes reasoning — a floor, not a guaranteed "off": some models still think a little at 0, and adaptive models already self-skip at 1 (low). Level 1 (low) is the sensible default for most work; reach for 0 only when you truly want minimal deliberation. Omit for the model's own default. */
|
|
39
|
+
effort?: 0 | 1 | 2 | 3;
|
|
40
|
+
provider?: string;
|
|
41
|
+
model?: string;
|
|
42
|
+
/** Enable/disable web search. Default: on for BYOK, always off for free model. */
|
|
43
|
+
webSearch?: boolean;
|
|
44
|
+
/** Abort the request. On abort the promise rejects / the stream ends. */
|
|
45
|
+
signal?: AbortSignal;
|
|
45
46
|
}`;
|
|
46
47
|
/** A streamed delta from \`tb.ai.stream()\` — a discriminated union, exactly one kind per chunk. */
|
|
47
|
-
const aiChunkType = `
|
|
48
|
-
/** A single streamed delta from \`tb.ai.stream()\`. Discriminated by \`kind\`. */
|
|
49
|
-
type AiChunk =
|
|
50
|
-
| { kind: "text"; text: string }
|
|
51
|
-
| { kind: "reasoning"; text: string };
|
|
48
|
+
const aiChunkType = `
|
|
49
|
+
/** A single streamed delta from \`tb.ai.stream()\`. Discriminated by \`kind\`. */
|
|
50
|
+
type AiChunk =
|
|
51
|
+
| { kind: "text"; text: string }
|
|
52
|
+
| { kind: "reasoning"; text: string };
|
|
52
53
|
`;
|
|
53
54
|
/** What \`tb.aiAccess()\` answers. Named so bulbs can hold it in state without respelling the union. */
|
|
54
|
-
const aiAccessType = `
|
|
55
|
-
/** What backs \`tb.ai\`: the user's own keys, the quota-limited courtesy model, or nothing. */
|
|
56
|
-
type AiAccess = "own" | "courtesy" | "none";
|
|
55
|
+
const aiAccessType = `
|
|
56
|
+
/** What backs \`tb.ai\`: the user's own keys, the quota-limited courtesy model, or nothing. */
|
|
57
|
+
type AiAccess = "own" | "courtesy" | "none";
|
|
57
58
|
`;
|
|
58
|
-
const ai = `
|
|
59
|
-
/**
|
|
60
|
-
* General-purpose AI call. \`tb.ai(opts)\` resolves with the full text; \`tb.ai.stream(opts)\`
|
|
61
|
-
* returns an async iterable of {@link AiChunk} deltas you consume with \`for await\`.
|
|
62
|
-
*
|
|
63
|
-
* @returns Promise resolving to { text: string }
|
|
64
|
-
* @throws On rate limit, network error, or provider error
|
|
65
|
-
*/
|
|
66
|
-
ai: {
|
|
67
|
-
(${aiOptions}): Promise<{ text: string }>;
|
|
68
|
-
/**
|
|
69
|
-
* Streaming counterpart of \`tb.ai()\`. Yields \`{ kind: "text" | "reasoning", text }\` deltas
|
|
70
|
-
* as they arrive; break the loop (or abort \`signal\`) to cancel and stop the upstream.
|
|
71
|
-
*
|
|
72
|
-
* \`kind: "reasoning"\` deltas only arrive when you pass \`effort: 1-3\` AND use a
|
|
73
|
-
* thinking-capable model; otherwise the stream is \`text\`-only.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* let answer = "";
|
|
77
|
-
* for await (const c of tb.ai.stream({ messages })) {
|
|
78
|
-
* if (c.kind === "text") answer += c.text;
|
|
79
|
-
* }
|
|
80
|
-
*/
|
|
81
|
-
stream(${aiOptions}): AsyncIterable<AiChunk>;
|
|
59
|
+
const ai = `
|
|
60
|
+
/**
|
|
61
|
+
* General-purpose AI call. \`tb.ai(opts)\` resolves with the full text; \`tb.ai.stream(opts)\`
|
|
62
|
+
* returns an async iterable of {@link AiChunk} deltas you consume with \`for await\`.
|
|
63
|
+
*
|
|
64
|
+
* @returns Promise resolving to { text: string }
|
|
65
|
+
* @throws On rate limit, network error, or provider error
|
|
66
|
+
*/
|
|
67
|
+
ai: {
|
|
68
|
+
(${aiOptions}): Promise<{ text: string }>;
|
|
69
|
+
/**
|
|
70
|
+
* Streaming counterpart of \`tb.ai()\`. Yields \`{ kind: "text" | "reasoning", text }\` deltas
|
|
71
|
+
* as they arrive; break the loop (or abort \`signal\`) to cancel and stop the upstream.
|
|
72
|
+
*
|
|
73
|
+
* \`kind: "reasoning"\` deltas only arrive when you pass \`effort: 1-3\` AND use a
|
|
74
|
+
* thinking-capable model; otherwise the stream is \`text\`-only.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* let answer = "";
|
|
78
|
+
* for await (const c of tb.ai.stream({ messages })) {
|
|
79
|
+
* if (c.kind === "text") answer += c.text;
|
|
80
|
+
* }
|
|
81
|
+
*/
|
|
82
|
+
stream(${aiOptions}): AsyncIterable<AiChunk>;
|
|
82
83
|
};`;
|
|
83
|
-
const models = `
|
|
84
|
-
/**
|
|
85
|
-
* Returns AI models available to the current user.
|
|
86
|
-
* Models are filtered by the user's configured API keys.
|
|
87
|
-
* If no keys are configured, returns only the courtesy model.
|
|
88
|
-
*/
|
|
89
|
-
models(): Promise<Array<{
|
|
90
|
-
/** Provider protocol: "anthropic", "openai", "gemini", "openrouter" */
|
|
91
|
-
provider: string;
|
|
92
|
-
/** Model identifier, e.g. "claude-sonnet-4-6" */
|
|
93
|
-
name: string;
|
|
94
|
-
/** Human-readable display name, e.g. "Sonnet 4.6" */
|
|
95
|
-
friendlyName: string;
|
|
96
|
-
/** Provider display name, e.g. "Anthropic" */
|
|
97
|
-
providerName: string;
|
|
98
|
-
/** True on the .env-configured default model (TB_AI_PROVIDER + TB_AI_MODEL); absent otherwise */
|
|
99
|
-
default?: boolean;
|
|
100
|
-
}>>;
|
|
101
|
-
/**
|
|
102
|
-
* What backs \`tb.ai\` right now:
|
|
103
|
-
*
|
|
104
|
-
* - \`'own'\` — the user's own API keys (or their own local model server)
|
|
105
|
-
* - \`'courtesy'\` — the quota-limited courtesy model, fine for a call or two
|
|
106
|
-
* - \`'none'\` — no AI at all (the CLI with no keys, an
|
|
107
|
-
*
|
|
108
|
-
* A bulb making many AI calls should show a "use your own keys" notice
|
|
109
|
-
* instead of running unless this is \`'own'\`. Never derive it from
|
|
110
|
-
* \`tb.mode\` or the length of \`tb.models()\` — which hosts offer a courtesy
|
|
111
|
-
* model is the host's business and changes without your bulb changing.
|
|
112
|
-
*/
|
|
84
|
+
const models = `
|
|
85
|
+
/**
|
|
86
|
+
* Returns AI models available to the current user.
|
|
87
|
+
* Models are filtered by the user's configured API keys.
|
|
88
|
+
* If no keys are configured, returns only the courtesy model.
|
|
89
|
+
*/
|
|
90
|
+
models(): Promise<Array<{
|
|
91
|
+
/** Provider protocol: "anthropic", "openai", "gemini", "openrouter" */
|
|
92
|
+
provider: string;
|
|
93
|
+
/** Model identifier, e.g. "claude-sonnet-4-6" */
|
|
94
|
+
name: string;
|
|
95
|
+
/** Human-readable display name, e.g. "Sonnet 4.6" */
|
|
96
|
+
friendlyName: string;
|
|
97
|
+
/** Provider display name, e.g. "Anthropic" */
|
|
98
|
+
providerName: string;
|
|
99
|
+
/** True on the .env-configured default model (TB_AI_PROVIDER + TB_AI_MODEL); absent otherwise */
|
|
100
|
+
default?: boolean;
|
|
101
|
+
}>>;
|
|
102
|
+
/**
|
|
103
|
+
* What backs \`tb.ai\` right now:
|
|
104
|
+
*
|
|
105
|
+
* - \`'own'\` — the user's own API keys (or their own local model server)
|
|
106
|
+
* - \`'courtesy'\` — the quota-limited courtesy model, fine for a call or two
|
|
107
|
+
* - \`'none'\` — no AI at all (the CLI with no keys, an inline bulb)
|
|
108
|
+
*
|
|
109
|
+
* A bulb making many AI calls should show a "use your own keys" notice
|
|
110
|
+
* instead of running unless this is \`'own'\`. Never derive it from
|
|
111
|
+
* \`tb.mode\` or the length of \`tb.models()\` — which hosts offer a courtesy
|
|
112
|
+
* model is the host's business and changes without your bulb changing.
|
|
113
|
+
*/
|
|
113
114
|
aiAccess(): Promise<AiAccess>;`;
|
|
114
|
-
const theme = `
|
|
115
|
-
/**
|
|
116
|
-
* The bulb's theme override (\`<html data-theme>\`).
|
|
117
|
-
*
|
|
118
|
-
* - Get: the current override — \`'dark'\` | \`'light'\`, or \`undefined\` when
|
|
119
|
-
* following the OS preference.
|
|
120
|
-
* - Set \`'dark'\`/\`'light'\` to force and persist it (per-bulb); set
|
|
121
|
-
* \`undefined\` to clear the override and follow the OS again.
|
|
122
|
-
*
|
|
123
|
-
* Drives \`<html data-theme>\`, so render off \`html[data-theme="…"]\` selectors
|
|
124
|
-
* (or observe the attribute) rather than reading \`tb.theme\`.
|
|
125
|
-
*/
|
|
115
|
+
const theme = `
|
|
116
|
+
/**
|
|
117
|
+
* The bulb's theme override (\`<html data-theme>\`).
|
|
118
|
+
*
|
|
119
|
+
* - Get: the current override — \`'dark'\` | \`'light'\`, or \`undefined\` when
|
|
120
|
+
* following the OS preference.
|
|
121
|
+
* - Set \`'dark'\`/\`'light'\` to force and persist it (per-bulb); set
|
|
122
|
+
* \`undefined\` to clear the override and follow the OS again.
|
|
123
|
+
*
|
|
124
|
+
* Drives \`<html data-theme>\`, so render off \`html[data-theme="…"]\` selectors
|
|
125
|
+
* (or observe the attribute) rather than reading \`tb.theme\`.
|
|
126
|
+
*/
|
|
126
127
|
theme: 'light' | 'dark' | undefined;`;
|
|
127
|
-
const mode = `
|
|
128
|
-
/**
|
|
129
|
-
* The mode this bulb is running in.
|
|
130
|
-
*
|
|
131
|
-
* - \`'local'\` — Running via the typebulb CLI
|
|
132
|
-
* - \`'
|
|
133
|
-
* - \`'published'\` — Running as a published/standalone bulb on typebulb.com
|
|
134
|
-
* - \`'
|
|
135
|
-
* client-only: AI, filesystem, and server RPC are unavailable)
|
|
136
|
-
*/
|
|
137
|
-
mode:
|
|
138
|
-
const fs = `
|
|
139
|
-
/**
|
|
140
|
-
* Local filesystem access (CLI only).
|
|
141
|
-
*
|
|
142
|
-
* Relative paths resolve against the bulb's folder (\`tb.dir\` —
|
|
143
|
-
* \`<bulb-dir>/<filename-stem>/\`, created on demand), so
|
|
144
|
-
* \`tb.fs.write('results.json')\` lands beside the bulb. \`../\` reaches sibling
|
|
145
|
-
* bulbs' folders; everything stays confined to the project (the launch cwd).
|
|
146
|
-
* Throws in
|
|
147
|
-
*/
|
|
148
|
-
fs: {
|
|
149
|
-
/** Read a file as UTF-8 text. Throws if the file is not valid UTF-8 — use readBytes for binary. */
|
|
150
|
-
read(path: string): Promise<string>;
|
|
151
|
-
/** Read a file as raw bytes. */
|
|
152
|
-
readBytes(path: string): Promise<Uint8Array>;
|
|
153
|
-
/** Write text or raw bytes to a file. Creates parent directories if needed. */
|
|
154
|
-
write(path: string, content: string | Uint8Array): Promise<boolean>;
|
|
128
|
+
const mode = `
|
|
129
|
+
/**
|
|
130
|
+
* The mode this bulb is running in.
|
|
131
|
+
*
|
|
132
|
+
* - \`'local'\` — Running via the typebulb CLI
|
|
133
|
+
* - \`'ide'\` — Running in the typebulb.com editor
|
|
134
|
+
* - \`'published'\` — Running as a published/standalone bulb on typebulb.com
|
|
135
|
+
* - \`'inline'\` — Running inline in an agent's transcript, rendered by the mirror
|
|
136
|
+
* (sandboxed, client-only: AI, filesystem, and server RPC are unavailable)
|
|
137
|
+
*/
|
|
138
|
+
mode: ${modeUnion};`;
|
|
139
|
+
const fs = `
|
|
140
|
+
/**
|
|
141
|
+
* Local filesystem access (CLI only).
|
|
142
|
+
*
|
|
143
|
+
* Relative paths resolve against the bulb's folder (\`tb.dir\` —
|
|
144
|
+
* \`<bulb-dir>/<filename-stem>/\`, created on demand), so
|
|
145
|
+
* \`tb.fs.write('results.json')\` lands beside the bulb. \`../\` reaches sibling
|
|
146
|
+
* bulbs' folders; everything stays confined to the project (the launch cwd).
|
|
147
|
+
* Throws in ide/published mode.
|
|
148
|
+
*/
|
|
149
|
+
fs: {
|
|
150
|
+
/** Read a file as UTF-8 text. Throws if the file is not valid UTF-8 — use readBytes for binary. */
|
|
151
|
+
read(path: string): Promise<string>;
|
|
152
|
+
/** Read a file as raw bytes. */
|
|
153
|
+
readBytes(path: string): Promise<Uint8Array>;
|
|
154
|
+
/** Write text or raw bytes to a file. Creates parent directories if needed. */
|
|
155
|
+
write(path: string, content: string | Uint8Array): Promise<boolean>;
|
|
155
156
|
};`;
|
|
156
|
-
const dir = `
|
|
157
|
-
/**
|
|
158
|
-
* The bulb's folder — absolute path to \`<bulb-dir>/<filename-stem>/\`
|
|
159
|
-
* (or its \`batches/<name>/\` folder when the run is scoped with \`--batch\`).
|
|
160
|
-
*
|
|
161
|
-
* For interop only (handing a path to \`server.ts\` or a spawned tool):
|
|
162
|
-
* \`tb.fs\` already resolves relative paths against it, so bulb code writing
|
|
163
|
-
* its own files never needs it. CLI only — throws in
|
|
164
|
-
*/
|
|
157
|
+
const dir = `
|
|
158
|
+
/**
|
|
159
|
+
* The bulb's folder — absolute path to \`<bulb-dir>/<filename-stem>/\`
|
|
160
|
+
* (or its \`batches/<name>/\` folder when the run is scoped with \`--batch\`).
|
|
161
|
+
*
|
|
162
|
+
* For interop only (handing a path to \`server.ts\` or a spawned tool):
|
|
163
|
+
* \`tb.fs\` already resolves relative paths against it, so bulb code writing
|
|
164
|
+
* its own files never needs it. CLI only — throws in ide/published/inline mode.
|
|
165
|
+
*/
|
|
165
166
|
readonly dir: string;`;
|
|
166
|
-
const clientOnlyMembers = `
|
|
167
|
-
/**
|
|
168
|
-
* Async value inspector for tensor-like objects.
|
|
169
|
-
*
|
|
170
|
-
* Materializes lazy values (like GPU tensors) and logs them with metadata.
|
|
171
|
-
* Handles objects with \`.js()\`, \`.data()\`, \`.array()\`, \`.arraySync()\`, etc.
|
|
172
|
-
*
|
|
173
|
-
* @remarks
|
|
174
|
-
* - Always use \`await\` - materialization may be async (GPU→CPU readback)
|
|
175
|
-
* - Large values are truncated (max 1000 elements)
|
|
176
|
-
* - Promises are logged as \`[Promise]\` (not awaited - could hang)
|
|
177
|
-
*/
|
|
178
|
-
dump(...args: any[]): Promise<void>;
|
|
179
|
-
/**
|
|
180
|
-
* Trigger inference to generate new insight data.
|
|
181
|
-
*
|
|
182
|
-
* Opens a confirmation modal showing the data to be analyzed, then streams
|
|
183
|
-
* the inference result. On success, updates the insight so subsequent
|
|
184
|
-
* \`tb.insight()\` calls return the new value.
|
|
185
|
-
*
|
|
186
|
-
* @param opts - Options for inference
|
|
187
|
-
* @param opts.data - Data to pre-populate in the modal (string or array of strings). If omitted, modal opens with empty textarea for user to paste.
|
|
188
|
-
* @returns Promise that resolves with the parsed insight JSON
|
|
189
|
-
* @throws If inference is already in progress, or on network/parse/rate limit errors
|
|
190
|
-
*/
|
|
191
|
-
infer<T = unknown>(opts?: { data?: string | string[] }): Promise<T>;
|
|
192
|
-
/**
|
|
193
|
-
* Get the current inference state.
|
|
194
|
-
*
|
|
195
|
-
* @returns 'idle' | 'running' | 'complete' | 'error'
|
|
196
|
-
*/
|
|
197
|
-
inferenceState(): 'idle' | 'running' | 'complete' | 'error';
|
|
198
|
-
/**
|
|
199
|
-
* Set a data chunk for the next inference call.
|
|
200
|
-
*
|
|
201
|
-
* Use this to programmatically set data that will be sent when \`tb.infer()\` is called
|
|
202
|
-
* without the \`data\` option.
|
|
203
|
-
*
|
|
204
|
-
* @param index - The chunk index (0-based)
|
|
205
|
-
* @param content - The content for this chunk
|
|
206
|
-
*/
|
|
207
|
-
setData(index: number, content: string): void;
|
|
208
|
-
/**
|
|
209
|
-
* Proxy a CDN URL through the sandbox origin for Web Worker/WASM same-origin loading.
|
|
210
|
-
*
|
|
211
|
-
* In the sandbox, prepends \`/proxy/\` so the URL is served from the same origin.
|
|
212
|
-
* Outside the sandbox (exported HTML, CLI), returns the URL unchanged.
|
|
213
|
-
*
|
|
214
|
-
* @param url - Full HTTPS URL to an allowlisted CDN (esm.sh, unpkg.com, cdn.jsdelivr.net, cdnjs.cloudflare.com)
|
|
215
|
-
* @returns The proxied URL (sandbox) or the original URL (standalone/CLI)
|
|
216
|
-
*/
|
|
217
|
-
proxy(url: string): string;
|
|
218
|
-
/**
|
|
219
|
-
* Copy text to clipboard.
|
|
220
|
-
* Must be called synchronously within a user gesture (click/keydown).
|
|
221
|
-
* @returns true if successful, false otherwise
|
|
222
|
-
*/
|
|
223
|
-
copy(text: string): Promise<boolean>;
|
|
224
|
-
/**
|
|
225
|
-
* Get the canonical URL of this bulb.
|
|
226
|
-
*
|
|
227
|
-
* Returns the parent typebulb.com URL (including path, query, and \`#tb=\` fragment),
|
|
228
|
-
* resolving correctly from inside the cross-origin sandbox iframe.
|
|
229
|
-
* Use this instead of \`location.href\` or \`document.referrer\`.
|
|
230
|
-
*
|
|
231
|
-
* @returns The full canonical URL
|
|
232
|
-
*/
|
|
167
|
+
const clientOnlyMembers = `
|
|
168
|
+
/**
|
|
169
|
+
* Async value inspector for tensor-like objects.
|
|
170
|
+
*
|
|
171
|
+
* Materializes lazy values (like GPU tensors) and logs them with metadata.
|
|
172
|
+
* Handles objects with \`.js()\`, \`.data()\`, \`.array()\`, \`.arraySync()\`, etc.
|
|
173
|
+
*
|
|
174
|
+
* @remarks
|
|
175
|
+
* - Always use \`await\` - materialization may be async (GPU→CPU readback)
|
|
176
|
+
* - Large values are truncated (max 1000 elements)
|
|
177
|
+
* - Promises are logged as \`[Promise]\` (not awaited - could hang)
|
|
178
|
+
*/
|
|
179
|
+
dump(...args: any[]): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Trigger inference to generate new insight data.
|
|
182
|
+
*
|
|
183
|
+
* Opens a confirmation modal showing the data to be analyzed, then streams
|
|
184
|
+
* the inference result. On success, updates the insight so subsequent
|
|
185
|
+
* \`tb.insight()\` calls return the new value.
|
|
186
|
+
*
|
|
187
|
+
* @param opts - Options for inference
|
|
188
|
+
* @param opts.data - Data to pre-populate in the modal (string or array of strings). If omitted, modal opens with empty textarea for user to paste.
|
|
189
|
+
* @returns Promise that resolves with the parsed insight JSON
|
|
190
|
+
* @throws If inference is already in progress, or on network/parse/rate limit errors
|
|
191
|
+
*/
|
|
192
|
+
infer<T = unknown>(opts?: { data?: string | string[] }): Promise<T>;
|
|
193
|
+
/**
|
|
194
|
+
* Get the current inference state.
|
|
195
|
+
*
|
|
196
|
+
* @returns 'idle' | 'running' | 'complete' | 'error'
|
|
197
|
+
*/
|
|
198
|
+
inferenceState(): 'idle' | 'running' | 'complete' | 'error';
|
|
199
|
+
/**
|
|
200
|
+
* Set a data chunk for the next inference call.
|
|
201
|
+
*
|
|
202
|
+
* Use this to programmatically set data that will be sent when \`tb.infer()\` is called
|
|
203
|
+
* without the \`data\` option.
|
|
204
|
+
*
|
|
205
|
+
* @param index - The chunk index (0-based)
|
|
206
|
+
* @param content - The content for this chunk
|
|
207
|
+
*/
|
|
208
|
+
setData(index: number, content: string): void;
|
|
209
|
+
/**
|
|
210
|
+
* Proxy a CDN URL through the sandbox origin for Web Worker/WASM same-origin loading.
|
|
211
|
+
*
|
|
212
|
+
* In the sandbox, prepends \`/proxy/\` so the URL is served from the same origin.
|
|
213
|
+
* Outside the sandbox (exported HTML, CLI), returns the URL unchanged.
|
|
214
|
+
*
|
|
215
|
+
* @param url - Full HTTPS URL to an allowlisted CDN (esm.sh, unpkg.com, cdn.jsdelivr.net, cdnjs.cloudflare.com)
|
|
216
|
+
* @returns The proxied URL (sandbox) or the original URL (standalone/CLI)
|
|
217
|
+
*/
|
|
218
|
+
proxy(url: string): string;
|
|
219
|
+
/**
|
|
220
|
+
* Copy text to clipboard.
|
|
221
|
+
* Must be called synchronously within a user gesture (click/keydown).
|
|
222
|
+
* @returns true if successful, false otherwise
|
|
223
|
+
*/
|
|
224
|
+
copy(text: string): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* Get the canonical URL of this bulb.
|
|
227
|
+
*
|
|
228
|
+
* Returns the parent typebulb.com URL (including path, query, and \`#tb=\` fragment),
|
|
229
|
+
* resolving correctly from inside the cross-origin sandbox iframe.
|
|
230
|
+
* Use this instead of \`location.href\` or \`document.referrer\`.
|
|
231
|
+
*
|
|
232
|
+
* @returns The full canonical URL
|
|
233
|
+
*/
|
|
233
234
|
url(): Promise<string>;`;
|
|
234
|
-
const onMessage = `
|
|
235
|
-
/**
|
|
236
|
-
* Subscribe to a value pushed from the terminal via \`typebulb send <file> [message]\`.
|
|
237
|
-
*
|
|
238
|
-
* The dual of \`tb.log\` (data out): a value sent *in* from the CLI, no \`--trust\` required.
|
|
239
|
-
* Use it to start expensive work on demand instead of on load — e.g. \`tb.onMessage(() => start())\`
|
|
240
|
-
* — so hot reloads don't re-trigger it while you edit, and an agent kicks off one run when ready.
|
|
241
|
-
*
|
|
242
|
-
* The message is the JSON-parsed value of what \`send\` was given (or the raw string if it isn't
|
|
243
|
-
* JSON; \`undefined\` for a bare \`typebulb send <file>\`). A non-\`undefined\` return value (awaited)
|
|
244
|
-
* becomes the reply \`send --wait\` prints on stdout — JSON-serializable, at most one handler
|
|
245
|
-
* replying — the structured read-back for self-tests. Returns an unsubscribe function. Inert in
|
|
246
|
-
* an
|
|
247
|
-
*
|
|
248
|
-
* @param handler - Called with each pushed message; may return a JSON-serializable reply.
|
|
249
|
-
* @returns An unsubscribe function.
|
|
250
|
-
*/
|
|
235
|
+
const onMessage = `
|
|
236
|
+
/**
|
|
237
|
+
* Subscribe to a value pushed from the terminal via \`typebulb send <file> [message]\`.
|
|
238
|
+
*
|
|
239
|
+
* The dual of \`tb.log\` (data out): a value sent *in* from the CLI, no \`--trust\` required.
|
|
240
|
+
* Use it to start expensive work on demand instead of on load — e.g. \`tb.onMessage(() => start())\`
|
|
241
|
+
* — so hot reloads don't re-trigger it while you edit, and an agent kicks off one run when ready.
|
|
242
|
+
*
|
|
243
|
+
* The message is the JSON-parsed value of what \`send\` was given (or the raw string if it isn't
|
|
244
|
+
* JSON; \`undefined\` for a bare \`typebulb send <file>\`). A non-\`undefined\` return value (awaited)
|
|
245
|
+
* becomes the reply \`send --wait\` prints on stdout — JSON-serializable, at most one handler
|
|
246
|
+
* replying — the structured read-back for self-tests. Returns an unsubscribe function. Inert in
|
|
247
|
+
* an inline bulb (no sender) — the handler is registered but never fires.
|
|
248
|
+
*
|
|
249
|
+
* @param handler - Called with each pushed message; may return a JSON-serializable reply.
|
|
250
|
+
* @returns An unsubscribe function.
|
|
251
|
+
*/
|
|
251
252
|
onMessage(handler: (message: any) => unknown): () => void;`;
|
|
252
|
-
const log = `
|
|
253
|
-
/**
|
|
254
|
-
* Print to the CLI's stdout — the bulb's log channel, read back with \`typebulb logs <file>\`.
|
|
255
|
-
*
|
|
256
|
-
* Ungated: needs no \`server.ts\` block and no \`--trust\`, so a Restricted client-only bulb can
|
|
257
|
-
* instrument itself. Args cross to the CLI as JSON; where no CLI serves the page (web,
|
|
258
|
-
* or a transport failure) it falls back to the browser console. Works in \`server.ts\` too (same
|
|
259
|
-
* as \`console.log\` there).
|
|
260
|
-
*/
|
|
253
|
+
const log = `
|
|
254
|
+
/**
|
|
255
|
+
* Print to the CLI's stdout — the bulb's log channel, read back with \`typebulb logs <file>\`.
|
|
256
|
+
*
|
|
257
|
+
* Ungated: needs no \`server.ts\` block and no \`--trust\`, so a Restricted client-only bulb can
|
|
258
|
+
* instrument itself. Args cross to the CLI as JSON; where no CLI serves the page (web, inline,
|
|
259
|
+
* or a transport failure) it falls back to the browser console. Works in \`server.ts\` too (same
|
|
260
|
+
* as \`console.log\` there).
|
|
261
|
+
*/
|
|
261
262
|
log(...args: any[]): void;`;
|
|
262
|
-
const clientServerProxy = `
|
|
263
|
-
/**
|
|
264
|
-
* Server-side function proxy.
|
|
265
|
-
*
|
|
266
|
-
* In the CLI, calls exported functions from the \`**server.ts**\` section.
|
|
267
|
-
*
|
|
268
|
-
* A normal export is awaited for its result (\`await tb.server.fn()\`). An \`async function*\`
|
|
269
|
-
* export streams: \`for await (const chunk of tb.server.gen())\`. The call object supports both;
|
|
270
|
-
* break the \`for await\` to cancel and tear down the server generator.
|
|
271
|
-
*/
|
|
263
|
+
const clientServerProxy = `
|
|
264
|
+
/**
|
|
265
|
+
* Server-side function proxy.
|
|
266
|
+
*
|
|
267
|
+
* In the CLI, calls exported functions from the \`**server.ts**\` section.
|
|
268
|
+
*
|
|
269
|
+
* A normal export is awaited for its result (\`await tb.server.fn()\`). An \`async function*\`
|
|
270
|
+
* export streams: \`for await (const chunk of tb.server.gen())\`. The call object supports both;
|
|
271
|
+
* break the \`for await\` to cancel and tear down the server generator.
|
|
272
|
+
*/
|
|
272
273
|
server: Record<string, (...args: any[]) => Promise<any> & AsyncIterable<any>>;`;
|
|
273
274
|
/** Typebulb globals available in browser-side code (code.tsx). */
|
|
274
|
-
export const clientTbTypings = `${aiChunkType}${aiAccessType}
|
|
275
|
-
/**
|
|
276
|
-
* Typebulb utilities namespace.
|
|
277
|
-
* Type \`tb.\` to discover available helpers.
|
|
278
|
-
*/
|
|
279
|
-
declare const tb: {${dataAndJson}${clientOnlyMembers}${insight}${log}${clientServerProxy}${onMessage}${ai}${fs}${dir}${models}${theme}${mode}
|
|
280
|
-
};
|
|
275
|
+
export const clientTbTypings = `${aiChunkType}${aiAccessType}
|
|
276
|
+
/**
|
|
277
|
+
* Typebulb utilities namespace.
|
|
278
|
+
* Type \`tb.\` to discover available helpers.
|
|
279
|
+
*/
|
|
280
|
+
declare const tb: {${dataAndJson}${clientOnlyMembers}${insight}${log}${clientServerProxy}${onMessage}${ai}${fs}${dir}${models}${theme}${mode}
|
|
281
|
+
};
|
|
281
282
|
`;
|
|
282
|
-
const serverLog = `
|
|
283
|
-
/**
|
|
284
|
-
* Print to the CLI's stdout — the same channel as \`console.log\` here (the server's console IS
|
|
285
|
-
* the bulb's log). One log verb across blocks: page-side \`tb.log\` reaches this same stdout.
|
|
286
|
-
*/
|
|
283
|
+
const serverLog = `
|
|
284
|
+
/**
|
|
285
|
+
* Print to the CLI's stdout — the same channel as \`console.log\` here (the server's console IS
|
|
286
|
+
* the bulb's log). One log verb across blocks: page-side \`tb.log\` reaches this same stdout.
|
|
287
|
+
*/
|
|
287
288
|
log(...args: any[]): void;`;
|
|
288
289
|
/** Typebulb globals available in Node-side code (server.ts).
|
|
289
290
|
* Only what carries a bulb-specific rule Node can't know — tb.ai, tb.fs, tb.dir (TB-FS.md);
|
|
290
291
|
* plus the tb.log uniformity exception (serverTb.ts). The browser-only helpers are intentionally
|
|
291
292
|
* absent. Must match serverTb.ts's runtime surface. */
|
|
292
|
-
export const serverTbTypings = `${aiChunkType}${aiAccessType}
|
|
293
|
-
/**
|
|
294
|
-
* Typebulb utilities namespace (server-side).
|
|
295
|
-
* Type \`tb.\` to discover available helpers.
|
|
296
|
-
*/
|
|
297
|
-
declare const tb: {${serverLog}${ai}${fs}${dir}${models}${mode}
|
|
298
|
-
};
|
|
293
|
+
export const serverTbTypings = `${aiChunkType}${aiAccessType}
|
|
294
|
+
/**
|
|
295
|
+
* Typebulb utilities namespace (server-side).
|
|
296
|
+
* Type \`tb.\` to discover available helpers.
|
|
297
|
+
*/
|
|
298
|
+
declare const tb: {${serverLog}${ai}${fs}${dir}${models}${mode}
|
|
299
|
+
};
|
|
299
300
|
`;
|
|
300
301
|
//# sourceMappingURL=tbTypings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tbTypings.js","sourceRoot":"","sources":["../../dts/src/tbTypings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,GAAG;;;;;;;;;;;uCAWmB,CAAA;AAEvC,MAAM,OAAO,GAAG;;;;;;;;;yCASyB,CAAA;AAEzC,2DAA2D;AAC3D,MAAM,SAAS,GAAG;;;;;;;;;;;IAWd,CAAA;AAEJ,oGAAoG;AACpG,MAAM,WAAW,GAAG;;;;;CAKnB,CAAA;AAED,wGAAwG;AACxG,MAAM,YAAY,GAAG;;;CAGpB,CAAA;AAED,MAAM,EAAE,GAAG;;;;;;;;;OASJ,SAAS;;;;;;;;;;;;;;aAcH,SAAS;KACjB,CAAA;AAEL,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA8BkB,CAAA;AAEjC,MAAM,KAAK,GAAG;;;;;;;;;;;;uCAYyB,CAAA;AAEvC,MAAM,IAAI,GAAG;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tbTypings.js","sourceRoot":"","sources":["../../dts/src/tbTypings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,GAAG;;;;;;;;;;;uCAWmB,CAAA;AAEvC,MAAM,OAAO,GAAG;;;;;;;;;yCASyB,CAAA;AAEzC,2DAA2D;AAC3D,MAAM,SAAS,GAAG;;;;;;;;;;;IAWd,CAAA;AAEJ,oGAAoG;AACpG,MAAM,WAAW,GAAG;;;;;CAKnB,CAAA;AAED,wGAAwG;AACxG,MAAM,YAAY,GAAG;;;CAGpB,CAAA;AAED,MAAM,EAAE,GAAG;;;;;;;;;OASJ,SAAS;;;;;;;;;;;;;;aAcH,SAAS;KACjB,CAAA;AAEL,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA8BkB,CAAA;AAEjC,MAAM,KAAK,GAAG;;;;;;;;;;;;uCAYyB,CAAA;AAEvC,MAAM,IAAI,GAAG;;;;;;;;;;UAUH,SAAS,GAAG,CAAA;AAEtB,MAAM,EAAE,GAAG;;;;;;;;;;;;;;;;;KAiBN,CAAA;AAEL,MAAM,GAAG,GAAG;;;;;;;;;wBASY,CAAA;AAExB,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAmEA,CAAA;AAE1B,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;6DAiB2C,CAAA;AAE7D,MAAM,GAAG,GAAG;;;;;;;;;6BASiB,CAAA;AAE7B,MAAM,iBAAiB,GAAG;;;;;;;;;;iFAUuD,CAAA;AAEjF,kEAAkE;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,WAAW,GAAG,YAAY;;;;;qBAKvC,WAAW,GAAG,iBAAiB,GAAG,OAAO,GAAG,GAAG,GAAG,iBAAiB,GAAG,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI;;CAE3I,CAAA;AAED,MAAM,SAAS,GAAG;;;;;6BAKW,CAAA;AAE7B;;;wDAGwD;AACxD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,WAAW,GAAG,YAAY;;;;;qBAKvC,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,MAAM,GAAG,IAAI;;CAE7D,CAAA"}
|