typebulb 0.19.0 → 0.19.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/README.md +9 -2
- package/dist/agents/claude/client.js +4 -6
- package/dist/agents/pi/client.js +4 -6
- package/dist/ai/protocol.d.ts +7 -3
- package/dist/ai/protocol.d.ts.map +1 -1
- package/dist/ai/providers/anthropic.d.ts.map +1 -1
- package/dist/ai/providers/anthropic.js +23 -13
- package/dist/ai/providers/anthropic.js.map +1 -1
- package/dist/ai/providers/gemini.d.ts.map +1 -1
- package/dist/ai/providers/gemini.js +8 -2
- package/dist/ai/providers/gemini.js.map +1 -1
- package/dist/ai/providers/openAI.d.ts +1 -1
- package/dist/ai/providers/openAI.d.ts.map +1 -1
- package/dist/ai/providers/openAI.js +4 -4
- package/dist/ai/providers/openAI.js.map +1 -1
- package/dist/ai/providers/openRouter.d.ts +1 -1
- package/dist/ai/providers/openRouter.d.ts.map +1 -1
- package/dist/ai/providers/openRouter.js +3 -0
- package/dist/ai/providers/openRouter.js.map +1 -1
- package/dist/dts/tbTypings.d.ts +5 -3
- package/dist/dts/tbTypings.d.ts.map +1 -1
- package/dist/dts/tbTypings.js +6 -15
- package/dist/dts/tbTypings.js.map +1 -1
- package/dist/index.js +199 -211
- package/dist/render.js +4 -6
- package/dist/servers.js +71 -71
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ A bulb is a single **markdown** file — the minimum viable structure for a smal
|
|
|
77
77
|
| `**data.txt**` | Read-only data your code processes via `tb.data(n)` (raw string) / `tb.json(n)` (parsed) — JSON, CSV, XML, YAML, or plain text. Multiple chunks are separated by **two blank lines**. |
|
|
78
78
|
| `**infer.md**` / `**insight.json**` | Runtime one-shot LLM call via `tb.infer()` — a typebulb.com feature; not supported locally. |
|
|
79
79
|
| `**notes.md**` | Persistent context for the AI assistant, carried across conversations and clones. Not run. |
|
|
80
|
-
| `**server.ts**` | Node.js code; its exports become `tb.server.<name>()` in the browser.
|
|
80
|
+
| `**server.ts**` | Node.js code; its exports become `tb.server.<name>()` in the browser. Mostly plain Node — log with `console.log` — but `tb.ai`/`tb.ai.stream`/`tb.models` are callable here too (under `--trust`). **Local only.** |
|
|
81
81
|
|
|
82
82
|
### Example
|
|
83
83
|
|
|
@@ -241,6 +241,12 @@ That one launch *is* the loop: the server watches the file, so every save recomp
|
|
|
241
241
|
- **Reading the log:** it appends across every reload, so `typebulb logs --run latest <file>` shows just the current run (no need to clear).
|
|
242
242
|
- **When done:** Ctrl-C, or `typebulb stop <file>` — closing the terminal leaves the server running detached.
|
|
243
243
|
|
|
244
|
+
### Emitting a server-only bulb
|
|
245
|
+
|
|
246
|
+
A `**server.ts**` block with no `**code.tsx**` is a headless bulb — no UI, no port, absent from the launcher. Under `--trust` its code can call `tb.ai`, `tb.ai.stream`, and `tb.models` against your `.env` keys.
|
|
247
|
+
|
|
248
|
+
- **Invoke one export with `typebulb call <file> <fn> [args…] --trust`.** It boots, runs that export, prints the `return` as JSON to stdout, and exits — a fresh boot per call. Log with `console.log` (no `tb.server.log` here); under `call` logs go to stderr, so the JSON result owns stdout.
|
|
249
|
+
|
|
244
250
|
## Sizing
|
|
245
251
|
|
|
246
252
|
The host owns a bulb's **width**; you own its **height**.
|
|
@@ -368,10 +374,11 @@ Or you can rely on the default provider and model if you set them in `.env`.
|
|
|
368
374
|
|
|
369
375
|
### Reasoning effort
|
|
370
376
|
|
|
371
|
-
`tb.ai()` accepts an optional `effort` parameter (
|
|
377
|
+
`tb.ai()` accepts an optional `effort` parameter (0–3) that hints at how much the model should reason. `low` (1) is the sensible default for most work; omit it for the model's own default.
|
|
372
378
|
|
|
373
379
|
| Level | Label | Effect |
|
|
374
380
|
|-------|-------|--------|
|
|
381
|
+
| 0 | Minimal | Least reasoning — mapped to each provider's floor. Not a guaranteed "off": some models still think a little, and adaptive ones already self-skip at low. |
|
|
375
382
|
| 1 | Low | Light reasoning |
|
|
376
383
|
| 2 | Med | Moderate reasoning |
|
|
377
384
|
| 3 | High | Heavy reasoning |
|
|
@@ -998,13 +998,12 @@ const something = require('module-name') // NOT SUPPORTED!
|
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
1000
|
// tb.ai(): non-streaming, resolves with the full { text } (unchanged 90% path).
|
|
1001
|
-
const aiCall = async ({ messages, system, effort,
|
|
1001
|
+
const aiCall = async ({ messages, system, effort, provider, model, webSearch, signal } = {}) => {
|
|
1002
1002
|
if (isEmbedded) throw embedErr('tb.ai()');
|
|
1003
1003
|
const resp = await fetch('/__ai', {
|
|
1004
1004
|
method: 'POST',
|
|
1005
1005
|
headers: { 'Content-Type': 'application/json' },
|
|
1006
|
-
|
|
1007
|
-
body: JSON.stringify({ messages, system, effort: effort ?? reasoning, provider, model, webSearch }),
|
|
1006
|
+
body: JSON.stringify({ messages, system, effort, provider, model, webSearch }),
|
|
1008
1007
|
signal
|
|
1009
1008
|
});
|
|
1010
1009
|
if (resp.status === 403) throw new Error((await resp.text().catch(() => '')) || 'tb.ai() is blocked \u2014 re-run with --trust');
|
|
@@ -1021,12 +1020,11 @@ const something = require('module-name') // NOT SUPPORTED!
|
|
|
1021
1020
|
// streaming tb.server.<gen>(). Break the loop (or abort the signal) to cancel.
|
|
1022
1021
|
const aiStream = (opts = {}) => (async function* () {
|
|
1023
1022
|
if (isEmbedded) throw embedErr('tb.ai.stream()');
|
|
1024
|
-
const { messages, system, effort,
|
|
1023
|
+
const { messages, system, effort, provider, model, webSearch, signal } = opts;
|
|
1025
1024
|
const resp = await fetch('/__ai', {
|
|
1026
1025
|
method: 'POST',
|
|
1027
1026
|
headers: { 'Content-Type': 'application/json' },
|
|
1028
|
-
|
|
1029
|
-
body: JSON.stringify({ messages, system, effort: effort ?? reasoning, provider, model, webSearch, stream: true }),
|
|
1027
|
+
body: JSON.stringify({ messages, system, effort, provider, model, webSearch, stream: true }),
|
|
1030
1028
|
signal
|
|
1031
1029
|
});
|
|
1032
1030
|
if (resp.status === 403) throw new Error((await resp.text().catch(() => '')) || 'tb.ai() is blocked \u2014 re-run with --trust');
|
package/dist/agents/pi/client.js
CHANGED
|
@@ -998,13 +998,12 @@ const something = require('module-name') // NOT SUPPORTED!
|
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
1000
|
// tb.ai(): non-streaming, resolves with the full { text } (unchanged 90% path).
|
|
1001
|
-
const aiCall = async ({ messages, system, effort,
|
|
1001
|
+
const aiCall = async ({ messages, system, effort, provider, model, webSearch, signal } = {}) => {
|
|
1002
1002
|
if (isEmbedded) throw embedErr('tb.ai()');
|
|
1003
1003
|
const resp = await fetch('/__ai', {
|
|
1004
1004
|
method: 'POST',
|
|
1005
1005
|
headers: { 'Content-Type': 'application/json' },
|
|
1006
|
-
|
|
1007
|
-
body: JSON.stringify({ messages, system, effort: effort ?? reasoning, provider, model, webSearch }),
|
|
1006
|
+
body: JSON.stringify({ messages, system, effort, provider, model, webSearch }),
|
|
1008
1007
|
signal
|
|
1009
1008
|
});
|
|
1010
1009
|
if (resp.status === 403) throw new Error((await resp.text().catch(() => '')) || 'tb.ai() is blocked \u2014 re-run with --trust');
|
|
@@ -1021,12 +1020,11 @@ const something = require('module-name') // NOT SUPPORTED!
|
|
|
1021
1020
|
// streaming tb.server.<gen>(). Break the loop (or abort the signal) to cancel.
|
|
1022
1021
|
const aiStream = (opts = {}) => (async function* () {
|
|
1023
1022
|
if (isEmbedded) throw embedErr('tb.ai.stream()');
|
|
1024
|
-
const { messages, system, effort,
|
|
1023
|
+
const { messages, system, effort, provider, model, webSearch, signal } = opts;
|
|
1025
1024
|
const resp = await fetch('/__ai', {
|
|
1026
1025
|
method: 'POST',
|
|
1027
1026
|
headers: { 'Content-Type': 'application/json' },
|
|
1028
|
-
|
|
1029
|
-
body: JSON.stringify({ messages, system, effort: effort ?? reasoning, provider, model, webSearch, stream: true }),
|
|
1027
|
+
body: JSON.stringify({ messages, system, effort, provider, model, webSearch, stream: true }),
|
|
1030
1028
|
signal
|
|
1031
1029
|
});
|
|
1032
1030
|
if (resp.status === 403) throw new Error((await resp.text().catch(() => '')) || 'tb.ai() is blocked \u2014 re-run with --trust');
|
package/dist/ai/protocol.d.ts
CHANGED
|
@@ -5,9 +5,13 @@ export * from './stream.js';
|
|
|
5
5
|
* runtime. `ollama` is the zero-config preset; `openai-compat` is the generic form. See
|
|
6
6
|
* runtime-specs/TB-Custom-Providers.md. */
|
|
7
7
|
export type ProviderProtocol = 'openai' | 'anthropic' | 'openrouter' | 'gemini' | 'ollama' | 'openai-compat';
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
|
|
8
|
+
/** Reasoning effort hint: 0 (minimal) – 3 (high). 0 minimizes reasoning, mapped to each provider's
|
|
9
|
+
* least rung — OpenAI/OpenRouter `none` (`minimal` is model-gated, so `none` is the robust floor),
|
|
10
|
+
* Gemini `thinkingBudget: 0`, Anthropic no-thinking on Opus (or `low` where thinking can't be
|
|
11
|
+
* disabled). Higher levels are `low`/`medium`/`high`. Omit entirely for the model's own default. Note
|
|
12
|
+
* 0 is a floor, not a guaranteed "off": always-thinking models degrade it to the lowest available
|
|
13
|
+
* thinking, and on adaptive models `low` already self-skips. */
|
|
14
|
+
export type EffortLevel = 0 | 1 | 2 | 3;
|
|
11
15
|
/** A streamed delta from `tb.ai.stream()`. Discriminated union — exactly one kind per chunk, so
|
|
12
16
|
* `switch (chunk.kind)` is exhaustive and no `{}`/both-fields state is representable. The public
|
|
13
17
|
* shape; the internal wire piece (`ChatStreamPieceDto { text?, reasoning? }`) stays loose. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../ai/src/protocol.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAE3B;;;4CAG4C;AAC5C,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,eAAe,CAAA;AAE5G;
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../ai/src/protocol.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAE3B;;;4CAG4C;AAC5C,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,eAAe,CAAA;AAE5G;;;;;iEAKiE;AACjE,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAEvC;;+FAE+F;AAC/F,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvC,iEAAiE;AACjE,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAA;IACpB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAA;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../ai/src/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAEhB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAInE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,UAAU,CAAA;IA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8B;IACrD,QAAQ,CAAC,IAAI,kBAAiB;IAI9B,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IASpD,YAAY,CACV,QAAQ,EAAE,cAAc,EAAE,EAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,OAAO,GACd,uBAAuB;IA6D1B,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB;IAM/D,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe;IAkBrE,SAAS,CAAC,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,GAAG,IAAI;IA4B3F,kGAAkG;IAClG,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,gBAAgB;IAIxB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -35,20 +35,30 @@ export class AnthropicProvider extends AIProvider {
|
|
|
35
35
|
if (this.isReasoningEnabled(opts)) {
|
|
36
36
|
const depth = opts.effort;
|
|
37
37
|
if (this.isModernModel(model)) {
|
|
38
|
-
// Opus 4.6+: adaptive thinking + effort parameter
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
// Opus 4.6+: adaptive thinking + effort parameter.
|
|
39
|
+
// 0 = minimal: send the lowest effort with NO `thinking` directive. On adaptive models where
|
|
40
|
+
// thinking is opt-in (Opus 4.7/4.8) omitting it runs the request *without* thinking — the real
|
|
41
|
+
// "off". On Sonnet 5 / Fable / Mythos, thinking is on-by-default or mandatory, so 0 floors to
|
|
42
|
+
// low-effort thinking rather than off (Anthropic has no sub-`low` effort rung).
|
|
43
|
+
if (depth === 0) {
|
|
44
|
+
payload.output_config = { effort: 'low' };
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const effortMap = {
|
|
48
|
+
1: 'low',
|
|
49
|
+
2: 'medium',
|
|
50
|
+
3: 'high'
|
|
51
|
+
};
|
|
52
|
+
// display defaults to 'omitted' on Fable 5 / Mythos 5 / Opus 4.7+ / Sonnet 5 (a silent change from
|
|
53
|
+
// Opus 4.6 / Sonnet 4.6, which defaulted to 'summarized') — thinking still happens and is billed,
|
|
54
|
+
// but streams with empty text unless requested explicitly.
|
|
55
|
+
payload.thinking = { type: 'adaptive', display: 'summarized' };
|
|
56
|
+
payload.output_config = { effort: effortMap[depth] };
|
|
57
|
+
}
|
|
49
58
|
}
|
|
50
|
-
else {
|
|
51
|
-
// Older models: manual thinking with budget_tokens
|
|
59
|
+
else if (depth !== 0) {
|
|
60
|
+
// Older models: manual thinking with budget_tokens. 0 = minimal → omit `thinking` entirely (off);
|
|
61
|
+
// budget_tokens: 0 is rejected, so there's no "tiny budget" rung below the smallest here.
|
|
52
62
|
const budgetMap = {
|
|
53
63
|
1: 2048,
|
|
54
64
|
2: 4096,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../ai/src/providers/anthropic.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAA;AA+GnE,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAAjD;;QACqB,iBAAY,GAAG,WAAW,CAAA;QACpC,mBAAc,GAAG,2BAA2B,CAAA;QAC5C,SAAI,GAAG,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../ai/src/providers/anthropic.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAA;AA+GnE,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAAjD;;QACqB,iBAAY,GAAG,WAAW,C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O,CAAC,YAAY;IAYpB,OAAO,CAAC,gBAAgB;CAsBzB"}
|
|
@@ -43,9 +43,15 @@ export class GeminiProvider extends AIProvider {
|
|
|
43
43
|
// `-1` (dynamic, always in-range, no per-model max risk). `includeThoughts` streams thought
|
|
44
44
|
// summaries as `thought` parts, which the parser maps to AiChunk `{ kind: "reasoning" }`.
|
|
45
45
|
if (this.isReasoningEnabled(opts)) {
|
|
46
|
-
|
|
46
|
+
// 0 = minimal → thinkingBudget 0: disables thinking on 2.5 Flash/Lite (2.5 Pro can't disable and
|
|
47
|
+
// clamps up; Gemini 3.x wants `thinking_level` — a separate migration). At budget 0 there are no
|
|
48
|
+
// thoughts to stream, so `includeThoughts` is dropped.
|
|
49
|
+
const budgetMap = { 0: 0, 1: 1024, 2: 8192, 3: -1 };
|
|
50
|
+
const thinkingBudget = budgetMap[opts.effort];
|
|
47
51
|
payload.generationConfig = {
|
|
48
|
-
thinkingConfig:
|
|
52
|
+
thinkingConfig: thinkingBudget === 0
|
|
53
|
+
? { thinkingBudget: 0 }
|
|
54
|
+
: { includeThoughts: true, thinkingBudget },
|
|
49
55
|
};
|
|
50
56
|
}
|
|
51
57
|
return payload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../ai/src/providers/gemini.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAwB,MAAM,kBAAkB,CAAA;AAiFxF,MAAM,OAAO,cAAe,SAAQ,UAAU;IAA9C;;QACqB,iBAAY,GAAG,QAAQ,CAAA;QACjC,mBAAc,GAAG,2CAA2C,CAAA;QAC5D,SAAI,GAAG,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../ai/src/providers/gemini.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAwB,MAAM,kBAAkB,CAAA;AAiFxF,MAAM,OAAO,cAAe,SAAQ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IAEO,gBAAgB,CAAC,IAAa;QACpC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACjE,MAAM,QAAQ,GAAI,IAA2B,CAAC,KAAK,CAAA;YAEnD,IAAI,OAAe,CAAA;YACnB,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,OAAO,GAAG,QAAQ,CAAA;YACpB,CAAC;iBAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAC7D,MAAM,GAAG,GAAG,QAAiD,CAAA;gBAC7D,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,MAAM,IAAI,0BAA0B,CAAA;YACnE,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,0BAA0B,CAAA;YACtC,CAAC;YAED,MAAM,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACxC,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC;YACpE,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAA;YAC9C,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ChatMessageDto, UpstreamErrorDto, ChatStreamPieceDto, ChatResponseDto, ProviderResponseDto, ProviderStreamEventDto } from '../protocol.js';
|
|
5
5
|
import { AIProvider, type ChatRequestOpts } from '../aiProvider.js';
|
|
6
|
-
export type OpenAIReasoningEffort = 'low' | 'medium' | 'high';
|
|
6
|
+
export type OpenAIReasoningEffort = 'none' | 'low' | 'medium' | 'high';
|
|
7
7
|
export type OpenAIReasoningSummary = 'auto' | 'concise' | 'detailed';
|
|
8
8
|
export interface OpenAIWebSearchTool {
|
|
9
9
|
type: 'web_search';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openAI.d.ts","sourceRoot":"","sources":["../../../ai/src/providers/openAI.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAEhB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,UAAU,EAAuB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"openAI.d.ts","sourceRoot":"","sources":["../../../ai/src/providers/openAI.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAEhB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,UAAU,EAAuB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAOxF,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AACtE,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;AAGpE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,MAAM,MAAM,UAAU,GAAG,mBAAmB,CAAA;AAG5C,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,qBAAqB,CAAA;QAC7B,OAAO,CAAC,EAAE,sBAAsB,CAAA;KACjC,CAAA;IACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAGD,MAAM,WAAW,wBAAwB;IACvC,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M,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQpD,YAAY,CACV,QAAQ,EAAE,cAAc,EAAE,EAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,OAAO,GACd,4BAA4B;IAuB/B,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB;IAM/D,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe;IA0BrE,SAAS,CAAC,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,GAAG,IAAI;IA4C3F,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,sBAAsB;CAI/B"}
|
|
@@ -7,6 +7,7 @@ export class OpenAIProvider extends AIProvider {
|
|
|
7
7
|
this.defaultBaseUrl = 'https://api.openai.com';
|
|
8
8
|
this.path = '/v1/responses';
|
|
9
9
|
this.effortMap = {
|
|
10
|
+
0: 'none',
|
|
10
11
|
1: 'low',
|
|
11
12
|
2: 'medium',
|
|
12
13
|
3: 'high'
|
|
@@ -33,10 +34,9 @@ export class OpenAIProvider extends AIProvider {
|
|
|
33
34
|
payload.tools = [{ type: 'web_search' }];
|
|
34
35
|
}
|
|
35
36
|
if (this.isReasoningEnabled(opts)) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
37
|
+
const effort = this.effortMap[opts.effort];
|
|
38
|
+
// `summary: 'auto'` requests a reasoning summary; at `none` there's no reasoning to summarize.
|
|
39
|
+
payload.reasoning = effort === 'none' ? { effort } : { effort, summary: 'auto' };
|
|
40
40
|
}
|
|
41
41
|
return payload;
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openAI.js","sourceRoot":"","sources":["../../../ai/src/providers/openAI.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAw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T,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,iCAAiC;AACjC,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;KAAE,CAAA;IAC1D,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAA;AAED,qBAAa,kBAAmB,SAAQ,UAAU;IAChD,SAAS,CAAC,QAAQ,CAAC,YAAY,gBAAe;IAO9C,QAAQ,CAAC,cAAc,2BAA0B;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAA6B;IAIlD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAKzB;IAID,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAkBrE,YAAY,CACV,QAAQ,EAAE,cAAc,EAAE,EAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,OAAO,GACd,wBAAwB;IAqB3B,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB;IAM/D,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe;IAarE,SAAS,CAAC,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,GAAG,IAAI;IAmB3F,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -11,7 +11,10 @@ export class OpenRouterProvider extends AIProvider {
|
|
|
11
11
|
// both web and CLI. (Do NOT put `/api` in the base too — the join would then double it to `/api/api`.)
|
|
12
12
|
this.defaultBaseUrl = 'https://openrouter.ai';
|
|
13
13
|
this.path = '/api/v1/chat/completions';
|
|
14
|
+
// 0 → `none` (reasoning off): OpenRouter normalizes this across providers, and it's the robust floor
|
|
15
|
+
// (its `minimal` isn't supported by every underlying model, e.g. gpt-5.4-mini).
|
|
14
16
|
this.effortMap = {
|
|
17
|
+
0: 'none',
|
|
15
18
|
1: 'low',
|
|
16
19
|
2: 'medium',
|
|
17
20
|
3: 'high'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openRouter.js","sourceRoot":"","sources":["../../../ai/src/providers/openRouter.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAA;AAkEnE,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAAlD;;QACqB,iBAAY,GAAG,YAAY,CAAA;QAC9C,6FAA6F;QAC7F,iGAAiG;QACjG,gGAAgG;QAChG,gGAAgG;QAChG,iGAAiG;QACjG,uGAAuG;QAC9F,mBAAc,GAAG,uBAAuB,CAAA;QACxC,SAAI,GAAW,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"openRouter.js","sourceRoot":"","sources":["../../../ai/src/providers/openRouter.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAA;AAkEnE,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAAlD;;QACqB,iBAAY,GAAG,YAAY,CAAA;QAC9C,6FAA6F;QAC7F,iGAAiG;QACjG,gGAAgG;QAChG,gGAAgG;QAChG,iGAAiG;QACjG,uGAAuG;QAC9F,mBAAc,GAAG,uBAAuB,CAAA;QACxC,SAAI,GAAW,0BAA0B,CAAA;QAElD,qGAAqG;QACrG,gFAAgF;QAC/D,cAAS,GAA4D;YACpF,CAAC,EAAE,MAAM;YACT,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,QAAQ;YACX,CAAC,EAAE,MAAM;SACV,CAAA;IAyFH,CAAC;IAvFC,oEAAoE;IAEpE,YAAY,CAAC,MAAc,EAAE,MAAe;QAC1C,MAAM,OAAO,GAA2B;YACtC,eA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ser-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/**\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 * Server-side function proxy.\n *\n * In the CLI, calls exported functions from the `**server.ts**` section.\n * `tb.server.log(...)` is a built-in that prints to CLI stdout (falls back to console.log on web).\n * User exports override built-ins of the same name.\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.server.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>`). 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.\n * @returns An unsubscribe function.\n */\n onMessage(handler: (message: any) => void): () => 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 /** Extended-thinking effort hint (1=low, 2=med, 3=high). Mapped to each provider's native mechanism (e.g. Anthropic adaptive thinking, OpenAI reasoning effort). Omit for the model's native default; use a non-reasoning model to avoid thinking entirely. */\n effort?: 1 | 2 | 3;\n /** @deprecated Renamed to `effort`. Still accepted; a `0` is treated as omitted. */\n reasoning?: 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 /** Extended-thinking effort hint (1=low, 2=med, 3=high). Mapped to each provider's native mechanism (e.g. Anthropic adaptive thinking, OpenAI reasoning effort). Omit for the model's native default; use a non-reasoning model to avoid thinking entirely. */\n effort?: 1 | 2 | 3;\n /** @deprecated Renamed to `effort`. Still accepted; a `0` is treated as omitted. */\n reasoning?: 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 * Paths are resolved relative to the current working directory (where the CLI\n * was launched), consistent with the .env cascade \u2014 not the bulb file's folder.\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 * 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 }>>;\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";
|
|
13
|
-
/** Typebulb globals available in Node-side code (server.ts).
|
|
14
|
-
|
|
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/**\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 * Server-side function proxy.\n *\n * In the CLI, calls exported functions from the `**server.ts**` section.\n * `tb.server.log(...)` is a built-in that prints to CLI stdout (falls back to console.log on web).\n * User exports override built-ins of the same name.\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.server.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>`). 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.\n * @returns An unsubscribe function.\n */\n onMessage(handler: (message: any) => void): () => 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 * Paths are resolved relative to the current working directory (where the CLI\n * was launched), consistent with the .env cascade \u2014 not the bulb file's folder.\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 * 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 }>>;\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";
|
|
13
|
+
/** Typebulb globals available in Node-side code (server.ts).
|
|
14
|
+
* The AI subset only — server.ts is otherwise plain Node (its own `fs`, `console.log`), so the
|
|
15
|
+
* browser-only `tb` helpers are intentionally absent here and must match serverTb.ts's runtime surface. */
|
|
16
|
+
export declare const serverTbTypings = "\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/**\n * Typebulb utilities namespace (server-side).\n * Type `tb.` to discover available helpers.\n */\ndeclare const tb: {\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 * 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 }>>;\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";
|
|
15
17
|
//# 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;AA0OH,kEAAkE;AAClE,eAAO,MAAM,eAAe,urUAO3B,CAAA;AAED;;4GAE4G;AAC5G,eAAO,MAAM,eAAe,ijIAO3B,CAAA"}
|
package/dist/dts/tbTypings.js
CHANGED
|
@@ -34,10 +34,8 @@ const insight = `
|
|
|
34
34
|
const aiOptions = `options: {
|
|
35
35
|
messages: Array<{ role: "user" | "assistant"; content: string }>;
|
|
36
36
|
system?: string;
|
|
37
|
-
/**
|
|
38
|
-
effort?: 1 | 2 | 3;
|
|
39
|
-
/** @deprecated Renamed to \`effort\`. Still accepted; a \`0\` is treated as omitted. */
|
|
40
|
-
reasoning?: 0 | 1 | 2 | 3;
|
|
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;
|
|
41
39
|
provider?: string;
|
|
42
40
|
model?: string;
|
|
43
41
|
/** Enable/disable web search. Default: on for BYOK, always off for free model. */
|
|
@@ -133,15 +131,6 @@ const fs = `
|
|
|
133
131
|
/** Write text or raw bytes to a file. Creates parent directories if needed. */
|
|
134
132
|
write(path: string, content: string | Uint8Array): Promise<boolean>;
|
|
135
133
|
};`;
|
|
136
|
-
const serverLogOnly = `
|
|
137
|
-
/**
|
|
138
|
-
* Server-side function proxy. The built-in \`log\` prints to CLI stdout
|
|
139
|
-
* (falls back to console.log on web). On the server side, this object only
|
|
140
|
-
* exposes \`log\` — server-to-server calls are not supported.
|
|
141
|
-
*/
|
|
142
|
-
server: {
|
|
143
|
-
log(...args: any[]): Promise<void>;
|
|
144
|
-
};`;
|
|
145
134
|
const clientOnlyMembers = `
|
|
146
135
|
/**
|
|
147
136
|
* Async value inspector for tensor-like objects.
|
|
@@ -248,13 +237,15 @@ export const clientTbTypings = `${aiChunkType}
|
|
|
248
237
|
declare const tb: {${dataAndJson}${clientOnlyMembers}${insight}${clientServerProxy}${onMessage}${ai}${fs}${models}${theme}${mode}
|
|
249
238
|
};
|
|
250
239
|
`;
|
|
251
|
-
/** Typebulb globals available in Node-side code (server.ts).
|
|
240
|
+
/** Typebulb globals available in Node-side code (server.ts).
|
|
241
|
+
* The AI subset only — server.ts is otherwise plain Node (its own `fs`, `console.log`), so the
|
|
242
|
+
* browser-only `tb` helpers are intentionally absent here and must match serverTb.ts's runtime surface. */
|
|
252
243
|
export const serverTbTypings = `${aiChunkType}
|
|
253
244
|
/**
|
|
254
245
|
* Typebulb utilities namespace (server-side).
|
|
255
246
|
* Type \`tb.\` to discover available helpers.
|
|
256
247
|
*/
|
|
257
|
-
declare const tb: {${
|
|
248
|
+
declare const tb: {${ai}${models}${mode}
|
|
258
249
|
};
|
|
259
250
|
`;
|
|
260
251
|
//# 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
|
|
1
|
+
{"version":3,"file":"tbTypings.js","sourceRoot":"","sources":["../../dts/src/tbTypings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,GAAG;;;;;;;;;;;uCAWmB,CAAA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