@deepstrike/sdk 0.1.13 → 0.1.15

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 (55) hide show
  1. package/README.md +77 -51
  2. package/dist/collaboration/harness.js +6 -1
  3. package/dist/collaboration/modes/creator-verifier.d.ts +2 -2
  4. package/dist/collaboration/modes/creator-verifier.js +2 -2
  5. package/dist/collaboration/pool.d.ts +4 -35
  6. package/dist/collaboration/pool.js +18 -44
  7. package/dist/harness/harness.d.ts +9 -7
  8. package/dist/harness/harness.js +19 -22
  9. package/dist/index.d.ts +18 -6
  10. package/dist/index.js +14 -2
  11. package/dist/kernel.d.ts +1 -0
  12. package/dist/kernel.js +10 -1
  13. package/dist/memory/protocols.d.ts +0 -4
  14. package/dist/providers/anthropic.d.ts +4 -2
  15. package/dist/providers/anthropic.js +34 -10
  16. package/dist/providers/deepseek.d.ts +3 -2
  17. package/dist/providers/deepseek.js +9 -0
  18. package/dist/providers/gemini.d.ts +2 -1
  19. package/dist/providers/gemini.js +11 -0
  20. package/dist/providers/kimi.d.ts +3 -1
  21. package/dist/providers/kimi.js +10 -0
  22. package/dist/providers/minimax.d.ts +3 -1
  23. package/dist/providers/minimax.js +8 -0
  24. package/dist/providers/ollama.d.ts +2 -1
  25. package/dist/providers/ollama.js +22 -0
  26. package/dist/providers/openai-chat.d.ts +1 -1
  27. package/dist/providers/openai-chat.js +5 -7
  28. package/dist/providers/openai-responses.d.ts +1 -0
  29. package/dist/providers/openai-responses.js +13 -0
  30. package/dist/providers/openai.d.ts +4 -1
  31. package/dist/providers/openai.js +28 -0
  32. package/dist/providers/profiles.d.ts +502 -6
  33. package/dist/providers/profiles.js +225 -82
  34. package/dist/providers/qwen.d.ts +2 -1
  35. package/dist/providers/qwen.js +15 -0
  36. package/dist/runtime/credential-vault.d.ts +18 -0
  37. package/dist/runtime/credential-vault.js +33 -0
  38. package/dist/runtime/execution-plane.d.ts +38 -0
  39. package/dist/runtime/execution-plane.js +146 -0
  40. package/dist/runtime/mcp-proxy-plane.d.ts +51 -0
  41. package/dist/runtime/mcp-proxy-plane.js +204 -0
  42. package/dist/runtime/process-sandbox-plane.d.ts +32 -0
  43. package/dist/runtime/process-sandbox-plane.js +109 -0
  44. package/dist/runtime/provider-replay.d.ts +7 -0
  45. package/dist/runtime/provider-replay.js +18 -0
  46. package/dist/runtime/remote-vpc-plane.d.ts +48 -0
  47. package/dist/runtime/remote-vpc-plane.js +82 -0
  48. package/dist/runtime/runner.d.ts +49 -0
  49. package/dist/runtime/runner.js +368 -0
  50. package/dist/runtime/session-log.d.ts +68 -0
  51. package/dist/runtime/session-log.js +84 -0
  52. package/dist/types.d.ts +27 -0
  53. package/package.json +3 -2
  54. package/dist/agent.d.ts +0 -90
  55. package/dist/agent.js +0 -499
