@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.cjs
CHANGED
|
@@ -3272,7 +3272,9 @@ function serializeAgents(agents2) {
|
|
|
3272
3272
|
out[name] = {
|
|
3273
3273
|
description: def.description,
|
|
3274
3274
|
prompt: def.prompt,
|
|
3275
|
-
...def.model !== void 0 ? { model: def.model } : {}
|
|
3275
|
+
...def.model !== void 0 ? { model: def.model } : {},
|
|
3276
|
+
...def.tools !== void 0 ? { tools: def.tools } : {},
|
|
3277
|
+
...def.sandbox !== void 0 ? { sandbox: def.sandbox } : {}
|
|
3276
3278
|
};
|
|
3277
3279
|
}
|
|
3278
3280
|
return out;
|
|
@@ -4363,7 +4365,8 @@ function applyExtraRunFields(base, script) {
|
|
|
4363
4365
|
// src/internal/runtime/fixtures/fixture-run-base.ts
|
|
4364
4366
|
function prepareRunContext(message) {
|
|
4365
4367
|
const userText = typeof message === "string" ? message : message.text;
|
|
4366
|
-
|
|
4368
|
+
const userImages = typeof message === "string" ? void 0 : message.images;
|
|
4369
|
+
return { userText, userImages, id: generateRunId(), startTime: Date.now() };
|
|
4367
4370
|
}
|
|
4368
4371
|
var FixtureRunBase = class {
|
|
4369
4372
|
id;
|
|
@@ -6753,9 +6756,9 @@ function rejectMcp(fields, filename) {
|
|
|
6753
6756
|
function resolveModel(fields, filename) {
|
|
6754
6757
|
const modelId = asString(fields.model);
|
|
6755
6758
|
const effort = asString(fields.reasoning_effort);
|
|
6756
|
-
if (effort !== void 0 && modelId === void 0) {
|
|
6759
|
+
if (effort !== void 0 && (modelId === void 0 || modelId === "inherit")) {
|
|
6757
6760
|
throw new ConfigurationError(
|
|
6758
|
-
`Subagent ${filename}: reasoning_effort requires a model (effort is a model parameter)`,
|
|
6761
|
+
`Subagent ${filename}: reasoning_effort requires a concrete model (effort is a model parameter; an absent model or "inherit" cannot carry it)`,
|
|
6759
6762
|
{ code: "subagent_reasoning_effort_without_model" }
|
|
6760
6763
|
);
|
|
6761
6764
|
}
|
|
@@ -6774,7 +6777,9 @@ function resolveSandbox(fields, filename) {
|
|
|
6774
6777
|
return fields.sandbox;
|
|
6775
6778
|
}
|
|
6776
6779
|
function asString(v) {
|
|
6777
|
-
|
|
6780
|
+
if (typeof v !== "string") return void 0;
|
|
6781
|
+
const m = /^(["'])(.*)\1$/.exec(v);
|
|
6782
|
+
return m ? m[2] : v;
|
|
6778
6783
|
}
|
|
6779
6784
|
function toStringList(v) {
|
|
6780
6785
|
if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);
|
|
@@ -9482,6 +9487,18 @@ function buildAssistantTurn(text, toolCalls) {
|
|
|
9482
9487
|
}
|
|
9483
9488
|
|
|
9484
9489
|
// src/internal/agent-loop/loop-context-init.ts
|
|
9490
|
+
function buildUserContent(text, images) {
|
|
9491
|
+
const content = [{ type: "text", text }];
|
|
9492
|
+
for (const img of images ?? []) {
|
|
9493
|
+
if ("data" in img) {
|
|
9494
|
+
content.push({
|
|
9495
|
+
type: "image",
|
|
9496
|
+
source: { type: "base64", media_type: img.mimeType, data: img.data }
|
|
9497
|
+
});
|
|
9498
|
+
}
|
|
9499
|
+
}
|
|
9500
|
+
return content;
|
|
9501
|
+
}
|
|
9485
9502
|
function buildAgentRef(inputs) {
|
|
9486
9503
|
return {
|
|
9487
9504
|
agentId: inputs.agentId,
|
|
@@ -9569,7 +9586,7 @@ async function initLoopContext(inputs) {
|
|
|
9569
9586
|
conversation: [],
|
|
9570
9587
|
messages: [
|
|
9571
9588
|
...priorMessages,
|
|
9572
|
-
{ role: "user", content:
|
|
9589
|
+
{ role: "user", content: buildUserContent(inputs.userMessage, inputs.userImages) }
|
|
9573
9590
|
],
|
|
9574
9591
|
tools,
|
|
9575
9592
|
finalText: "",
|
|
@@ -11590,6 +11607,9 @@ function toAnthropicWireMessage(message) {
|
|
|
11590
11607
|
if (part.type === "tool_use") {
|
|
11591
11608
|
return { type: "tool_use", id: part.id, name: part.name, input: part.input };
|
|
11592
11609
|
}
|
|
11610
|
+
if (part.type === "image") {
|
|
11611
|
+
return { type: "image", source: part.source };
|
|
11612
|
+
}
|
|
11593
11613
|
return {
|
|
11594
11614
|
type: "tool_result",
|
|
11595
11615
|
tool_use_id: part.toolUseId,
|
|
@@ -12891,7 +12911,20 @@ function userOrToolMessages(message) {
|
|
|
12891
12911
|
}
|
|
12892
12912
|
}
|
|
12893
12913
|
const userText = joinTextParts2(message);
|
|
12894
|
-
|
|
12914
|
+
const imageParts = message.content.filter((p) => p.type === "image");
|
|
12915
|
+
if (imageParts.length > 0) {
|
|
12916
|
+
const content = [];
|
|
12917
|
+
if (userText.length > 0) content.push({ type: "text", text: userText });
|
|
12918
|
+
for (const img of imageParts) {
|
|
12919
|
+
content.push({
|
|
12920
|
+
type: "image_url",
|
|
12921
|
+
image_url: { url: `data:${img.source.media_type};base64,${img.source.data}` }
|
|
12922
|
+
});
|
|
12923
|
+
}
|
|
12924
|
+
out.push({ role: "user", content });
|
|
12925
|
+
} else if (userText.length > 0) {
|
|
12926
|
+
out.push({ role: "user", content: userText });
|
|
12927
|
+
}
|
|
12895
12928
|
return out;
|
|
12896
12929
|
}
|
|
12897
12930
|
function assistantMessage(message) {
|
|
@@ -13861,10 +13894,11 @@ ${lines.join("\n")}
|
|
|
13861
13894
|
}
|
|
13862
13895
|
function buildChildCreateOptions(spec, inherited) {
|
|
13863
13896
|
const model = spec.model !== void 0 ? typeof spec.model === "string" ? { id: spec.model } : spec.model : inherited?.model;
|
|
13897
|
+
const sandbox = spec.sandbox ?? inherited?.sandbox;
|
|
13864
13898
|
return {
|
|
13865
13899
|
...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
|
|
13866
13900
|
...model !== void 0 ? { model } : {},
|
|
13867
|
-
...
|
|
13901
|
+
...sandbox !== void 0 ? { local: { sandboxOptions: { enabled: sandbox } } } : {},
|
|
13868
13902
|
...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
|
|
13869
13903
|
systemPrompt: spec.instructions,
|
|
13870
13904
|
tools: spec.tools ?? []
|
|
@@ -14040,10 +14074,12 @@ function declarativeSubagentTools(agents2, parentTools) {
|
|
|
14040
14074
|
}
|
|
14041
14075
|
function bindParentCredentials(tools, agentOptions) {
|
|
14042
14076
|
const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
|
|
14077
|
+
const parentSandbox = agentOptions.local?.sandboxOptions?.enabled;
|
|
14043
14078
|
const credentials = {
|
|
14044
14079
|
...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
|
|
14045
14080
|
...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
|
|
14046
|
-
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
|
|
14081
|
+
...parentPlugins !== void 0 ? { plugins: parentPlugins } : {},
|
|
14082
|
+
...parentSandbox !== void 0 ? { sandbox: parentSandbox } : {}
|
|
14047
14083
|
};
|
|
14048
14084
|
for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
|
|
14049
14085
|
}
|
|
@@ -14074,7 +14110,7 @@ function buildCustomToolsInput(agentOptions, sendOptions, pluginManager, persona
|
|
|
14074
14110
|
|
|
14075
14111
|
// src/internal/local-agent/real-local-run.ts
|
|
14076
14112
|
function createRealLocalRun(options) {
|
|
14077
|
-
const { userText, id, startTime } = prepareRunContext(options.message);
|
|
14113
|
+
const { userText, userImages, id, startTime } = prepareRunContext(options.message);
|
|
14078
14114
|
const supported = /* @__PURE__ */ new Set(["stream", "wait", "cancel", "conversation"]);
|
|
14079
14115
|
const runScript = {
|
|
14080
14116
|
events: [],
|
|
@@ -14093,7 +14129,7 @@ function createRealLocalRun(options) {
|
|
|
14093
14129
|
supportedOps: supported,
|
|
14094
14130
|
startTime
|
|
14095
14131
|
},
|
|
14096
|
-
() => buildLoopInputs(options, id, userText)
|
|
14132
|
+
() => buildLoopInputs(options, id, userText, userImages)
|
|
14097
14133
|
);
|
|
14098
14134
|
handle.bootstrap();
|
|
14099
14135
|
registerRun(handle);
|
|
@@ -14126,7 +14162,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
|
14126
14162
|
if (existing !== void 0 && existing.length > 0) return pools;
|
|
14127
14163
|
return { ...pools ?? {}, [primary]: [apiKey] };
|
|
14128
14164
|
}
|
|
14129
|
-
function buildLoopInputs(options, runId, userText) {
|
|
14165
|
+
function buildLoopInputs(options, runId, userText, userImages) {
|
|
14130
14166
|
const maxIterations = options.sendOptions.maxIterations;
|
|
14131
14167
|
if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
|
|
14132
14168
|
throw new ConfigurationError(
|
|
@@ -14165,6 +14201,7 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
14165
14201
|
...options.model?.params !== void 0 ? { params: options.model.params } : {}
|
|
14166
14202
|
},
|
|
14167
14203
|
userMessage: userText,
|
|
14204
|
+
...userImages !== void 0 ? { userImages } : {},
|
|
14168
14205
|
llm,
|
|
14169
14206
|
mcp: buildMcpMap(options),
|
|
14170
14207
|
hooks: options.hooks,
|