@datalayer/agent-runtimes 1.0.18 → 1.0.20

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 (146) hide show
  1. package/README.md +14 -6
  2. package/lib/AgentNode.js +567 -67
  3. package/lib/App.js +2 -2
  4. package/lib/agent-node/AgentNodeGallery.d.ts +80 -0
  5. package/lib/agent-node/AgentNodeGallery.js +627 -0
  6. package/lib/agent-notebook-main.js +0 -1
  7. package/lib/api/runtimes/runtimes.d.ts +57 -0
  8. package/lib/api/runtimes/runtimes.js +55 -1
  9. package/lib/chat/Chat.d.ts +14 -1
  10. package/lib/chat/Chat.js +22 -7
  11. package/lib/chat/base/ChatBase.js +86 -23
  12. package/lib/chat/document/EphemeralDocument.d.ts +49 -1
  13. package/lib/chat/document/EphemeralDocument.js +141 -15
  14. package/lib/chat/header/ChatHeaderBase.d.ts +3 -1
  15. package/lib/chat/header/ChatHeaderBase.js +5 -3
  16. package/lib/chat/messages/ChatMessageList.d.ts +19 -0
  17. package/lib/chat/messages/ChatMessageList.js +180 -9
  18. package/lib/chat/notebook/EphemeralNotebook.d.ts +40 -1
  19. package/lib/chat/notebook/EphemeralNotebook.js +49 -13
  20. package/lib/chat/prompt/InputPrompt.js +1 -1
  21. package/lib/chat/tools/SubagentActivity.d.ts +20 -0
  22. package/lib/chat/tools/SubagentActivity.js +154 -0
  23. package/lib/chat/tools/index.d.ts +1 -0
  24. package/lib/chat/tools/index.js +1 -0
  25. package/lib/chat/usage/TokenUsageBar.js +3 -3
  26. package/lib/client/AgentRuntimesClient.d.ts +5 -0
  27. package/lib/client/AgentsMixin.js +3 -1
  28. package/lib/client/mixins/RuntimesMixin.d.ts +12 -0
  29. package/lib/client/mixins/RuntimesMixin.js +24 -1
  30. package/lib/components/AgentSummary.d.ts +1 -0
  31. package/lib/components/AgentSummary.js +66 -10
  32. package/lib/components/runtimes/RuntimePickerBase.js +64 -29
  33. package/lib/components/runtimes/RuntimePickerCell.js +1 -1
  34. package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
  35. package/lib/components/runtimes/RuntimeSimplePicker.js +3 -2
  36. package/lib/components/runtimes/RuntimeUtils.js +2 -2
  37. package/lib/context/GraphFlowChart.js +1 -1
  38. package/lib/context/TokenUsageChart.js +1 -1
  39. package/lib/context/TurnGraphChart.js +2 -2
  40. package/lib/examples/A2UiAgentExample.js +4 -4
  41. package/lib/examples/A2UiComponentsGalleryExample.js +3 -3
  42. package/lib/examples/A2UiContactCardExample.js +3 -3
  43. package/lib/examples/A2UiRestaurantExample.js +2 -2
  44. package/lib/examples/A2UiViewerExample.js +3 -3
  45. package/lib/examples/AgUiAgenticExample.js +3 -3
  46. package/lib/examples/AgUiBackendToolRenderingExample.js +2 -2
  47. package/lib/examples/AgUiHaikuGenUiExample.js +3 -3
  48. package/lib/examples/AgUiHumanInTheLoopExample.js +5 -5
  49. package/lib/examples/AgUiSharedStateExample.js +3 -3
  50. package/lib/examples/AgUiToolsBasedGenUiExample.js +7 -5
  51. package/lib/examples/AgentCheckpointsExample.js +6 -5
  52. package/lib/examples/{AgentSandboxExample.d.ts → AgentCodeSandboxExample.d.ts} +4 -4
  53. package/lib/examples/{AgentSandboxExample.js → AgentCodeSandboxExample.js} +10 -9
  54. package/lib/examples/AgentCodeSandboxesExample.js +2 -2
  55. package/lib/examples/AgentCodemodeExample.js +3 -3
  56. package/lib/examples/AgentCompactionExample.d.ts +12 -0
  57. package/lib/examples/AgentCompactionExample.js +244 -0
  58. package/lib/examples/AgentEvalsExample.js +10 -20
  59. package/lib/examples/AgentGuardrailsExample.js +2 -2
  60. package/lib/examples/AgentHooksExample.js +1 -1
  61. package/lib/examples/AgentInferenceProviderExample.js +6 -8
  62. package/lib/examples/AgentLoopExample.js +3 -3
  63. package/lib/examples/AgentMCPExample.js +3 -3
  64. package/lib/examples/AgentMemoryExample.d.ts +4 -2
  65. package/lib/examples/AgentMemoryExample.js +93 -10
  66. package/lib/examples/AgentMonitoringExample.js +2 -2
  67. package/lib/examples/AgentNotificationsExample.js +1 -1
  68. package/lib/examples/AgentOtelExample.d.ts +2 -3
  69. package/lib/examples/AgentOtelExample.js +7 -12
  70. package/lib/examples/AgentOutputsExample.js +5 -5
  71. package/lib/examples/AgentParametersExample.js +3 -3
  72. package/lib/examples/AgentSkillsExample.js +4 -4
  73. package/lib/examples/AgentSubagentsExample.d.ts +2 -2
  74. package/lib/examples/AgentSubagentsExample.js +43 -34
  75. package/lib/examples/AgentToolApprovalsExample.js +1 -1
  76. package/lib/examples/AgentTriggersExample.js +9 -11
  77. package/lib/examples/AgentspecsExample.js +13 -5
  78. package/lib/examples/CellExample.d.ts +6 -0
  79. package/lib/examples/CellExample.js +84 -0
  80. package/lib/examples/ChatCustomExample.js +1 -1
  81. package/lib/examples/ChatExample.js +1 -1
  82. package/lib/examples/ChatStandaloneExample.js +2 -2
  83. package/lib/examples/HomeExample.js +29 -28
  84. package/lib/examples/Lexical2Example.js +2 -2
  85. package/lib/examples/LexicalAgentExample.js +1 -1
  86. package/lib/examples/LexicalAgentSidebarExample.js +2 -2
  87. package/lib/examples/NotebookAgentSidebarExample.d.ts +1 -1
  88. package/lib/examples/NotebookAgentSidebarExample.js +5 -4
  89. package/lib/examples/NotebookCollaborationExample.js +3 -3
  90. package/lib/examples/NotebookExample.js +2 -2
  91. package/lib/examples/components/ExampleWrapper.js +5 -0
  92. package/lib/examples/components/Header.js +2 -2
  93. package/lib/examples/components/HeaderControls.js +1 -1
  94. package/lib/examples/components/LexicalEditor.js +1 -1
  95. package/lib/examples/components/MainContent.js +1 -1
  96. package/lib/examples/components/MockFileBrowser.js +8 -8
  97. package/lib/examples/components/TimeTravel.js +1 -1
  98. package/lib/examples/components/haiku/HaikuDisplay.js +2 -2
  99. package/lib/examples/example-selector.js +4 -3
  100. package/lib/examples/hooks/useExampleAgentRuntime.js +11 -1
  101. package/lib/examples/hooks/useExampleAgentRuntimes.d.ts +7 -0
  102. package/lib/examples/hooks/useExampleAgentRuntimes.js +82 -0
  103. package/lib/examples/index.d.ts +2 -1
  104. package/lib/examples/index.js +2 -1
  105. package/lib/examples/main.js +359 -46
  106. package/lib/examples/utils/agentSummaryStore.d.ts +17 -0
  107. package/lib/examples/utils/themedProvider.js +32 -2
  108. package/lib/examples/utils/useExampleAgentRuntimesUrl.js +2 -1
  109. package/lib/examples2/NotebookMutationsKernel.js +6 -3
  110. package/lib/examples2/NotebookMutationsServiceManager.js +6 -3
  111. package/lib/examples2/ReactRouterExample.js +5 -5
  112. package/lib/examples2/main.js +38 -0
  113. package/lib/hooks/useAIAgentsWebSocket.js +35 -0
  114. package/lib/hooks/useAgentRuntimes.d.ts +22 -0
  115. package/lib/hooks/useAgentRuntimes.js +192 -5
  116. package/lib/hooks/useCheckpoints.js +2 -2
  117. package/lib/hooks/useToolApprovals.d.ts +10 -4
  118. package/lib/hooks/useToolApprovals.js +11 -5
  119. package/lib/identity/AgentIdentity.js +1 -2
  120. package/lib/models/Runtime.d.ts +10 -8
  121. package/lib/models/RuntimeDTO.d.ts +5 -3
  122. package/lib/models/RuntimeDTO.js +3 -3
  123. package/lib/runtimes/actions.js +3 -1
  124. package/lib/runtimes/apis.d.ts +7 -0
  125. package/lib/shims/primerAddonsBox.d.ts +1 -0
  126. package/lib/shims/primerAddonsBox.js +7 -0
  127. package/lib/specs/agents/agents.d.ts +51 -0
  128. package/lib/specs/agents/agents.js +3389 -94
  129. package/lib/specs/models.d.ts +2 -0
  130. package/lib/specs/models.js +37 -0
  131. package/lib/stores/agentRuntimeStore.d.ts +32 -1
  132. package/lib/stores/agentRuntimeStore.js +65 -1
  133. package/lib/stores/index.d.ts +1 -1
  134. package/lib/stores/index.js +1 -1
  135. package/lib/types/agents.d.ts +9 -3
  136. package/lib/types/agentspecs.d.ts +2 -0
  137. package/lib/types/chat.d.ts +83 -0
  138. package/lib/types/models.d.ts +5 -0
  139. package/lib/types/stream.d.ts +58 -1
  140. package/package.json +6 -5
  141. package/scripts/codegen/generate_agents.py +7 -0
  142. package/scripts/codegen/generate_models.py +22 -9
  143. package/scripts/gen_workers.py +340 -0
  144. package/lib/examples/CellSimpleExample.d.ts +0 -6
  145. package/lib/examples/CellSimpleExample.js +0 -20
  146. package/scripts/codegen/__pycache__/generate_sandbox_agents.cpython-313.pyc +0 -0
