@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/cron.d.cts
CHANGED
package/dist/cron.d.ts
CHANGED
package/dist/cron.js
CHANGED
|
@@ -6707,22 +6707,84 @@ async function readProjectSubagents(cwd) {
|
|
|
6707
6707
|
}
|
|
6708
6708
|
return subagents;
|
|
6709
6709
|
}
|
|
6710
|
+
var ACCEPTED_FIELDS = /* @__PURE__ */ new Set([
|
|
6711
|
+
"name",
|
|
6712
|
+
"description",
|
|
6713
|
+
"model",
|
|
6714
|
+
"tools",
|
|
6715
|
+
"reasoning_effort",
|
|
6716
|
+
"mcp",
|
|
6717
|
+
"sandbox"
|
|
6718
|
+
]);
|
|
6710
6719
|
function parseSubagentMarkdown(raw, filename) {
|
|
6711
6720
|
const { frontmatter, body } = splitFrontmatter(raw, filename);
|
|
6712
6721
|
const fields = parseFrontmatterFields(frontmatter);
|
|
6713
|
-
|
|
6714
|
-
|
|
6722
|
+
rejectUnknownFields(fields, filename);
|
|
6723
|
+
rejectMcp(fields, filename);
|
|
6715
6724
|
const definition = {
|
|
6716
|
-
description: fields.description ?? "",
|
|
6725
|
+
description: asString(fields.description) ?? "",
|
|
6717
6726
|
prompt: body
|
|
6718
6727
|
};
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6728
|
+
const model = resolveModel(fields, filename);
|
|
6729
|
+
if (model !== void 0) definition.model = model;
|
|
6730
|
+
const tools = toStringList(fields.tools);
|
|
6731
|
+
if (tools.length > 0) definition.tools = tools;
|
|
6732
|
+
const sandbox = resolveSandbox(fields, filename);
|
|
6733
|
+
if (sandbox !== void 0) definition.sandbox = sandbox;
|
|
6734
|
+
const name = asString(fields.name) ?? filename.replace(/\.md$/, "");
|
|
6724
6735
|
return { name, definition };
|
|
6725
6736
|
}
|
|
6737
|
+
function rejectUnknownFields(fields, filename) {
|
|
6738
|
+
for (const key of Object.keys(fields)) {
|
|
6739
|
+
if (!ACCEPTED_FIELDS.has(key)) {
|
|
6740
|
+
throw new ConfigurationError(
|
|
6741
|
+
`Subagent ${filename}: unknown frontmatter field "${key}" (accepted: ${[...ACCEPTED_FIELDS].join(", ")})`,
|
|
6742
|
+
{ code: "subagent_unknown_field" }
|
|
6743
|
+
);
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6747
|
+
function rejectMcp(fields, filename) {
|
|
6748
|
+
if (fields.mcp !== void 0) {
|
|
6749
|
+
throw new ConfigurationError(
|
|
6750
|
+
`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`,
|
|
6751
|
+
{ code: "subagent_mcp_unsupported_local" }
|
|
6752
|
+
);
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
function resolveModel(fields, filename) {
|
|
6756
|
+
const modelId = asString(fields.model);
|
|
6757
|
+
const effort = asString(fields.reasoning_effort);
|
|
6758
|
+
if (effort !== void 0 && modelId === void 0) {
|
|
6759
|
+
throw new ConfigurationError(
|
|
6760
|
+
`Subagent ${filename}: reasoning_effort requires a model (effort is a model parameter)`,
|
|
6761
|
+
{ code: "subagent_reasoning_effort_without_model" }
|
|
6762
|
+
);
|
|
6763
|
+
}
|
|
6764
|
+
if (modelId === void 0) return void 0;
|
|
6765
|
+
if (modelId === "inherit") return "inherit";
|
|
6766
|
+
return effort !== void 0 ? { id: modelId, params: [{ id: "thinking", value: effort }] } : { id: modelId };
|
|
6767
|
+
}
|
|
6768
|
+
function resolveSandbox(fields, filename) {
|
|
6769
|
+
if (fields.sandbox === void 0) return void 0;
|
|
6770
|
+
if (typeof fields.sandbox !== "boolean") {
|
|
6771
|
+
throw new ConfigurationError(
|
|
6772
|
+
`Subagent ${filename}: sandbox must be a boolean (got "${String(fields.sandbox)}"); granular sandbox modes are not supported by the runtime`,
|
|
6773
|
+
{ code: "subagent_sandbox_not_boolean" }
|
|
6774
|
+
);
|
|
6775
|
+
}
|
|
6776
|
+
return fields.sandbox;
|
|
6777
|
+
}
|
|
6778
|
+
function asString(v) {
|
|
6779
|
+
return typeof v === "string" ? v : void 0;
|
|
6780
|
+
}
|
|
6781
|
+
function toStringList(v) {
|
|
6782
|
+
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6783
|
+
if (typeof v === "string") {
|
|
6784
|
+
return v.split(/[\s,]+/).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6785
|
+
}
|
|
6786
|
+
return [];
|
|
6787
|
+
}
|
|
6726
6788
|
function splitFrontmatter(raw, filename) {
|
|
6727
6789
|
const match = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/.exec(raw);
|
|
6728
6790
|
if (match === null) {
|
|
@@ -6733,12 +6795,7 @@ function splitFrontmatter(raw, filename) {
|
|
|
6733
6795
|
return { frontmatter: match[1] ?? "", body: (match[2] ?? "").trim() };
|
|
6734
6796
|
}
|
|
6735
6797
|
function parseFrontmatterFields(frontmatter) {
|
|
6736
|
-
|
|
6737
|
-
const out = {};
|
|
6738
|
-
for (const [k, v] of Object.entries(raw)) {
|
|
6739
|
-
out[k] = typeof v === "string" ? v : void 0;
|
|
6740
|
-
}
|
|
6741
|
-
return out;
|
|
6798
|
+
return parseSimpleYaml(frontmatter);
|
|
6742
6799
|
}
|
|
6743
6800
|
|
|
6744
6801
|
// src/define-tool.ts
|
|
@@ -6936,12 +6993,12 @@ init_errors();
|
|
|
6936
6993
|
|
|
6937
6994
|
// src/internal/runtime/skills/skill-frontmatter.ts
|
|
6938
6995
|
init_errors();
|
|
6939
|
-
function
|
|
6996
|
+
function asString2(v) {
|
|
6940
6997
|
return typeof v === "string" ? v : void 0;
|
|
6941
6998
|
}
|
|
6942
6999
|
function toStringFields(raw) {
|
|
6943
7000
|
const out = {};
|
|
6944
|
-
for (const [k, v] of Object.entries(raw)) out[k] =
|
|
7001
|
+
for (const [k, v] of Object.entries(raw)) out[k] = asString2(v);
|
|
6945
7002
|
return out;
|
|
6946
7003
|
}
|
|
6947
7004
|
function parseSkillFrontmatter(raw, fallbackName) {
|
|
@@ -13805,10 +13862,11 @@ ${lines.join("\n")}
|
|
|
13805
13862
|
</subagent-tool-results>`;
|
|
13806
13863
|
}
|
|
13807
13864
|
function buildChildCreateOptions(spec, inherited) {
|
|
13808
|
-
const model = spec.model ? { id: spec.model } : inherited?.model;
|
|
13865
|
+
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
13809
13866
|
return {
|
|
13810
13867
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
13811
13868
|
...model !== void 0 ? { model } : {},
|
|
13869
|
+
...spec.sandbox === true ? { local: { sandboxOptions: { enabled: true } } } : {},
|
|
13812
13870
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
13813
13871
|
systemPrompt: spec.instructions,
|
|
13814
13872
|
tools: spec.tools ?? []
|
|
@@ -13917,7 +13975,10 @@ function subAgentToolsFromDefinitions(agents2, parentTools) {
|
|
|
13917
13975
|
name,
|
|
13918
13976
|
description: def.description,
|
|
13919
13977
|
instructions: def.prompt,
|
|
13920
|
-
|
|
13978
|
+
// Carry the FULL ModelSelection (id + reasoning params), not just the id, so
|
|
13979
|
+
// per-subagent reasoning effort survives to buildChildCreateOptions.
|
|
13980
|
+
...def.model !== void 0 && def.model !== "inherit" ? { model: def.model } : {},
|
|
13981
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {},
|
|
13921
13982
|
tools: [...childTools]
|
|
13922
13983
|
});
|
|
13923
13984
|
});
|