@@ -1,4 +1,10 @@
1
1
  export const endpointProfiles = {
2
+ "anthropic.messages": {
3
+ id: "anthropic.messages",
4
+ providerId: "anthropic",
5
+ protocol: "anthropic-messages",
6
+ baseURL: "https://api.anthropic.com",
7
+ },
2
8
  "openai.chat": {
3
9
  id: "openai.chat",
4
10
  providerId: "openai",
@@ -43,146 +49,283 @@ export const endpointProfiles = {
43
49
  },
44
50
  };
45
51
  export const modelProfiles = {
46
- "openai/gpt-4o": {
47
- id: "openai/gpt-4o",
48
- providerId: "openai",
49
- defaultEndpointId: "openai.chat",
50
- contextWindow: 128_000,
52
+ "anthropic/claude-opus-4-7": {
53
+ id: "anthropic/claude-opus-4-7",
54
+ providerId: "anthropic",
55
+ defaultEndpointId: "anthropic.messages",
56
+ contextWindow: 200_000,
57
+ modalities: { input: ["text", "image"], output: ["text"] },
58
+ tools: { supported: true },
59
+ reasoning: { supported: true, preserveAcrossToolTurns: true },
60
+ policy: { maxTurns: 50 },
61
+ },
62
+ "anthropic/claude-opus-4-6": {
63
+ id: "anthropic/claude-opus-4-6",
64
+ providerId: "anthropic",
65
+ defaultEndpointId: "anthropic.messages",
66
+ contextWindow: 200_000,
67
+ modalities: { input: ["text", "image"], output: ["text"] },
68
+ tools: { supported: true },
69
+ reasoning: { supported: true, preserveAcrossToolTurns: true },
70
+ policy: { maxTurns: 50 },
71
+ },
72
+ "anthropic/claude-sonnet-4-6": {
73
+ id: "anthropic/claude-sonnet-4-6",
74
+ providerId: "anthropic",
75
+ defaultEndpointId: "anthropic.messages",
76
+ contextWindow: 200_000,
77
+ modalities: { input: ["text", "image"], output: ["text"] },
78
+ tools: { supported: true },
79
+ reasoning: { supported: true, preserveAcrossToolTurns: false },
80
+ policy: { maxTurns: 25 },
81
+ },
82
+ "anthropic/claude-haiku-4-5": {
83
+ id: "anthropic/claude-haiku-4-5",
84
+ providerId: "anthropic",
85
+ defaultEndpointId: "anthropic.messages",
86
+ contextWindow: 200_000,
51
87
  modalities: { input: ["text", "image"], output: ["text"] },
52
88
  tools: { supported: true },
53
89
  reasoning: { supported: false, preserveAcrossToolTurns: false },
90
+ policy: { maxTurns: 15 },
91
+ },
92
+ // ── OpenAI ─────────────────────────────────────────────────────────────────
93
+ "openai/gpt-4o": {
94
+ id: "openai/gpt-4o", providerId: "openai", defaultEndpointId: "openai.chat",
95
+ contextWindow: 128_000,
96
+ modalities: { input: ["text", "image"], output: ["text"] },
97
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
98
+ policy: { maxTurns: 25 },
54
99
  },
55
100
  "openai/gpt-4o-mini": {
56
- id: "openai/gpt-4o-mini",
57
- providerId: "openai",
58
- defaultEndpointId: "openai.chat",
101
+ id: "openai/gpt-4o-mini", providerId: "openai", defaultEndpointId: "openai.chat",
59
102
  contextWindow: 128_000,
60
103
  modalities: { input: ["text", "image"], output: ["text"] },
61
- tools: { supported: true },
62
- reasoning: { supported: false, preserveAcrossToolTurns: false },
104
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
105
+ policy: { maxTurns: 15 },
106
+ },
107
+ "openai/gpt-4.1": {
108
+ id: "openai/gpt-4.1", providerId: "openai", defaultEndpointId: "openai.responses",
109
+ contextWindow: 1_047_576,
110
+ modalities: { input: ["text", "image"], output: ["text"] },
111
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
112
+ policy: { maxTurns: 35 },
113
+ },
114
+ "openai/gpt-4.1-mini": {
115
+ id: "openai/gpt-4.1-mini", providerId: "openai", defaultEndpointId: "openai.responses",
116
+ contextWindow: 1_047_576,
117
+ modalities: { input: ["text", "image"], output: ["text"] },
118
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
119
+ policy: { maxTurns: 20 },
120
+ },
121
+ "openai/gpt-4.1-nano": {
122
+ id: "openai/gpt-4.1-nano", providerId: "openai", defaultEndpointId: "openai.responses",
123
+ contextWindow: 1_047_576,
124
+ modalities: { input: ["text", "image"], output: ["text"] },
125
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
126
+ policy: { maxTurns: 15 },
63
127
  },
64
128
  "openai/gpt-5": {
65
- id: "openai/gpt-5",
66
- providerId: "openai",
67
- defaultEndpointId: "openai.responses",
129
+ id: "openai/gpt-5", providerId: "openai", defaultEndpointId: "openai.responses",
68
130
  modalities: { input: ["text", "image"], output: ["text"] },
69
- tools: { supported: true },
70
- reasoning: { supported: true, preserveAcrossToolTurns: true },
131
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
132
+ policy: { maxTurns: 50 },
71
133
  },
72
134
  "openai/gpt-5-mini": {
73
- id: "openai/gpt-5-mini",
74
- providerId: "openai",
75
- defaultEndpointId: "openai.responses",
135
+ id: "openai/gpt-5-mini", providerId: "openai", defaultEndpointId: "openai.responses",
76
136
  modalities: { input: ["text", "image"], output: ["text"] },
77
- tools: { supported: true },
78
- reasoning: { supported: true, preserveAcrossToolTurns: true },
137
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
138
+ policy: { maxTurns: 25 },
79
139
  },
140
+ "openai/o3": {
141
+ id: "openai/o3", providerId: "openai", defaultEndpointId: "openai.responses",
142
+ modalities: { input: ["text", "image"], output: ["text"] },
143
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
144
+ policy: { maxTurns: 50 },
145
+ },
146
+ "openai/o3-mini": {
147
+ id: "openai/o3-mini", providerId: "openai", defaultEndpointId: "openai.responses",
148
+ modalities: { input: ["text"], output: ["text"] },
149
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
150
+ policy: { maxTurns: 25 },
151
+ },
152
+ "openai/o4-mini": {
153
+ id: "openai/o4-mini", providerId: "openai", defaultEndpointId: "openai.responses",
154
+ modalities: { input: ["text", "image"], output: ["text"] },
155
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
156
+ policy: { maxTurns: 25 },
157
+ },
158
+ // ── MiniMax ────────────────────────────────────────────────────────────────
80
159
  "minimax/MiniMax-M2.7": {
81
- id: "minimax/MiniMax-M2.7",
82
- providerId: "minimax",
83
- defaultEndpointId: "minimax.anthropic",
160
+ id: "minimax/MiniMax-M2.7", providerId: "minimax", defaultEndpointId: "minimax.anthropic",
84
161
  contextWindow: 204_800,
85
162
  modalities: { input: ["text"], output: ["text"] },
86
- tools: { supported: true },
87
- reasoning: { supported: true, preserveAcrossToolTurns: true },
163
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
164
+ policy: { maxTurns: 35 },
88
165
  },
89
166
  "minimax/MiniMax-M2.5": {
90
- id: "minimax/MiniMax-M2.5",
91
- providerId: "minimax",
92
- defaultEndpointId: "minimax.anthropic",
167
+ id: "minimax/MiniMax-M2.5", providerId: "minimax", defaultEndpointId: "minimax.anthropic",
93
168
  contextWindow: 204_800,
94
169
  modalities: { input: ["text"], output: ["text"] },
95
- tools: { supported: true },
96
- reasoning: { supported: true, preserveAcrossToolTurns: true },
170
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
171
+ policy: { maxTurns: 25 },
172
+ },
173
+ "minimax/MiniMax-Text-01": {
174
+ id: "minimax/MiniMax-Text-01", providerId: "minimax", defaultEndpointId: "minimax.anthropic",
175
+ contextWindow: 1_000_000,
176
+ modalities: { input: ["text"], output: ["text"] },
177
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
178
+ policy: { maxTurns: 20 },
179
+ },
180
+ // ── DeepSeek ───────────────────────────────────────────────────────────────
181
+ "deepseek/deepseek-chat": {
182
+ id: "deepseek/deepseek-chat", providerId: "deepseek", defaultEndpointId: "deepseek.openai",
183
+ contextWindow: 64_000,
184
+ modalities: { input: ["text"], output: ["text"] },
185
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
186
+ policy: { maxTurns: 25 },
187
+ },
188
+ "deepseek/deepseek-reasoner": {
189
+ id: "deepseek/deepseek-reasoner", providerId: "deepseek", defaultEndpointId: "deepseek.openai",
190
+ contextWindow: 64_000,
191
+ modalities: { input: ["text"], output: ["text"] },
192
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
193
+ policy: { maxTurns: 50 },
97
194
  },
98
195
  "deepseek/deepseek-v4-flash": {
99
- id: "deepseek/deepseek-v4-flash",
100
- providerId: "deepseek",
101
- defaultEndpointId: "deepseek.openai",
196
+ id: "deepseek/deepseek-v4-flash", providerId: "deepseek", defaultEndpointId: "deepseek.openai",
102
197
  contextWindow: 1_000_000,
103
198
  modalities: { input: ["text"], output: ["text"] },
104
- tools: { supported: true },
105
- reasoning: { supported: true, preserveAcrossToolTurns: true },
199
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
200
+ policy: { maxTurns: 20 },
106
201
  },
107
202
  "deepseek/deepseek-v4-pro": {
108
- id: "deepseek/deepseek-v4-pro",
109
- providerId: "deepseek",
110
- defaultEndpointId: "deepseek.openai",
203
+ id: "deepseek/deepseek-v4-pro", providerId: "deepseek", defaultEndpointId: "deepseek.openai",
111
204
  contextWindow: 1_000_000,
112
205
  modalities: { input: ["text"], output: ["text"] },
113
- tools: { supported: true },
114
- reasoning: { supported: true, preserveAcrossToolTurns: true },
206
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: true },
207
+ policy: { maxTurns: 35 },
208
+ },
209
+ // ── Kimi ───────────────────────────────────────────────────────────────────
210
+ "kimi/moonshot-v1-8k": {
211
+ id: "kimi/moonshot-v1-8k", providerId: "kimi", defaultEndpointId: "kimi.openai",
212
+ contextWindow: 8_000,
213
+ modalities: { input: ["text"], output: ["text"] },
214
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
215
+ policy: { maxTurns: 15 },
216
+ },
217
+ "kimi/moonshot-v1-32k": {
218
+ id: "kimi/moonshot-v1-32k", providerId: "kimi", defaultEndpointId: "kimi.openai",
219
+ contextWindow: 32_000,
220
+ modalities: { input: ["text"], output: ["text"] },
221
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
222
+ policy: { maxTurns: 20 },
223
+ },
224
+ "kimi/moonshot-v1-128k": {
225
+ id: "kimi/moonshot-v1-128k", providerId: "kimi", defaultEndpointId: "kimi.openai",
226
+ contextWindow: 128_000,
227
+ modalities: { input: ["text", "image"], output: ["text"] },
228
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
229
+ policy: { maxTurns: 30 },
115
230
  },
116
231
  "kimi/kimi-k2.5": {
117
- id: "kimi/kimi-k2.5",
118
- providerId: "kimi",
119
- defaultEndpointId: "kimi.openai",
232
+ id: "kimi/kimi-k2.5", providerId: "kimi", defaultEndpointId: "kimi.openai",
120
233
  contextWindow: 256_000,
121
234
  modalities: { input: ["text", "image"], output: ["text"] },
122
- tools: { supported: true },
123
- reasoning: { supported: true, preserveAcrossToolTurns: false },
235
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
236
+ policy: { maxTurns: 30 },
124
237
  },
125
238
  "kimi/kimi-k2.6": {
126
- id: "kimi/kimi-k2.6",
127
- providerId: "kimi",
128
- defaultEndpointId: "kimi.openai",
239
+ id: "kimi/kimi-k2.6", providerId: "kimi", defaultEndpointId: "kimi.openai",
129
240
  modalities: { input: ["text"], output: ["text"] },
130
- tools: { supported: true },
131
- reasoning: { supported: true, preserveAcrossToolTurns: false },
241
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
242
+ policy: { maxTurns: 35 },
132
243
  },
244
+ // ── Qwen ───────────────────────────────────────────────────────────────────
133
245
  "qwen/qwen-max": {
134
- id: "qwen/qwen-max",
135
- providerId: "qwen",
136
- defaultEndpointId: "qwen.dashscope",
246
+ id: "qwen/qwen-max", providerId: "qwen", defaultEndpointId: "qwen.dashscope",
137
247
  contextWindow: 32_768,
138
248
  modalities: { input: ["text", "image"], output: ["text"] },
139
- tools: { supported: true },
140
- reasoning: { supported: false, preserveAcrossToolTurns: false },
249
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
250
+ policy: { maxTurns: 25 },
141
251
  },
142
252
  "qwen/qwen-plus": {
143
- id: "qwen/qwen-plus",
144
- providerId: "qwen",
145
- defaultEndpointId: "qwen.dashscope",
253
+ id: "qwen/qwen-plus", providerId: "qwen", defaultEndpointId: "qwen.dashscope",
146
254
  contextWindow: 131_072,
147
255
  modalities: { input: ["text", "image"], output: ["text"] },
148
- tools: { supported: true },
149
- reasoning: { supported: false, preserveAcrossToolTurns: false },
256
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
257
+ policy: { maxTurns: 20 },
150
258
  },
151
259
  "qwen/qwq-plus": {
152
- id: "qwen/qwq-plus",
153
- providerId: "qwen",
154
- defaultEndpointId: "qwen.dashscope",
260
+ id: "qwen/qwq-plus", providerId: "qwen", defaultEndpointId: "qwen.dashscope",
155
261
  contextWindow: 131_072,
156
262
  modalities: { input: ["text"], output: ["text"] },
157
- tools: { supported: true },
158
- reasoning: { supported: true, preserveAcrossToolTurns: false },
263
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
264
+ policy: { maxTurns: 40 },
159
265
  },
160
- "gemini/gemini-2.0-flash": {
161
- id: "gemini/gemini-2.0-flash",
162
- providerId: "gemini",
163
- defaultEndpointId: "gemini.google",
266
+ "qwen/qwen3-235b-a22b": {
267
+ id: "qwen/qwen3-235b-a22b", providerId: "qwen", defaultEndpointId: "qwen.dashscope",
268
+ contextWindow: 131_072,
269
+ modalities: { input: ["text"], output: ["text"] },
270
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
271
+ policy: { maxTurns: 35 },
272
+ },
273
+ "qwen/qwen3-72b": {
274
+ id: "qwen/qwen3-72b", providerId: "qwen", defaultEndpointId: "qwen.dashscope",
275
+ contextWindow: 131_072,
276
+ modalities: { input: ["text"], output: ["text"] },
277
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
278
+ policy: { maxTurns: 25 },
279
+ },
280
+ "qwen/qwen3-32b": {
281
+ id: "qwen/qwen3-32b", providerId: "qwen", defaultEndpointId: "qwen.dashscope",
282
+ contextWindow: 131_072,
283
+ modalities: { input: ["text"], output: ["text"] },
284
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
285
+ policy: { maxTurns: 20 },
286
+ },
287
+ // ── Gemini ─────────────────────────────────────────────────────────────────
288
+ "gemini/gemini-2.5-pro": {
289
+ id: "gemini/gemini-2.5-pro", providerId: "gemini", defaultEndpointId: "gemini.google",
164
290
  contextWindow: 1_048_576,
165
291
  modalities: { input: ["text", "image", "audio"], output: ["text"] },
166
- tools: { supported: true },
167
- reasoning: { supported: false, preserveAcrossToolTurns: false },
292
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
293
+ policy: { maxTurns: 35 },
168
294
  },
169
295
  "gemini/gemini-2.5-flash": {
170
- id: "gemini/gemini-2.5-flash",
171
- providerId: "gemini",
172
- defaultEndpointId: "gemini.google",
296
+ id: "gemini/gemini-2.5-flash", providerId: "gemini", defaultEndpointId: "gemini.google",
173
297
  contextWindow: 1_048_576,
174
298
  modalities: { input: ["text", "image", "audio"], output: ["text"] },
175
- tools: { supported: true },
176
- reasoning: { supported: true, preserveAcrossToolTurns: false },
299
+ tools: { supported: true }, reasoning: { supported: true, preserveAcrossToolTurns: false },
300
+ policy: { maxTurns: 20 },
177
301
  },
178
- "gemini/gemini-2.5-pro": {
179
- id: "gemini/gemini-2.5-pro",
180
- providerId: "gemini",
181
- defaultEndpointId: "gemini.google",
302
+ "gemini/gemini-2.0-flash": {
303
+ id: "gemini/gemini-2.0-flash", providerId: "gemini", defaultEndpointId: "gemini.google",
182
304
  contextWindow: 1_048_576,
183
305
  modalities: { input: ["text", "image", "audio"], output: ["text"] },
184
- tools: { supported: true },
185
- reasoning: { supported: true, preserveAcrossToolTurns: false },
306
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
307
+ policy: { maxTurns: 15 },
308
+ },
309
+ "gemini/gemini-2.0-flash-lite": {
310
+ id: "gemini/gemini-2.0-flash-lite", providerId: "gemini", defaultEndpointId: "gemini.google",
311
+ contextWindow: 1_048_576,
312
+ modalities: { input: ["text", "image", "audio"], output: ["text"] },
313
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
314
+ policy: { maxTurns: 10 },
315
+ },
316
+ "gemini/gemini-1.5-pro": {
317
+ id: "gemini/gemini-1.5-pro", providerId: "gemini", defaultEndpointId: "gemini.google",
318
+ contextWindow: 2_097_152,
319
+ modalities: { input: ["text", "image", "audio"], output: ["text"] },
320
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
321
+ policy: { maxTurns: 30 },
322
+ },
323
+ "gemini/gemini-1.5-flash": {
324
+ id: "gemini/gemini-1.5-flash", providerId: "gemini", defaultEndpointId: "gemini.google",
325
+ contextWindow: 1_048_576,
326
+ modalities: { input: ["text", "image", "audio"], output: ["text"] },
327
+ tools: { supported: true }, reasoning: { supported: false, preserveAcrossToolTurns: false },
328
+ policy: { maxTurns: 15 },
186
329
  },
187
330
  };
188
331
  export function getModelProfile(id) {
@@ -1,5 +1,5 @@
1
1
  import OpenAI from "openai";
2
- import type { LLMProvider, Message, RenderedContext, StreamEvent, ToolSchema } from "../types.js";
2
+ import type { LLMProvider, Message, RenderedContext, StreamEvent, ToolSchema, RuntimePolicy } from "../types.js";
3
3
  import { CircuitBreaker } from "./base.js";
4
4
  import { OpenAIChatAdapter } from "./openai-chat.js";
5
5
  export declare class QwenProvider implements LLMProvider {
@@ -13,6 +13,7 @@ export declare class QwenProvider implements LLMProvider {
13
13
  maxRetries: number;
14
14
  baseDelay: number;
15
15
  }, baseURL?: string);
16
+ runtimePolicy(): RuntimePolicy;
16
17
  complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<Message>;
17
18
  stream(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): AsyncIterable<StreamEvent>;
18
19
  private thinkingExtraBody;
@@ -4,6 +4,18 @@ import { CircuitBreaker, omitExtensionKeys } from "./base.js";
4
4
  import { OpenAIChatAdapter } from "./openai-chat.js";
5
5
  import { endpointProfiles } from "./profiles.js";
6
6
  const QWEN_BASE = endpointProfiles["qwen.dashscope"].baseURL;
7
+ const QWEN_POLICIES = {
8
+ "qwen-max": { maxTurns: 25 },
9
+ "qwen-plus": { maxTurns: 20 },
10
+ "qwen-turbo": { maxTurns: 15 },
11
+ "qwq-plus": { maxTurns: 40 },
12
+ "qwq-32b": { maxTurns: 35 },
13
+ "qwen3-235b-a22b": { maxTurns: 35 },
14
+ "qwen3-72b": { maxTurns: 25 },
15
+ "qwen3-32b": { maxTurns: 20 },
16
+ "qwen3-14b": { maxTurns: 15 },
17
+ "qwen3-8b": { maxTurns: 15 },
18
+ };
7
19
  export class QwenProvider {
8
20
  model;
9
21
  client;
@@ -18,6 +30,9 @@ export class QwenProvider {
18
30
  this.maxRetries = retry.maxRetries;
19
31
  this.baseDelay = retry.baseDelay;
20
32
  }
33
+ runtimePolicy() {
34
+ return QWEN_POLICIES[this.model] ?? {};
35
+ }
21
36
  async complete(context, tools, extensions) {
22
37
  if (this.circuit.isOpen())
23
38
  throw new Error("Circuit breaker open");
@@ -0,0 +1,18 @@
1
+ export interface CredentialVault {
2
+ get(key: string): Promise<string | undefined>;
3
+ }
4
+ export declare class EnvCredentialVault implements CredentialVault {
5
+ get(key: string): Promise<string | undefined>;
6
+ }
7
+ export declare class InMemoryCredentialVault implements CredentialVault {
8
+ private store;
9
+ constructor(init?: Record<string, string>);
10
+ set(key: string, value: string): this;
11
+ get(key: string): Promise<string | undefined>;
12
+ }
13
+ /** Tries each vault in order, returning the first defined value. */
14
+ export declare class ChainedCredentialVault implements CredentialVault {
15
+ private readonly vaults;
16
+ constructor(vaults: CredentialVault[]);
17
+ get(key: string): Promise<string | undefined>;
18
+ }
@@ -0,0 +1,33 @@
1
+ export class EnvCredentialVault {
2
+ async get(key) {
3
+ return process.env[key];
4
+ }
5
+ }
6
+ export class InMemoryCredentialVault {
7
+ store;
8
+ constructor(init) {
9
+ this.store = new Map(Object.entries(init ?? {}));
10
+ }
11
+ set(key, value) {
12
+ this.store.set(key, value);
13
+ return this;
14
+ }
15
+ async get(key) {
16
+ return this.store.get(key);
17
+ }
18
+ }
19
+ /** Tries each vault in order, returning the first defined value. */
20
+ export class ChainedCredentialVault {
21
+ vaults;
22
+ constructor(vaults) {
23
+ this.vaults = vaults;
24
+ }
25
+ async get(key) {
26
+ for (const vault of this.vaults) {
27
+ const val = await vault.get(key);
28
+ if (val !== undefined)
29
+ return val;
30
+ }
31
+ return undefined;
32
+ }
33
+ }
@@ -0,0 +1,38 @@
1
+ import type { ToolCall, ToolSchema, StreamEvent, ToolSuspendEvent } from "../types.js";
2
+ import type { RegisteredTool } from "../tools/index.js";
3
+ import type { DreamStore } from "../memory/protocols.js";
4
+ import type { KnowledgeSource } from "../knowledge/source.js";
5
+ export interface RunContext {
6
+ agentId?: string;
7
+ skillDir?: string;
8
+ dreamStore?: DreamStore;
9
+ knowledgeSource?: KnowledgeSource;
10
+ governance?: {
11
+ setTime?(nowMs: bigint): void;
12
+ evaluate(name: string, argsJson: string): {
13
+ kind: string;
14
+ reason?: string;
15
+ retryAfterMs?: number;
16
+ };
17
+ };
18
+ onToolSuspend?: (event: ToolSuspendEvent) => Promise<unknown> | unknown;
19
+ }
20
+ export interface ExecutionPlane {
21
+ register(...tools: RegisteredTool[]): this;
22
+ unregister(name: string): this;
23
+ schemas(): ToolSchema[];
24
+ /**
25
+ * Execute a batch of calls. Yields StreamEvents during execution.
26
+ * Guarantees exactly one `tool_result` event per call in `calls`.
27
+ * The runner collects those events to build ToolResult[] for the kernel.
28
+ */
29
+ executeAll(calls: ToolCall[], ctx: RunContext): AsyncIterable<StreamEvent>;
30
+ }
31
+ export declare class LocalExecutionPlane implements ExecutionPlane {
32
+ private tools;
33
+ register(...tools: RegisteredTool[]): this;
34
+ unregister(name: string): this;
35
+ schemas(): ToolSchema[];
36
+ executeAll(calls: ToolCall[], ctx: RunContext): AsyncIterable<StreamEvent>;
37
+ private executeSingle;
38
+ }
@@ -0,0 +1,146 @@
1
+ import { isAsyncIterable, normalizeToolChunk, toolChunkText, validateToolArguments } from "../tools/index.js";
2
+ import { readSkillFile } from "../skills/loader.js";
3
+ export class LocalExecutionPlane {
4
+ tools = new Map();
5
+ register(...tools) {
6
+ for (const t of tools)
7
+ this.tools.set(t.schema.name, t);
8
+ return this;
9
+ }
10
+ unregister(name) {
11
+ this.tools.delete(name);
12
+ return this;
13
+ }
14
+ schemas() {
15
+ return Array.from(this.tools.values()).map(t => t.schema);
16
+ }
17
+ async *executeAll(calls, ctx) {
18
+ // Governance pass — denied calls get an immediate tool_result so the kernel always
19
+ // receives a result for every call it dispatched.
20
+ const permitted = [];
21
+ for (const c of calls) {
22
+ if (ctx.governance) {
23
+ ctx.governance.setTime?.(BigInt(Date.now()));
24
+ const v = ctx.governance.evaluate(c.name, c.arguments);
25
+ if (v.kind === "deny") {
26
+ yield { type: "error", message: `permission denied: ${c.name} — ${v.reason ?? ""}` };
27
+ yield { type: "tool_result", callId: c.id, name: c.name, content: `permission denied: ${v.reason ?? ""}`, isError: true };
28
+ continue;
29
+ }
30
+ if (v.kind === "rate_limited") {
31
+ yield { type: "error", message: `rate limited: ${c.name}` };
32
+ yield { type: "tool_result", callId: c.id, name: c.name, content: "rate limited", isError: true };
33
+ continue;
34
+ }
35
+ if (v.kind === "ask_user") {
36
+ yield { type: "permission_request", callId: c.id, toolName: c.name, arguments: c.arguments, reason: v.reason ?? "" };
37
+ yield { type: "tool_result", callId: c.id, name: c.name, content: "awaiting user approval", isError: true };
38
+ continue;
39
+ }
40
+ }
41
+ permitted.push(c);
42
+ }
43
+ const skillCalls = permitted.filter(c => c.name === "skill");
44
+ const memoryCalls = permitted.filter(c => c.name === "memory");
45
+ const knowledgeCalls = permitted.filter(c => c.name === "knowledge");
46
+ const regularCalls = permitted.filter(c => !["skill", "memory", "knowledge"].includes(c.name));
47
+ for (const c of skillCalls) {
48
+ const name = String(tryParseJson(c.arguments)?.name ?? "");
49
+ const content = ctx.skillDir ? await readSkillFile(ctx.skillDir, name) : null;
50
+ yield { type: "tool_result", callId: c.id, name: c.name, content: content ?? `Skill "${name}" not found.`, isError: !content };
51
+ }
52
+ for (const c of memoryCalls) {
53
+ const args = tryParseJson(c.arguments);
54
+ const topK = typeof args?.top_k === "number" ? args.top_k : 5;
55
+ const entries = (ctx.dreamStore && ctx.agentId)
56
+ ? await ctx.dreamStore.search(ctx.agentId, String(args?.query ?? ""), topK)
57
+ : [];
58
+ const content = entries.length
59
+ ? entries.map((e) => `[score=${e.score.toFixed(3)}] ${e.text}`).join("\n---\n")
60
+ : "No relevant memories found.";
61
+ yield { type: "tool_result", callId: c.id, name: c.name, content, isError: false };
62
+ }
63
+ for (const c of knowledgeCalls) {
64
+ const args = tryParseJson(c.arguments);
65
+ const topK = typeof args?.top_k === "number" ? args.top_k : 5;
66
+ const snippets = ctx.knowledgeSource
67
+ ? await ctx.knowledgeSource.retrieve(String(args?.query ?? ""), topK)
68
+ : [];
69
+ const content = snippets.length ? snippets.join("\n---\n") : "No relevant knowledge found.";
70
+ yield { type: "tool_result", callId: c.id, name: c.name, content, isError: false };
71
+ }
72
+ // Regular tools run concurrently; intermediate stream events (delta, suspend) are
73
+ // yielded as they arrive; the final tool_result is emitted when each call finishes.
74
+ if (regularCalls.length > 0) {
75
+ const active = regularCalls.map(call => {
76
+ const gen = this.executeSingle(call, ctx);
77
+ return { call, gen, pending: gen.next() };
78
+ });
79
+ while (active.length > 0) {
80
+ const { index, result } = await Promise.race(active.map((task, i) => task.pending.then(r => ({ index: i, result: r }))));
81
+ const task = active[index];
82
+ if (result.done) {
83
+ const r = result.value;
84
+ yield { type: "tool_result", callId: r.callId, name: task.call.name, content: r.output, isError: r.isError };
85
+ active.splice(index, 1);
86
+ continue;
87
+ }
88
+ yield result.value;
89
+ task.pending = task.gen.next();
90
+ }
91
+ }
92
+ }
93
+ async *executeSingle(call, ctx) {
94
+ const registered = this.tools.get(call.name);
95
+ if (!registered)
96
+ return { callId: call.id, output: `unknown tool: ${call.name}`, isError: true };
97
+ try {
98
+ const args = JSON.parse(call.arguments || "{}");
99
+ const err = validateToolArguments(registered.schema.parameters, args);
100
+ if (err)
101
+ return { callId: call.id, output: `invalid arguments: ${err}`, isError: true };
102
+ const output = await registered.execute(args);
103
+ if (isAsyncIterable(output)) {
104
+ let combined = "";
105
+ const iterator = output[Symbol.asyncIterator]();
106
+ let resumeValue;
107
+ while (true) {
108
+ const next = await iterator.next(resumeValue);
109
+ resumeValue = undefined;
110
+ if (next.done)
111
+ break;
112
+ const chunk = normalizeToolChunk(next.value);
113
+ if (chunk.type === "suspend") {
114
+ const event = {
115
+ type: "tool_suspend", callId: call.id, name: call.name,
116
+ suspensionId: chunk.suspensionId,
117
+ ...(chunk.payload ? { payload: chunk.payload } : {}),
118
+ };
119
+ yield event;
120
+ if (!ctx.onToolSuspend) {
121
+ return { callId: call.id, output: `tool suspended without resume handler: ${chunk.suspensionId}`, isError: true };
122
+ }
123
+ resumeValue = await ctx.onToolSuspend(event);
124
+ continue;
125
+ }
126
+ const delta = toolChunkText(next.value);
127
+ combined += delta;
128
+ yield { type: "tool_delta", callId: call.id, name: call.name, ...(delta ? { delta } : {}), chunk };
129
+ }
130
+ return { callId: call.id, output: combined, isError: false };
131
+ }
132
+ return { callId: call.id, output, isError: false };
133
+ }
134
+ catch (err) {
135
+ return { callId: call.id, output: String(err), isError: true };
136
+ }
137
+ }
138
+ }
139
+ function tryParseJson(s) {
140
+ try {
141
+ return JSON.parse(s);
142
+ }
143
+ catch {
144
+ return null;
145
+ }
146
+ }