@anvia/studio 1.0.0-rc.1 → 1.0.0-rc.3

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 +56 -10
  2. package/dist/index.d.ts +176 -116
  3. package/dist/index.js +1408 -1216
  4. package/dist/index.js.map +1 -1
  5. package/dist/ui/assets/ArrowClockwise.es-CSEY3Qr6.js +2 -0
  6. package/dist/ui/assets/{ArrowClockwise.es-yNj_oSyD.js.map → ArrowClockwise.es-CSEY3Qr6.js.map} +1 -1
  7. package/dist/ui/assets/CaretDown.es-BHAPbv1R.js +2 -0
  8. package/dist/ui/assets/CaretDown.es-BHAPbv1R.js.map +1 -0
  9. package/dist/ui/assets/Check.es-BLChmggz.js +2 -0
  10. package/dist/ui/assets/Check.es-BLChmggz.js.map +1 -0
  11. package/dist/ui/assets/Wrench.es-BL6BmNv7.js +4 -0
  12. package/dist/ui/assets/Wrench.es-BL6BmNv7.js.map +1 -0
  13. package/dist/ui/assets/agents-page-DQqt45If.js +2 -0
  14. package/dist/ui/assets/{agents-page-ucKNS0fS.js.map → agents-page-DQqt45If.js.map} +1 -1
  15. package/dist/ui/assets/{badge-RJJoRC4P.js → badge-CcajoiAt.js} +1 -1
  16. package/dist/ui/assets/{badge-RJJoRC4P.js.map → badge-CcajoiAt.js.map} +1 -1
  17. package/dist/ui/assets/button-07gzSO47.js +2 -0
  18. package/dist/ui/assets/button-07gzSO47.js.map +1 -0
  19. package/dist/ui/assets/chunk-D2ECOWN5-fs3ih0yA.js +65 -0
  20. package/dist/ui/assets/chunk-D2ECOWN5-fs3ih0yA.js.map +1 -0
  21. package/dist/ui/assets/dialog-CNNQ3hoF.js +2 -0
  22. package/dist/ui/assets/dialog-CNNQ3hoF.js.map +1 -0
  23. package/dist/ui/assets/dist-CqMdRzwk.js +2 -0
  24. package/dist/ui/assets/dist-CqMdRzwk.js.map +1 -0
  25. package/dist/ui/assets/dist-DWqJwN1i.js +2 -0
  26. package/dist/ui/assets/dist-DWqJwN1i.js.map +1 -0
  27. package/dist/ui/assets/es2015-DsZq7PFO.js +42 -0
  28. package/dist/ui/assets/es2015-DsZq7PFO.js.map +1 -0
  29. package/dist/ui/assets/icon-CqkMSRbt.js +2 -0
  30. package/dist/ui/assets/icon-CqkMSRbt.js.map +1 -0
  31. package/dist/ui/assets/index-BGNC3dLD.css +1 -0
  32. package/dist/ui/assets/index-BLaXiUWO.js +12 -0
  33. package/dist/ui/assets/index-BLaXiUWO.js.map +1 -0
  34. package/dist/ui/assets/{input-BOUv3rgO.js → input-BiI6gsxA.js} +1 -1
  35. package/dist/ui/assets/{input-BOUv3rgO.js.map → input-BiI6gsxA.js.map} +1 -1
  36. package/dist/ui/assets/knowledge-model-S51n2rKh.js +2 -0
  37. package/dist/ui/assets/knowledge-model-S51n2rKh.js.map +1 -0
  38. package/dist/ui/assets/knowledge-page-DzRhA9qQ.js +2 -0
  39. package/dist/ui/assets/{knowledge-page-vwFOGhkh.js.map → knowledge-page-DzRhA9qQ.js.map} +1 -1
  40. package/dist/ui/assets/mcps-page-ZVngljXI.js +2 -0
  41. package/dist/ui/assets/{mcps-page-Bsu_-w7A.js.map → mcps-page-ZVngljXI.js.map} +1 -1
  42. package/dist/ui/assets/{memory-page-DJ_nq7Ip.js → memory-page-DAJk0Zof.js} +4 -4
  43. package/dist/ui/assets/memory-page-DAJk0Zof.js.map +1 -0
  44. package/dist/ui/assets/pipelines-page-8osYA129.js +8 -0
  45. package/dist/ui/assets/pipelines-page-8osYA129.js.map +1 -0
  46. package/dist/ui/assets/{renderers-5kT5HxmZ.js → renderers-BPGo4d2i.js} +3 -3
  47. package/dist/ui/assets/{renderers-5kT5HxmZ.js.map → renderers-BPGo4d2i.js.map} +1 -1
  48. package/dist/ui/assets/request-7oUPS8zY.js +4 -0
  49. package/dist/ui/assets/request-7oUPS8zY.js.map +1 -0
  50. package/dist/ui/assets/rfb-DiW3PDuT.js +6 -0
  51. package/dist/ui/assets/rfb-DiW3PDuT.js.map +1 -0
  52. package/dist/ui/assets/sandboxes-page-C6kokYwc.js +2 -0
  53. package/dist/ui/assets/sandboxes-page-C6kokYwc.js.map +1 -0
  54. package/dist/ui/assets/select-BOYfrfck.js +2 -0
  55. package/dist/ui/assets/select-BOYfrfck.js.map +1 -0
  56. package/dist/ui/assets/sessions-page-ClXzRM9K.js +2 -0
  57. package/dist/ui/assets/{sessions-page-BLGrHrQT.js.map → sessions-page-ClXzRM9K.js.map} +1 -1
  58. package/dist/ui/assets/status-page-DfuQ0fpa.js +2 -0
  59. package/dist/ui/assets/{status-page-D-BUKV_r.js.map → status-page-DfuQ0fpa.js.map} +1 -1
  60. package/dist/ui/assets/studio-CeTsQ4gf.js +2 -0
  61. package/dist/ui/assets/studio-CeTsQ4gf.js.map +1 -0
  62. package/dist/ui/assets/textarea-DESKg_ZK.js +2 -0
  63. package/dist/ui/assets/textarea-DESKg_ZK.js.map +1 -0
  64. package/dist/ui/assets/tool-runner-Cdrcs2v4.js +2 -0
  65. package/dist/ui/assets/{tool-runner-6-N-OOCI.js.map → tool-runner-Cdrcs2v4.js.map} +1 -1
  66. package/dist/ui/assets/tools-page-C865VQmM.js +2 -0
  67. package/dist/ui/assets/{tools-page-BEQJgFX0.js.map → tools-page-C865VQmM.js.map} +1 -1
  68. package/dist/ui/assets/trace-browser-D93H7Xxs.js +10 -0
  69. package/dist/ui/assets/trace-browser-D93H7Xxs.js.map +1 -0
  70. package/dist/ui/assets/transcript-item-BadzBIzE.js +3 -0
  71. package/dist/ui/assets/transcript-item-BadzBIzE.js.map +1 -0
  72. package/dist/ui/assets/with-selector-CRZWaZzC.js +2 -0
  73. package/dist/ui/assets/with-selector-CRZWaZzC.js.map +1 -0
  74. package/dist/ui/index.html +19 -3
  75. package/package.json +16 -11
  76. package/dist/ui/assets/ArrowClockwise.es-yNj_oSyD.js +0 -2
  77. package/dist/ui/assets/agents-page-ucKNS0fS.js +0 -2
  78. package/dist/ui/assets/chunk-ADH7NNCS-DM6fsnDI.js +0 -2
  79. package/dist/ui/assets/chunk-ADH7NNCS-DM6fsnDI.js.map +0 -1
  80. package/dist/ui/assets/index-D-CbFx6c.css +0 -1
  81. package/dist/ui/assets/index-DIV9J1_T.js +0 -56
  82. package/dist/ui/assets/index-DIV9J1_T.js.map +0 -1
  83. package/dist/ui/assets/knowledge-page-vwFOGhkh.js +0 -2
  84. package/dist/ui/assets/mcps-page-Bsu_-w7A.js +0 -2
  85. package/dist/ui/assets/memory-page-DJ_nq7Ip.js.map +0 -1
  86. package/dist/ui/assets/pipelines-page-BsHeSdbO.js +0 -8
  87. package/dist/ui/assets/pipelines-page-BsHeSdbO.js.map +0 -1
  88. package/dist/ui/assets/sandboxes-page-BQuQepXk.js +0 -2
  89. package/dist/ui/assets/sandboxes-page-BQuQepXk.js.map +0 -1
  90. package/dist/ui/assets/sessions-page-BLGrHrQT.js +0 -2
  91. package/dist/ui/assets/status-page-D-BUKV_r.js +0 -2
  92. package/dist/ui/assets/tool-runner-6-N-OOCI.js +0 -2
  93. package/dist/ui/assets/tools-page-BEQJgFX0.js +0 -2
  94. package/dist/ui/assets/trace-browser-DdGcJyNX.js +0 -10
  95. package/dist/ui/assets/trace-browser-DdGcJyNX.js.map +0 -1
  96. package/dist/ui/assets/transcript-item-Bbf77TZa.js +0 -3
  97. package/dist/ui/assets/transcript-item-Bbf77TZa.js.map +0 -1
