@theokit/sdk 4.5.1 → 4.6.1
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/CHANGELOG.md +24 -0
- package/dist/a2a/index.cjs +3 -1
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +3 -1
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/subagent.d.cts +24 -2
- package/dist/a2a/subagent.d.ts +24 -2
- package/dist/{cron-CWQPZTwX.d.cts → cron-26WH1n7o.d.cts} +9 -0
- package/dist/{cron-DVM9f1I_.d.ts → cron-D_0p_gXd.d.ts} +9 -0
- package/dist/cron.cjs +88 -20
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +88 -20
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +88 -20
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +88 -20
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +88 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +88 -20
- package/dist/index.js.map +1 -1
- package/dist/internal/runtime/registry/agent-registry-store.d.ts +4 -3
- package/dist/types/agent.d.ts +9 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6127,7 +6127,9 @@ function serializeAgents(agents2) {
|
|
|
6127
6127
|
out[name] = {
|
|
6128
6128
|
description: def.description,
|
|
6129
6129
|
prompt: def.prompt,
|
|
6130
|
-
...def.model !== void 0 ? { model: def.model } : {}
|
|
6130
|
+
...def.model !== void 0 ? { model: def.model } : {},
|
|
6131
|
+
...def.tools !== void 0 ? { tools: def.tools } : {},
|
|
6132
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {}
|
|
6131
6133
|
};
|
|
6132
6134
|
}
|
|
6133
6135
|
return out;
|
|
@@ -9287,22 +9289,86 @@ async function readProjectSubagents(cwd) {
|
|
|
9287
9289
|
}
|
|
9288
9290
|
return subagents;
|
|
9289
9291
|
}
|
|
9292
|
+
var ACCEPTED_FIELDS = /* @__PURE__ */ new Set([
|
|
9293
|
+
"name",
|
|
9294
|
+
"description",
|
|
9295
|
+
"model",
|
|
9296
|
+
"tools",
|
|
9297
|
+
"reasoning_effort",
|
|
9298
|
+
"mcp",
|
|
9299
|
+
"sandbox"
|
|
9300
|
+
]);
|
|
9290
9301
|
function parseSubagentMarkdown(raw, filename) {
|
|
9291
9302
|
const { frontmatter, body } = splitFrontmatter(raw, filename);
|
|
9292
9303
|
const fields = parseFrontmatterFields(frontmatter);
|
|
9293
|
-
|
|
9294
|
-
|
|
9304
|
+
rejectUnknownFields(fields, filename);
|
|
9305
|
+
rejectMcp(fields, filename);
|
|
9295
9306
|
const definition = {
|
|
9296
|
-
description: fields.description ?? "",
|
|
9307
|
+
description: asString(fields.description) ?? "",
|
|
9297
9308
|
prompt: body
|
|
9298
9309
|
};
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9310
|
+
const model = resolveModel(fields, filename);
|
|
9311
|
+
if (model !== void 0) definition.model = model;
|
|
9312
|
+
const tools = toStringList(fields.tools);
|
|
9313
|
+
if (tools.length > 0) definition.tools = tools;
|
|
9314
|
+
const sandbox = resolveSandbox(fields, filename);
|
|
9315
|
+
if (sandbox !== void 0) definition.sandbox = sandbox;
|
|
9316
|
+
const name = asString(fields.name) ?? filename.replace(/\.md$/, "");
|
|
9304
9317
|
return { name, definition };
|
|
9305
9318
|
}
|
|
9319
|
+
function rejectUnknownFields(fields, filename) {
|
|
9320
|
+
for (const key2 of Object.keys(fields)) {
|
|
9321
|
+
if (!ACCEPTED_FIELDS.has(key2)) {
|
|
9322
|
+
throw new exports.ConfigurationError(
|
|
9323
|
+
`Subagent ${filename}: unknown frontmatter field "${key2}" (accepted: ${[...ACCEPTED_FIELDS].join(", ")})`,
|
|
9324
|
+
{ code: "subagent_unknown_field" }
|
|
9325
|
+
);
|
|
9326
|
+
}
|
|
9327
|
+
}
|
|
9328
|
+
}
|
|
9329
|
+
function rejectMcp(fields, filename) {
|
|
9330
|
+
if (fields.mcp !== void 0) {
|
|
9331
|
+
throw new exports.ConfigurationError(
|
|
9332
|
+
`Subagent ${filename}: per-subagent "mcp" is not yet supported on the local delegation path; declare MCP servers in .theokit/mcp.json (or the parent) instead`,
|
|
9333
|
+
{ code: "subagent_mcp_unsupported_local" }
|
|
9334
|
+
);
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
function resolveModel(fields, filename) {
|
|
9338
|
+
const modelId = asString(fields.model);
|
|
9339
|
+
const effort = asString(fields.reasoning_effort);
|
|
9340
|
+
if (effort !== void 0 && (modelId === void 0 || modelId === "inherit")) {
|
|
9341
|
+
throw new exports.ConfigurationError(
|
|
9342
|
+
`Subagent ${filename}: reasoning_effort requires a concrete model (effort is a model parameter; an absent model or "inherit" cannot carry it)`,
|
|
9343
|
+
{ code: "subagent_reasoning_effort_without_model" }
|
|
9344
|
+
);
|
|
9345
|
+
}
|
|
9346
|
+
if (modelId === void 0) return void 0;
|
|
9347
|
+
if (modelId === "inherit") return "inherit";
|
|
9348
|
+
return effort !== void 0 ? { id: modelId, params: [{ id: "thinking", value: effort }] } : { id: modelId };
|
|
9349
|
+
}
|
|
9350
|
+
function resolveSandbox(fields, filename) {
|
|
9351
|
+
if (fields.sandbox === void 0) return void 0;
|
|
9352
|
+
if (typeof fields.sandbox !== "boolean") {
|
|
9353
|
+
throw new exports.ConfigurationError(
|
|
9354
|
+
`Subagent ${filename}: sandbox must be a boolean (got "${String(fields.sandbox)}"); granular sandbox modes are not supported by the runtime`,
|
|
9355
|
+
{ code: "subagent_sandbox_not_boolean" }
|
|
9356
|
+
);
|
|
9357
|
+
}
|
|
9358
|
+
return fields.sandbox;
|
|
9359
|
+
}
|
|
9360
|
+
function asString(v) {
|
|
9361
|
+
if (typeof v !== "string") return void 0;
|
|
9362
|
+
const m = /^(["'])(.*)\1$/.exec(v);
|
|
9363
|
+
return m ? m[2] : v;
|
|
9364
|
+
}
|
|
9365
|
+
function toStringList(v) {
|
|
9366
|
+
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
9367
|
+
if (typeof v === "string") {
|
|
9368
|
+
return v.split(/[\s,]+/).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
9369
|
+
}
|
|
9370
|
+
return [];
|
|
9371
|
+
}
|
|
9306
9372
|
function splitFrontmatter(raw, filename) {
|
|
9307
9373
|
const match = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/.exec(raw);
|
|
9308
9374
|
if (match === null) {
|
|
@@ -9313,12 +9379,7 @@ function splitFrontmatter(raw, filename) {
|
|
|
9313
9379
|
return { frontmatter: match[1] ?? "", body: (match[2] ?? "").trim() };
|
|
9314
9380
|
}
|
|
9315
9381
|
function parseFrontmatterFields(frontmatter) {
|
|
9316
|
-
|
|
9317
|
-
const out = {};
|
|
9318
|
-
for (const [k, v] of Object.entries(raw)) {
|
|
9319
|
-
out[k] = typeof v === "string" ? v : void 0;
|
|
9320
|
-
}
|
|
9321
|
-
return out;
|
|
9382
|
+
return parseSimpleYaml(frontmatter);
|
|
9322
9383
|
}
|
|
9323
9384
|
|
|
9324
9385
|
// src/define-tool.ts
|
|
@@ -9517,12 +9578,12 @@ init_path_guard();
|
|
|
9517
9578
|
|
|
9518
9579
|
// src/internal/runtime/skills/skill-frontmatter.ts
|
|
9519
9580
|
init_errors();
|
|
9520
|
-
function
|
|
9581
|
+
function asString2(v) {
|
|
9521
9582
|
return typeof v === "string" ? v : void 0;
|
|
9522
9583
|
}
|
|
9523
9584
|
function toStringFields(raw) {
|
|
9524
9585
|
const out = {};
|
|
9525
|
-
for (const [k, v] of Object.entries(raw)) out[k] =
|
|
9586
|
+
for (const [k, v] of Object.entries(raw)) out[k] = asString2(v);
|
|
9526
9587
|
return out;
|
|
9527
9588
|
}
|
|
9528
9589
|
function parseSkillFrontmatter(raw, fallbackName) {
|
|
@@ -16406,10 +16467,12 @@ ${lines.join("\n")}
|
|
|
16406
16467
|
</subagent-tool-results>`;
|
|
16407
16468
|
}
|
|
16408
16469
|
function buildChildCreateOptions(spec, inherited) {
|
|
16409
|
-
const model = spec.model ? { id: spec.model } : inherited?.model;
|
|
16470
|
+
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
16471
|
+
const sandbox = spec.sandbox ?? inherited?.sandbox;
|
|
16410
16472
|
return {
|
|
16411
16473
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
16412
16474
|
...model !== void 0 ? { model } : {},
|
|
16475
|
+
...sandbox !== void 0 ? { local: { sandboxOptions: { enabled: sandbox } } } : {},
|
|
16413
16476
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
16414
16477
|
systemPrompt: spec.instructions,
|
|
16415
16478
|
tools: spec.tools ?? []
|
|
@@ -16518,7 +16581,10 @@ function subAgentToolsFromDefinitions(agents2, parentTools) {
|
|
|
16518
16581
|
name,
|
|
16519
16582
|
description: def.description,
|
|
16520
16583
|
instructions: def.prompt,
|
|
16521
|
-
|
|
16584
|
+
// Carry the FULL ModelSelection (id + reasoning params), not just the id, so
|
|
16585
|
+
// per-subagent reasoning effort survives to buildChildCreateOptions.
|
|
16586
|
+
...def.model !== void 0 && def.model !== "inherit" ? { model: def.model } : {},
|
|
16587
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {},
|
|
16522
16588
|
tools: [...childTools]
|
|
16523
16589
|
});
|
|
16524
16590
|
});
|
|
@@ -16582,10 +16648,12 @@ function declarativeSubagentTools(agents2, parentTools) {
|
|
|
16582
16648
|
}
|
|
16583
16649
|
function bindParentCredentials(tools, agentOptions) {
|
|
16584
16650
|
const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
|
|
16651
|
+
const parentSandbox = agentOptions.local?.sandboxOptions?.enabled;
|
|
16585
16652
|
const credentials = {
|
|
16586
16653
|
...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
|
|
16587
16654
|
...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
|
|
16588
|
-
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
|
|
16655
|
+
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {},
|
|
16656
|
+
...parentSandbox !== void 0 ? { sandbox: parentSandbox } : {}
|
|
16589
16657
|
};
|
|
16590
16658
|
for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
|
|
16591
16659
|
}
|