@theokit/sdk 4.5.0 → 4.6.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/CHANGELOG.md +17 -0
- package/README.md +12 -2
- package/dist/a2a/index.cjs +2 -1
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +2 -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 +79 -18
- 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 +79 -18
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +79 -18
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +79 -18
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +79 -18
- 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 +79 -18
- package/dist/index.js.map +1 -1
- package/dist/types/agent.d.ts +9 -0
- package/docs/error-codes.md +157 -0
- package/docs/harness-capability-map.md +260 -0
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -9287,22 +9287,84 @@ async function readProjectSubagents(cwd) {
|
|
|
9287
9287
|
}
|
|
9288
9288
|
return subagents;
|
|
9289
9289
|
}
|
|
9290
|
+
var ACCEPTED_FIELDS = /* @__PURE__ */ new Set([
|
|
9291
|
+
"name",
|
|
9292
|
+
"description",
|
|
9293
|
+
"model",
|
|
9294
|
+
"tools",
|
|
9295
|
+
"reasoning_effort",
|
|
9296
|
+
"mcp",
|
|
9297
|
+
"sandbox"
|
|
9298
|
+
]);
|
|
9290
9299
|
function parseSubagentMarkdown(raw, filename) {
|
|
9291
9300
|
const { frontmatter, body } = splitFrontmatter(raw, filename);
|
|
9292
9301
|
const fields = parseFrontmatterFields(frontmatter);
|
|
9293
|
-
|
|
9294
|
-
|
|
9302
|
+
rejectUnknownFields(fields, filename);
|
|
9303
|
+
rejectMcp(fields, filename);
|
|
9295
9304
|
const definition = {
|
|
9296
|
-
description: fields.description ?? "",
|
|
9305
|
+
description: asString(fields.description) ?? "",
|
|
9297
9306
|
prompt: body
|
|
9298
9307
|
};
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9308
|
+
const model = resolveModel(fields, filename);
|
|
9309
|
+
if (model !== void 0) definition.model = model;
|
|
9310
|
+
const tools = toStringList(fields.tools);
|
|
9311
|
+
if (tools.length > 0) definition.tools = tools;
|
|
9312
|
+
const sandbox = resolveSandbox(fields, filename);
|
|
9313
|
+
if (sandbox !== void 0) definition.sandbox = sandbox;
|
|
9314
|
+
const name = asString(fields.name) ?? filename.replace(/\.md$/, "");
|
|
9304
9315
|
return { name, definition };
|
|
9305
9316
|
}
|
|
9317
|
+
function rejectUnknownFields(fields, filename) {
|
|
9318
|
+
for (const key2 of Object.keys(fields)) {
|
|
9319
|
+
if (!ACCEPTED_FIELDS.has(key2)) {
|
|
9320
|
+
throw new exports.ConfigurationError(
|
|
9321
|
+
`Subagent ${filename}: unknown frontmatter field "${key2}" (accepted: ${[...ACCEPTED_FIELDS].join(", ")})`,
|
|
9322
|
+
{ code: "subagent_unknown_field" }
|
|
9323
|
+
);
|
|
9324
|
+
}
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
function rejectMcp(fields, filename) {
|
|
9328
|
+
if (fields.mcp !== void 0) {
|
|
9329
|
+
throw new exports.ConfigurationError(
|
|
9330
|
+
`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`,
|
|
9331
|
+
{ code: "subagent_mcp_unsupported_local" }
|
|
9332
|
+
);
|
|
9333
|
+
}
|
|
9334
|
+
}
|
|
9335
|
+
function resolveModel(fields, filename) {
|
|
9336
|
+
const modelId = asString(fields.model);
|
|
9337
|
+
const effort = asString(fields.reasoning_effort);
|
|
9338
|
+
if (effort !== void 0 && modelId === void 0) {
|
|
9339
|
+
throw new exports.ConfigurationError(
|
|
9340
|
+
`Subagent ${filename}: reasoning_effort requires a model (effort is a model parameter)`,
|
|
9341
|
+
{ code: "subagent_reasoning_effort_without_model" }
|
|
9342
|
+
);
|
|
9343
|
+
}
|
|
9344
|
+
if (modelId === void 0) return void 0;
|
|
9345
|
+
if (modelId === "inherit") return "inherit";
|
|
9346
|
+
return effort !== void 0 ? { id: modelId, params: [{ id: "thinking", value: effort }] } : { id: modelId };
|
|
9347
|
+
}
|
|
9348
|
+
function resolveSandbox(fields, filename) {
|
|
9349
|
+
if (fields.sandbox === void 0) return void 0;
|
|
9350
|
+
if (typeof fields.sandbox !== "boolean") {
|
|
9351
|
+
throw new exports.ConfigurationError(
|
|
9352
|
+
`Subagent ${filename}: sandbox must be a boolean (got "${String(fields.sandbox)}"); granular sandbox modes are not supported by the runtime`,
|
|
9353
|
+
{ code: "subagent_sandbox_not_boolean" }
|
|
9354
|
+
);
|
|
9355
|
+
}
|
|
9356
|
+
return fields.sandbox;
|
|
9357
|
+
}
|
|
9358
|
+
function asString(v) {
|
|
9359
|
+
return typeof v === "string" ? v : void 0;
|
|
9360
|
+
}
|
|
9361
|
+
function toStringList(v) {
|
|
9362
|
+
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
9363
|
+
if (typeof v === "string") {
|
|
9364
|
+
return v.split(/[\s,]+/).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
9365
|
+
}
|
|
9366
|
+
return [];
|
|
9367
|
+
}
|
|
9306
9368
|
function splitFrontmatter(raw, filename) {
|
|
9307
9369
|
const match = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/.exec(raw);
|
|
9308
9370
|
if (match === null) {
|
|
@@ -9313,12 +9375,7 @@ function splitFrontmatter(raw, filename) {
|
|
|
9313
9375
|
return { frontmatter: match[1] ?? "", body: (match[2] ?? "").trim() };
|
|
9314
9376
|
}
|
|
9315
9377
|
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;
|
|
9378
|
+
return parseSimpleYaml(frontmatter);
|
|
9322
9379
|
}
|
|
9323
9380
|
|
|
9324
9381
|
// src/define-tool.ts
|
|
@@ -9517,12 +9574,12 @@ init_path_guard();
|
|
|
9517
9574
|
|
|
9518
9575
|
// src/internal/runtime/skills/skill-frontmatter.ts
|
|
9519
9576
|
init_errors();
|
|
9520
|
-
function
|
|
9577
|
+
function asString2(v) {
|
|
9521
9578
|
return typeof v === "string" ? v : void 0;
|
|
9522
9579
|
}
|
|
9523
9580
|
function toStringFields(raw) {
|
|
9524
9581
|
const out = {};
|
|
9525
|
-
for (const [k, v] of Object.entries(raw)) out[k] =
|
|
9582
|
+
for (const [k, v] of Object.entries(raw)) out[k] = asString2(v);
|
|
9526
9583
|
return out;
|
|
9527
9584
|
}
|
|
9528
9585
|
function parseSkillFrontmatter(raw, fallbackName) {
|
|
@@ -16406,10 +16463,11 @@ ${lines.join("\n")}
|
|
|
16406
16463
|
</subagent-tool-results>`;
|
|
16407
16464
|
}
|
|
16408
16465
|
function buildChildCreateOptions(spec, inherited) {
|
|
16409
|
-
const model = spec.model ? { id: spec.model } : inherited?.model;
|
|
16466
|
+
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
16410
16467
|
return {
|
|
16411
16468
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
16412
16469
|
...model !== void 0 ? { model } : {},
|
|
16470
|
+
...spec.sandbox === true ? { local: { sandboxOptions: { enabled: true } } } : {},
|
|
16413
16471
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
16414
16472
|
systemPrompt: spec.instructions,
|
|
16415
16473
|
tools: spec.tools ?? []
|
|
@@ -16518,7 +16576,10 @@ function subAgentToolsFromDefinitions(agents2, parentTools) {
|
|
|
16518
16576
|
name,
|
|
16519
16577
|
description: def.description,
|
|
16520
16578
|
instructions: def.prompt,
|
|
16521
|
-
|
|
16579
|
+
// Carry the FULL ModelSelection (id + reasoning params), not just the id, so
|
|
16580
|
+
// per-subagent reasoning effort survives to buildChildCreateOptions.
|
|
16581
|
+
...def.model !== void 0 && def.model !== "inherit" ? { model: def.model } : {},
|
|
16582
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {},
|
|
16522
16583
|
tools: [...childTools]
|
|
16523
16584
|
});
|
|
16524
16585
|
});
|