@theokit/agents 0.46.0 → 1.0.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/dist/{bridge-entry-BQ6UUSLZ.d.ts → bridge-entry-F9kHGaIn.d.ts} +378 -106
- package/dist/bridge.d.ts +1 -2
- package/dist/bridge.js +3 -12
- package/dist/{chunk-YBNKD5UM.js → chunk-7KRJJX7W.js} +393 -492
- package/dist/chunk-7KRJJX7W.js.map +1 -0
- package/dist/index.d.ts +278 -16
- package/dist/index.js +453 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
- package/dist/chunk-NERDIS45.js +0 -329
- package/dist/chunk-NERDIS45.js.map +0 -1
- package/dist/chunk-YBNKD5UM.js.map +0 -1
- package/dist/decorators.d.ts +0 -176
- package/dist/decorators.js +0 -308
- package/dist/decorators.js.map +0 -1
- package/dist/types-DVA4LQsA.d.ts +0 -313
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
AgentDefinitionError,
|
|
4
4
|
AgentRunner,
|
|
5
5
|
AgentRunnerBuilder,
|
|
6
|
-
AgentWarningCode,
|
|
7
6
|
BudgetExceededError,
|
|
8
7
|
CostBudgetExceededError,
|
|
9
8
|
DEFAULT_KEEP_TOKENS,
|
|
@@ -14,12 +13,12 @@ import {
|
|
|
14
13
|
agentsPlugin,
|
|
15
14
|
buildModelSelection,
|
|
16
15
|
compactionStrategyConfigSchema,
|
|
17
|
-
compileAgent,
|
|
18
16
|
compileAgentDefinition,
|
|
19
17
|
compileAgentModule,
|
|
20
18
|
compileContextWindow,
|
|
21
19
|
compileProjectContext,
|
|
22
20
|
compileSkills,
|
|
21
|
+
compileSkillsSelection,
|
|
23
22
|
compileTools,
|
|
24
23
|
contextualTool,
|
|
25
24
|
costGuard,
|
|
@@ -67,15 +66,430 @@ import {
|
|
|
67
66
|
toAgentFactory,
|
|
68
67
|
tokenBudgetCompactionStrategy,
|
|
69
68
|
translateSdkEvent,
|
|
70
|
-
unicodeNormalizer
|
|
71
|
-
|
|
72
|
-
walkAgentMetadata
|
|
73
|
-
} from "./chunk-YBNKD5UM.js";
|
|
74
|
-
import "./chunk-NERDIS45.js";
|
|
69
|
+
unicodeNormalizer
|
|
70
|
+
} from "./chunk-7KRJJX7W.js";
|
|
75
71
|
import {
|
|
76
72
|
__name
|
|
77
73
|
} from "./chunk-7QVYU63E.js";
|
|
78
74
|
|
|
75
|
+
// src/capability/capability.ts
|
|
76
|
+
import { isDeepStrictEqual } from "util";
|
|
77
|
+
var CapabilityConflictError = class extends Error {
|
|
78
|
+
static {
|
|
79
|
+
__name(this, "CapabilityConflictError");
|
|
80
|
+
}
|
|
81
|
+
name = "CapabilityConflictError";
|
|
82
|
+
constructor(field, previous, next, capability) {
|
|
83
|
+
super(
|
|
84
|
+
// NUNCA ecoa os valores: um draft montado a partir de arquivo de config pode carregar
|
|
85
|
+
// token de MCP, header de auth, credencial de memória. Reporta a FORMA, como a validação
|
|
86
|
+
// de fronteira das capabilities já faz.
|
|
87
|
+
`capability "${capability}": campo "${field}" j\xE1 declarado (${shapeOf(previous)}) e redeclarado com valor diferente (${shapeOf(next)}) \u2014 declare uma vez s\xF3.`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function shapeOf(value) {
|
|
92
|
+
if (value === null) return "null";
|
|
93
|
+
if (Array.isArray(value)) return `array(${value.length})`;
|
|
94
|
+
if (typeof value === "object") {
|
|
95
|
+
return `object{${Object.keys(value).sort((a, b) => a.localeCompare(b)).join(",")}}`;
|
|
96
|
+
}
|
|
97
|
+
return typeof value;
|
|
98
|
+
}
|
|
99
|
+
__name(shapeOf, "shapeOf");
|
|
100
|
+
function createDraft() {
|
|
101
|
+
return {
|
|
102
|
+
tools: [],
|
|
103
|
+
agents: {},
|
|
104
|
+
provenance: []
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
__name(createDraft, "createDraft");
|
|
108
|
+
function applyCapabilities(capabilities, draft = createDraft()) {
|
|
109
|
+
for (const c of capabilities) c.apply(draft);
|
|
110
|
+
draft.stream ??= true;
|
|
111
|
+
return draft;
|
|
112
|
+
}
|
|
113
|
+
__name(applyCapabilities, "applyCapabilities");
|
|
114
|
+
function setOnce(draft, field, value, capability) {
|
|
115
|
+
if (value === void 0) return;
|
|
116
|
+
const previous = draft[field];
|
|
117
|
+
if (previous !== void 0 && !isDeepStrictEqual(previous, value)) {
|
|
118
|
+
throw new CapabilityConflictError(field, previous, value, capability);
|
|
119
|
+
}
|
|
120
|
+
draft[field] = value;
|
|
121
|
+
draft.provenance.push({
|
|
122
|
+
capability,
|
|
123
|
+
contributed: [
|
|
124
|
+
field
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
__name(setOnce, "setOnce");
|
|
129
|
+
|
|
130
|
+
// src/capability/capabilities.ts
|
|
131
|
+
var ConfigurationError = class extends Error {
|
|
132
|
+
static {
|
|
133
|
+
__name(this, "ConfigurationError");
|
|
134
|
+
}
|
|
135
|
+
name = "ConfigurationError";
|
|
136
|
+
};
|
|
137
|
+
function describe(value) {
|
|
138
|
+
if (value === null) return "null";
|
|
139
|
+
return Array.isArray(value) ? "array" : typeof value;
|
|
140
|
+
}
|
|
141
|
+
__name(describe, "describe");
|
|
142
|
+
var ModelCapability = class {
|
|
143
|
+
static {
|
|
144
|
+
__name(this, "ModelCapability");
|
|
145
|
+
}
|
|
146
|
+
id;
|
|
147
|
+
reasoningEffort;
|
|
148
|
+
name = "model";
|
|
149
|
+
constructor(id, reasoningEffort) {
|
|
150
|
+
this.id = id;
|
|
151
|
+
this.reasoningEffort = reasoningEffort;
|
|
152
|
+
if (typeof id !== "string") {
|
|
153
|
+
throw new ConfigurationError(`model: esperava string, recebi ${describe(id)}`);
|
|
154
|
+
}
|
|
155
|
+
if (id.trim().length === 0) throw new ConfigurationError("model: id n\xE3o pode ser vazio");
|
|
156
|
+
}
|
|
157
|
+
apply(draft) {
|
|
158
|
+
setOnce(draft, "model", this.id, this.name);
|
|
159
|
+
if (this.reasoningEffort !== void 0) {
|
|
160
|
+
setOnce(draft, "reasoningEffort", this.reasoningEffort, this.name);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var ToolsCapability = class {
|
|
165
|
+
static {
|
|
166
|
+
__name(this, "ToolsCapability");
|
|
167
|
+
}
|
|
168
|
+
name = "tools";
|
|
169
|
+
#tools;
|
|
170
|
+
constructor(tools) {
|
|
171
|
+
this.#tools = tools;
|
|
172
|
+
}
|
|
173
|
+
apply(draft) {
|
|
174
|
+
draft.tools.push(...this.#tools);
|
|
175
|
+
draft.provenance.push({
|
|
176
|
+
capability: this.name,
|
|
177
|
+
contributed: [
|
|
178
|
+
"tools"
|
|
179
|
+
]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var skills = /* @__PURE__ */ __name((entries) => {
|
|
184
|
+
if (!Array.isArray(entries)) {
|
|
185
|
+
throw new ConfigurationError(`skills: esperava array de nomes, recebi ${describe(entries)}`);
|
|
186
|
+
}
|
|
187
|
+
for (const e of entries) {
|
|
188
|
+
if (typeof e === "string") {
|
|
189
|
+
if (e.trim().length === 0) {
|
|
190
|
+
throw new ConfigurationError("skills: nome vazio \u2014 use um nome de skill n\xE3o vazio");
|
|
191
|
+
}
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (typeof e !== "object" || e === null || Array.isArray(e)) {
|
|
195
|
+
throw new ConfigurationError(`skills: entrada inv\xE1lida (${describe(e)}) \u2014 use um nome ou um skill inline`);
|
|
196
|
+
}
|
|
197
|
+
for (const field of [
|
|
198
|
+
"name",
|
|
199
|
+
"description",
|
|
200
|
+
"instructions"
|
|
201
|
+
]) {
|
|
202
|
+
const value = e[field];
|
|
203
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
204
|
+
throw new ConfigurationError(`skills: skill inline sem \`${field}\` v\xE1lido (${describe(value)}) \u2014 name, description e instructions s\xE3o obrigat\xF3rios`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
name: "skills",
|
|
210
|
+
apply: /* @__PURE__ */ __name((draft) => {
|
|
211
|
+
const compiled = compileSkillsSelection(entries.slice());
|
|
212
|
+
if (compiled.skills === void 0) return;
|
|
213
|
+
const previous = draft.skills;
|
|
214
|
+
draft.skills = previous === void 0 ? compiled.skills : {
|
|
215
|
+
// The spread is exhaustive only because `compileSkillsSelection` emits a FIXED 3-key
|
|
216
|
+
// shape (`enabled`, `autoInject: true`, and `inline` iff non-empty) — `enabled` and
|
|
217
|
+
// `inline` are both re-derived below, and `autoInject` is the same literal on both
|
|
218
|
+
// sides. TRAP for the future: if a capability ever authors `autoInject: false`, this
|
|
219
|
+
// spread would silently normalize it back to `true`. Unreachable today (no capability
|
|
220
|
+
// and no reference array form can express it) — revisit when one can.
|
|
221
|
+
...previous,
|
|
222
|
+
...compiled.skills,
|
|
223
|
+
enabled: [
|
|
224
|
+
...previous.enabled ?? [],
|
|
225
|
+
...compiled.skills.enabled ?? []
|
|
226
|
+
],
|
|
227
|
+
...previous.inline !== void 0 || compiled.skills.inline !== void 0 ? {
|
|
228
|
+
inline: [
|
|
229
|
+
...previous.inline ?? [],
|
|
230
|
+
...compiled.skills.inline ?? []
|
|
231
|
+
]
|
|
232
|
+
} : {}
|
|
233
|
+
};
|
|
234
|
+
draft.provenance.push({
|
|
235
|
+
capability: "skills",
|
|
236
|
+
contributed: [
|
|
237
|
+
"skills"
|
|
238
|
+
]
|
|
239
|
+
});
|
|
240
|
+
}, "apply")
|
|
241
|
+
};
|
|
242
|
+
}, "skills");
|
|
243
|
+
|
|
244
|
+
// src/capability/registry.ts
|
|
245
|
+
var UnknownCapabilityError = class extends Error {
|
|
246
|
+
static {
|
|
247
|
+
__name(this, "UnknownCapabilityError");
|
|
248
|
+
}
|
|
249
|
+
name = "UnknownCapabilityError";
|
|
250
|
+
constructor(requested, known) {
|
|
251
|
+
super(`capability "${requested}" n\xE3o registrada. Conhecidas: ${known.join(", ") || "(nenhuma)"}.`);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var CapabilityRegistry = class {
|
|
255
|
+
static {
|
|
256
|
+
__name(this, "CapabilityRegistry");
|
|
257
|
+
}
|
|
258
|
+
#factories = /* @__PURE__ */ new Map();
|
|
259
|
+
register(name, factory) {
|
|
260
|
+
this.#factories.set(name, factory);
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
has(name) {
|
|
264
|
+
return this.#factories.has(name);
|
|
265
|
+
}
|
|
266
|
+
names() {
|
|
267
|
+
return [
|
|
268
|
+
...this.#factories.keys()
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
resolve(name, arg) {
|
|
272
|
+
const factory = this.#factories.get(name);
|
|
273
|
+
if (factory === void 0) throw new UnknownCapabilityError(name, this.names());
|
|
274
|
+
return factory(arg);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
var CapabilityPreset = class {
|
|
278
|
+
static {
|
|
279
|
+
__name(this, "CapabilityPreset");
|
|
280
|
+
}
|
|
281
|
+
name;
|
|
282
|
+
#members;
|
|
283
|
+
constructor(name, members) {
|
|
284
|
+
this.name = name;
|
|
285
|
+
this.#members = members;
|
|
286
|
+
}
|
|
287
|
+
apply(draft) {
|
|
288
|
+
for (const member of this.#members) member.apply(draft);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// src/capability/agent-capabilities.ts
|
|
293
|
+
function fieldCapability(name, field) {
|
|
294
|
+
return (value) => ({
|
|
295
|
+
name,
|
|
296
|
+
apply: /* @__PURE__ */ __name((draft) => {
|
|
297
|
+
setOnce(draft, field, value, name);
|
|
298
|
+
}, "apply")
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
__name(fieldCapability, "fieldCapability");
|
|
302
|
+
var memory = fieldCapability("memory", "memory");
|
|
303
|
+
var contextWindow = /* @__PURE__ */ __name((options) => ({
|
|
304
|
+
name: "context-window",
|
|
305
|
+
apply: /* @__PURE__ */ __name((draft) => {
|
|
306
|
+
setOnce(draft, "context", compileContextWindow(options).context, "context-window");
|
|
307
|
+
}, "apply")
|
|
308
|
+
}), "contextWindow");
|
|
309
|
+
var projectContext = fieldCapability("project-context", "projectContext");
|
|
310
|
+
var mcpServers = fieldCapability("mcp", "mcpServers");
|
|
311
|
+
var guardrails = fieldCapability("guardrails", "guardrails");
|
|
312
|
+
var checkpoint = /* @__PURE__ */ __name((options) => ({
|
|
313
|
+
name: "checkpoint",
|
|
314
|
+
apply: /* @__PURE__ */ __name((draft) => {
|
|
315
|
+
if (options !== void 0 && options.storage !== "filesystem") {
|
|
316
|
+
console.warn(`[THEO_AGENT_CHECKPOINT_STORAGE_METADATA_ONLY] checkpoint({ storage: '${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.`);
|
|
317
|
+
}
|
|
318
|
+
setOnce(draft, "checkpoint", options, "checkpoint");
|
|
319
|
+
}, "apply")
|
|
320
|
+
}), "checkpoint");
|
|
321
|
+
var humanInTheLoop = fieldCapability("human-in-the-loop", "hitl");
|
|
322
|
+
var subAgents = /* @__PURE__ */ __name((children) => ({
|
|
323
|
+
name: "sub-agents",
|
|
324
|
+
apply: /* @__PURE__ */ __name((draft) => {
|
|
325
|
+
for (const [name, child] of Object.entries(children)) {
|
|
326
|
+
if (name in draft.agents && draft.agents[name] !== child) {
|
|
327
|
+
throw new ConfigurationError(`sub-agents: filho "${name}" declarado duas vezes com defini\xE7\xF5es diferentes`);
|
|
328
|
+
}
|
|
329
|
+
draft.agents[name] = child;
|
|
330
|
+
}
|
|
331
|
+
draft.provenance.push({
|
|
332
|
+
capability: "sub-agents",
|
|
333
|
+
contributed: [
|
|
334
|
+
"agents"
|
|
335
|
+
]
|
|
336
|
+
});
|
|
337
|
+
}, "apply")
|
|
338
|
+
}), "subAgents");
|
|
339
|
+
var skillsOptions = /* @__PURE__ */ __name((options) => ({
|
|
340
|
+
name: "skills",
|
|
341
|
+
apply: /* @__PURE__ */ __name((draft) => {
|
|
342
|
+
setOnce(draft, "skills", compileSkills(options), "skills");
|
|
343
|
+
}, "apply")
|
|
344
|
+
}), "skillsOptions");
|
|
345
|
+
var settingSources = fieldCapability("setting-sources", "settingSources");
|
|
346
|
+
var plugins = fieldCapability("plugins", "plugins");
|
|
347
|
+
var runContext = fieldCapability("run-context", "runContext");
|
|
348
|
+
var skillsResolver = fieldCapability("skills-resolver", "skillsResolver");
|
|
349
|
+
var AgentConfigCapability = class {
|
|
350
|
+
static {
|
|
351
|
+
__name(this, "AgentConfigCapability");
|
|
352
|
+
}
|
|
353
|
+
config;
|
|
354
|
+
name = "agent-config";
|
|
355
|
+
constructor(config) {
|
|
356
|
+
this.config = config;
|
|
357
|
+
if (typeof config !== "object" || config === null) {
|
|
358
|
+
throw new ConfigurationError("agent-config: esperava um objeto de configura\xE7\xE3o");
|
|
359
|
+
}
|
|
360
|
+
for (const field of [
|
|
361
|
+
"maxIterations",
|
|
362
|
+
"timeoutMs"
|
|
363
|
+
]) {
|
|
364
|
+
const value = config[field];
|
|
365
|
+
if (value !== void 0 && (!Number.isFinite(value) || value <= 0)) {
|
|
366
|
+
throw new ConfigurationError(`agent-config: \`${field}\` deve ser um n\xFAmero positivo`);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
apply(draft) {
|
|
371
|
+
const claimedByMainLoop = /* @__PURE__ */ __name((field) => draft.provenance.some((p) => p.capability === "main-loop" && p.contributed.includes(field)), "claimedByMainLoop");
|
|
372
|
+
if (!claimedByMainLoop("maxIterations")) {
|
|
373
|
+
setOnce(draft, "maxIterations", this.config.maxIterations, this.name);
|
|
374
|
+
}
|
|
375
|
+
if (!claimedByMainLoop("timeoutMs")) {
|
|
376
|
+
setOnce(draft, "timeoutMs", this.config.timeoutMs, this.name);
|
|
377
|
+
}
|
|
378
|
+
setOnce(draft, "systemPrompt", this.config.systemPrompt, this.name);
|
|
379
|
+
setOnce(draft, "parseThinkTags", this.config.parseThinkTags, this.name);
|
|
380
|
+
setOnce(draft, "stripToolDialect", this.config.stripToolDialect, this.name);
|
|
381
|
+
setOnce(draft, "recoverLeakedToolCalls", this.config.recoverLeakedToolCalls, this.name);
|
|
382
|
+
setOnce(draft, "stream", this.config.stream, this.name);
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
var MainLoopCapability = class {
|
|
386
|
+
static {
|
|
387
|
+
__name(this, "MainLoopCapability");
|
|
388
|
+
}
|
|
389
|
+
config;
|
|
390
|
+
name = "main-loop";
|
|
391
|
+
constructor(config) {
|
|
392
|
+
this.config = config;
|
|
393
|
+
}
|
|
394
|
+
apply(draft) {
|
|
395
|
+
const contributed = [];
|
|
396
|
+
if (this.config.maxIterations !== void 0) {
|
|
397
|
+
draft.maxIterations = this.config.maxIterations;
|
|
398
|
+
contributed.push("maxIterations");
|
|
399
|
+
}
|
|
400
|
+
if (this.config.timeoutMs !== void 0) {
|
|
401
|
+
draft.timeoutMs = this.config.timeoutMs;
|
|
402
|
+
contributed.push("timeoutMs");
|
|
403
|
+
}
|
|
404
|
+
if (contributed.length > 0) draft.provenance.push({
|
|
405
|
+
capability: this.name,
|
|
406
|
+
contributed
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// src/capability/toolbox.ts
|
|
412
|
+
var ToolboxCapability = class {
|
|
413
|
+
static {
|
|
414
|
+
__name(this, "ToolboxCapability");
|
|
415
|
+
}
|
|
416
|
+
name = "toolbox";
|
|
417
|
+
#instance;
|
|
418
|
+
#declarations;
|
|
419
|
+
#namespace;
|
|
420
|
+
constructor(instance, options = {}) {
|
|
421
|
+
if (typeof instance !== "object" || instance === null) {
|
|
422
|
+
throw new ConfigurationError("toolbox: esperava uma inst\xE2ncia de toolbox");
|
|
423
|
+
}
|
|
424
|
+
const declared = options.tools ?? instance.constructor.tools;
|
|
425
|
+
if (declared === void 0 || declared.length === 0) {
|
|
426
|
+
throw new ConfigurationError(`toolbox: ${instance.constructor.name} n\xE3o declara tools \u2014 use \`static tools = [...]\` ou a op\xE7\xE3o \`tools\``);
|
|
427
|
+
}
|
|
428
|
+
for (const tool of declared) {
|
|
429
|
+
if (typeof instance[tool.method] !== "function") {
|
|
430
|
+
throw new ConfigurationError(`toolbox: ${instance.constructor.name}.${tool.method} n\xE3o \xE9 um m\xE9todo (tool "${tool.name}")`);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
this.#instance = instance;
|
|
434
|
+
this.#declarations = declared;
|
|
435
|
+
this.#namespace = options.namespace ?? "";
|
|
436
|
+
}
|
|
437
|
+
/** The compiled tools this toolbox contributes — the same shape the decorator path produces. */
|
|
438
|
+
compile() {
|
|
439
|
+
const token = this.#instance.constructor;
|
|
440
|
+
const walk = {
|
|
441
|
+
class: token,
|
|
442
|
+
namespace: this.#namespace,
|
|
443
|
+
guards: [],
|
|
444
|
+
tools: this.#declarations.map((tool) => ({
|
|
445
|
+
propertyKey: tool.method,
|
|
446
|
+
config: tool,
|
|
447
|
+
guards: [],
|
|
448
|
+
approval: tool.approval,
|
|
449
|
+
trace: tool.trace ?? false,
|
|
450
|
+
audit: tool.audit ?? false,
|
|
451
|
+
...tool.hitl !== void 0 ? {
|
|
452
|
+
hitl: tool.hitl
|
|
453
|
+
} : {}
|
|
454
|
+
}))
|
|
455
|
+
};
|
|
456
|
+
return compileTools([
|
|
457
|
+
walk
|
|
458
|
+
], /* @__PURE__ */ new Map([
|
|
459
|
+
[
|
|
460
|
+
token,
|
|
461
|
+
this.#instance
|
|
462
|
+
]
|
|
463
|
+
]));
|
|
464
|
+
}
|
|
465
|
+
apply(draft) {
|
|
466
|
+
draft.tools.push(...this.compile());
|
|
467
|
+
draft.provenance.push({
|
|
468
|
+
capability: this.name,
|
|
469
|
+
contributed: [
|
|
470
|
+
"tools"
|
|
471
|
+
]
|
|
472
|
+
});
|
|
473
|
+
const gates = [];
|
|
474
|
+
for (const tool of this.#declarations) {
|
|
475
|
+
if (tool.hitl === void 0) continue;
|
|
476
|
+
gates.push([
|
|
477
|
+
this.#namespace === "" ? tool.name : `${this.#namespace}.${tool.name}`,
|
|
478
|
+
tool.hitl
|
|
479
|
+
]);
|
|
480
|
+
}
|
|
481
|
+
if (gates.length === 0) return;
|
|
482
|
+
draft.hitl ??= /* @__PURE__ */ new Map();
|
|
483
|
+
for (const [key, options] of gates) draft.hitl.set(key, options);
|
|
484
|
+
draft.provenance.push({
|
|
485
|
+
capability: this.name,
|
|
486
|
+
contributed: [
|
|
487
|
+
"hitl"
|
|
488
|
+
]
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
79
493
|
// src/a2a/agent-card.ts
|
|
80
494
|
function trimTrailingSlash(url) {
|
|
81
495
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
@@ -212,8 +626,12 @@ async function resolveEnabledSkills(selection, ctx) {
|
|
|
212
626
|
if (!Array.isArray(resolved)) {
|
|
213
627
|
throw new Error("[@theokit/agents] skills resolver must return an array of skill names");
|
|
214
628
|
}
|
|
629
|
+
const names = resolved;
|
|
630
|
+
if (!names.every((n) => typeof n === "string" && n.trim().length > 0)) {
|
|
631
|
+
throw new Error("[@theokit/agents] skills resolver must return non-empty skill NAME strings");
|
|
632
|
+
}
|
|
215
633
|
return [
|
|
216
|
-
...
|
|
634
|
+
...names
|
|
217
635
|
];
|
|
218
636
|
}
|
|
219
637
|
__name(resolveEnabledSkills, "resolveEnabledSkills");
|
|
@@ -347,35 +765,47 @@ export {
|
|
|
347
765
|
AGENT_BRAND,
|
|
348
766
|
AcpClient,
|
|
349
767
|
AcpMessageDecoder,
|
|
768
|
+
AgentConfigCapability,
|
|
350
769
|
AgentDefinitionError,
|
|
351
770
|
AgentRunner,
|
|
352
771
|
AgentRunnerBuilder,
|
|
353
|
-
AgentWarningCode,
|
|
354
772
|
BudgetExceededError,
|
|
773
|
+
CapabilityConflictError,
|
|
774
|
+
CapabilityPreset,
|
|
775
|
+
CapabilityRegistry,
|
|
776
|
+
ConfigurationError,
|
|
355
777
|
CostBudgetExceededError,
|
|
356
778
|
DEFAULT_KEEP_TOKENS,
|
|
357
779
|
DEFAULT_MAX_ITERATIONS,
|
|
358
780
|
DelegationError,
|
|
359
781
|
GuardrailViolationError,
|
|
360
782
|
MCP_PROTOCOL_VERSION,
|
|
783
|
+
MainLoopCapability,
|
|
784
|
+
ModelCapability,
|
|
785
|
+
ToolboxCapability,
|
|
786
|
+
ToolsCapability,
|
|
787
|
+
UnknownCapabilityError,
|
|
361
788
|
agent,
|
|
362
789
|
agentsPlugin,
|
|
790
|
+
applyCapabilities,
|
|
363
791
|
buildAgentCard,
|
|
364
792
|
buildMcpToolDescriptors,
|
|
365
793
|
buildModelSelection,
|
|
794
|
+
checkpoint,
|
|
366
795
|
compactionStrategyConfigSchema,
|
|
367
|
-
compileAgent,
|
|
368
796
|
compileAgentDefinition,
|
|
369
797
|
compileAgentModule,
|
|
370
798
|
compileContextWindow,
|
|
371
799
|
compileProjectContext,
|
|
372
800
|
compileSkills,
|
|
373
801
|
compileTools,
|
|
802
|
+
contextWindow,
|
|
374
803
|
contextualTool,
|
|
375
804
|
costGuard,
|
|
376
805
|
createA2ATool,
|
|
377
806
|
createAgentExecutionContext,
|
|
378
807
|
createApiErrorHandler,
|
|
808
|
+
createDraft,
|
|
379
809
|
createSdkAgentStream,
|
|
380
810
|
createThinkTagExtractor,
|
|
381
811
|
createToolHooksPlugin,
|
|
@@ -388,6 +818,8 @@ export {
|
|
|
388
818
|
extractThinkTagStream,
|
|
389
819
|
generateAgentManifest,
|
|
390
820
|
generateAgentRoutes,
|
|
821
|
+
guardrails,
|
|
822
|
+
humanInTheLoop,
|
|
391
823
|
isAgentContext,
|
|
392
824
|
isAgentDefinition,
|
|
393
825
|
isApprovalRequired,
|
|
@@ -401,13 +833,17 @@ export {
|
|
|
401
833
|
loopStrategyConfigSchema,
|
|
402
834
|
mcpRegistry,
|
|
403
835
|
mcpServerInfo,
|
|
836
|
+
mcpServers,
|
|
404
837
|
mcpToolApprovals,
|
|
838
|
+
memory,
|
|
405
839
|
moderateOutputStream,
|
|
406
840
|
noopReflectionStrategy,
|
|
407
841
|
outputModeration,
|
|
408
842
|
parseConversationId,
|
|
409
843
|
piiDetector,
|
|
844
|
+
plugins,
|
|
410
845
|
presentUIMessageStream,
|
|
846
|
+
projectContext,
|
|
411
847
|
projectContextMetadataOnlyKnobs,
|
|
412
848
|
promptInjectionDetector,
|
|
413
849
|
reflectionStrategyConfigSchema,
|
|
@@ -415,17 +851,22 @@ export {
|
|
|
415
851
|
resolveEnabledSkills,
|
|
416
852
|
resolveLoopStrategy,
|
|
417
853
|
resolveMcpServers,
|
|
854
|
+
runContext,
|
|
418
855
|
runInputGuards,
|
|
419
856
|
runOutputGuards,
|
|
420
857
|
runWithApiErrorHandling,
|
|
858
|
+
setOnce,
|
|
859
|
+
settingSources,
|
|
860
|
+
skills,
|
|
861
|
+
skillsOptions,
|
|
862
|
+
skillsResolver,
|
|
421
863
|
streamAgentResponse,
|
|
422
864
|
streamAgentUIMessages,
|
|
865
|
+
subAgents,
|
|
423
866
|
toAgentFactory,
|
|
424
867
|
tokenBudgetCompactionStrategy,
|
|
425
868
|
translateSdkEvent,
|
|
426
869
|
unicodeNormalizer,
|
|
427
|
-
validateUniqueRoutes,
|
|
428
|
-
walkAgentMetadata,
|
|
429
870
|
wellKnownCardPath
|
|
430
871
|
};
|
|
431
872
|
//# sourceMappingURL=index.js.map
|