@theokit/sdk 4.5.1 → 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 +11 -0
- 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/package.json +1 -1
package/dist/eval.js
CHANGED
|
@@ -6702,22 +6702,84 @@ async function readProjectSubagents(cwd) {
|
|
|
6702
6702
|
}
|
|
6703
6703
|
return subagents;
|
|
6704
6704
|
}
|
|
6705
|
+
var ACCEPTED_FIELDS = /* @__PURE__ */ new Set([
|
|
6706
|
+
"name",
|
|
6707
|
+
"description",
|
|
6708
|
+
"model",
|
|
6709
|
+
"tools",
|
|
6710
|
+
"reasoning_effort",
|
|
6711
|
+
"mcp",
|
|
6712
|
+
"sandbox"
|
|
6713
|
+
]);
|
|
6705
6714
|
function parseSubagentMarkdown(raw, filename) {
|
|
6706
6715
|
const { frontmatter, body } = splitFrontmatter(raw, filename);
|
|
6707
6716
|
const fields = parseFrontmatterFields(frontmatter);
|
|
6708
|
-
|
|
6709
|
-
|
|
6717
|
+
rejectUnknownFields(fields, filename);
|
|
6718
|
+
rejectMcp(fields, filename);
|
|
6710
6719
|
const definition = {
|
|
6711
|
-
description: fields.description ?? "",
|
|
6720
|
+
description: asString(fields.description) ?? "",
|
|
6712
6721
|
prompt: body
|
|
6713
6722
|
};
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6723
|
+
const model = resolveModel(fields, filename);
|
|
6724
|
+
if (model !== void 0) definition.model = model;
|
|
6725
|
+
const tools = toStringList(fields.tools);
|
|
6726
|
+
if (tools.length > 0) definition.tools = tools;
|
|
6727
|
+
const sandbox = resolveSandbox(fields, filename);
|
|
6728
|
+
if (sandbox !== void 0) definition.sandbox = sandbox;
|
|
6729
|
+
const name = asString(fields.name) ?? filename.replace(/\.md$/, "");
|
|
6719
6730
|
return { name, definition };
|
|
6720
6731
|
}
|
|
6732
|
+
function rejectUnknownFields(fields, filename) {
|
|
6733
|
+
for (const key of Object.keys(fields)) {
|
|
6734
|
+
if (!ACCEPTED_FIELDS.has(key)) {
|
|
6735
|
+
throw new ConfigurationError(
|
|
6736
|
+
`Subagent ${filename}: unknown frontmatter field "${key}" (accepted: ${[...ACCEPTED_FIELDS].join(", ")})`,
|
|
6737
|
+
{ code: "subagent_unknown_field" }
|
|
6738
|
+
);
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
function rejectMcp(fields, filename) {
|
|
6743
|
+
if (fields.mcp !== void 0) {
|
|
6744
|
+
throw new ConfigurationError(
|
|
6745
|
+
`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`,
|
|
6746
|
+
{ code: "subagent_mcp_unsupported_local" }
|
|
6747
|
+
);
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
function resolveModel(fields, filename) {
|
|
6751
|
+
const modelId = asString(fields.model);
|
|
6752
|
+
const effort = asString(fields.reasoning_effort);
|
|
6753
|
+
if (effort !== void 0 && modelId === void 0) {
|
|
6754
|
+
throw new ConfigurationError(
|
|
6755
|
+
`Subagent ${filename}: reasoning_effort requires a model (effort is a model parameter)`,
|
|
6756
|
+
{ code: "subagent_reasoning_effort_without_model" }
|
|
6757
|
+
);
|
|
6758
|
+
}
|
|
6759
|
+
if (modelId === void 0) return void 0;
|
|
6760
|
+
if (modelId === "inherit") return "inherit";
|
|
6761
|
+
return effort !== void 0 ? { id: modelId, params: [{ id: "thinking", value: effort }] } : { id: modelId };
|
|
6762
|
+
}
|
|
6763
|
+
function resolveSandbox(fields, filename) {
|
|
6764
|
+
if (fields.sandbox === void 0) return void 0;
|
|
6765
|
+
if (typeof fields.sandbox !== "boolean") {
|
|
6766
|
+
throw new ConfigurationError(
|
|
6767
|
+
`Subagent ${filename}: sandbox must be a boolean (got "${String(fields.sandbox)}"); granular sandbox modes are not supported by the runtime`,
|
|
6768
|
+
{ code: "subagent_sandbox_not_boolean" }
|
|
6769
|
+
);
|
|
6770
|
+
}
|
|
6771
|
+
return fields.sandbox;
|
|
6772
|
+
}
|
|
6773
|
+
function asString(v) {
|
|
6774
|
+
return typeof v === "string" ? v : void 0;
|
|
6775
|
+
}
|
|
6776
|
+
function toStringList(v) {
|
|
6777
|
+
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6778
|
+
if (typeof v === "string") {
|
|
6779
|
+
return v.split(/[\s,]+/).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6780
|
+
}
|
|
6781
|
+
return [];
|
|
6782
|
+
}
|
|
6721
6783
|
function splitFrontmatter(raw, filename) {
|
|
6722
6784
|
const match = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/.exec(raw);
|
|
6723
6785
|
if (match === null) {
|
|
@@ -6728,12 +6790,7 @@ function splitFrontmatter(raw, filename) {
|
|
|
6728
6790
|
return { frontmatter: match[1] ?? "", body: (match[2] ?? "").trim() };
|
|
6729
6791
|
}
|
|
6730
6792
|
function parseFrontmatterFields(frontmatter) {
|
|
6731
|
-
|
|
6732
|
-
const out = {};
|
|
6733
|
-
for (const [k, v] of Object.entries(raw)) {
|
|
6734
|
-
out[k] = typeof v === "string" ? v : void 0;
|
|
6735
|
-
}
|
|
6736
|
-
return out;
|
|
6793
|
+
return parseSimpleYaml(frontmatter);
|
|
6737
6794
|
}
|
|
6738
6795
|
|
|
6739
6796
|
// src/define-tool.ts
|
|
@@ -6931,12 +6988,12 @@ init_errors();
|
|
|
6931
6988
|
|
|
6932
6989
|
// src/internal/runtime/skills/skill-frontmatter.ts
|
|
6933
6990
|
init_errors();
|
|
6934
|
-
function
|
|
6991
|
+
function asString2(v) {
|
|
6935
6992
|
return typeof v === "string" ? v : void 0;
|
|
6936
6993
|
}
|
|
6937
6994
|
function toStringFields(raw) {
|
|
6938
6995
|
const out = {};
|
|
6939
|
-
for (const [k, v] of Object.entries(raw)) out[k] =
|
|
6996
|
+
for (const [k, v] of Object.entries(raw)) out[k] = asString2(v);
|
|
6940
6997
|
return out;
|
|
6941
6998
|
}
|
|
6942
6999
|
function parseSkillFrontmatter(raw, fallbackName) {
|
|
@@ -13800,10 +13857,11 @@ ${lines.join("\n")}
|
|
|
13800
13857
|
</subagent-tool-results>`;
|
|
13801
13858
|
}
|
|
13802
13859
|
function buildChildCreateOptions(spec, inherited) {
|
|
13803
|
-
const model = spec.model ? { id: spec.model } : inherited?.model;
|
|
13860
|
+
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
13804
13861
|
return {
|
|
13805
13862
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
13806
13863
|
...model !== void 0 ? { model } : {},
|
|
13864
|
+
...spec.sandbox === true ? { local: { sandboxOptions: { enabled: true } } } : {},
|
|
13807
13865
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
13808
13866
|
systemPrompt: spec.instructions,
|
|
13809
13867
|
tools: spec.tools ?? []
|
|
@@ -13912,7 +13970,10 @@ function subAgentToolsFromDefinitions(agents2, parentTools) {
|
|
|
13912
13970
|
name,
|
|
13913
13971
|
description: def.description,
|
|
13914
13972
|
instructions: def.prompt,
|
|
13915
|
-
|
|
13973
|
+
// Carry the FULL ModelSelection (id + reasoning params), not just the id, so
|
|
13974
|
+
// per-subagent reasoning effort survives to buildChildCreateOptions.
|
|
13975
|
+
...def.model !== void 0 && def.model !== "inherit" ? { model: def.model } : {},
|
|
13976
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {},
|
|
13916
13977
|
tools: [...childTools]
|
|
13917
13978
|
});
|
|
13918
13979
|
});
|