@theokit/sdk 4.6.1 → 4.7.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 +12 -0
- package/dist/cron.cjs +42 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +42 -6
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +42 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +42 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +42 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/types.d.ts +17 -1
- package/package.json +13 -12
package/dist/index.js
CHANGED
|
@@ -6983,7 +6983,8 @@ function applyExtraRunFields(base, script) {
|
|
|
6983
6983
|
// src/internal/runtime/fixtures/fixture-run-base.ts
|
|
6984
6984
|
function prepareRunContext(message) {
|
|
6985
6985
|
const userText = typeof message === "string" ? message : message.text;
|
|
6986
|
-
|
|
6986
|
+
const userImages = typeof message === "string" ? void 0 : message.images;
|
|
6987
|
+
return { userText, userImages, id: generateRunId(), startTime: Date.now() };
|
|
6987
6988
|
}
|
|
6988
6989
|
var FixtureRunBase = class {
|
|
6989
6990
|
id;
|
|
@@ -12070,6 +12071,15 @@ function buildAssistantTurn(text, toolCalls) {
|
|
|
12070
12071
|
}
|
|
12071
12072
|
|
|
12072
12073
|
// src/internal/agent-loop/loop-context-init.ts
|
|
12074
|
+
function buildUserContent(text, images) {
|
|
12075
|
+
const content = [{ type: "text", text }];
|
|
12076
|
+
for (const img of images ?? []) {
|
|
12077
|
+
content.push(
|
|
12078
|
+
"data" in img ? { type: "image", source: { type: "base64", media_type: img.mimeType, data: img.data } } : { type: "image", source: { type: "url", url: img.url } }
|
|
12079
|
+
);
|
|
12080
|
+
}
|
|
12081
|
+
return content;
|
|
12082
|
+
}
|
|
12073
12083
|
function buildAgentRef(inputs) {
|
|
12074
12084
|
return {
|
|
12075
12085
|
agentId: inputs.agentId,
|
|
@@ -12157,7 +12167,7 @@ async function initLoopContext(inputs) {
|
|
|
12157
12167
|
conversation: [],
|
|
12158
12168
|
messages: [
|
|
12159
12169
|
...priorMessages,
|
|
12160
|
-
{ role: "user", content:
|
|
12170
|
+
{ role: "user", content: buildUserContent(inputs.userMessage, inputs.userImages) }
|
|
12161
12171
|
],
|
|
12162
12172
|
tools,
|
|
12163
12173
|
finalText: "",
|
|
@@ -14193,6 +14203,9 @@ function toAnthropicWireMessage(message) {
|
|
|
14193
14203
|
if (part.type === "tool_use") {
|
|
14194
14204
|
return { type: "tool_use", id: part.id, name: part.name, input: part.input };
|
|
14195
14205
|
}
|
|
14206
|
+
if (part.type === "image") {
|
|
14207
|
+
return { type: "image", source: part.source };
|
|
14208
|
+
}
|
|
14196
14209
|
return {
|
|
14197
14210
|
type: "tool_result",
|
|
14198
14211
|
tool_use_id: part.toolUseId,
|
|
@@ -14736,6 +14749,9 @@ function readOpenAiContent(body) {
|
|
|
14736
14749
|
return void 0;
|
|
14737
14750
|
}
|
|
14738
14751
|
|
|
14752
|
+
// src/internal/llm/ollama-native.ts
|
|
14753
|
+
init_errors();
|
|
14754
|
+
|
|
14739
14755
|
// src/internal/error-mappers/ollama.ts
|
|
14740
14756
|
init_errors();
|
|
14741
14757
|
function mapOllamaTransportError(args) {
|
|
@@ -15003,6 +15019,12 @@ function toOllamaMessages(message) {
|
|
|
15003
15019
|
return [{ role: "system", content: joinTextParts(message) }];
|
|
15004
15020
|
}
|
|
15005
15021
|
if (message.role === "user") {
|
|
15022
|
+
if (message.content.some((p) => p.type === "image")) {
|
|
15023
|
+
throw new ConfigurationError(
|
|
15024
|
+
"image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
|
|
15025
|
+
{ code: "ollama_image_unsupported" }
|
|
15026
|
+
);
|
|
15027
|
+
}
|
|
15006
15028
|
const out = [];
|
|
15007
15029
|
for (const part of message.content) {
|
|
15008
15030
|
if (part.type === "tool_result") {
|
|
@@ -15494,7 +15516,20 @@ function userOrToolMessages(message) {
|
|
|
15494
15516
|
}
|
|
15495
15517
|
}
|
|
15496
15518
|
const userText = joinTextParts2(message);
|
|
15497
|
-
|
|
15519
|
+
const imageParts = message.content.filter(
|
|
15520
|
+
(p) => p.type === "image"
|
|
15521
|
+
);
|
|
15522
|
+
if (imageParts.length > 0) {
|
|
15523
|
+
const content = [];
|
|
15524
|
+
if (userText.length > 0) content.push({ type: "text", text: userText });
|
|
15525
|
+
for (const img of imageParts) {
|
|
15526
|
+
const url = img.source.type === "base64" ? `data:${img.source.media_type};base64,${img.source.data}` : img.source.url;
|
|
15527
|
+
content.push({ type: "image_url", image_url: { url } });
|
|
15528
|
+
}
|
|
15529
|
+
out.push({ role: "user", content });
|
|
15530
|
+
} else if (userText.length > 0) {
|
|
15531
|
+
out.push({ role: "user", content: userText });
|
|
15532
|
+
}
|
|
15498
15533
|
return out;
|
|
15499
15534
|
}
|
|
15500
15535
|
function assistantMessage(message) {
|
|
@@ -16681,7 +16716,7 @@ function buildCustomToolsInput(agentOptions, sendOptions, pluginManager, persona
|
|
|
16681
16716
|
|
|
16682
16717
|
// src/internal/local-agent/real-local-run.ts
|
|
16683
16718
|
function createRealLocalRun(options) {
|
|
16684
|
-
const { userText, id, startTime } = prepareRunContext(options.message);
|
|
16719
|
+
const { userText, userImages, id, startTime } = prepareRunContext(options.message);
|
|
16685
16720
|
const supported = /* @__PURE__ */ new Set(["stream", "wait", "cancel", "conversation"]);
|
|
16686
16721
|
const runScript = {
|
|
16687
16722
|
events: [],
|
|
@@ -16700,7 +16735,7 @@ function createRealLocalRun(options) {
|
|
|
16700
16735
|
supportedOps: supported,
|
|
16701
16736
|
startTime
|
|
16702
16737
|
},
|
|
16703
|
-
() => buildLoopInputs(options, id, userText)
|
|
16738
|
+
() => buildLoopInputs(options, id, userText, userImages)
|
|
16704
16739
|
);
|
|
16705
16740
|
handle.bootstrap();
|
|
16706
16741
|
registerRun(handle);
|
|
@@ -16733,7 +16768,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
|
16733
16768
|
if (existing !== void 0 && existing.length > 0) return pools;
|
|
16734
16769
|
return { ...pools ?? {}, [primary]: [apiKey] };
|
|
16735
16770
|
}
|
|
16736
|
-
function buildLoopInputs(options, runId, userText) {
|
|
16771
|
+
function buildLoopInputs(options, runId, userText, userImages) {
|
|
16737
16772
|
const maxIterations = options.sendOptions.maxIterations;
|
|
16738
16773
|
if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
|
|
16739
16774
|
throw new ConfigurationError(
|
|
@@ -16772,6 +16807,7 @@ function buildLoopInputs(options, runId, userText) {
|
|
|
16772
16807
|
...options.model?.params !== void 0 ? { params: options.model.params } : {}
|
|
16773
16808
|
},
|
|
16774
16809
|
userMessage: userText,
|
|
16810
|
+
...userImages !== void 0 ? { userImages } : {},
|
|
16775
16811
|
llm,
|
|
16776
16812
|
mcp: buildMcpMap(options),
|
|
16777
16813
|
hooks: options.hooks,
|