@theokit/sdk 2.0.0 → 2.0.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 +18 -0
- package/dist/a2a/index.cjs +154 -148
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +154 -148
- package/dist/a2a/index.js.map +1 -1
- package/dist/{cron-Ci_NUkUj.d.ts → cron-Bj8-Aq1O.d.ts} +1 -1
- package/dist/{cron-Bse1MbaE.d.cts → cron-DFG9-W17.d.cts} +1 -1
- package/dist/cron.cjs +135 -128
- 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 +138 -131
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +134 -124
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.d.cts +1 -0
- package/dist/eval.d.ts +1 -0
- package/dist/eval.js +137 -127
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +113 -106
- 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 +113 -106
- package/dist/index.js.map +1 -1
- package/dist/internal/runtime/{fork-agent.d.ts → lifecycle/fork-agent.d.ts} +1 -1
- package/dist/internal/runtime/{run-until.d.ts → lifecycle/run-until.d.ts} +3 -3
- package/dist/internal/runtime/local-agent/local-agent-bootstrap.d.ts +1 -1
- package/dist/internal/runtime/registry/agent-factory-registry.d.ts +12 -9
- package/dist/internal/scorers/llm-judge.d.ts +4 -4
- package/dist/internal/security/index.d.cts +1 -1
- package/dist/internal/security/index.d.ts +1 -1
- package/dist/types/fork.d.ts +1 -1
- package/dist/workflow.cjs +2 -2
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js +2 -2
- package/dist/workflow.js.map +1 -1
- package/package.json +6 -2
- /package/dist/internal/{errors/mappers → error-mappers}/anthropic.d.ts +0 -0
- /package/dist/internal/{errors/mappers → error-mappers}/bedrock.d.ts +0 -0
- /package/dist/internal/{errors/mappers → error-mappers}/ollama.d.ts +0 -0
- /package/dist/internal/{errors/mappers → error-mappers}/openai-compatible.d.ts +0 -0
- /package/dist/internal/{errors/mappers → error-mappers}/shared.d.ts +0 -0
- /package/dist/internal/{errors/mappers → error-mappers}/vertex.d.ts +0 -0
- /package/dist/internal/runtime/{abort-utils.d.ts → concurrency/abort-utils.d.ts} +0 -0
- /package/dist/internal/runtime/{async-local-storage.d.ts → concurrency/async-local-storage.d.ts} +0 -0
- /package/dist/internal/runtime/{async-semaphore.d.ts → concurrency/async-semaphore.d.ts} +0 -0
- /package/dist/internal/runtime/{default-model.d.ts → config/default-model.d.ts} +0 -0
- /package/dist/internal/runtime/{providers-manager.d.ts → config/providers-manager.d.ts} +0 -0
- /package/dist/internal/runtime/{workspace-dir.d.ts → config/workspace-dir.d.ts} +0 -0
- /package/dist/internal/runtime/{yaml-frontmatter.d.ts → context/yaml-frontmatter.d.ts} +0 -0
- /package/dist/internal/runtime/{post-run-lifecycle.d.ts → lifecycle/post-run-lifecycle.d.ts} +0 -0
- /package/dist/internal/runtime/{spawn-collect.d.ts → lifecycle/spawn-collect.d.ts} +0 -0
- /package/dist/internal/runtime/{system-prompt.d.ts → system-prompt/system-prompt.d.ts} +0 -0
- /package/dist/internal/runtime/{shell-tool.d.ts → tools/shell-tool.d.ts} +0 -0
- /package/dist/internal/runtime/{validate-agent-options.d.ts → validation/validate-agent-options.d.ts} +0 -0
- /package/dist/internal/runtime/{validate-response.d.ts → validation/validate-response.d.ts} +0 -0
package/dist/eval.cjs
CHANGED
|
@@ -585,7 +585,7 @@ var init_atomic_write = __esm({
|
|
|
585
585
|
}
|
|
586
586
|
});
|
|
587
587
|
|
|
588
|
-
// src/internal/runtime/yaml-frontmatter.ts
|
|
588
|
+
// src/internal/runtime/context/yaml-frontmatter.ts
|
|
589
589
|
function parseSimpleYaml(text) {
|
|
590
590
|
const fields = {};
|
|
591
591
|
for (const line of text.split(/\r?\n/)) {
|
|
@@ -609,7 +609,7 @@ function coerce(raw) {
|
|
|
609
609
|
return raw;
|
|
610
610
|
}
|
|
611
611
|
var init_yaml_frontmatter = __esm({
|
|
612
|
-
"src/internal/runtime/yaml-frontmatter.ts"() {
|
|
612
|
+
"src/internal/runtime/context/yaml-frontmatter.ts"() {
|
|
613
613
|
}
|
|
614
614
|
});
|
|
615
615
|
async function loadMarkdownEntities(opts) {
|
|
@@ -812,7 +812,7 @@ function checkToolWhitelist(toolName) {
|
|
|
812
812
|
}
|
|
813
813
|
var toolWhitelistStore;
|
|
814
814
|
var init_async_local_storage = __esm({
|
|
815
|
-
"src/internal/runtime/async-local-storage.ts"() {
|
|
815
|
+
"src/internal/runtime/concurrency/async-local-storage.ts"() {
|
|
816
816
|
toolWhitelistStore = new async_hooks.AsyncLocalStorage();
|
|
817
817
|
}
|
|
818
818
|
});
|
|
@@ -1161,7 +1161,7 @@ var init_local_agent_plugins = __esm({
|
|
|
1161
1161
|
}
|
|
1162
1162
|
});
|
|
1163
1163
|
|
|
1164
|
-
// src/internal/runtime/run-until.ts
|
|
1164
|
+
// src/internal/runtime/lifecycle/run-until.ts
|
|
1165
1165
|
var run_until_exports = {};
|
|
1166
1166
|
__export(run_until_exports, {
|
|
1167
1167
|
composeContinuation: () => composeContinuation,
|
|
@@ -1254,7 +1254,7 @@ Your last response was:
|
|
|
1254
1254
|
${lastResponse.slice(0, 1e3)}`;
|
|
1255
1255
|
}
|
|
1256
1256
|
var init_run_until = __esm({
|
|
1257
|
-
"src/internal/runtime/run-until.ts"() {
|
|
1257
|
+
"src/internal/runtime/lifecycle/run-until.ts"() {
|
|
1258
1258
|
}
|
|
1259
1259
|
});
|
|
1260
1260
|
|
|
@@ -1365,16 +1365,16 @@ var init_judge_call = __esm({
|
|
|
1365
1365
|
// src/internal/runtime/registry/agent-factory-registry.ts
|
|
1366
1366
|
var agent_factory_registry_exports = {};
|
|
1367
1367
|
__export(agent_factory_registry_exports, {
|
|
1368
|
-
|
|
1369
|
-
|
|
1368
|
+
getAgentFacade: () => getAgentFacade,
|
|
1369
|
+
setAgentFacade: () => setAgentFacade
|
|
1370
1370
|
});
|
|
1371
|
-
function
|
|
1372
|
-
registered3 =
|
|
1371
|
+
function setAgentFacade(facade) {
|
|
1372
|
+
registered3 = facade;
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function getAgentFacade() {
|
|
1375
1375
|
if (registered3 === void 0) {
|
|
1376
1376
|
throw new Error(
|
|
1377
|
-
"internal: Agent
|
|
1377
|
+
"internal: Agent facade not registered. The `agent.ts` module must be loaded before internal subsystems (LocalAgent.runUntil/fork, eval, scorers, cron) invoke it."
|
|
1378
1378
|
);
|
|
1379
1379
|
}
|
|
1380
1380
|
return registered3;
|
|
@@ -1385,7 +1385,7 @@ var init_agent_factory_registry = __esm({
|
|
|
1385
1385
|
}
|
|
1386
1386
|
});
|
|
1387
1387
|
|
|
1388
|
-
// src/internal/runtime/fork-agent.ts
|
|
1388
|
+
// src/internal/runtime/lifecycle/fork-agent.ts
|
|
1389
1389
|
var fork_agent_exports = {};
|
|
1390
1390
|
__export(fork_agent_exports, {
|
|
1391
1391
|
filterMemoryPlugins: () => filterMemoryPlugins,
|
|
@@ -1445,7 +1445,7 @@ function extractUsage(result) {
|
|
|
1445
1445
|
};
|
|
1446
1446
|
}
|
|
1447
1447
|
var init_fork_agent = __esm({
|
|
1448
|
-
"src/internal/runtime/fork-agent.ts"() {
|
|
1448
|
+
"src/internal/runtime/lifecycle/fork-agent.ts"() {
|
|
1449
1449
|
init_async_local_storage();
|
|
1450
1450
|
init_local_agent_plugins();
|
|
1451
1451
|
}
|
|
@@ -1468,7 +1468,7 @@ var init_task = __esm({
|
|
|
1468
1468
|
}
|
|
1469
1469
|
});
|
|
1470
1470
|
|
|
1471
|
-
// src/internal/runtime/async-semaphore.ts
|
|
1471
|
+
// src/internal/runtime/concurrency/async-semaphore.ts
|
|
1472
1472
|
function createSemaphore(permits) {
|
|
1473
1473
|
if (!Number.isInteger(permits) || permits < 1) {
|
|
1474
1474
|
throw new ConfigurationError(
|
|
@@ -1506,7 +1506,7 @@ function createSemaphore(permits) {
|
|
|
1506
1506
|
};
|
|
1507
1507
|
}
|
|
1508
1508
|
var init_async_semaphore = __esm({
|
|
1509
|
-
"src/internal/runtime/async-semaphore.ts"() {
|
|
1509
|
+
"src/internal/runtime/concurrency/async-semaphore.ts"() {
|
|
1510
1510
|
init_errors();
|
|
1511
1511
|
}
|
|
1512
1512
|
});
|
|
@@ -3083,7 +3083,7 @@ function sanitizeIdentifier(input, options) {
|
|
|
3083
3083
|
return input.toLowerCase();
|
|
3084
3084
|
}
|
|
3085
3085
|
|
|
3086
|
-
// src/internal/runtime/default-model.ts
|
|
3086
|
+
// src/internal/runtime/config/default-model.ts
|
|
3087
3087
|
var DEFAULT_AGENTIC_MODEL_ID = "google/gemini-2.0-flash-001";
|
|
3088
3088
|
|
|
3089
3089
|
// src/internal/runtime/registry/agent-registry-store.ts
|
|
@@ -3404,7 +3404,7 @@ async function flushRegistrySaves(cwd) {
|
|
|
3404
3404
|
}
|
|
3405
3405
|
}
|
|
3406
3406
|
|
|
3407
|
-
// src/internal/runtime/system-prompt.ts
|
|
3407
|
+
// src/internal/runtime/system-prompt/system-prompt.ts
|
|
3408
3408
|
async function resolveSystemPrompt(agent, override, ctx) {
|
|
3409
3409
|
if (override !== void 0) return override;
|
|
3410
3410
|
if (agent === void 0) return void 0;
|
|
@@ -5787,28 +5787,6 @@ function parseDecisionFromStdout(stdout) {
|
|
|
5787
5787
|
return { decision: "allow" };
|
|
5788
5788
|
}
|
|
5789
5789
|
|
|
5790
|
-
// src/internal/runtime/memory/memory-path-selector.ts
|
|
5791
|
-
var PORT_MEMORY_PATH_ENV_VAR = "THEOKIT_PORT_MEMORY_PATH";
|
|
5792
|
-
function shouldUsePortMemoryPath() {
|
|
5793
|
-
const env = globalThis.process?.env;
|
|
5794
|
-
if (env === void 0) return false;
|
|
5795
|
-
const val = env[PORT_MEMORY_PATH_ENV_VAR];
|
|
5796
|
-
return val === "1" || val === "true";
|
|
5797
|
-
}
|
|
5798
|
-
function resolveMemoryProviderForLoop(consumerSupplied, defaultAdapter, portPathEnabled) {
|
|
5799
|
-
if (consumerSupplied !== void 0) return consumerSupplied;
|
|
5800
|
-
if (portPathEnabled) return defaultAdapter;
|
|
5801
|
-
return void 0;
|
|
5802
|
-
}
|
|
5803
|
-
function resolveMemoryToolsForLoop(legacyTools, portPathEnabled) {
|
|
5804
|
-
if (portPathEnabled) return void 0;
|
|
5805
|
-
return legacyTools;
|
|
5806
|
-
}
|
|
5807
|
-
function resolveActiveMemorySummaryForSend(legacySummary, portPathEnabled) {
|
|
5808
|
-
if (portPathEnabled) return void 0;
|
|
5809
|
-
return legacySummary;
|
|
5810
|
-
}
|
|
5811
|
-
|
|
5812
5790
|
// src/internal/memory/storage/session-summary-writer.ts
|
|
5813
5791
|
init_atomic_write();
|
|
5814
5792
|
var MAX_TURN_CHARS = 2e3;
|
|
@@ -5852,6 +5830,28 @@ async function writeSessionSummary(input) {
|
|
|
5852
5830
|
await replaceFileAtomic(path, body);
|
|
5853
5831
|
}
|
|
5854
5832
|
|
|
5833
|
+
// src/internal/runtime/memory/memory-path-selector.ts
|
|
5834
|
+
var PORT_MEMORY_PATH_ENV_VAR = "THEOKIT_PORT_MEMORY_PATH";
|
|
5835
|
+
function shouldUsePortMemoryPath() {
|
|
5836
|
+
const env = globalThis.process?.env;
|
|
5837
|
+
if (env === void 0) return false;
|
|
5838
|
+
const val = env[PORT_MEMORY_PATH_ENV_VAR];
|
|
5839
|
+
return val === "1" || val === "true";
|
|
5840
|
+
}
|
|
5841
|
+
function resolveMemoryProviderForLoop(consumerSupplied, defaultAdapter, portPathEnabled) {
|
|
5842
|
+
if (consumerSupplied !== void 0) return consumerSupplied;
|
|
5843
|
+
if (portPathEnabled) return defaultAdapter;
|
|
5844
|
+
return void 0;
|
|
5845
|
+
}
|
|
5846
|
+
function resolveMemoryToolsForLoop(legacyTools, portPathEnabled) {
|
|
5847
|
+
if (portPathEnabled) return void 0;
|
|
5848
|
+
return legacyTools;
|
|
5849
|
+
}
|
|
5850
|
+
function resolveActiveMemorySummaryForSend(legacySummary, portPathEnabled) {
|
|
5851
|
+
if (portPathEnabled) return void 0;
|
|
5852
|
+
return legacySummary;
|
|
5853
|
+
}
|
|
5854
|
+
|
|
5855
5855
|
// src/internal/runtime/session/agent-session-store.ts
|
|
5856
5856
|
init_atomic_write();
|
|
5857
5857
|
var VALID_ROLES = /* @__PURE__ */ new Set([
|
|
@@ -6108,7 +6108,7 @@ function clearSession(agentId) {
|
|
|
6108
6108
|
sessions.delete(agentId);
|
|
6109
6109
|
}
|
|
6110
6110
|
|
|
6111
|
-
// src/internal/runtime/post-run-lifecycle.ts
|
|
6111
|
+
// src/internal/runtime/lifecycle/post-run-lifecycle.ts
|
|
6112
6112
|
async function runPostRunLifecycle(inputs) {
|
|
6113
6113
|
const {
|
|
6114
6114
|
run,
|
|
@@ -6340,7 +6340,7 @@ var liveAgentRegistry = new LiveAgentRegistry();
|
|
|
6340
6340
|
// src/internal/runtime/skills/subagents-loader.ts
|
|
6341
6341
|
init_errors();
|
|
6342
6342
|
|
|
6343
|
-
// src/internal/runtime/workspace-dir.ts
|
|
6343
|
+
// src/internal/runtime/config/workspace-dir.ts
|
|
6344
6344
|
init_errors();
|
|
6345
6345
|
async function readWorkspaceDir(root, errorCode, describe) {
|
|
6346
6346
|
try {
|
|
@@ -6626,7 +6626,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
|
|
|
6626
6626
|
}
|
|
6627
6627
|
};
|
|
6628
6628
|
|
|
6629
|
-
// src/internal/runtime/validate-agent-options.ts
|
|
6629
|
+
// src/internal/runtime/validation/validate-agent-options.ts
|
|
6630
6630
|
init_errors();
|
|
6631
6631
|
function validateAgentOptions(options) {
|
|
6632
6632
|
rejectProgrammaticHooks(options);
|
|
@@ -6821,6 +6821,71 @@ function validateMemory(options) {
|
|
|
6821
6821
|
}
|
|
6822
6822
|
}
|
|
6823
6823
|
|
|
6824
|
+
// src/internal/runtime/config/providers-manager.ts
|
|
6825
|
+
var ProvidersManagerImpl = class {
|
|
6826
|
+
constructor(model, providers, plugins) {
|
|
6827
|
+
this.model = model;
|
|
6828
|
+
this.providers = providers;
|
|
6829
|
+
this.plugins = plugins;
|
|
6830
|
+
}
|
|
6831
|
+
model;
|
|
6832
|
+
providers;
|
|
6833
|
+
plugins;
|
|
6834
|
+
routes() {
|
|
6835
|
+
const resolved = [];
|
|
6836
|
+
const modelProvider = providerFromModel(this.model);
|
|
6837
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6838
|
+
if (this.providers?.routes !== void 0) {
|
|
6839
|
+
for (const route of this.providers.routes) {
|
|
6840
|
+
const resolvedRoute = resolveRoute(route, modelProvider, this.plugins);
|
|
6841
|
+
if (!seen.has(route.capability)) {
|
|
6842
|
+
seen.add(route.capability);
|
|
6843
|
+
resolved.push(resolvedRoute);
|
|
6844
|
+
}
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
return Promise.resolve(resolved);
|
|
6848
|
+
}
|
|
6849
|
+
};
|
|
6850
|
+
function providerFromModel(model) {
|
|
6851
|
+
if (model === void 0) return void 0;
|
|
6852
|
+
const id = model.id;
|
|
6853
|
+
if (id.includes(":")) return id.split(":")[0];
|
|
6854
|
+
return void 0;
|
|
6855
|
+
}
|
|
6856
|
+
function resolveRoute(route, modelProvider, plugins) {
|
|
6857
|
+
if (route.capability === "chat" && modelProvider === route.provider) {
|
|
6858
|
+
const modelName = extractModelName(modelProvider, route);
|
|
6859
|
+
const base = {
|
|
6860
|
+
capability: route.capability,
|
|
6861
|
+
provider: route.provider,
|
|
6862
|
+
reason: "explicit-model-provider"
|
|
6863
|
+
};
|
|
6864
|
+
if (modelName !== void 0) base.model = modelName;
|
|
6865
|
+
return base;
|
|
6866
|
+
}
|
|
6867
|
+
if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
|
|
6868
|
+
return {
|
|
6869
|
+
capability: route.capability,
|
|
6870
|
+
provider: route.provider,
|
|
6871
|
+
reason: "first-available-plugin-provider"
|
|
6872
|
+
};
|
|
6873
|
+
}
|
|
6874
|
+
return {
|
|
6875
|
+
capability: route.capability,
|
|
6876
|
+
provider: route.provider,
|
|
6877
|
+
reason: "explicit-route"
|
|
6878
|
+
};
|
|
6879
|
+
}
|
|
6880
|
+
function extractModelName(prefix, route) {
|
|
6881
|
+
if (route.model !== void 0) return route.model;
|
|
6882
|
+
return prefix === route.provider ? defaultModelForProvider(prefix) : void 0;
|
|
6883
|
+
}
|
|
6884
|
+
function defaultModelForProvider(provider) {
|
|
6885
|
+
if (provider === "anthropic") return "claude-3-7-sonnet";
|
|
6886
|
+
return void 0;
|
|
6887
|
+
}
|
|
6888
|
+
|
|
6824
6889
|
// src/internal/runtime/context/context-manager.ts
|
|
6825
6890
|
init_errors();
|
|
6826
6891
|
init_markdown_config_loader();
|
|
@@ -7617,71 +7682,6 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
|
|
|
7617
7682
|
return metadata;
|
|
7618
7683
|
}
|
|
7619
7684
|
|
|
7620
|
-
// src/internal/runtime/providers-manager.ts
|
|
7621
|
-
var ProvidersManagerImpl = class {
|
|
7622
|
-
constructor(model, providers, plugins) {
|
|
7623
|
-
this.model = model;
|
|
7624
|
-
this.providers = providers;
|
|
7625
|
-
this.plugins = plugins;
|
|
7626
|
-
}
|
|
7627
|
-
model;
|
|
7628
|
-
providers;
|
|
7629
|
-
plugins;
|
|
7630
|
-
routes() {
|
|
7631
|
-
const resolved = [];
|
|
7632
|
-
const modelProvider = providerFromModel(this.model);
|
|
7633
|
-
const seen = /* @__PURE__ */ new Set();
|
|
7634
|
-
if (this.providers?.routes !== void 0) {
|
|
7635
|
-
for (const route of this.providers.routes) {
|
|
7636
|
-
const resolvedRoute = resolveRoute(route, modelProvider, this.plugins);
|
|
7637
|
-
if (!seen.has(route.capability)) {
|
|
7638
|
-
seen.add(route.capability);
|
|
7639
|
-
resolved.push(resolvedRoute);
|
|
7640
|
-
}
|
|
7641
|
-
}
|
|
7642
|
-
}
|
|
7643
|
-
return Promise.resolve(resolved);
|
|
7644
|
-
}
|
|
7645
|
-
};
|
|
7646
|
-
function providerFromModel(model) {
|
|
7647
|
-
if (model === void 0) return void 0;
|
|
7648
|
-
const id = model.id;
|
|
7649
|
-
if (id.includes(":")) return id.split(":")[0];
|
|
7650
|
-
return void 0;
|
|
7651
|
-
}
|
|
7652
|
-
function resolveRoute(route, modelProvider, plugins) {
|
|
7653
|
-
if (route.capability === "chat" && modelProvider === route.provider) {
|
|
7654
|
-
const modelName = extractModelName(modelProvider, route);
|
|
7655
|
-
const base = {
|
|
7656
|
-
capability: route.capability,
|
|
7657
|
-
provider: route.provider,
|
|
7658
|
-
reason: "explicit-model-provider"
|
|
7659
|
-
};
|
|
7660
|
-
if (modelName !== void 0) base.model = modelName;
|
|
7661
|
-
return base;
|
|
7662
|
-
}
|
|
7663
|
-
if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
|
|
7664
|
-
return {
|
|
7665
|
-
capability: route.capability,
|
|
7666
|
-
provider: route.provider,
|
|
7667
|
-
reason: "first-available-plugin-provider"
|
|
7668
|
-
};
|
|
7669
|
-
}
|
|
7670
|
-
return {
|
|
7671
|
-
capability: route.capability,
|
|
7672
|
-
provider: route.provider,
|
|
7673
|
-
reason: "explicit-route"
|
|
7674
|
-
};
|
|
7675
|
-
}
|
|
7676
|
-
function extractModelName(prefix, route) {
|
|
7677
|
-
if (route.model !== void 0) return route.model;
|
|
7678
|
-
return prefix === route.provider ? defaultModelForProvider(prefix) : void 0;
|
|
7679
|
-
}
|
|
7680
|
-
function defaultModelForProvider(provider) {
|
|
7681
|
-
if (provider === "anthropic") return "claude-3-7-sonnet";
|
|
7682
|
-
return void 0;
|
|
7683
|
-
}
|
|
7684
|
-
|
|
7685
7685
|
// src/internal/runtime/skills/skills-manager.ts
|
|
7686
7686
|
init_errors();
|
|
7687
7687
|
|
|
@@ -8028,7 +8028,7 @@ var IterationBudget = class {
|
|
|
8028
8028
|
}
|
|
8029
8029
|
};
|
|
8030
8030
|
|
|
8031
|
-
// src/internal/runtime/validate-response.ts
|
|
8031
|
+
// src/internal/runtime/validation/validate-response.ts
|
|
8032
8032
|
function validateResponse(response) {
|
|
8033
8033
|
const trimmed = response.content.trim();
|
|
8034
8034
|
const toolCallsArr = Array.isArray(response.toolCalls) ? response.toolCalls : [];
|
|
@@ -8487,7 +8487,7 @@ function coerceArgsToSchema(args, schema) {
|
|
|
8487
8487
|
return { value: out, changed };
|
|
8488
8488
|
}
|
|
8489
8489
|
|
|
8490
|
-
// src/internal/runtime/shell-tool.ts
|
|
8490
|
+
// src/internal/runtime/tools/shell-tool.ts
|
|
8491
8491
|
async function runShell(options) {
|
|
8492
8492
|
if (options.sandbox === true && isObviouslyUnsafe(options.command)) {
|
|
8493
8493
|
return {
|
|
@@ -9688,10 +9688,10 @@ function registerBuiltins() {
|
|
|
9688
9688
|
registerCatalogProviders();
|
|
9689
9689
|
}
|
|
9690
9690
|
|
|
9691
|
-
// src/internal/
|
|
9691
|
+
// src/internal/error-mappers/anthropic.ts
|
|
9692
9692
|
init_errors();
|
|
9693
9693
|
|
|
9694
|
-
// src/internal/
|
|
9694
|
+
// src/internal/error-mappers/shared.ts
|
|
9695
9695
|
var RAW_MAX_BYTES = 2048;
|
|
9696
9696
|
function parseRetryAfter(headers) {
|
|
9697
9697
|
if (headers === void 0) return void 0;
|
|
@@ -9720,7 +9720,7 @@ function buildErrorMetadata(args) {
|
|
|
9720
9720
|
};
|
|
9721
9721
|
}
|
|
9722
9722
|
|
|
9723
|
-
// src/internal/
|
|
9723
|
+
// src/internal/error-mappers/anthropic.ts
|
|
9724
9724
|
function mapAnthropicError(args) {
|
|
9725
9725
|
const { status, body, headers, endpoint } = args;
|
|
9726
9726
|
const code = mapAnthropicStatusToCode(status, body);
|
|
@@ -10060,7 +10060,7 @@ function buildAnthropicBody(request) {
|
|
|
10060
10060
|
// src/internal/llm/bedrock-anthropic.ts
|
|
10061
10061
|
init_errors();
|
|
10062
10062
|
|
|
10063
|
-
// src/internal/
|
|
10063
|
+
// src/internal/error-mappers/bedrock.ts
|
|
10064
10064
|
init_errors();
|
|
10065
10065
|
function classifyBedrockError(args, awsType, message) {
|
|
10066
10066
|
if (args.status === 429 || awsType.includes("Throttling") || awsType.includes("TooManyRequests")) {
|
|
@@ -10197,7 +10197,7 @@ function buildBedrockBody(request) {
|
|
|
10197
10197
|
init_credential_pool();
|
|
10198
10198
|
init_credential_pool_context();
|
|
10199
10199
|
|
|
10200
|
-
// src/internal/
|
|
10200
|
+
// src/internal/error-mappers/openai-compatible.ts
|
|
10201
10201
|
init_errors();
|
|
10202
10202
|
function mapOpenAICompatibleError(args) {
|
|
10203
10203
|
const { providerId, status, body, headers, endpoint } = args;
|
|
@@ -10361,7 +10361,7 @@ function readOpenAiContent(body) {
|
|
|
10361
10361
|
return void 0;
|
|
10362
10362
|
}
|
|
10363
10363
|
|
|
10364
|
-
// src/internal/
|
|
10364
|
+
// src/internal/error-mappers/ollama.ts
|
|
10365
10365
|
init_errors();
|
|
10366
10366
|
function mapOllamaTransportError(args) {
|
|
10367
10367
|
if (args.providerId !== "ollama") return void 0;
|
|
@@ -11011,7 +11011,7 @@ function abortError2(signal) {
|
|
|
11011
11011
|
// src/internal/llm/vertex-anthropic.ts
|
|
11012
11012
|
init_errors();
|
|
11013
11013
|
|
|
11014
|
-
// src/internal/
|
|
11014
|
+
// src/internal/error-mappers/vertex.ts
|
|
11015
11015
|
init_errors();
|
|
11016
11016
|
var VERTEX_RULES = [
|
|
11017
11017
|
{ test: (s, e) => s === 429 || e === "RESOURCE_EXHAUSTED", code: "rate_limit" },
|
|
@@ -14261,8 +14261,8 @@ function localAgentRunUntil(agent, goal, options) {
|
|
|
14261
14261
|
async function* wrap() {
|
|
14262
14262
|
const { runUntilImpl: runUntilImpl2 } = await Promise.resolve().then(() => (init_run_until(), run_until_exports));
|
|
14263
14263
|
const { judgeCallImpl: judgeCallImpl2 } = await Promise.resolve().then(() => (init_judge_call(), judge_call_exports));
|
|
14264
|
-
const {
|
|
14265
|
-
const create =
|
|
14264
|
+
const { getAgentFacade: getAgentFacade2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
|
|
14265
|
+
const create = getAgentFacade2().create;
|
|
14266
14266
|
const deps = {
|
|
14267
14267
|
judge: async (ctx, opts) => judgeCallImpl2(ctx, opts, { create })
|
|
14268
14268
|
};
|
|
@@ -14272,9 +14272,9 @@ function localAgentRunUntil(agent, goal, options) {
|
|
|
14272
14272
|
}
|
|
14273
14273
|
async function localAgentFork(parent, options) {
|
|
14274
14274
|
const { forkAgentImpl: forkAgentImpl2 } = await Promise.resolve().then(() => (init_fork_agent(), fork_agent_exports));
|
|
14275
|
-
const {
|
|
14275
|
+
const { getAgentFacade: getAgentFacade2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
|
|
14276
14276
|
const { withPersonalityContext: withPersonalityContext2 } = await Promise.resolve().then(() => (init_context(), context_exports));
|
|
14277
|
-
const create =
|
|
14277
|
+
const create = getAgentFacade2().create;
|
|
14278
14278
|
return withPersonalityContext2(
|
|
14279
14279
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
14280
14280
|
() => forkAgentImpl2(parent, options, { create })
|
|
@@ -14295,7 +14295,7 @@ async function persistMemoryFactIfWritePrompt(workspaceCwd, memoryConfig, userTe
|
|
|
14295
14295
|
// src/internal/runtime/local-agent/local-agent-send.ts
|
|
14296
14296
|
init_errors();
|
|
14297
14297
|
|
|
14298
|
-
// src/internal/runtime/abort-utils.ts
|
|
14298
|
+
// src/internal/runtime/concurrency/abort-utils.ts
|
|
14299
14299
|
function anySignal(signals) {
|
|
14300
14300
|
const filtered = signals.filter((s) => s !== void 0);
|
|
14301
14301
|
if (filtered.length === 0) {
|
|
@@ -15324,7 +15324,16 @@ async function getOrCreateUncached(agentId, options) {
|
|
|
15324
15324
|
throw err;
|
|
15325
15325
|
}
|
|
15326
15326
|
}
|
|
15327
|
-
|
|
15327
|
+
setAgentFacade({
|
|
15328
|
+
create: (options) => Agent.create(options),
|
|
15329
|
+
prompt: (message, options) => Agent.prompt(message, options),
|
|
15330
|
+
get: (agentId) => Agent.get(agentId),
|
|
15331
|
+
resume: (agentId, options) => Agent.resume(agentId, options),
|
|
15332
|
+
batch: (prompts, options) => Agent.batch(prompts, options)
|
|
15333
|
+
});
|
|
15334
|
+
|
|
15335
|
+
// src/internal/eval/runner.ts
|
|
15336
|
+
init_agent_factory_registry();
|
|
15328
15337
|
|
|
15329
15338
|
// src/internal/eval/aggregate.ts
|
|
15330
15339
|
function percentile(sorted, p) {
|
|
@@ -15627,7 +15636,7 @@ async function runRowsViaBatch(entries, agentOptions, scorers, concurrency, sign
|
|
|
15627
15636
|
concurrency,
|
|
15628
15637
|
...signal !== void 0 ? { signal } : {}
|
|
15629
15638
|
};
|
|
15630
|
-
const batchResults = await
|
|
15639
|
+
const batchResults = await getAgentFacade().batch(prompts, batchOpts);
|
|
15631
15640
|
const rows = [];
|
|
15632
15641
|
for (let i = 0; i < batchResults.length; i += 1) {
|
|
15633
15642
|
const entry = entries[i];
|
|
@@ -15700,6 +15709,7 @@ async function runEval(options, runOpts) {
|
|
|
15700
15709
|
}
|
|
15701
15710
|
|
|
15702
15711
|
// src/internal/scorers/llm-judge.ts
|
|
15712
|
+
init_agent_factory_registry();
|
|
15703
15713
|
function buildPrompt(subject, criteria, rubric, expected) {
|
|
15704
15714
|
const scoreHint = rubric === "discrete" ? "between 0 and 1 (use 0 for fail, 1 for pass)" : "between 0.0 and 1.0";
|
|
15705
15715
|
const expectedBlock = expected !== void 0 ? `EXPECTED (reference): ${JSON.stringify(expected)}
|
|
@@ -15724,7 +15734,7 @@ function buildPrompt(subject, criteria, rubric, expected) {
|
|
|
15724
15734
|
var SCORE_REGEX = /\{\s*"score"\s*:\s*([0-9]*\.?[0-9]+)\s*,\s*"reason"\s*:\s*"([^"]*)"\s*\}/;
|
|
15725
15735
|
async function callJudge(message, options) {
|
|
15726
15736
|
try {
|
|
15727
|
-
const result = await
|
|
15737
|
+
const result = await getAgentFacade().prompt(message, {
|
|
15728
15738
|
apiKey: options.apiKey,
|
|
15729
15739
|
model: options.model,
|
|
15730
15740
|
local: { cwd: process.cwd(), sandboxOptions: { enabled: false } },
|