@theokit/sdk 4.6.0 → 4.7.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 +19 -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/cron.cjs +49 -12
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +49 -12
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +49 -12
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +49 -12
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +49 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -12
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/types.d.ts +14 -1
- package/dist/internal/runtime/registry/agent-registry-store.d.ts +4 -3
- package/package.json +13 -12
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;
|
|
@@ -4360,7 +4362,8 @@ function applyExtraRunFields(base, script) {
|
|
|
4360
4362
|
// src/internal/runtime/fixtures/fixture-run-base.ts
|
|
4361
4363
|
function prepareRunContext(message) {
|
|
4362
4364
|
const userText = typeof message === "string" ? message : message.text;
|
|
4363
|
-
|
|
4365
|
+
const userImages = typeof message === "string" ? void 0 : message.images;
|
|
4366
|
+
return { userText, userImages, id: generateRunId(), startTime: Date.now() };
|
|
4364
4367
|
}
|
|
4365
4368
|
var FixtureRunBase = class {
|
|
4366
4369
|
id;
|
|
@@ -6750,9 +6753,9 @@ function rejectMcp(fields, filename) {
|
|
|
6750
6753
|
function resolveModel(fields, filename) {
|
|
6751
6754
|
const modelId = asString(fields.model);
|
|
6752
6755
|
const effort = asString(fields.reasoning_effort);
|
|
6753
|
-
if (effort !== void 0 && modelId === void 0) {
|
|
6756
|
+
if (effort !== void 0 && (modelId === void 0 || modelId === "inherit")) {
|
|
6754
6757
|
throw new ConfigurationError(
|
|
6755
|
-
`Subagent ${filename}: reasoning_effort requires a model (effort is a model parameter)`,
|
|
6758
|
+
`Subagent ${filename}: reasoning_effort requires a concrete model (effort is a model parameter; an absent model or "inherit" cannot carry it)`,
|
|
6756
6759
|
{ code: "subagent_reasoning_effort_without_model" }
|
|
6757
6760
|
);
|
|
6758
6761
|
}
|
|
@@ -6771,7 +6774,9 @@ function resolveSandbox(fields, filename) {
|
|
|
6771
6774
|
return fields.sandbox;
|
|
6772
6775
|
}
|
|
6773
6776
|
function asString(v) {
|
|
6774
|
-
|
|
6777
|
+
if (typeof v !== "string") return void 0;
|
|
6778
|
+
const m = /^(["'])(.*)\1$/.exec(v);
|
|
6779
|
+
return m ? m[2] : v;
|
|
6775
6780
|
}
|
|
6776
6781
|
function toStringList(v) {
|
|
6777
6782
|
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
@@ -9479,6 +9484,18 @@ function buildAssistantTurn(text, toolCalls) {
|
|
|
9479
9484
|
}
|
|
9480
9485
|
|
|
9481
9486
|
// src/internal/agent-loop/loop-context-init.ts
|
|
9487
|
+
function buildUserContent(text, images) {
|
|
9488
|
+
const content = [{ type: "text", text }];
|
|
9489
|
+
for (const img of images ?? []) {
|
|
9490
|
+
if ("data" in img) {
|
|
9491
|
+
content.push({
|
|
9492
|
+
type: "image",
|
|
9493
|
+
source: { type: "base64", media_type: img.mimeType, data: img.data }
|
|
9494
|
+
});
|
|
9495
|
+
}
|
|
9496
|
+
}
|
|
9497
|
+
return content;
|
|
9498
|
+
}
|
|
9482
9499
|
function buildAgentRef(inputs) {
|
|
9483
9500
|
return {
|
|
9484
9501
|
agentId: inputs.agentId,
|
|
@@ -9566,7 +9583,7 @@ async function initLoopContext(inputs) {
|
|
|
9566
9583
|
conversation: [],
|
|
9567
9584
|
messages: [
|
|
9568
9585
|
...priorMessages,
|
|
9569
|
-
{ role: "user", content:
|
|
9586
|
+
{ role: "user", content: buildUserContent(inputs.userMessage, inputs.userImages) }
|
|
9570
9587
|
],
|
|
9571
9588
|
tools,
|
|
9572
9589
|
finalText: "",
|
|
@@ -11587,6 +11604,9 @@ function toAnthropicWireMessage(message) {
|
|
|
11587
11604
|
if (part.type === "tool_use") {
|
|
11588
11605
|
return { type: "tool_use", id: part.id, name: part.name, input: part.input };
|
|
11589
11606
|
}
|
|
11607
|
+
if (part.type === "image") {
|
|
11608
|
+
return { type: "image", source: part.source };
|
|
11609
|
+
}
|
|
11590
11610
|
return {
|
|
11591
11611
|
type: "tool_result",
|
|
11592
11612
|
tool_use_id: part.toolUseId,
|
|
@@ -12888,7 +12908,20 @@ function userOrToolMessages(message) {
|
|
|
12888
12908
|
}
|
|
12889
12909
|
}
|
|
12890
12910
|
const userText = joinTextParts2(message);
|
|
12891
|
-
|
|
12911
|
+
const imageParts = message.content.filter((p) => p.type === "image");
|
|
12912
|
+
if (imageParts.length > 0) {
|
|
12913
|
+
const content = [];
|
|
12914
|
+
if (userText.length > 0) content.push({ type: "text", text: userText });
|
|
12915
|
+
for (const img of imageParts) {
|
|
12916
|
+
content.push({
|
|
12917
|
+
type: "image_url",
|
|
12918
|
+
image_url: { url: `data:${img.source.media_type};base64,${img.source.data}` }
|
|
12919
|
+
});
|
|
12920
|
+
}
|
|
12921
|
+
out.push({ role: "user", content });
|
|
12922
|
+
} else if (userText.length > 0) {
|
|
12923
|
+
out.push({ role: "user", content: userText });
|
|
12924
|
+
}
|
|
12892
12925
|
return out;
|
|
12893
12926
|
}
|
|
12894
12927
|
function assistantMessage(message) {
|
|
@@ -13858,10 +13891,11 @@ ${lines.join("\n")}
|
|
|
13858
13891
|
}
|
|
13859
13892
|
function buildChildCreateOptions(spec, inherited) {
|
|
13860
13893
|
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
13894
|
+
const sandbox = spec.sandbox ?? inherited?.sandbox;
|
|
13861
13895
|
return {
|
|
13862
13896
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
13863
13897
|
...model !== void 0 ? { model } : {},
|
|
13864
|
-
...
|
|
13898
|
+
...sandbox !== void 0 ? { local: { sandboxOptions: { enabled: sandbox } } } : {},
|
|
13865
13899
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
13866
13900
|
systemPrompt: spec.instructions,
|
|
13867
13901
|
tools: spec.tools ?? []
|
|
@@ -14037,10 +14071,12 @@ function declarativeSubagentTools(agents2, parentTools) {
|
|
|
14037
14071
|
}
|
|
14038
14072
|
function bindParentCredentials(tools, agentOptions) {
|
|
14039
14073
|
const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
|
|
14074
|
+
const parentSandbox = agentOptions.local?.sandboxOptions?.enabled;
|
|
14040
14075
|
const credentials = {
|
|
14041
14076
|
...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
|
|
14042
14077
|
...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
|
|
14043
|
-
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
|
|
14078
|
+
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {},
|
|
14079
|
+
...parentSandbox !== void 0 ? { sandbox: parentSandbox } : {}
|
|
14044
14080
|
};
|
|
14045
14081
|
for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
|
|
14046
14082
|
}
|
|
@@ -14071,7 +14107,7 @@ function buildCustomToolsInput(agentOptions, sendOptions, pluginManager, persona
|
|
|
14071
14107
|
|
|
14072
14108
|
// src/internal/local-agent/real-local-run.ts
|
|
14073
14109
|
function createRealLocalRun(options) {
|
|
14074
|
-
const { userText, id, startTime } = prepareRunContext(options.message);
|
|
14110
|
+
const { userText, userImages, id, startTime } = prepareRunContext(options.message);
|
|
14075
14111
|
const supported = /* @__PURE__ */ new Set(["stream", "wait", "cancel", "conversation"]);
|
|
14076
14112
|
const runScript = {
|
|
14077
14113
|
events: [],
|
|
@@ -14090,7 +14126,7 @@ function createRealLocalRun(options) {
|
|
|
14090
14126
|
supportedOps: supported,
|
|
14091
14127
|
startTime
|
|
14092
14128
|
},
|
|
14093
|
-
() => buildLoopInputs(options, id, userText)
|
|
14129
|
+
() => buildLoopInputs(options, id, userText, userImages)
|
|
14094
14130
|
);
|
|
14095
14131
|
handle.bootstrap();
|
|
14096
14132
|
registerRun(handle);
|
|
@@ -14123,7 +14159,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
|
14123
14159
|
if (existing !== void 0 && existing.length > 0) return pools;
|
|
14124
14160
|
return { ...pools ?? {}, [primary]: [apiKey] };
|
|
14125
14161
|
}
|
|
14126
|
-
function buildLoopInputs(options, runId, userText) {
|
|
14162
|
+
function buildLoopInputs(options, runId, userText, userImages) {
|
|
14127
14163
|
const maxIterations = options.sendOptions.maxIterations;
|
|
14128
14164
|
if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
|
|
14129
14165
|
throw new ConfigurationError(
|
|
@@ -14162,6 +14198,7 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
14162
14198
|
...options.model?.params !== void 0 ? { params: options.model.params } : {}
|
|
14163
14199
|
},
|
|
14164
14200
|
userMessage: userText,
|
|
14201
|
+
...userImages !== void 0 ? { userImages } : {},
|
|
14165
14202
|
llm,
|
|
14166
14203
|
mcp: buildMcpMap(options),
|
|
14167
14204
|
hooks: options.hooks,
|