package/README.md CHANGED
@@ -29,7 +29,7 @@ const client = new OpenAIClient({
29
29
 
30
30
  const agent = new Agent({
31
31
  id: "support",
32
- model: client.completionModel(),
32
+ model: client.completionModel({ modelId: "gpt-5", api: "responses" }),
33
33
  name: "Support",
34
34
  description: "Answers support questions.",
35
35
  instructions: "Answer support questions clearly.",
@@ -61,7 +61,7 @@ const anthropic = new AnthropicClient({ apiKey: process.env.ANTHROPIC_API_KEY })
61
61
 
62
62
  const agent = new Agent({
63
63
  id: "support",
64
- model: openai.completionModel("gpt-5"),
64
+ model: openai.completionModel({ modelId: "gpt-5", api: "responses" }),
65
65
  name: "Support",
66
66
  instructions: "Answer support questions clearly.",
67
67
  });
@@ -72,8 +72,9 @@ new Studio([agent], {
72
72
  {
73
73
  id: "openai",
74
74
  name: "OpenAI",
75
- defaultModel: "gpt-5",
76
- createCompletionModel: (model) => openai.completionModel(model),
75
+ defaultModelId: "gpt-5",
76
+ createCompletionModel: ({ modelId }) =>
77
+ openai.completionModel({ modelId, api: "responses" }),
77
78
  listModels: () => openai.listModels(),
78
79
  models: [
79
80
  {
@@ -85,14 +86,14 @@ new Studio([agent], {
85
86
  {
86
87
  id: "anthropic",
87
88
  name: "Anthropic",
88
- defaultModel: "claude-sonnet-4-20250514",
89
- createCompletionModel: (model) => anthropic.completionModel(model),
89
+ defaultModelId: "claude-sonnet-4-20250514",
90
+ createCompletionModel: ({ modelId }) => anthropic.completionModel({ modelId }),
90
91
  },
91
92
  ],
92
93
  agents: {
93
94
  support: {
94
- default: "openai:gpt-5",
95
- allowed: ["openai:*", "anthropic:claude-sonnet-4-20250514"],
95
+ defaultModelRef: { providerId: "openai", modelId: "gpt-5" },
96
+ allowed: ["openai:*", { providerId: "anthropic", modelId: "claude-sonnet-4-20250514" }],
96
97
  },
97
98
  },
98
99
  },
@@ -104,8 +105,11 @@ also select a model per run:
104
105
 
105
106
  ```json
106
107
  {
107
- "message": "Summarize this ticket",
108
- "model": "anthropic:claude-sonnet-4-20250514",
108
+ "messages": [{ "role": "user", "content": "Summarize this ticket" }],
109
+ "model": {
110
+ "providerId": "anthropic",
111
+ "modelId": "claude-sonnet-4-20250514"
112
+ },
109
113
  "stream": true
110
114
  }
111
115
  ```
@@ -124,6 +128,10 @@ Studio exposes:
124
128
  - Status dashboard for storage adapters, record counts, and enabled capabilities
125
129
  - Knowledge tabs for static context, dynamic context, dynamic tools, and retrieval log
126
130
 
131
+ Studio reads MCP provenance directly from `Agent.mcpServers`. Prefixes configured by an
132
+ `McpClient` remain visible in both the MCP inspector and direct tool runner, while the remote tool
133
+ name stays available on the typed MCP registration.
134
+
127
135
  ## Session Storage
128
136
 
129
137
  Studio uses an in-memory store by default. Sessions, traces, and pipeline run history are available while the process is running, but they do not create local files unless you pass an explicit SQLite store. If you omit the port, Studio uses `RUNNER_PORT` and then falls back to `4021`.
@@ -156,3 +164,41 @@ pnpm --filter @anvia/studio typecheck
156
164
  pnpm --filter @anvia/studio test
157
165
  pnpm --filter @anvia/studio build
158
166
  ```
167
+ ## Browser sandbox views
168
+
169
+ Sandbox registrations may include explicit noVNC views. Studio resolves the upstream only through the
170
+ inspector's loopback-published port and exposes an authorized, same-origin WebSocket bridge. Studio's
171
+ programmatic noVNC client renders the desktop directly, so the stock noVNC splash, toolbar, and password
172
+ prompt are not part of the UI.
173
+
174
+ ```ts
175
+ const studio = new Studio([agent], {
176
+ sandboxes: [
177
+ {
178
+ inspector: browser.inspector({ files: true, ports: true, processes: true }),
179
+ views: [
180
+ {
181
+ id: "desktop",
182
+ label: "Browser",
183
+ source: browser.desktop,
184
+ access: { mode: "local" },
185
+ authentication: { type: "password", password },
186
+ },
187
+ ],
188
+ },
189
+ ],
190
+ });
191
+ ```
192
+
193
+ Local mode requires a loopback connection and a same-origin browser request. Remotely reachable Studio
194
+ instances must instead provide `{ mode: "authorize", authorize }`; the application callback runs for
195
+ the viewer connection, WebSocket upgrade, and every takeover operation. Studio does not provide or infer
196
+ an application authentication system. View credentials are omitted from sandbox discovery metadata and
197
+ URLs and returned only by the authorized, non-cacheable viewer-connection endpoint.
198
+
199
+ When a registered agent emits a matching browser tool call, Playground replaces its Sessions sidebar
200
+ with a larger resizable desktop panel. The embedded desktop remains view-only until the user explicitly
201
+ takes control. That lease blocks Anvia browser tools, is renewed by the UI, and expires when abandoned.
202
+ It is a coordination boundary rather than a replacement for application authorization. The Sandboxes
203
+ page continues to expose the registered view as inspectable runtime metadata. Closing the Playground
204
+ panel restores Sessions without forgetting the current browser; use **Open browser** to show it again.
package/dist/index.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import { Hono } from 'hono';
2
2
  import { AgentObserver, AgentRunStartArgs, AgentRunObserver } from '@anvia/core/observability';
3
- import { AgentResponse, AgentStreamEvent, Agent } from '@anvia/core/agent';
4
- import { Message, JsonObject, JsonValue, CompletionModelCapabilities, ToolResultContent, Usage, CompletionModel, StreamingCompletionModel } from '@anvia/core/completion';
3
+ import { AgentInteractionResponse, AgentResult, AgentSuspendedResult, AgentStreamEvent, Agent } from '@anvia/core/agent';
4
+ import { JsonObject, Message, JsonValue, CompletionModelCapabilities, ToolResultContentPart, Usage, CompletionModel, StreamingCompletionModel } from '@anvia/core/completion';
5
+ import { MemoryStore, MemoryAppendOptions, MemoryErrorOptions, MemoryScope } from '@anvia/core/memory';
5
6
  import { ModelList } from '@anvia/core/model-listing';
6
7
  import { Pipeline, PipelineGraph } from '@anvia/core/pipeline';
7
8
 
8
9
  declare function traceSummary(trace: StudioTrace): StudioTraceSummary;
9
10
 
10
- type StudioCapability = "agents" | "approvals" | "evals" | "memory" | "knowledge" | "mcps" | "observability" | "pipelines" | "sandboxes" | "sessions" | "status" | "tools" | "traces";
11
+ type StudioCapability = "agents" | "interactions" | "evals" | "memory" | "knowledge" | "mcps" | "observability" | "pipelines" | "sandboxes" | "sessions" | "status" | "tools" | "traces";
11
12
  type AgentTraceInfo = {
13
+ observer: string;
12
14
  traceId?: string | undefined;
13
15
  observationId?: string | undefined;
14
16
  };
@@ -16,15 +18,14 @@ type AgentTraceOptions = {
16
18
  name?: string | undefined;
17
19
  userId?: string | undefined;
18
20
  sessionId?: string | undefined;
19
- metadata?: Record<string, unknown> | undefined;
21
+ metadata?: JsonObject | undefined;
20
22
  tags?: string[] | undefined;
21
23
  version?: string | undefined;
22
24
  traceId?: string | undefined;
23
- failOnObserverError?: boolean | undefined;
24
25
  };
25
- type StudioModelRef = string | {
26
- provider: string;
27
- model: string;
26
+ type StudioModelRef = {
27
+ providerId: string;
28
+ modelId: string;
28
29
  };
29
30
  type StudioModelModality = "text" | "image" | "document" | "audio" | "video";
30
31
  type StudioModelModalities = {
@@ -42,19 +43,23 @@ type StudioModelDefinition = {
42
43
  type StudioModelProvider = {
43
44
  id: string;
44
45
  name?: string;
45
- defaultModel?: string;
46
+ defaultModelId?: string;
46
47
  models?: StudioModelDefinition[];
47
- createCompletionModel(model: string): CompletionModel | StreamingCompletionModel;
48
- listModels?: () => Promise<ModelList>;
48
+ createCompletionModel(options: {
49
+ modelId: string;
50
+ }): CompletionModel | StreamingCompletionModel;
51
+ listModels?: (options?: {
52
+ abortSignal?: AbortSignal | undefined;
53
+ }) => Promise<ModelList>;
49
54
  metadata?: JsonObject;
50
55
  };
51
56
  type StudioAgentModelPolicy = {
52
- default?: StudioModelRef;
57
+ defaultModelRef?: StudioModelRef;
53
58
  allowed?: Array<StudioModelRef | `${string}:*`>;
54
59
  };
55
60
  type StudioModelConfig = {
56
61
  providers: StudioModelProvider[];
57
- default?: StudioModelRef;
62
+ defaultModelRef?: StudioModelRef;
58
63
  agents?: Record<string, StudioAgentModelPolicy>;
59
64
  };
60
65
  type StudioModelSummary = StudioModelDefinition & {
@@ -65,23 +70,23 @@ type StudioModelSummary = StudioModelDefinition & {
65
70
  type StudioModelProviderConfig = {
66
71
  id: string;
67
72
  name?: string;
68
- defaultModel?: string;
73
+ defaultModelId?: string;
69
74
  models: StudioModelSummary[];
70
75
  metadata?: JsonObject;
71
76
  warning?: string;
72
77
  };
73
78
  type StudioAgentModelPolicyConfig = {
74
- default?: string;
79
+ defaultModelRef?: string;
75
80
  allowed?: string[];
76
81
  };
77
82
  type StudioModelsConfig = {
78
83
  providers: StudioModelProviderConfig[];
79
- default?: string;
84
+ defaultModelRef?: string;
80
85
  agents: Record<string, StudioAgentModelPolicyConfig>;
81
86
  };
82
87
  type StudioAgentModelsSummary = {
83
88
  agentId: string;
84
- defaultModel?: string;
89
+ defaultModelRef?: string;
85
90
  models: StudioModelSummary[];
86
91
  warnings?: JsonObject[];
87
92
  };
@@ -148,7 +153,7 @@ type StudioEvalSuite<Input = any, _Output = any, _Expected = any> = {
148
153
  metrics: any[];
149
154
  concurrency?: number;
150
155
  reporters?: any[];
151
- failOnReporterError?: boolean;
156
+ reporterErrorPolicy?: "collect" | "throw";
152
157
  id?: string;
153
158
  description?: string;
154
159
  metadata?: JsonObject;
@@ -231,9 +236,128 @@ type StudioAgentToolsSummary = {
231
236
  tools: StudioAgentToolMetadata[];
232
237
  };
233
238
  type StudioSandboxCapabilities = {
234
- files: true;
239
+ files: boolean;
235
240
  ports: boolean;
236
241
  processes: boolean;
242
+ views: boolean;
243
+ };
244
+ type StudioSandboxInspectorFileEntry = Readonly<{
245
+ path: string;
246
+ type: StudioSandboxFileType;
247
+ size?: number;
248
+ }>;
249
+ type StudioSandboxInspectorPort = Readonly<{
250
+ containerPort: number;
251
+ host: string;
252
+ hostPort: number;
253
+ protocol: string;
254
+ }>;
255
+ type StudioSandboxInspectorProcess = Readonly<{
256
+ id: string;
257
+ command: string;
258
+ args: readonly string[];
259
+ cwd?: string;
260
+ status: StudioSandboxProcessStatus;
261
+ exitCode?: number;
262
+ startedAt: string;
263
+ endedAt?: string;
264
+ }>;
265
+ type StudioSandboxInspector = Readonly<{
266
+ id: string;
267
+ provider: string;
268
+ workdir: string;
269
+ listFiles?: (options?: Readonly<{
270
+ path?: string;
271
+ abortSignal?: AbortSignal;
272
+ }>) => Promise<readonly StudioSandboxInspectorFileEntry[]>;
273
+ readFile?: (options: Readonly<{
274
+ path: string;
275
+ abortSignal?: AbortSignal;
276
+ }>) => Promise<Uint8Array>;
277
+ publishedPorts?: readonly StudioSandboxInspectorPort[];
278
+ listProcesses?: (options?: Readonly<{
279
+ abortSignal?: AbortSignal;
280
+ }>) => Promise<readonly StudioSandboxInspectorProcess[]>;
281
+ readProcessLogs?: (options: Readonly<{
282
+ processId: string;
283
+ tailBytes?: number;
284
+ abortSignal?: AbortSignal;
285
+ }>) => Promise<StudioSandboxInspectorProcessLogs>;
286
+ }>;
287
+ type StudioSandboxInspectorProcessLogs = Readonly<{
288
+ stdout: Uint8Array;
289
+ stderr: Uint8Array;
290
+ stdoutTruncated: boolean;
291
+ stderrTruncated: boolean;
292
+ }>;
293
+ type StudioSandboxViewControlSnapshot = Readonly<{
294
+ mode: "agent" | "human";
295
+ ownerId?: string;
296
+ expiresAt?: string;
297
+ }>;
298
+ type StudioSandboxViewControlLease = Readonly<{
299
+ id: string;
300
+ ownerId: string;
301
+ expiresAt: string;
302
+ renew(options: Readonly<{
303
+ leaseTimeoutMs: number;
304
+ }>): StudioSandboxViewControlSnapshot;
305
+ release(): void;
306
+ }>;
307
+ type StudioSandboxViewControl = Readonly<{
308
+ snapshot(): StudioSandboxViewControlSnapshot;
309
+ acquireHumanControl(options: Readonly<{
310
+ ownerId: string;
311
+ leaseTimeoutMs: number;
312
+ abortSignal?: AbortSignal;
313
+ }>): Promise<StudioSandboxViewControlLease>;
314
+ }>;
315
+ type StudioSandboxViewSource = Readonly<{
316
+ protocol: "novnc";
317
+ containerPort: number;
318
+ control: StudioSandboxViewControl;
319
+ }>;
320
+ type StudioSandboxViewAuthorizeArgs = Readonly<{
321
+ request: Request;
322
+ sandboxRef: string;
323
+ viewId: string;
324
+ }>;
325
+ type StudioSandboxViewAccess = Readonly<{
326
+ mode: "local";
327
+ }> | Readonly<{
328
+ mode: "authorize";
329
+ authorize(args: StudioSandboxViewAuthorizeArgs): boolean | Promise<boolean>;
330
+ }>;
331
+ type StudioSandboxViewAuthentication = Readonly<{
332
+ type: "none";
333
+ }> | Readonly<{
334
+ type: "password";
335
+ password: string;
336
+ }>;
337
+ type StudioSandboxViewRegistration = Readonly<{
338
+ id: string;
339
+ label: string;
340
+ source: StudioSandboxViewSource;
341
+ access: StudioSandboxViewAccess;
342
+ authentication: StudioSandboxViewAuthentication;
343
+ }>;
344
+ type StudioSandboxRegistration = Readonly<{
345
+ inspector: StudioSandboxInspector;
346
+ agentIds?: readonly string[];
347
+ toolNames?: readonly string[];
348
+ views?: readonly StudioSandboxViewRegistration[];
349
+ }>;
350
+ type StudioSandboxViewSummary = {
351
+ id: string;
352
+ label: string;
353
+ protocol: "novnc";
354
+ };
355
+ type StudioSandboxViewConnection = {
356
+ sandboxRef: string;
357
+ viewId: string;
358
+ protocol: "novnc";
359
+ websocketPath: string;
360
+ authentication: StudioSandboxViewAuthentication;
237
361
  };
238
362
  type StudioSandboxSummary = {
239
363
  ref: string;
@@ -242,6 +366,7 @@ type StudioSandboxSummary = {
242
366
  workdir: string;
243
367
  agentIds: string[];
244
368
  toolNames: string[];
369
+ views: StudioSandboxViewSummary[];
245
370
  capabilities: StudioSandboxCapabilities;
246
371
  };
247
372
  type StudioSandboxesSummary = {
@@ -353,7 +478,7 @@ type StudioTranscriptToolEntry = {
353
478
  callId?: string;
354
479
  args?: string;
355
480
  result?: string;
356
- structuredResult?: ToolResultContent[];
481
+ structuredResult?: readonly ToolResultContentPart[];
357
482
  childEvents?: StudioTranscriptChildAgentEvent[];
358
483
  approval?: StudioToolApprovalTranscript;
359
484
  question?: StudioToolQuestionTranscript;
@@ -377,7 +502,7 @@ type StudioTranscriptChildAgentEvent = {
377
502
  callId?: string;
378
503
  args?: string;
379
504
  result?: string;
380
- structuredResult?: ToolResultContent[];
505
+ structuredResult?: readonly ToolResultContentPart[];
381
506
  };
382
507
  type StudioTranscriptEntry = StudioTranscriptChatEntry | StudioTranscriptReasoningEntry | StudioTranscriptToolEntry;
383
508
  type StudioSessionSummary = {
@@ -403,7 +528,7 @@ type StudioSessionListOptions = {
403
528
  agentId?: string;
404
529
  limit: number;
405
530
  };
406
- type StudioSessionRunStatus = "running" | "success" | "error" | "cancelled";
531
+ type StudioSessionRunStatus = "running" | "success" | "suspended" | "error" | "cancelled";
407
532
  type StudioSessionRunTranscriptInput = {
408
533
  id: string;
409
534
  runId: string;
@@ -440,29 +565,10 @@ type StudioSessionLogListOptions = {
440
565
  limit: number;
441
566
  after?: number;
442
567
  };
443
- type StudioMemoryContext = {
444
- sessionId: string;
445
- userId?: string | undefined;
446
- metadata?: JsonObject | undefined;
447
- };
448
- type StudioMemoryAppendInput = {
449
- context: StudioMemoryContext;
450
- runId: string;
451
- turn: number;
452
- messages: Message[];
453
- };
454
- type StudioMemoryErrorInput = {
455
- context: StudioMemoryContext;
456
- runId: string;
457
- error: unknown;
458
- messages: Message[];
459
- };
460
- type StudioMemoryStore = {
461
- load(context: StudioMemoryContext): Promise<Message[]>;
462
- append(input: StudioMemoryAppendInput): Promise<void>;
463
- clear(context: StudioMemoryContext): Promise<void>;
464
- recordError?(input: StudioMemoryErrorInput): Promise<void>;
465
- };
568
+ type StudioMemoryScope = MemoryScope;
569
+ type StudioMemoryAppendOptions = MemoryAppendOptions;
570
+ type StudioMemoryErrorOptions = MemoryErrorOptions;
571
+ type StudioMemoryStore = MemoryStore;
466
572
  type StudioSessionStore = StudioMemoryStore & {
467
573
  readonly kind?: string;
468
574
  listSessions(options: StudioSessionListOptions): StudioSessionSummary[] | Promise<StudioSessionSummary[]>;
@@ -474,7 +580,7 @@ type StudioSessionStore = StudioMemoryStore & {
474
580
  listSessionLogs?(options: StudioSessionLogListOptions): StudioSessionLogEntry[] | Promise<StudioSessionLogEntry[]>;
475
581
  deleteSession?(id: string): boolean | Promise<boolean>;
476
582
  };
477
- type StudioTraceStatus = "running" | "success" | "error";
583
+ type StudioTraceStatus = "running" | "success" | "suspended" | "error";
478
584
  type StudioTraceObservationKind = "agent" | "generation" | "tool";
479
585
  type StudioTraceObservation = {
480
586
  id: string;
@@ -547,7 +653,7 @@ type StudioKnowledgeSourceSummary = {
547
653
  count: number;
548
654
  registrationIndex?: number;
549
655
  topK?: number;
550
- threshold?: number;
656
+ minScore?: number;
551
657
  inspectable?: boolean;
552
658
  itemCount?: number;
553
659
  };
@@ -734,6 +840,7 @@ type StudioOptions = {
734
840
  stores?: StudioStores;
735
841
  ui?: boolean | StudioUiOptions;
736
842
  models?: StudioModelConfig;
843
+ sandboxes?: readonly StudioSandboxRegistration[];
737
844
  };
738
845
  type StudioServeOptions = {
739
846
  port?: number;
@@ -745,25 +852,7 @@ type StudioServeLifecycleOptions = Omit<StudioServeOptions, "handleSignals"> & {
745
852
  signal?: AbortSignal;
746
853
  onShutdown?: () => void | Promise<void>;
747
854
  };
748
- type StudioToolApprovalDecision = {
749
- approved: boolean;
750
- reason?: string;
751
- };
752
855
  type StudioToolApprovalStatus = "pending" | "approved" | "rejected" | "timed_out" | "cancelled";
753
- type StudioToolApproval = {
754
- id: string;
755
- runId: string;
756
- agentId: string;
757
- sessionId?: string;
758
- toolName: string;
759
- callId?: string;
760
- internalCallId: string;
761
- args: string;
762
- status: StudioToolApprovalStatus;
763
- requestedAt: string;
764
- resolvedAt?: string;
765
- reason?: string;
766
- };
767
856
  type StudioToolApprovalTranscript = {
768
857
  id: string;
769
858
  status: StudioToolApprovalStatus;
@@ -771,14 +860,6 @@ type StudioToolApprovalTranscript = {
771
860
  resolvedAt?: string;
772
861
  reason?: string;
773
862
  };
774
- type StudioToolApprovalRequestEvent = {
775
- type: "tool_approval_request";
776
- approval: StudioToolApproval;
777
- };
778
- type StudioToolApprovalResultEvent = {
779
- type: "tool_approval_result";
780
- approval: StudioToolApproval;
781
- };
782
863
  type StudioToolQuestionChoice = {
783
864
  label: string;
784
865
  value: string;
@@ -787,6 +868,7 @@ type StudioToolQuestionPrompt = {
787
868
  id: string;
788
869
  question: string;
789
870
  choices: StudioToolQuestionChoice[];
871
+ allowCustom: boolean;
790
872
  };
791
873
  type StudioToolQuestionAnswer = {
792
874
  questionId: string;
@@ -795,22 +877,6 @@ type StudioToolQuestionAnswer = {
795
877
  custom?: boolean;
796
878
  };
797
879
  type StudioToolQuestionStatus = "pending" | "answered" | "cancelled";
798
- type StudioToolQuestion = {
799
- id: string;
800
- runId: string;
801
- agentId: string;
802
- sessionId?: string;
803
- toolName: string;
804
- callId?: string;
805
- internalCallId: string;
806
- args: string;
807
- questions: StudioToolQuestionPrompt[];
808
- status: StudioToolQuestionStatus;
809
- requestedAt: string;
810
- answeredAt?: string;
811
- cancelledAt?: string;
812
- answers?: StudioToolQuestionAnswer[];
813
- };
814
880
  type StudioToolQuestionTranscript = {
815
881
  id: string;
816
882
  status: StudioToolQuestionStatus;
@@ -820,14 +886,6 @@ type StudioToolQuestionTranscript = {
820
886
  questions: StudioToolQuestionPrompt[];
821
887
  answers?: StudioToolQuestionAnswer[];
822
888
  };
823
- type StudioToolQuestionRequestEvent = {
824
- type: "tool_question_request";
825
- question: StudioToolQuestion;
826
- };
827
- type StudioToolQuestionResultEvent = {
828
- type: "tool_question_result";
829
- question: StudioToolQuestion;
830
- };
831
889
  type StudioSessionLogEvent = {
832
890
  type: "session_log";
833
891
  log: StudioSessionLogEntry;
@@ -926,32 +984,33 @@ type StudioPipelineRunResponse = {
926
984
  pipelineId: string;
927
985
  output: JsonValue;
928
986
  };
929
- type AgentRunRequest = {
930
- message: string | Message;
931
- history?: Message[];
932
- sessionId?: string;
987
+ type AgentRunRequestBase = {
933
988
  stream?: boolean;
934
- maxTurns?: number;
935
- toolConcurrency?: number;
936
- model?: StudioModelRef;
937
989
  metadata?: JsonObject;
938
990
  trace?: AgentTraceOptions;
939
991
  };
940
- type AgentRunUIRequest = {
941
- messages: Message[];
992
+ type AgentRunRequest = (AgentRunRequestBase & {
993
+ type: "messages";
994
+ messages: readonly Message[];
942
995
  sessionId?: string;
943
- stream?: boolean;
944
996
  maxTurns?: number;
945
997
  toolConcurrency?: number;
946
998
  model?: StudioModelRef;
947
- metadata?: JsonObject;
948
- trace?: AgentTraceOptions;
949
- };
950
- type AgentRunResponse = AgentResponse;
951
- type AgentRunStreamEvent = Exclude<AgentStreamEvent, {
952
- type: "approval_required";
953
- }> | StudioToolApprovalRequestEvent | StudioToolApprovalResultEvent | StudioToolQuestionRequestEvent | StudioToolQuestionResultEvent | StudioSessionLogEvent | StudioPipelineLogEvent | StudioPipelineFinalEvent;
954
- type StudioErrorCode = "bad_request" | "conflict" | "not_found" | "payload_too_large" | "unsupported_capability" | "internal_error";
999
+ interactionId?: never;
1000
+ response?: never;
1001
+ }) | (AgentRunRequestBase & {
1002
+ type: "interaction_response";
1003
+ interactionId: string;
1004
+ response: AgentInteractionResponse;
1005
+ messages?: never;
1006
+ sessionId?: never;
1007
+ maxTurns?: never;
1008
+ toolConcurrency?: never;
1009
+ model?: never;
1010
+ });
1011
+ type AgentRunResponse = Exclude<AgentResult, AgentSuspendedResult> | Omit<AgentSuspendedResult, "continuation" | "messages">;
1012
+ type AgentRunStreamEvent = AgentStreamEvent | StudioSessionLogEvent | StudioPipelineLogEvent | StudioPipelineFinalEvent;
1013
+ type StudioErrorCode = "bad_request" | "conflict" | "forbidden" | "not_found" | "payload_too_large" | "unsupported_capability" | "internal_error";
955
1014
  type StudioErrorResponse = {
956
1015
  error: {
957
1016
  code: StudioErrorCode;
@@ -981,6 +1040,7 @@ declare class Studio implements AnviaStudio {
981
1040
  private readonly options;
982
1041
  private studio;
983
1042
  private server;
1043
+ private websocketServer;
984
1044
  private sigintHandler;
985
1045
  constructor(targets?: StudioTarget[], options?: StudioOptions);
986
1046
  get app(): Hono;
@@ -1000,4 +1060,4 @@ declare function createSqliteSessionStore(options?: SqliteSessionStoreOptions):
1000
1060
 
1001
1061
  declare function createInMemoryStudioStore(): StudioSessionStore & StudioTraceStore & StudioPipelineLogStore & StudioPipelineRunStore;
1002
1062
 
1003
- export { type AgentRunRequest, type AgentRunResponse, type AgentRunStreamEvent, type AgentRunUIRequest, type AgentTraceInfo, type AgentTraceOptions, type AnviaStudio, type SqliteSessionStoreOptions, Studio, type StudioAgent, type StudioAgentConfig, type StudioAgentKnowledgeConfig, type StudioAgentMcpServerMetadata, type StudioAgentMcpToolMetadata, type StudioAgentMcpsSummary, type StudioAgentModelPolicy, type StudioAgentModelPolicyConfig, type StudioAgentModelsSummary, type StudioAgentRuntimeSummary, type StudioAgentToolApprovalMetadata, type StudioAgentToolMetadata, type StudioAgentToolSource, type StudioAgentToolsSummary, type StudioCapability, type StudioCapabilityConfig, type StudioConfig, type StudioErrorCode, type StudioErrorResponse, type StudioEvalCasePreview, type StudioEvalMetricSummary, type StudioEvalRunRequest, type StudioEvalRunResponse, type StudioEvalSuite, type StudioEvalSuiteConfig, type StudioKnowledgeEvidence, type StudioKnowledgeEvidenceDocument, type StudioKnowledgeItem, type StudioKnowledgeItemKind, type StudioKnowledgeItemsPage, type StudioKnowledgeSourceKind, type StudioKnowledgeSourceSummary, type StudioKnowledgeSummary, type StudioMemoryAppendInput, type StudioMemoryContext, type StudioMemoryConversationMessages, type StudioMemoryConversationSteps, type StudioMemoryConversationSummary, type StudioMemoryConversationsPage, type StudioMemoryErrorInput, type StudioMemoryMessageRecord, type StudioMemorySourceConversationMessages, type StudioMemorySourceConversationSteps, type StudioMemorySourceConversationSummary, type StudioMemorySourceConversationsPage, type StudioMemorySourceKind, type StudioMemorySourceSummary, type StudioMemorySourceUsersPage, type StudioMemorySourcesPage, type StudioMemoryStore, type StudioMemoryUserSummary, type StudioMemoryUsersPage, type StudioModelConfig, type StudioModelDefinition, type StudioModelModalities, type StudioModelModality, type StudioModelProvider, type StudioModelProviderConfig, type StudioModelRef, type StudioModelSummary, type StudioModelsConfig, type StudioObservabilityEvent, type StudioObservabilityEventType, type StudioOptions, type StudioPipeline, type StudioPipelineConfig, type StudioPipelineDetail, type StudioPipelineFinalEvent, type StudioPipelineLogAppendInput, type StudioPipelineLogCategory, type StudioPipelineLogEntry, type StudioPipelineLogEvent, type StudioPipelineLogLevel, type StudioPipelineLogListOptions, type StudioPipelineLogStore, type StudioPipelineReplayRequest, type StudioPipelineRunGetOptions, type StudioPipelineRunListOptions, type StudioPipelineRunRecord, type StudioPipelineRunRequest, type StudioPipelineRunResponse, type StudioPipelineRunSaveInput, type StudioPipelineRunStatus, type StudioPipelineRunStore, type StudioSandboxCapabilities, type StudioSandboxFileEntry, type StudioSandboxFileType, type StudioSandboxFilesResponse, type StudioSandboxPort, type StudioSandboxPortsResponse, type StudioSandboxProcess, type StudioSandboxProcessLogsResponse, type StudioSandboxProcessStatus, type StudioSandboxProcessesResponse, type StudioSandboxSummary, type StudioSandboxesSummary, type StudioServeLifecycleOptions, type StudioServeOptions, type StudioSession, type StudioSessionCreateInput, type StudioSessionListOptions, type StudioSessionLogAppendInput, type StudioSessionLogCategory, type StudioSessionLogEntry, type StudioSessionLogEvent, type StudioSessionLogLevel, type StudioSessionLogListOptions, type StudioSessionRunStatus, type StudioSessionRunTranscriptInput, type StudioSessionStore, type StudioSessionSummary, type StudioSessionTraceListOptions, type StudioStaticKnowledgeDocument, type StudioStatusSummary, type StudioStores, type StudioTarget, type StudioToolApproval, type StudioToolApprovalDecision, type StudioToolApprovalRequestEvent, type StudioToolApprovalResultEvent, type StudioToolApprovalStatus, type StudioToolApprovalTranscript, type StudioToolQuestion, type StudioToolQuestionAnswer, type StudioToolQuestionChoice, type StudioToolQuestionPrompt, type StudioToolQuestionRequestEvent, type StudioToolQuestionResultEvent, type StudioToolQuestionStatus, type StudioToolQuestionTranscript, type StudioToolRunRequest, type StudioToolRunResponse, type StudioTrace, type StudioTraceListOptions, type StudioTraceObservation, type StudioTraceObservationKind, StudioTraceObserver, type StudioTraceObserverOptions, type StudioTraceStatus, type StudioTraceStore, type StudioTraceSummary, type StudioTranscriptAttachment, type StudioTranscriptChatEntry, type StudioTranscriptChildAgentEvent, type StudioTranscriptEntry, type StudioTranscriptReasoningEntry, type StudioTranscriptToolEntry, type StudioUiOptions, createInMemoryStudioStore, createSqliteSessionStore, traceSummary };
1063
+ export { type AgentRunRequest, type AgentRunResponse, type AgentRunStreamEvent, type AgentTraceInfo, type AgentTraceOptions, type AnviaStudio, type SqliteSessionStoreOptions, Studio, type StudioAgent, type StudioAgentConfig, type StudioAgentKnowledgeConfig, type StudioAgentMcpServerMetadata, type StudioAgentMcpToolMetadata, type StudioAgentMcpsSummary, type StudioAgentModelPolicy, type StudioAgentModelPolicyConfig, type StudioAgentModelsSummary, type StudioAgentRuntimeSummary, type StudioAgentToolApprovalMetadata, type StudioAgentToolMetadata, type StudioAgentToolSource, type StudioAgentToolsSummary, type StudioCapability, type StudioCapabilityConfig, type StudioConfig, type StudioErrorCode, type StudioErrorResponse, type StudioEvalCasePreview, type StudioEvalMetricSummary, type StudioEvalRunRequest, type StudioEvalRunResponse, type StudioEvalSuite, type StudioEvalSuiteConfig, type StudioKnowledgeEvidence, type StudioKnowledgeEvidenceDocument, type StudioKnowledgeItem, type StudioKnowledgeItemKind, type StudioKnowledgeItemsPage, type StudioKnowledgeSourceKind, type StudioKnowledgeSourceSummary, type StudioKnowledgeSummary, type StudioMemoryAppendOptions, type StudioMemoryConversationMessages, type StudioMemoryConversationSteps, type StudioMemoryConversationSummary, type StudioMemoryConversationsPage, type StudioMemoryErrorOptions, type StudioMemoryMessageRecord, type StudioMemoryScope, type StudioMemorySourceConversationMessages, type StudioMemorySourceConversationSteps, type StudioMemorySourceConversationSummary, type StudioMemorySourceConversationsPage, type StudioMemorySourceKind, type StudioMemorySourceSummary, type StudioMemorySourceUsersPage, type StudioMemorySourcesPage, type StudioMemoryStore, type StudioMemoryUserSummary, type StudioMemoryUsersPage, type StudioModelConfig, type StudioModelDefinition, type StudioModelModalities, type StudioModelModality, type StudioModelProvider, type StudioModelProviderConfig, type StudioModelRef, type StudioModelSummary, type StudioModelsConfig, type StudioObservabilityEvent, type StudioObservabilityEventType, type StudioOptions, type StudioPipeline, type StudioPipelineConfig, type StudioPipelineDetail, type StudioPipelineFinalEvent, type StudioPipelineLogAppendInput, type StudioPipelineLogCategory, type StudioPipelineLogEntry, type StudioPipelineLogEvent, type StudioPipelineLogLevel, type StudioPipelineLogListOptions, type StudioPipelineLogStore, type StudioPipelineReplayRequest, type StudioPipelineRunGetOptions, type StudioPipelineRunListOptions, type StudioPipelineRunRecord, type StudioPipelineRunRequest, type StudioPipelineRunResponse, type StudioPipelineRunSaveInput, type StudioPipelineRunStatus, type StudioPipelineRunStore, type StudioSandboxCapabilities, type StudioSandboxFileEntry, type StudioSandboxFileType, type StudioSandboxFilesResponse, type StudioSandboxInspector, type StudioSandboxInspectorFileEntry, type StudioSandboxInspectorPort, type StudioSandboxInspectorProcess, type StudioSandboxInspectorProcessLogs, type StudioSandboxPort, type StudioSandboxPortsResponse, type StudioSandboxProcess, type StudioSandboxProcessLogsResponse, type StudioSandboxProcessStatus, type StudioSandboxProcessesResponse, type StudioSandboxRegistration, type StudioSandboxSummary, type StudioSandboxViewAccess, type StudioSandboxViewAuthentication, type StudioSandboxViewAuthorizeArgs, type StudioSandboxViewConnection, type StudioSandboxViewControl, type StudioSandboxViewControlLease, type StudioSandboxViewControlSnapshot, type StudioSandboxViewRegistration, type StudioSandboxViewSource, type StudioSandboxViewSummary, type StudioSandboxesSummary, type StudioServeLifecycleOptions, type StudioServeOptions, type StudioSession, type StudioSessionCreateInput, type StudioSessionListOptions, type StudioSessionLogAppendInput, type StudioSessionLogCategory, type StudioSessionLogEntry, type StudioSessionLogEvent, type StudioSessionLogLevel, type StudioSessionLogListOptions, type StudioSessionRunStatus, type StudioSessionRunTranscriptInput, type StudioSessionStore, type StudioSessionSummary, type StudioSessionTraceListOptions, type StudioStaticKnowledgeDocument, type StudioStatusSummary, type StudioStores, type StudioTarget, type StudioToolApprovalStatus, type StudioToolApprovalTranscript, type StudioToolQuestionAnswer, type StudioToolQuestionChoice, type StudioToolQuestionPrompt, type StudioToolQuestionStatus, type StudioToolQuestionTranscript, type StudioToolRunRequest, type StudioToolRunResponse, type StudioTrace, type StudioTraceListOptions, type StudioTraceObservation, type StudioTraceObservationKind, StudioTraceObserver, type StudioTraceObserverOptions, type StudioTraceStatus, type StudioTraceStore, type StudioTraceSummary, type StudioTranscriptAttachment, type StudioTranscriptChatEntry, type StudioTranscriptChildAgentEvent, type StudioTranscriptEntry, type StudioTranscriptReasoningEntry, type StudioTranscriptToolEntry, type StudioUiOptions, createInMemoryStudioStore, createSqliteSessionStore, traceSummary };