@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.
Files changed (97) hide show
  1. package/README.md +8 -5
  2. package/cookbooks/catalog.js +18 -5
  3. package/cookbooks/tools.js +3 -3
  4. package/label-areas.d.ts +133 -0
  5. package/label-areas.js +154 -0
  6. package/mod.d.ts +4 -3
  7. package/mod.js +4 -3
  8. package/package.json +4 -4
  9. package/page/assets/Banner-DEVAsFER.js +4 -0
  10. package/page/assets/{ConsoleFrame-B7rArrs0.js → ConsoleFrame-CqUUcrR4.js} +1 -1
  11. package/page/assets/{MenuBottomSheet-CRiCEOWg.js → MenuBottomSheet-DOa09vl1.js} +1 -1
  12. package/page/assets/{SchemaFields-BoySuRuC.js → SchemaFields-CMwMU1Px.js} +1 -1
  13. package/page/assets/{ToolResultCharts-C_qojgbn.js → ToolResultCharts-CW23-D1x.js} +1 -1
  14. package/page/assets/{TraceInspector-DSLg92wY.js → TraceInspector-h030OQ82.js} +1 -1
  15. package/page/assets/{TraceOverview-TDZ4GUIz.js → TraceOverview-BsON_uZj.js} +1 -1
  16. package/page/assets/{_virtual_studio-type-sources-B0cSCDug.js → _virtual_studio-type-sources-BwSqfSwd.js} +23 -4
  17. package/page/assets/browser-connection-DSUHVCT5.js +3 -0
  18. package/page/assets/browser-engine-Cf6d-zNH.js +11 -0
  19. package/page/assets/browser-transport-BK4cbTE_.js +45 -0
  20. package/page/assets/{crypto-B6qD6nxk.js → crypto-CD14HeXH.js} +1 -1
  21. package/page/assets/{encode-files-CM9H0Lq5.js → encode-files-DhoC5hWG.js} +1 -1
  22. package/page/assets/{export-agent-BuZ4GIKx.js → export-agent-CaHsJPsM.js} +1 -1
  23. package/page/assets/{guardrail-tester-bc9lxU9X.js → guardrail-tester-BDhFLvT5.js} +1 -1
  24. package/page/assets/index-CqwmMJ4C.js +145 -0
  25. package/page/assets/{live-messages-CHHEtxno.js → live-messages-CiLmR89m.js} +1 -1
  26. package/page/assets/reader-DrOfMM8I.js +5 -0
  27. package/page/assets/shaped-data-H1miOZm2.js +20 -0
  28. package/page/assets/{stub-CWjTbSMX.js → stub-nxRsh1jo.js} +4 -4
  29. package/page/assets/{studio-code-pane-DevKnszl.js → studio-code-pane-C1wH63Y2.js} +3 -3
  30. package/page/assets/{studio-console-kpYOJazO.js → studio-console-DRzo4yTy.js} +1 -1
  31. package/page/assets/{studio-decision-Dq5LDTrl.js → studio-decision-C7QWMm7Q.js} +1 -1
  32. package/page/assets/{studio-embedding-Cebwv5_l.js → studio-embedding-D8KroBXY.js} +1 -1
  33. package/page/assets/{studio-host-console-CaaVHxrN.js → studio-host-console-HkX8BerX.js} +2 -2
  34. package/page/assets/{studio-labels-BQOD-taS.js → studio-labels-6w1SKC2D.js} +1 -1
  35. package/page/assets/studio-live-BmVeXAu4.js +5 -0
  36. package/page/assets/{studio-map-BOaPPVXK.js → studio-map-5ZU1nicW.js} +1 -1
  37. package/page/assets/studio-session-CjUQSXx0.js +1 -0
  38. package/page/assets/studio-trace-replay-CSbJSN5e.js +3 -0
  39. package/page/assets/{studio-type-checker-BQmVytwu.js → studio-type-checker-BbUSqqOS.js} +1 -1
  40. package/page/assets/tool-schema-BmRYaywn.js +17 -0
  41. package/page/assets/{trace-record-CtL5_CIg.js → trace-record-DxgSKmYY.js} +1 -1
  42. package/page/assets/tree-3N-1RPZz.js +3 -0
  43. package/page/assets/{turn-client-yriGS51g.js → turn-client-DN8PawJr.js} +2 -2
  44. package/page/assets/{use-one-call-8QTXCYlp.js → use-one-call-Br2IVJLU.js} +1 -1
  45. package/page/assets/{use-second-ticker-rObooyH6.js → use-second-ticker-CEwOSS-d.js} +1 -1
  46. package/page/assets/{workspace-WKa0_gWg.js → workspace-CTSW941G.js} +1 -1
  47. package/page/index.html +16 -16
  48. package/replay.d.ts +13 -8
  49. package/replay.js +33 -31
  50. package/run-payload.d.ts +20 -6
  51. package/run-payload.js +85 -13
  52. package/runtime-scope.js +1 -0
  53. package/runtime.js +1 -0
  54. package/server/project.js +5 -32
  55. package/transport.d.ts +1 -3
  56. package/transport.js +0 -9
  57. package/ui/inspector.js +11 -5
  58. package/ui/lib/acting-as.js +1 -6
  59. package/ui/lib/run-keys.d.ts +15 -5
  60. package/ui/lib/run-keys.js +80 -16
  61. package/ui/lib/studio-conversation.d.ts +2 -3
  62. package/ui/lib/studio-conversation.js +28 -65
  63. package/ui/lib/studio-keep.d.ts +34 -0
  64. package/ui/lib/studio-keep.js +202 -0
  65. package/ui/lib/studio-map-kept.d.ts +2 -2
  66. package/ui/lib/studio-map-kept.js +5 -10
  67. package/ui/lib/studio-open.d.ts +1 -1
  68. package/ui/lib/studio-open.js +5 -5
  69. package/ui/lib/studio-page.js +1 -7
  70. package/ui/lib/studio-restore.d.ts +2 -3
  71. package/ui/lib/studio-restore.js +8 -48
  72. package/ui/lib/studio-run-open.d.ts +10 -5
  73. package/ui/lib/studio-run-open.js +18 -9
  74. package/ui/lib/studio-session.d.ts +38 -5
  75. package/ui/lib/studio-session.js +133 -3
  76. package/ui/lib/studio-store.js +8 -30
  77. package/ui/profile-editor.js +37 -185
  78. package/ui/studio-compare.js +239 -46
  79. package/ui/studio-run.js +29 -15
  80. package/ui/studio-screen.d.ts +1 -1
  81. package/ui/studio-screen.js +8 -9
  82. package/ui/studio-trace-replay.js +39 -14
  83. package/vite.mjs +1 -1
  84. package/page/assets/Banner-CzP7eU2F.js +0 -4
  85. package/page/assets/browser-connection-QNf4S7Ff.js +0 -3
  86. package/page/assets/browser-engine-DpEz1HOI.js +0 -11
  87. package/page/assets/browser-transport-sRqTLzGF.js +0 -45
  88. package/page/assets/index-CVYQrx1w.js +0 -145
  89. package/page/assets/reader-DlrsIIkn.js +0 -5
  90. package/page/assets/shaped-data-DAdn_XvU.js +0 -20
  91. package/page/assets/studio-live-Bz8YuQcb.js +0 -5
  92. package/page/assets/studio-session-yEqFQo5o.js +0 -1
  93. package/page/assets/studio-trace-replay-Ck0X9hTR.js +0 -3
  94. package/page/assets/tool-schema-B_EOjDjg.js +0 -17
  95. package/page/assets/tree-DM7jRXMx.js +0 -3
  96. package/run-payload-core.d.ts +0 -28
  97. package/run-payload-core.js +0 -117
package/ui/studio-run.js CHANGED
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Icon } from '@astryxdesign/core/Icon';
3
3
  import { IconKey } from '@tabler/icons-react';
4
4
  import { PaneState, TheoremThemeProvider, TracePlacement } from '@theoremjs/react/ui';
5
- import { useEffect, useState } from 'react';
5
+ import { useEffect, useMemo, useState } from 'react';
6
6
  import { studioKeySlots } from "../browser.js";
7
- import { modelRoute, modelSlots, onStudioLocal, readStudioRunIdFromUrl, STUDIO_PROVIDERS, } from "../mod.js";
7
+ import { modelRoute, modelSlots, onStudioLocal, readStudioRunIdFromUrl, STUDIO_PROVIDERS, withStudioRunCredentials, } from "../mod.js";
8
8
  import { recordsTraces } from "./lib/project-traces.js";
9
9
  import { askRunKeys } from "./lib/run-keys.js";
10
10
  import { ProjectContext } from "./lib/studio-project.js";
@@ -27,7 +27,10 @@ function providersOf(payload) {
27
27
  * `opened` is what `openStudioRun` returned for this tab.
28
28
  */
29
29
  export function StudioRunScreen({ opened, supplies, }) {
30
- const { payload } = opened;
30
+ const fromStudio = useFromStudio(opened.masked);
31
+ const payload = useMemo(() => fromStudio.tools
32
+ ? withStudioRunCredentials(opened.payload, fromStudio.tools)
33
+ : opened.payload, [opened.payload, fromStudio.tools]);
31
34
  // The agent and the agents it calls each read their own key slots.
32
35
  const profiles = [
33
36
  payload.profile,
@@ -46,7 +49,15 @@ export function StudioRunScreen({ opened, supplies, }) {
46
49
  ? []
47
50
  : Object.values(profile.models).flatMap((binding) => Object.values(modelSlots(providersOf(payload), binding)))),
48
51
  ], supplies);
49
- const keysFromStudio = useStudioKeys(!opened.project && payload.connectionMode === 'byok', connection.setVault);
52
+ const needsKeys = !opened.project && payload.connectionMode === 'byok';
53
+ const { setVault } = connection;
54
+ useEffect(() => {
55
+ if (needsKeys && fromStudio.keys)
56
+ setVault(fromStudio.keys);
57
+ }, [needsKeys, fromStudio.keys, setVault]);
58
+ const isGone = fromStudio.gone && (needsKeys || opened.masked);
59
+ // why: a tool called before its credentials arrive would go out with them masked.
60
+ const isWaiting = opened.masked && !fromStudio.tools && !fromStudio.gone;
50
61
  const traced = recordsTraces(payload);
51
62
  const [traceOpen, setTraceOpen] = useState(false);
52
63
  const phone = usePhone();
@@ -54,26 +65,29 @@ export function StudioRunScreen({ opened, supplies, }) {
54
65
  const title = studioRunTitle(payload);
55
66
  return (_jsxs(TheoremThemeProvider, { mode: "dark", children: [_jsx("title", { children: `${title} · theorem studio` }), _jsx(TracePlacement, { value: "panel", children: _jsxs("div", { className: "run-page", children: [_jsx("div", { className: "run-controls", children: traced ? (_jsx(TraceButton, { open: traceOpen, isIconOnly: phone, onToggle: () => {
56
67
  setTraceOpen((open) => !open);
57
- } })) : null }), keysFromStudio === 'gone' ? (_jsx(PaneState, { icon: _jsx(Icon, { icon: IconKey, size: "lg", color: "secondary" }), title: "Set your keys in the studio", description: "This tab takes its keys from the studio tab that opened it, and that tab is closed. Open the agent in a new tab from the studio again." })) : (_jsx(ProjectContext.Provider, { value: opened.project, children: _jsx(StudioRunner, { payload: payload, runtime: runtime, trace: traced ? traceOpen : undefined, flush: true, columns: true, className: "run-chat" }, mode) }))] }) })] }));
68
+ } })) : null }), isGone ? (_jsx(PaneState, { icon: _jsx(Icon, { icon: IconKey, size: "lg", color: "secondary" }), title: "Open the agent from the studio again", description: "This tab takes its keys and its tools' credentials from the studio tab that opened it, and that tab no longer holds them: it was closed, reloaded, or left the studio. Open the agent in a new tab from the studio again." })) : isWaiting ? null : (_jsx(ProjectContext.Provider, { value: opened.project, children: _jsx(StudioRunner, { payload: payload, runtime: runtime, trace: traced ? traceOpen : undefined, flush: true, columns: true, className: "run-chat" }, mode) }))] }) })] }));
58
69
  }
59
70
  /**
60
- * Fills the vault from the studio tab that opened this one, when the run reads this browser's
61
- * keys. `gone` when there is no studio tab left to ask.
71
+ * What the studio tab that opened this one answers: its keys, and the credentials the kept copy of
72
+ * this run masked. `gone` when no studio tab holds them for it.
62
73
  */
63
- function useStudioKeys(needed, setVault) {
74
+ function useFromStudio(masked) {
75
+ const [answer, setAnswer] = useState();
64
76
  const [gone, setGone] = useState(false);
65
77
  useEffect(() => {
66
- if (!needed)
67
- return;
68
78
  const run = readStudioRunIdFromUrl();
69
- const stop = run ? askRunKeys(run, setVault) : null;
79
+ const stop = run
80
+ ? askRunKeys(run, (keys, tools) => {
81
+ setAnswer({ keys, tools });
82
+ }, () => {
83
+ setGone(true);
84
+ })
85
+ : null;
70
86
  if (!stop) {
71
87
  setGone(true);
72
88
  return;
73
89
  }
74
90
  return stop;
75
- }, [needed, setVault]);
76
- if (!needed)
77
- return 'unneeded';
78
- return gone ? 'gone' : 'asked';
91
+ }, []);
92
+ return { ...answer, tools: masked ? answer?.tools : undefined, gone };
79
93
  }
