@theokit/sdk 1.9.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 +32 -1
- 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 -12
- package/dist/rag/index.cjs +0 -136
- package/dist/rag/index.cjs.map +0 -1
- package/dist/rag/index.d.cts +0 -11
- package/dist/rag/index.d.ts +0 -11
- package/dist/rag/index.js +0 -129
- package/dist/rag/index.js.map +0 -1
- package/dist/rag/reranker.d.cts +0 -26
- package/dist/rag/reranker.d.ts +0 -26
- package/dist/rag/retriever.d.cts +0 -25
- package/dist/rag/retriever.d.ts +0 -25
- package/dist/rag/text-splitter.d.cts +0 -12
- package/dist/rag/text-splitter.d.ts +0 -12
- package/dist/rag/types.d.cts +0 -37
- package/dist/rag/types.d.ts +0 -37
- package/dist/voice/index.d.ts +0 -7
- package/dist/voice/openai-realtime.d.ts +0 -21
- package/dist/voice/types.d.ts +0 -35
- /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/a2a/index.cjs
CHANGED
|
@@ -1043,10 +1043,10 @@ var init_path_guard = __esm({
|
|
|
1043
1043
|
}
|
|
1044
1044
|
});
|
|
1045
1045
|
|
|
1046
|
-
// src/internal/runtime/default-model.ts
|
|
1046
|
+
// src/internal/runtime/config/default-model.ts
|
|
1047
1047
|
var DEFAULT_AGENTIC_MODEL_ID;
|
|
1048
1048
|
var init_default_model = __esm({
|
|
1049
|
-
"src/internal/runtime/default-model.ts"() {
|
|
1049
|
+
"src/internal/runtime/config/default-model.ts"() {
|
|
1050
1050
|
DEFAULT_AGENTIC_MODEL_ID = "google/gemini-2.0-flash-001";
|
|
1051
1051
|
}
|
|
1052
1052
|
});
|
|
@@ -1442,7 +1442,7 @@ var init_agent_registry = __esm({
|
|
|
1442
1442
|
}
|
|
1443
1443
|
});
|
|
1444
1444
|
|
|
1445
|
-
// src/internal/runtime/system-prompt.ts
|
|
1445
|
+
// src/internal/runtime/system-prompt/system-prompt.ts
|
|
1446
1446
|
async function resolveSystemPrompt(agent, override, ctx) {
|
|
1447
1447
|
if (override !== void 0) return override;
|
|
1448
1448
|
if (agent === void 0) return void 0;
|
|
@@ -1460,7 +1460,7 @@ async function resolveSystemPromptForSend(agent, override, buildCtx) {
|
|
|
1460
1460
|
return resolveSystemPrompt(agent, override, ctx);
|
|
1461
1461
|
}
|
|
1462
1462
|
var init_system_prompt = __esm({
|
|
1463
|
-
"src/internal/runtime/system-prompt.ts"() {
|
|
1463
|
+
"src/internal/runtime/system-prompt/system-prompt.ts"() {
|
|
1464
1464
|
}
|
|
1465
1465
|
});
|
|
1466
1466
|
|
|
@@ -3114,7 +3114,7 @@ var init_paths = __esm({
|
|
|
3114
3114
|
}
|
|
3115
3115
|
});
|
|
3116
3116
|
|
|
3117
|
-
// src/internal/runtime/yaml-frontmatter.ts
|
|
3117
|
+
// src/internal/runtime/context/yaml-frontmatter.ts
|
|
3118
3118
|
function parseSimpleYaml(text) {
|
|
3119
3119
|
const fields = {};
|
|
3120
3120
|
for (const line of text.split(/\r?\n/)) {
|
|
@@ -3138,7 +3138,7 @@ function coerce(raw) {
|
|
|
3138
3138
|
return raw;
|
|
3139
3139
|
}
|
|
3140
3140
|
var init_yaml_frontmatter = __esm({
|
|
3141
|
-
"src/internal/runtime/yaml-frontmatter.ts"() {
|
|
3141
|
+
"src/internal/runtime/context/yaml-frontmatter.ts"() {
|
|
3142
3142
|
}
|
|
3143
3143
|
});
|
|
3144
3144
|
async function loadMarkdownEntities(opts) {
|
|
@@ -4142,7 +4142,7 @@ function spawnAndCollect(options) {
|
|
|
4142
4142
|
});
|
|
4143
4143
|
}
|
|
4144
4144
|
var init_spawn_collect = __esm({
|
|
4145
|
-
"src/internal/runtime/spawn-collect.ts"() {
|
|
4145
|
+
"src/internal/runtime/lifecycle/spawn-collect.ts"() {
|
|
4146
4146
|
}
|
|
4147
4147
|
});
|
|
4148
4148
|
|
|
@@ -4239,33 +4239,6 @@ var init_hooks_executor = __esm({
|
|
|
4239
4239
|
};
|
|
4240
4240
|
}
|
|
4241
4241
|
});
|
|
4242
|
-
|
|
4243
|
-
// src/internal/runtime/memory/memory-path-selector.ts
|
|
4244
|
-
function shouldUsePortMemoryPath() {
|
|
4245
|
-
const env = globalThis.process?.env;
|
|
4246
|
-
if (env === void 0) return false;
|
|
4247
|
-
const val = env[PORT_MEMORY_PATH_ENV_VAR];
|
|
4248
|
-
return val === "1" || val === "true";
|
|
4249
|
-
}
|
|
4250
|
-
function resolveMemoryProviderForLoop(consumerSupplied, defaultAdapter, portPathEnabled) {
|
|
4251
|
-
if (consumerSupplied !== void 0) return consumerSupplied;
|
|
4252
|
-
if (portPathEnabled) return defaultAdapter;
|
|
4253
|
-
return void 0;
|
|
4254
|
-
}
|
|
4255
|
-
function resolveMemoryToolsForLoop(legacyTools, portPathEnabled) {
|
|
4256
|
-
if (portPathEnabled) return void 0;
|
|
4257
|
-
return legacyTools;
|
|
4258
|
-
}
|
|
4259
|
-
function resolveActiveMemorySummaryForSend(legacySummary, portPathEnabled) {
|
|
4260
|
-
if (portPathEnabled) return void 0;
|
|
4261
|
-
return legacySummary;
|
|
4262
|
-
}
|
|
4263
|
-
var PORT_MEMORY_PATH_ENV_VAR;
|
|
4264
|
-
var init_memory_path_selector = __esm({
|
|
4265
|
-
"src/internal/runtime/memory/memory-path-selector.ts"() {
|
|
4266
|
-
PORT_MEMORY_PATH_ENV_VAR = "THEOKIT_PORT_MEMORY_PATH";
|
|
4267
|
-
}
|
|
4268
|
-
});
|
|
4269
4242
|
function sessionsDir(cwd) {
|
|
4270
4243
|
return path.join(memoryDir(cwd), "sessions");
|
|
4271
4244
|
}
|
|
@@ -4314,6 +4287,33 @@ var init_session_summary_writer = __esm({
|
|
|
4314
4287
|
MAX_TURN_CHARS = 2e3;
|
|
4315
4288
|
}
|
|
4316
4289
|
});
|
|
4290
|
+
|
|
4291
|
+
// src/internal/runtime/memory/memory-path-selector.ts
|
|
4292
|
+
function shouldUsePortMemoryPath() {
|
|
4293
|
+
const env = globalThis.process?.env;
|
|
4294
|
+
if (env === void 0) return false;
|
|
4295
|
+
const val = env[PORT_MEMORY_PATH_ENV_VAR];
|
|
4296
|
+
return val === "1" || val === "true";
|
|
4297
|
+
}
|
|
4298
|
+
function resolveMemoryProviderForLoop(consumerSupplied, defaultAdapter, portPathEnabled) {
|
|
4299
|
+
if (consumerSupplied !== void 0) return consumerSupplied;
|
|
4300
|
+
if (portPathEnabled) return defaultAdapter;
|
|
4301
|
+
return void 0;
|
|
4302
|
+
}
|
|
4303
|
+
function resolveMemoryToolsForLoop(legacyTools, portPathEnabled) {
|
|
4304
|
+
if (portPathEnabled) return void 0;
|
|
4305
|
+
return legacyTools;
|
|
4306
|
+
}
|
|
4307
|
+
function resolveActiveMemorySummaryForSend(legacySummary, portPathEnabled) {
|
|
4308
|
+
if (portPathEnabled) return void 0;
|
|
4309
|
+
return legacySummary;
|
|
4310
|
+
}
|
|
4311
|
+
var PORT_MEMORY_PATH_ENV_VAR;
|
|
4312
|
+
var init_memory_path_selector = __esm({
|
|
4313
|
+
"src/internal/runtime/memory/memory-path-selector.ts"() {
|
|
4314
|
+
PORT_MEMORY_PATH_ENV_VAR = "THEOKIT_PORT_MEMORY_PATH";
|
|
4315
|
+
}
|
|
4316
|
+
});
|
|
4317
4317
|
function sessionFilePath(cwd, agentId) {
|
|
4318
4318
|
const safe2 = sanitizeIdentifier(agentId, { maxLen: 128 });
|
|
4319
4319
|
return safePathJoin(cwd, ".theokit", "agents", safe2, "messages.jsonl");
|
|
@@ -4587,7 +4587,7 @@ var init_agent_session = __esm({
|
|
|
4587
4587
|
}
|
|
4588
4588
|
});
|
|
4589
4589
|
|
|
4590
|
-
// src/internal/runtime/post-run-lifecycle.ts
|
|
4590
|
+
// src/internal/runtime/lifecycle/post-run-lifecycle.ts
|
|
4591
4591
|
async function runPostRunLifecycle(inputs) {
|
|
4592
4592
|
const {
|
|
4593
4593
|
run,
|
|
@@ -4648,7 +4648,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
4648
4648
|
await flushSessionWrites();
|
|
4649
4649
|
}
|
|
4650
4650
|
var init_post_run_lifecycle = __esm({
|
|
4651
|
-
"src/internal/runtime/post-run-lifecycle.ts"() {
|
|
4651
|
+
"src/internal/runtime/lifecycle/post-run-lifecycle.ts"() {
|
|
4652
4652
|
init_session_summary_writer();
|
|
4653
4653
|
init_memory_path_selector();
|
|
4654
4654
|
init_agent_session();
|
|
@@ -4840,7 +4840,7 @@ async function readWorkspaceDir(root, errorCode, describe) {
|
|
|
4840
4840
|
}
|
|
4841
4841
|
}
|
|
4842
4842
|
var init_workspace_dir = __esm({
|
|
4843
|
-
"src/internal/runtime/workspace-dir.ts"() {
|
|
4843
|
+
"src/internal/runtime/config/workspace-dir.ts"() {
|
|
4844
4844
|
init_errors();
|
|
4845
4845
|
}
|
|
4846
4846
|
});
|
|
@@ -5171,7 +5171,7 @@ var init_pipeline = __esm({
|
|
|
5171
5171
|
}
|
|
5172
5172
|
});
|
|
5173
5173
|
|
|
5174
|
-
// src/internal/runtime/validate-agent-options.ts
|
|
5174
|
+
// src/internal/runtime/validation/validate-agent-options.ts
|
|
5175
5175
|
function validateAgentOptions(options) {
|
|
5176
5176
|
rejectProgrammaticHooks(options);
|
|
5177
5177
|
ensureRuntimeShape(options);
|
|
@@ -5364,12 +5364,82 @@ function validateMemory(options) {
|
|
|
5364
5364
|
}
|
|
5365
5365
|
var TOOL_NAME_PATTERN, RESERVED_TOOL_NAMES;
|
|
5366
5366
|
var init_validate_agent_options = __esm({
|
|
5367
|
-
"src/internal/runtime/validate-agent-options.ts"() {
|
|
5367
|
+
"src/internal/runtime/validation/validate-agent-options.ts"() {
|
|
5368
5368
|
init_errors();
|
|
5369
5369
|
TOOL_NAME_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/;
|
|
5370
5370
|
RESERVED_TOOL_NAMES = /* @__PURE__ */ new Set(["shell", "memory_search", "memory_get"]);
|
|
5371
5371
|
}
|
|
5372
5372
|
});
|
|
5373
|
+
|
|
5374
|
+
// src/internal/runtime/config/providers-manager.ts
|
|
5375
|
+
function providerFromModel(model) {
|
|
5376
|
+
if (model === void 0) return void 0;
|
|
5377
|
+
const id = model.id;
|
|
5378
|
+
if (id.includes(":")) return id.split(":")[0];
|
|
5379
|
+
return void 0;
|
|
5380
|
+
}
|
|
5381
|
+
function resolveRoute(route, modelProvider, plugins) {
|
|
5382
|
+
if (route.capability === "chat" && modelProvider === route.provider) {
|
|
5383
|
+
const modelName = extractModelName(modelProvider, route);
|
|
5384
|
+
const base = {
|
|
5385
|
+
capability: route.capability,
|
|
5386
|
+
provider: route.provider,
|
|
5387
|
+
reason: "explicit-model-provider"
|
|
5388
|
+
};
|
|
5389
|
+
if (modelName !== void 0) base.model = modelName;
|
|
5390
|
+
return base;
|
|
5391
|
+
}
|
|
5392
|
+
if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
|
|
5393
|
+
return {
|
|
5394
|
+
capability: route.capability,
|
|
5395
|
+
provider: route.provider,
|
|
5396
|
+
reason: "first-available-plugin-provider"
|
|
5397
|
+
};
|
|
5398
|
+
}
|
|
5399
|
+
return {
|
|
5400
|
+
capability: route.capability,
|
|
5401
|
+
provider: route.provider,
|
|
5402
|
+
reason: "explicit-route"
|
|
5403
|
+
};
|
|
5404
|
+
}
|
|
5405
|
+
function extractModelName(prefix, route) {
|
|
5406
|
+
if (route.model !== void 0) return route.model;
|
|
5407
|
+
return prefix === route.provider ? defaultModelForProvider(prefix) : void 0;
|
|
5408
|
+
}
|
|
5409
|
+
function defaultModelForProvider(provider) {
|
|
5410
|
+
if (provider === "anthropic") return "claude-3-7-sonnet";
|
|
5411
|
+
return void 0;
|
|
5412
|
+
}
|
|
5413
|
+
var ProvidersManagerImpl;
|
|
5414
|
+
var init_providers_manager = __esm({
|
|
5415
|
+
"src/internal/runtime/config/providers-manager.ts"() {
|
|
5416
|
+
ProvidersManagerImpl = class {
|
|
5417
|
+
constructor(model, providers, plugins) {
|
|
5418
|
+
this.model = model;
|
|
5419
|
+
this.providers = providers;
|
|
5420
|
+
this.plugins = plugins;
|
|
5421
|
+
}
|
|
5422
|
+
model;
|
|
5423
|
+
providers;
|
|
5424
|
+
plugins;
|
|
5425
|
+
routes() {
|
|
5426
|
+
const resolved = [];
|
|
5427
|
+
const modelProvider = providerFromModel(this.model);
|
|
5428
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5429
|
+
if (this.providers?.routes !== void 0) {
|
|
5430
|
+
for (const route of this.providers.routes) {
|
|
5431
|
+
const resolvedRoute = resolveRoute(route, modelProvider, this.plugins);
|
|
5432
|
+
if (!seen.has(route.capability)) {
|
|
5433
|
+
seen.add(route.capability);
|
|
5434
|
+
resolved.push(resolvedRoute);
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
return Promise.resolve(resolved);
|
|
5439
|
+
}
|
|
5440
|
+
};
|
|
5441
|
+
}
|
|
5442
|
+
});
|
|
5373
5443
|
function truncateWithMarker(content, max) {
|
|
5374
5444
|
if (content.length <= max) {
|
|
5375
5445
|
return { truncated: false, finalContent: content };
|
|
@@ -6135,8 +6205,8 @@ var init_plugins_manager = __esm({
|
|
|
6135
6205
|
init_errors();
|
|
6136
6206
|
init_markdown_config_loader();
|
|
6137
6207
|
init_path_guard();
|
|
6138
|
-
init_hooks_source();
|
|
6139
6208
|
init_workspace_dir();
|
|
6209
|
+
init_hooks_source();
|
|
6140
6210
|
init_plugin_frontmatter();
|
|
6141
6211
|
PluginsManager = class {
|
|
6142
6212
|
constructor(cwd, enabled, settingSourcesIncludePlugins, cloud, localPaths) {
|
|
@@ -6219,76 +6289,6 @@ var init_plugins_manager = __esm({
|
|
|
6219
6289
|
}
|
|
6220
6290
|
});
|
|
6221
6291
|
|
|
6222
|
-
// src/internal/runtime/providers-manager.ts
|
|
6223
|
-
function providerFromModel(model) {
|
|
6224
|
-
if (model === void 0) return void 0;
|
|
6225
|
-
const id = model.id;
|
|
6226
|
-
if (id.includes(":")) return id.split(":")[0];
|
|
6227
|
-
return void 0;
|
|
6228
|
-
}
|
|
6229
|
-
function resolveRoute(route, modelProvider, plugins) {
|
|
6230
|
-
if (route.capability === "chat" && modelProvider === route.provider) {
|
|
6231
|
-
const modelName = extractModelName(modelProvider, route);
|
|
6232
|
-
const base = {
|
|
6233
|
-
capability: route.capability,
|
|
6234
|
-
provider: route.provider,
|
|
6235
|
-
reason: "explicit-model-provider"
|
|
6236
|
-
};
|
|
6237
|
-
if (modelName !== void 0) base.model = modelName;
|
|
6238
|
-
return base;
|
|
6239
|
-
}
|
|
6240
|
-
if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
|
|
6241
|
-
return {
|
|
6242
|
-
capability: route.capability,
|
|
6243
|
-
provider: route.provider,
|
|
6244
|
-
reason: "first-available-plugin-provider"
|
|
6245
|
-
};
|
|
6246
|
-
}
|
|
6247
|
-
return {
|
|
6248
|
-
capability: route.capability,
|
|
6249
|
-
provider: route.provider,
|
|
6250
|
-
reason: "explicit-route"
|
|
6251
|
-
};
|
|
6252
|
-
}
|
|
6253
|
-
function extractModelName(prefix, route) {
|
|
6254
|
-
if (route.model !== void 0) return route.model;
|
|
6255
|
-
return prefix === route.provider ? defaultModelForProvider(prefix) : void 0;
|
|
6256
|
-
}
|
|
6257
|
-
function defaultModelForProvider(provider) {
|
|
6258
|
-
if (provider === "anthropic") return "claude-3-7-sonnet";
|
|
6259
|
-
return void 0;
|
|
6260
|
-
}
|
|
6261
|
-
var ProvidersManagerImpl;
|
|
6262
|
-
var init_providers_manager = __esm({
|
|
6263
|
-
"src/internal/runtime/providers-manager.ts"() {
|
|
6264
|
-
ProvidersManagerImpl = class {
|
|
6265
|
-
constructor(model, providers, plugins) {
|
|
6266
|
-
this.model = model;
|
|
6267
|
-
this.providers = providers;
|
|
6268
|
-
this.plugins = plugins;
|
|
6269
|
-
}
|
|
6270
|
-
model;
|
|
6271
|
-
providers;
|
|
6272
|
-
plugins;
|
|
6273
|
-
routes() {
|
|
6274
|
-
const resolved = [];
|
|
6275
|
-
const modelProvider = providerFromModel(this.model);
|
|
6276
|
-
const seen = /* @__PURE__ */ new Set();
|
|
6277
|
-
if (this.providers?.routes !== void 0) {
|
|
6278
|
-
for (const route of this.providers.routes) {
|
|
6279
|
-
const resolvedRoute = resolveRoute(route, modelProvider, this.plugins);
|
|
6280
|
-
if (!seen.has(route.capability)) {
|
|
6281
|
-
seen.add(route.capability);
|
|
6282
|
-
resolved.push(resolvedRoute);
|
|
6283
|
-
}
|
|
6284
|
-
}
|
|
6285
|
-
}
|
|
6286
|
-
return Promise.resolve(resolved);
|
|
6287
|
-
}
|
|
6288
|
-
};
|
|
6289
|
-
}
|
|
6290
|
-
});
|
|
6291
|
-
|
|
6292
6292
|
// src/internal/runtime/skills/skill-frontmatter.ts
|
|
6293
6293
|
function asString(v) {
|
|
6294
6294
|
return typeof v === "string" ? v : void 0;
|
|
@@ -6495,9 +6495,9 @@ function bootstrapSubmanagers(args) {
|
|
|
6495
6495
|
}
|
|
6496
6496
|
var init_local_agent_bootstrap = __esm({
|
|
6497
6497
|
"src/internal/runtime/local-agent/local-agent-bootstrap.ts"() {
|
|
6498
|
+
init_providers_manager();
|
|
6498
6499
|
init_context_manager();
|
|
6499
6500
|
init_plugins_manager();
|
|
6500
|
-
init_providers_manager();
|
|
6501
6501
|
init_agent_registry();
|
|
6502
6502
|
init_skills_manager();
|
|
6503
6503
|
}
|
|
@@ -6671,7 +6671,7 @@ var init_budget = __esm({
|
|
|
6671
6671
|
}
|
|
6672
6672
|
});
|
|
6673
6673
|
|
|
6674
|
-
// src/internal/runtime/validate-response.ts
|
|
6674
|
+
// src/internal/runtime/validation/validate-response.ts
|
|
6675
6675
|
function validateResponse(response) {
|
|
6676
6676
|
const trimmed = response.content.trim();
|
|
6677
6677
|
const toolCallsArr = Array.isArray(response.toolCalls) ? response.toolCalls : [];
|
|
@@ -6684,7 +6684,7 @@ function validateResponse(response) {
|
|
|
6684
6684
|
return { ok: true };
|
|
6685
6685
|
}
|
|
6686
6686
|
var init_validate_response = __esm({
|
|
6687
|
-
"src/internal/runtime/validate-response.ts"() {
|
|
6687
|
+
"src/internal/runtime/validation/validate-response.ts"() {
|
|
6688
6688
|
}
|
|
6689
6689
|
});
|
|
6690
6690
|
|
|
@@ -7107,7 +7107,7 @@ function checkToolWhitelist(toolName) {
|
|
|
7107
7107
|
}
|
|
7108
7108
|
var toolWhitelistStore;
|
|
7109
7109
|
var init_async_local_storage = __esm({
|
|
7110
|
-
"src/internal/runtime/async-local-storage.ts"() {
|
|
7110
|
+
"src/internal/runtime/concurrency/async-local-storage.ts"() {
|
|
7111
7111
|
toolWhitelistStore = new async_hooks.AsyncLocalStorage();
|
|
7112
7112
|
}
|
|
7113
7113
|
});
|
|
@@ -7190,7 +7190,7 @@ var init_repair_middleware = __esm({
|
|
|
7190
7190
|
}
|
|
7191
7191
|
});
|
|
7192
7192
|
|
|
7193
|
-
// src/internal/runtime/shell-tool.ts
|
|
7193
|
+
// src/internal/runtime/tools/shell-tool.ts
|
|
7194
7194
|
async function runShell(options) {
|
|
7195
7195
|
if (options.sandbox === true && isObviouslyUnsafe(options.command)) {
|
|
7196
7196
|
return {
|
|
@@ -7221,7 +7221,7 @@ function isObviouslyUnsafe(command) {
|
|
|
7221
7221
|
return false;
|
|
7222
7222
|
}
|
|
7223
7223
|
var init_shell_tool = __esm({
|
|
7224
|
-
"src/internal/runtime/shell-tool.ts"() {
|
|
7224
|
+
"src/internal/runtime/tools/shell-tool.ts"() {
|
|
7225
7225
|
init_spawn_collect();
|
|
7226
7226
|
}
|
|
7227
7227
|
});
|
|
@@ -8538,7 +8538,7 @@ var init_providers = __esm({
|
|
|
8538
8538
|
}
|
|
8539
8539
|
});
|
|
8540
8540
|
|
|
8541
|
-
// src/internal/
|
|
8541
|
+
// src/internal/error-mappers/shared.ts
|
|
8542
8542
|
function parseRetryAfter(headers) {
|
|
8543
8543
|
if (headers === void 0) return void 0;
|
|
8544
8544
|
const raw = headers.get("retry-after");
|
|
@@ -8567,13 +8567,13 @@ function buildErrorMetadata(args) {
|
|
|
8567
8567
|
}
|
|
8568
8568
|
var RAW_MAX_BYTES;
|
|
8569
8569
|
var init_shared = __esm({
|
|
8570
|
-
"src/internal/
|
|
8570
|
+
"src/internal/error-mappers/shared.ts"() {
|
|
8571
8571
|
init_security();
|
|
8572
8572
|
RAW_MAX_BYTES = 2048;
|
|
8573
8573
|
}
|
|
8574
8574
|
});
|
|
8575
8575
|
|
|
8576
|
-
// src/internal/
|
|
8576
|
+
// src/internal/error-mappers/anthropic.ts
|
|
8577
8577
|
function mapAnthropicError(args) {
|
|
8578
8578
|
const { status, body, headers, endpoint } = args;
|
|
8579
8579
|
const code = mapAnthropicStatusToCode(status, body);
|
|
@@ -8627,7 +8627,7 @@ function formatMessage(status, code) {
|
|
|
8627
8627
|
return `Anthropic API error: ${code} (HTTP ${status})`;
|
|
8628
8628
|
}
|
|
8629
8629
|
var init_anthropic2 = __esm({
|
|
8630
|
-
"src/internal/
|
|
8630
|
+
"src/internal/error-mappers/anthropic.ts"() {
|
|
8631
8631
|
init_errors();
|
|
8632
8632
|
init_shared();
|
|
8633
8633
|
}
|
|
@@ -8934,7 +8934,7 @@ var init_anthropic3 = __esm({
|
|
|
8934
8934
|
}
|
|
8935
8935
|
});
|
|
8936
8936
|
|
|
8937
|
-
// src/internal/
|
|
8937
|
+
// src/internal/error-mappers/bedrock.ts
|
|
8938
8938
|
function classifyBedrockError(args, awsType, message) {
|
|
8939
8939
|
if (args.status === 429 || awsType.includes("Throttling") || awsType.includes("TooManyRequests")) {
|
|
8940
8940
|
return "rate_limit";
|
|
@@ -8994,7 +8994,7 @@ function parseBody(body) {
|
|
|
8994
8994
|
return {};
|
|
8995
8995
|
}
|
|
8996
8996
|
var init_bedrock2 = __esm({
|
|
8997
|
-
"src/internal/
|
|
8997
|
+
"src/internal/error-mappers/bedrock.ts"() {
|
|
8998
8998
|
init_errors();
|
|
8999
8999
|
init_shared();
|
|
9000
9000
|
}
|
|
@@ -9381,7 +9381,7 @@ var init_credential_pool_context = __esm({
|
|
|
9381
9381
|
}
|
|
9382
9382
|
});
|
|
9383
9383
|
|
|
9384
|
-
// src/internal/
|
|
9384
|
+
// src/internal/error-mappers/openai-compatible.ts
|
|
9385
9385
|
function mapOpenAICompatibleError(args) {
|
|
9386
9386
|
const { providerId, status, body, headers, endpoint } = args;
|
|
9387
9387
|
const code = mapOpenAiStatusToCode(status, body);
|
|
@@ -9444,7 +9444,7 @@ function formatMessage2(providerId, status, code) {
|
|
|
9444
9444
|
return `${providerId} API error: ${code} (HTTP ${status})`;
|
|
9445
9445
|
}
|
|
9446
9446
|
var init_openai_compatible = __esm({
|
|
9447
|
-
"src/internal/
|
|
9447
|
+
"src/internal/error-mappers/openai-compatible.ts"() {
|
|
9448
9448
|
init_errors();
|
|
9449
9449
|
init_shared();
|
|
9450
9450
|
}
|
|
@@ -9556,7 +9556,7 @@ var init_fault_injection = __esm({
|
|
|
9556
9556
|
}
|
|
9557
9557
|
});
|
|
9558
9558
|
|
|
9559
|
-
// src/internal/
|
|
9559
|
+
// src/internal/error-mappers/ollama.ts
|
|
9560
9560
|
function mapOllamaTransportError(args) {
|
|
9561
9561
|
if (args.providerId !== "ollama") return void 0;
|
|
9562
9562
|
const causeCode = extractCauseCode(args.cause);
|
|
@@ -9629,7 +9629,7 @@ function extractModelName2(errString) {
|
|
|
9629
9629
|
return match?.[1];
|
|
9630
9630
|
}
|
|
9631
9631
|
var init_ollama2 = __esm({
|
|
9632
|
-
"src/internal/
|
|
9632
|
+
"src/internal/error-mappers/ollama.ts"() {
|
|
9633
9633
|
init_errors();
|
|
9634
9634
|
init_shared();
|
|
9635
9635
|
}
|
|
@@ -10230,7 +10230,7 @@ var init_pool_aware_client = __esm({
|
|
|
10230
10230
|
}
|
|
10231
10231
|
});
|
|
10232
10232
|
|
|
10233
|
-
// src/internal/
|
|
10233
|
+
// src/internal/error-mappers/vertex.ts
|
|
10234
10234
|
function classifyVertexError(args, errStatus) {
|
|
10235
10235
|
for (const rule of VERTEX_RULES) {
|
|
10236
10236
|
if (rule.test(args.status, errStatus)) return rule.code;
|
|
@@ -10267,7 +10267,7 @@ function parseBody2(body) {
|
|
|
10267
10267
|
}
|
|
10268
10268
|
var VERTEX_RULES, VERTEX_ERROR_BUILDERS;
|
|
10269
10269
|
var init_vertex2 = __esm({
|
|
10270
|
-
"src/internal/
|
|
10270
|
+
"src/internal/error-mappers/vertex.ts"() {
|
|
10271
10271
|
init_errors();
|
|
10272
10272
|
init_shared();
|
|
10273
10273
|
VERTEX_RULES = [
|
|
@@ -13836,7 +13836,7 @@ var init_local_agent_plugins = __esm({
|
|
|
13836
13836
|
}
|
|
13837
13837
|
});
|
|
13838
13838
|
|
|
13839
|
-
// src/internal/runtime/run-until.ts
|
|
13839
|
+
// src/internal/runtime/lifecycle/run-until.ts
|
|
13840
13840
|
var run_until_exports = {};
|
|
13841
13841
|
__export(run_until_exports, {
|
|
13842
13842
|
composeContinuation: () => composeContinuation,
|
|
@@ -13929,7 +13929,7 @@ Your last response was:
|
|
|
13929
13929
|
${lastResponse.slice(0, 1e3)}`;
|
|
13930
13930
|
}
|
|
13931
13931
|
var init_run_until = __esm({
|
|
13932
|
-
"src/internal/runtime/run-until.ts"() {
|
|
13932
|
+
"src/internal/runtime/lifecycle/run-until.ts"() {
|
|
13933
13933
|
}
|
|
13934
13934
|
});
|
|
13935
13935
|
|
|
@@ -14040,16 +14040,16 @@ var init_judge_call = __esm({
|
|
|
14040
14040
|
// src/internal/runtime/registry/agent-factory-registry.ts
|
|
14041
14041
|
var agent_factory_registry_exports = {};
|
|
14042
14042
|
__export(agent_factory_registry_exports, {
|
|
14043
|
-
|
|
14044
|
-
|
|
14043
|
+
getAgentFacade: () => getAgentFacade,
|
|
14044
|
+
setAgentFacade: () => setAgentFacade
|
|
14045
14045
|
});
|
|
14046
|
-
function
|
|
14047
|
-
registered3 =
|
|
14046
|
+
function setAgentFacade(facade) {
|
|
14047
|
+
registered3 = facade;
|
|
14048
14048
|
}
|
|
14049
|
-
function
|
|
14049
|
+
function getAgentFacade() {
|
|
14050
14050
|
if (registered3 === void 0) {
|
|
14051
14051
|
throw new Error(
|
|
14052
|
-
"internal: Agent
|
|
14052
|
+
"internal: Agent facade not registered. The `agent.ts` module must be loaded before internal subsystems (LocalAgent.runUntil/fork, eval, scorers, cron) invoke it."
|
|
14053
14053
|
);
|
|
14054
14054
|
}
|
|
14055
14055
|
return registered3;
|
|
@@ -14060,7 +14060,7 @@ var init_agent_factory_registry = __esm({
|
|
|
14060
14060
|
}
|
|
14061
14061
|
});
|
|
14062
14062
|
|
|
14063
|
-
// src/internal/runtime/fork-agent.ts
|
|
14063
|
+
// src/internal/runtime/lifecycle/fork-agent.ts
|
|
14064
14064
|
var fork_agent_exports = {};
|
|
14065
14065
|
__export(fork_agent_exports, {
|
|
14066
14066
|
filterMemoryPlugins: () => filterMemoryPlugins,
|
|
@@ -14120,7 +14120,7 @@ function extractUsage(result) {
|
|
|
14120
14120
|
};
|
|
14121
14121
|
}
|
|
14122
14122
|
var init_fork_agent = __esm({
|
|
14123
|
-
"src/internal/runtime/fork-agent.ts"() {
|
|
14123
|
+
"src/internal/runtime/lifecycle/fork-agent.ts"() {
|
|
14124
14124
|
init_async_local_storage();
|
|
14125
14125
|
init_local_agent_plugins();
|
|
14126
14126
|
}
|
|
@@ -14131,8 +14131,8 @@ function localAgentRunUntil(agent, goal, options) {
|
|
|
14131
14131
|
async function* wrap() {
|
|
14132
14132
|
const { runUntilImpl: runUntilImpl2 } = await Promise.resolve().then(() => (init_run_until(), run_until_exports));
|
|
14133
14133
|
const { judgeCallImpl: judgeCallImpl2 } = await Promise.resolve().then(() => (init_judge_call(), judge_call_exports));
|
|
14134
|
-
const {
|
|
14135
|
-
const create =
|
|
14134
|
+
const { getAgentFacade: getAgentFacade2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
|
|
14135
|
+
const create = getAgentFacade2().create;
|
|
14136
14136
|
const deps = {
|
|
14137
14137
|
judge: async (ctx, opts) => judgeCallImpl2(ctx, opts, { create })
|
|
14138
14138
|
};
|
|
@@ -14142,9 +14142,9 @@ function localAgentRunUntil(agent, goal, options) {
|
|
|
14142
14142
|
}
|
|
14143
14143
|
async function localAgentFork(parent, options) {
|
|
14144
14144
|
const { forkAgentImpl: forkAgentImpl2 } = await Promise.resolve().then(() => (init_fork_agent(), fork_agent_exports));
|
|
14145
|
-
const {
|
|
14145
|
+
const { getAgentFacade: getAgentFacade2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
|
|
14146
14146
|
const { withPersonalityContext: withPersonalityContext2 } = await Promise.resolve().then(() => (init_context2(), context_exports));
|
|
14147
|
-
const create =
|
|
14147
|
+
const create = getAgentFacade2().create;
|
|
14148
14148
|
return withPersonalityContext2(
|
|
14149
14149
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
14150
14150
|
() => forkAgentImpl2(parent, options, { create })
|
|
@@ -14168,7 +14168,7 @@ var init_local_agent_runtime_extensions = __esm({
|
|
|
14168
14168
|
}
|
|
14169
14169
|
});
|
|
14170
14170
|
|
|
14171
|
-
// src/internal/runtime/abort-utils.ts
|
|
14171
|
+
// src/internal/runtime/concurrency/abort-utils.ts
|
|
14172
14172
|
function anySignal(signals) {
|
|
14173
14173
|
const filtered = signals.filter((s) => s !== void 0);
|
|
14174
14174
|
if (filtered.length === 0) {
|
|
@@ -14194,7 +14194,7 @@ function ponyfillAny(signals) {
|
|
|
14194
14194
|
return ctrl.signal;
|
|
14195
14195
|
}
|
|
14196
14196
|
var init_abort_utils = __esm({
|
|
14197
|
-
"src/internal/runtime/abort-utils.ts"() {
|
|
14197
|
+
"src/internal/runtime/concurrency/abort-utils.ts"() {
|
|
14198
14198
|
}
|
|
14199
14199
|
});
|
|
14200
14200
|
|
|
@@ -14347,7 +14347,7 @@ var init_task = __esm({
|
|
|
14347
14347
|
}
|
|
14348
14348
|
});
|
|
14349
14349
|
|
|
14350
|
-
// src/internal/runtime/async-semaphore.ts
|
|
14350
|
+
// src/internal/runtime/concurrency/async-semaphore.ts
|
|
14351
14351
|
function createSemaphore(permits) {
|
|
14352
14352
|
if (!Number.isInteger(permits) || permits < 1) {
|
|
14353
14353
|
throw new ConfigurationError(
|
|
@@ -14385,7 +14385,7 @@ function createSemaphore(permits) {
|
|
|
14385
14385
|
};
|
|
14386
14386
|
}
|
|
14387
14387
|
var init_async_semaphore = __esm({
|
|
14388
|
-
"src/internal/runtime/async-semaphore.ts"() {
|
|
14388
|
+
"src/internal/runtime/concurrency/async-semaphore.ts"() {
|
|
14389
14389
|
init_errors();
|
|
14390
14390
|
}
|
|
14391
14391
|
});
|
|
@@ -14952,8 +14952,8 @@ var init_local_agent = __esm({
|
|
|
14952
14952
|
init_span_names();
|
|
14953
14953
|
init_tracer();
|
|
14954
14954
|
init_hooks_executor();
|
|
14955
|
-
init_memory_path_selector();
|
|
14956
14955
|
init_post_run_lifecycle();
|
|
14956
|
+
init_memory_path_selector();
|
|
14957
14957
|
init_agent_registry();
|
|
14958
14958
|
init_live_agent_registry();
|
|
14959
14959
|
init_agent_session();
|
|
@@ -16422,7 +16422,13 @@ var init_agent = __esm({
|
|
|
16422
16422
|
await flushRegistrySaves();
|
|
16423
16423
|
}
|
|
16424
16424
|
};
|
|
16425
|
-
|
|
16425
|
+
setAgentFacade({
|
|
16426
|
+
create: (options) => Agent.create(options),
|
|
16427
|
+
prompt: (message, options) => Agent.prompt(message, options),
|
|
16428
|
+
get: (agentId) => Agent.get(agentId),
|
|
16429
|
+
resume: (agentId, options) => Agent.resume(agentId, options),
|
|
16430
|
+
batch: (prompts, options) => Agent.batch(prompts, options)
|
|
16431
|
+
});
|
|
16426
16432
|
}
|
|
16427
16433
|
});
|
|
16428
16434
|
|