@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/eval.js
CHANGED
|
@@ -3269,7 +3269,9 @@ function serializeAgents(agents2) {
|
|
|
3269
3269
|
out[name] = {
|
|
3270
3270
|
description: def.description,
|
|
3271
3271
|
prompt: def.prompt,
|
|
3272
|
-
...def.model !== void 0 ? { model: def.model } : {}
|
|
3272
|
+
...def.model !== void 0 ? { model: def.model } : {},
|
|
3273
|
+
...def.tools !== void 0 ? { tools: def.tools } : {},
|
|
3274
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {}
|
|
3273
3275
|
};
|
|
3274
3276
|
}
|
|
3275
3277
|
return out;
|
|
@@ -6702,22 +6704,86 @@ async function readProjectSubagents(cwd) {
|
|
|
6702
6704
|
}
|
|
6703
6705
|
return subagents;
|
|
6704
6706
|
}
|
|
6707
|
+
var ACCEPTED_FIELDS = /* @__PURE__ */ new Set([
|
|
6708
|
+
"name",
|
|
6709
|
+
"description",
|
|
6710
|
+
"model",
|
|
6711
|
+
"tools",
|
|
6712
|
+
"reasoning_effort",
|
|
6713
|
+
"mcp",
|
|
6714
|
+
"sandbox"
|
|
6715
|
+
]);
|
|
6705
6716
|
function parseSubagentMarkdown(raw, filename) {
|
|
6706
6717
|
const { frontmatter, body } = splitFrontmatter(raw, filename);
|
|
6707
6718
|
const fields = parseFrontmatterFields(frontmatter);
|
|
6708
|
-
|
|
6709
|
-
|
|
6719
|
+
rejectUnknownFields(fields, filename);
|
|
6720
|
+
rejectMcp(fields, filename);
|
|
6710
6721
|
const definition = {
|
|
6711
|
-
description: fields.description ?? "",
|
|
6722
|
+
description: asString(fields.description) ?? "",
|
|
6712
6723
|
prompt: body
|
|
6713
6724
|
};
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6725
|
+
const model = resolveModel(fields, filename);
|
|
6726
|
+
if (model !== void 0) definition.model = model;
|
|
6727
|
+
const tools = toStringList(fields.tools);
|
|
6728
|
+
if (tools.length > 0) definition.tools = tools;
|
|
6729
|
+
const sandbox = resolveSandbox(fields, filename);
|
|
6730
|
+
if (sandbox !== void 0) definition.sandbox = sandbox;
|
|
6731
|
+
const name = asString(fields.name) ?? filename.replace(/\.md$/, "");
|
|
6719
6732
|
return { name, definition };
|
|
6720
6733
|
}
|
|
6734
|
+
function rejectUnknownFields(fields, filename) {
|
|
6735
|
+
for (const key of Object.keys(fields)) {
|
|
6736
|
+
if (!ACCEPTED_FIELDS.has(key)) {
|
|
6737
|
+
throw new ConfigurationError(
|
|
6738
|
+
`Subagent ${filename}: unknown frontmatter field "${key}" (accepted: ${[...ACCEPTED_FIELDS].join(", ")})`,
|
|
6739
|
+
{ code: "subagent_unknown_field" }
|
|
6740
|
+
);
|
|
6741
|
+
}
|
|
6742
|
+
}
|
|
6743
|
+
}
|
|
6744
|
+
function rejectMcp(fields, filename) {
|
|
6745
|
+
if (fields.mcp !== void 0) {
|
|
6746
|
+
throw new ConfigurationError(
|
|
6747
|
+
`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`,
|
|
6748
|
+
{ code: "subagent_mcp_unsupported_local" }
|
|
6749
|
+
);
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
function resolveModel(fields, filename) {
|
|
6753
|
+
const modelId = asString(fields.model);
|
|
6754
|
+
const effort = asString(fields.reasoning_effort);
|
|
6755
|
+
if (effort !== void 0 && (modelId === void 0 || modelId === "inherit")) {
|
|
6756
|
+
throw new ConfigurationError(
|
|
6757
|
+
`Subagent ${filename}: reasoning_effort requires a concrete model (effort is a model parameter; an absent model or "inherit" cannot carry it)`,
|
|
6758
|
+
{ code: "subagent_reasoning_effort_without_model" }
|
|
6759
|
+
);
|
|
6760
|
+
}
|
|
6761
|
+
if (modelId === void 0) return void 0;
|
|
6762
|
+
if (modelId === "inherit") return "inherit";
|
|
6763
|
+
return effort !== void 0 ? { id: modelId, params: [{ id: "thinking", value: effort }] } : { id: modelId };
|
|
6764
|
+
}
|
|
6765
|
+
function resolveSandbox(fields, filename) {
|
|
6766
|
+
if (fields.sandbox === void 0) return void 0;
|
|
6767
|
+
if (typeof fields.sandbox !== "boolean") {
|
|
6768
|
+
throw new ConfigurationError(
|
|
6769
|
+
`Subagent ${filename}: sandbox must be a boolean (got "${String(fields.sandbox)}"); granular sandbox modes are not supported by the runtime`,
|
|
6770
|
+
{ code: "subagent_sandbox_not_boolean" }
|
|
6771
|
+
);
|
|
6772
|
+
}
|
|
6773
|
+
return fields.sandbox;
|
|
6774
|
+
}
|
|
6775
|
+
function asString(v) {
|
|
6776
|
+
if (typeof v !== "string") return void 0;
|
|
6777
|
+
const m = /^(["'])(.*)\1$/.exec(v);
|
|
6778
|
+
return m ? m[2] : v;
|
|
6779
|
+
}
|
|
6780
|
+
function toStringList(v) {
|
|
6781
|
+
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6782
|
+
if (typeof v === "string") {
|
|
6783
|
+
return v.split(/[\s,]+/).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6784
|
+
}
|
|
6785
|
+
return [];
|
|
6786
|
+
}
|
|
6721
6787
|
function splitFrontmatter(raw, filename) {
|
|
6722
6788
|
const match = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/.exec(raw);
|
|
6723
6789
|
if (match === null) {
|
|
@@ -6728,12 +6794,7 @@ function splitFrontmatter(raw, filename) {
|
|
|
6728
6794
|
return { frontmatter: match[1] ?? "", body: (match[2] ?? "").trim() };
|
|
6729
6795
|
}
|
|
6730
6796
|
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;
|
|
6797
|
+
return parseSimpleYaml(frontmatter);
|
|
6737
6798
|
}
|
|
6738
6799
|
|
|
6739
6800
|
// src/define-tool.ts
|
|
@@ -6931,12 +6992,12 @@ init_errors();
|
|
|
6931
6992
|
|
|
6932
6993
|
// src/internal/runtime/skills/skill-frontmatter.ts
|
|
6933
6994
|
init_errors();
|
|
6934
|
-
function
|
|
6995
|
+
function asString2(v) {
|
|
6935
6996
|
return typeof v === "string" ? v : void 0;
|
|
6936
6997
|
}
|
|
6937
6998
|
function toStringFields(raw) {
|
|
6938
6999
|
const out = {};
|
|
6939
|
-
for (const [k, v] of Object.entries(raw)) out[k] =
|
|
7000
|
+
for (const [k, v] of Object.entries(raw)) out[k] = asString2(v);
|
|
6940
7001
|
return out;
|
|
6941
7002
|
}
|
|
6942
7003
|
function parseSkillFrontmatter(raw, fallbackName) {
|
|
@@ -13800,10 +13861,12 @@ ${lines.join("\n")}
|
|
|
13800
13861
|
</subagent-tool-results>`;
|
|
13801
13862
|
}
|
|
13802
13863
|
function buildChildCreateOptions(spec, inherited) {
|
|
13803
|
-
const model = spec.model ? { id: spec.model } : inherited?.model;
|
|
13864
|
+
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
13865
|
+
const sandbox = spec.sandbox ?? inherited?.sandbox;
|
|
13804
13866
|
return {
|
|
13805
13867
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
13806
13868
|
...model !== void 0 ? { model } : {},
|
|
13869
|
+
...sandbox !== void 0 ? { local: { sandboxOptions: { enabled: sandbox } } } : {},
|
|
13807
13870
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
13808
13871
|
systemPrompt: spec.instructions,
|
|
13809
13872
|
tools: spec.tools ?? []
|
|
@@ -13912,7 +13975,10 @@ function subAgentToolsFromDefinitions(agents2, parentTools) {
|
|
|
13912
13975
|
name,
|
|
13913
13976
|
description: def.description,
|
|
13914
13977
|
instructions: def.prompt,
|
|
13915
|
-
|
|
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 } : {},
|
|
13916
13982
|
tools: [...childTools]
|
|
13917
13983
|
});
|
|
13918
13984
|
});
|
|
@@ -13976,10 +14042,12 @@ function declarativeSubagentTools(agents2, parentTools) {
|
|
|
13976
14042
|
}
|
|
13977
14043
|
function bindParentCredentials(tools, agentOptions) {
|
|
13978
14044
|
const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
|
|
14045
|
+
const parentSandbox = agentOptions.local?.sandboxOptions?.enabled;
|
|
13979
14046
|
const credentials = {
|
|
13980
14047
|
...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
|
|
13981
14048
|
...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
|
|
13982
|
-
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
|
|
14049
|
+
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {},
|
|
14050
|
+
...parentSandbox !== void 0 ? { sandbox: parentSandbox } : {}
|
|
13983
14051
|
};
|
|
13984
14052
|
for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
|
|
13985
14053
|
}
|