@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/cron.d.cts
CHANGED
package/dist/cron.d.ts
CHANGED
package/dist/cron.js
CHANGED
|
@@ -3274,7 +3274,9 @@ function serializeAgents(agents2) {
|
|
|
3274
3274
|
out[name] = {
|
|
3275
3275
|
description: def.description,
|
|
3276
3276
|
prompt: def.prompt,
|
|
3277
|
-
...def.model !== void 0 ? { model: def.model } : {}
|
|
3277
|
+
...def.model !== void 0 ? { model: def.model } : {},
|
|
3278
|
+
...def.tools !== void 0 ? { tools: def.tools } : {},
|
|
3279
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {}
|
|
3278
3280
|
};
|
|
3279
3281
|
}
|
|
3280
3282
|
return out;
|
|
@@ -6707,22 +6709,86 @@ async function readProjectSubagents(cwd) {
|
|
|
6707
6709
|
}
|
|
6708
6710
|
return subagents;
|
|
6709
6711
|
}
|
|
6712
|
+
var ACCEPTED_FIELDS = /* @__PURE__ */ new Set([
|
|
6713
|
+
"name",
|
|
6714
|
+
"description",
|
|
6715
|
+
"model",
|
|
6716
|
+
"tools",
|
|
6717
|
+
"reasoning_effort",
|
|
6718
|
+
"mcp",
|
|
6719
|
+
"sandbox"
|
|
6720
|
+
]);
|
|
6710
6721
|
function parseSubagentMarkdown(raw, filename) {
|
|
6711
6722
|
const { frontmatter, body } = splitFrontmatter(raw, filename);
|
|
6712
6723
|
const fields = parseFrontmatterFields(frontmatter);
|
|
6713
|
-
|
|
6714
|
-
|
|
6724
|
+
rejectUnknownFields(fields, filename);
|
|
6725
|
+
rejectMcp(fields, filename);
|
|
6715
6726
|
const definition = {
|
|
6716
|
-
description: fields.description ?? "",
|
|
6727
|
+
description: asString(fields.description) ?? "",
|
|
6717
6728
|
prompt: body
|
|
6718
6729
|
};
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6730
|
+
const model = resolveModel(fields, filename);
|
|
6731
|
+
if (model !== void 0) definition.model = model;
|
|
6732
|
+
const tools = toStringList(fields.tools);
|
|
6733
|
+
if (tools.length > 0) definition.tools = tools;
|
|
6734
|
+
const sandbox = resolveSandbox(fields, filename);
|
|
6735
|
+
if (sandbox !== void 0) definition.sandbox = sandbox;
|
|
6736
|
+
const name = asString(fields.name) ?? filename.replace(/\.md$/, "");
|
|
6724
6737
|
return { name, definition };
|
|
6725
6738
|
}
|
|
6739
|
+
function rejectUnknownFields(fields, filename) {
|
|
6740
|
+
for (const key of Object.keys(fields)) {
|
|
6741
|
+
if (!ACCEPTED_FIELDS.has(key)) {
|
|
6742
|
+
throw new ConfigurationError(
|
|
6743
|
+
`Subagent ${filename}: unknown frontmatter field "${key}" (accepted: ${[...ACCEPTED_FIELDS].join(", ")})`,
|
|
6744
|
+
{ code: "subagent_unknown_field" }
|
|
6745
|
+
);
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
}
|
|
6749
|
+
function rejectMcp(fields, filename) {
|
|
6750
|
+
if (fields.mcp !== void 0) {
|
|
6751
|
+
throw new ConfigurationError(
|
|
6752
|
+
`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`,
|
|
6753
|
+
{ code: "subagent_mcp_unsupported_local" }
|
|
6754
|
+
);
|
|
6755
|
+
}
|
|
6756
|
+
}
|
|
6757
|
+
function resolveModel(fields, filename) {
|
|
6758
|
+
const modelId = asString(fields.model);
|
|
6759
|
+
const effort = asString(fields.reasoning_effort);
|
|
6760
|
+
if (effort !== void 0 && (modelId === void 0 || modelId === "inherit")) {
|
|
6761
|
+
throw new ConfigurationError(
|
|
6762
|
+
`Subagent ${filename}: reasoning_effort requires a concrete model (effort is a model parameter; an absent model or "inherit" cannot carry it)`,
|
|
6763
|
+
{ code: "subagent_reasoning_effort_without_model" }
|
|
6764
|
+
);
|
|
6765
|
+
}
|
|
6766
|
+
if (modelId === void 0) return void 0;
|
|
6767
|
+
if (modelId === "inherit") return "inherit";
|
|
6768
|
+
return effort !== void 0 ? { id: modelId, params: [{ id: "thinking", value: effort }] } : { id: modelId };
|
|
6769
|
+
}
|
|
6770
|
+
function resolveSandbox(fields, filename) {
|
|
6771
|
+
if (fields.sandbox === void 0) return void 0;
|
|
6772
|
+
if (typeof fields.sandbox !== "boolean") {
|
|
6773
|
+
throw new ConfigurationError(
|
|
6774
|
+
`Subagent ${filename}: sandbox must be a boolean (got "${String(fields.sandbox)}"); granular sandbox modes are not supported by the runtime`,
|
|
6775
|
+
{ code: "subagent_sandbox_not_boolean" }
|
|
6776
|
+
);
|
|
6777
|
+
}
|
|
6778
|
+
return fields.sandbox;
|
|
6779
|
+
}
|
|
6780
|
+
function asString(v) {
|
|
6781
|
+
if (typeof v !== "string") return void 0;
|
|
6782
|
+
const m = /^(["'])(.*)\1$/.exec(v);
|
|
6783
|
+
return m ? m[2] : v;
|
|
6784
|
+
}
|
|
6785
|
+
function toStringList(v) {
|
|
6786
|
+
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6787
|
+
if (typeof v === "string") {
|
|
6788
|
+
return v.split(/[\s,]+/).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
6789
|
+
}
|
|
6790
|
+
return [];
|
|
6791
|
+
}
|
|
6726
6792
|
function splitFrontmatter(raw, filename) {
|
|
6727
6793
|
const match = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/.exec(raw);
|
|
6728
6794
|
if (match === null) {
|
|
@@ -6733,12 +6799,7 @@ function splitFrontmatter(raw, filename) {
|
|
|
6733
6799
|
return { frontmatter: match[1] ?? "", body: (match[2] ?? "").trim() };
|
|
6734
6800
|
}
|
|
6735
6801
|
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;
|
|
6802
|
+
return parseSimpleYaml(frontmatter);
|
|
6742
6803
|
}
|
|
6743
6804
|
|
|
6744
6805
|
// src/define-tool.ts
|
|
@@ -6936,12 +6997,12 @@ init_errors();
|
|
|
6936
6997
|
|
|
6937
6998
|
// src/internal/runtime/skills/skill-frontmatter.ts
|
|
6938
6999
|
init_errors();
|
|
6939
|
-
function
|
|
7000
|
+
function asString2(v) {
|
|
6940
7001
|
return typeof v === "string" ? v : void 0;
|
|
6941
7002
|
}
|
|
6942
7003
|
function toStringFields(raw) {
|
|
6943
7004
|
const out = {};
|
|
6944
|
-
for (const [k, v] of Object.entries(raw)) out[k] =
|
|
7005
|
+
for (const [k, v] of Object.entries(raw)) out[k] = asString2(v);
|
|
6945
7006
|
return out;
|
|
6946
7007
|
}
|
|
6947
7008
|
function parseSkillFrontmatter(raw, fallbackName) {
|
|
@@ -13805,10 +13866,12 @@ ${lines.join("\n")}
|
|
|
13805
13866
|
</subagent-tool-results>`;
|
|
13806
13867
|
}
|
|
13807
13868
|
function buildChildCreateOptions(spec, inherited) {
|
|
13808
|
-
const model = spec.model ? { id: spec.model } : inherited?.model;
|
|
13869
|
+
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
13870
|
+
const sandbox = spec.sandbox ?? inherited?.sandbox;
|
|
13809
13871
|
return {
|
|
13810
13872
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
13811
13873
|
...model !== void 0 ? { model } : {},
|
|
13874
|
+
...sandbox !== void 0 ? { local: { sandboxOptions: { enabled: sandbox } } } : {},
|
|
13812
13875
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
13813
13876
|
systemPrompt: spec.instructions,
|
|
13814
13877
|
tools: spec.tools ?? []
|
|
@@ -13917,7 +13980,10 @@ function subAgentToolsFromDefinitions(agents2, parentTools) {
|
|
|
13917
13980
|
name,
|
|
13918
13981
|
description: def.description,
|
|
13919
13982
|
instructions: def.prompt,
|
|
13920
|
-
|
|
13983
|
+
// Carry the FULL ModelSelection (id + reasoning params), not just the id, so
|
|
13984
|
+
// per-subagent reasoning effort survives to buildChildCreateOptions.
|
|
13985
|
+
...def.model !== void 0 && def.model !== "inherit" ? { model: def.model } : {},
|
|
13986
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {},
|
|
13921
13987
|
tools: [...childTools]
|
|
13922
13988
|
});
|
|
13923
13989
|
});
|
|
@@ -13981,10 +14047,12 @@ function declarativeSubagentTools(agents2, parentTools) {
|
|
|
13981
14047
|
}
|
|
13982
14048
|
function bindParentCredentials(tools, agentOptions) {
|
|
13983
14049
|
const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
|
|
14050
|
+
const parentSandbox = agentOptions.local?.sandboxOptions?.enabled;
|
|
13984
14051
|
const credentials = {
|
|
13985
14052
|
...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
|
|
13986
14053
|
...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
|
|
13987
|
-
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
|
|
14054
|
+
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {},
|
|
14055
|
+
...parentSandbox !== void 0 ? { sandbox: parentSandbox } : {}
|
|
13988
14056
|
};
|
|
13989
14057
|
for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
|
|
13990
14058
|
}
|