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

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 (98) hide show
  1. package/README.md +56 -10
  2. package/dist/index.d.ts +177 -116
  3. package/dist/index.js +1418 -1219
  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-QGX73TSQ-D9QAGlAY.js +65 -0
  20. package/dist/ui/assets/chunk-QGX73TSQ-D9QAGlAY.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-BtvoCaW7.js +12 -0
  32. package/dist/ui/assets/index-BtvoCaW7.js.map +1 -0
  33. package/dist/ui/assets/index-CFbK-pX6.css +2 -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-DZeLh92t.js +2 -0
  39. package/dist/ui/assets/{knowledge-page-vwFOGhkh.js.map → knowledge-page-DZeLh92t.js.map} +1 -1
  40. package/dist/ui/assets/mcps-page-CDPMO2x9.js +2 -0
  41. package/dist/ui/assets/{mcps-page-Bsu_-w7A.js.map → mcps-page-CDPMO2x9.js.map} +1 -1
  42. package/dist/ui/assets/memory-page-D3UhjpTb.js +4 -0
  43. package/dist/ui/assets/memory-page-D3UhjpTb.js.map +1 -0
  44. package/dist/ui/assets/pipelines-page-BP8R6NI7.js +8 -0
  45. package/dist/ui/assets/pipelines-page-BP8R6NI7.js.map +1 -0
  46. package/dist/ui/assets/{renderers-5kT5HxmZ.js → renderers-DHMEAblV.js} +3 -3
  47. package/dist/ui/assets/{renderers-5kT5HxmZ.js.map → renderers-DHMEAblV.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-eA8uRLZQ.js +2 -0
  59. package/dist/ui/assets/{status-page-D-BUKV_r.js.map → status-page-eA8uRLZQ.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-D3-SlGqQ.js +2 -0
  65. package/dist/ui/assets/{tool-runner-6-N-OOCI.js.map → tool-runner-D3-SlGqQ.js.map} +1 -1
  66. package/dist/ui/assets/tools-page-D3gnQf1_.js +2 -0
  67. package/dist/ui/assets/{tools-page-BEQJgFX0.js.map → tools-page-D3gnQf1_.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-BmjdZLbS.js +3 -0
  71. package/dist/ui/assets/transcript-item-BmjdZLbS.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 +0 -4
  86. package/dist/ui/assets/memory-page-DJ_nq7Ip.js.map +0 -1
  87. package/dist/ui/assets/pipelines-page-BsHeSdbO.js +0 -8
  88. package/dist/ui/assets/pipelines-page-BsHeSdbO.js.map +0 -1
  89. package/dist/ui/assets/sandboxes-page-BQuQepXk.js +0 -2
  90. package/dist/ui/assets/sandboxes-page-BQuQepXk.js.map +0 -1
  91. package/dist/ui/assets/sessions-page-BLGrHrQT.js +0 -2
  92. package/dist/ui/assets/status-page-D-BUKV_r.js +0 -2
  93. package/dist/ui/assets/tool-runner-6-N-OOCI.js +0 -2
  94. package/dist/ui/assets/tools-page-BEQJgFX0.js +0 -2
  95. package/dist/ui/assets/trace-browser-DdGcJyNX.js +0 -10
  96. package/dist/ui/assets/trace-browser-DdGcJyNX.js.map +0 -1
  97. package/dist/ui/assets/transcript-item-Bbf77TZa.js +0 -3
  98. 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,17 @@
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 { AgentOutcome, AgentInteractionOutcome, AgentStreamEvent, Agent } from '@anvia/core/agent';
4
+ import { AgentInteractionResponse } from '@anvia/core/agent/interactions';
5
+ import { JsonObject, Message, JsonValue, CompletionModelCapabilities, ToolResultContentPart, Usage, CompletionModel, StreamingCompletionModel } from '@anvia/core/completion';
6
+ import { MemoryStore, MemoryAppendOptions, MemoryErrorOptions, MemoryScope } from '@anvia/core/memory';
5
7
  import { ModelList } from '@anvia/core/model-listing';
6
8
  import { Pipeline, PipelineGraph } from '@anvia/core/pipeline';
7
9
 
8
10
  declare function traceSummary(trace: StudioTrace): StudioTraceSummary;
9
11
 
10
- type StudioCapability = "agents" | "approvals" | "evals" | "memory" | "knowledge" | "mcps" | "observability" | "pipelines" | "sandboxes" | "sessions" | "status" | "tools" | "traces";
12
+ type StudioCapability = "agents" | "interactions" | "evals" | "memory" | "knowledge" | "mcps" | "observability" | "pipelines" | "sandboxes" | "sessions" | "status" | "tools" | "traces";
11
13
  type AgentTraceInfo = {
14
+ observer: string;
12
15
  traceId?: string | undefined;
13
16
  observationId?: string | undefined;
14
17
  };
@@ -16,15 +19,14 @@ type AgentTraceOptions = {
16
19
  name?: string | undefined;
17
20
  userId?: string | undefined;
18
21
  sessionId?: string | undefined;
19
- metadata?: Record<string, unknown> | undefined;
22
+ metadata?: JsonObject | undefined;
20
23
  tags?: string[] | undefined;
21
24
  version?: string | undefined;
22
25
  traceId?: string | undefined;
23
- failOnObserverError?: boolean | undefined;
24
26
  };
25
- type StudioModelRef = string | {
26
- provider: string;
27
- model: string;
27
+ type StudioModelRef = {
28
+ providerId: string;
29
+ modelId: string;
28
30
  };
29
31
  type StudioModelModality = "text" | "image" | "document" | "audio" | "video";
30
32
  type StudioModelModalities = {
@@ -42,19 +44,23 @@ type StudioModelDefinition = {
42
44
  type StudioModelProvider = {
43
45
  id: string;
44
46
  name?: string;
45
- defaultModel?: string;
47
+ defaultModelId?: string;
46
48
  models?: StudioModelDefinition[];
47
- createCompletionModel(model: string): CompletionModel | StreamingCompletionModel;
48
- listModels?: () => Promise<ModelList>;
49
+ createCompletionModel(options: {
50
+ modelId: string;
51
+ }): CompletionModel | StreamingCompletionModel;
52
+ listModels?: (options?: {
53
+ abortSignal?: AbortSignal | undefined;
54
+ }) => Promise<ModelList>;
49
55
  metadata?: JsonObject;
50
56
  };
51
57
  type StudioAgentModelPolicy = {
52
- default?: StudioModelRef;
58
+ defaultModelRef?: StudioModelRef;
53
59
  allowed?: Array<StudioModelRef | `${string}:*`>;
54
60
  };
55
61
  type StudioModelConfig = {
56
62
  providers: StudioModelProvider[];
57
- default?: StudioModelRef;
63
+ defaultModelRef?: StudioModelRef;
58
64
  agents?: Record<string, StudioAgentModelPolicy>;
59
65
  };
60
66
  type StudioModelSummary = StudioModelDefinition & {
@@ -65,23 +71,23 @@ type StudioModelSummary = StudioModelDefinition & {
65
71
  type StudioModelProviderConfig = {
66
72
  id: string;
67
73
  name?: string;
68
- defaultModel?: string;
74
+ defaultModelId?: string;
69
75
  models: StudioModelSummary[];
70
76
  metadata?: JsonObject;
71
77
  warning?: string;
72
78
  };
73
79
  type StudioAgentModelPolicyConfig = {
74
- default?: string;
80
+ defaultModelRef?: string;
75
81
  allowed?: string[];
76
82
  };
77
83
  type StudioModelsConfig = {
78
84
  providers: StudioModelProviderConfig[];
79
- default?: string;
85
+ defaultModelRef?: string;
80
86
  agents: Record<string, StudioAgentModelPolicyConfig>;
81
87
  };
82
88
  type StudioAgentModelsSummary = {
83
89
  agentId: string;
84
- defaultModel?: string;
90
+ defaultModelRef?: string;
85
91
  models: StudioModelSummary[];
86
92
  warnings?: JsonObject[];
87
93
  };
@@ -148,7 +154,7 @@ type StudioEvalSuite<Input = any, _Output = any, _Expected = any> = {
148
154
  metrics: any[];
149
155
  concurrency?: number;
150
156
  reporters?: any[];
151
- failOnReporterError?: boolean;
157
+ reporterErrorPolicy?: "collect" | "throw";
152
158
  id?: string;
153
159
  description?: string;
154
160
  metadata?: JsonObject;
@@ -231,9 +237,128 @@ type StudioAgentToolsSummary = {
231
237
  tools: StudioAgentToolMetadata[];
232
238
  };
233
239
  type StudioSandboxCapabilities = {
234
- files: true;
240
+ files: boolean;
235
241
  ports: boolean;
236
242
  processes: boolean;
243
+ views: boolean;
244
+ };
245
+ type StudioSandboxInspectorFileEntry = Readonly<{
246
+ path: string;
247
+ type: StudioSandboxFileType;
248
+ size?: number;
249
+ }>;
250
+ type StudioSandboxInspectorPort = Readonly<{
251
+ containerPort: number;
252
+ host: string;
253
+ hostPort: number;
254
+ protocol: string;
255
+ }>;
256
+ type StudioSandboxInspectorProcess = Readonly<{
257
+ id: string;
258
+ command: string;
259
+ args: readonly string[];
260
+ cwd?: string;
261
+ status: StudioSandboxProcessStatus;
262
+ exitCode?: number;
263
+ startedAt: string;
264
+ endedAt?: string;
265
+ }>;
266
+ type StudioSandboxInspector = Readonly<{
267
+ id: string;
268
+ provider: string;
269
+ workdir: string;
270
+ listFiles?: (options?: Readonly<{
271
+ path?: string;
272
+ abortSignal?: AbortSignal;
273
+ }>) => Promise<readonly StudioSandboxInspectorFileEntry[]>;
274
+ readFile?: (options: Readonly<{
275
+ path: string;
276
+ abortSignal?: AbortSignal;
277
+ }>) => Promise<Uint8Array>;
278
+ publishedPorts?: readonly StudioSandboxInspectorPort[];
279
+ listProcesses?: (options?: Readonly<{
280
+ abortSignal?: AbortSignal;
281
+ }>) => Promise<readonly StudioSandboxInspectorProcess[]>;
282
+ readProcessLogs?: (options: Readonly<{
283
+ processId: string;
284
+ tailBytes?: number;
285
+ abortSignal?: AbortSignal;
286
+ }>) => Promise<StudioSandboxInspectorProcessLogs>;
287
+ }>;
288
+ type StudioSandboxInspectorProcessLogs = Readonly<{
289
+ stdout: Uint8Array;
290
+ stderr: Uint8Array;
291
+ stdoutTruncated: boolean;
292
+ stderrTruncated: boolean;
293
+ }>;
294
+ type StudioSandboxViewControlSnapshot = Readonly<{
295
+ mode: "agent" | "human";
296
+ ownerId?: string;
297
+ expiresAt?: string;
298
+ }>;
299
+ type StudioSandboxViewControlLease = Readonly<{
300
+ id: string;
301
+ ownerId: string;
302
+ expiresAt: string;
303
+ renew(options: Readonly<{
304
+ leaseTimeoutMs: number;
305
+ }>): StudioSandboxViewControlSnapshot;
306
+ release(): void;
307
+ }>;
308
+ type StudioSandboxViewControl = Readonly<{
309
+ snapshot(): StudioSandboxViewControlSnapshot;
310
+ acquireHumanControl(options: Readonly<{
311
+ ownerId: string;
312
+ leaseTimeoutMs: number;
313
+ abortSignal?: AbortSignal;
314
+ }>): Promise<StudioSandboxViewControlLease>;
315
+ }>;
316
+ type StudioSandboxViewSource = Readonly<{
317
+ protocol: "novnc";
318
+ containerPort: number;
319
+ control: StudioSandboxViewControl;
320
+ }>;
321
+ type StudioSandboxViewAuthorizeArgs = Readonly<{
322
+ request: Request;
323
+ sandboxRef: string;
324
+ viewId: string;
325
+ }>;
326
+ type StudioSandboxViewAccess = Readonly<{
327
+ mode: "local";
328
+ }> | Readonly<{
329
+ mode: "authorize";
330
+ authorize(args: StudioSandboxViewAuthorizeArgs): boolean | Promise<boolean>;
331
+ }>;
332
+ type StudioSandboxViewAuthentication = Readonly<{
333
+ type: "none";
334
+ }> | Readonly<{
335
+ type: "password";
336
+ password: string;
337
+ }>;
338
+ type StudioSandboxViewRegistration = Readonly<{
339
+ id: string;
340
+ label: string;
341
+ source: StudioSandboxViewSource;
342
+ access: StudioSandboxViewAccess;
343
+ authentication: StudioSandboxViewAuthentication;
344
+ }>;
345
+ type StudioSandboxRegistration = Readonly<{
346
+ inspector: StudioSandboxInspector;
347
+ agentIds?: readonly string[];
348
+ toolNames?: readonly string[];
349
+ views?: readonly StudioSandboxViewRegistration[];
350
+ }>;
351
+ type StudioSandboxViewSummary = {
352
+ id: string;
353
+ label: string;
354
+ protocol: "novnc";
355
+ };
356
+ type StudioSandboxViewConnection = {
357
+ sandboxRef: string;
358
+ viewId: string;
359
+ protocol: "novnc";
360
+ websocketPath: string;
361
+ authentication: StudioSandboxViewAuthentication;
237
362
  };
238
363
  type StudioSandboxSummary = {
239
364
  ref: string;
@@ -242,6 +367,7 @@ type StudioSandboxSummary = {
242
367
  workdir: string;
243
368
  agentIds: string[];
244
369
  toolNames: string[];
370
+ views: StudioSandboxViewSummary[];
245
371
  capabilities: StudioSandboxCapabilities;
246
372
  };
247
373
  type StudioSandboxesSummary = {
@@ -353,7 +479,7 @@ type StudioTranscriptToolEntry = {
353
479
  callId?: string;
354
480
  args?: string;
355
481
  result?: string;
356
- structuredResult?: ToolResultContent[];
482
+ structuredResult?: readonly ToolResultContentPart[];
357
483
  childEvents?: StudioTranscriptChildAgentEvent[];
358
484
  approval?: StudioToolApprovalTranscript;
359
485
  question?: StudioToolQuestionTranscript;
@@ -377,7 +503,7 @@ type StudioTranscriptChildAgentEvent = {
377
503
  callId?: string;
378
504
  args?: string;
379
505
  result?: string;
380
- structuredResult?: ToolResultContent[];
506
+ structuredResult?: readonly ToolResultContentPart[];
381
507
  };
382
508
  type StudioTranscriptEntry = StudioTranscriptChatEntry | StudioTranscriptReasoningEntry | StudioTranscriptToolEntry;
383
509
  type StudioSessionSummary = {
@@ -403,7 +529,7 @@ type StudioSessionListOptions = {
403
529
  agentId?: string;
404
530
  limit: number;
405
531
  };
406
- type StudioSessionRunStatus = "running" | "success" | "error" | "cancelled";
532
+ type StudioSessionRunStatus = "running" | "success" | "suspended" | "error" | "cancelled";
407
533
  type StudioSessionRunTranscriptInput = {
408
534
  id: string;
409
535
  runId: string;
@@ -440,29 +566,10 @@ type StudioSessionLogListOptions = {
440
566
  limit: number;
441
567
  after?: number;
442
568
  };
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
- };
569
+ type StudioMemoryScope = MemoryScope;
570
+ type StudioMemoryAppendOptions = MemoryAppendOptions;
571
+ type StudioMemoryErrorOptions = MemoryErrorOptions;
572
+ type StudioMemoryStore = MemoryStore;
466
573
  type StudioSessionStore = StudioMemoryStore & {
467
574
  readonly kind?: string;
468
575
  listSessions(options: StudioSessionListOptions): StudioSessionSummary[] | Promise<StudioSessionSummary[]>;
@@ -474,7 +581,7 @@ type StudioSessionStore = StudioMemoryStore & {
474
581
  listSessionLogs?(options: StudioSessionLogListOptions): StudioSessionLogEntry[] | Promise<StudioSessionLogEntry[]>;
475
582
  deleteSession?(id: string): boolean | Promise<boolean>;
476
583
  };
477
- type StudioTraceStatus = "running" | "success" | "error";
584
+ type StudioTraceStatus = "running" | "success" | "suspended" | "error";
478
585
  type StudioTraceObservationKind = "agent" | "generation" | "tool";
479
586
  type StudioTraceObservation = {
480
587
  id: string;
@@ -547,7 +654,7 @@ type StudioKnowledgeSourceSummary = {
547
654
  count: number;
548
655
  registrationIndex?: number;
549
656
  topK?: number;
550
- threshold?: number;
657
+ minScore?: number;
551
658
  inspectable?: boolean;
552
659
  itemCount?: number;
553
660
  };
@@ -734,6 +841,7 @@ type StudioOptions = {
734
841
  stores?: StudioStores;
735
842
  ui?: boolean | StudioUiOptions;
736
843
  models?: StudioModelConfig;
844
+ sandboxes?: readonly StudioSandboxRegistration[];
737
845
  };
738
846
  type StudioServeOptions = {
739
847
  port?: number;
@@ -745,25 +853,7 @@ type StudioServeLifecycleOptions = Omit<StudioServeOptions, "handleSignals"> & {
745
853
  signal?: AbortSignal;
746
854
  onShutdown?: () => void | Promise<void>;
747
855
  };
748
- type StudioToolApprovalDecision = {
749
- approved: boolean;
750
- reason?: string;
751
- };
752
856
  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
857
  type StudioToolApprovalTranscript = {
768
858
  id: string;
769
859
  status: StudioToolApprovalStatus;
@@ -771,14 +861,6 @@ type StudioToolApprovalTranscript = {
771
861
  resolvedAt?: string;
772
862
  reason?: string;
773
863
  };
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
864
  type StudioToolQuestionChoice = {
783
865
  label: string;
784
866
  value: string;
@@ -787,6 +869,7 @@ type StudioToolQuestionPrompt = {
787
869
  id: string;
788
870
  question: string;
789
871
  choices: StudioToolQuestionChoice[];
872
+ allowCustom: boolean;
790
873
  };
791
874
  type StudioToolQuestionAnswer = {
792
875
  questionId: string;
@@ -795,22 +878,6 @@ type StudioToolQuestionAnswer = {
795
878
  custom?: boolean;
796
879
  };
797
880
  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
881
  type StudioToolQuestionTranscript = {
815
882
  id: string;
816
883
  status: StudioToolQuestionStatus;
@@ -820,14 +887,6 @@ type StudioToolQuestionTranscript = {
820
887
  questions: StudioToolQuestionPrompt[];
821
888
  answers?: StudioToolQuestionAnswer[];
822
889
  };
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
890
  type StudioSessionLogEvent = {
832
891
  type: "session_log";
833
892
  log: StudioSessionLogEntry;
@@ -926,32 +985,33 @@ type StudioPipelineRunResponse = {
926
985
  pipelineId: string;
927
986
  output: JsonValue;
928
987
  };
929
- type AgentRunRequest = {
930
- message: string | Message;
931
- history?: Message[];
932
- sessionId?: string;
988
+ type AgentRunRequestBase = {
933
989
  stream?: boolean;
934
- maxTurns?: number;
935
- toolConcurrency?: number;
936
- model?: StudioModelRef;
937
990
  metadata?: JsonObject;
938
991
  trace?: AgentTraceOptions;
939
992
  };
940
- type AgentRunUIRequest = {
941
- messages: Message[];
993
+ type AgentRunRequest = (AgentRunRequestBase & {
994
+ type: "messages";
995
+ messages: readonly Message[];
942
996
  sessionId?: string;
943
- stream?: boolean;
944
997
  maxTurns?: number;
945
998
  toolConcurrency?: number;
946
999
  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";
1000
+ interactionId?: never;
1001
+ response?: never;
1002
+ }) | (AgentRunRequestBase & {
1003
+ type: "interaction_response";
1004
+ interactionId: string;
1005
+ response: AgentInteractionResponse;
1006
+ messages?: never;
1007
+ sessionId?: never;
1008
+ maxTurns?: never;
1009
+ toolConcurrency?: never;
1010
+ model?: never;
1011
+ });
1012
+ type AgentRunResponse = Exclude<AgentOutcome, AgentInteractionOutcome> | Omit<AgentInteractionOutcome, "continuation" | "messages">;
1013
+ type AgentRunStreamEvent = AgentStreamEvent | StudioSessionLogEvent | StudioPipelineLogEvent | StudioPipelineFinalEvent;
1014
+ type StudioErrorCode = "bad_request" | "conflict" | "forbidden" | "not_found" | "payload_too_large" | "unsupported_capability" | "internal_error";
955
1015
  type StudioErrorResponse = {
956
1016
  error: {
957
1017
  code: StudioErrorCode;
@@ -981,6 +1041,7 @@ declare class Studio implements AnviaStudio {
981
1041
  private readonly options;
982
1042
  private studio;
983
1043
  private server;
1044
+ private websocketServer;
984
1045
  private sigintHandler;
985
1046
  constructor(targets?: StudioTarget[], options?: StudioOptions);
986
1047
  get app(): Hono;
@@ -1000,4 +1061,4 @@ declare function createSqliteSessionStore(options?: SqliteSessionStoreOptions):
1000
1061
 
1001
1062
  declare function createInMemoryStudioStore(): StudioSessionStore & StudioTraceStore & StudioPipelineLogStore & StudioPipelineRunStore;
1002
1063
 
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 };
1064
+ 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 };