@@ -4,7 +4,7 @@ import { type ProjectFiles, type ProjectSession } from './lib/studio-project.ts'
4
4
  import { type RestoredStudio } from './lib/studio-session.ts';
5
5
  import type { ProbeResult } from './lib/tool-probe.ts';
6
6
  import { type StudioHost, type StudioOpened } from './studio-host.ts';
7
- /** The workspace's store, kept in this tab's sessionStorage, and the open agent's draft from it. */
7
+ /** The workspace's store, kept in this tab's records, and the open agent's draft from it. */
8
8
  declare function useStudioWorkspace(start: RestoredStudio, project: ProjectSession | undefined): {
9
9
  store: {
10
10
  getWorkspace: () => StudioWorkspace;
@@ -25,7 +25,7 @@ import { IconAdjustmentsHorizontal, IconArrowBarToDown, IconArrowLeft, IconBrows
25
25
  import { profileGraphFacet } from '@theoremjs/agents';
26
26
  import { InPlace, PaneFailure, RaisedPane, useDisclosureMotion, } from '@theoremjs/react/ui';
27
27
  import { canonical } from "../canonical.js";
28
- import { addAgent, addArchitectExample, addProvider, addResearchExample, agentNodeId, compileWorkspace, createBlankDraft, createConsoleExampleDraft, createDecisionExampleDraft, createExampleDraft, createGeminiEmbeddingExampleDraft, createLiveExampleDraft, createNarratorExampleDraft, createStudioRunId, draftFacets, duplicateAgent, editedSince, excludeFacet, includableFacets, includeFacet, libraryDraft, localProviderAddress, mergedWithFiles, modelBindingNodeId, modelRoute, modelSharers, modelSlots, nodeOrigins, onStudioLocal, openOutcome, originLabel, originPlace, originWay, providerIdOf, providerNodeId, providerUse, rebased, removeAgent, removeLibraryTool, removeProvider, renameProvider, reopened, resetAgent, resetAgentNode, resetLibraryTool, resetProvider, sampleToolInput, saveStudioRunPayload, scopedNodeId, setToolAllowed, sharedAsk, sharedAt, sharedEntries, studioNodeRef, studioSource, studioTree, toolSpecKeyOf, withAgentDraft, withFilesChosen, withProvider, workspaceNodeRef, workspaceRunAgent, workspaceTree, writeAsk, } from "../mod.js";
28
+ import { addAgent, addArchitectExample, addProvider, addResearchExample, agentNodeId, compileWorkspace, createBlankDraft, createConsoleExampleDraft, createDecisionExampleDraft, createExampleDraft, createGeminiEmbeddingExampleDraft, createLiveExampleDraft, createNarratorExampleDraft, draftFacets, duplicateAgent, editedSince, excludeFacet, includableFacets, includeFacet, libraryDraft, localProviderAddress, mergedWithFiles, modelBindingNodeId, modelRoute, modelSharers, modelSlots, nodeOrigins, onStudioLocal, openOutcome, originLabel, originPlace, originWay, providerIdOf, providerNodeId, providerUse, rebased, removeAgent, removeLibraryTool, removeProvider, renameProvider, reopened, resetAgent, resetAgentNode, resetLibraryTool, resetProvider, sampleToolInput, scopedNodeId, setToolAllowed, sharedAsk, sharedAt, sharedEntries, studioNodeRef, studioSource, studioTree, toolSpecKeyOf, withAgentDraft, withFilesChosen, withProvider, workspaceNodeRef, workspaceRunAgent, workspaceTree, writeAsk, } from "../mod.js";
29
29
  import { slotProviders } from "../requirements.js";
30
30
  import { studioSurface } from "../surface.js";
31
31
  import './studio.css';
@@ -42,7 +42,7 @@ import { FACET_ICON } from "./lib/facet-icons.js";
42
42
  import { movePanel } from "./lib/panel-motion.js";
43
43
  import { screenEndpoint } from "./lib/project-address.js";
44
44
  import { recordsTraces } from "./lib/project-traces.js";
45
- import { answerRunKeys } from "./lib/run-keys.js";
45
+ import { answerRunKeys, handOffStudioRun } from "./lib/run-keys.js";
46
46
  import { sendWhenReady } from "./lib/send-when-ready.js";
47
47
  import { clearConversation, restoreConversation, saveConversation, } from "./lib/studio-conversation.js";
48
48
  import { STUDIO_EXAMPLES } from "./lib/studio-examples.js";
@@ -559,10 +559,9 @@ function innerNodeId(id, focus) {
559
559
  return 'identity';
560
560
  return id.startsWith(`${root}/`) ? id.slice(root.length + 1) : undefined;
561
561
  }
562
- /** Hands the compiled agent to a new tab through this browser's storage; the run route reads it back. */
563
- function openInNewTab(payload, project) {
564
- const runId = createStudioRunId();
565
- saveStudioRunPayload(payload, runId);
562
+ /** Hands the compiled agent to a new tab through the browser's keep; the run route takes it. */
563
+ async function openInNewTab(payload, project) {
564
+ const runId = await handOffStudioRun(payload);
566
565
  // A project's agent runs the project's code on its own page too.
567
566
  const named = project ? `&project=${encodeURIComponent(project.name)}` : '';
568
567
  // why: no `noopener`: the run tab asks this tab for its keys, which never leave memory.
@@ -803,7 +802,7 @@ function runMembers(store, page, chat) {
803
802
  const result = runNow();
804
803
  if (!result)
805
804
  return;
806
- openInNewTab({
805
+ void openInNewTab({
807
806
  ...runPayload(result),
808
807
  connectionMode: page.current.on.mode,
809
808
  localBaseUrl: page.current.connection.local.baseUrl,
@@ -892,7 +891,7 @@ function OpenInNewTabButton({ compiled, chattedId, blocked, connection, isIconOn
892
891
  'Run this agent on a full page of its own, in a new tab, the way a person using it would see it', onClick: () => {
893
892
  const run = compiled && workspaceRunAgent(compiled, chattedId);
894
893
  if (run)
895
- openInNewTab({ ...runPayload(run), ...connection }, project);
894
+ void openInNewTab({ ...runPayload(run), ...connection }, project);
896
895
  } }));
897
896
  }
898
897
  /** Get code: a .zip, Copy, or Copy for LLM, for every agent; off while the workspace has issues. */
@@ -952,7 +951,7 @@ function ExportMenu({ store, compile, copy, }) {
952
951
  },
953
952
  ] }));
954
953
  }
955
- /** The workspace's store, kept in this tab's sessionStorage, and the open agent's draft from it. */
954
+ /** The workspace's store, kept in this tab's records, and the open agent's draft from it. */
956
955
  function useStudioWorkspace(start, project) {
957
956
  // The settings the project's profiles share, on the agents it opened as: a change to one is
958
957
  // made on each of them.
@@ -18,13 +18,13 @@ import { StackItem } from '@astryxdesign/core/Stack';
18
18
  import { Switch } from '@astryxdesign/core/Switch';
19
19
  import { Text } from '@astryxdesign/core/Text';
20
20
  import { VStack } from '@astryxdesign/core/VStack';
21
- import { IconX } from '@tabler/icons-react';
21
+ import { IconChevronLeft, IconChevronRight, IconX } from '@tabler/icons-react';
22
22
  import { useTheoremChat } from '@theoremjs/react';
23
23
  import { ChatTranscript, ConsoleFrame, RequestCard, ResponseColumn, RunBar, TheoremLabelsProvider, TheoremThemeProvider, useLabels, useTraceInspector, } from '@theoremjs/react/ui';
24
24
  import { createTraceFeed, recordedFeed, } from '@theoremjs/web/client';
25
25
  import { useEffect, useMemo, useRef, useState } from 'react';
26
26
  import { createBrowserStudioTransport, startBrowserStudioConversation, } from "../browser.js";
27
- import { createReplay, parseTraceFile, recordedPayload, recordedTranscript, replayScript, startStudioConversation, studioInterface, studioPageTools, } from "../mod.js";
27
+ import { createReplay, parseTraceFile, recordedPayload, recordedTranscript, replayScripts, startStudioConversation, studioInterface, studioPageTools, } from "../mod.js";
28
28
  import { pageConversationKey } from "./lib/studio-conversation.js";
29
29
  import { STUDIO_LABELS } from "./lib/studio-labels.js";
30
30
  /**
@@ -67,8 +67,6 @@ function TraceFileInput({ onImport }) {
67
67
  setReading(true);
68
68
  try {
69
69
  const records = parseTraceFile(await file.text());
70
- // why: a file the replay cannot read is refused here, where the card can say why.
71
- replayScript(records);
72
70
  onImport({ name: file.name, records });
73
71
  setProblem(undefined);
74
72
  }
@@ -99,7 +97,11 @@ function TraceFacts({ controls }) {
99
97
  `${String(turns)} ${turns === 1 ? 'turn' : 'turns'}`,
100
98
  recordedAt(script),
101
99
  ];
102
- return (_jsxs(_Fragment, { children: [_jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(StackItem, { size: "fill", children: _jsxs(VStack, { gap: 0, children: [_jsx(Text, { type: "label", maxLines: 1, children: controls.opened.name }), _jsx(Text, { type: "supporting", color: "secondary", maxLines: 1, children: facts.filter(Boolean).join(' · ') })] }) }), _jsx(IconButton, { label: "Clear trace", variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconX, size: "sm" }), isDisabled: controls.isRunning, onClick: controls.onClear })] }), script.agent && script.agent !== payload.profile.id ? (_jsx(Banner, { status: "info", title: `Recorded with ${script.agent}; a replay runs through ${payload.profile.id}.` })) : null, turns === 0 ? (_jsx(Banner, { status: "info", title: "This trace holds no conversation to replay." })) : null, _jsx(Switch, { label: "Live tools", description: "Run the profile's tools instead of answering them from the recording.", value: controls.liveTools, onChange: controls.onLiveTools })] }));
100
+ return (_jsxs(_Fragment, { children: [_jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(StackItem, { size: "fill", children: _jsxs(VStack, { gap: 0, children: [_jsx(Text, { type: "label", maxLines: 1, children: controls.opened.name }), _jsx(Text, { type: "supporting", color: "secondary", maxLines: 1, children: facts.filter(Boolean).join(' · ') })] }) }), _jsx(IconButton, { label: "Clear trace", variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconX, size: "sm" }), isDisabled: controls.isRunning, onClick: controls.onClear })] }), controls.count > 1 ? (_jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(IconButton, { label: "Previous conversation", variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconChevronLeft, size: "sm" }), isDisabled: controls.isRunning || controls.picked === 0, onClick: () => {
101
+ controls.onPick(controls.picked - 1);
102
+ } }), _jsxs(Text, { type: "supporting", children: ["Conversation ", String(controls.picked + 1), " of ", String(controls.count)] }), _jsx(IconButton, { label: "Next conversation", variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconChevronRight, size: "sm" }), isDisabled: controls.isRunning || controls.picked === controls.count - 1, onClick: () => {
103
+ controls.onPick(controls.picked + 1);
104
+ } })] })) : null, script.agent && script.agent !== payload.profile.id ? (_jsx(Banner, { status: "info", title: `Recorded with ${script.agent}; a replay runs through ${payload.profile.id}.` })) : null, turns === 0 ? (_jsx(Banner, { status: "info", title: "This trace holds no conversation to replay." })) : null, _jsx(Switch, { label: "Live tools", description: "Run the profile's tools instead of answering them from the recording.", value: controls.liveTools, onChange: controls.onLiveTools })] }));
103
105
  }
104
106
  const idle = () => undefined;
105
107
  /** The trace card: the file, what it recorded, and Replay. */
@@ -150,11 +152,11 @@ function StatusBanner({ status, turns, onContinue, onLive, }) {
150
152
  return (_jsxs(VStack, { gap: 1, children: [banner, problem ? _jsx(Banner, { status: "error", title: problem }) : null] }));
151
153
  }
152
154
  /** A replay of the imported trace: driven turn by turn, beside what the trace recorded. */
153
- function ReplayConsole({ payload, iface, trace, card, opened, script, shown, liveTools, runtime, onLive, }) {
155
+ function ReplayConsole({ payload, iface, trace, card, records, script, shown, liveTools, runtime, onLive, }) {
154
156
  const diverged = useRef(undefined);
155
157
  const [status, setStatus] = useState({ kind: 'running', turn: 0 });
156
158
  const [traces] = useState(createTraceFeed);
157
- const recorded = useMemo(() => recordedFeed(opened.records), [opened.records]);
159
+ const recorded = useMemo(() => recordedFeed(records), [records]);
158
160
  const replay = useMemo(() => createReplay(script, payload.profile.id, (divergence) => {
159
161
  diverged.current ??= divergence;
160
162
  }), [script, payload.profile.id]);
@@ -240,14 +242,32 @@ function ReplayConsole({ payload, iface, trace, card, opened, script, shown, liv
240
242
  export function TraceReplay(props) {
241
243
  return (_jsx(TheoremThemeProvider, { children: _jsx(TheoremLabelsProvider, { labels: STUDIO_LABELS, children: _jsx(TraceConsole, { ...props }) }) }));
242
244
  }
245
+ /** A file with no conversation in it. */
246
+ const emptyScript = { agent: '', turns: [], records: [] };
247
+ /**
248
+ * What the inspector shows of a file: all of it with one conversation in it; with more, the open
249
+ * conversation's records and those no conversation holds (a host's tool call, a decision).
250
+ */
251
+ function shownRecords(records, scripts, script) {
252
+ if (scripts.length <= 1 || !script)
253
+ return records;
254
+ const held = new Set(scripts.flatMap((each) => each.records));
255
+ const open = new Set(script.records);
256
+ return records.filter((record) => open.has(record) || !held.has(record));
257
+ }
243
258
  function TraceConsole({ payload, trace, runtime, onLive, opened, onOpened, onClear, }) {
244
259
  const iface = useMemo(() => studioInterface(payload), [payload]);
245
- const script = useMemo(() => opened && replayScript(opened.records), [opened]);
246
- const recorded = useMemo(() => recordedFeed(opened?.records ?? []), [opened]);
260
+ const scripts = useMemo(() => (opened ? replayScripts(opened.records) : []), [opened]);
261
+ const [pick, setPick] = useState();
262
+ // why: a newly opened file starts on its first conversation.
263
+ const picked = pick && pick.of === opened ? pick.index : 0;
264
+ const script = opened ? (scripts[picked] ?? emptyScript) : undefined;
265
+ const records = useMemo(() => shownRecords(opened?.records ?? [], scripts, script), [opened, scripts, script]);
266
+ const recorded = useMemo(() => recordedFeed(records), [records]);
247
267
  const [ran, setRan] = useState();
248
268
  const [liveTools, setLiveTools] = useState(false);
249
- // invariant: a replay belongs to the file and the agent it ran; another of either shows the recording.
250
- const run = ran?.of === opened && ran?.agent === payload.profile.id ? ran : undefined;
269
+ // invariant: a replay belongs to the conversation and the agent it ran; another of either shows the recording.
270
+ const run = ran && ran.of === script && ran.agent === payload.profile.id ? ran : undefined;
251
271
  const attempt = run?.attempt ?? 0;
252
272
  const shown = run?.shown ?? 'recorded';
253
273
  const setShown = (next) => {
@@ -255,8 +275,8 @@ function TraceConsole({ payload, trace, runtime, onLive, opened, onOpened, onCle
255
275
  setRan({ ...run, shown: next });
256
276
  };
257
277
  const replayOnce = () => {
258
- if (opened)
259
- setRan({ of: opened, agent: payload.profile.id, attempt: attempt + 1, shown: 'replayed' });
278
+ if (script)
279
+ setRan({ of: script, agent: payload.profile.id, attempt: attempt + 1, shown: 'replayed' });
260
280
  };
261
281
  // invariant: the header offers an import only for a type whose conversation a trace holds.
262
282
  if (iface.type === 'live')
@@ -266,6 +286,11 @@ function TraceConsole({ payload, trace, runtime, onLive, opened, onOpened, onCle
266
286
  const card = ({ isRunning, onStop }) => (_jsx(TraceCard, { onImport: onOpened, controls: {
267
287
  opened,
268
288
  script,
289
+ picked,
290
+ count: scripts.length,
291
+ onPick: (index) => {
292
+ setPick({ of: opened, index });
293
+ },
269
294
  payload,
270
295
  shown: attempt > 0 ? shown : null,
271
296
  onShown: setShown,
@@ -282,5 +307,5 @@ function TraceConsole({ payload, trace, runtime, onLive, opened, onOpened, onCle
282
307
  } }));
283
308
  if (attempt === 0)
284
309
  return (_jsx(TraceFrame, { iface: iface, feed: recorded, trace: trace, card: card({ isRunning: false, onStop: () => undefined }), conversation: _jsx(Conversation, { iface: iface, blocks: recordedTranscript(script) }) }));
285
- return (_jsx(ReplayConsole, { payload: payload, iface: iface, trace: trace, card: card, opened: opened, script: script, shown: shown, liveTools: liveTools, runtime: runtime, onLive: onLive }, attempt));
310
+ return (_jsx(ReplayConsole, { payload: payload, iface: iface, trace: trace, card: card, records: records, script: script, shown: shown, liveTools: liveTools, runtime: runtime, onLive: onLive }, attempt));
286
311
  }
package/vite.mjs CHANGED
@@ -140,7 +140,7 @@ function emitDeclarations(hostRoot) {
140
140
  emitDeclarationOnly: true,
141
141
  skipLibCheck: true,
142
142
  strict: true,
143
- target: ts.ScriptTarget.ES2022,
143
+ target: ts.ScriptTarget.ES2023,
144
144
  module: ts.ModuleKind.ESNext,
145
145
  moduleResolution: ts.ModuleResolutionKind.Bundler,
146
146
  allowImportingTsExtensions: true,
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TraceInspector-DSLg92wY.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-DAdn_XvU.js","assets/host-patterns-F-KZIzkF.js","assets/trace-record-CtL5_CIg.js","assets/TraceOverview-TDZ4GUIz.js","assets/labels-provider-t4c-5JMk.js","assets/CodeBlock-CfVOtDeO.js","assets/useClipboard-CbN9bb4J.js","assets/index-CVYQrx1w.js","assets/browser-transport-sRqTLzGF.js","assets/Center-nHS1JSux.js","assets/IconSearch-BTx66a40.js","assets/schemas-BQ9Jydzb.js","assets/tool-schema-B_EOjDjg.js","assets/reader-DlrsIIkn.js","assets/browser-connection-QNf4S7Ff.js","assets/live-ingress-OuSlQ6q7.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-CWjTbSMX.js","assets/Dialog-Sd04KQS2.js","assets/HoverCard-DMyWUvwP.js","assets/IconEye-BB5aY-wQ.js","assets/studio-labels-BQOD-taS.js","assets/turn-client-yriGS51g.js","assets/encode-files-CM9H0Lq5.js","assets/CollapsibleGroup-BsIYDnJR.js","assets/tree-DM7jRXMx.js","assets/crypto-B6qD6nxk.js","assets/use-second-ticker-rObooyH6.js","assets/use-second-ticker-GWBt83pd.css","assets/workspace-WKa0_gWg.js","assets/lent-keys-C32ems-I.js","assets/editors-BJX_S59A.js","assets/studio-session-yEqFQo5o.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 oe,_ as C,h as w,i as T,j as E,mn as D,q as O,v as se,yt as k,z as A}from"./tool-schema-B_EOjDjg.js";import{c as j,r as ce}from"./host-patterns-F-KZIzkF.js";import{Gn as M,Lr as N,Pn as le,Rn as P,Sr as F,Un as I,Vn as ue,an as de,gr as L,in as fe,jn as pe,vr as me}from"./shaped-data-DAdn_XvU.js";import{C as R,G as z,H as he,K as ge,S as B,W as _e,_ as ve,h as ye,l as be,m as xe,q as Se,s as Ce,t as V}from"./tree-DM7jRXMx.js";import{W as we,_ as Te,c as Ee,h as De,u as H}from"./browser-connection-QNf4S7Ff.js";import{a as Oe,r as ke}from"./live-ingress-OuSlQ6q7.js";import{n as Ae,r as je}from"./use-second-ticker-rObooyH6.js";var Me=x(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),Ne=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`}]]),U=`••••`,Pe=/auth|key|token|secret|passw|pwd|cookie|session|signature|^sig$|credential|^code$|appid/i,Fe=/auth|key|token|secret|passw|pwd|signature|credential|appid/i,Ie=[[/^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`]],Le=16;function Re(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<Le&&i.push(`shorter than keys usually are`));let a=Ie.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 W=/^([a-z][a-z0-9+.-]*:\/\/)([^/?#@]*)@/i,G=/([?&;])([^=?&;#\s]*)=([^&;#\s]*)/g;function K(e){let t=e.indexOf(`:`);return t<0?[e,void 0]:[e.slice(0,t),e.slice(t+1)]}function ze(e){try{return decodeURIComponent(e)}catch{return e}}function q(e){return Pe.test(e)}function Be(e){let t=URL.canParse(e)?Pe:Fe;return e.replace(W,(e,t,n)=>{let[r,i]=K(n);return`${t}${r&&`••••`}${i===void 0?``:`:${i&&`••••`}`}@`}).replace(G,(e,n,r,i)=>i&&t.test(ze(r))?`${n}${r}=${U}`:e)}function Ve(e,t){let[n,r]=K(W.exec(t)?.[2]??``),i=new Map;for(let[,,e=``,n=``]of t.matchAll(G))i.set(e,[...i.get(e)??[],n]);return e.replace(W,(e,t,i)=>{let[a,o]=K(i),s=a===`••••`&&n?n:a,c=o===`••••`&&r?r:o;return`${t}${s}${c===void 0?``:`:${c}`}@`}).replace(G,(e,t,n,r)=>{let a=r===`••••`?i.get(n)?.shift():void 0;return a?`${t}${n}=${a}`:e})}function He(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,q(e)?U:t]));return typeof e==`string`?JSON.stringify(n):n}var Ue=/\{\s*private\s*:/g;function We(e,t){return e.slice(0,t).split(`
3
- `).length}function Ge(e){let t=[],n=0;for(let r of e.matchAll(Ue)){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(We(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(We(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 Ke=()=>void 0,qe=()=>void 0;function J(e){return(e??[]).map(e=>e.trim()).filter(Boolean)}function Y(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 Je={agentId:{label:`Profile id`,max:64},handle:{label:`Handle`,max:32}};function Ye(e,t,n){let{label:r,max:i}=Je[t];n.trim()?Array.from(n).length>i&&e(`identity`,`${r} is at most ${i} characters.`,t):e(`identity`,`${r} is required.`,t)}function Xe(e,t){Ye(t,`agentId`,e.identity.agentId),e.identity.profileType!==`host`&&Ye(t,`handle`,e.identity.handle)}function Ze(e,t,n,r){let i=V(e.key),a=E(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 Qe(e){return e.length<2?e[0]??``:`${e.slice(0,-1).join(`, `)} or ${e.at(-1)}`}function $e(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 et(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),w(t)&&!oe.includes(o)&&r(n,`${e.provider} takes the ${Qe(oe)} 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&&z(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 ${Qe(e)}.`:`Default effort '${a}' is not one of the efforts.`,`defaultEffort`)}return{efforts:i,defaultEffort:a}}function tt(e,t,n,r,i){let a=V(e.key),o=Ze(e,t,n,r),{apiId:s}=o,{efforts:c,defaultEffort:l}=et(e,o,a,r),u=Object.keys(c).length;Y(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`),rt(e,n,t,a,r);let d=it(e,t,a,r,i),f=nt(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 nt(e,t,n){let r={};for(let{name:i,label:a,isTimer:o}of ye){let s=e.limits?.[i]??null;s!==null&&(Y(n,t,`limits.${i}`,a,s,1),o&&s>2147483647&&n(t,`${a} must be at most ${ve} ms.`,`limits.${i}`),r[i]=s)}return Object.keys(r).length?r:void 0}function rt(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`?$e(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 it(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??be.compactAt,c=e.compactKeep??null;o===null&&r(n,`Compaction needs a budget.`,`compactMaxTokens`),Y(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 at(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&&ge(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 ot(e,t,n,r){let{models:i,modelBindings:a}=e,o={};for(let s of a){let a=tt({...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=V(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=at(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 X(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 st=e=>typeof e==`string`,ct=e=>!0;function lt(e){return X(e,st)}var ut=e=>we(e,`system`)===void 0;function dt(e,t){let n=X(e,ut);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=Ge(i);if(!n.ok){t(`${e}: ${n.message}`);return}n.prompt!==void 0&&(r[e]=n.prompt)}return r}function ft(e,t,n){let r=X(e,t);return r===null&&n(),r??void 0}function pt(e,t){if(!e.authType||e.authType===`none`)return;let n=e.authService?.trim()??``;n||t(`Service is required.`,`authService`);let r=J(e.authScopes),i=e.authType===`api_key`?e.authQueryParam?.trim():void 0;i&&J(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 mt(e){try{return new URL(e),!0}catch{return!1}}function ht(e,t){e?C(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 gt(e,t,n){let r=e.toolName.trim();ht(r,t);let i=e.description.trim();i||t(`Description is required.`,`description`);let a=e.toolType===`agent`?{inputSchema:n(e.agentKey??``)??vt,outputSchema:yt}:_t(e,t),o=J(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 _t(e,t){let n=T(e.inputJson,`Input`);n.ok||t(n.error,`inputJson`);let r=T(e.outputJson,`Output`);return r.ok||t(r.error,`outputJson`),{inputSchema:n.ok?n.schema:{},outputSchema:r.ok?r.schema:{}}}var vt=H(De({type:`text`}),`input`),yt=H(Te,`output`);function bt(e){let t=e.identity.profileType;if(t!==`text`&&t!==`image`&&t!==`speech`)return;let n=t!==`speech`&&R(e).includes(`inputs`)?It(e.inputs,t,()=>{}):void 0;return H(De({type:t,...n?{inputs:n}:{}}),`input`)}function xt(e){return(e??``).split(`
4
- `).map(e=>e.trim()).filter(Boolean)}function St(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=xt(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 Ct(e){let t=Object.entries(e??{}).find(([e,t])=>q(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 wt(e){if(!e||!URL.canParse(e))return;let t=[...new URL(e).searchParams].find(([e,t])=>q(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 Tt(e,t){let n=lt(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=Ct(n??void 0);r&&t(r,`headersJson`);let i=e.toolType===`mcp`?`serverUrl`:`endpoint`,a=wt(e[i]?.trim());a&&t(a,i);let o=pt(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 Et(e,t,n,r){let i=e[t]?.trim()??``;return i?mt(i)||r(`${n} must be a full URL.`,t):r(`${n} is required.`,t),i}function Dt(e,t,n){let r=Et(e,`endpoint`,`Endpoint URL`,n),i=J(e.pathParams),a=J(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??fe[0],...Tt(e,n),...Object.keys(s).length?{mapping:s}:{}}}function Ot(e,t,n){let r=Et(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,...Tt(e,n),...kt(e,n)}}function kt(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 At(e,t,n){let r=e.answeredBy===`page`?{answeredBy:`page`}:{};if(!e.stubOutputJson?.trim())return{type:`function`,...t,...r};let i=T(e.stubOutputJson,`Stub output`);return i.ok||n(i.error.replace(` JSON Schema`,``),`stubOutputJson`),{type:`function`,...t,...r,...i.ok?{stubResponse:i.schema}:{}}}function jt(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 Mt={http:Dt,mcp:Ot,function:At,agent:jt};function Nt(e){return Ae.includes(e)}function Pt(e,t,n,r){let i=Ce(e.key);if(!Nt(e.toolType)){t(i,je,`toolType`);return}let a=!1,o=(e,n)=>{a=!0,t(i,e,n)},s=gt(e,o,r),c=St(e,s,o),l=Mt[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 Ft(e,t,n,r,i,a){let o=[],s=new Set;for(let t of e.toolSpecs){let e=Pt(t,r,i,a);e&&(s.has(e.name)?r(Ce(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 It(e,t,n){let r=t===`image`?e.attachmentsAccept.filter(e=>!D(de,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`),Se(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)}Y(n,`inputs`,`maxFiles`,`Max files`,e.maxFiles,1),Y(n,`inputs`,`maxBytes`,`Max bytes`,e.maxBytes,1),Y(n,`inputs`,`maxTurnBytes`,`Max turn bytes`,e.maxTurnBytes,1);let i=Rt(e,n),a=Bt(e,n),o=Lt(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 Lt(e,t){if(e.contextFrom.length)return e.contextMaxChars===null&&t(`inputs`,`Max characters is required with context.`,`contextMaxChars`),Y(t,`inputs`,`contextMaxChars`,`Max characters`,e.contextMaxChars,1),{from:[...e.contextFrom],maxChars:e.contextMaxChars??0}}function Rt(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 zt(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 Bt(e,t){if(e.slots.length)return e.slots.forEach((n,r)=>{for(let i of zt(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 Vt(e,t){let n=Bt(e,t),r=Lt(e,t);return!n&&!r?{}:{inputs:{...n?{slots:n}:{},...r?{context:r}:{}}}}function Ht(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=T(e.schemaJson,`Structured output`);i.ok||n(`outputs`,i.error,`schemaJson`),t&&i.ok&&(r={id:t,spec:{jsonSchema:i.schema}})}i&&Y(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 Ut(e,t){return e.resumeEnabled?(Y(t,`turnBehaviour`,`maxContinues`,`Max continues`,e.maxContinues,1),{allowContinue:[...e.allowContinue],autoContinue:[...e.autoContinue],...e.maxContinues===null?{}:{maxContinues:e.maxContinues}}):{allowContinue:[],autoContinue:[]}}function Wt(e,t,n){let r=t?Ut(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 Gt(e,t,n,r){let i=[],a=e=>t.has(e)||t.has(`labels`),{turnBehaviour:o,guardrails:s,outputs:c}=e;if(a(`turnBehaviour`)&&he(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))xe[t]||i.push([`labels`,t,t,n.trim()]);let l={};for(let[e,t,n,a]of i)if(a)try{N({[n]:a},`Profile labels`),l[n]=a}catch(n){r(e,F(n),t)}return Object.keys(l).length?l:void 0}function Kt(e,t){if(e.quotaEnabled){if(e.quotaPerDay===null)t(`guardrails`,`Quota needs turns per day.`,`quotaPerDay`);else return Y(t,`guardrails`,`quotaPerDay`,`Quota per day`,e.quotaPerDay,1),{perDay:e.quotaPerDay}}}function qt(e,t){Y(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 Jt(e){return Yt(e,()=>{})}function Yt(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=J(e.allowedSchemes);if(e.allowPrivateNetworks||n.length||i.length)return{...e.allowPrivateNetworks?{allowPrivateNetworks:!0}:{},...n.length?{allowedHosts:n}:{},...i.length?{allowedSchemes:i}:{}}}function Xt(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 Zt(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(!J(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 Qt(e,t,n){let r=e.map(e=>{let t=e.name.trim();if(e.kind===`words`)return{name:t,words:J(e.words)};let n=e.flags.trim();return{name:t,pattern:e.pattern,...n?{flags:n}:{}}}),i=Zt(e,r);return i!==void 0&&n(`guardrails`,i,t),r}function $t(e,t,n){if(!t||!P[e].patterns)return{};let r=en(t.hint,`sources.${e}.hint`,n),i=Qt(t.patterns,`sources.${e}.patterns`,n);return{...t.theorem?{}:{theorem:!1},...i.length?{patterns:i}:{},...i.length&&r?{hint:r}:{}}}function en(e,t,n){let r=e.trim();if(!r)return;let i=M(`The retry hint`,r);return i!==void 0&&n(`guardrails`,`${i}.`,t),r}function tn(e,t){if(!e)return`Give this detector a key, such as acme.codenames.`;let n={label:e,action:`flag`,find:rn};return I(`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 nn(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=en(a.hint,`own.${i}.hint`,n),c=Qt(a.patterns,`own.${i}.patterns`,n),l=a.label.trim(),u=tn(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 rn=()=>[];function an(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:rn}];let{hint:i,...a}=r;return[e,a]}))}function on(e){let{guardrails:t}=e;return!t||!(`detect`in t)||t.detect===void 0?e:{...e,guardrails:{...t,detect:an(t.detect)}}}function sn(e,t,n){let{detect:r}=e,i={};for(let a of le){let o=t.filter(e=>r[a][e]!==ue[a][e]),s=t.some(e=>r[a][e]!==`ignore`)?cn(a,e,n):void 0,c=$t(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,nn(e.own,t,n));let a=I(`Detect`,an(i),t);return a!==void 0&&n(`guardrails`,a,`detect`),Object.keys(i).length?i:void 0}function cn(e,t,n){if(ln(e))return Xt(e,t.allow[e],n);if(P[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 ln(e){return P[e].allow===`urls`}function un(e){let{taintAfterRemoteRead:t,taintRemoteDestination:n}=e;if(t||n)return{...t?{afterRemoteRead:t}:{},...n?{remoteDestination:n}:{}}}function dn(e,t,n=L){let r={detect:sn(e,n,t),quota:Kt(e,t),blockedReply:qt(e,t),network:Yt(e,t),taint:un(e)},i=Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0));return Object.keys(i).length?i:void 0}function fn(e,t){let n=Oe({}),{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=ft(e.resourceJson,ct,()=>{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 pn={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`,gif:`image/gif`};function mn(e){if(!URL.canParse(e))return;let t=new URL(e);return t.protocol!==`https:`&&t.protocol!==`http:`?void 0:pn[t.pathname.split(`.`).pop()?.toLowerCase()??``]}function hn(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=mn(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 gn(e,t){Y(t,`image`,`n`,`Images per request`,e.n,1),Y(t,`image`,`seed`,`Seed`,e.seed,0),Y(t,`image`,`outputCompression`,`Compression`,e.outputCompression,0),e.outputCompression!==null&&e.outputCompression>100&&t(`image`,`Compression goes from 0 to 100.`,`outputCompression`);let n=hn(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 _n(e,t,n){let{format:r}=e;if(r){let e=t.modelBindings.find(e=>w(E(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=>w(E(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 vn(e,t){Y(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 yn(e,t,n){!e.ingressAudio&&!e.ingressVideo&&!e.ingressText&&t(`live`,`Turn on at least one ingress channel.`),Y(t,`live`,`vadPrefixPaddingMs`,`VAD prefix padding`,e.vadPrefixPaddingMs,0),Y(t,`live`,`vadSilenceDurationMs`,`VAD silence duration`,e.vadSilenceDurationMs,0),e.contextCompression&&bn(e,t,n.mode===`demo`?n.keys.liveInputTokens:void 0);let r=vn(e,t),i={audio:e.ingressAudio,video:e.ingressVideo,text:e.ingressText},a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t!==ke(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:xn(e)}:{},...Object.keys(s).length?{transcription:s}:{}}}function bn(e,t,n){Y(t,`live`,`compressionTriggerTokens`,`Compression trigger`,e.compressionTriggerTokens,1),Y(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 xn(e){let t=e.compressionTriggerTokens,n=e.compressionTargetTokens;return{...t===null?{}:{triggerTokens:t},slidingWindow:n===null?{}:{targetTokens:n}}}function Sn(e,t){let[n,...r]=t,{[n]:i,...a}=e;return!r.length||typeof i!=`object`||!i?a:{...a,[n]:Sn(i,r)}}function Cn(e){let t=e;for(let{path:n}of pe(e))t=Sn(t,n.split(`.`));return t}function wn(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 Tn=/^[a-z0-9_]+$/,En=[`image/png`,`image/jpeg`];function Dn(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}>`;Tn.test(a)?Object.hasOwn(n,o)?i(`Image ${o} is used twice.`):!En.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 On(e,t,n){let r=t.has(`observability`)?fn(e.observability,n):void 0,i=Gt(e,t,t=>B(e,t),n);return{...r?{observability:r}:{},...i?{labels:i}:{}}}function kn(e,t){let{decision:n}=e,r=n.contract.trim();return r||t(`decision`,`Contract is required.`,`contract`),r}function An(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=V(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(E(e.providers,`decision`,c),u);d&&l(d)})}function jn(e,t,n){let{decision:r}=e,i=new Set(R(e)),a=kn(e,t);e.modelBindings.length!==1&&t(`models`,`A decision needs exactly one model binding.`);let o=e.modelBindings[0],s=o?V(o.key):`models`;o&&(Ze(o,`decision`,e.providers,t),rt(o,e.providers,`decision`,s,t),o.modelId.trim()||t(s,`Model id is required.`,`modelId`),Y(t,s,`timeoutMs`,`Timeout`,o.timeoutMs,1));let c=o?nt(o,s,t):void 0;Y(t,`decision`,`maxStateBytes`,`Max state`,r.maxStateBytes,1);let l=wn(r,t),u=Dn(r,t);return n.mode===`demo`&&An(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},...On(e,i,t)},customTools:[],...r.questionsBuilt?{}:{questions:l},...Object.keys(u).length?{images:{...u}}:{}}}function Mn(e,t,n,r){let i=new Set(R(e)),{customTools:a,tools:o}=Ft(e,B(e,`tools.t2Loader`),B(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`)?dn(e.guardrails,t,me):void 0;return{profile:Cn({type:`host`,id:e.identity.agentId.trim(),tools:o,...s?{guardrails:s}:{},...On(e,i,t)}),customTools:a}}function Nn(e,t,n,r,i,a){let o=new Set(R(e)),s=t=>B(e,t),c=typeof e.identity.system==`string`?Ge(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=dt(e.identity.systemByRoleJson,e=>{n(`identity`,e,`systemByRoleJson`)}),d=ot(e,t,n,i),{outputs:f,structured:p}=o.has(`outputs`)?Ht(e.outputs,s(`outputs.structured`),n):{},{customTools:m,tools:h}=o.has(`tools`)?Ft(e,s(`tools.t2Loader`),s(`tools.parallel`),n,i,a):{customTools:[]},g=o.has(`turnBehaviour`)?Wt(e.turnBehaviour,s(`turnBehaviour.resumption`),n):void 0,_=o.has(`guardrails`)?dn(e.guardrails,n):void 0;return{profile:Cn({type:t,id:e.identity.agentId.trim(),identity:{handle:e.identity.handle.trim(),...l?{system:l}:{},...u?{systemByRole:u}:{}},...d,...o.has(`image`)?{image:gn(e.image,n)}:{},...o.has(`speech`)?{speech:_n(e.speech,e,n)}:{},...o.has(`live`)?{live:yn(e.live,n,r)}:{},...h?{tools:h}:{},...o.has(`inputs`)?t===`live`?Vt(e.inputs,n):{inputs:It(e.inputs,t,n)}:{},...f?{outputs:f}:{},...g?{turnBehaviour:g}:{},..._?{guardrails:_}:{},...On(e,o,n)}),customTools:m,...p?{structured:p}:{}}}function Pn(e,t,n=Ke,r=qe){let i=[],a=(e,t,n,r)=>{i.push({nodeId:e,message:t,...n===void 0?{}:{field:n},...r===void 0?{}:{index:r}})};Xe(e,a),new Set([e.models.key,e.models.fallbackKey,...e.modelBindings.flatMap(t=>{let{keySlot:n,fallbackKeySlot:r}=_e(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({...E(e.providers,o,n),builtInTools:n.builtInTools},t);r&&a(V(n.key),r.message,r.field)}let s=o===`decision`?jn(e,a,t):o===`host`?Mn(e,a,n,r):Nn(e,o,a,t,n,r);if(i.length)return{ok:!1,issues:i};try{Ee(on(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(),Fn=(0,Z.lazy)(()=>b(()=>import(`./TraceInspector-DSLg92wY.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]))),In=(0,Z.lazy)(()=>b(()=>import(`./TraceInspector-DSLg92wY.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]))),Ln=(0,Z.createContext)(`replace`);function Rn({value:e,children:t}){return(0,Q.jsx)(Ln,{value:e,children:t})}function zn({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)(In,{traces:n,isWide:e,end:t})})})}function Bn(e,t,n){let r=ee(),i=(0,Z.useId)(),[a,o]=(0,Z.useState)(!1),s=(0,Z.use)(Ln),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?Vn(s===`panel`,i,t,d(`sm`)):null,labels:c,offered:!0}}function Vn(e,t,n,r){return e?(0,Q.jsx)(Hn,{id:t,toggle:r,traces:n}):(0,Q.jsx)(zn,{id:t,toggle:r,traces:n})}function Hn({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)(In,{traces:n,isWide:p(i),end:t})})})}function Un({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 Wn({inspector:e,children:t}){return(0,Z.use)(Ln)===`panel`&&e.offered?(0,Q.jsx)(Un,{inspector:e,children:t}):(0,Q.jsx)(v,{view:e.view,children:t})}function Gn({records:e,head:t}){return(0,Q.jsx)(te,{children:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(Fn,{records:e,head:t})})})}var Kn={info:`info`,warning:`warning`,error:`error`,success:`success`},qn={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}},Jn={info:{kWkggS:`xgcxg3y`,$$css:!0},warning:{kWkggS:`x24i8r5`,$$css:!0},error:{kWkggS:`x1pritpl`,$$css:!0},success:{kWkggS:`xu13z74`,$$css:!0}};function Yn(e){return Object.prototype.hasOwnProperty.call(Jn,e)}var Xn={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function Zn({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,...oe}){let C=u(),[w,T]=(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=Kn[e],ce=qn[e],M=c(b),N=C(`@astryx.banner.dismiss`),le=h??N,P=h??(typeof t==`string`?C(`@astryx.banner.dismissTitled`,{dismiss:N,title:t}):N);if(w)return null;let F=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(k.current=e)},I=e=>{F(e.relatedTarget,e.currentTarget)},ue=e=>{F(document.activeElement,e.currentTarget)},de=()=>{let e=k.current;T(!0),m?.(),e?.isConnected&&e.focus()},L=D&&M,fe=c(g)||p||L,pe=c(g)||p,me=!c(i)&&pe,R=M&&(!D||O),z=_===`card`;return(0,Q.jsxs)(`div`,{ref:ie,onFocusCapture:s(ae,I),onPointerDownCapture:s(S,ue),...o(r(`banner-frame`,{container:_,elevation:v}),n($.root,Xn[v],z&&v!==`none`&&$.rootElevatedCard,ee),te,x),...oe,children:[(0,Q.jsxs)(`div`,{...o(r(`banner`,{container:_,status:e}),n($.header,me&&$.headerCentered,Yn(e)&&Jn[e],z&&(R?$.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})]}),fe&&(0,Q.jsxs)(`div`,{...n($.endArea,ne.inset(a[`--spacing-2`])),children:[g,L&&(0,Q.jsx)(re,{variant:`ghost`,size:`sm`,label:C(O?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:C(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":R?A:void 0,isIconOnly:!0}),p&&(0,Q.jsx)(re,{variant:`ghost`,size:`sm`,label:P,tooltip:le,icon:(0,Q.jsx)(l,{icon:`close`,size:`sm`,color:`inherit`}),onClick:de,isIconOnly:!0})]})]}),R&&(0,Q.jsx)(`div`,{id:L?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`}}[!!z|0]),children:b})]})}Zn.displayName=`Banner`;export{Ne as _,Bn as a,Ct as c,on as d,U as f,Ve as g,Re as h,Wn as i,wt as l,Be as m,Gn as n,bt as o,He as p,Rn as r,Pn as s,Zn as t,Jt as u,Me as v};
@@ -1,3 +0,0 @@
1
- import{C as e,E as t,O as n,T as r,l as i,o as a,u as o,v as s,w as c,y as l}from"./schemas-BQ9Jydzb.js";import{Fn as ee,H as te,Jn as ne,Ln as re,Wt as ie,gn as u,hn as ae,in as oe,mn as d,nn as se,pn as ce,tn as le,vn as f,zn as ue,zt as de}from"./tool-schema-B_EOjDjg.js";import{c as p}from"./host-patterns-F-KZIzkF.js";import{A as fe,Ir as m,Lr as pe,Mn as me,Nn as he,Un as h,an as ge,er as _e,fn as ve,jn as ye,lr as be,pn as xe,tn as Se,tr as Ce,vn as g,vr as we,wr as Te}from"./shaped-data-DAdn_XvU.js";import{a as Ee,n as De}from"./live-ingress-OuSlQ6q7.js";var Oe=2,ke=4,Ae=3,je=/(^|,)(\s*)("?)(?:([=@])|([+-])(?![0-9."]))/gm,Me=/^[A-Za-z0-9+/]*={0,2}$/,Ne=new Set([`text/csv`,`text/plain`,`text/markdown`]);function _(e){let{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}=e;if(t&&n&&r)return{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}}function Pe(e,t){if(t.limitsByMime){let n=f(e);if(t.limitsByMime[n])return t.limitsByMime[n];let[r]=n.split(`/`),i=`${r}/*`;if(t.limitsByMime[i])return t.limitsByMime[i]}return t.maxBytes}function v(e){return`uri`in e}function Fe(e){if(e.type===`speech`)throw new p(`request`,`Profile ${e.id} (speech) does not accept media input`);if(e.type===`live`)throw new p(`request`,`Profile ${e.id} (live) does not accept turn attachment input`);if(e.type===`host`||e.type===`decision`||e.type===`embedding`)throw new p(`request`,`Profile ${e.id} (${e.type}) does not accept turn input`);let t=_(e.inputs??{});if(!t)throw new p(`config`,`Profile ${e.id} must set maxFiles, maxBytes, and maxTurnBytes`);return t}function Ie(e){let t=0;return e.endsWith(`==`)?t=Oe:e.endsWith(`=`)&&(t=1),Math.floor(e.length*Ae/ke)-t}function Le(e){try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(e)}catch{return new TextDecoder(`latin1`).decode(e)}}function Re(e){return e.replace(je,(e,...t)=>{let[n,r,i,a,o]=t;return`${n}${r}${i}'${a??``}${o??``}`})}function ze(e,t,n){let r=Le(t);return e===`text/csv`&&(r=Re(r)),new TextEncoder().encode(n.read(r))}function y(e,t){return t?{...e,fileName:t}:e}function b(e,t,n){return t.filter(t=>!d(e,t.mimeType)).map(e=>y({code:`mime_not_allowed`,params:{mimeType:e.mimeType,channel:n}},e.name))}function Be(e,t){let n=[];e.length>t.maxFiles&&n.push({code:`too_many_files`,params:{maxFiles:t.maxFiles}});let r=0;for(let i of e){if(i.sizeBytes===void 0)continue;let e=Pe(i.mimeType,t);i.sizeBytes>e&&n.push(y({code:`file_too_large`,params:{maxBytes:e}},i.name)),r+=i.sizeBytes}return r>t.maxTurnBytes&&n.push({code:`turn_too_large`,params:{maxTurnBytes:t.maxTurnBytes}}),n}function x(e,t,n){let r=[];return t.length>0&&!e.attachments&&r.push({code:`attachments_not_accepted`,params:{channel:`attachment`}}),n.length>0&&!e.voice&&r.push({code:`voice_not_accepted`,params:{channel:`voice`}}),r.length>0||t.length===0&&n.length===0?r:(e.attachments&&r.push(...b(e.attachments,t,`attachment`)),e.voice&&r.push(...b(e.voice,n,`voice`)),e.limits?[...r,...Be([...t,...n],e.limits)]:[...r,{code:`limits_unconfigured`}])}var Ve={mime_not_allowed:`attachments.mime_not_allowed`,too_many_files:`attachments.too_many_files`,too_many_of_kind:`attachments.too_many_of_kind`,file_too_large:`attachments.file_too_large`,turn_too_large:`attachments.turn_too_large`,attachments_not_accepted:`attachments.not_accepted`,voice_not_accepted:`attachments.not_accepted`,limits_unconfigured:`attachments.limits_unconfigured`};function S(e){let t={};for(let[n,r]of Object.entries(e.params??{}))r!==void 0&&(t[n]=r);return e.fileName!==void 0&&(t.fileName=e.fileName),{key:Ve[e.code],params:t}}function He(e,t){let n=S(e);return m(n.key,n.params,t)}function C(e){return new p(`input`,`attachments refused: ${e.map(e=>e.code).join(`, `)}`,{copy:e.map(S)})}function w(e){if(!Me.test(e))throw new p(`request`,`attachment data must be base64`);return Ie(e)}function T(e){let t={mimeType:e.mimeType,name:e.name};return v(e)||(t.sizeBytes=w(e.data)),t}function Ue(e,t,n){if(!We(t,n))return;let r=Fe(e),i=x({attachments:ae(e,`attachments`),voice:ae(e,`voice`),limits:r},(t??[]).map(T),(n??[]).map(T));if(i.length>0)throw C(i)}function E(e,t){if(v(e))return e;let{mimeType:n,data:r}=e;if(!Ne.has(f(n)))return e;let i=ze(n,_e(r),t);return{...e,data:Ce(i)}}function We(e,t){return(e?.length??0)>0||(t?.length??0)>0}function Ge(e,t,n,r){return Ue(e,t,n),{attachments:t?.length?t.map(e=>E(e,r.attachment)):t,voice:n?.length?n.map(e=>E(e,r.voice)):n}}var Ke=`
2
-
3
- `;function qe(e){if(typeof e==`string`)return;if(typeof e!=`object`||!e||Array.isArray(e))return`must be a string or { private: string }`;let t=Object.keys(e);if(t.length!==1||t[0]!==`private`)return`must have exactly one key, private`;let n=e.private;if(typeof n!=`string`)return`must be a string`;if(n===``)return`must not be empty`}function Je(e,t){if(typeof e!=`string`){if(!Array.isArray(e))return`${t} must be a string or an array of parts`;if(e.length===0)return`${t} must not be an empty array`;for(let[n,r]of e.entries()){let e=qe(r);if(e)return`${t}[${n}]${typeof r==`object`&&r&&`private`in r?`.private`:``} ${e}`}}}function D(e,t){let n=Je(e,t);if(n)throw new p(`config`,n)}function Ye(e,t,n){return D(e,t),typeof e==`string`?n(e):e.map(e=>typeof e==`string`?n(e):{private:n(e.private)})}function Xe(e){if(typeof e==`string`)return[{text:e,private:!0}];let t=e.some(e=>typeof e!=`string`);return e.map(e=>typeof e==`string`?{text:e,private:!t}:{text:e.private,private:!0})}function Ze(e){let t=[];for(let n of e)n.some(e=>e.text)&&(t.length>0&&t.push({text:Ke,private:!0}),t.push(...n));return t}function Qe(e){return e.map(e=>e.text).join(``)}function $e(e){let t=[],n=``;for(let r of e)r.private?n+=r.text:(n.trim()&&t.push(n),n=``);return n.trim()&&t.push(n),{text:Qe(e),private:t}}function et(e,t){return $e(Ze([e,...t.map(e=>e?[{text:e,private:!0}]:[])]))}function O(e){let t=Object.keys(e);return t.length===1?t[0]:void 0}function k(e,t){let n=e.get(t);return n!==void 0&&n.type!==`builtin`}function A(e,t){return!e||e.includes(`*`)?!0:t?e.includes(t):!1}function tt(e,t){return t.filter(n=>{let r=e.get(n);return r?.type!==`builtin`||!(r.conflictsWith??[]).some(e=>t.includes(e))})}function j(e){return`tools`in e?e.tools.allow:[]}function M(e){return e.type===`text`||e.type===`image`?e.tools:void 0}function nt(e){return`tools`in e?e.tools.parallel:void 0}function rt(e,t,n){return j(t).filter(r=>{let i=e.get(r);return!i||i.type===`builtin`?!1:t.type===`host`||A(i.paths,n.path)})}function it(e,t,n,r){let i=t.models[r];return i?(i.builtInTools??[]).filter(t=>{let r=e.get(t);return r?.type===`builtin`&&A(r.paths,n.path)}):[]}function N(e,t){let n=e.get(t);if(n&&n.type!==`builtin`)return{type:`function`,name:n.name,description:n.description,parameters:n.inputSchema}}function at(e,t){let n=[];for(let r of t){let t=N(e,r);t&&n.push(t)}return n}function P(e,t,n){if(t.visible.includes(n))return;t.visible.push(n);let r=N(e,n);r&&!t.wire.some(e=>e.name===n)&&t.wire.push(r)}function ot(e,t,n){if(t.builtins.includes(n))return;let r=e.get(n);if(r?.type!==`builtin`)return;let i=r.conflictsWith??[];t.builtins=t.builtins.filter(t=>{if(i.includes(t))return!1;let r=e.get(t);return!(r?.type===`builtin`&&r.conflictsWith?.includes(n))}),t.builtins.push(n)}function st(e,t,n){return t.type===`live`||t.type===`host`?[...n]:n.filter(t=>e.get(t)?.loadTier===`T0`)}function ct(e,t,n){return tt(e,n.filter(n=>{let r=e.get(n);return r?.type===`builtin`&&(t.type===`live`||r.loadTier===`T0`)}))}function F(e,t,n,r){let i=rt(e,t,n),a=t.type===`host`||t.type===`decision`||t.type===`embedding`||r===void 0?[]:it(e,t,n,r),o=[...i,...a],s=ct(e,t,o),c=st(e,t,o);return{builtins:s,gated:o,visible:c,executable:c.filter(t=>k(e,t)),path:n.path,sessionPermissions:n.sessionPermissions,wire:at(e,c)}}async function lt(e,t,n,r){let i=F(e,t,n,r);return await I(e,i,t,n),i}function ut(e){return{builtins:[...e.builtins],gated:[...e.gated],visible:[...e.visible],executable:[...e.executable],path:e.path,sessionPermissions:e.sessionPermissions?[...e.sessionPermissions]:void 0,wire:e.wire.map(e=>({...e,parameters:structuredClone(e.parameters)}))}}async function I(e,t,n,r){let i=M(n)?.t1Policy;if(!i)return;let a;try{a=await i({profile:n,input:r.input,path:r.path,sessionPermissions:r.sessionPermissions,gated:t.gated,host:r.host})}catch(e){let t=e instanceof Error?e.message:String(e);throw new p(`config`,`Profile '${n.id}' tools.t1Policy rejected: ${t}`,{cause:e})}if(!Array.isArray(a))throw new p(`config`,`Profile '${n.id}' tools.t1Policy must return ToolId[]`);for(let n of a){if(!t.gated.includes(n))continue;let r=e.get(n);r?.loadTier===`T2`&&(r.type===`builtin`?ot(e,t,n):P(e,t,n))}t.executable=t.visible.filter(t=>k(e,t))}var dt=new Set([`__proto__`,`constructor`,`prototype`]);function ft(e){if(!fe(e))return;let{loaded:t}=e;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t}function pt(e,t,n,r){if(r.type===`live`||r.type===`host`)return{promoted:[]};let i=[];for(let a of n){if(typeof a!=`string`||dt.has(a))return{promoted:[],failure:{code:`invalid_output`,kind:`bad_response`,message:`tools.t2Loader loaded ids must be plain strings`}};let n=mt(e,a,r);if(`failure`in n)return{promoted:[],failure:n.failure};let{tool:o}=n;A(o.paths,t.path)&&t.gated.includes(a)&&i.push(a)}let a=[];for(let n of i)P(e,t,n),a.push(n);return t.executable=t.visible.filter(t=>k(e,t)),{promoted:a}}function L(e){return{failure:{code:`invalid_output`,kind:`bad_response`,message:e}}}function mt(e,t,n){if(!j(n).includes(t))return L(`tools.t2Loader attempted to promote tool '${t}' outside profile allow`);let r=e.get(t);return r?r.type===`builtin`?L(`tools.t2Loader attempted to promote builtin '${t}' — only custom tools may be promoted`):r.loadTier===`T2`?{tool:r}:L(`tools.t2Loader attempted to promote tool '${t}' with loadTier '${r.loadTier}' — only T2 tools may be promoted`):L(`tools.t2Loader attempted to promote unknown tool '${t}'`)}function R(e){return Array.isArray(e)?[...e]:e.choices.map(e=>e.value)}function ht(e){return Array.isArray(e)?{choices:e.map(e=>({value:e}))}:{...e.label!==void 0&&e.label!==``?{label:e.label}:{},choices:e.choices.map(e=>({value:e.value,...e.description!==void 0&&e.description!==``?{description:e.description}:{}}))}}function z(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ht(t)]))}function B(e){return e?.slots?{...e,slots:z(e.slots)}:e}function V(e){return e==null}function H(e){return V(e)||typeof e!=`object`||Array.isArray(e)?null:e}function U(e){let t=H(e);return!t||t.type!==void 0&&t.type!==`object`?null:t}function W(e){let t=e.required;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function G(e){let t=e.properties;return H(t)??{}}function gt(e,t){return e?`${e}.${t}`:t}function K(e,t){t.push({path:e,error:`required field '${e}' is missing`})}async function _t(e,t,n,r,i){if(!n)return;let a=await n(t,r);a.isValid||i.push({path:e,error:a.error||a.finding||`Validation failed for '${e}'`})}async function vt(e){let{path:t,propSchema:n,child:r,isRequired:i,fields:a,slots:o,failures:s}=e;if(V(r)){i&&K(t,s);return}await _t(t,r,a?.[t],o,s);let c=U(n),l=c?H(r):null;c&&l&&await q(c,l,t,a,o,s)}async function q(e,t,n,r,i,a){let o=G(e),s=new Set(W(e)),c=new Set([...Object.keys(o),...s]),l=H(t);for(let e of c)await vt({path:gt(n,e),propSchema:o[e],child:l?.[e],isRequired:s.has(e),fields:r,slots:i,failures:a})}async function yt(e,t,n,r){let i=U(e);if(!i)throw new p(`config`,`structured validation requires a JSON Schema object root`);let a=[];if(!H(t)){for(let e of W(i))K(e,a);return a}return await q(i,t,``,n,r,a),a}function bt(e,t){let n=e;for(let e of t.split(`.`)){let t=U(n);if(!t)return!1;let r=G(t);if(!Object.hasOwn(r,e)&&!W(t).includes(e))return!1;n=r[e]}return!0}function xt(e){return e.map(e=>e.error).join(`; `)}function St(e,t){let n=e;for(let e of t.split(`.`))n=H(n)?.[e];return n}function J(e,t,n){let[r,...i]=t.split(`.`),a=H(e)??{};return r===void 0?e:{...a,[r]:i.length?J(a[r],i.join(`.`),n):n}}async function Ct(e,t,n){let r=[];for(let[i,a]of Object.entries(t??{})){let t=St(e,i);if(Array.isArray(t))for(let[e,o]of t.entries()){let t=await a.check(o,n);t.isValid||r.push({path:i,index:e,item:o,reason:t.error||t.finding||`Validation failed for '${i}'`,onFail:a.onFail})}}return r}function wt(e,t){let n=e;for(let e of t.split(`.`)){let t=U(n);if(!t)return;n=G(t)[e]}let r=H(n);if(r?.type===`array`)return H(r.items)??void 0}var Tt=class extends Error{failure;constructor(e){super(e.message),this.failure=e}},Et=new Set([`text`,`image`,`speech`]),Dt=c().regex(/\S/),Ot=e({mimeType:c(),data:o(),name:c().optional()}),kt=e({mimeType:c(),uri:c(),name:c().optional()}),At=e({voice:c().optional(),style:c().optional(),speed:s().positive().optional()});function jt(t){return e(Object.fromEntries(Object.entries(t).map(([e,t])=>{let n=R(t);return[e,a(n).optional()]})))}var Mt=new Set([`text`,`attachments`,`voice`,`slots`,`speech`]);function Nt(e,t){if(!e.hostFields)return{sent:t};let n={...t},r={};for(let t of Object.keys(e.hostFields))n[t]!==void 0&&(r[t]=n[t]);let{text:i,attachments:a,voice:o,slots:s,speech:c}=t;return{sent:{text:i,...a?{attachments:a}:{},...o?{voice:o}:{},...s?{slots:s}:{},...c?{speech:c}:{}},hostInput:r}}function Pt(t,n){let{inputs:a}=t,o={text:Dt};a?.attachments&&(o.attachments=i(r([Ot,kt])).optional()),a?.voice&&(o.voice=i(Ot).optional()),a?.slots&&(o.slots=jt(a.slots).optional()),t.type===`speech`&&(o.speech=At.optional());for(let e of n?.hostOnly??[]){if(!o[e])throw new p(`config`,`Tool '${n?.name}' keeps '${e}' for the host, which its profile does not take`);delete o[e]}for(let[e,t]of Object.entries(n?.fieldText??{})){let r=o[e];if(!r)throw new p(`config`,`Tool '${n?.name}' describes '${e}', which its profile does not take`);o[e]=r.describe(t)}for(let[e,t]of Object.entries(n?.hostFields??{})){if(Mt.has(e))throw new p(`config`,`Tool '${n?.name}' declares the host field '${e}', which is a field of every agent tool`);o[e]=t}return e(o)}var Ft=l({text:c().optional(),structured:t().optional(),removed:i(l({path:c(),reason:c(),item:t()})).optional(),parts:i(ee).optional(),sources:i(ue).optional()});function It(e){return e.type===`speech`||(e.type===`text`||e.type===`image`)&&e.inputs.text!==!1}function Lt(e){return e.type===`builtin`?!1:e.permission!==`auto`||`auth`in e&&e.auth!==void 0&&(e.auth.onUnauthenticated??`gate`)===`gate`}function Rt(e,t){if(!Et.has(e.type))return`it is a ${e.type} profile; an agent tool runs a text, image, or speech profile`;if(!It(e))return`it does not take text`;for(let n of j(e)){let e=t(n);if(!e)return`its tool '${n}' is not registered; register it first`;if(Lt(e))return`its tool '${n}' can stop on a gate; give it permission 'auto' and no sign-in`}}function zt(e,t,n){let r=`Agent tool "${e.name}"`,i=e.maxCallsPerTurn;if(i!==void 0&&!(Number.isInteger(i)&&i>0))throw new p(`config`,`${r}: maxCallsPerTurn must be a whole number above 0`);let a=t(e.profile);if(!a)throw new p(`config`,`${r}: profile '${e.profile}' must be registered before the tool`);let o=Rt(a,n);if(o)throw new p(`config`,`${r} can't run '${e.profile}': ${o}`);return a}function Bt(e){if(!e)return`delegated`;let t=`models`in e&&Object.values(e.models).some(e=>(e.builtInTools?.length??0)>0);return j(e).length===0&&!t?`local`:`delegated`}function Vt(e){let t=re(e),n=t.flatMap(e=>e.type===`text`?[e.text]:[]).join(``),r=de(t,e=>e.type===`structured`),i=r?.structured,a=t.flatMap(e=>e.type===`media`?[{type:e.media.mimeType.startsWith(`audio/`)?`audio`:`image`,mimeType:e.media.mimeType,data:e.media.data}]:[]),o=t.flatMap(e=>e.type===`citation`?e.sources:[]);return{...i===void 0?{text:n}:{structured:i},...r?.removed?.length?{removed:r.removed}:{},...a.length>0?{parts:a}:{},...o.length>0?{sources:o}:{}}}function Ht(e,t,n){return{...e,type:`agent`,input:t,output:Ft,sources:e=>e.sources??[],...n}}function Ut(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return n.push(`${t}: schema must be an object`),!1;let r=typeof e.type==`string`||Array.isArray(e.type),i=e.anyOf!==void 0||e.oneOf!==void 0;if(!r&&!i){if(t!==`$`)return!0;n.push(`${t}: missing type or combinator`)}return e.type===`array`&&e.items===void 0&&n.push(`${t}: array schema must define items`),!0}function Wt(e,t,n,r){let i=Array.isArray(t)?t:[];for(let t of i)typeof t==`string`&&!Object.hasOwn(e,t)&&r.push(`${n}: required key '${t}' missing from properties`);for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&Y(i,`${n}.properties.${t}`,r)}function Y(e,t,n){if(!Ut(e,t,n))return;let r=e.properties;r&&typeof r==`object`&&!Array.isArray(r)&&Wt(r,e.required,t,n),e.items&&typeof e.items==`object`&&!Array.isArray(e.items)&&Y(e.items,`${t}.items`,n);for(let r of[`anyOf`,`oneOf`]){let i=e[r];Array.isArray(i)&&i.forEach((e,i)=>{e&&typeof e==`object`&&Y(e,`${t}.${r}[${i}]`,n)})}}function Gt(e,t){let n=[];if(Y(e,`$`,n),n.length>0)throw new p(`config`,`Invalid tool ${t} schema: ${n.join(`; `)}`)}function Kt(e,t=`output`){let r=n(e,{target:`draft-7`,io:t});return delete r.$schema,r.type||=`object`,r}function X(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(X);let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=X(e[n]));return t}function qt(e){let t=/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(e)?.[0];if(!t||/[{}]/.test(t))throw new p(`config`,`Endpoint "${e}" must start with a fixed scheme and host; placeholders belong in the path or query`)}function Jt(e,t,n,r){if(!n.provider?.trim()||!n.apiId?.trim())throw new p(`config`,m(`provider.binding_identity`))}function Yt(e){an(e.id,e.models),Q(e.id,e.observability),qn(e.id,e.inputs);for(let[t,n]of Object.entries(e.models))sn(e.id,t,n);return{type:`embedding`,id:e.id,identity:{handle:e.identity.handle},models:e.models,defaultModel:on(e.id,e),allowModelSelect:e.allowModelSelect,inputs:e.inputs,guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function Xt(e,t,n,r){let i=r.safeParse(n);if(!i.success)throw new p(`config`,`Profile ${e} model '${t}': ${i.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`; `)}`)}function Zt(e,t,n){if(Xt(e,t,n,se),Jt(e,t,n,`decision`),`retry`in n)throw new p(`config`,`Profile ${e} model '${t}': a decision binding takes no retry; a decision retries only a transient failure, by the kernel's rule`);if(n.timeoutMs!==void 0&&(!Number.isFinite(n.timeoutMs)||n.timeoutMs<=0))throw new p(`config`,`Profile ${e} model '${t}' timeoutMs must be > 0`)}function Qt(e){let t=e.models?O(e.models):void 0;if(!t)throw new p(`config`,`Profile ${e.id}: type 'decision' must declare exactly one model`);Zt(e.id,t,e.models[t])}function $t(e){if(e.inputs.state!==`json`)throw new p(`config`,`Profile ${e.id}: decision inputs.state must be 'json'`);let t=e.inputs.maxStateBytes;if(t!==void 0&&!(Number.isInteger(t)&&t>0))throw new p(`config`,`Profile ${e.id}: decision inputs.maxStateBytes must be a positive integer`);if(!e.decision.contract.trim())throw new p(`config`,`Profile ${e.id}: decision.contract must be non-empty`)}function en(e){return Qt(e),$t(e),Q(e.id,e.observability),{...e,identity:{handle:e.identity.handle}}}function tn(e){return e===void 0?{}:{parallel:e}}function nn(e){return rn(e.id,e.tools),Q(e.id,e.observability),{type:`host`,id:e.id,tools:{allow:e.tools.allow,...tn(e.tools.parallel)},guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function rn(e,t){if(!Array.isArray(t.allow))throw new p(`config`,`Profile ${e}: type 'host' must set tools.allow`)}function an(e,t){if(Object.keys(t).length===0)throw new p(`config`,`Profile ${e} must declare at least one model`)}function on(e,t){let n=t.defaultModel??O(t.models);if(!n)throw new p(`config`,`Profile ${e} must set defaultModel when more than one model is declared`);if(!t.models[n])throw new p(`config`,`Profile ${e} defaultModel '${n}' is not declared`);return n}function sn(e,t,n){cn(e,t,n),Xt(e,t,n,oe),cn(e,t,n)}function cn(e,t,n){let r=n.efforts;if(!r||Object.keys(r).length===0){if(n.defaultEffort||n.allowEffortSelect)throw new p(`config`,`Profile ${e} model '${t}': defaultEffort and allowEffortSelect require efforts`);return}for(let[n,i]of Object.entries(r))if(!g.includes(i))throw new p(`config`,`Profile ${e} model '${t}' effort '${n}': '${i}' is not a thinking level (${g.join(`, `)})`);let i=Object.keys(r),a=n.defaultEffort??(i.length===1?i[0]:void 0);if(!a)throw new p(`config`,`Profile ${e} model '${t}' must set defaultEffort when more than one effort is declared`);if(!r[a])throw new p(`config`,`Profile ${e} model '${t}' defaultEffort '${a}' is not declared`);if(n.allowEffortSelect&&i.length<2)throw new p(`config`,`Profile ${e} model '${t}' allowEffortSelect requires at least two efforts`)}function ln(e){return{providerContinuation:e.providerContinuation?ne.parse(e.providerContinuation):{},models:e.models,defaultModel:on(e.id,e),allowModelSelect:e.allowModelSelect,maxSteps:e.maxSteps}}function un(e,t,n){if(n?.length){for(let r of n)if(!ie(r))throw new p(`config`,`Profile ${e}: turnBehaviour.resumption.${t} may only include ContinueStopKind (length | stream_incomplete | provider_error); got '${r}'`)}}function dn(e,t){t&&(un(e,`allowContinue`,t.allowContinue),un(e,`autoContinue`,t.autoContinue))}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fn(e,t){let n=[e];for(let e of t)n=n.flatMap(t=>Z(t)?e===`*`?Object.values(t):[t[e]]:[]);return n}var pn=Object.entries(ve).filter(([,e])=>e.required===!0).map(([e,t])=>[e,t.profileTypes]).sort(([e],[t])=>e.split(`.`).length-t.split(`.`).length);function mn(e){if(!Z(e))throw new p(`config`,`Profile definition must be an object`);let t=typeof e.id==`string`&&e.id.trim()?e.id:void 0;if(!t)throw new p(`config`,`Profile definition must set id`);if(!xe.find(t=>t===e.type))throw new p(`config`,`Profile ${t}: type must be one of ${xe.join(`, `)}`)}function hn(e){let t=e.identity?.handle,n=[[`id`,e.id,64],[`identity.handle`,typeof t==`string`?t:``,32]];for(let[t,r,i]of n)if(!(Array.from(r).length<=i))throw new p(`config`,`Profile ${e.id.slice(0,64)}: ${t} must be at most ${i} characters`)}function gn(e){let{id:t,type:n}=e,r=e;for(let[e,i]of pn){if(i&&!i.includes(n))continue;let a=me(e),o=fn(r,a.slice(0,-1)),s=a[a.length-1];if(o.some(e=>{if(!Z(e))return!1;let t=e[s];return t==null||t===``}))throw new p(`config`,`Profile ${t}: type '${n}' must set ${a.join(`.`)}`)}}function _n(e){let{id:t,type:n}=e;if(n!==`live`&&he(`inputs`).includes(n)&&e.inputs==null)throw new p(`config`,`Profile ${t}: type '${n}' must set inputs`)}function vn(e){let[t]=ye(e);if(!t)return;let{offValue:n,reason:r}=t.scope,i=n===void 0?``:` (other than ${n})`;throw new p(`config`,`Profile ${e.id}: type '${e.type}' must not set ${t.path}${i} — ${r}`)}function yn(e,t){let n=t.turnBehaviour;dn(e,n?.resumption)}function bn(e,t){let n=t=>new p(`config`,`Profile ${e}: ${t}`),r=t?.maxRetries;if(r!==void 0&&(!Number.isInteger(r)||r<0))throw n(`outputs.validation.maxRetries must be a non-negative integer`)}function xn(e,t){let n=t=>new p(`config`,`Profile ${e}: ${t}`),r=Object.keys(t??{}).find(e=>!Sn.includes(e));if(r!==void 0)throw n(`guardrails.${r} is not a setting; it takes ${Sn.join(`, `)}`);wn(t?.blockedReply,n)}var Sn=[`quota`,`detect`,`blockedReply`,`network`,`taint`],Cn=[`onBlock`,`maxRetries`];function wn(e,t){if(e===void 0)return;let n=Object.keys(e).find(e=>!Cn.includes(e));if(n!==void 0)throw t(`guardrails.blockedReply.${n} is not a setting; it takes onBlock and maxRetries`);let{onBlock:r,maxRetries:i}=e;if(r!==void 0&&!be.includes(r))throw t(`guardrails.blockedReply.onBlock must be one of ${be.join(`, `)}`);if(i!==void 0&&(!Number.isInteger(i)||i<0))throw t(`guardrails.blockedReply.maxRetries must be a non-negative integer`)}function Tn(e){let t=e.guardrails?.detect,n=e.type===`host`?h(`guardrails.detect`,t,we):h(`guardrails.detect`,t);if(n!==void 0)throw new p(`config`,`Profile ${e.id}: ${n}`)}function Q(e,t){try{let n=Ee(t);if(!Number.isFinite(n.retainForDays))throw new p(`config`,`Profile ${e}: observability.retainForDays must be a finite number`);if(n.rotateAfterMiB<=0||!Number.isFinite(n.rotateAfterMiB))throw new p(`config`,`Profile ${e}: observability.rotateAfterMiB must be a positive number`)}catch(t){if(t instanceof p&&t.message.startsWith(`Profile `))throw t;let n=t instanceof Error?t.message:String(t);throw new p(Te(t),`Profile ${e}: ${n}`,{cause:t})}}function En(e){if(e.type===`host`||e.type===`decision`||e.type===`speech`||e.type===`embedding`)return;let{system:t,systemByRole:n}=e.identity;t!==void 0&&D(t,`Profile ${e.id} identity.system`);for(let[t,r]of Object.entries(n??{}))D(r,`Profile ${e.id} identity.systemByRole.${t}`)}function Dn(e){mn(e);for(let t of[`key`,`fallbackKey`,`protocol`,`provider`])if(t in e)throw new p(`config`,m(`provider.profile_configuration`,{profile:e.id,field:t}));if(vn(e),_n(e),gn(e),hn(e),e.labels&&pe(e.labels,`Profile ${e.id}`),En(e),Tn(e),e.type===`host`)return nn(e);if(e.type===`decision`)return en(e);if(e.type===`embedding`)return Yt(e);an(e.id,e.models),yn(e.id,e),xn(e.id,e.guardrails),e.type===`text`&&bn(e.id,e.outputs?.validation),Q(e.id,e.observability);for(let[t,n]of Object.entries(e.models))sn(e.id,t,n);let t=e.type===`speech`?{handle:e.identity.handle}:{handle:e.identity.handle,system:e.identity.system,systemByRole:e.identity.systemByRole},n=e.guardrails,r=e.observability,i=e.labels,a=ln(e),o;switch(e.type){case`text`:o={type:`text`,id:e.id,identity:t,...a,tools:e.tools,inputs:B(e.inputs),outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i};break;case`image`:o={type:`image`,id:e.id,identity:t,...a,image:e.image,tools:e.tools,inputs:B(e.inputs),outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i},Nn(o.id,o.inputs.attachments?.accept),Mn(o.id,o.image);break;case`speech`:o={type:`speech`,id:e.id,identity:t,...a,speech:e.speech,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i};break;case`live`:o={type:`live`,id:e.id,identity:t,...a,live:e.live,inputs:e.inputs?B(e.inputs):e.inputs,tools:{allow:e.tools.allow,...tn(e.tools.parallel)},turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i},De(o),Fn(o.id,o.live.contextCompression),Pn(o);break;default:throw new p(`config`,`Unknown profile type '${String(e)}'`)}return An(o),On(o),kn(o),o}function On(e){let{maxSteps:t}=e;if(!(t===void 0||Number.isInteger(t)&&t>0))throw new p(`config`,`Profile ${e.id}: maxSteps must be a whole number of 1 or more; leave it out for the default of 20`)}function kn(e){if(e.type===`text`&&e.turnBehaviour?.atStepLimit===`answer`&&e.maxSteps===1)throw new p(`config`,`Profile ${e.id}: turnBehaviour.atStepLimit 'answer' with maxSteps 1 leaves no step that can call a tool`)}function An(e){if(e.type===`live`)return;let t=e.outputs?.structured;if(!t||typeof t==`string`)return;let n=u(e)?.slots?.[t.by];if(!n)throw new p(`config`,`Profile ${e.id}: outputs.structured.by '${t.by}' is not a slot in inputs.slots`);let r=R(n),i=Object.keys(t.map).filter(e=>!r.includes(e));if(i.length)throw new p(`config`,`Profile ${e.id}: outputs.structured.map maps ${i.join(`, `)}, not a choice of slot '${t.by}'`)}var jn={n:{ok:e=>Number.isInteger(e)&&e>=1,rule:`a whole number of 1 or more`},seed:{ok:Number.isInteger,rule:`a whole number`},outputCompression:{ok:e=>Number.isInteger(e)&&e>=0&&e<=100,rule:`a whole number from 0 to 100`}};function Mn(e,t){for(let[n,{ok:r,rule:i}]of Object.entries(jn)){let a=t[n];if(a!==void 0&&!r(a))throw new p(`config`,`Profile ${e}: image.${n} must be ${i}`)}t.references?.forEach((t,n)=>{let r=`Profile ${e}: image.references[${n}]`;if(ce(t.mimeType)!==`image`)throw new p(`config`,`${r} must be an image, not '${t.mimeType}'`);if(!(v(t)?t.uri:t.data))throw new p(`config`,`${r} needs its bytes or its uri`)})}function Nn(e,t){let n=t?.filter(e=>!d(ge,e));if(n?.length)throw new p(`config`,`Profile ${e}: an image profile's attachments take images, video, and PDF only, not ${n.join(`, `)}`)}function Pn(e){let{greeting:t,resumed:n,sessionResumption:r}=e.live,i=`Profile ${e.id} live`;if(t!==void 0&&(typeof t!=`string`||!t.trim()))throw new p(`config`,`${i}.greeting must be a prompt; leave it out to wait`);if(!n)return;if(typeof n.prompt!=`string`||!n.prompt.trim())throw new p(`config`,`${i}.resumed.prompt must be a prompt`);let{afterMs:a}=n;if(a!==void 0&&!(Number.isFinite(a)&&a>=0))throw new p(`config`,`${i}.resumed.afterMs must be 0 or more milliseconds`);if(!r)throw new p(`config`,`${i}.resumed needs live.sessionResumption: without it no call resumes`)}function Fn(e,t){if(!t)return;let n=`Profile ${e} live.contextCompression`,r=t.triggerTokens,i=t.slidingWindow.targetTokens;if(In(`${n}.triggerTokens`,r),In(`${n}.slidingWindow.targetTokens`,i),r!==void 0&&i!==void 0&&i>=r)throw new p(`config`,`${n}: slidingWindow.targetTokens must be below triggerTokens`)}function In(e,t){if(!(t===void 0||Number.isInteger(t)&&t>0))throw new p(`config`,`${e} must be a whole number above 0`)}function Ln(e,t,n,r){let i=`Profile ${t.id} model ${n} compaction`;if(Rn(i,r),zn(i,r),r.meter!=null&&r.meter!==`history`&&r.meter!==`input`)throw new p(`config`,`${i}: meter must be 'history' or 'input'`);if(r.profile===void 0){if(t.type!==`text`||t.inputs.text===!1)throw new p(`config`,`${i}: a profile that compacts itself must be a text profile that takes text`);return}let a=e.get(r.profile);if(!a)throw new p(`config`,`${i}: compaction profile '${r.profile}' must be registered before '${t.id}'`);if(a.type!==`text`||a.inputs.text===!1)throw new p(`config`,`${i}: compaction profile '${r.profile}' must be a text profile that takes text`)}function Rn(e,t){if(t.maxTokens<=0)throw new p(`config`,`${e}: maxTokens must be > 0`);if(t.compactAt<=0||t.compactAt>=1)throw new p(`config`,`${e}: compactAt must be in (0, 1)`)}function zn(e,t){if(t.previousExchanges<0)throw new p(`config`,`${e}: previousExchanges must be >= 0`);if(t.previousExchanges<1&&t.previousExchanges>=t.compactAt)throw new p(`config`,`${e}: previousExchanges as fraction (${t.previousExchanges}) must be < compactAt (${t.compactAt})`);if(t.previousExchanges>1&&!Number.isInteger(t.previousExchanges))throw new p(`config`,`${e}: previousExchanges >= 1 must be an integer`)}function Bn(e,t){for(let n of j(t))if(e.get(n)?.type===`builtin`)throw new p(`config`,t.type===`host`?`Profile ${t.id} lists builtin '${n}' in tools.allow — type 'host' never runs a model`:`Profile ${t.id} lists builtin '${n}' in tools.allow — declare it on models.*.builtInTools instead`)}function Vn(e,t){let n=M(t)?.t2Loader;if(n){if(!j(t).includes(n))throw new p(`config`,`Profile ${t.id} tools.t2Loader '${n}' must also be listed in tools.allow`);if(e.get(n)?.type!==`function`)throw new p(`config`,`Profile ${t.id} tools.t2Loader '${n}' must be a registered type: 'function' tool`)}}function*Hn(e){for(let[t,n]of Object.entries(e.models))for(let e of n.builtInTools??[])yield{modelId:t,id:e}}function Un(e,t){for(let{modelId:n,id:r}of Hn(t))if(e.get(r)?.type!==`builtin`)throw new p(`config`,`Profile ${t.id} model '${n}' lists '${r}' in builtInTools — not a registered builtin`)}function Wn(e){let t=e.type===`text`?e.outputs?.structured:void 0;return t?typeof t==`string`?[t]:[...new Set([...Object.values(t.map),t.fallback])]:[]}function Gn(e,t){let n=Wn(t).map(n=>{let r=e.find(n);if(!r)throw new p(`config`,`Profile ${t.id}: outputs.structured names '${n}', which is not a registered schema; register it before the profile`);return r}),r=t.type===`text`?t.outputs?.validation:void 0,i=Object.keys(r?.fields??{}),a=Object.keys(r?.items??{});if(!i.length&&!a.length)return;if(!n.length)throw new p(`config`,`Profile ${t.id}: outputs.validation checks a structured reply, so it needs outputs.structured`);let o=a.filter(e=>!n.some(t=>wt(t.jsonSchema,e)));if(o.length)throw new p(`config`,`Profile ${t.id}: outputs.validation.items has ${o.join(`, `)}, which no structured schema reaches as a list with an items schema`);let s=i.filter(e=>!n.some(t=>bt(t.jsonSchema,e)));if(s.length)throw new p(`config`,`Profile ${t.id}: outputs.validation.fields has ${s.join(`, `)}, which no structured schema reaches through object properties`)}function Kn(e){let t=u(e)?.context;if(!t)return;let n=Se;if(t.from.length===0||t.from.some(e=>!n.includes(e)))throw new p(`config`,`Profile ${e.id}: inputs.context.from must list ${Se.join(` or `)}`);if(!(Number.isInteger(t.maxChars)&&t.maxChars>0))throw new p(`config`,`Profile ${e.id}: inputs.context.maxChars must be a positive integer`)}function qn(e,t){if(!t)return;let{attachments:n,voice:r,maxFiles:i,maxBytes:a,maxTurnBytes:o,limitsByMime:s}=t,c={maxFiles:i,maxBytes:a,maxTurnBytes:o};if((n||r)&&Object.values(c).some(e=>e===void 0))throw new p(`config`,`Profile ${e} must set maxFiles, maxBytes, and maxTurnBytes`);for(let[e,t]of Object.entries(s??{}))c[`limitsByMime['${e}']`]=t;for(let[t,n]of Object.entries(c))if(n!==void 0&&!(Number.isInteger(n)&&n>0))throw new p(`config`,`Profile ${e}: inputs.${t} must be a positive integer`)}function Jn(e,t,n){let r=new Map,i=i=>{let a=Dn(i),o=n&&a.type!==`host`?{...a,models:Object.fromEntries(Object.entries(a.models).map(([e,t])=>[e,le(n.require(t.provider,t.apiId),t,a.type)]))}:a;if(Bn(e,o),Vn(e,o),o.type!==`host`&&o.type!==`decision`&&o.type!==`embedding`){Un(e,o),qn(o.id,u(o)),Kn(o),Gn(t,o);for(let[e,t]of Object.entries(o.models))t.compaction&&Ln(r,o,e,t.compaction)}r.set(o.id,o)};return{register:i,registerMany(e){for(let t of e)i(t)},get(e){let t=r.get(e);if(!t)throw new p(`config`,`Unknown profile '${e}'`);return t},find:e=>r.get(e),has:e=>r.has(e),list:()=>[...r.values()],clear:()=>r.clear()}}function Yn(e){let t=e?.trim()??``;if(t.startsWith(`AIza`))return`gemini`;if(t.startsWith(`sk-or-`))return`openrouter`}function Xn(e){let t;try{t=new URL(e.baseUrl)}catch{throw new p(`config`,`Enter a valid localhost URL.`)}if(![`http:`,`https:`].includes(t.protocol)||![`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname)||t.username||t.password||t.search||t.hash)throw new p(`config`,`Use a localhost URL without credentials, query parameters or a fragment.`);return{baseUrl:t.href.replace(/\/$/,``),fetch:(e,n)=>new URL(e instanceof Request?e.url:String(e)).origin===t.origin?fetch(e,{...n,redirect:`error`,credentials:`omit`}):Promise.reject(new p(`blocked`,`Local requests must stay on the configured origin.`))}}var Zn=l({data:i(l({id:c().min(1)}))});async function Qn(e,t){let n=Xn(e);if(!n?.fetch)throw new p(`config`,`Enter a local endpoint.`);let r=await n.fetch(`${n.baseUrl}/v1/models`,{signal:t,headers:{Accept:`application/json`}});if(!r.ok)throw new p(`network`,`Local model list returned HTTP ${r.status}.`);let i=Zn.safeParse(await r.json());if(!i.success)throw new p(`request`,`The endpoint returned an invalid model list.`);return[...new Set(i.data.data.map(e=>e.id))]}var $n=`https://openrouter.ai/api/v1/models`,er=`https://openrouter.ai/api/v1/embeddings/models`,tr=[{id:`gemini-embedding-2-preview`,label:`Gemini Embeddings 2 (preview)`},{id:`gemini-embedding-001`,label:`Gemini Embedding 001`}],nr=[{id:`liquid/lfm-2.5-embedding-350m:free`,label:`Liquid LFM 2.5 Embedding 350M (free)`},{id:`nvidia/nemotron-3-embed-1b:free`,label:`NVIDIA Nemotron 3 Embed 1B (free)`},{id:`nvidia/llama-nemotron-embed-vl-1b-v2:free`,label:`NVIDIA Llama Nemotron Embed VL 1B v2 (free)`}],rr={text:`text`,image:`image`,speech:`speech`,live:void 0,embedding:void 0},ir=l({data:i(l({id:c().min(1),name:c().optional(),architecture:l({output_modalities:i(c()).optional()}).optional()}))}),ar=l({data:i(l({id:c().min(1),name:c().optional()}))}),or=l({models:i(l({name:c().min(1),displayName:c().optional(),supportedGenerationMethods:i(c()).optional()})).optional(),nextPageToken:c().optional()}),sr=5;async function $(e,t,n){let r=await fetch(t,{...n,redirect:`error`,credentials:`omit`});if(r.status===400||r.status===401||r.status===403)throw new p(`auth`,`${e} refused the key.`);if(!r.ok)throw new p(`network`,`${e} model list returned HTTP ${r.status}.`);return await r.json()}async function cr(e,t,n,r){let i=n?.trim();if(t===`embedding`&&!i)return[...e===`openrouter`?nr:tr];if(e===`openrouter`)return await lr(t,i,r);if(!i)throw new p(`auth`,`Choose a key to list Gemini models.`);return await dr(t,i,r)}async function lr(e,t,n){let r={signal:n,headers:{Accept:`application/json`,...t?{Authorization:[`Bearer`,t].join(` `)}:{}}};if(e===`embedding`){let e=ar.safeParse(await $(`OpenRouter`,er,r));if(!e.success)throw new p(`bad_response`,`OpenRouter returned an invalid embedding model list.`);return e.data.data.map(e=>({id:e.id,label:e.name??e.id}))}let i=rr[e];if(!i)return[];let a=ir.safeParse(await $(`OpenRouter`,`${$n}?output_modalities=${i}`,r));if(!a.success)throw new p(`bad_response`,`OpenRouter returned an invalid model list.`);return a.data.data.filter(e=>e.architecture?.output_modalities?.includes(i)??!0).map(e=>({id:e.id,label:e.name??e.id}))}var ur={live:`bidiGenerateContent`,embedding:`embedContent`};async function dr(e,t,n){let r=ur[e]??`generateContent`,i=[],a;for(let e=0;e<sr;e++){let e=new URL(te);e.searchParams.set(`pageSize`,`1000`),a&&e.searchParams.set(`pageToken`,a);let o=or.safeParse(await $(`Google`,e.href,{signal:n,headers:{Accept:`application/json`,"x-goog-api-key":t}}));if(!o.success)throw new p(`bad_response`,`Google returned an invalid model list.`);for(let e of o.data.models??[]){if(!e.supportedGenerationMethods?.includes(r))continue;let t=e.name.replace(/^models\//,``);i.push({id:t,label:e.displayName??t})}if(a=o.data.nextPageToken,!a)break}return i}function fr(e){return[...new Set([e.key,e.fallbackKey,...Object.values(e.models??{}).flatMap(e=>[e.keySlot,e.fallbackKeySlot])].filter(e=>!!e))]}function pr(e,t){return Object.fromEntries(e.map(e=>[e,Object.hasOwn(t,e)?t[e]:void 0]))}export{ut as A,et as B,yt as C,J as D,St as E,nt as F,He as G,Ye as H,M as I,w as J,x as K,pt as L,ft as M,lt as N,z as O,j as P,F as R,Ct as S,wt as T,Xe as U,Ze as V,Je as W,_ as X,v as Y,Ge as Z,Ft as _,fr as a,Ht as b,Dn as c,X as d,Gt as f,Bt as g,Pt as h,Xn as i,I as j,R as k,qt as l,Rt as m,Qn as n,pr as o,Tt as p,C as q,cr as r,Jn as s,Yn as t,Kt as u,Vt as v,xt as w,Nt as x,zt as y,O as z};