@@ -22,6 +22,7 @@ export declare const AIModels: {
22
22
  readonly BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_8: "bedrock:us.anthropic.claude-opus-4-8";
23
23
  readonly BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_20250514_V1_0: "bedrock:us.anthropic.claude-opus-4-20250514-v1:0";
24
24
  readonly BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_5_20250929_V1_0: "bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0";
25
+ readonly BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_6: "bedrock:us.anthropic.claude-sonnet-4-6";
25
26
  readonly BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_20250514_V1_0: "bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0";
26
27
  readonly OPENAI_GPT_4_1_MINI: "openai:gpt-4.1-mini";
27
28
  readonly OPENAI_GPT_4_1_NANO: "openai:gpt-4.1-nano";
@@ -45,6 +46,7 @@ export declare const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_6_V1_0_0_1: AIModel;
45
46
  export declare const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_8_0_0_1: AIModel;
46
47
  export declare const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_20250514_V1_0_0_0_1: AIModel;
47
48
  export declare const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_5_20250929_V1_0_0_0_1: AIModel;
49
+ export declare const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_6_0_0_1: AIModel;
48
50
  export declare const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_20250514_V1_0_0_0_1: AIModel;
49
51
  export declare const OPENAI_GPT_4_1_MINI_0_0_1: AIModel;
50
52
  export declare const OPENAI_GPT_4_1_NANO_0_0_1: AIModel;
@@ -20,6 +20,7 @@ export const AIModels = {
20
20
  BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_8: 'bedrock:us.anthropic.claude-opus-4-8',
21
21
  BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_20250514_V1_0: 'bedrock:us.anthropic.claude-opus-4-20250514-v1:0',
22
22
  BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_5_20250929_V1_0: 'bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0',
23
+ BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_6: 'bedrock:us.anthropic.claude-sonnet-4-6',
23
24
  BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_20250514_V1_0: 'bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0',
24
25
  OPENAI_GPT_4_1_MINI: 'openai:gpt-4.1-mini',
25
26
  OPENAI_GPT_4_1_NANO: 'openai:gpt-4.1-nano',
@@ -39,6 +40,7 @@ export const ANTHROPIC_CLAUDE_3_5_HAIKU_20241022_0_0_1 = {
39
40
  provider: 'anthropic',
40
41
  default: false,
41
42
  requiredEnvVars: ['ANTHROPIC_API_KEY'],
43
+ tokensLimit: 8192,
42
44
  };
43
45
  export const ANTHROPIC_CLAUDE_OPUS_4_20250514_0_0_1 = {
44
46
  id: 'anthropic:claude-opus-4-20250514',
@@ -48,6 +50,7 @@ export const ANTHROPIC_CLAUDE_OPUS_4_20250514_0_0_1 = {
48
50
  provider: 'anthropic',
49
51
  default: false,
50
52
  requiredEnvVars: ['ANTHROPIC_API_KEY'],
53
+ tokensLimit: 32000,
51
54
  };
52
55
  export const ANTHROPIC_CLAUDE_SONNET_4_5_20250514_0_0_1 = {
53
56
  id: 'anthropic:claude-sonnet-4-5-20250514',
@@ -57,6 +60,7 @@ export const ANTHROPIC_CLAUDE_SONNET_4_5_20250514_0_0_1 = {
57
60
  provider: 'anthropic',
58
61
  default: false,
59
62
  requiredEnvVars: ['ANTHROPIC_API_KEY'],
63
+ tokensLimit: 64000,
60
64
  };
61
65
  export const ANTHROPIC_CLAUDE_SONNET_4_20250514_0_0_1 = {
62
66
  id: 'anthropic:claude-sonnet-4-20250514',
@@ -66,6 +70,7 @@ export const ANTHROPIC_CLAUDE_SONNET_4_20250514_0_0_1 = {
66
70
  provider: 'anthropic',
67
71
  default: false,
68
72
  requiredEnvVars: ['ANTHROPIC_API_KEY'],
73
+ tokensLimit: 64000,
69
74
  };
70
75
  export const AZURE_OPENAI_GPT_4_1_MINI_0_0_1 = {
71
76
  id: 'azure-openai:gpt-4.1-mini',
@@ -75,6 +80,7 @@ export const AZURE_OPENAI_GPT_4_1_MINI_0_0_1 = {
75
80
  provider: 'azure-openai',
76
81
  default: false,
77
82
  requiredEnvVars: ['AZURE_OPENAI_API_KEY', 'AZURE_OPENAI_ENDPOINT'],
83
+ tokensLimit: 32768,
78
84
  };
79
85
  export const AZURE_OPENAI_GPT_4_1_NANO_0_0_1 = {
80
86
  id: 'azure-openai:gpt-4.1-nano',
@@ -84,6 +90,7 @@ export const AZURE_OPENAI_GPT_4_1_NANO_0_0_1 = {
84
90
  provider: 'azure-openai',
85
91
  default: false,
86
92
  requiredEnvVars: ['AZURE_OPENAI_API_KEY', 'AZURE_OPENAI_ENDPOINT'],
93
+ tokensLimit: 32768,
87
94
  };
88
95
  export const AZURE_OPENAI_GPT_4_1_0_0_1 = {
89
96
  id: 'azure-openai:gpt-4.1',
@@ -93,6 +100,7 @@ export const AZURE_OPENAI_GPT_4_1_0_0_1 = {
93
100
  provider: 'azure-openai',
94
101
  default: false,
95
102
  requiredEnvVars: ['AZURE_OPENAI_API_KEY', 'AZURE_OPENAI_ENDPOINT'],
103
+ tokensLimit: 32768,
96
104
  };
97
105
  export const AZURE_OPENAI_GPT_4O_MINI_0_0_1 = {
98
106
  id: 'azure-openai:gpt-4o-mini',
@@ -102,6 +110,7 @@ export const AZURE_OPENAI_GPT_4O_MINI_0_0_1 = {
102
110
  provider: 'azure-openai',
103
111
  default: false,
104
112
  requiredEnvVars: ['AZURE_OPENAI_API_KEY', 'AZURE_OPENAI_ENDPOINT'],
113
+ tokensLimit: 16384,
105
114
  };
106
115
  export const AZURE_OPENAI_GPT_4O_0_0_1 = {
107
116
  id: 'azure-openai:gpt-4o',
@@ -111,6 +120,7 @@ export const AZURE_OPENAI_GPT_4O_0_0_1 = {
111
120
  provider: 'azure-openai',
112
121
  default: false,
113
122
  requiredEnvVars: ['AZURE_OPENAI_API_KEY', 'AZURE_OPENAI_ENDPOINT'],
123
+ tokensLimit: 16384,
114
124
  };
115
125
  export const BEDROCK_US_ANTHROPIC_CLAUDE_FABLE_5_0_0_1 = {
116
126
  id: 'bedrock:us.anthropic.claude-fable-5',
@@ -124,6 +134,7 @@ export const BEDROCK_US_ANTHROPIC_CLAUDE_FABLE_5_0_0_1 = {
124
134
  'AWS_SECRET_ACCESS_KEY',
125
135
  'AWS_DEFAULT_REGION',
126
136
  ],
137
+ tokensLimit: 64000,
127
138
  };
128
139
  export const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_6_V1_0_0_1 = {
129
140
  id: 'bedrock:us.anthropic.claude-opus-4-6-v1',
@@ -137,6 +148,7 @@ export const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_6_V1_0_0_1 = {
137
148
  'AWS_SECRET_ACCESS_KEY',
138
149
  'AWS_DEFAULT_REGION',
139
150
  ],
151
+ tokensLimit: 32000,
140
152
  };
141
153
  export const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_8_0_0_1 = {
142
154
  id: 'bedrock:us.anthropic.claude-opus-4-8',
@@ -150,6 +162,7 @@ export const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_8_0_0_1 = {
150
162
  'AWS_SECRET_ACCESS_KEY',
151
163
  'AWS_DEFAULT_REGION',
152
164
  ],
165
+ tokensLimit: 32000,
153
166
  };
154
167
  export const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_20250514_V1_0_0_0_1 = {
155
168
  id: 'bedrock:us.anthropic.claude-opus-4-20250514-v1:0',
@@ -163,6 +176,7 @@ export const BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_20250514_V1_0_0_0_1 = {
163
176
  'AWS_SECRET_ACCESS_KEY',
164
177
  'AWS_DEFAULT_REGION',
165
178
  ],
179
+ tokensLimit: 32000,
166
180
  };
167
181
  export const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_5_20250929_V1_0_0_0_1 = {
168
182
  id: 'bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0',
@@ -176,6 +190,21 @@ export const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_5_20250929_V1_0_0_0_1 = {
176
190
  'AWS_SECRET_ACCESS_KEY',
177
191
  'AWS_DEFAULT_REGION',
178
192
  ],
193
+ tokensLimit: 64000,
194
+ };
195
+ export const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_6_0_0_1 = {
196
+ id: 'bedrock:us.anthropic.claude-sonnet-4-6',
197
+ version: '0.0.1',
198
+ name: 'Bedrock Claude Sonnet 4.6',
199
+ description: 'Claude Sonnet 4.6 via AWS Bedrock - balanced performance',
200
+ provider: 'bedrock',
201
+ default: true,
202
+ requiredEnvVars: [
203
+ 'AWS_ACCESS_KEY_ID',
204
+ 'AWS_SECRET_ACCESS_KEY',
205
+ 'AWS_DEFAULT_REGION',
206
+ ],
207
+ tokensLimit: 64000,
179
208
  };
180
209
  export const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_20250514_V1_0_0_0_1 = {
181
210
  id: 'bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0',
@@ -189,6 +218,7 @@ export const BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_20250514_V1_0_0_0_1 = {
189
218
  'AWS_SECRET_ACCESS_KEY',
190
219
  'AWS_DEFAULT_REGION',
191
220
  ],
221
+ tokensLimit: 64000,
192
222
  };
193
223
  export const OPENAI_GPT_4_1_MINI_0_0_1 = {
194
224
  id: 'openai:gpt-4.1-mini',
@@ -198,6 +228,7 @@ export const OPENAI_GPT_4_1_MINI_0_0_1 = {
198
228
  provider: 'openai',
199
229
  default: false,
200
230
  requiredEnvVars: ['OPENAI_API_KEY'],
231
+ tokensLimit: 32768,
201
232
  };
202
233
  export const OPENAI_GPT_4_1_NANO_0_0_1 = {
203
234
  id: 'openai:gpt-4.1-nano',
@@ -207,6 +238,7 @@ export const OPENAI_GPT_4_1_NANO_0_0_1 = {
207
238
  provider: 'openai',
208
239
  default: false,
209
240
  requiredEnvVars: ['OPENAI_API_KEY'],
241
+ tokensLimit: 32768,
210
242
  };
211
243
  export const OPENAI_GPT_4_1_0_0_1 = {
212
244
  id: 'openai:gpt-4.1',
@@ -216,6 +248,7 @@ export const OPENAI_GPT_4_1_0_0_1 = {
216
248
  provider: 'openai',
217
249
  default: false,
218
250
  requiredEnvVars: ['OPENAI_API_KEY'],
251
+ tokensLimit: 32768,
219
252
  };
220
253
  export const OPENAI_GPT_4O_MINI_0_0_1 = {
221
254
  id: 'openai:gpt-4o-mini',
@@ -225,6 +258,7 @@ export const OPENAI_GPT_4O_MINI_0_0_1 = {
225
258
  provider: 'openai',
226
259
  default: false,
227
260
  requiredEnvVars: ['OPENAI_API_KEY'],
261
+ tokensLimit: 16384,
228
262
  };
229
263
  export const OPENAI_GPT_4O_0_0_1 = {
230
264
  id: 'openai:gpt-4o',
@@ -234,6 +268,7 @@ export const OPENAI_GPT_4O_0_0_1 = {
234
268
  provider: 'openai',
235
269
  default: false,
236
270
  requiredEnvVars: ['OPENAI_API_KEY'],
271
+ tokensLimit: 16384,
237
272
  };
238
273
  export const OPENAI_O3_MINI_0_0_1 = {
239
274
  id: 'openai:o3-mini',
@@ -243,6 +278,7 @@ export const OPENAI_O3_MINI_0_0_1 = {
243
278
  provider: 'openai',
244
279
  default: false,
245
280
  requiredEnvVars: ['OPENAI_API_KEY'],
281
+ tokensLimit: 100000,
246
282
  };
247
283
  // ============================================================================
248
284
  // AI Model Catalog
@@ -262,6 +298,7 @@ export const AI_MODEL_CATALOGUE = {
262
298
  'bedrock:us.anthropic.claude-opus-4-8': BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_8_0_0_1,
263
299
  'bedrock:us.anthropic.claude-opus-4-20250514-v1:0': BEDROCK_US_ANTHROPIC_CLAUDE_OPUS_4_20250514_V1_0_0_0_1,
264
300
  'bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0': BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_5_20250929_V1_0_0_0_1,
301
+ 'bedrock:us.anthropic.claude-sonnet-4-6': BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_6_0_0_1,
265
302
  'bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0': BEDROCK_US_ANTHROPIC_CLAUDE_SONNET_4_20250514_V1_0_0_0_1,
266
303
  'openai:gpt-4.1-mini': OPENAI_GPT_4_1_MINI_0_0_1,
267
304
  'openai:gpt-4.1-nano': OPENAI_GPT_4_1_NANO_0_0_1,
@@ -2,7 +2,7 @@ import type { ServiceManager } from '@jupyterlab/services';
2
2
  import type { INotebookContent } from '@jupyterlab/nbformat';
3
3
  import type { IRuntimeOptions } from '../runtimes/apis';
4
4
  import type { AgentStatus, AgentConnection, AgentConfig, Protocol } from '../types';
5
- import type { AgentStreamSnapshotPayload, AgentStreamToolApprovalPayload, CodemodeStatusData } from '../types/stream';
5
+ import type { AgentStreamSnapshotPayload, AgentStreamSubagentPayload, AgentStreamCompactionPayload, AgentStreamToolApprovalPayload, CodemodeStatusData } from '../types/stream';
6
6
  import type { ContextSnapshotData } from '../types/context';
7
7
  import type { McpToolsetsStatusResponse } from '../types/mcp';
8
8
  import type { LoadedSkillInfo } from '../types/skills';
@@ -54,6 +54,17 @@ export interface AgentRuntimeStoreState {
54
54
  wsState: AgentRuntimeWsState;
55
55
  approvals: AgentStreamToolApprovalPayload[];
56
56
  pendingApprovalCount: number;
57
+ /**
58
+ * Live subagent (`delegate_task`) activity keyed by the parent delegation
59
+ * tool call id. Each entry is the ordered stream of interaction events for
60
+ * that subagent run.
61
+ */
62
+ subagentActivity: Record<string, AgentStreamSubagentPayload[]>;
63
+ /**
64
+ * Latest history-compaction activity for the connected agent, or `null` when
65
+ * no compaction has occurred on the current stream.
66
+ */
67
+ compaction: AgentStreamCompactionPayload | null;
57
68
  contextSnapshot: ContextSnapshotData | null;
58
69
  costUsage: ContextSnapshotData['costUsage'] | null;
59
70
  mcpStatus: McpToolsetsStatusResponse | null;
@@ -113,6 +124,9 @@ export interface AgentRuntimeStoreActions {
113
124
  setWsState: (state: AgentRuntimeWsState) => void;
114
125
  setWs: (ws: WebSocket | null, agentId?: string) => void;
115
126
  applySnapshot: (payload: AgentStreamSnapshotPayload) => void;
127
+ appendSubagentEvent: (event: AgentStreamSubagentPayload) => void;
128
+ clearSubagentActivity: () => void;
129
+ setCompaction: (payload: AgentStreamCompactionPayload | null) => void;
116
130
  upsertApproval: (approval: AgentStreamToolApprovalPayload) => void;
117
131
  removeApproval: (approvalId: string) => void;
118
132
  sendDecision: (approvalId: string, approved: boolean, note?: string, toolCallId?: string, agentId?: string) => boolean;
@@ -221,6 +235,23 @@ export declare const useAgentRuntimeCostUsage: () => {
221
235
  export declare const useAgentRuntimeCodemodeStatus: () => CodemodeStatusData | null;
222
236
  export declare const useAgentRuntimeWsState: () => AgentRuntimeWsState;
223
237
  export declare const useAgentRuntimeLoadedSkills: (agentId?: string) => LoadedSkillInfo[];
238
+ /** Live subagent activity for a given parent `delegate_task` tool call id. */
239
+ export declare const useAgentRuntimeSubagentActivity: (toolCallId?: string) => readonly AgentStreamSubagentPayload[];
240
+ /**
241
+ * Live subagent activity resolved by tool-call id with a subagent-name
242
+ * fallback. The backend keys events by the parent run's `tool_call_id`, which
243
+ * can differ from the id surfaced in the chat transport stream; when the id
244
+ * misses we fall back to the most recent run for the named subagent.
245
+ */
246
+ export declare const useAgentRuntimeSubagentActivityByToolCall: (toolCallId?: string, subagentName?: string) => readonly AgentStreamSubagentPayload[];
247
+ /**
248
+ * Key of the currently active (running) subagent run, or `null` when none is
249
+ * active. A run is active while its event list has no `end`/`error` phase; when
250
+ * several are active the most recently started one wins.
251
+ */
252
+ export declare const useAgentRuntimeActiveSubagentToolCallId: () => string | null;
253
+ /** Latest history-compaction activity for the connected agent. */
254
+ export declare const useAgentRuntimeCompaction: () => AgentStreamCompactionPayload | null;
224
255
  export declare const getAgentRuntimeState: () => AgentRuntimeStore;
225
256
  export declare const subscribeToAgentRuntime: {
226
257
  (listener: (selectedState: AgentRuntimeStore, previousSelectedState: AgentRuntimeStore) => void): () => void;
@@ -106,6 +106,8 @@ const initialWsState = {
106
106
  wsState: 'closed',
107
107
  approvals: [],
108
108
  pendingApprovalCount: 0,
109
+ subagentActivity: {},
110
+ compaction: null,
109
111
  contextSnapshot: null,
110
112
  costUsage: null,
111
113
  mcpStatus: null,
@@ -332,7 +334,7 @@ export const agentRuntimeStore = createStore()(subscribeWithSelector(persist((se
332
334
  const agentBaseUrl = jupyterBaseUrl.replace('/jupyter/server/', '/agent-runtimes/');
333
335
  const conn = {
334
336
  podName: runtimePod.pod_name,
335
- environmentName: runtimePod.environment_name,
337
+ environmentName: runtimePod.environment.name,
336
338
  jupyterBaseUrl,
337
339
  agentBaseUrl,
338
340
  status: 'ready',
@@ -400,6 +402,18 @@ export const agentRuntimeStore = createStore()(subscribeWithSelector(persist((se
400
402
  codemodeStatus: payload.codemodeStatus ?? null,
401
403
  fullContext: payload.fullContext ?? null,
402
404
  })),
405
+ appendSubagentEvent: event => set(state => {
406
+ const key = event.toolCallId ?? event.subagentName;
407
+ const existing = state.subagentActivity[key] ?? [];
408
+ return {
409
+ subagentActivity: {
410
+ ...state.subagentActivity,
411
+ [key]: [...existing, event],
412
+ },
413
+ };
414
+ }),
415
+ clearSubagentActivity: () => set({ subagentActivity: {} }),
416
+ setCompaction: payload => set({ compaction: payload }),
403
417
  upsertApproval: approval => set(state => {
404
418
  const filtered = state.approvals.filter(a => a.id !== approval.id);
405
419
  const approvals = [approval, ...filtered];
@@ -738,6 +752,56 @@ export const useAgentRuntimeCostUsage = () => useAgentRuntimeStore(s => s.costUs
738
752
  export const useAgentRuntimeCodemodeStatus = () => useAgentRuntimeStore(s => s.codemodeStatus);
739
753
  export const useAgentRuntimeWsState = () => useAgentRuntimeStore(s => s.wsState);
740
754
  export const useAgentRuntimeLoadedSkills = (agentId) => useAgentRuntimeStore(s => agentId ? (s.loadedSkillsByAgentId[agentId] ?? []) : []);
755
+ const EMPTY_SUBAGENT_EVENTS = [];
756
+ /** Live subagent activity for a given parent `delegate_task` tool call id. */
757
+ export const useAgentRuntimeSubagentActivity = (toolCallId) => useAgentRuntimeStore(s => toolCallId
758
+ ? (s.subagentActivity[toolCallId] ?? EMPTY_SUBAGENT_EVENTS)
759
+ : EMPTY_SUBAGENT_EVENTS);
760
+ /**
761
+ * Live subagent activity resolved by tool-call id with a subagent-name
762
+ * fallback. The backend keys events by the parent run's `tool_call_id`, which
763
+ * can differ from the id surfaced in the chat transport stream; when the id
764
+ * misses we fall back to the most recent run for the named subagent.
765
+ */
766
+ export const useAgentRuntimeSubagentActivityByToolCall = (toolCallId, subagentName) => useAgentRuntimeStore(s => {
767
+ if (toolCallId) {
768
+ const byId = s.subagentActivity[toolCallId];
769
+ if (byId && byId.length > 0)
770
+ return byId;
771
+ }
772
+ if (subagentName) {
773
+ const byNameKey = s.subagentActivity[subagentName];
774
+ if (byNameKey && byNameKey.length > 0)
775
+ return byNameKey;
776
+ let match;
777
+ for (const events of Object.values(s.subagentActivity)) {
778
+ if (events.length > 0 && events[0]?.subagentName === subagentName) {
779
+ match = events;
780
+ }
781
+ }
782
+ if (match)
783
+ return match;
784
+ }
785
+ return EMPTY_SUBAGENT_EVENTS;
786
+ });
787
+ /**
788
+ * Key of the currently active (running) subagent run, or `null` when none is
789
+ * active. A run is active while its event list has no `end`/`error` phase; when
790
+ * several are active the most recently started one wins.
791
+ */
792
+ export const useAgentRuntimeActiveSubagentToolCallId = () => useAgentRuntimeStore(s => {
793
+ let activeKey = null;
794
+ for (const [key, events] of Object.entries(s.subagentActivity)) {
795
+ if (events.length === 0)
796
+ continue;
797
+ const done = events.some(e => e.phase === 'end' || e.phase === 'error');
798
+ if (!done)
799
+ activeKey = key;
800
+ }
801
+ return activeKey;
802
+ });
803
+ /** Latest history-compaction activity for the connected agent. */
804
+ export const useAgentRuntimeCompaction = () => useAgentRuntimeStore(s => s.compaction);
741
805
  // ---------------------------------------------------------------------------
742
806
  // Non-React access
743
807
  // ---------------------------------------------------------------------------
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * @module store
5
5
  */
6
- export { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeConnection, useAgentRuntimeStatus, useAgentRuntimeError, useAgentRuntimeIsLaunching, useAgentRuntimeApprovals, useAgentRuntimePendingCount, useAgentRuntimeMcpStatus, useAgentRuntimeFullContext, useAgentRuntimeContextSnapshot, useAgentRuntimeCostUsage, useAgentRuntimeCodemodeStatus, useAgentRuntimeWsState, useAgentRuntimeLoadedSkills, getAgentRuntimeState, subscribeToAgentRuntime, type AgentRegistryEntry, type AgentRuntimeWsState, type AgentRuntimeStoreState, type AgentRuntimeStoreActions, type AgentRuntimeStore, } from './agentRuntimeStore';
6
+ export { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeConnection, useAgentRuntimeStatus, useAgentRuntimeError, useAgentRuntimeIsLaunching, useAgentRuntimeApprovals, useAgentRuntimePendingCount, useAgentRuntimeMcpStatus, useAgentRuntimeFullContext, useAgentRuntimeContextSnapshot, useAgentRuntimeCostUsage, useAgentRuntimeCodemodeStatus, useAgentRuntimeWsState, useAgentRuntimeLoadedSkills, useAgentRuntimeActiveSubagentToolCallId, useAgentRuntimeSubagentActivity, useAgentRuntimeSubagentActivityByToolCall, useAgentRuntimeCompaction, getAgentRuntimeState, subscribeToAgentRuntime, type AgentRegistryEntry, type AgentRuntimeWsState, type AgentRuntimeStoreState, type AgentRuntimeStoreActions, type AgentRuntimeStore, } from './agentRuntimeStore';
7
7
  export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, type ChatStore, type ChatState, type ChatActions, type ChatConfig, type ToolCallState, } from './chatStore';
8
8
  export { useConversationStore, useConversationMessages, useNeedsFetch, useIsFetching, type ConversationStore, type ConversationData, } from './conversationStore';
@@ -7,6 +7,6 @@
7
7
  *
8
8
  * @module store
9
9
  */
10
- export { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeConnection, useAgentRuntimeStatus, useAgentRuntimeError, useAgentRuntimeIsLaunching, useAgentRuntimeApprovals, useAgentRuntimePendingCount, useAgentRuntimeMcpStatus, useAgentRuntimeFullContext, useAgentRuntimeContextSnapshot, useAgentRuntimeCostUsage, useAgentRuntimeCodemodeStatus, useAgentRuntimeWsState, useAgentRuntimeLoadedSkills, getAgentRuntimeState, subscribeToAgentRuntime, } from './agentRuntimeStore';
10
+ export { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeConnection, useAgentRuntimeStatus, useAgentRuntimeError, useAgentRuntimeIsLaunching, useAgentRuntimeApprovals, useAgentRuntimePendingCount, useAgentRuntimeMcpStatus, useAgentRuntimeFullContext, useAgentRuntimeContextSnapshot, useAgentRuntimeCostUsage, useAgentRuntimeCodemodeStatus, useAgentRuntimeWsState, useAgentRuntimeLoadedSkills, useAgentRuntimeActiveSubagentToolCallId, useAgentRuntimeSubagentActivity, useAgentRuntimeSubagentActivityByToolCall, useAgentRuntimeCompaction, getAgentRuntimeState, subscribeToAgentRuntime, } from './agentRuntimeStore';
11
11
  export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, } from './chatStore';
12
12
  export { useConversationStore, useConversationMessages, useNeedsFetch, useIsFetching, } from './conversationStore';
@@ -30,7 +30,7 @@ export interface AgentRuntimeState {
30
30
  /**
31
31
  * Agent Runtime data type (mapped from runtimes service).
32
32
  *
33
- * Backend RuntimePod fields: pod_name, environment_name, environment_title, uid,
33
+ * Backend RuntimePod fields: pod_name, environment{name,title,cpu,memory,gpu,resources}, uid,
34
34
  * type, given_name, token, ingress, reservation_id, started_at, expired_at, burning_rate.
35
35
  *
36
36
  * We map `ingress` to `url` for consistency with the UI.
@@ -39,8 +39,14 @@ export type AgentRuntimeData = {
39
39
  pod_name: string;
40
40
  id: string;
41
41
  name: string;
42
- environment_name: string;
43
- environment_title?: string;
42
+ environment: {
43
+ name: string;
44
+ title?: string;
45
+ cpu?: string;
46
+ memory?: string;
47
+ gpu?: string;
48
+ resources?: Record<string, string>;
49
+ };
44
50
  given_name: string;
45
51
  type: string;
46
52
  started_at?: string;
@@ -29,6 +29,8 @@ export interface Agentspec {
29
29
  systemPromptCodemodeAddons?: string;
30
30
  /** Tags for categorization */
31
31
  tags: string[];
32
+ /** Domain used to group agents in the gallery */
33
+ domain?: string;
32
34
  /** Whether the agent is enabled */
33
35
  enabled: boolean;
34
36
  /** AI model identifier to use for this agent */
@@ -4,6 +4,7 @@
4
4
  * @module types/chat
5
5
  */
6
6
  import type { ComponentType, ReactNode } from 'react';
7
+ import type { ICollaborationProvider } from '@datalayer/jupyter-react';
7
8
  import type { ChatMessage, MessageHandler } from './messages';
8
9
  import type { Protocol, ProtocolConfig } from './protocol';
9
10
  import type { McpServerSelection } from './inference';
@@ -12,6 +13,8 @@ import type { AgentRuntimeConfig } from './config';
12
13
  import type { SandboxWsStatus } from './sandbox';
13
14
  import type { FrontendToolDefinition } from './tools';
14
15
  import type { PoweredByTagProps } from '../chat/display/PoweredByTag';
16
+ import type { EphemeralRuntimeOverride } from '../chat/notebook/EphemeralNotebook';
17
+ import type { EphemeralDocumentCollaboration } from '../chat/document/EphemeralDocument';
15
18
  /**
16
19
  * Context passed to tool-call pre-hooks.
17
20
  * Fires when a tool call starts executing (backend or frontend).
@@ -366,6 +369,34 @@ export interface ChatCommonProps {
366
369
  * Defaults to the toolbar from `@datalayer/jupyter-react` when omitted.
367
370
  */
368
371
  ephemeralNotebookToolbar?: EphemeralNotebookToolbarComponent;
372
+ /**
373
+ * Optional real-time collaboration provider for the ephemeral notebook.
374
+ * When supplied, the notebook joins a shared collaborative room so its state
375
+ * transits over RTC (e.g. between an Agent Node and the SaaS UI) instead of
376
+ * the tunnel. The caller owns the provider lifecycle.
377
+ */
378
+ ephemeralNotebookCollaborationProvider?: ICollaborationProvider;
379
+ /**
380
+ * Explicit collaboration room / document id for the ephemeral notebook. When
381
+ * set it becomes the notebook id directly so multiple peers (e.g. an Agent
382
+ * Node and the SaaS UI) share the same collaborative room and tool scope.
383
+ */
384
+ ephemeralNotebookCollaborationDocumentId?: string;
385
+ /**
386
+ * Optional real-time collaboration configuration for the ephemeral document
387
+ * (Lexical). When supplied the document joins a shared Loro room over
388
+ * WebSocket so its rich-text state transits over RTC (e.g. between an Agent
389
+ * Node and the SaaS UI). Its `roomId` also becomes the document id so all
390
+ * peers share the same collaborative room and lexical tool scope.
391
+ */
392
+ ephemeralDocumentCollaboration?: EphemeralDocumentCollaboration;
393
+ /**
394
+ * Explicit runtime endpoint for the ephemeral notebook kernel. When set, the
395
+ * notebook binds its kernel to this endpoint directly instead of resolving a
396
+ * pod from the user's runtimes list — used to reach an Agent Node's Jupyter
397
+ * server through the runtimes tunnel HTTP/WebSocket proxy.
398
+ */
399
+ ephemeralRuntimeOverride?: EphemeralRuntimeOverride;
369
400
  /** Pre-hook: fires when a tool call starts executing */
370
401
  onToolCallStart?: (context: ToolCallStartContext) => void;
371
402
  /** Post-hook: fires when a tool result is received */
@@ -413,12 +444,30 @@ export interface ChatCommonProps {
413
444
  codemodeStatusData?: import('./stream').CodemodeStatusData | null;
414
445
  /** Optional sandbox status override for immediate UI updates. */
415
446
  sandboxStatusData?: SandboxWsStatus | null;
447
+ /** Horizontal placement for the header kernel indicator. @default 'left' */
448
+ kernelIndicatorPlacement?: 'left' | 'center' | 'right';
416
449
  /**
417
450
  * Live kernel connection of the companion notebook/document sandbox.
418
451
  * When provided, it is forwarded to the chat header's `<KernelIndicator>`
419
452
  * so the indicator reflects the surface's runtime.
420
453
  */
421
454
  kernel?: import('@jupyterlab/services/lib/kernel/kernel').IKernelConnection | null;
455
+ /**
456
+ * Optional environment name displayed in the chat header's kernel
457
+ * indicator details (e.g. the agent's local sandbox name). Defaults to
458
+ * the indicator's own "browser-runtime" placeholder when omitted.
459
+ */
460
+ kernelEnvironmentName?: string;
461
+ /** Optional CPU info displayed in the chat header's kernel indicator. */
462
+ kernelCpu?: string;
463
+ /** Optional memory info displayed in the chat header's kernel indicator. */
464
+ kernelMemory?: string;
465
+ /** Optional GPU info displayed in the chat header's kernel indicator. */
466
+ kernelGpu?: string;
467
+ /** Optional theme variant override for companion notebook/document surfaces. */
468
+ themeVariant?: string;
469
+ /** Optional color mode override for companion notebook/document surfaces. */
470
+ colorMode?: 'light' | 'dark' | 'auto';
422
471
  /**
423
472
  * Disable ChatBase's internal JupyterReactTheme wrapper.
424
473
  * Use this when the host page already provides a JupyterReactTheme boundary.
@@ -553,6 +602,8 @@ export interface ChatBaseProps {
553
602
  headerActions?: React.ReactNode;
554
603
  /** Notebook kernel indicator state override for the chat header. */
555
604
  kernelIndicatorState?: import('@datalayer/jupyter-react').ExecutionState;
605
+ /** Horizontal placement for the header kernel indicator. @default 'left' */
606
+ kernelIndicatorPlacement?: 'left' | 'center' | 'right';
556
607
  /**
557
608
  * Live notebook kernel connection. When provided, the chat header
558
609
  * renders the same `<KernelIndicator>` as the notebook toolbar so
@@ -573,6 +624,10 @@ export interface ChatBaseProps {
573
624
  kernelMemory?: string;
574
625
  /** Optional GPU info displayed in kernel indicator details. */
575
626
  kernelGpu?: string;
627
+ /** Optional theme variant override for companion notebook/document surfaces. */
628
+ themeVariant?: string;
629
+ /** Optional color mode override for companion notebook/document surfaces. */
630
+ colorMode?: 'light' | 'dark' | 'auto';
576
631
  /**
577
632
  * Current chat view mode.
578
633
  * When provided, a segmented view-mode toggle is rendered in the header
@@ -746,6 +801,34 @@ export interface ChatBaseProps {
746
801
  * Defaults to the toolbar from `@datalayer/jupyter-react` when omitted.
747
802
  */
748
803
  ephemeralNotebookToolbar?: EphemeralNotebookToolbarComponent;
804
+ /**
805
+ * Optional real-time collaboration provider for the ephemeral notebook.
806
+ * When supplied, the notebook joins a shared collaborative room so its state
807
+ * transits over RTC (e.g. between an Agent Node and the SaaS UI) instead of
808
+ * the tunnel. The caller owns the provider lifecycle.
809
+ */
810
+ ephemeralNotebookCollaborationProvider?: ICollaborationProvider;
811
+ /**
812
+ * Explicit collaboration room / document id for the ephemeral notebook. When
813
+ * set it becomes the notebook id directly so multiple peers (e.g. an Agent
814
+ * Node and the SaaS UI) share the same collaborative room and tool scope.
815
+ */
816
+ ephemeralNotebookCollaborationDocumentId?: string;
817
+ /**
818
+ * Optional real-time collaboration configuration for the ephemeral document
819
+ * (Lexical). When supplied the document joins a shared Loro room over
820
+ * WebSocket so its rich-text state transits over RTC (e.g. between an Agent
821
+ * Node and the SaaS UI). Its `roomId` also becomes the document id so all
822
+ * peers share the same collaborative room and lexical tool scope.
823
+ */
824
+ ephemeralDocumentCollaboration?: EphemeralDocumentCollaboration;
825
+ /**
826
+ * Explicit runtime endpoint for the ephemeral notebook kernel. When set, the
827
+ * notebook binds its kernel to this endpoint directly instead of resolving a
828
+ * pod from the user's runtimes list — used to reach an Agent Node's Jupyter
829
+ * server through the runtimes tunnel HTTP/WebSocket proxy.
830
+ */
831
+ ephemeralRuntimeOverride?: EphemeralRuntimeOverride;
749
832
  /**
750
833
  * Callback when the agent requests authorization for an external service.
751
834
  * This is called when a tool needs OAuth access to a service like GitHub.
@@ -17,6 +17,11 @@ export interface AIModel {
17
17
  default: boolean;
18
18
  /** Required environment variable names */
19
19
  requiredEnvVars: string[];
20
+ /**
21
+ * Maximum output tokens the model can generate in a single run
22
+ * (maps to pydantic-ai output_tokens_limit).
23
+ */
24
+ tokensLimit?: number;
20
25
  }
21
26
  /**
22
27
  * Configuration for an AI model runtime (as returned by the server).
@@ -1,7 +1,64 @@
1
1
  import type { ContextSnapshotData } from './context';
2
2
  import type { McpToolsetsStatusResponse } from './mcp';
3
3
  import type { SkillStatus } from './skills';
4
- export type AgentStreamEventType = 'agent.snapshot' | 'tool_approval_created' | 'tool_approval_approved' | 'tool_approval_rejected';
4
+ export type AgentStreamEventType = 'agent.snapshot' | 'agent.subagent' | 'agent.compaction' | 'tool_approval_created' | 'tool_approval_approved' | 'tool_approval_rejected';
5
+ /** Phase of a streamed history-compaction interaction. */
6
+ export type AgentCompactionPhase = 'start' | 'end';
7
+ /**
8
+ * History-compaction activity pushed on the agent's monitoring stream when the
9
+ * conversation is summarized to stay under the configured token budget. A
10
+ * `start` event precedes summarization; the matching `end` event reports the
11
+ * before/after token and message counts plus the elapsed time.
12
+ */
13
+ export interface AgentStreamCompactionPayload {
14
+ /** Interaction phase. */
15
+ phase: AgentCompactionPhase;
16
+ /** Token ceiling driving compaction. */
17
+ budget: number;
18
+ /** Estimated history tokens before compaction. */
19
+ beforeTokens: number;
20
+ /** Estimated history tokens after compaction (`end`). */
21
+ afterTokens?: number;
22
+ /** Message count before compaction. */
23
+ beforeMessages: number;
24
+ /** Message count after compaction (`end`). */
25
+ afterMessages?: number;
26
+ /** Elapsed summarization time in milliseconds (`end`). */
27
+ durationMs?: number;
28
+ /** Cumulative number of compactions performed (`end`). */
29
+ compactionCount?: number;
30
+ /** Whether history was actually reduced (`end`). */
31
+ reduced?: boolean;
32
+ }
33
+ /** Phase of a streamed subagent interaction. */
34
+ export type AgentSubagentPhase = 'start' | 'text' | 'thinking' | 'tool_call' | 'tool_result' | 'end' | 'error';
35
+ /**
36
+ * Incremental subagent activity pushed on the parent agent's monitoring
37
+ * stream while a `delegate_task` call runs. Consumers key events by
38
+ * `toolCallId` (the parent delegation tool call) to render a live timeline.
39
+ */
40
+ export interface AgentStreamSubagentPayload {
41
+ /** Name of the subagent producing the activity. */
42
+ subagentName: string;
43
+ /** Parent `delegate_task` tool call id, when resolvable. */
44
+ toolCallId?: string | null;
45
+ /** Interaction phase. */
46
+ phase: AgentSubagentPhase;
47
+ /** Delegated task description (`start`). */
48
+ task?: string;
49
+ /** Text or thinking delta (`text` / `thinking`). */
50
+ text?: string;
51
+ /** Tool name (`tool_call` / `tool_result`). */
52
+ toolName?: string;
53
+ /** Tool call arguments (`tool_call`). */
54
+ toolArgs?: Record<string, unknown>;
55
+ /** Tool result preview (`tool_result`). */
56
+ result?: string;
57
+ /** Final subagent output (`end`). */
58
+ output?: string;
59
+ /** Failure message (`error`). */
60
+ error?: string;
61
+ }
5
62
  export interface AgentStreamMessage<TPayload = Record<string, unknown>> {
6
63
  version: string;
7
64
  type: AgentStreamEventType | string;