@theoremjs/studio 0.3.4-next.647.g436b659 → 0.3.4-next.671.gfa09ab2
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 +8 -5
- package/cookbooks/catalog.js +18 -5
- package/cookbooks/tools.js +3 -3
- package/label-areas.d.ts +133 -0
- package/label-areas.js +154 -0
- package/mod.d.ts +4 -3
- package/mod.js +4 -3
- package/package.json +4 -4
- package/page/assets/Banner-DEVAsFER.js +4 -0
- package/page/assets/{ConsoleFrame-B7rArrs0.js → ConsoleFrame-CqUUcrR4.js} +1 -1
- package/page/assets/{MenuBottomSheet-CRiCEOWg.js → MenuBottomSheet-DOa09vl1.js} +1 -1
- package/page/assets/{SchemaFields-BoySuRuC.js → SchemaFields-CMwMU1Px.js} +1 -1
- package/page/assets/{ToolResultCharts-C_qojgbn.js → ToolResultCharts-CW23-D1x.js} +1 -1
- package/page/assets/{TraceInspector-DSLg92wY.js → TraceInspector-h030OQ82.js} +1 -1
- package/page/assets/{TraceOverview-TDZ4GUIz.js → TraceOverview-BsON_uZj.js} +1 -1
- package/page/assets/{_virtual_studio-type-sources-B0cSCDug.js → _virtual_studio-type-sources-BwSqfSwd.js} +23 -4
- package/page/assets/browser-connection-DSUHVCT5.js +3 -0
- package/page/assets/browser-engine-Cf6d-zNH.js +11 -0
- package/page/assets/browser-transport-BK4cbTE_.js +45 -0
- package/page/assets/{crypto-B6qD6nxk.js → crypto-CD14HeXH.js} +1 -1
- package/page/assets/{encode-files-CM9H0Lq5.js → encode-files-DhoC5hWG.js} +1 -1
- package/page/assets/{export-agent-BuZ4GIKx.js → export-agent-CaHsJPsM.js} +1 -1
- package/page/assets/{guardrail-tester-bc9lxU9X.js → guardrail-tester-BDhFLvT5.js} +1 -1
- package/page/assets/index-CqwmMJ4C.js +145 -0
- package/page/assets/{live-messages-CHHEtxno.js → live-messages-CiLmR89m.js} +1 -1
- package/page/assets/reader-DrOfMM8I.js +5 -0
- package/page/assets/shaped-data-H1miOZm2.js +20 -0
- package/page/assets/{stub-CWjTbSMX.js → stub-nxRsh1jo.js} +4 -4
- package/page/assets/{studio-code-pane-DevKnszl.js → studio-code-pane-C1wH63Y2.js} +3 -3
- package/page/assets/{studio-console-kpYOJazO.js → studio-console-DRzo4yTy.js} +1 -1
- package/page/assets/{studio-decision-Dq5LDTrl.js → studio-decision-C7QWMm7Q.js} +1 -1
- package/page/assets/{studio-embedding-Cebwv5_l.js → studio-embedding-D8KroBXY.js} +1 -1
- package/page/assets/{studio-host-console-CaaVHxrN.js → studio-host-console-HkX8BerX.js} +2 -2
- package/page/assets/{studio-labels-BQOD-taS.js → studio-labels-6w1SKC2D.js} +1 -1
- package/page/assets/studio-live-BmVeXAu4.js +5 -0
- package/page/assets/{studio-map-BOaPPVXK.js → studio-map-5ZU1nicW.js} +1 -1
- package/page/assets/studio-session-CjUQSXx0.js +1 -0
- package/page/assets/studio-trace-replay-CSbJSN5e.js +3 -0
- package/page/assets/{studio-type-checker-BQmVytwu.js → studio-type-checker-BbUSqqOS.js} +1 -1
- package/page/assets/tool-schema-BmRYaywn.js +17 -0
- package/page/assets/{trace-record-CtL5_CIg.js → trace-record-DxgSKmYY.js} +1 -1
- package/page/assets/tree-3N-1RPZz.js +3 -0
- package/page/assets/{turn-client-yriGS51g.js → turn-client-DN8PawJr.js} +2 -2
- package/page/assets/{use-one-call-8QTXCYlp.js → use-one-call-Br2IVJLU.js} +1 -1
- package/page/assets/{use-second-ticker-rObooyH6.js → use-second-ticker-CEwOSS-d.js} +1 -1
- package/page/assets/{workspace-WKa0_gWg.js → workspace-CTSW941G.js} +1 -1
- package/page/index.html +16 -16
- package/replay.d.ts +13 -8
- package/replay.js +33 -31
- package/run-payload.d.ts +20 -6
- package/run-payload.js +85 -13
- package/runtime-scope.js +1 -0
- package/runtime.js +1 -0
- package/server/project.js +5 -32
- package/transport.d.ts +1 -3
- package/transport.js +0 -9
- package/ui/inspector.js +11 -5
- package/ui/lib/acting-as.js +1 -6
- package/ui/lib/run-keys.d.ts +15 -5
- package/ui/lib/run-keys.js +80 -16
- package/ui/lib/studio-conversation.d.ts +2 -3
- package/ui/lib/studio-conversation.js +28 -65
- package/ui/lib/studio-keep.d.ts +34 -0
- package/ui/lib/studio-keep.js +202 -0
- package/ui/lib/studio-map-kept.d.ts +2 -2
- package/ui/lib/studio-map-kept.js +5 -10
- package/ui/lib/studio-open.d.ts +1 -1
- package/ui/lib/studio-open.js +5 -5
- package/ui/lib/studio-page.js +1 -7
- package/ui/lib/studio-restore.d.ts +2 -3
- package/ui/lib/studio-restore.js +8 -48
- package/ui/lib/studio-run-open.d.ts +10 -5
- package/ui/lib/studio-run-open.js +18 -9
- package/ui/lib/studio-session.d.ts +38 -5
- package/ui/lib/studio-session.js +133 -3
- package/ui/lib/studio-store.js +8 -30
- package/ui/profile-editor.js +37 -185
- package/ui/studio-compare.js +239 -46
- package/ui/studio-run.js +29 -15
- package/ui/studio-screen.d.ts +1 -1
- package/ui/studio-screen.js +8 -9
- package/ui/studio-trace-replay.js +39 -14
- package/vite.mjs +1 -1
- package/page/assets/Banner-CzP7eU2F.js +0 -4
- package/page/assets/browser-connection-QNf4S7Ff.js +0 -3
- package/page/assets/browser-engine-DpEz1HOI.js +0 -11
- package/page/assets/browser-transport-sRqTLzGF.js +0 -45
- package/page/assets/index-CVYQrx1w.js +0 -145
- package/page/assets/reader-DlrsIIkn.js +0 -5
- package/page/assets/shaped-data-DAdn_XvU.js +0 -20
- package/page/assets/studio-live-Bz8YuQcb.js +0 -5
- package/page/assets/studio-session-yEqFQo5o.js +0 -1
- package/page/assets/studio-trace-replay-Ck0X9hTR.js +0 -3
- package/page/assets/tool-schema-B_EOjDjg.js +0 -17
- package/page/assets/tree-DM7jRXMx.js +0 -3
- package/run-payload-core.d.ts +0 -28
- package/run-payload-core.js +0 -117
package/README.md
CHANGED
|
@@ -189,18 +189,21 @@ import '@astryxdesign/core/astryx.css';
|
|
|
189
189
|
import '@theoremjs/studio/ui/built/theme.css';
|
|
190
190
|
import '@theoremjs/studio/ui/motion.css';
|
|
191
191
|
|
|
192
|
+
// In the browser, before the first render: it reads this tab's kept workspace.
|
|
193
|
+
const opened = await openStudio();
|
|
194
|
+
|
|
192
195
|
export function Studio() {
|
|
193
196
|
return (
|
|
194
197
|
<Theme theme={theoremStudioTheme} mode="dark">
|
|
195
198
|
<LayerProvider>
|
|
196
|
-
<StudioScreen opened={
|
|
199
|
+
<StudioScreen opened={opened} host={{ kernelVersion: '0.3.3' }} />
|
|
197
200
|
</LayerProvider>
|
|
198
201
|
</Theme>
|
|
199
202
|
);
|
|
200
203
|
}
|
|
201
204
|
```
|
|
202
205
|
|
|
203
|
-
Render it in the browser only. `openStudio()` reads the tab's kept workspace, so it does not run on a server.
|
|
206
|
+
Render it in the browser only. `openStudio()` reads the tab's kept workspace from the browser, so it does not run on a server. It returns a promise: await it before the first render.
|
|
204
207
|
|
|
205
208
|
`host` tells the screen about your page:
|
|
206
209
|
|
|
@@ -279,7 +282,7 @@ const studio = createStudioDraftHandler({
|
|
|
279
282
|
```
|
|
280
283
|
|
|
281
284
|
```tsx
|
|
282
|
-
<StudioScreen opened={
|
|
285
|
+
<StudioScreen opened={opened} host={{ kernelVersion: '0.3.3', lentKeys: keys }} />
|
|
283
286
|
```
|
|
284
287
|
|
|
285
288
|
`hostOptions` gets each draft's profile. The draft names its own key slots, so fill the slots its models name. A decision or embedding whose vault holds no key is refused with `auth`.
|
|
@@ -319,7 +322,7 @@ Use these when you build on the studio's draft yourself: compile it, export it a
|
|
|
319
322
|
| Export | Purpose |
|
|
320
323
|
| --- | --- |
|
|
321
324
|
| `StudioDraft`, `createBlankDraft()`, `createExampleDraft()`, `COOKBOOKS` | Editable profile draft; blank, the travel concierge, or the canonical cookbook catalog (`research`, `concierge`, `architect`, `live-concierge`, `decision`, `gemini-embedding-2`, `narrator`, `console`) |
|
|
322
|
-
| `createResearchWorkspace()`, `addResearchExample()`, `createResearchScoutDraft()`, `createPageReaderExampleDraft()`, `cookbookOpening()`, `openingFromRecords()` | The lead system cookbook: `research.scout` (OpenRouter `
|
|
325
|
+
| `createResearchWorkspace()`, `addResearchExample()`, `createResearchScoutDraft()`, `createPageReaderExampleDraft()`, `cookbookOpening()`, `openingFromRecords()` | The lead system cookbook: `research.scout` (OpenRouter `openrouter/free` by default, Gemini `gemini-3.8-flash` on `geminiInteractions` to pick, streamed thoughts, prose reply, liquid tool labels; no attachment accept list and no effort select — Goals examples turn those on) linked to `research.pagereader` (Jev decision profile that filters page passages at `post_tool`). `cookbookOpening('research')` projects its recorded `.trace.json` with the same helpers Replay exchange and Continue live use |
|
|
323
326
|
| `projectProfileSlice()`, `projectToolSlice()`, `stitchCookbook()`, `resolveCookbookSlice()` | Project or stitch individual profile facets, tool sub-objects (`auth`, `mapping`, `labels`), or full runnable programs from `COOKBOOKS` |
|
|
324
327
|
| `GOOGLE_BUILTIN_TOOLS`, `OPENROUTER_BUILTIN_TOOLS`, `GOOGLE_SPEECH_VOICES`, `googleBindingViolation()`, `localBindingViolation()`, `ollamaModelThinks()` | Provider and model cookbooks: hosted builtin tool definitions, provider media/voice vocabularies, and model binding checks |
|
|
325
328
|
| `createDecisionExampleDraft()`, `decisionExampleDraft(images?)`, `DECISION_EXAMPLE_STATE`, `decisionExampleAssets()` | The Pantry cookbook (`COOKBOOKS.decision`, agent `pantry.jev`): Jev 1.14 asked about a pantry shelf, with box, Number and Choice questions. Its four pictures ship with it, and load only when the example is made, so `createDecisionExampleDraft` and `decisionExampleAssets` return a promise; `decisionExampleDraft` is the same draft with the pictures it is given, none by default, for a page that only shows its shape. The ginger, the colour chart and the flag are the decision's own; a decision sends each one its state or questions name. Each box question names the image it reads: the Ginger and Union Jack questions read `photo`, and the chart question reads `<apple_ripeness>`. The run tab starts with the shelf in its state. Each is written as its reference, such as `<ginger>`, in the state or in the questions. The shelf and ginger photos are CC0 and the flag is public domain, all from Wikimedia Commons. The colour chart was drawn for the example |
|
|
@@ -330,7 +333,7 @@ Use these when you build on the studio's draft yourself: compile it, export it a
|
|
|
330
333
|
| `studioSource()` | Compiled draft as a TypeScript module (`registerTool`, `defineProfile`, `registerProfile`) |
|
|
331
334
|
| `LentKeys`, `LentHolds`, `StudioRunsOn`, `ON_OWN_KEYS`, `modelBindingViolation()` | What a studio runs on: a page's lent keys (which models, built-ins, and decision sizes they allow, and what runs on them keep to whatever a profile says), or the builder's own keys or machine, where a profile runs as written |
|
|
332
335
|
| `zodFromJsonSchema()`, `parseJsonSchema()` | Authored JSON Schema → Zod for registration |
|
|
333
|
-
|
|
|
336
|
+
| `maskedStudioRun()`, `studioRunCredentials()`, `withStudioRunCredentials()`, `readStudioRunIdFromUrl()`, `studioRunDefines()` | Handoff of a compiled draft to the run tab: the copy the browser keeps has its tools' credentials masked, and the run tab gets them back from the studio tab that opened it. `studioRunDefines()` says whether a kept run still defines on this package |
|
|
334
337
|
| `createStudioTransport()`, `studioInterface()` | The run tab's transport for a compiled draft; its `traces` feed receives the records each run writes |
|
|
335
338
|
| `runGuardrailProbes()`, `runGuardrailProbe()`, `probeDraft()`, `PROBE_BOUNDARIES`, `PROBE_BOUNDARY_NOTES`, `PROBE_STATUSES` | Test a draft's guardrails: send one text across every boundary, or across one, on a scripted model. Each boundary answers with a status (passed, flagged, redacted, or blocked), whether its turn was tainted by a remote read, the guardrail events, what went on past the boundary, and the turn's trace records. No model or host is called. Each boundary's note says what crosses it, when the kernel reads it and what the kernel does there |
|
|
336
339
|
| `PROBE_BATTERY` | Hard texts to probe with: disguised attacks and harmless texts that look like attacks, each with the boundary it crosses and whether a guardrail should act on it |
|
package/cookbooks/catalog.js
CHANGED
|
@@ -355,7 +355,7 @@ function exampleTextDraft(identity, tools) {
|
|
|
355
355
|
...blank,
|
|
356
356
|
identity: { ...identity, profileType: 'text', systemByRoleJson: '' },
|
|
357
357
|
included: ['outputs', 'turnBehaviour', 'guardrails', 'observability', 'labels'],
|
|
358
|
-
models: { defaultModel: '
|
|
358
|
+
models: { defaultModel: 'open', allowModelSelect: true, maxSteps: 12, key: 'gemini' },
|
|
359
359
|
modelBindings: defaultTextModelBindings(),
|
|
360
360
|
...tools,
|
|
361
361
|
inputs: {
|
|
@@ -432,16 +432,16 @@ export function createResearchScoutDraft() {
|
|
|
432
432
|
maxTurnBytes: null,
|
|
433
433
|
},
|
|
434
434
|
models: {
|
|
435
|
-
defaultModel: '
|
|
436
|
-
allowModelSelect:
|
|
435
|
+
defaultModel: 'open',
|
|
436
|
+
allowModelSelect: true,
|
|
437
437
|
maxSteps: 32,
|
|
438
438
|
key: 'openrouter',
|
|
439
439
|
},
|
|
440
440
|
modelBindings: [
|
|
441
441
|
defaultModelBinding({
|
|
442
|
-
modelId: '
|
|
442
|
+
modelId: 'open',
|
|
443
443
|
...firstServed('openrouter', 'text'),
|
|
444
|
-
apiId: '
|
|
444
|
+
apiId: 'openrouter/free',
|
|
445
445
|
keySlot: 'openrouter',
|
|
446
446
|
efforts: [
|
|
447
447
|
{ alias: 'normal', level: 'medium' },
|
|
@@ -451,6 +451,19 @@ export function createResearchScoutDraft() {
|
|
|
451
451
|
allowEffortSelect: false,
|
|
452
452
|
summaries: true,
|
|
453
453
|
}),
|
|
454
|
+
defaultModelBinding({
|
|
455
|
+
modelId: 'gemini',
|
|
456
|
+
...firstServed('gemini', 'text'),
|
|
457
|
+
apiId: 'gemini-3.8-flash',
|
|
458
|
+
keySlot: 'gemini',
|
|
459
|
+
efforts: [
|
|
460
|
+
{ alias: 'normal', level: 'medium' },
|
|
461
|
+
{ alias: 'deep', level: 'high' },
|
|
462
|
+
],
|
|
463
|
+
defaultEffort: 'normal',
|
|
464
|
+
allowEffortSelect: false,
|
|
465
|
+
summaries: true,
|
|
466
|
+
}),
|
|
454
467
|
],
|
|
455
468
|
turnBehaviour: {
|
|
456
469
|
...base.turnBehaviour,
|
package/cookbooks/tools.js
CHANGED
|
@@ -132,7 +132,7 @@ Read pages`,
|
|
|
132
132
|
data: {
|
|
133
133
|
toolName: 'search_models',
|
|
134
134
|
activity: 'Searching Hugging Face models for {search}',
|
|
135
|
-
activityPast: `Found {length
|
|
135
|
+
activityPast: `Found {length hit|hits} for {search}
|
|
136
136
|
Found hits for {search|that query}`,
|
|
137
137
|
activityFailed: 'Could not search models for {search|that query}',
|
|
138
138
|
request: 'search Hugging Face models for {search}',
|
|
@@ -161,7 +161,7 @@ Found hits for {search|that query}`,
|
|
|
161
161
|
data: {
|
|
162
162
|
toolName: 'search_datasets',
|
|
163
163
|
activity: 'Searching Hugging Face datasets for {search}',
|
|
164
|
-
activityPast: `Found {length
|
|
164
|
+
activityPast: `Found {length hit|hits} for {search}
|
|
165
165
|
Found hits for {search|that query}`,
|
|
166
166
|
activityFailed: 'Could not search datasets for {search|that query}',
|
|
167
167
|
request: 'search Hugging Face datasets for {search}',
|
|
@@ -250,7 +250,7 @@ Found hits for {search|that query}`,
|
|
|
250
250
|
data: {
|
|
251
251
|
toolName: 'search_github',
|
|
252
252
|
activity: 'Searching GitHub for {q}',
|
|
253
|
-
activityPast: `Found {total_count
|
|
253
|
+
activityPast: `Found {total_count hit|hits} for {q}
|
|
254
254
|
Found hits for {q|that query}`,
|
|
255
255
|
activityFailed: 'Could not search GitHub for {q|that query}',
|
|
256
256
|
request: 'search GitHub for {q}',
|
package/label-areas.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { type LabelKey } from '@theoremjs/agents/guardrails';
|
|
2
|
+
/** Who reads a line: the visitor, in the chat, or the model, in its context. */
|
|
3
|
+
export type LabelAudience = 'visitor' | 'model';
|
|
4
|
+
/** A labels area: the keys under one prefix, on the studio's Labels page. */
|
|
5
|
+
export type LabelArea = {
|
|
6
|
+
prefix: string;
|
|
7
|
+
title: string;
|
|
8
|
+
note: string;
|
|
9
|
+
audience: LabelAudience;
|
|
10
|
+
};
|
|
11
|
+
/** Labels' areas, by labels key prefix: what visitors read first, then what the model reads. */
|
|
12
|
+
export declare const LABEL_AREAS: readonly [{
|
|
13
|
+
readonly prefix: "error";
|
|
14
|
+
readonly title: "Errors";
|
|
15
|
+
readonly note: "When a turn fails.";
|
|
16
|
+
readonly audience: "visitor";
|
|
17
|
+
}, {
|
|
18
|
+
readonly prefix: "attachments";
|
|
19
|
+
readonly title: "Attachments";
|
|
20
|
+
readonly note: "When a file can't be sent.";
|
|
21
|
+
readonly audience: "visitor";
|
|
22
|
+
}, {
|
|
23
|
+
readonly prefix: "voice";
|
|
24
|
+
readonly title: "Voice";
|
|
25
|
+
readonly note: "When a voice note can't be recorded or used.";
|
|
26
|
+
readonly audience: "visitor";
|
|
27
|
+
}, {
|
|
28
|
+
readonly prefix: "session";
|
|
29
|
+
readonly title: "Session";
|
|
30
|
+
readonly note: "Waits, approvals, and signing in.";
|
|
31
|
+
readonly audience: "visitor";
|
|
32
|
+
}, {
|
|
33
|
+
readonly prefix: "stop";
|
|
34
|
+
readonly title: "Stops";
|
|
35
|
+
readonly note: "Why a reply ended short.";
|
|
36
|
+
readonly audience: "visitor";
|
|
37
|
+
}, {
|
|
38
|
+
readonly prefix: "composer";
|
|
39
|
+
readonly title: "Composer";
|
|
40
|
+
readonly note: "The model and effort pickers.";
|
|
41
|
+
readonly audience: "visitor";
|
|
42
|
+
}, {
|
|
43
|
+
readonly prefix: "detect.blocked";
|
|
44
|
+
readonly title: "Blocked messages";
|
|
45
|
+
readonly note: "When a detector stops the visitor's message.";
|
|
46
|
+
readonly audience: "visitor";
|
|
47
|
+
}, {
|
|
48
|
+
readonly prefix: "thought";
|
|
49
|
+
readonly title: "Thoughts";
|
|
50
|
+
readonly note: "What stands in for what a thought leaves out.";
|
|
51
|
+
readonly audience: "visitor";
|
|
52
|
+
}, {
|
|
53
|
+
readonly prefix: "live";
|
|
54
|
+
readonly title: "Live";
|
|
55
|
+
readonly note: "When a live session ends.";
|
|
56
|
+
readonly audience: "visitor";
|
|
57
|
+
}, {
|
|
58
|
+
readonly prefix: "quota";
|
|
59
|
+
readonly title: "Quota";
|
|
60
|
+
readonly note: "When the daily limit is reached.";
|
|
61
|
+
readonly audience: "visitor";
|
|
62
|
+
}, {
|
|
63
|
+
readonly prefix: "tool";
|
|
64
|
+
readonly title: "Tools";
|
|
65
|
+
readonly note: "When a tool call can't run.";
|
|
66
|
+
readonly audience: "model";
|
|
67
|
+
}, {
|
|
68
|
+
readonly prefix: "repair";
|
|
69
|
+
readonly title: "Repair";
|
|
70
|
+
readonly note: "Fixing a reply that failed its schema.";
|
|
71
|
+
readonly audience: "model";
|
|
72
|
+
}, {
|
|
73
|
+
readonly prefix: "egress";
|
|
74
|
+
readonly title: "Egress";
|
|
75
|
+
readonly note: "A reply that fails its check, sent back or refused.";
|
|
76
|
+
readonly audience: "model";
|
|
77
|
+
}, {
|
|
78
|
+
readonly prefix: "continue";
|
|
79
|
+
readonly title: "Resumption";
|
|
80
|
+
readonly note: "Picking up a reply that stopped short.";
|
|
81
|
+
readonly audience: "model";
|
|
82
|
+
}, {
|
|
83
|
+
readonly prefix: "canary";
|
|
84
|
+
readonly title: "Canary";
|
|
85
|
+
readonly note: "The note that binds each turn's canary.";
|
|
86
|
+
readonly audience: "model";
|
|
87
|
+
}, {
|
|
88
|
+
readonly prefix: "taint";
|
|
89
|
+
readonly title: "Untrusted content";
|
|
90
|
+
readonly note: "Why a tool call was refused after reading it.";
|
|
91
|
+
readonly audience: "model";
|
|
92
|
+
}, {
|
|
93
|
+
readonly prefix: "advisory";
|
|
94
|
+
readonly title: "Advisories";
|
|
95
|
+
readonly note: "Notes beside content that tries to direct it.";
|
|
96
|
+
readonly audience: "model";
|
|
97
|
+
}, {
|
|
98
|
+
readonly prefix: "detect";
|
|
99
|
+
readonly title: "Detectors";
|
|
100
|
+
readonly note: "When a detector stops a call or a result, and what it asks the model to leave out.";
|
|
101
|
+
readonly audience: "model";
|
|
102
|
+
}, {
|
|
103
|
+
readonly prefix: "sign_in";
|
|
104
|
+
readonly title: "Sign-in";
|
|
105
|
+
readonly note: "Where a tool waits for the person to sign in to a service.";
|
|
106
|
+
readonly audience: "model";
|
|
107
|
+
}, {
|
|
108
|
+
readonly prefix: "user_data";
|
|
109
|
+
readonly title: "User data";
|
|
110
|
+
readonly note: "The note on the fence around the user's message.";
|
|
111
|
+
readonly audience: "model";
|
|
112
|
+
}, {
|
|
113
|
+
readonly prefix: "context";
|
|
114
|
+
readonly title: "Turn context";
|
|
115
|
+
readonly note: "The note on the fence around what the app or the host adds.";
|
|
116
|
+
readonly audience: "model";
|
|
117
|
+
}, {
|
|
118
|
+
readonly prefix: "structured";
|
|
119
|
+
readonly title: "Structured replies";
|
|
120
|
+
readonly note: "Asking for the final answer as JSON or as an answer tool call.";
|
|
121
|
+
readonly audience: "model";
|
|
122
|
+
}, {
|
|
123
|
+
readonly prefix: "compaction";
|
|
124
|
+
readonly title: "Compaction";
|
|
125
|
+
readonly note: "Asking for the summary that replaces earlier turns.";
|
|
126
|
+
readonly audience: "model";
|
|
127
|
+
}];
|
|
128
|
+
/** One of {@linkcode LABEL_AREAS}' prefixes. */
|
|
129
|
+
export type LabelAreaPrefix = (typeof LABEL_AREAS)[number]['prefix'];
|
|
130
|
+
/** The area a label key is under: the one with the longest prefix that holds it. */
|
|
131
|
+
export declare function labelAreaOf(key: string): (typeof LABEL_AREAS)[number] | undefined;
|
|
132
|
+
/** The keys a profile's `labels` can change, which the Labels page shows. */
|
|
133
|
+
export declare const PROFILE_LABEL_KEYS: readonly LabelKey[];
|
package/label-areas.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { HOST_LABEL_KEYS, LABEL_KEYS } from '@theoremjs/agents/guardrails';
|
|
2
|
+
/** Labels' areas, by labels key prefix: what visitors read first, then what the model reads. */
|
|
3
|
+
export const LABEL_AREAS = [
|
|
4
|
+
{
|
|
5
|
+
prefix: 'error',
|
|
6
|
+
title: 'Errors',
|
|
7
|
+
note: 'When a turn fails.',
|
|
8
|
+
audience: 'visitor',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
prefix: 'attachments',
|
|
12
|
+
title: 'Attachments',
|
|
13
|
+
note: "When a file can't be sent.",
|
|
14
|
+
audience: 'visitor',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
prefix: 'voice',
|
|
18
|
+
title: 'Voice',
|
|
19
|
+
note: "When a voice note can't be recorded or used.",
|
|
20
|
+
audience: 'visitor',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
prefix: 'session',
|
|
24
|
+
title: 'Session',
|
|
25
|
+
note: 'Waits, approvals, and signing in.',
|
|
26
|
+
audience: 'visitor',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
prefix: 'stop',
|
|
30
|
+
title: 'Stops',
|
|
31
|
+
note: 'Why a reply ended short.',
|
|
32
|
+
audience: 'visitor',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
prefix: 'composer',
|
|
36
|
+
title: 'Composer',
|
|
37
|
+
note: 'The model and effort pickers.',
|
|
38
|
+
audience: 'visitor',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
prefix: 'detect.blocked',
|
|
42
|
+
title: 'Blocked messages',
|
|
43
|
+
note: "When a detector stops the visitor's message.",
|
|
44
|
+
audience: 'visitor',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
prefix: 'thought',
|
|
48
|
+
title: 'Thoughts',
|
|
49
|
+
note: 'What stands in for what a thought leaves out.',
|
|
50
|
+
audience: 'visitor',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
prefix: 'live',
|
|
54
|
+
title: 'Live',
|
|
55
|
+
note: 'When a live session ends.',
|
|
56
|
+
audience: 'visitor',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
prefix: 'quota',
|
|
60
|
+
title: 'Quota',
|
|
61
|
+
note: 'When the daily limit is reached.',
|
|
62
|
+
audience: 'visitor',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
prefix: 'tool',
|
|
66
|
+
title: 'Tools',
|
|
67
|
+
note: "When a tool call can't run.",
|
|
68
|
+
audience: 'model',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
prefix: 'repair',
|
|
72
|
+
title: 'Repair',
|
|
73
|
+
note: 'Fixing a reply that failed its schema.',
|
|
74
|
+
audience: 'model',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
prefix: 'egress',
|
|
78
|
+
title: 'Egress',
|
|
79
|
+
note: 'A reply that fails its check, sent back or refused.',
|
|
80
|
+
audience: 'model',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
prefix: 'continue',
|
|
84
|
+
title: 'Resumption',
|
|
85
|
+
note: 'Picking up a reply that stopped short.',
|
|
86
|
+
audience: 'model',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
prefix: 'canary',
|
|
90
|
+
title: 'Canary',
|
|
91
|
+
note: "The note that binds each turn's canary.",
|
|
92
|
+
audience: 'model',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
prefix: 'taint',
|
|
96
|
+
title: 'Untrusted content',
|
|
97
|
+
note: 'Why a tool call was refused after reading it.',
|
|
98
|
+
audience: 'model',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
prefix: 'advisory',
|
|
102
|
+
title: 'Advisories',
|
|
103
|
+
note: 'Notes beside content that tries to direct it.',
|
|
104
|
+
audience: 'model',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
prefix: 'detect',
|
|
108
|
+
title: 'Detectors',
|
|
109
|
+
note: 'When a detector stops a call or a result, and what it asks the model to leave out.',
|
|
110
|
+
audience: 'model',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
prefix: 'sign_in',
|
|
114
|
+
title: 'Sign-in',
|
|
115
|
+
note: 'Where a tool waits for the person to sign in to a service.',
|
|
116
|
+
audience: 'model',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
prefix: 'user_data',
|
|
120
|
+
title: 'User data',
|
|
121
|
+
note: "The note on the fence around the user's message.",
|
|
122
|
+
audience: 'model',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
prefix: 'context',
|
|
126
|
+
title: 'Turn context',
|
|
127
|
+
note: 'The note on the fence around what the app or the host adds.',
|
|
128
|
+
audience: 'model',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
prefix: 'structured',
|
|
132
|
+
title: 'Structured replies',
|
|
133
|
+
note: 'Asking for the final answer as JSON or as an answer tool call.',
|
|
134
|
+
audience: 'model',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
prefix: 'compaction',
|
|
138
|
+
title: 'Compaction',
|
|
139
|
+
note: 'Asking for the summary that replaces earlier turns.',
|
|
140
|
+
audience: 'model',
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
/** The area a label key is under: the one with the longest prefix that holds it. */
|
|
144
|
+
export function labelAreaOf(key) {
|
|
145
|
+
let found;
|
|
146
|
+
for (const area of LABEL_AREAS) {
|
|
147
|
+
const holds = key === area.prefix || key.startsWith(`${area.prefix}.`);
|
|
148
|
+
if (holds && (!found || area.prefix.length > found.prefix.length))
|
|
149
|
+
found = area;
|
|
150
|
+
}
|
|
151
|
+
return found;
|
|
152
|
+
}
|
|
153
|
+
/** The keys a profile's `labels` can change, which the Labels page shows. */
|
|
154
|
+
export const PROFILE_LABEL_KEYS = LABEL_KEYS.filter((key) => !HOST_LABEL_KEYS.includes(key));
|
package/mod.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { EXAMPLE_EMBEDDING_FILES } from './example-embedding-files.ts';
|
|
|
9
9
|
export type { GuardrailProbe, GuardrailProbeAnswer, GuardrailProbeDraft, GuardrailProbeResult, ProbeBoundary, ProbeBoundaryNote, ProbeStatus, } from './guardrail-probe.ts';
|
|
10
10
|
export { PROBE_BOUNDARIES, PROBE_BOUNDARY_NOTES, PROBE_STATUSES, PROBE_TEXT_LIMIT, probeDraft, probeRefusal, runGuardrailProbe, runGuardrailProbes, } from './guardrail-probe.ts';
|
|
11
11
|
export { unheldProblem } from './held-credentials.ts';
|
|
12
|
+
export { LABEL_AREAS, type LabelArea, type LabelAreaPrefix, type LabelAudience, labelAreaOf, PROFILE_LABEL_KEYS, } from './label-areas.ts';
|
|
12
13
|
export { type LentBinding, type LentDecisionLimits, type LentHolds, type LentKeys, type LentModel, lentCompression, type ModelBindingViolation, type ModelPicks, type ModelProfileType, type ModelStart, ON_OWN_KEYS, type StudioRunsOn, studioNetworkNote, studioTaintNote, } from './lent-keys.ts';
|
|
13
14
|
export { type DiffLine, lineDiff } from './line-diff.ts';
|
|
14
15
|
export type { StudioLiveDraftMessage } from './live-connection.ts';
|
|
@@ -21,9 +22,9 @@ export { PROBE_BATTERY, type ProbeBatteryCase } from './probe-battery.ts';
|
|
|
21
22
|
export { type ConnectionField, connectionFields, definitionFactory, definitionOf, definitionOfFactory, kernelDefinition, kernelDefinitions, LOCAL_PROVIDER_ID, localProviderAddress, type ModelRoute, modelRoute, modelSlots, onStudioLocal, optionAt, type ProtocolOptionField, type ProviderProblem, protocolOptionFields, providerProblems, registerStudioProvider, STUDIO_PROVIDERS, type StudioProvider, servedProtocols, servesProfileType, takesKey, withOption, } from './providers.ts';
|
|
22
23
|
export { type AgentKeyOf, type ProviderSourceRead, readProviderSource, readStudioSource, type StudioSourceError, type StudioSourceRead, type StudioSourceSpan, } from './read-source.ts';
|
|
23
24
|
export type { AgentToolRegistration, FunctionToolRegistration, HttpToolRegistration, McpToolRegistration, StructuredRegistration, ToolRegistration, } from './registrations.ts';
|
|
24
|
-
export { createReplay, openingFromRecords, parseTraceFile, parseTraceRecords, type Replay, type ReplayDivergence, type ReplayScript, type ReplayTurn, recordedPayload, recordedTranscript,
|
|
25
|
+
export { createReplay, openingFromRecords, parseTraceFile, parseTraceRecords, type Replay, type ReplayDivergence, type ReplayScript, type ReplayTurn, recordedPayload, recordedTranscript, replayScripts, } from './replay.ts';
|
|
25
26
|
export { bindingSlots, defaultEffortRequired, defaultModelRequired, inputLimitsRequired, keySlotUnset, } from './requirements.ts';
|
|
26
|
-
export {
|
|
27
|
+
export { createStudioRunId, keptStudioRun, maskedStudioRun, readStudioRunIdFromUrl, type StudioRunCredentials, type StudioRunPayload, studioRunCredentials, studioRunIsMasked, withStudioRunCredentials, } from './run-payload.ts';
|
|
27
28
|
export type { StudioDependency } from './runtime-scope.ts';
|
|
28
29
|
export { sectionNote } from './section-notes.ts';
|
|
29
30
|
export { type Ask, type AskPlace, askParts, reachesOthers, type SharedCarry, type SharedReach, type SharedSites, type SharedSnapshot, sharedAsk, sharedSnapshot, shortPlace, type ToolReach, type ToolSnapshot, toolReach, toolSnapshot, withSharedCarry, withToolCarry, } from './shared-carry.ts';
|
|
@@ -34,7 +35,7 @@ export { DEFAULT_TOOL_INPUT_SCHEMA, DEFAULT_TOOL_OUTPUT_SCHEMA, parseJsonSchema,
|
|
|
34
35
|
export { registerStudioTools, type StudioToolHandler, type StudioToolHandlers } from './tools.ts';
|
|
35
36
|
export { createStudioTraceRouter, STUDIO_RUN_METADATA_KEY, type StudioTraceLine, type StudioTraceRoute, type StudioTraceRouter, } from './traces.ts';
|
|
36
37
|
export type { StudioSteerLine, StudioTransportOptions } from './transport.ts';
|
|
37
|
-
export {
|
|
38
|
+
export { createStudioDecisionTransport, createStudioEmbeddingTransport, createStudioHostTransport, createStudioTransport, startStudioConversation, studioInterface, studioRunDefines, } from './transport.ts';
|
|
38
39
|
export { modelBindingNodeId, providerIdOf, providerNodeId, type StudioNodeRef, type StudioTreeNode, studioNodeRef, studioTree, toolSpecKeyOf, toolSpecNodeId, } from './tree.ts';
|
|
39
40
|
export type { StudioInputsSpec, StudioToolSeed, StudioToolSpecSeed } from './types.ts';
|
|
40
41
|
export { type AgentDraft, type AgentToolsDraft, addAgent, addProvider, agentDraft, agentNodeId, atStart, createBlankWorkspace, duplicateAgent, editedSince, type FileConflict, type FilesMerge, type FileUpdate, filesPrint, libraryDraft, mergedWithFiles, modelSharers, newProvider, providersAtStart, providerUse, rebased, removeAgent, removeLibraryTool, removeProvider, renameProvider, reopened, resetAgent, resetAgentNode, resetAll, resetLibraryTool, resetProvider, type SettingPath, STUDIO_WORKSPACE_VERSION, type StudioWorkspace, scopedNodeId, setToolAllowed, startedHere, type WorkspaceContent, type WorkspaceNodeRef, type WorkspaceStarts, type WorkspaceTree, withAgentDraft, withFilesChosen, withLibraryDraft, withProvider, workspaceFromDraft, workspaceNodeRef, workspaceTree, } from './workspace.ts';
|
package/mod.js
CHANGED
|
@@ -7,6 +7,7 @@ export { agentToolTarget, COMPACTION_DRAFT_DEFAULTS, createBlankDraft, defaultMo
|
|
|
7
7
|
export { EXAMPLE_EMBEDDING_FILES } from "./example-embedding-files.js";
|
|
8
8
|
export { PROBE_BOUNDARIES, PROBE_BOUNDARY_NOTES, PROBE_STATUSES, PROBE_TEXT_LIMIT, probeDraft, probeRefusal, runGuardrailProbe, runGuardrailProbes, } from "./guardrail-probe.js";
|
|
9
9
|
export { unheldProblem } from "./held-credentials.js";
|
|
10
|
+
export { LABEL_AREAS, labelAreaOf, PROFILE_LABEL_KEYS, } from "./label-areas.js";
|
|
10
11
|
export { lentCompression, ON_OWN_KEYS, studioNetworkNote, studioTaintNote, } from "./lent-keys.js";
|
|
11
12
|
export { lineDiff } from "./line-diff.js";
|
|
12
13
|
export { studioLiveConnection, studioPageTools } from "./live-connection.js";
|
|
@@ -17,9 +18,9 @@ export { firstServed, isGoogleRoute, isOpenRouterRoute, isProviderBuiltinId, mod
|
|
|
17
18
|
export { PROBE_BATTERY } from "./probe-battery.js";
|
|
18
19
|
export { connectionFields, definitionFactory, definitionOf, definitionOfFactory, kernelDefinition, kernelDefinitions, LOCAL_PROVIDER_ID, localProviderAddress, modelRoute, modelSlots, onStudioLocal, optionAt, protocolOptionFields, providerProblems, registerStudioProvider, STUDIO_PROVIDERS, servedProtocols, servesProfileType, takesKey, withOption, } from "./providers.js";
|
|
19
20
|
export { readProviderSource, readStudioSource, } from "./read-source.js";
|
|
20
|
-
export { createReplay, openingFromRecords, parseTraceFile, parseTraceRecords, recordedPayload, recordedTranscript,
|
|
21
|
+
export { createReplay, openingFromRecords, parseTraceFile, parseTraceRecords, recordedPayload, recordedTranscript, replayScripts, } from "./replay.js";
|
|
21
22
|
export { bindingSlots, defaultEffortRequired, defaultModelRequired, inputLimitsRequired, keySlotUnset, } from "./requirements.js";
|
|
22
|
-
export {
|
|
23
|
+
export { createStudioRunId, keptStudioRun, maskedStudioRun, readStudioRunIdFromUrl, studioRunCredentials, studioRunIsMasked, withStudioRunCredentials, } from "./run-payload.js";
|
|
23
24
|
export { sectionNote } from "./section-notes.js";
|
|
24
25
|
export { askParts, reachesOthers, sharedAsk, sharedSnapshot, shortPlace, toolReach, toolSnapshot, withSharedCarry, withToolCarry, } from "./shared-carry.js";
|
|
25
26
|
export { sharedAt, sharedEntries, sharedNodeId, sharedOpens, } from "./shared-settings.js";
|
|
@@ -28,6 +29,6 @@ export { sampleToolInput, stubOutputFromSchema } from "./stub.js";
|
|
|
28
29
|
export { DEFAULT_TOOL_INPUT_SCHEMA, DEFAULT_TOOL_OUTPUT_SCHEMA, parseJsonSchema, sampleFromJsonSchema, zodFromJsonSchema, } from "./tool-schema.js";
|
|
29
30
|
export { registerStudioTools } from "./tools.js";
|
|
30
31
|
export { createStudioTraceRouter, STUDIO_RUN_METADATA_KEY, } from "./traces.js";
|
|
31
|
-
export {
|
|
32
|
+
export { createStudioDecisionTransport, createStudioEmbeddingTransport, createStudioHostTransport, createStudioTransport, startStudioConversation, studioInterface, studioRunDefines, } from "./transport.js";
|
|
32
33
|
export { modelBindingNodeId, providerIdOf, providerNodeId, studioNodeRef, studioTree, toolSpecKeyOf, toolSpecNodeId, } from "./tree.js";
|
|
33
34
|
export { addAgent, addProvider, agentDraft, agentNodeId, atStart, createBlankWorkspace, duplicateAgent, editedSince, filesPrint, libraryDraft, mergedWithFiles, modelSharers, newProvider, providersAtStart, providerUse, rebased, removeAgent, removeLibraryTool, removeProvider, renameProvider, reopened, resetAgent, resetAgentNode, resetAll, resetLibraryTool, resetProvider, STUDIO_WORKSPACE_VERSION, scopedNodeId, setToolAllowed, startedHere, withAgentDraft, withFilesChosen, withLibraryDraft, withProvider, workspaceFromDraft, workspaceNodeRef, workspaceTree, } from "./workspace.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/studio",
|
|
3
|
-
"version": "0.3.4-next.
|
|
3
|
+
"version": "0.3.4-next.671.gfa09ab2",
|
|
4
4
|
"description": "Theorem Studio: open a project's agents in a local studio on Deno, edit and run them, and save back to its files; or show the studio screen in a Vite app.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"zod": "^4.6.5",
|
|
80
|
-
"@theoremjs/agents": "0.3.4-next.
|
|
81
|
-
"@theoremjs/web": "0.3.4-next.
|
|
82
|
-
"@theoremjs/react": "0.3.4-next.
|
|
80
|
+
"@theoremjs/agents": "0.3.4-next.671.gfa09ab2",
|
|
81
|
+
"@theoremjs/web": "0.3.4-next.671.gfa09ab2",
|
|
82
|
+
"@theoremjs/react": "0.3.4-next.671.gfa09ab2"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|
|
85
85
|
"@theoremjs/react": {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TraceInspector-h030OQ82.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-3IqahpCr.js","assets/tokens.stylex-DkHf0P9C.js","assets/SegmentedControlItem-CZs-ycSA.js","assets/padding.stylex-B76907Zf.js","assets/VStack-CkVMcNiK.js","assets/mergeProps-ptS-gIMz.js","assets/StackItem-CQviqAfM.js","assets/useLayerDismissal-BAnTRYTt.js","assets/fieldParts-CoOpDoax.js","assets/Icon-BqkS-pIq.js","assets/devWarning-DxuplmRl.js","assets/Text-BOqCfzZC.js","assets/sharedResizeObserver-4U9Xq5Oq.js","assets/preload-helper-DpV6A1kQ.js","assets/useMediaQuery-BCT0NUeZ.js","assets/useResolvedRequired-DbsOcDqy.js","assets/useAnnounce-DTSHZvjg.js","assets/Tooltip-BWs5DLrM.js","assets/useTooltip-c097gL_-.js","assets/focusOutline.stylex-BT0kfa4t.js","assets/IconButton-DVUFx-8p.js","assets/focusableSelector-DXZeMU85.js","assets/useDevWarning-Z9SoixOP.js","assets/createReactComponent-CZwsv6DD.js","assets/isRtlElement-BG33-k_H.js","assets/plainDate-BHiJcj7o.js","assets/DateInput-CalwZl6a.js","assets/focusReturn-CTppP2k0.js","assets/Card-DruykyeB.js","assets/container.stylex-BmOi-8DQ.js","assets/ScrollableArea-ChTx-OVZ.js","assets/useScrollableArea-DuF_pz9m.js","assets/chainEventHandlers-C6ttXGfW.js","assets/BottomSheet-Dbh6A5Vl.js","assets/useScrollLock-Dyf6PHJt.js","assets/SidePanel-DEd3R1Q3.js","assets/CheckboxInput-CFZ_Wq8-.js","assets/isRenderable-DHkzpAoQ.js","assets/IconAlertTriangle-BqAEqqdU.js","assets/row-keys-WByP9Hsh.js","assets/IconShield-DDOh7Gr5.js","assets/shaped-data-H1miOZm2.js","assets/host-patterns-F-KZIzkF.js","assets/trace-record-DxgSKmYY.js","assets/TraceOverview-BsON_uZj.js","assets/labels-provider-t4c-5JMk.js","assets/CodeBlock-CfVOtDeO.js","assets/useClipboard-CbN9bb4J.js","assets/index-CqwmMJ4C.js","assets/browser-transport-BK4cbTE_.js","assets/Center-nHS1JSux.js","assets/IconSearch-BTx66a40.js","assets/schemas-BQ9Jydzb.js","assets/tool-schema-BmRYaywn.js","assets/reader-DrOfMM8I.js","assets/browser-connection-DSUHVCT5.js","assets/live-ingress-OuSlQ6q7.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-nxRsh1jo.js","assets/Dialog-Sd04KQS2.js","assets/HoverCard-DMyWUvwP.js","assets/IconEye-BB5aY-wQ.js","assets/studio-labels-6w1SKC2D.js","assets/turn-client-DN8PawJr.js","assets/encode-files-DhoC5hWG.js","assets/CollapsibleGroup-BsIYDnJR.js","assets/tree-3N-1RPZz.js","assets/crypto-CD14HeXH.js","assets/use-second-ticker-CEwOSS-d.js","assets/use-second-ticker-GWBt83pd.css","assets/workspace-CTSW941G.js","assets/lent-keys-C32ems-I.js","assets/editors-BJX_S59A.js","assets/studio-session-CjUQSXx0.js","assets/EmptyState-C_uF9Wyj.js","assets/useMenuPress-DLG1QOiE.js","assets/useAdaptivePresentation-Bma4-u1a.js","assets/useFocusReturnVisibility-BHKv5Jwr.js","assets/ListItem-QF7KFt0h.js","assets/index-C9rhrCGT.css","assets/trace-patterns-D6TbkLLr.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{h as a}from"./tokens.stylex-DkHf0P9C.js";import{t as o}from"./mergeProps-ptS-gIMz.js";import{b as s}from"./fieldParts-CoOpDoax.js";import{t as c}from"./isRenderable-DHkzpAoQ.js";import{t as l,x as u}from"./Icon-BqkS-pIq.js";import{T as d,c as f,d as p,l as m,m as h,p as g,s as _,t as v,u as y}from"./SidePanel-DEd3R1Q3.js";import{t as b}from"./preload-helper-DpV6A1kQ.js";import{n as ee,t as te}from"./labels-provider-t4c-5JMk.js";import{c as ne,n as re}from"./IconButton-DVUFx-8p.js";import{t as x}from"./createReactComponent-CZwsv6DD.js";import{a as ie}from"./ScrollableArea-ChTx-OVZ.js";import{F as ae,R as S,Y as C,_ as w,h as T,hn as oe,i as E,j as D,q as O,v as se,yt as k,z as A}from"./tool-schema-BmRYaywn.js";import{c as j,r as ce}from"./host-patterns-F-KZIzkF.js";import{Gn as le,Pn as M,Rn as N,Rr as ue,Sr as P,Un as F,Vn as de,an as fe,gr as I,in as pe,jn as me,vr as he}from"./shaped-data-H1miOZm2.js";import{C as L,G as R,H as ge,K as _e,S as z,W as ve,_ as ye,h as be,l as xe,m as Se,q as Ce,s as we,t as B}from"./tree-3N-1RPZz.js";import{W as Te,_ as Ee,c as De,h as Oe,u as V}from"./browser-connection-DSUHVCT5.js";import{a as ke,r as Ae}from"./live-ingress-OuSlQ6q7.js";import{n as je,r as Me}from"./use-second-ticker-CEwOSS-d.js";var Ne=x(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),Pe=x(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),H=`••••`,Fe=/auth|key|token|secret|passw|pwd|cookie|session|signature|^sig$|credential|^code$|appid/i,Ie=/auth|key|token|secret|passw|pwd|signature|credential|appid/i,Le=[[/^AIza/,`Google API key`],[/^sk-or-/,`OpenRouter key`],[/^sk-ant-/,`Anthropic key`],[/^sk-/,`OpenAI key`],[/^(?:ghp_|github_pat_)/,`GitHub token`],[/^xox[baprs]-/,`Slack token`],[/^AKIA/,`AWS access key id`],[/^eyJ[\w-]+\.[\w-]+\./,`JWT`],[/^Bearer\s/i,`a whole Bearer header, not a bare token`],[/^https?:\/\//i,`a URL, not a key`]],Re=16;function ze(e,t={}){let n=typeof e==`string`?e:``,r=n.trim(),i=[];/^(?:<.*>|x{3,}|\.{3}|your[-_ ]?(?:api[-_ ]?)?key|changeme|todo)$/i.test(r)?i.push(`a placeholder, not a real value`):(r&&r!==n&&i.push(`spaces or a line break around it`),/[\r\n]/.test(r)?i.push(`a line break inside`):/\s/.test(r)&&i.push(`a space inside`),/^(['"`]).*\1$/.test(r)&&i.push(`wrapped in quotes`),r&&r.length<Re&&i.push(`shorter than keys usually are`));let a=Le.find(([e])=>e.test(r))?.[1];return{secret:!0,set:r.length>0,...a?{looksLike:a}:{},problems:i,sameAs:[...t.sameAs??[]],usedBy:[...t.usedBy??[]]}}var U=/^([a-z][a-z0-9+.-]*:\/\/)([^/?#@]*)@/i,W=/([?&;])([^=?&;#\s]*)=([^&;#\s]*)/g;function G(e){let t=e.indexOf(`:`);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)]}function Be(e){try{return decodeURIComponent(e)}catch{return e}}function K(e){return Fe.test(e)}function Ve(e){let t=URL.canParse(e)?Fe:Ie;return e.replace(U,(e,t,n)=>{let[r,i]=G(n);return`${t}${r&&`••••`}${i===void 0?``:`:${i&&`••••`}`}@`}).replace(W,(e,n,r,i)=>i&&t.test(Be(r))?`${n}${r}=${H}`:e)}function He(e,t){let[n,r]=G(U.exec(t)?.[2]??``),i=new Map;for(let[,,e=``,n=``]of t.matchAll(W))i.set(e,[...i.get(e)??[],n]);return e.replace(U,(e,t,i)=>{let[a,o]=G(i),s=a===`••••`&&n?n:a,c=o===`••••`&&r?r:o;return`${t}${s}${c===void 0?``:`:${c}`}@`}).replace(W,(e,t,n,r)=>{let a=r===`••••`?i.get(n)?.shift():void 0;return a?`${t}${n}=${a}`:e})}function Ue(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,n===`••••`?t?.[e]??n:n]))}function We(e){if(e==null||e===``)return e;let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return`(not a JSON object, ${String(e.length)} characters)`}if(typeof t!=`object`||!t||Array.isArray(t))return`(not a JSON object)`;let n=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,K(e)?H:t]));return typeof e==`string`?JSON.stringify(n):n}var Ge=/\{\s*private\s*:/g;function Ke(e,t){return e.slice(0,t).split(`
|
|
3
|
+
`).length}function qe(e){let t=[],n=0;for(let r of e.matchAll(Ge)){if(r.index<n)continue;let i=1,a=r.index+r[0].length;for(;a<e.length&&i>0;a++)e[a]===`{`?i++:e[a]===`}`&&i--;if(i>0)return{ok:!1,message:`The {private: section on line ${String(Ke(e,r.index))} has no closing }.`};let o=e.slice(r.index+r[0].length,a-1).trim();if(!o)return{ok:!1,message:`The {private: section on line ${String(Ke(e,r.index))} is empty.`};t.push(e.slice(n,r.index),{private:o}),n=a}if(t.push(e.slice(n)),t.length===1)return{ok:!0,prompt:e.trim()||void 0};let r=t[0],i=t.at(-1);return typeof r==`string`&&(t[0]=r.trimStart()),typeof i==`string`&&(t[t.length-1]=i.trimEnd()),{ok:!0,prompt:t.filter(e=>e!==``)}}var Je=()=>void 0,Ye=()=>void 0;function q(e){return(e??[]).map(e=>e.trim()).filter(Boolean)}function J(e,t,n,r,i,a){i===null||Number.isInteger(i)&&i>=a||e(t,`${r} must be a ${a?`positive`:`non-negative`} whole number.`,n)}var Xe={agentId:{label:`Profile id`,max:64},handle:{label:`Handle`,max:32}};function Ze(e,t,n){let{label:r,max:i}=Xe[t];n.trim()?Array.from(n).length>i&&e(`identity`,`${r} is at most ${i} characters.`,t):e(`identity`,`${r} is required.`,t)}function Qe(e,t){Ze(t,`agentId`,e.identity.agentId),e.identity.profileType!==`host`&&Ze(t,`handle`,e.identity.handle)}function $e(e,t,n,r){let i=B(e.key),a=D(n,t,{...e,apiId:e.apiId.trim()}),o=n.find(t=>t.id===e.provider);if(!o)r(i,`No provider is defined as ${e.provider}.`,`provider`);else if(!A(o,t))r(i,`${e.provider} doesn't serve ${t} agents.`,`provider`);else if(!A(o,t,e.protocol)){let n=(S(o,t)??[]).map(e=>e.id).join(` or `);r(i,n?`${e.provider} runs ${t} agents on ${n}, not ${e.protocol}.`:`${e.provider} doesn't serve ${t} agents on ${e.protocol}.`,`protocol`)}return a.apiId||r(i,`API model is required.`,`apiId`),a}function et(e){return e.length<2?e[0]??``:`${e.slice(0,-1).join(`, `)} or ${e.at(-1)}`}function tt(e,t){let n=ae(e).map(e=>e.path.split(`.`)[0]??e.path).find(e=>e.toLowerCase()===t.toLowerCase());return n?`${e.id} has no option ${t}. Did you mean ${n}?`:`${e.id} has no option ${t}.`}function nt(e,t,n,r){let i={};e.efforts.forEach(({alias:a,level:o},s)=>{let c=a.trim();c?c in i?r(n,`Effort alias '${c}' is used twice.`,`efforts`,s):i[c]=o:r(n,`Every effort needs an alias.`,`efforts`,s),T(t)&&!C.includes(o)&&r(n,`${e.provider} takes the ${et(C)} thinking level, not ${o}.`,`efforts`,s)}),e.allowEffortSelect&&Object.keys(i).length<2&&r(n,`Effort select needs at least two efforts.`,`allowEffortSelect`);let a=e.defaultEffort.trim();if(!a&&R(e))r(n,`Pick a default effort — there is more than one.`,`defaultEffort`);else if(a&&!(a in i)){let e=Object.keys(i);r(n,e.length?`Default effort '${a}' is not one of the efforts. Pick ${et(e)}.`:`Default effort '${a}' is not one of the efforts.`,`defaultEffort`)}return{efforts:i,defaultEffort:a}}function rt(e,t,n,r,i){let a=B(e.key),o=$e(e,t,n,r),{apiId:s}=o,{efforts:c,defaultEffort:l}=nt(e,o,a,r),u=Object.keys(c).length;J(r,a,`maxOutputTokens`,`Max output tokens`,e.maxOutputTokens,1),e.temperature!==null&&!(Number.isFinite(e.temperature)&&e.temperature>=0)&&r(a,`Temperature must be zero or more.`,`temperature`),at(e,n,t,a,r);let d=ot(e,t,a,r,i),f=it(e,a,r);return{protocol:e.protocol,provider:e.provider,apiId:s,...e.keySlot?{keySlot:e.keySlot}:{},...e.fallbackKeySlot?{fallbackKeySlot:e.fallbackKeySlot}:{},...u?{efforts:c}:{},...l?{defaultEffort:l}:{},...e.allowEffortSelect?{allowEffortSelect:!0}:{},...e.summaries===null?{}:{summaries:e.summaries},...e.maxOutputTokens===null?{}:{maxOutputTokens:e.maxOutputTokens},...e.temperature===null?{}:{temperature:e.temperature},...e.builtInTools.length?{builtInTools:[...e.builtInTools]}:{},...Object.keys(e.options).length?{options:e.options}:{},...f?{limits:f}:{},...d?{compaction:d}:{}}}function it(e,t,n){let r={};for(let{name:i,label:a,isTimer:o}of be){let s=e.limits?.[i]??null;s!==null&&(J(n,t,`limits.${i}`,a,s,1),o&&s>2147483647&&n(t,`${a} must be at most ${ye} ms.`,`limits.${i}`),r[i]=s)}return Object.keys(r).length?r:void 0}function at(e,t,n,r,i){let a=t.find(t=>t.id===e.provider),o=a&&S(a,n)?.find(t=>t.id===e.protocol);for(let t of o?.options.safeParse(e.options).error?.issues??[]){let e=t.code===`unrecognized_keys`?t.keys[0]:t.path[0];i(r,o&&t.code===`unrecognized_keys`&&typeof e==`string`?tt(o,e):t.message,typeof e==`string`?`options.${e}`:`options`)}let s=e.apiId.trim();for(let t of s?o?.refusedOptions?.(s)??[]:[])e.options[t]!==void 0&&i(r,`${s} takes no ${t}.`,`options.${t}`)}function ot(e,t,n,r,i){let a=e.compactTiming;if(!a)return;t!==`text`&&r(n,`Only a text agent compacts its own history.`,`compactTiming`);let o=e.compactMaxTokens??null,s=e.compactAt??xe.compactAt,c=e.compactKeep??null;o===null&&r(n,`Compaction needs a budget.`,`compactMaxTokens`),J(r,n,`compactMaxTokens`,`Budget`,o,1),s>0&&s<1||r(n,`Compaction must start between 0 and 1 of the budget.`,`compactAt`),c!==null&&(c===0||Number.isInteger(c)&&c>=1||c>0&&c<s)||r(n,`Keep a whole number of exchanges, a fraction of the budget below where compaction starts, or 0.`,`compactKeep`);let l=e.compactWith??``,u=l?i(l):void 0;return l&&!u&&r(n,`The agent that summarised is gone. Pick another, or this agent.`,`compactWith`),{maxTokens:o??0,compactAt:s,...u?{profile:u}:{},previousExchanges:c??0,timing:a,...e.compactMeter?{meter:e.compactMeter}:{}}}function st(e,t,n){let{models:r,modelBindings:i}=e;i.length||n(`models`,`Add at least one model.`);let a=r.defaultModel.trim();return a&&!(a in t)?n(`models`,`Default model '${a}' is not one of the models.`,`defaultModel`):!a&&_e(e)&&n(`models`,`Pick a default model — there is more than one.`,`defaultModel`),r.maxSteps!==null&&!Number.isInteger(r.maxSteps)&&n(`models`,`Max steps must be a whole number.`,`maxSteps`),a}function ct(e,t,n,r){let{models:i,modelBindings:a}=e,o={};for(let s of a){let a=rt({...s,keySlot:s.keySlot||i.key||void 0,fallbackKeySlot:s.fallbackKeySlot||i.fallbackKey||void 0},t,e.providers,n,r),c=s.modelId.trim(),l=B(s.key);c?c in o?n(l,`Model id '${c}' is used twice.`,`modelId`):o[c]=a:n(l,`Model id is required.`,`modelId`)}let s=st(e,o,n),c=i.providerHistory===`provider`||i.providerHistory===`stateless`?i.providerHistory:void 0;return{models:o,...s?{defaultModel:s}:{},...c?{providerContinuation:{history:c}}:{},...i.allowModelSelect?{allowModelSelect:!0}:{},...i.maxSteps===null?{}:{maxSteps:i.maxSteps}}}function Y(e,t){if(!e?.trim())return;let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=Object.entries(n);return r.every(([,e])=>t(e))?r.length?Object.fromEntries(r):void 0:null}var lt=e=>typeof e==`string`,ut=e=>!0;function dt(e){return Y(e,lt)}var ft=e=>Te(e,`system`)===void 0;function pt(e,t){let n=Y(e,ft);if(n===null){t(`Instructions by role must be a JSON object of text, or of lists of text and { "private": text }.`);return}if(!n)return;let r={};for(let[e,i]of Object.entries(n)){if(typeof i!=`string`){r[e]=i;continue}let n=qe(i);if(!n.ok){t(`${e}: ${n.message}`);return}n.prompt!==void 0&&(r[e]=n.prompt)}return r}function mt(e,t,n){let r=Y(e,t);return r===null&&n(),r??void 0}function ht(e,t){if(!e.authType||e.authType===`none`)return;let n=e.authService?.trim()??``;n||t(`Service is required.`,`authService`);let r=q(e.authScopes),i=e.authType===`api_key`?e.authQueryParam?.trim():void 0;i&&q(e.queryParams).includes(i)&&t(`${i} is also one of the query parameters the model fills.`,`authQueryParam`);let a=i?{queryParam:i}:{...e.authHeaderName?.trim()?{headerName:e.authHeaderName.trim()}:{},...e.authHeaderPrefix===void 0?{}:{headerPrefix:e.authHeaderPrefix}};return{slot:e.authSlot?.trim()||`default`,type:e.authType,service:n,...a,onUnauthenticated:e.authUnauthenticated??`gate`,...r.length?{scopes:r}:{},...e.authClientId?.trim()?{clientId:e.authClientId.trim()}:{},...e.authRedirectUri?.trim()?{redirectUri:e.authRedirectUri.trim()}:{}}}function gt(e){try{return new URL(e),!0}catch{return!1}}function _t(e,t){e?w(e)&&t(`${e} is a provider builtin — turn it on under the model's built-in tools.`,`toolName`):t(`Tool name is required.`,`toolName`)}function vt(e,t,n){let r=e.toolName.trim();_t(r,t);let i=e.description.trim();i||t(`Description is required.`,`description`);let a=e.toolType===`agent`?{inputSchema:n(e.agentKey??``)??bt,outputSchema:xt}:yt(e,t),o=q(e.paths);return{name:r,description:i,category:e.category.trim()||`studio`,access:e.access,permission:e.permission,loadTier:e.loadTier,paths:o.length?o:[`*`],...a}}function yt(e,t){let n=E(e.inputJson,`Input`);n.ok||t(n.error,`inputJson`);let r=E(e.outputJson,`Output`);return r.ok||t(r.error,`outputJson`),{inputSchema:n.ok?n.schema:{},outputSchema:r.ok?r.schema:{}}}var bt=V(Oe({type:`text`}),`input`),xt=V(Ee,`output`);function St(e){let t=e.identity.profileType;if(t!==`text`&&t!==`image`&&t!==`speech`)return;let n=t!==`speech`&&L(e).includes(`inputs`)?Rt(e.inputs,t,()=>{}):void 0;return V(Oe({type:t,...n?{inputs:n}:{}}),`input`)}function Ct(e){return(e??``).split(`
|
|
4
|
+
`).map(e=>e.trim()).filter(Boolean)}function wt(e,t,n){let r={},i={activity:{input:t.inputSchema},activityPast:{input:t.inputSchema,output:t.outputSchema},activityFailed:{input:t.inputSchema},request:{input:t.inputSchema}};for(let t of[`activity`,`activityPast`,`activityFailed`,`request`]){let a=Ct(e[t]),[o]=a;if(o===void 0)continue;let s=a.length===1?o:a,c=k(s,i[t]);c?n(c,t):r[t]=s}return Object.keys(r).length?r:void 0}function Tt(e){let t=Object.entries(e??{}).find(([e,t])=>K(e)&&t!==`••••`)?.[0];return t?`${t} looks like a credential. Put it under Auth instead: Auth asks for it when a call runs and nothing saves it.`:void 0}function Et(e){if(!e||!URL.canParse(e))return;let t=[...new URL(e).searchParams].find(([e,t])=>K(e)&&t&&t!==`••••`)?.[0];return t?`${t} in the URL looks like a credential. Put it under Auth instead, as an API key with ${t} as its query parameter: Auth asks for it when a call runs and nothing saves it.`:void 0}function Dt(e,t){let n=dt(e.headersJson);n===null&&t(`Headers must be a JSON object of strings. Until they are, a reload brings back the headers as they started.`,`headersJson`);let r=Tt(n??void 0);r&&t(r,`headersJson`);let i=e.toolType===`mcp`?`serverUrl`:`endpoint`,a=Et(e[i]?.trim());a&&t(a,i);let o=ht(e,t),s=e.maxResponseBytes??null;return s!==null&&!(Number.isInteger(s)&&s>=1)&&t(`Max response must be a positive whole number.`,`maxResponseBytes`),{...n?{headers:n}:{},...o?{auth:o}:{},...s===null?{}:{maxResponseBytes:s}}}function Ot(e,t,n,r){let i=e[t]?.trim()??``;return i?gt(i)||r(`${n} must be a full URL.`,t):r(`${n} is required.`,t),i}function kt(e,t,n){let r=Ot(e,`endpoint`,`Endpoint URL`,n),i=q(e.pathParams),a=q(e.queryParams),o=e.bodyParam?.trim(),s={...i.length?{pathParams:i}:{},...a.length?{queryParams:a}:{},...o?{bodyParam:o}:{}};return{type:`http`,...t,endpoint:r,method:e.method??pe[0],...Dt(e,n),...Object.keys(s).length?{mapping:s}:{}}}function At(e,t,n){let r=Ot(e,`serverUrl`,`MCP server URL`,n),i=e.mcpToolName?.trim()??``;return i||n(`MCP tool name is required.`,`mcpToolName`),{type:`mcp`,...t,serverUrl:r,mcpToolName:i,...Dt(e,n),...jt(e,n)}}function jt(e,t){let n=e.sessionIdleMs??null,r=e.sessionMax??null;n!==null&&!(Number.isInteger(n)&&n>=1)&&t(`Idle must be a positive whole number.`,`sessionIdleMs`),r!==null&&!(Number.isInteger(r)&&r>=1)&&t(`Max must be a positive whole number.`,`sessionMax`);let i={...n===null?{}:{idleMs:n},...r===null?{}:{max:r}};return Object.keys(i).length?{session:i}:{}}function Mt(e,t,n){let r=e.answeredBy===`page`?{answeredBy:`page`}:{};if(!e.stubOutputJson?.trim())return{type:`function`,...t,...r};let i=E(e.stubOutputJson,`Stub output`);return i.ok||n(i.error.replace(` JSON Schema`,``),`stubOutputJson`),{type:`function`,...t,...r,...i.ok?{stubResponse:i.schema}:{}}}function Nt(e,t,n,r){let i=e.agentKey??``,a=i?r(i):void 0;i?a||n(`The agent this tool ran is gone. Pick another.`,`agentKey`):n(`Pick the agent this tool runs.`,`agentKey`);let o=e.maxCallsPerTurn??null;return o!==null&&!(Number.isInteger(o)&&o>=1)&&n(`Calls per turn must be a positive whole number.`,`maxCallsPerTurn`),{type:`agent`,...t,profile:a??``,...o===null?{}:{maxCallsPerTurn:o}}}var Pt={http:kt,mcp:At,function:Mt,agent:Nt};function Ft(e){return je.includes(e)}function It(e,t,n,r){let i=we(e.key);if(!Ft(e.toolType)){t(i,Me,`toolType`);return}let a=!1,o=(e,n)=>{a=!0,t(i,e,n)},s=vt(e,o,r),c=wt(e,s,o),l=Pt[e.toolType](e,s,o,n),u=e.toolType===`agent`?``:e.stageAgentKey?.trim()??``,d=u?n(u):void 0;return a?void 0:{...l,...c?{labels:c}:{},...d&&l.type!==`agent`?{stageAgent:d}:{}}}function Lt(e,t,n,r,i,a){let o=[],s=new Set;for(let t of e.toolSpecs){let e=It(t,r,i,a);e&&(s.has(e.name)?r(we(t.key),`Tool name '${e.name}' is used twice.`,`toolName`):(s.add(e.name),o.push(e)))}let c=o.map(e=>e.name),l=t?e.tools.t2Loader.trim():``;l&&!s.has(l)&&r(`tools`,`T2 loader '${l}' must be one of the custom tools.`,`t2Loader`);let u=n&&e.tools.parallel;return{customTools:o,tools:{allow:c,...l?{t2Loader:l}:{},...u?{parallel:u}:{}}}}function Rt(e,t,n){let r=t===`image`?e.attachmentsAccept.filter(e=>!oe(fe,e)):[];if(r.length&&n(`inputs`,`An image profile takes images, video, and PDF only, not ${r.join(`, `)}.`,`attachmentsAccept`),!e.text&&!e.attachmentsAccept.length&&!e.voiceAccept.length&&n(`inputs`,`Take text, files, or voice notes: with none, the agent can be sent nothing.`,`text`),Ce(e)){let t=[[`maxFiles`,`Max files`,e.maxFiles],[`maxBytes`,`Max bytes`,e.maxBytes],[`maxTurnBytes`,`Max turn bytes`,e.maxTurnBytes]];for(let[e,r,i]of t)i===null&&n(`inputs`,`${r} is required with attachments or voice.`,e)}J(n,`inputs`,`maxFiles`,`Max files`,e.maxFiles,1),J(n,`inputs`,`maxBytes`,`Max bytes`,e.maxBytes,1),J(n,`inputs`,`maxTurnBytes`,`Max turn bytes`,e.maxTurnBytes,1);let i=Bt(e,n),a=Ht(e,n),o=zt(e,n);return{...e.text?{}:{text:!1},...e.attachmentsAccept.length?{attachments:{accept:[...e.attachmentsAccept]}}:{},...e.voiceAccept.length?{voice:{accept:[...e.voiceAccept]}}:{},...e.maxFiles===null?{}:{maxFiles:e.maxFiles},...e.maxBytes===null?{}:{maxBytes:e.maxBytes},...e.maxTurnBytes===null?{}:{maxTurnBytes:e.maxTurnBytes},...i?{limitsByMime:i}:{},...a?{slots:a}:{},...o?{context:o}:{}}}function zt(e,t){if(e.contextFrom.length)return e.contextMaxChars===null&&t(`inputs`,`Max characters is required with context.`,`contextMaxChars`),J(t,`inputs`,`contextMaxChars`,`Max characters`,e.contextMaxChars,1),{from:[...e.contextFrom],maxChars:e.contextMaxChars??0}}function Bt(e,t){let n=Object.entries(e.limitsByMime);for(let[e,r]of n)Number.isInteger(r)&&r>=1||t(`inputs`,`Max size for ${e} must be a whole number of at least 1.`,`limitsByMime`);return n.length?{...e.limitsByMime}:void 0}function Vt(e,t,n){let r=e.name.trim(),i=[];r?n.findIndex(e=>e.name.trim()===r)<t&&i.push(`Another slot is called ${r}.`):i.push(`Name this slot.`);let a=e.choices.map(e=>e.value.trim());a.some(Boolean)||i.push(`Give this slot a choice.`),e.choices.some((e,t)=>!a[t]&&e.description.trim())&&i.push(`Every choice with a description needs a value.`);let o=a.filter((e,t)=>e&&a.indexOf(e)<t);for(let e of new Set(o))i.push(`${e} is a choice twice.`);return i}function Ht(e,t){if(e.slots.length)return e.slots.forEach((n,r)=>{for(let i of Vt(n,r,e.slots))t(`inputs`,i,`slots`,r)}),Object.fromEntries(e.slots.map(e=>{let t=e.label.trim(),n=e.choices.filter(e=>e.value.trim()).map(e=>({value:e.value.trim(),description:e.description.trim()})),r=!t&&n.every(e=>!e.description)?n.map(e=>e.value):{...t?{label:t}:{},choices:n.map(({value:e,description:t})=>t?{value:e,description:t}:{value:e})};return[e.name.trim(),r]}))}function Ut(e,t){let n=Ht(e,t),r=zt(e,t);return!n&&!r?{}:{inputs:{...n?{slots:n}:{},...r?{context:r}:{}}}}function Wt(e,t,n){let r,i=t&&e.validationEnabled;if(t&&e.mode===`structured`){let t=e.schemaId.trim();t||n(`outputs`,`Structured output needs a schema id.`,`schemaId`);let i=E(e.schemaJson,`Structured output`);i.ok||n(`outputs`,i.error,`schemaJson`),t&&i.ok&&(r={id:t,spec:{jsonSchema:i.schema}})}i&&J(n,`outputs`,`maxRetries`,`Validation max retries`,e.maxRetries,0);let a=Object.fromEntries(Object.entries(e.itemRules).map(([e,t])=>[e,{onFail:t}])),o=i?{...e.maxRetries===null?{}:{maxRetries:e.maxRetries},...Object.keys(a).length?{items:a}:{}}:{},s={...e.streamMode?{mode:e.streamMode}:{},...e.streamThoughts?{}:{streamThoughts:!1}},c={...r?{structured:r.id}:{},...Object.keys(o).length?{validation:o}:{},...Object.keys(s).length?{streaming:s}:{}};return{...Object.keys(c).length?{outputs:c}:{},...r?{structured:r}:{}}}function Gt(e,t){return e.resumeEnabled?(J(t,`turnBehaviour`,`maxContinues`,`Max continues`,e.maxContinues,1),{allowContinue:[...e.allowContinue],autoContinue:[...e.autoContinue],...e.maxContinues===null?{}:{maxContinues:e.maxContinues}}):{allowContinue:[],autoContinue:[]}}function Kt(e,t,n){let r=t?Gt(e,n):void 0,i={...r?{resumption:r}:{},...e.allowSteering?{}:{allowSteering:!1},...e.atStepLimit===`answer`?{atStepLimit:e.atStepLimit}:{}};return Object.keys(i).length?i:void 0}function qt(e,t,n,r){let i=[],a=e=>t.has(e)||t.has(`labels`),{turnBehaviour:o,guardrails:s,outputs:c}=e;if(a(`turnBehaviour`)&&ge(e)&&i.push([`turnBehaviour`,`continueInstruction`,`continue.instruction`,o.continueInstruction.trim()]),a(`guardrails`)&&n(`identity.system`)&&i.push([`guardrails`,`canaryBindNote`,`canary.bind_note`,s.canaryBindNote.trim()]),a(`guardrails`)&&n(`guardrails.quota`)&&i.push([`guardrails`,`quotaMessage`,`quota.exhausted`,s.quotaMessage.trim()]),a(`outputs`)&&n(`outputs.validation`)&&i.push([`outputs`,`repairGuidance`,`repair.default_guidance`,c.repairGuidance.trim()]),a(`guardrails`)&&n(`guardrails.blockedReply`)&&(i.push([`guardrails`,`egressRepairGuidance`,`egress.default_repair_guidance`,s.egressRepairGuidance.trim()]),i.push([`guardrails`,`egressRefusal`,`egress.refusal`,s.egressRefusal.trim()])),t.has(`labels`))for(let[t,n]of Object.entries(e.labels))Se[t]||i.push([`labels`,t,t,n.trim()]);let l={};for(let[e,t,n,a]of i)if(a)try{ue({[n]:a},`Profile labels`),l[n]=a}catch(n){r(e,P(n),t)}return Object.keys(l).length?l:void 0}function Jt(e,t){if(e.quotaEnabled){if(e.quotaPerDay===null)t(`guardrails`,`Quota needs turns per day.`,`quotaPerDay`);else return J(t,`guardrails`,`quotaPerDay`,`Quota per day`,e.quotaPerDay,1),{perDay:e.quotaPerDay}}}function Yt(e,t){J(t,`guardrails`,`blockedReplyMaxRetries`,`Blocked reply max retries`,e.blockedReplyMaxRetries,0);let n={...e.blockedReplyOnBlock?{onBlock:e.blockedReplyOnBlock}:{},...e.blockedReplyMaxRetries===null?{}:{maxRetries:e.blockedReplyMaxRetries}};return Object.keys(n).length?n:void 0}function Xt(e){return Zt(e,()=>{})}function Zt(e,t){let n=e.allowedHosts.map(e=>e.trim()),r=n.indexOf(``);r!==-1&&t(`guardrails`,`Allowed hosts cannot be blank.`,`allowedHosts`,r);let i=q(e.allowedSchemes);if(e.allowPrivateNetworks||n.length||i.length)return{...e.allowPrivateNetworks?{allowPrivateNetworks:!0}:{},...n.length?{allowedHosts:n}:{},...i.length?{allowedSchemes:i}:{}}}function Qt(e,t,n){let r=t.hosts.map(e=>e.trim()),i=r.indexOf(``);i!==-1&&n(`guardrails`,`Allowed hosts cannot be blank.`,`allow.${e}.hosts`,i);let a=r.filter(Boolean),o={...a.length?{hosts:a}:{},...t.fromTools?{}:{fromTools:!1}};return Object.keys(o).length?o:void 0}function $t(e,t){for(let[t,n]of e.entries()){let e=`Pattern ${t+1}`;if(!n.name.trim())return`${e} needs a name.`;if(n.kind===`words`){if(!q(n.words).length)return`${e} needs a word to match.`}else if(!n.pattern)return`${e} needs a regular expression.`}let n=ce(``,t);if(n===void 0)return;let r=/^\.patterns\[(\d+)\](?:\.(\w+))?:? (.*)$/s.exec(n);if(!r)return n.replace(/^\.patterns/,`This`);let[,i,a,o]=r;return`Pattern ${Number(i)+1}${a?`, ${a}`:``}: ${o}`}function en(e,t,n){let r=e.map(e=>{let t=e.name.trim();if(e.kind===`words`)return{name:t,words:q(e.words)};let n=e.flags.trim();return{name:t,pattern:e.pattern,...n?{flags:n}:{}}}),i=$t(e,r);return i!==void 0&&n(`guardrails`,i,t),r}function tn(e,t,n){if(!t||!N[e].patterns)return{};let r=nn(t.hint,`sources.${e}.hint`,n),i=en(t.patterns,`sources.${e}.patterns`,n);return{...t.theorem?{}:{theorem:!1},...i.length?{patterns:i}:{},...i.length&&r?{hint:r}:{}}}function nn(e,t,n){let r=e.trim();if(!r)return;let i=le(`The retry hint`,r);return i!==void 0&&n(`guardrails`,`${i}.`,t),r}function rn(e,t){if(!e)return`Give this detector a key, such as acme.codenames.`;let n={label:e,action:`flag`,find:on};return F(`Detect`,{[e]:n},t)===void 0?void 0:`A key is a namespace, a dot, and a name, in lower case letters, digits and _, such as acme.codenames.`}function an(e,t,n){let r={};for(let[i,a]of e.entries()){let e=a.key.trim();if(Object.hasOwn(r,e)){n(`guardrails`,`Detector ${e} is listed twice.`,`own`,i);continue}let o=t.filter(e=>a.at[e]!==`ignore`),s=nn(a.hint,`own.${i}.hint`,n),c=en(a.patterns,`own.${i}.patterns`,n),l=a.label.trim(),u=rn(e,t);u!==void 0&&n(`guardrails`,u,`own`,i),l||n(`guardrails`,`Give this detector a name.`,`own.${i}.label`),o.length||n(`guardrails`,`Pick what a match does. It is ignored now.`,`own.${i}.at`),u===void 0&&l&&o.length&&(r[e]={label:l,at:Object.fromEntries(o.map(e=>[e,a.at[e]])),patterns:c,...s?{hint:s}:{}})}return r}var on=()=>[];function sn(e){return e===void 0||typeof e==`string`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>{if(typeof t==`string`||t.patterns===void 0)return[e,t];let{patterns:n,...r}=t;if(e.includes(`.`))return[e,{...r,find:on}];let{hint:i,...a}=r;return[e,a]}))}function cn(e){let{guardrails:t}=e;return!t||!(`detect`in t)||t.detect===void 0?e:{...e,guardrails:{...t,detect:sn(t.detect)}}}function ln(e,t,n){let{detect:r}=e,i={};for(let a of M){let o=t.filter(e=>r[a][e]!==de[a][e]),s=t.some(e=>r[a][e]!==`ignore`)?un(a,e,n):void 0,c=tn(a,e.sources[a],n);(o.length||s||Object.keys(c).length)&&(i[a]={...o.length?{at:Object.fromEntries(o.map(e=>[e,r[a][e]]))}:{},...c,...s?{allow:s}:{}})}Object.assign(i,an(e.own,t,n));let a=F(`Detect`,sn(i),t);return a!==void 0&&n(`guardrails`,a,`detect`),Object.keys(i).length?i:void 0}function un(e,t,n){if(dn(e))return Qt(e,t.allow[e],n);if(N[e].allow!==`names`)return;let r=t.innocentNames.map(e=>e.trim()),i=r.indexOf(``);i!==-1&&n(`guardrails`,`Allowed names cannot be blank.`,`innocentNames`,i);let a=r.filter(Boolean);return a.length?{names:a}:void 0}function dn(e){return N[e].allow===`urls`}function fn(e){let{taintAfterRemoteRead:t,taintRemoteDestination:n}=e;if(t||n)return{...t?{afterRemoteRead:t}:{},...n?{remoteDestination:n}:{}}}function pn(e,t,n=I){let r={detect:ln(e,n,t),quota:Jt(e,t),blockedReply:Yt(e,t),network:Zt(e,t),taint:fn(e)},i=Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0));return Object.keys(i).length?i:void 0}function mn(e,t){let n=ke({}),{writeTo:r}=e,{sampleRate:i}=e;Number.isFinite(i)&&i>=0&&i<=1||t(`observability`,`Sample rate must be between 0 and 1.`,`sampleRate`),e.retainForDays!==null&&!Number.isFinite(e.retainForDays)&&t(`observability`,`Retain for days must be a number.`,`retainForDays`),e.rotateAfterMiB!==null&&!(Number.isFinite(e.rotateAfterMiB)&&e.rotateAfterMiB>0)&&t(`observability`,`Rotate after MiB must be more than zero.`,`rotateAfterMiB`);let a=mt(e.resourceJson,ut,()=>{t(`observability`,`Resource must be a JSON object.`,`resourceJson`)}),o=Object.fromEntries(Object.entries(e.include).filter(([e,t])=>t!==n.include[e])),s=Object.fromEntries(Object.entries(e.scrub).filter(([e,t])=>t!==n.scrub[e])),c={writeTo:r,...i===n.sampleRate?{}:{sampleRate:i},...Object.keys(o).length?{include:o}:{},...Object.keys(s).length?{scrub:s}:{},...e.retainForDays===null?{}:{retainForDays:e.retainForDays},...e.rotateAfterMiB===null?{}:{rotateAfterMiB:e.rotateAfterMiB},...a?{resource:a}:{}};return Object.keys(c).length?c:void 0}var hn={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`,gif:`image/gif`};function gn(e){if(!URL.canParse(e))return;let t=new URL(e);return t.protocol!==`https:`&&t.protocol!==`http:`?void 0:hn[t.pathname.split(`.`).pop()?.toLowerCase()??``]}function _n(e,t){return e.flatMap((e,n)=>{if(`data`in e)return e.mimeType.startsWith(`image/`)&&e.data?[{mimeType:e.mimeType,data:e.data,name:e.name}]:(t(`image`,`${e.name||`A reference`} is not an image.`,`references`,n),[]);let r=e.uri.trim(),i=gn(r);return i?[{mimeType:i,uri:r,...e.name?{name:e.name}:{}}]:(t(`image`,r?`Link to a .png, .jpg, .webp or .gif image over http(s).`:`Add a link or remove the reference.`,`references`,n),[])})}function vn(e,t){J(t,`image`,`n`,`Images per request`,e.n,1),J(t,`image`,`seed`,`Seed`,e.seed,0),J(t,`image`,`outputCompression`,`Compression`,e.outputCompression,0),e.outputCompression!==null&&e.outputCompression>100&&t(`image`,`Compression goes from 0 to 100.`,`outputCompression`);let n=_n(e.references,t);return{...e.aspectRatio.trim()?{aspectRatio:e.aspectRatio.trim()}:{},...e.resolution.trim()?{resolution:e.resolution.trim()}:{},...e.mimeType.trim()?{mimeType:e.mimeType.trim()}:{},...e.quality.trim()?{quality:e.quality.trim()}:{},...e.background.trim()?{background:e.background.trim()}:{},...e.n===null?{}:{n:e.n},...e.seed===null?{}:{seed:e.seed},...e.outputCompression===null?{}:{outputCompression:e.outputCompression},...e.includeText?{includeText:!0}:{},...n.length?{references:n}:{}}}function yn(e,t,n){let{format:r}=e;if(r){let e=t.modelBindings.find(e=>T(D(t.providers,`speech`,e))&&!O.includes(r));e&&n(`speech`,`Google doesn't make ${r}; ${e.modelId} is on ${e.provider}.`,`format`)}let i=t.modelBindings.find(e=>T(D(t.providers,`speech`,e)));i&&!e.voice.trim()&&n(`speech`,`Gemini needs a voice to speak; ${i.modelId} is on ${i.provider}.`,`voice`);let{speed:a}=e;return{...e.voice.trim()?{voice:e.voice.trim()}:{},...e.style.trim()?{style:e.style.trim()}:{},...a===null?{}:{speed:a},...r?{format:r}:{}}}function bn(e,t){J(t,`live`,`resumedAfterMs`,`Away for`,e.resumedAfterMs,0);let n=e.resumedPrompt.trim();if(n&&!e.sessionResumption&&t(`live`,`A resume prompt needs Resumption on.`,`resumedPrompt`),!n)e.resumedAfterMs!==null&&t(`live`,`Away for needs a resume prompt.`,`resumedAfterMs`);else return{prompt:n,...e.resumedAfterMs===null?{}:{afterMs:e.resumedAfterMs}}}function xn(e,t,n){!e.ingressAudio&&!e.ingressVideo&&!e.ingressText&&t(`live`,`Turn on at least one ingress channel.`),J(t,`live`,`vadPrefixPaddingMs`,`VAD prefix padding`,e.vadPrefixPaddingMs,0),J(t,`live`,`vadSilenceDurationMs`,`VAD silence duration`,e.vadSilenceDurationMs,0),e.contextCompression&&Sn(e,t,n.mode===`demo`?n.keys.liveInputTokens:void 0);let r=bn(e,t),i={audio:e.ingressAudio,video:e.ingressVideo,text:e.ingressText},a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t!==Ae(e))),o={...e.vadActivityHandling?{activityHandling:e.vadActivityHandling}:{},...e.vadStartSensitivity?{startSensitivity:e.vadStartSensitivity}:{},...e.vadEndSensitivity?{endSensitivity:e.vadEndSensitivity}:{},...e.vadPrefixPaddingMs===null?{}:{prefixPaddingMs:e.vadPrefixPaddingMs},...e.vadSilenceDurationMs===null?{}:{silenceDurationMs:e.vadSilenceDurationMs}},s={...e.transcriptionInput?{input:!0}:{},...e.transcriptionOutput?{output:!0}:{}};return{...Object.keys(a).length?{ingress:a}:{},...e.voice.trim()?{voice:e.voice.trim()}:{},...Object.keys(o).length?{vad:o}:{},...e.sessionResumption?{sessionResumption:!0}:{},...e.greeting.trim()?{greeting:e.greeting.trim()}:{},...r?{resumed:r}:{},...e.contextCompression?{contextCompression:Cn(e)}:{},...Object.keys(s).length?{transcription:s}:{}}}function Sn(e,t,n){J(t,`live`,`compressionTriggerTokens`,`Compression trigger`,e.compressionTriggerTokens,1),J(t,`live`,`compressionTargetTokens`,`Compression target`,e.compressionTargetTokens,1);let r=e.compressionTriggerTokens,i=e.compressionTargetTokens,a=n?.toLocaleString(`en-US`);n!==void 0&&r!==null&&r>n&&t(`live`,`Compression trigger can't exceed the ${a} input tokens a session holds on these keys.`,`compressionTriggerTokens`),i!==null&&(r!==null&&i>=r||n!==void 0&&r===null&&i>=n)&&t(`live`,r===null?`Compression target must be below the ${a} input tokens a session holds on these keys.`:`Compression target must be below the trigger.`,`compressionTargetTokens`)}function Cn(e){let t=e.compressionTriggerTokens,n=e.compressionTargetTokens;return{...t===null?{}:{triggerTokens:t},slidingWindow:n===null?{}:{targetTokens:n}}}function wn(e,t){let[n,...r]=t,{[n]:i,...a}=e;return!r.length||typeof i!=`object`||!i?a:{...a,[n]:wn(i,r)}}function Tn(e){let t=e;for(let{path:n}of me(e))t=wn(t,n.split(`.`));return t}function En(e,t){let n=Object.create(null);return e.questionsBuilt||(e.questions.length||t(`decision`,`Add at least one question.`,`questions`),e.questions.forEach((e,r)=>{let i=e=>t(`decision`,e,`questions`,r),a=e.id.trim(),o=e.instructions.trim();a?Object.hasOwn(n,a)&&i(`Question id '${a}' is used twice.`):i(`Each question needs an id.`),o||i(`Question '${a||r+1}' needs instructions.`);let s=e.criteria.map(e=>({label:e.label.trim(),text:e.text.trim()}));if(!a||!o)return;if(e.type===`box`){let t=e.image?.trim();n[a]={type:`box`,instructions:o,...t?{image:t}:{}};return}if(e.type===`score`){(s.length<2||s.some(e=>!e.text))&&i(`Score '${a}' needs at least two levels, each described.`),n[a]={type:`score`,instructions:o,criteria:s.map(e=>e.text)};return}let c=Object.create(null);for(let e of s)e.label?Object.hasOwn(c,e.label)?i(`Option '${e.label}' of '${a}' is used twice.`):c[e.label]=e.text||e.label:i(`Every option of '${a}' needs a label.`);e.type===`choice`?(s.length<2&&i(`Choice '${a}' needs at least two options.`),n[a]={type:`choice`,instructions:o,criteria:c}):n[a]={type:`noul`,instructions:o,...s.length?{criteria:c}:{}}})),n}var Dn=/^[a-z0-9_]+$/,On=[`image/png`,`image/jpeg`];function kn(e,t){let n=Object.create(null);return e.images.forEach((e,r)=>{let i=e=>t(`decision`,e,`images`,r),a=e.name.trim(),o=`<${a}>`;Dn.test(a)?Object.hasOwn(n,o)?i(`Image ${o} is used twice.`):!On.includes(e.mimeType)||!e.data?i(`${o} is not a PNG or JPEG.`):n[o]={mimeType:e.mimeType,data:e.data}:i(`Name an image with lowercase letters, digits, and _.`)}),e.questions.forEach((e,r)=>{let i=[...e.instructions.matchAll(/<[a-z0-9_]+>/g)].map(([e])=>e),a=e.type===`box`?e.image?.trim():void 0;a?.startsWith(`<`)&&i.push(a);for(let e of new Set(i))Object.hasOwn(n,e)||t(`decision`,`No image is named ${e}.`,`questions`,r)}),n}function X(e,t,n){let r=t.has(`observability`)?mn(e.observability,n):void 0,i=qt(e,t,t=>z(e,t),n);return{...r?{observability:r}:{},...i?{labels:i}:{}}}function An(e,t){let{decision:n}=e,r=n.contract.trim();return r||t(`decision`,`Contract is required.`,`contract`),r}function jn(e,t,n,r){let i=n.decision,{decision:a,identity:o}=e,s=(e,t)=>e.trim().length>t;s(a.contract,i.idChars)&&r(`decision`,`Contract is limited to ${i.idChars} characters on these keys.`,`contract`),s(o.agentId,i.idChars)&&r(`identity`,`Profile id is limited to ${i.idChars} characters on these keys.`,`agentId`),s(o.handle,i.nameChars)&&r(`identity`,`Handle is limited to ${i.nameChars} characters on these keys.`,`handle`);let c=e.modelBindings[0];if(c){let e=B(c.key);c.timeoutMs!==null&&c.timeoutMs>i.timeoutMs&&r(e,`Timeout is limited to ${i.timeoutMs} ms on these keys.`,`timeoutMs`),s(c.modelId,i.nameChars)&&r(e,`Model id is limited to ${i.nameChars} characters on these keys.`,`modelId`),s(c.apiId,i.idChars)&&r(e,`API model is limited to ${i.idChars} characters on these keys.`,`apiId`)}a.maxStateBytes!==null&&a.maxStateBytes>i.stateBytes&&r(`decision`,`These keys take at most ${i.stateBytes} bytes of state.`,`maxStateBytes`),a.questions.length>i.questions&&r(`decision`,`These keys ask at most ${i.questions} questions.`,`questions`),a.images.length>i.images&&r(`decision`,`These keys send at most ${i.images} images.`,`images`),a.images.forEach((e,t)=>{Math.floor(e.data.length*3/4)>i.imageBytes&&r(`decision`,`Each image is limited to ${i.imageBytes} bytes on these keys.`,`images`,t)}),a.questions.forEach((a,o)=>{let l=e=>r(`decision`,e,`questions`,o);s(a.id,i.nameChars)&&l(`Question ids are limited to ${i.nameChars} characters on these keys.`),a.type===`box`&&i.images===0&&l(`These keys take no images, so a Box question has nothing to read.`),s(a.instructions,i.instructionsChars)&&l(`Instructions are limited to ${i.instructionsChars} characters on these keys.`),a.criteria.length>i.criteria&&l(`A question has at most ${i.criteria} options or levels on these keys.`),a.criteria.some(e=>s(e.text,i.criterionChars))&&l(`Each option or level is limited to ${i.criterionChars} characters on these keys.`),a.criteria.some(e=>s(e.label,i.nameChars))&&l(`Option labels are limited to ${i.nameChars} characters on these keys.`);let u=t[a.id.trim()],d=c&&u&&n.questionViolation(D(e.providers,`decision`,c),u);d&&l(d)})}function Mn(e,t,n){let{decision:r}=e,i=new Set(L(e)),a=An(e,t);e.modelBindings.length!==1&&t(`models`,`A decision needs exactly one model binding.`);let o=e.modelBindings[0],s=o?B(o.key):`models`;o&&($e(o,`decision`,e.providers,t),at(o,e.providers,`decision`,s,t),o.modelId.trim()||t(s,`Model id is required.`,`modelId`),J(t,s,`timeoutMs`,`Timeout`,o.timeoutMs,1));let c=o?it(o,s,t):void 0;J(t,`decision`,`maxStateBytes`,`Max state`,r.maxStateBytes,1);let l=En(r,t),u=kn(r,t);return n.mode===`demo`&&jn(e,l,n.keys,t),{profile:{type:`decision`,id:e.identity.agentId.trim(),identity:{handle:e.identity.handle.trim()},models:o?{[o.modelId.trim()]:{protocol:o.protocol,provider:o.provider,apiId:o.apiId.trim(),...Object.keys(o.options).length?{options:o.options}:{},...o.keySlot||e.models.key?{keySlot:o.keySlot||e.models.key}:{},...o.fallbackKeySlot?{fallbackKeySlot:o.fallbackKeySlot}:{},...o.timeoutMs===null?{}:{timeoutMs:o.timeoutMs},...c?{limits:c}:{}}}:{},inputs:{state:`json`,...r.maxStateBytes===null?{}:{maxStateBytes:r.maxStateBytes}},decision:{contract:a},...X(e,i,t)},customTools:[],...r.questionsBuilt?{}:{questions:l},...Object.keys(u).length?{images:{...u}}:{}}}function Nn(e,t,n,r){let i=new Set(L(e)),{customTools:a,tools:o}=Lt(e,z(e,`tools.t2Loader`),z(e,`tools.parallel`),t,n,r);a.length||t(`tools`,`Add at least one tool: a host runs only its tools.`);let s=i.has(`guardrails`)?pn(e.guardrails,t,he):void 0;return{profile:Tn({type:`host`,id:e.identity.agentId.trim(),tools:o,...s?{guardrails:s}:{},...X(e,i,t)}),customTools:a}}function Pn(e,t,n,r,i,a){let o=new Set(L(e)),s=t=>z(e,t),c=typeof e.identity.system==`string`?qe(e.identity.system):{ok:!1,message:`The system prompt must be text.`};c.ok||n(`identity`,c.message,`system`);let l=c.ok?c.prompt:void 0,u=pt(e.identity.systemByRoleJson,e=>{n(`identity`,e,`systemByRoleJson`)}),d=ct(e,t,n,i),{outputs:f,structured:p}=o.has(`outputs`)?Wt(e.outputs,s(`outputs.structured`),n):{},{customTools:m,tools:h}=o.has(`tools`)?Lt(e,s(`tools.t2Loader`),s(`tools.parallel`),n,i,a):{customTools:[]},g=o.has(`turnBehaviour`)?Kt(e.turnBehaviour,s(`turnBehaviour.resumption`),n):void 0,_=o.has(`guardrails`)?pn(e.guardrails,n):void 0;return{profile:Tn({type:t,id:e.identity.agentId.trim(),identity:{handle:e.identity.handle.trim(),...l?{system:l}:{},...u?{systemByRole:u}:{}},...d,...o.has(`image`)?{image:vn(e.image,n)}:{},...o.has(`speech`)?{speech:yn(e.speech,e,n)}:{},...o.has(`live`)?{live:xn(e.live,n,r)}:{},...h?{tools:h}:{},...o.has(`inputs`)?t===`live`?Ut(e.inputs,n):{inputs:Rt(e.inputs,t,n)}:{},...f?{outputs:f}:{},...g?{turnBehaviour:g}:{},..._?{guardrails:_}:{},...X(e,o,n)}),customTools:m,...p?{structured:p}:{}}}function Fn(e,t,n=Je,r=Ye){let i=[],a=(e,t,n,r)=>{i.push({nodeId:e,message:t,...n===void 0?{}:{field:n},...r===void 0?{}:{index:r}})};Qe(e,a),new Set([e.models.key,e.models.fallbackKey,...e.modelBindings.flatMap(t=>{let{keySlot:n,fallbackKeySlot:r}=ve(e,t);return[n,r]})].filter(Boolean)).size>32&&a(`models`,`The studio supports up to 32 key slots.`,`key`);let o=e.identity.profileType;if(!o)return a(`identity`,`Pick a profile type.`,`profileType`),{ok:!1,issues:i};if(o!==`host`)for(let n of e.modelBindings){if(!n.apiId.trim())continue;let r=se({...D(e.providers,o,n),builtInTools:n.builtInTools},t);r&&a(B(n.key),r.message,r.field)}let s=o===`decision`?Mn(e,a,t):o===`host`?Nn(e,a,n,r):Pn(e,o,a,t,n,r);if(i.length)return{ok:!1,issues:i};try{De(cn(s.profile))}catch(e){if(!(e instanceof j))throw e;return{ok:!1,issues:[{nodeId:`identity`,message:e.message}]}}return{ok:!0,agentId:s.profile.id,providers:e.providers,...s}}var Z=e(i(),1),Q=t(),In=(0,Z.lazy)(()=>b(()=>import(`./TraceInspector-h030OQ82.js`).then(e=>({default:e.TraceGuardrailsBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82]))),Ln=(0,Z.lazy)(()=>b(()=>import(`./TraceInspector-h030OQ82.js`).then(e=>({default:e.TraceFeedBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82]))),Rn=(0,Z.createContext)(`replace`);function zn({value:e,children:t}){return(0,Q.jsx)(Rn,{value:e,children:t})}function Bn({id:e,toggle:t,traces:n}){return(0,Q.jsx)(_,{id:e,children:e=>(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(m,{floating:!0,children:t}),children:(0,Q.jsx)(Ln,{traces:n,isWide:e,end:t})})})}function Vn(e,t,n){let r=ee(),i=(0,Z.useId)(),[a,o]=(0,Z.useState)(!1),s=(0,Z.use)(Rn),c={name:r(`@theorem.panel.trace.name`),show:r(`@theorem.panel.trace.show`),hide:r(`@theorem.panel.trace.hide`),resize:r(`@theorem.panel.trace.resize`)};if(e.observability?.record!==!0)return{toggle:null,view:null,labels:c,offered:!1};let u=n??a,d=e=>n===void 0?(0,Q.jsx)(y,{labels:c,icon:(0,Q.jsx)(l,{icon:ie}),panelId:i,open:u,size:e,onToggle:()=>o(e=>!e)}):null;return{toggle:d(),view:u?Hn(s===`panel`,i,t,d(`sm`)):null,labels:c,offered:!0}}function Hn(e,t,n,r){return e?(0,Q.jsx)(Un,{id:t,toggle:r,traces:n}):(0,Q.jsx)(Bn,{id:t,toggle:r,traces:n})}function Un({id:e,toggle:t,traces:n}){let{ref:r,width:i}=h();return(0,Q.jsx)(`div`,{id:e,ref:r,style:{height:`100%`,position:`relative`},children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(m,{floating:!0,children:t}),children:(0,Q.jsx)(Ln,{traces:n,isWide:p(i),end:t})})})}function Wn({inspector:e,children:t}){let n=(0,Z.useRef)(null),r=g(n,!1),i=(0,Z.useRef)(void 0),a=(0,Z.useCallback)(e=>{n.current=e;let t=i.current;typeof t==`function`?t(e):t!=null&&(t.current=e)},[]);if(!(0,Z.isValidElement)(t))return(0,Q.jsx)(v,{view:e.view,children:t});i.current=t.props.ref;let o=e.view!=null;return(0,Z.cloneElement)(t,{ref:a,end:(0,Q.jsx)(f,{labels:e.labels,resizable:r.resizable,open:o,children:e.view})})}function Gn({inspector:e,children:t}){return(0,Z.use)(Rn)===`panel`&&e.offered?(0,Q.jsx)(Wn,{inspector:e,children:t}):(0,Q.jsx)(v,{view:e.view,children:t})}function Kn({records:e,head:t}){return(0,Q.jsx)(te,{children:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(In,{records:e,head:t})})})}var qn={info:`info`,warning:`warning`,error:`error`,success:`success`},Jn={info:`accent`,warning:`warning`,error:`error`,success:`success`},$={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},Yn={info:{kWkggS:`xgcxg3y`,$$css:!0},warning:{kWkggS:`x24i8r5`,$$css:!0},error:{kWkggS:`x1pritpl`,$$css:!0},success:{kWkggS:`xu13z74`,$$css:!0}};function Xn(e){return Object.prototype.hasOwnProperty.call(Yn,e)}var Zn={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function Qn({status:e,title:t,description:i,icon:f,isDismissable:p=!1,onDismiss:m,dismissLabel:h,endContent:g,container:_=`card`,elevation:v=`none`,collapsible:y=!0,children:b,xstyle:ee,className:te,style:x,ref:ie,onFocusCapture:ae,onPointerDownCapture:S,...C}){let w=u(),[T,oe]=(0,Z.useState)(!1),E=typeof y==`object`&&y?y:{},{isEnabled:D,isOpen:O,toggle:se}=d({isCollapsible:y!==!1&&{...E,defaultIsOpen:E.defaultIsOpen??!1}}),k=(0,Z.useRef)(null),A=(0,Z.useId)(),j=qn[e],ce=Jn[e],le=c(b),M=w(`@astryx.banner.dismiss`),N=h??M,ue=h??(typeof t==`string`?w(`@astryx.banner.dismissTitled`,{dismiss:M,title:t}):M);if(T)return null;let P=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(k.current=e)},F=e=>{P(e.relatedTarget,e.currentTarget)},de=e=>{P(document.activeElement,e.currentTarget)},fe=()=>{let e=k.current;oe(!0),m?.(),e?.isConnected&&e.focus()},I=D&&le,pe=c(g)||p||I,me=c(g)||p,he=!c(i)&&me,L=le&&(!D||O),R=_===`card`;return(0,Q.jsxs)(`div`,{ref:ie,onFocusCapture:s(ae,F),onPointerDownCapture:s(S,de),...o(r(`banner-frame`,{container:_,elevation:v}),n($.root,Zn[v],R&&v!==`none`&&$.rootElevatedCard,ee),te,x),...C,children:[(0,Q.jsxs)(`div`,{...o(r(`banner`,{container:_,status:e}),n($.header,he&&$.headerCentered,Xn(e)&&Yn[e],R&&(L?$.headerCardWithContent:$.headerCardStandalone))),children:[(0,Q.jsx)(`div`,{...c(f)?o(r(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:c(f)?f:j==null?null:(0,Q.jsx)(l,{icon:j,size:`md`,color:ce,...r(`banner-icon`,{status:e})})}),(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!c(g)|0],children:[(0,Q.jsx)(`div`,{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe`,children:t}),c(i)&&(0,Q.jsx)(`div`,{...o(r(`banner-description`),{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe`}),children:i})]}),pe&&(0,Q.jsxs)(`div`,{...n($.endArea,ne.inset(a[`--spacing-2`])),children:[g,I&&(0,Q.jsx)(re,{variant:`ghost`,size:`sm`,label:w(O?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:w(O?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,Q.jsx)(l,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[$.chevron,O&&$.chevronExpanded]}),onClick:se,"aria-expanded":O,"aria-controls":L?A:void 0,isIconOnly:!0}),p&&(0,Q.jsx)(re,{variant:`ghost`,size:`sm`,label:ue,tooltip:N,icon:(0,Q.jsx)(l,{icon:`close`,size:`sm`,color:`inherit`}),onClick:fe,isIconOnly:!0})]})]}),L&&(0,Q.jsx)(`div`,{id:I?A:void 0,...o(r(`banner-content`,{container:_,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!R|0]),children:b})]})}Qn.displayName=`Banner`;export{He as _,Vn as a,Tt as c,cn as d,H as f,Ue as g,ze as h,Gn as i,Et as l,Ve as m,Kn as n,St as o,We as p,zn as r,Fn as s,Qn as t,Xt as u,Pe as v,Ne as y};
|