@theokit/agents 7.4.2 → 7.5.0
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.
- package/LICENSE +201 -0
- package/dist/auth.js +72 -74
- package/dist/auth.js.map +1 -1
- package/dist/bridge.js +2 -1
- package/dist/{chunk-FJA4QQLZ.js → chunk-2BAFKRXT.js} +221 -165
- package/dist/chunk-2BAFKRXT.js.map +1 -0
- package/dist/{chunk-PHUNONZT.js → chunk-WKBZZQBO.js} +975 -445
- package/dist/chunk-WKBZZQBO.js.map +1 -0
- package/dist/chunk-Z4QWC7IK.js +7 -0
- package/dist/chunk-Z4QWC7IK.js.map +1 -0
- package/dist/client-react.js +9 -3
- package/dist/client-react.js.map +1 -1
- package/dist/client.js +2 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +365 -129
- package/dist/index.js.map +1 -1
- package/dist/interactive.js +3 -6
- package/dist/interactive.js.map +1 -1
- package/dist/persistence.js +2 -0
- package/dist/persistence.js.map +1 -1
- package/dist/pty.js +3 -7
- package/dist/pty.js.map +1 -1
- package/dist/sandbox.js +3 -26
- package/dist/sandbox.js.map +1 -1
- package/dist/testing.js +21 -3
- package/dist/testing.js.map +1 -1
- package/dist/tools.js +3 -55
- package/dist/tools.js.map +1 -1
- package/package.json +12 -12
- package/dist/chunk-FJA4QQLZ.js.map +0 -1
- package/dist/chunk-PHUNONZT.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -76,7 +76,10 @@ import {
|
|
|
76
76
|
toolRuntimeName,
|
|
77
77
|
translateSdkEvent,
|
|
78
78
|
unicodeNormalizer
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-WKBZZQBO.js";
|
|
80
|
+
import {
|
|
81
|
+
__name
|
|
82
|
+
} from "./chunk-Z4QWC7IK.js";
|
|
80
83
|
|
|
81
84
|
// src/index.ts
|
|
82
85
|
import { Agent as AgentDoSdk } from "@theokit/sdk";
|
|
@@ -84,6 +87,9 @@ import { Agent as AgentDoSdk } from "@theokit/sdk";
|
|
|
84
87
|
// src/capability/capability.ts
|
|
85
88
|
import { isDeepStrictEqual } from "util";
|
|
86
89
|
var CapabilityConflictError = class extends Error {
|
|
90
|
+
static {
|
|
91
|
+
__name(this, "CapabilityConflictError");
|
|
92
|
+
}
|
|
87
93
|
name = "CapabilityConflictError";
|
|
88
94
|
constructor(field, previous, next, capability) {
|
|
89
95
|
super(
|
|
@@ -102,14 +108,21 @@ function shapeOf(value) {
|
|
|
102
108
|
}
|
|
103
109
|
return typeof value;
|
|
104
110
|
}
|
|
111
|
+
__name(shapeOf, "shapeOf");
|
|
105
112
|
function createDraft() {
|
|
106
|
-
return {
|
|
113
|
+
return {
|
|
114
|
+
tools: [],
|
|
115
|
+
agents: {},
|
|
116
|
+
provenance: []
|
|
117
|
+
};
|
|
107
118
|
}
|
|
119
|
+
__name(createDraft, "createDraft");
|
|
108
120
|
function applyCapabilities(capabilities, draft = createDraft()) {
|
|
109
121
|
for (const c of capabilities) c.apply(draft);
|
|
110
122
|
draft.stream ??= true;
|
|
111
123
|
return draft;
|
|
112
124
|
}
|
|
125
|
+
__name(applyCapabilities, "applyCapabilities");
|
|
113
126
|
function setOnce(draft, field, value, capability) {
|
|
114
127
|
if (value === void 0) return;
|
|
115
128
|
const previous = draft[field];
|
|
@@ -117,15 +130,28 @@ function setOnce(draft, field, value, capability) {
|
|
|
117
130
|
throw new CapabilityConflictError(field, previous, value, capability);
|
|
118
131
|
}
|
|
119
132
|
draft[field] = value;
|
|
120
|
-
draft.provenance.push({
|
|
133
|
+
draft.provenance.push({
|
|
134
|
+
capability,
|
|
135
|
+
contributed: [
|
|
136
|
+
field
|
|
137
|
+
]
|
|
138
|
+
});
|
|
121
139
|
}
|
|
140
|
+
__name(setOnce, "setOnce");
|
|
122
141
|
|
|
123
142
|
// src/capability/capabilities.ts
|
|
124
143
|
function describe(value) {
|
|
125
144
|
if (value === null) return "null";
|
|
126
145
|
return Array.isArray(value) ? "array" : typeof value;
|
|
127
146
|
}
|
|
147
|
+
__name(describe, "describe");
|
|
128
148
|
var ModelCapability = class {
|
|
149
|
+
static {
|
|
150
|
+
__name(this, "ModelCapability");
|
|
151
|
+
}
|
|
152
|
+
id;
|
|
153
|
+
reasoningEffort;
|
|
154
|
+
name = "model";
|
|
129
155
|
constructor(id, reasoningEffort) {
|
|
130
156
|
this.id = id;
|
|
131
157
|
this.reasoningEffort = reasoningEffort;
|
|
@@ -134,9 +160,6 @@ var ModelCapability = class {
|
|
|
134
160
|
}
|
|
135
161
|
if (id.trim().length === 0) throw new ConfigurationError("model: id cannot be empty");
|
|
136
162
|
}
|
|
137
|
-
id;
|
|
138
|
-
reasoningEffort;
|
|
139
|
-
name = "model";
|
|
140
163
|
apply(draft) {
|
|
141
164
|
setOnce(draft, "model", this.id, this.name);
|
|
142
165
|
if (this.reasoningEffort !== void 0) {
|
|
@@ -145,6 +168,9 @@ var ModelCapability = class {
|
|
|
145
168
|
}
|
|
146
169
|
};
|
|
147
170
|
var ToolsCapability = class {
|
|
171
|
+
static {
|
|
172
|
+
__name(this, "ToolsCapability");
|
|
173
|
+
}
|
|
148
174
|
name = "tools";
|
|
149
175
|
#tools;
|
|
150
176
|
constructor(tools) {
|
|
@@ -152,10 +178,18 @@ var ToolsCapability = class {
|
|
|
152
178
|
}
|
|
153
179
|
apply(draft) {
|
|
154
180
|
draft.tools.push(...this.#tools);
|
|
155
|
-
draft.provenance.push({
|
|
181
|
+
draft.provenance.push({
|
|
182
|
+
capability: this.name,
|
|
183
|
+
contributed: [
|
|
184
|
+
"tools"
|
|
185
|
+
]
|
|
186
|
+
});
|
|
156
187
|
}
|
|
157
188
|
};
|
|
158
189
|
var SkillsCapability = class {
|
|
190
|
+
static {
|
|
191
|
+
__name(this, "SkillsCapability");
|
|
192
|
+
}
|
|
159
193
|
name = "skills";
|
|
160
194
|
#entries;
|
|
161
195
|
constructor(entries) {
|
|
@@ -170,16 +204,16 @@ var SkillsCapability = class {
|
|
|
170
204
|
continue;
|
|
171
205
|
}
|
|
172
206
|
if (typeof e !== "object" || e === null || Array.isArray(e)) {
|
|
173
|
-
throw new ConfigurationError(
|
|
174
|
-
`skills: invalid entry (${describe(e)}) \u2014 use a name or an inline skill`
|
|
175
|
-
);
|
|
207
|
+
throw new ConfigurationError(`skills: invalid entry (${describe(e)}) \u2014 use a name or an inline skill`);
|
|
176
208
|
}
|
|
177
|
-
for (const field of [
|
|
209
|
+
for (const field of [
|
|
210
|
+
"name",
|
|
211
|
+
"description",
|
|
212
|
+
"instructions"
|
|
213
|
+
]) {
|
|
178
214
|
const value = e[field];
|
|
179
215
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
180
|
-
throw new ConfigurationError(
|
|
181
|
-
`skills: inline skill without a valid \`${field}\` (${describe(value)}) \u2014 name, description and instructions are all required`
|
|
182
|
-
);
|
|
216
|
+
throw new ConfigurationError(`skills: inline skill without a valid \`${field}\` (${describe(value)}) \u2014 name, description and instructions are all required`);
|
|
183
217
|
}
|
|
184
218
|
}
|
|
185
219
|
}
|
|
@@ -198,21 +232,40 @@ var SkillsCapability = class {
|
|
|
198
232
|
// and no reference array form can express it) — revisit when one can.
|
|
199
233
|
...previous,
|
|
200
234
|
...compiled.skills,
|
|
201
|
-
enabled: [
|
|
202
|
-
|
|
235
|
+
enabled: [
|
|
236
|
+
...previous.enabled ?? [],
|
|
237
|
+
...compiled.skills.enabled ?? []
|
|
238
|
+
],
|
|
239
|
+
...previous.inline !== void 0 || compiled.skills.inline !== void 0 ? {
|
|
240
|
+
inline: [
|
|
241
|
+
...previous.inline ?? [],
|
|
242
|
+
...compiled.skills.inline ?? []
|
|
243
|
+
]
|
|
244
|
+
} : {}
|
|
203
245
|
};
|
|
204
|
-
draft.provenance.push({
|
|
246
|
+
draft.provenance.push({
|
|
247
|
+
capability: this.name,
|
|
248
|
+
contributed: [
|
|
249
|
+
"skills"
|
|
250
|
+
]
|
|
251
|
+
});
|
|
205
252
|
}
|
|
206
253
|
};
|
|
207
254
|
|
|
208
255
|
// src/capability/registry.ts
|
|
209
256
|
var UnknownCapabilityError = class extends Error {
|
|
257
|
+
static {
|
|
258
|
+
__name(this, "UnknownCapabilityError");
|
|
259
|
+
}
|
|
210
260
|
name = "UnknownCapabilityError";
|
|
211
261
|
constructor(requested, known) {
|
|
212
262
|
super(`capability "${requested}" is not registered. Known: ${known.join(", ") || "(none)"}.`);
|
|
213
263
|
}
|
|
214
264
|
};
|
|
215
265
|
var CapabilityRegistry = class {
|
|
266
|
+
static {
|
|
267
|
+
__name(this, "CapabilityRegistry");
|
|
268
|
+
}
|
|
216
269
|
#factories = /* @__PURE__ */ new Map();
|
|
217
270
|
register(name, factory) {
|
|
218
271
|
this.#factories.set(name, factory);
|
|
@@ -222,7 +275,9 @@ var CapabilityRegistry = class {
|
|
|
222
275
|
return this.#factories.has(name);
|
|
223
276
|
}
|
|
224
277
|
names() {
|
|
225
|
-
return [
|
|
278
|
+
return [
|
|
279
|
+
...this.#factories.keys()
|
|
280
|
+
];
|
|
226
281
|
}
|
|
227
282
|
resolve(name, arg) {
|
|
228
283
|
const factory = this.#factories.get(name);
|
|
@@ -231,12 +286,15 @@ var CapabilityRegistry = class {
|
|
|
231
286
|
}
|
|
232
287
|
};
|
|
233
288
|
var CapabilityPreset = class {
|
|
289
|
+
static {
|
|
290
|
+
__name(this, "CapabilityPreset");
|
|
291
|
+
}
|
|
292
|
+
name;
|
|
293
|
+
#members;
|
|
234
294
|
constructor(name, members) {
|
|
235
295
|
this.name = name;
|
|
236
296
|
this.#members = members;
|
|
237
297
|
}
|
|
238
|
-
name;
|
|
239
|
-
#members;
|
|
240
298
|
apply(draft) {
|
|
241
299
|
for (const member of this.#members) member.apply(draft);
|
|
242
300
|
}
|
|
@@ -244,120 +302,169 @@ var CapabilityPreset = class {
|
|
|
244
302
|
|
|
245
303
|
// src/capability/agent-capabilities.ts
|
|
246
304
|
var FieldCapability = class {
|
|
305
|
+
static {
|
|
306
|
+
__name(this, "FieldCapability");
|
|
307
|
+
}
|
|
308
|
+
value;
|
|
247
309
|
constructor(value) {
|
|
248
310
|
this.value = value;
|
|
249
311
|
}
|
|
250
|
-
value;
|
|
251
312
|
apply(draft) {
|
|
252
313
|
setOnce(draft, this.field, this.value, this.name);
|
|
253
314
|
}
|
|
254
315
|
};
|
|
255
316
|
var MemoryCapability = class extends FieldCapability {
|
|
317
|
+
static {
|
|
318
|
+
__name(this, "MemoryCapability");
|
|
319
|
+
}
|
|
256
320
|
name = "memory";
|
|
257
321
|
field = "memory";
|
|
258
322
|
};
|
|
259
323
|
var ContextWindowCapability = class {
|
|
260
|
-
|
|
261
|
-
this
|
|
324
|
+
static {
|
|
325
|
+
__name(this, "ContextWindowCapability");
|
|
262
326
|
}
|
|
263
327
|
options;
|
|
264
328
|
name = "context-window";
|
|
329
|
+
constructor(options) {
|
|
330
|
+
this.options = options;
|
|
331
|
+
}
|
|
265
332
|
apply(draft) {
|
|
266
333
|
setOnce(draft, "context", compileContextWindow(this.options).context, this.name);
|
|
267
334
|
}
|
|
268
335
|
};
|
|
269
336
|
var ProjectContextCapability = class extends FieldCapability {
|
|
337
|
+
static {
|
|
338
|
+
__name(this, "ProjectContextCapability");
|
|
339
|
+
}
|
|
270
340
|
name = "project-context";
|
|
271
341
|
field = "projectContext";
|
|
272
342
|
};
|
|
273
343
|
var McpServersCapability = class extends FieldCapability {
|
|
344
|
+
static {
|
|
345
|
+
__name(this, "McpServersCapability");
|
|
346
|
+
}
|
|
274
347
|
name = "mcp";
|
|
275
348
|
field = "mcpServers";
|
|
276
349
|
};
|
|
277
350
|
var GuardrailsCapability = class extends FieldCapability {
|
|
351
|
+
static {
|
|
352
|
+
__name(this, "GuardrailsCapability");
|
|
353
|
+
}
|
|
278
354
|
name = "guardrails";
|
|
279
355
|
field = "guardrails";
|
|
280
356
|
};
|
|
281
357
|
var CheckpointCapability = class {
|
|
282
|
-
|
|
283
|
-
this
|
|
358
|
+
static {
|
|
359
|
+
__name(this, "CheckpointCapability");
|
|
284
360
|
}
|
|
285
361
|
options;
|
|
286
362
|
name = "checkpoint";
|
|
363
|
+
constructor(options) {
|
|
364
|
+
this.options = options;
|
|
365
|
+
}
|
|
287
366
|
apply(draft) {
|
|
288
367
|
if (this.options !== void 0 && this.options.storage !== "filesystem") {
|
|
289
|
-
console.warn(
|
|
290
|
-
`[THEO_AGENT_CHECKPOINT_STORAGE_METADATA_ONLY] checkpoint({ storage: '${this.options.storage ?? "memory"}' }) does NOT resume across requests \u2014 only 'filesystem' selects the SDK's durable conversation store. Use checkpoint({ storage: 'filesystem' }) for cross-request resume.`
|
|
291
|
-
);
|
|
368
|
+
console.warn(`[THEO_AGENT_CHECKPOINT_STORAGE_METADATA_ONLY] checkpoint({ storage: '${this.options.storage ?? "memory"}' }) does NOT resume across requests \u2014 only 'filesystem' selects the SDK's durable conversation store. Use checkpoint({ storage: 'filesystem' }) for cross-request resume.`);
|
|
292
369
|
}
|
|
293
370
|
setOnce(draft, "checkpoint", this.options, this.name);
|
|
294
371
|
}
|
|
295
372
|
};
|
|
296
373
|
var HumanInTheLoopCapability = class extends FieldCapability {
|
|
374
|
+
static {
|
|
375
|
+
__name(this, "HumanInTheLoopCapability");
|
|
376
|
+
}
|
|
297
377
|
name = "human-in-the-loop";
|
|
298
378
|
field = "hitl";
|
|
299
379
|
};
|
|
300
380
|
var SubAgentsCapability = class {
|
|
301
|
-
|
|
302
|
-
this
|
|
381
|
+
static {
|
|
382
|
+
__name(this, "SubAgentsCapability");
|
|
303
383
|
}
|
|
304
384
|
children;
|
|
305
385
|
name = "sub-agents";
|
|
386
|
+
constructor(children) {
|
|
387
|
+
this.children = children;
|
|
388
|
+
}
|
|
306
389
|
apply(draft) {
|
|
307
390
|
for (const [name, child] of Object.entries(this.children)) {
|
|
308
391
|
if (name in draft.agents && draft.agents[name] !== child) {
|
|
309
|
-
throw new ConfigurationError(
|
|
310
|
-
`sub-agents: child "${name}" declared twice with different definitions`
|
|
311
|
-
);
|
|
392
|
+
throw new ConfigurationError(`sub-agents: child "${name}" declared twice with different definitions`);
|
|
312
393
|
}
|
|
313
394
|
draft.agents[name] = child;
|
|
314
395
|
}
|
|
315
|
-
draft.provenance.push({
|
|
396
|
+
draft.provenance.push({
|
|
397
|
+
capability: this.name,
|
|
398
|
+
contributed: [
|
|
399
|
+
"agents"
|
|
400
|
+
]
|
|
401
|
+
});
|
|
316
402
|
}
|
|
317
403
|
};
|
|
318
404
|
var SkillsOptionsCapability = class {
|
|
319
|
-
|
|
320
|
-
this
|
|
405
|
+
static {
|
|
406
|
+
__name(this, "SkillsOptionsCapability");
|
|
321
407
|
}
|
|
322
408
|
options;
|
|
323
409
|
name = "skills";
|
|
410
|
+
constructor(options) {
|
|
411
|
+
this.options = options;
|
|
412
|
+
}
|
|
324
413
|
apply(draft) {
|
|
325
414
|
setOnce(draft, "skills", compileSkills(this.options), this.name);
|
|
326
415
|
}
|
|
327
416
|
};
|
|
328
417
|
var SettingSourcesCapability = class extends FieldCapability {
|
|
418
|
+
static {
|
|
419
|
+
__name(this, "SettingSourcesCapability");
|
|
420
|
+
}
|
|
329
421
|
name = "setting-sources";
|
|
330
422
|
field = "settingSources";
|
|
331
423
|
};
|
|
332
424
|
var PluginsCapability = class extends FieldCapability {
|
|
425
|
+
static {
|
|
426
|
+
__name(this, "PluginsCapability");
|
|
427
|
+
}
|
|
333
428
|
name = "plugins";
|
|
334
429
|
field = "plugins";
|
|
335
430
|
};
|
|
336
431
|
var RunContextCapability = class extends FieldCapability {
|
|
432
|
+
static {
|
|
433
|
+
__name(this, "RunContextCapability");
|
|
434
|
+
}
|
|
337
435
|
name = "run-context";
|
|
338
436
|
field = "runContext";
|
|
339
437
|
};
|
|
340
438
|
var SkillsResolverCapability = class extends FieldCapability {
|
|
439
|
+
static {
|
|
440
|
+
__name(this, "SkillsResolverCapability");
|
|
441
|
+
}
|
|
341
442
|
name = "skills-resolver";
|
|
342
443
|
field = "skillsResolver";
|
|
343
444
|
};
|
|
344
445
|
var AgentConfigCapability = class {
|
|
446
|
+
static {
|
|
447
|
+
__name(this, "AgentConfigCapability");
|
|
448
|
+
}
|
|
449
|
+
config;
|
|
450
|
+
name = "agent-config";
|
|
345
451
|
constructor(config) {
|
|
346
452
|
this.config = config;
|
|
347
453
|
if (typeof config !== "object" || config === null) {
|
|
348
454
|
throw new ConfigurationError("agent-config: expected a configuration object");
|
|
349
455
|
}
|
|
350
|
-
for (const field of [
|
|
456
|
+
for (const field of [
|
|
457
|
+
"maxIterations",
|
|
458
|
+
"timeoutMs"
|
|
459
|
+
]) {
|
|
351
460
|
const value = config[field];
|
|
352
461
|
if (value !== void 0 && (!Number.isFinite(value) || value <= 0)) {
|
|
353
462
|
throw new ConfigurationError(`agent-config: \`${field}\` must be a positive number`);
|
|
354
463
|
}
|
|
355
464
|
}
|
|
356
465
|
}
|
|
357
|
-
config;
|
|
358
|
-
name = "agent-config";
|
|
359
466
|
apply(draft) {
|
|
360
|
-
const claimedByMainLoop = (field) => draft.provenance.some((p) => p.capability === "main-loop" && p.contributed.includes(field));
|
|
467
|
+
const claimedByMainLoop = /* @__PURE__ */ __name((field) => draft.provenance.some((p) => p.capability === "main-loop" && p.contributed.includes(field)), "claimedByMainLoop");
|
|
361
468
|
if (!claimedByMainLoop("maxIterations")) {
|
|
362
469
|
setOnce(draft, "maxIterations", this.config.maxIterations, this.name);
|
|
363
470
|
}
|
|
@@ -372,11 +479,14 @@ var AgentConfigCapability = class {
|
|
|
372
479
|
}
|
|
373
480
|
};
|
|
374
481
|
var MainLoopCapability = class {
|
|
375
|
-
|
|
376
|
-
this
|
|
482
|
+
static {
|
|
483
|
+
__name(this, "MainLoopCapability");
|
|
377
484
|
}
|
|
378
485
|
config;
|
|
379
486
|
name = "main-loop";
|
|
487
|
+
constructor(config) {
|
|
488
|
+
this.config = config;
|
|
489
|
+
}
|
|
380
490
|
apply(draft) {
|
|
381
491
|
const contributed = [];
|
|
382
492
|
if (this.config.maxIterations !== void 0) {
|
|
@@ -387,12 +497,18 @@ var MainLoopCapability = class {
|
|
|
387
497
|
draft.timeoutMs = this.config.timeoutMs;
|
|
388
498
|
contributed.push("timeoutMs");
|
|
389
499
|
}
|
|
390
|
-
if (contributed.length > 0) draft.provenance.push({
|
|
500
|
+
if (contributed.length > 0) draft.provenance.push({
|
|
501
|
+
capability: this.name,
|
|
502
|
+
contributed
|
|
503
|
+
});
|
|
391
504
|
}
|
|
392
505
|
};
|
|
393
506
|
|
|
394
507
|
// src/capability/toolbox.ts
|
|
395
508
|
var ToolboxCapability = class {
|
|
509
|
+
static {
|
|
510
|
+
__name(this, "ToolboxCapability");
|
|
511
|
+
}
|
|
396
512
|
name = "toolbox";
|
|
397
513
|
#instance;
|
|
398
514
|
#declarations;
|
|
@@ -403,15 +519,11 @@ var ToolboxCapability = class {
|
|
|
403
519
|
}
|
|
404
520
|
const declared = options.tools ?? instance.constructor.tools;
|
|
405
521
|
if (declared === void 0 || declared.length === 0) {
|
|
406
|
-
throw new ConfigurationError(
|
|
407
|
-
`toolbox: ${instance.constructor.name} declares no tools \u2014 use \`static tools = [...]\` or the \`tools\` option`
|
|
408
|
-
);
|
|
522
|
+
throw new ConfigurationError(`toolbox: ${instance.constructor.name} declares no tools \u2014 use \`static tools = [...]\` or the \`tools\` option`);
|
|
409
523
|
}
|
|
410
524
|
for (const tool of declared) {
|
|
411
525
|
if (typeof instance[tool.method] !== "function") {
|
|
412
|
-
throw new ConfigurationError(
|
|
413
|
-
`toolbox: ${instance.constructor.name}.${tool.method} is not a method (tool "${tool.name}")`
|
|
414
|
-
);
|
|
526
|
+
throw new ConfigurationError(`toolbox: ${instance.constructor.name}.${tool.method} is not a method (tool "${tool.name}")`);
|
|
415
527
|
}
|
|
416
528
|
}
|
|
417
529
|
this.#instance = instance;
|
|
@@ -420,15 +532,15 @@ var ToolboxCapability = class {
|
|
|
420
532
|
for (const tool of declared) toolRuntimeName(this.#namespace, tool.name);
|
|
421
533
|
}
|
|
422
534
|
/**
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
535
|
+
* The single derivation of this toolbox (M55). Both compilers below consume THIS object, so the
|
|
536
|
+
* tool registry and the HITL gate map cannot disagree on a name — the property is structural, not
|
|
537
|
+
* a convention repeated in two loops. That repetition is precisely how the two drifted apart in
|
|
538
|
+
* #145: the tool became `ns_tool` while its gate stayed `ns.tool`, silently ungating it.
|
|
539
|
+
*
|
|
540
|
+
* Same technique the `opencode` harness uses for the analogous tool↔permission coupling, where
|
|
541
|
+
* `Permission.visibleTools` filters the tool record itself rather than keeping a parallel map
|
|
542
|
+
* ("so the two cannot drift" — `permission/index.ts`).
|
|
543
|
+
*/
|
|
432
544
|
#walk() {
|
|
433
545
|
return {
|
|
434
546
|
// `constructor` is typed `Function` by lib.d.ts; here it is used purely as an IDENTITY key
|
|
@@ -443,48 +555,74 @@ var ToolboxCapability = class {
|
|
|
443
555
|
approval: tool.approval,
|
|
444
556
|
trace: tool.trace ?? false,
|
|
445
557
|
audit: tool.audit ?? false,
|
|
446
|
-
...tool.hitl !== void 0 ? {
|
|
558
|
+
...tool.hitl !== void 0 ? {
|
|
559
|
+
hitl: tool.hitl
|
|
560
|
+
} : {}
|
|
447
561
|
}))
|
|
448
562
|
};
|
|
449
563
|
}
|
|
450
564
|
/**
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
565
|
+
* M56 — the public `compile()` is GONE. It had zero callers anywhere in the monorepo and was kept
|
|
566
|
+
* only because deleting a public method is breaking; that concession is exactly the dead surface
|
|
567
|
+
* M55 set out to remove, preserved inside the milestone that removed it. `apply()` is the one path.
|
|
568
|
+
*/
|
|
455
569
|
apply(draft) {
|
|
456
570
|
const walk = this.#walk();
|
|
457
|
-
draft.tools.push(...compileTools([
|
|
458
|
-
|
|
459
|
-
|
|
571
|
+
draft.tools.push(...compileTools([
|
|
572
|
+
walk
|
|
573
|
+
], /* @__PURE__ */ new Map([
|
|
574
|
+
[
|
|
575
|
+
walk.class,
|
|
576
|
+
this.#instance
|
|
577
|
+
]
|
|
578
|
+
])));
|
|
579
|
+
draft.provenance.push({
|
|
580
|
+
capability: this.name,
|
|
581
|
+
contributed: [
|
|
582
|
+
"tools"
|
|
583
|
+
]
|
|
584
|
+
});
|
|
585
|
+
const gates = compileHitlGates([
|
|
586
|
+
walk
|
|
587
|
+
]);
|
|
460
588
|
if (gates.size === 0) return;
|
|
461
589
|
draft.hitl ??= /* @__PURE__ */ new Map();
|
|
462
590
|
for (const [key, options] of gates) draft.hitl.set(key, options);
|
|
463
|
-
draft.provenance.push({
|
|
591
|
+
draft.provenance.push({
|
|
592
|
+
capability: this.name,
|
|
593
|
+
contributed: [
|
|
594
|
+
"hitl"
|
|
595
|
+
]
|
|
596
|
+
});
|
|
464
597
|
}
|
|
465
598
|
};
|
|
466
599
|
|
|
467
600
|
// src/capability/toolset.ts
|
|
468
601
|
import { TheokitAgentError } from "@theokit/sdk/errors";
|
|
469
602
|
var ToolsetError = class extends TheokitAgentError {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.code = code;
|
|
603
|
+
static {
|
|
604
|
+
__name(this, "ToolsetError");
|
|
473
605
|
}
|
|
474
606
|
code;
|
|
475
607
|
name = "ToolsetError";
|
|
608
|
+
constructor(message, code) {
|
|
609
|
+
super(message), this.code = code;
|
|
610
|
+
}
|
|
476
611
|
};
|
|
477
612
|
var Toolset = class _Toolset {
|
|
613
|
+
static {
|
|
614
|
+
__name(this, "Toolset");
|
|
615
|
+
}
|
|
478
616
|
#byName;
|
|
479
617
|
constructor(byName) {
|
|
480
618
|
this.#byName = byName;
|
|
481
619
|
Object.freeze(this);
|
|
482
620
|
}
|
|
483
621
|
/**
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
622
|
+
* Builds from tools that are already instantiated. Fails loud on a duplicate name **at construction**
|
|
623
|
+
* — not at resolution: a descriptor with two tools of the same name is wrong the moment it is
|
|
624
|
+
* written, and deferring the error to the first `resolve` hides half the cases.
|
|
625
|
+
*/
|
|
488
626
|
static from(tools) {
|
|
489
627
|
const byName = /* @__PURE__ */ new Map();
|
|
490
628
|
for (const tool of tools) {
|
|
@@ -504,9 +642,9 @@ var Toolset = class _Toolset {
|
|
|
504
642
|
return tool;
|
|
505
643
|
}
|
|
506
644
|
/**
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
645
|
+
* Resolves a whitelist. Fails loud on an unknown name **and** on a duplicate within the list itself:
|
|
646
|
+
* a team never silently grants a tool the role did not declare, nor silently drops one it did.
|
|
647
|
+
*/
|
|
510
648
|
resolve(names) {
|
|
511
649
|
const seen = /* @__PURE__ */ new Set();
|
|
512
650
|
return names.map((name) => {
|
|
@@ -519,11 +657,15 @@ var Toolset = class _Toolset {
|
|
|
519
657
|
}
|
|
520
658
|
/** The known names, in registration order. */
|
|
521
659
|
names() {
|
|
522
|
-
return [
|
|
660
|
+
return [
|
|
661
|
+
...this.#byName.keys()
|
|
662
|
+
];
|
|
523
663
|
}
|
|
524
664
|
/** All the tools, in registration order. */
|
|
525
665
|
all() {
|
|
526
|
-
return [
|
|
666
|
+
return [
|
|
667
|
+
...this.#byName.values()
|
|
668
|
+
];
|
|
527
669
|
}
|
|
528
670
|
};
|
|
529
671
|
|
|
@@ -531,6 +673,7 @@ var Toolset = class _Toolset {
|
|
|
531
673
|
function trimTrailingSlash(url) {
|
|
532
674
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
533
675
|
}
|
|
676
|
+
__name(trimTrailingSlash, "trimTrailingSlash");
|
|
534
677
|
function buildAgentCard(entry, options) {
|
|
535
678
|
const base = trimTrailingSlash(options.baseUrl);
|
|
536
679
|
return {
|
|
@@ -543,14 +686,24 @@ function buildAgentCard(entry, options) {
|
|
|
543
686
|
pushNotifications: false,
|
|
544
687
|
stateTransitionHistory: false
|
|
545
688
|
},
|
|
546
|
-
defaultInputModes: [
|
|
547
|
-
|
|
548
|
-
|
|
689
|
+
defaultInputModes: [
|
|
690
|
+
"text"
|
|
691
|
+
],
|
|
692
|
+
defaultOutputModes: [
|
|
693
|
+
"text"
|
|
694
|
+
],
|
|
695
|
+
skills: entry.tools.map((t) => ({
|
|
696
|
+
id: t.name,
|
|
697
|
+
name: t.name,
|
|
698
|
+
description: t.description
|
|
699
|
+
}))
|
|
549
700
|
};
|
|
550
701
|
}
|
|
702
|
+
__name(buildAgentCard, "buildAgentCard");
|
|
551
703
|
function wellKnownCardPath(agentName) {
|
|
552
704
|
return `/.well-known/${agentName}/agent-card.json`;
|
|
553
705
|
}
|
|
706
|
+
__name(wellKnownCardPath, "wellKnownCardPath");
|
|
554
707
|
|
|
555
708
|
// src/a2a/mcp-server-manifest.ts
|
|
556
709
|
var MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
@@ -558,20 +711,33 @@ function buildMcpToolDescriptors(entry) {
|
|
|
558
711
|
return entry.tools.map((t) => ({
|
|
559
712
|
name: t.name,
|
|
560
713
|
description: t.description,
|
|
561
|
-
inputSchema: {
|
|
714
|
+
inputSchema: {
|
|
715
|
+
type: "object",
|
|
716
|
+
properties: {}
|
|
717
|
+
}
|
|
562
718
|
}));
|
|
563
719
|
}
|
|
720
|
+
__name(buildMcpToolDescriptors, "buildMcpToolDescriptors");
|
|
564
721
|
function mcpServerInfo(entry) {
|
|
565
|
-
return {
|
|
722
|
+
return {
|
|
723
|
+
name: entry.name,
|
|
724
|
+
version: "1.0",
|
|
725
|
+
protocolVersion: MCP_PROTOCOL_VERSION
|
|
726
|
+
};
|
|
566
727
|
}
|
|
728
|
+
__name(mcpServerInfo, "mcpServerInfo");
|
|
567
729
|
|
|
568
730
|
// src/a2a/a2a-client.ts
|
|
569
731
|
function buildHeaders(config) {
|
|
570
|
-
const headers = {
|
|
732
|
+
const headers = {
|
|
733
|
+
"content-type": "application/json",
|
|
734
|
+
...config.headers
|
|
735
|
+
};
|
|
571
736
|
if (config.auth?.bearer) headers.authorization = `Bearer ${config.auth.bearer}`;
|
|
572
737
|
if (config.auth?.apiKey) headers[config.auth.apiKey.header] = config.auth.apiKey.value;
|
|
573
738
|
return headers;
|
|
574
739
|
}
|
|
740
|
+
__name(buildHeaders, "buildHeaders");
|
|
575
741
|
function createA2ATool(config) {
|
|
576
742
|
const doFetch = config.fetchImpl ?? fetch;
|
|
577
743
|
return {
|
|
@@ -579,24 +745,34 @@ function createA2ATool(config) {
|
|
|
579
745
|
description: config.description,
|
|
580
746
|
inputSchema: {
|
|
581
747
|
type: "object",
|
|
582
|
-
properties: {
|
|
583
|
-
|
|
748
|
+
properties: {
|
|
749
|
+
message: {
|
|
750
|
+
type: "string",
|
|
751
|
+
description: "The message to send to the remote agent."
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
required: [
|
|
755
|
+
"message"
|
|
756
|
+
]
|
|
584
757
|
},
|
|
585
|
-
handler: async (input) => {
|
|
758
|
+
handler: /* @__PURE__ */ __name(async (input) => {
|
|
586
759
|
const message = typeof input.message === "string" ? input.message : "";
|
|
587
760
|
const res = await doFetch(config.url, {
|
|
588
761
|
method: "POST",
|
|
589
762
|
headers: buildHeaders(config),
|
|
590
|
-
body: JSON.stringify({
|
|
763
|
+
body: JSON.stringify({
|
|
764
|
+
message
|
|
765
|
+
})
|
|
591
766
|
});
|
|
592
767
|
if (!res.ok) {
|
|
593
768
|
throw new Error(`A2A call to "${config.name}" failed: ${res.status} ${res.statusText}`);
|
|
594
769
|
}
|
|
595
770
|
const data = await res.json();
|
|
596
771
|
return data.response ?? data.text ?? "";
|
|
597
|
-
}
|
|
772
|
+
}, "handler")
|
|
598
773
|
};
|
|
599
774
|
}
|
|
775
|
+
__name(createA2ATool, "createA2ATool");
|
|
600
776
|
|
|
601
777
|
// src/conversation-scope.ts
|
|
602
778
|
var SEPARATOR = "/";
|
|
@@ -605,14 +781,19 @@ function deriveConversationId(resource, thread) {
|
|
|
605
781
|
if (!thread) throw new Error("[@theokit/agents] deriveConversationId: thread must be non-empty");
|
|
606
782
|
return `${encodeURIComponent(resource)}${SEPARATOR}${encodeURIComponent(thread)}`;
|
|
607
783
|
}
|
|
784
|
+
__name(deriveConversationId, "deriveConversationId");
|
|
608
785
|
function parseConversationId(id) {
|
|
609
786
|
const idx = id.indexOf(SEPARATOR);
|
|
610
787
|
if (idx <= 0 || idx >= id.length - 1) return null;
|
|
611
788
|
const resource = decodeURIComponent(id.slice(0, idx));
|
|
612
789
|
const thread = decodeURIComponent(id.slice(idx + 1));
|
|
613
790
|
if (!resource || !thread) return null;
|
|
614
|
-
return {
|
|
791
|
+
return {
|
|
792
|
+
resource,
|
|
793
|
+
thread
|
|
794
|
+
};
|
|
615
795
|
}
|
|
796
|
+
__name(parseConversationId, "parseConversationId");
|
|
616
797
|
|
|
617
798
|
// src/skills-resolver.ts
|
|
618
799
|
async function resolveEnabledSkills(selection, ctx) {
|
|
@@ -628,15 +809,22 @@ async function resolveEnabledSkills(selection, ctx) {
|
|
|
628
809
|
if (!names.every((n) => typeof n === "string" && n.trim().length > 0)) {
|
|
629
810
|
throw new Error("[@theokit/agents] skills resolver must return non-empty skill NAME strings");
|
|
630
811
|
}
|
|
631
|
-
return [
|
|
812
|
+
return [
|
|
813
|
+
...names
|
|
814
|
+
];
|
|
632
815
|
}
|
|
816
|
+
__name(resolveEnabledSkills, "resolveEnabledSkills");
|
|
633
817
|
|
|
634
818
|
// src/acp/protocol.ts
|
|
635
819
|
function encodeAcpMessage(message) {
|
|
636
820
|
return `${JSON.stringify(message)}
|
|
637
821
|
`;
|
|
638
822
|
}
|
|
823
|
+
__name(encodeAcpMessage, "encodeAcpMessage");
|
|
639
824
|
var AcpMessageDecoder = class {
|
|
825
|
+
static {
|
|
826
|
+
__name(this, "AcpMessageDecoder");
|
|
827
|
+
}
|
|
640
828
|
buffer = "";
|
|
641
829
|
/** Feed a chunk; returns the messages completed by this chunk (possibly empty). */
|
|
642
830
|
push(chunk) {
|
|
@@ -650,7 +838,9 @@ var AcpMessageDecoder = class {
|
|
|
650
838
|
try {
|
|
651
839
|
messages.push(JSON.parse(line));
|
|
652
840
|
} catch (cause) {
|
|
653
|
-
throw new Error(`[@theokit/agents] ACP decode failed on line: ${line}`, {
|
|
841
|
+
throw new Error(`[@theokit/agents] ACP decode failed on line: ${line}`, {
|
|
842
|
+
cause
|
|
843
|
+
});
|
|
654
844
|
}
|
|
655
845
|
}
|
|
656
846
|
newlineIndex = this.buffer.indexOf("\n");
|
|
@@ -663,10 +853,20 @@ var AcpMessageDecoder = class {
|
|
|
663
853
|
function isResponse(m) {
|
|
664
854
|
return typeof m.id === "number" && ("result" in m || "error" in m) && !("method" in m);
|
|
665
855
|
}
|
|
856
|
+
__name(isResponse, "isResponse");
|
|
666
857
|
function isServerRequest(m) {
|
|
667
858
|
return typeof m.method === "string" && typeof m.id === "number";
|
|
668
859
|
}
|
|
860
|
+
__name(isServerRequest, "isServerRequest");
|
|
669
861
|
var AcpClient = class {
|
|
862
|
+
static {
|
|
863
|
+
__name(this, "AcpClient");
|
|
864
|
+
}
|
|
865
|
+
transport;
|
|
866
|
+
nextId = 1;
|
|
867
|
+
pending = /* @__PURE__ */ new Map();
|
|
868
|
+
handlers = /* @__PURE__ */ new Map();
|
|
869
|
+
decoder = new AcpMessageDecoder();
|
|
670
870
|
constructor(transport) {
|
|
671
871
|
this.transport = transport;
|
|
672
872
|
transport.subscribe((chunk) => {
|
|
@@ -675,17 +875,20 @@ var AcpClient = class {
|
|
|
675
875
|
}
|
|
676
876
|
});
|
|
677
877
|
}
|
|
678
|
-
transport;
|
|
679
|
-
nextId = 1;
|
|
680
|
-
pending = /* @__PURE__ */ new Map();
|
|
681
|
-
handlers = /* @__PURE__ */ new Map();
|
|
682
|
-
decoder = new AcpMessageDecoder();
|
|
683
878
|
/** Send a JSON-RPC request and resolve with its `result` (or reject on `error`). */
|
|
684
879
|
request(method, params) {
|
|
685
880
|
const id = this.nextId++;
|
|
686
881
|
return new Promise((resolve, reject) => {
|
|
687
|
-
this.pending.set(id, {
|
|
688
|
-
|
|
882
|
+
this.pending.set(id, {
|
|
883
|
+
resolve,
|
|
884
|
+
reject
|
|
885
|
+
});
|
|
886
|
+
this.transport.send(encodeAcpMessage({
|
|
887
|
+
jsonrpc: "2.0",
|
|
888
|
+
id,
|
|
889
|
+
method,
|
|
890
|
+
params
|
|
891
|
+
}));
|
|
689
892
|
});
|
|
690
893
|
}
|
|
691
894
|
/** Register a handler for a server→client request method (e.g. `session/request_permission`). */
|
|
@@ -708,22 +911,32 @@ var AcpClient = class {
|
|
|
708
911
|
async handleServerRequest(req) {
|
|
709
912
|
const handler = this.handlers.get(req.method);
|
|
710
913
|
if (!handler) {
|
|
711
|
-
this.transport.send(
|
|
712
|
-
|
|
713
|
-
|
|
914
|
+
this.transport.send(encodeAcpMessage({
|
|
915
|
+
jsonrpc: "2.0",
|
|
916
|
+
id: req.id,
|
|
917
|
+
error: {
|
|
918
|
+
code: -32601,
|
|
919
|
+
message: `No handler: ${req.method}`
|
|
920
|
+
}
|
|
921
|
+
}));
|
|
714
922
|
return;
|
|
715
923
|
}
|
|
716
924
|
try {
|
|
717
925
|
const result = await handler(req.params);
|
|
718
|
-
this.transport.send(encodeAcpMessage({
|
|
926
|
+
this.transport.send(encodeAcpMessage({
|
|
927
|
+
jsonrpc: "2.0",
|
|
928
|
+
id: req.id,
|
|
929
|
+
result
|
|
930
|
+
}));
|
|
719
931
|
} catch (err) {
|
|
720
|
-
this.transport.send(
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
932
|
+
this.transport.send(encodeAcpMessage({
|
|
933
|
+
jsonrpc: "2.0",
|
|
934
|
+
id: req.id,
|
|
935
|
+
error: {
|
|
936
|
+
code: -32603,
|
|
937
|
+
message: err instanceof Error ? err.message : "handler failed"
|
|
938
|
+
}
|
|
939
|
+
}));
|
|
727
940
|
}
|
|
728
941
|
}
|
|
729
942
|
};
|
|
@@ -733,12 +946,7 @@ import { Squad, Tool, Provider } from "@theokit/sdk";
|
|
|
733
946
|
import { setDiagnosticsSink } from "@theokit/sdk";
|
|
734
947
|
import { SubAgent } from "@theokit/sdk/a2a";
|
|
735
948
|
import { assertNoSymlinkEscape, isForbiddenPath, safePathJoin } from "@theokit/sdk/path-safety";
|
|
736
|
-
import {
|
|
737
|
-
CONTEXT_WINDOW_FLOOR,
|
|
738
|
-
CONTEXT_WINDOW_MARGIN,
|
|
739
|
-
ContextWindowMarginError,
|
|
740
|
-
resolveEffectiveContextWindow
|
|
741
|
-
} from "@theokit/sdk/compaction";
|
|
949
|
+
import { CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN, ContextWindowMarginError, resolveEffectiveContextWindow } from "@theokit/sdk/compaction";
|
|
742
950
|
export * from "@theokit/sdk/errors";
|
|
743
951
|
export * from "@theokit/sdk/retry";
|
|
744
952
|
export * from "@theokit/sdk/concurrency";
|
|
@@ -749,10 +957,11 @@ import { BudgetExceededError as BudgetExceededError2 } from "@theokit/sdk/errors
|
|
|
749
957
|
|
|
750
958
|
// src/in-process-turn.ts
|
|
751
959
|
var InProcessApprovalRequiredError = class extends Error {
|
|
960
|
+
static {
|
|
961
|
+
__name(this, "InProcessApprovalRequiredError");
|
|
962
|
+
}
|
|
752
963
|
constructor(toolNames) {
|
|
753
|
-
super(
|
|
754
|
-
`Agent has HITL-gated tool(s) [${toolNames.join(", ")}] but no \`awaitApproval\` resolver was supplied to streamAgentTurnInProcess. In-process runs must resolve approvals inline \u2014 pass awaitApproval, or remove the gate. Refused (fail-closed).`
|
|
755
|
-
);
|
|
964
|
+
super(`Agent has HITL-gated tool(s) [${toolNames.join(", ")}] but no \`awaitApproval\` resolver was supplied to streamAgentTurnInProcess. In-process runs must resolve approvals inline \u2014 pass awaitApproval, or remove the gate. Refused (fail-closed).`);
|
|
756
965
|
this.name = "InProcessApprovalRequiredError";
|
|
757
966
|
}
|
|
758
967
|
};
|
|
@@ -762,38 +971,65 @@ function postureResolver(posturePolicy) {
|
|
|
762
971
|
case "interactive":
|
|
763
972
|
return posturePolicy.awaitApproval;
|
|
764
973
|
case "auto-approve":
|
|
765
|
-
return () => Promise.resolve({
|
|
974
|
+
return () => Promise.resolve({
|
|
975
|
+
approved: true,
|
|
976
|
+
reason: posturePolicy.reason
|
|
977
|
+
});
|
|
766
978
|
case "auto-reject":
|
|
767
|
-
return () => Promise.resolve({
|
|
979
|
+
return () => Promise.resolve({
|
|
980
|
+
approved: false,
|
|
981
|
+
reason: posturePolicy.reason
|
|
982
|
+
});
|
|
768
983
|
case "owned-by-surface":
|
|
769
984
|
return void 0;
|
|
770
985
|
}
|
|
771
986
|
}
|
|
772
|
-
|
|
987
|
+
__name(postureResolver, "postureResolver");
|
|
988
|
+
function streamAgentTurnInProcess(mod, apiKey, input, deps = {
|
|
989
|
+
stream: streamAgentUIMessages
|
|
990
|
+
}) {
|
|
773
991
|
const compiled = compileAgentModule(mod, input.source);
|
|
774
992
|
const gated = compiled.hitl;
|
|
775
993
|
if (gated && gated.size > 0 && !input.awaitApproval && input.approvals === void 0) {
|
|
776
|
-
throw new InProcessApprovalRequiredError([
|
|
994
|
+
throw new InProcessApprovalRequiredError([
|
|
995
|
+
...gated.keys()
|
|
996
|
+
]);
|
|
777
997
|
}
|
|
778
998
|
const resolve = input.awaitApproval;
|
|
779
|
-
const approvalResolver = resolve ? (approvalId, opts, toolName) => resolve({
|
|
780
|
-
|
|
999
|
+
const approvalResolver = resolve ? (approvalId, opts, toolName) => resolve({
|
|
1000
|
+
approvalId,
|
|
1001
|
+
toolName,
|
|
1002
|
+
opts
|
|
1003
|
+
}) : postureResolver(input.approvals);
|
|
1004
|
+
const hitl = gated && gated.size > 0 && approvalResolver ? {
|
|
1005
|
+
gated,
|
|
1006
|
+
awaitApproval: approvalResolver
|
|
1007
|
+
} : void 0;
|
|
781
1008
|
const sessionId = input.sessionId ?? crypto.randomUUID();
|
|
782
1009
|
return (async function* () {
|
|
783
1010
|
if (compiled.skillsResolver) {
|
|
784
1011
|
const enabled = await resolveEnabledSkills(compiled.skillsResolver, compiled.runContext ?? {});
|
|
785
|
-
if (enabled !== void 0) compiled.skills = {
|
|
1012
|
+
if (enabled !== void 0) compiled.skills = {
|
|
1013
|
+
enabled,
|
|
1014
|
+
autoInject: true
|
|
1015
|
+
};
|
|
786
1016
|
}
|
|
787
1017
|
yield* deps.stream(compiled, apiKey, {
|
|
788
1018
|
message: input.message,
|
|
789
1019
|
// M35 — pass images through so the SDK send uses the structured `{ text, images }` form.
|
|
790
|
-
...input.images !== void 0 ? {
|
|
1020
|
+
...input.images !== void 0 ? {
|
|
1021
|
+
images: input.images
|
|
1022
|
+
} : {},
|
|
791
1023
|
sessionId,
|
|
792
1024
|
hitl,
|
|
793
|
-
signal: input.signal
|
|
1025
|
+
signal: input.signal,
|
|
1026
|
+
...input.onRunEvent !== void 0 ? {
|
|
1027
|
+
onRunEvent: input.onRunEvent
|
|
1028
|
+
} : {}
|
|
794
1029
|
});
|
|
795
1030
|
})();
|
|
796
1031
|
}
|
|
1032
|
+
__name(streamAgentTurnInProcess, "streamAgentTurnInProcess");
|
|
797
1033
|
|
|
798
1034
|
// src/index.ts
|
|
799
1035
|
var Agent = AgentDoSdk;
|