@theokit/sdk 2.23.0 → 2.25.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/a2a/index.cjs +259 -192
  3. package/dist/a2a/index.cjs.map +1 -1
  4. package/dist/a2a/index.js +259 -192
  5. package/dist/a2a/index.js.map +1 -1
  6. package/dist/create-skill.d.ts +8 -0
  7. package/dist/{cron-7CruUd_0.d.ts → cron-B44D-678.d.ts} +67 -4
  8. package/dist/{cron-Bpt_1khA.d.cts → cron-qI-dbG7c.d.cts} +67 -4
  9. package/dist/cron.cjs +246 -181
  10. package/dist/cron.cjs.map +1 -1
  11. package/dist/cron.d.cts +2 -2
  12. package/dist/cron.d.ts +2 -2
  13. package/dist/cron.js +246 -181
  14. package/dist/cron.js.map +1 -1
  15. package/dist/define-tool.d.ts +33 -20
  16. package/dist/{errors-CkCaIqVP.d.cts → errors-DIKBXffg.d.cts} +1 -1
  17. package/dist/{errors-BuwwkrAk.d.ts → errors-DRS-kqOK.d.ts} +1 -1
  18. package/dist/errors.d.cts +2 -2
  19. package/dist/eval.cjs +246 -181
  20. package/dist/eval.cjs.map +1 -1
  21. package/dist/eval.js +246 -181
  22. package/dist/eval.js.map +1 -1
  23. package/dist/index.cjs +299 -186
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +75 -27
  26. package/dist/index.d.ts +75 -27
  27. package/dist/index.js +299 -187
  28. package/dist/index.js.map +1 -1
  29. package/dist/internal/runtime/local-agent/local-agent-bootstrap.d.ts +2 -4
  30. package/dist/internal/runtime/skills/skill-frontmatter.d.ts +6 -0
  31. package/dist/{run-CrIulPF7.d.cts → run-Cr0C6cOM.d.cts} +17 -0
  32. package/dist/{run-CrIulPF7.d.ts → run-Cr0C6cOM.d.ts} +17 -0
  33. package/dist/skills.cjs.map +1 -1
  34. package/dist/skills.js.map +1 -1
  35. package/dist/types/agent.d.ts +57 -2
  36. package/dist/types/run.d.ts +17 -0
  37. package/dist/workflow.cjs +37 -0
  38. package/dist/workflow.cjs.map +1 -1
  39. package/dist/workflow.d.cts +47 -1
  40. package/dist/workflow.d.ts +47 -1
  41. package/dist/workflow.js +37 -2
  42. package/dist/workflow.js.map +1 -1
  43. package/package.json +1 -1
package/dist/eval.js CHANGED
@@ -3454,7 +3454,8 @@ function stripSecretsFromOptions(options) {
3454
3454
  local: serializeLocal(options.local),
3455
3455
  cloud: serializeCloud(options.cloud),
3456
3456
  memory: serializeMemory(options.memory),
3457
- skills: serializeEnabledList(options.skills),
3457
+ // SE22 — a SkillsResolver function isn't serializable; persist only the static form.
3458
+ skills: serializeEnabledList(typeof options.skills === "function" ? void 0 : options.skills),
3458
3459
  // Code-`Plugin` objects are closures and cannot be persisted (like custom
3459
3460
  // tools); only the named-enable settings form is serialized.
3460
3461
  plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
@@ -3762,6 +3763,7 @@ function serializeCloud2(cloud) {
3762
3763
  return result;
3763
3764
  }
3764
3765
  function serializeSkills(skills) {
3766
+ if (typeof skills === "function") return void 0;
3765
3767
  if (skills?.enabled === void 0 || skills.enabled.length === 0) return void 0;
3766
3768
  return { enabled: [...skills.enabled] };
3767
3769
  }
@@ -5233,6 +5235,7 @@ init_errors();
5233
5235
  function validateCloudToolParity(options) {
5234
5236
  if (options.cloud === void 0) return;
5235
5237
  rejectFunctionSystemPrompt(options);
5238
+ rejectFunctionSkills(options);
5236
5239
  rejectStdioMcpLocalPaths(options);
5237
5240
  }
5238
5241
  function rejectFunctionSystemPrompt(options) {
@@ -5243,6 +5246,14 @@ function rejectFunctionSystemPrompt(options) {
5243
5246
  );
5244
5247
  }
5245
5248
  }
5249
+ function rejectFunctionSkills(options) {
5250
+ if (typeof options.skills === "function") {
5251
+ throw new ConfigurationError(
5252
+ "Cloud agents require skills as a static settings object. SkillsResolver functions can't run on PaaS \u2014 resolve to a SkillsSettings object before Agent.create() or move the dynamic logic into a hook rule.",
5253
+ { code: "cloud_incompatible_function_resolver" }
5254
+ );
5255
+ }
5256
+ }
5246
5257
  function rejectStdioMcpLocalPaths(options) {
5247
5258
  if (options.mcpServers === void 0) return;
5248
5259
  for (const [name, config] of Object.entries(options.mcpServers)) {
@@ -7099,9 +7110,223 @@ function parseFrontmatterFields(frontmatter) {
7099
7110
  return out;
7100
7111
  }
7101
7112
 
7113
+ // src/internal/runtime/skills/discover-skills.ts
7114
+ init_errors();
7115
+
7116
+ // src/internal/runtime/skills/skill-frontmatter.ts
7117
+ init_errors();
7118
+ init_yaml_frontmatter();
7119
+ function asString(v) {
7120
+ return typeof v === "string" ? v : void 0;
7121
+ }
7122
+ function toStringFields(raw) {
7123
+ const out = {};
7124
+ for (const [k, v] of Object.entries(raw)) out[k] = asString(v);
7125
+ return out;
7126
+ }
7127
+ function parseSkillFrontmatter(raw, fallbackName) {
7128
+ const fields = extractAndParseFrontmatter(raw, fallbackName);
7129
+ const name = resolveName(fields, fallbackName);
7130
+ ensureRequiredFields(fields, name);
7131
+ return buildFrontmatter(fields, name);
7132
+ }
7133
+ function stripSkillFrontmatter(raw) {
7134
+ const match = /^---\s*\n[\s\S]*?\n---\s*\n/.exec(raw);
7135
+ return (match === null ? raw : raw.slice(match[0].length)).trim();
7136
+ }
7137
+ function extractAndParseFrontmatter(raw, fallbackName) {
7138
+ const match = /^---\s*\n([\s\S]*?)\n---\s*\n/.exec(raw);
7139
+ if (match === null) {
7140
+ throw new ConfigurationError(`Skill ${fallbackName} is missing frontmatter`, {
7141
+ code: "missing_frontmatter"
7142
+ });
7143
+ }
7144
+ const frontmatter = match[1] ?? "";
7145
+ try {
7146
+ return toStringFields(parseSimpleYaml(frontmatter));
7147
+ } catch (cause) {
7148
+ const detail = cause instanceof Error ? cause.message : String(cause);
7149
+ throw new ConfigurationError(
7150
+ `Skill ${fallbackName} has malformed YAML frontmatter: ${detail}`,
7151
+ { code: "schema_invalid", cause }
7152
+ );
7153
+ }
7154
+ }
7155
+ function resolveName(fields, fallbackName) {
7156
+ if (hasContent(fields.name)) return fields.name;
7157
+ if (hasContent(fallbackName)) return fallbackName;
7158
+ throw new ConfigurationError("Skill at unknown path is missing required field: name", {
7159
+ code: "schema_invalid"
7160
+ });
7161
+ }
7162
+ function ensureRequiredFields(fields, name) {
7163
+ if (!hasContent(fields.description)) {
7164
+ throw new ConfigurationError(`Skill ${name} is missing required field: description`, {
7165
+ code: "schema_invalid"
7166
+ });
7167
+ }
7168
+ }
7169
+ function buildFrontmatter(fields, name) {
7170
+ const description = fields.description;
7171
+ if (description === void 0) {
7172
+ throw new ConfigurationError(`Skill ${name} missing description`, { code: "schema_invalid" });
7173
+ }
7174
+ const result = { name, description };
7175
+ if (hasContent(fields.category)) result.category = fields.category;
7176
+ const deps = parseDependencies(fields.dependencies);
7177
+ if (deps !== void 0) result.dependencies = deps;
7178
+ return result;
7179
+ }
7180
+ function parseDependencies(raw) {
7181
+ if (!hasContent(raw)) return void 0;
7182
+ const deps = raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
7183
+ return deps.length > 0 ? deps : void 0;
7184
+ }
7185
+ function hasContent(value) {
7186
+ return value !== void 0 && value.trim().length > 0;
7187
+ }
7188
+
7189
+ // src/internal/runtime/skills/discover-skills.ts
7190
+ async function discoverSkills(dir, options) {
7191
+ let entries;
7192
+ try {
7193
+ entries = await readWorkspaceDir(dir, "skills_read_error", "skills directory");
7194
+ } catch {
7195
+ return [];
7196
+ }
7197
+ const skills = [];
7198
+ for (const entry of entries) {
7199
+ if (!entry.isDirectory()) continue;
7200
+ let skillDir;
7201
+ try {
7202
+ skillDir = safePathJoin(dir, entry.name);
7203
+ assertNoSymlinkEscape(skillDir, dir);
7204
+ } catch {
7205
+ continue;
7206
+ }
7207
+ const skillPath = join(skillDir, "SKILL.md");
7208
+ let raw;
7209
+ try {
7210
+ raw = await readFile(skillPath, "utf8");
7211
+ } catch {
7212
+ continue;
7213
+ }
7214
+ const skill = tryParseSkill(raw, entry.name, skillPath, options);
7215
+ if (skill !== void 0) skills.push(skill);
7216
+ }
7217
+ return skills;
7218
+ }
7219
+ function tryParseSkill(raw, fallbackName, source, options) {
7220
+ try {
7221
+ const frontmatter = parseSkillFrontmatter(raw, fallbackName);
7222
+ const skill = {
7223
+ name: frontmatter.name,
7224
+ description: frontmatter.description,
7225
+ source
7226
+ };
7227
+ if (frontmatter.category !== void 0) skill.category = frontmatter.category;
7228
+ if (frontmatter.dependencies !== void 0) skill.dependencies = frontmatter.dependencies;
7229
+ return skill;
7230
+ } catch (cause) {
7231
+ if (cause instanceof ConfigurationError) {
7232
+ options?.onInvalidSkill?.({
7233
+ name: fallbackName,
7234
+ source,
7235
+ code: cause.code ?? "unknown",
7236
+ message: cause.message
7237
+ });
7238
+ return void 0;
7239
+ }
7240
+ throw cause;
7241
+ }
7242
+ }
7243
+
7244
+ // src/internal/runtime/skills/skills-manager.ts
7245
+ var SkillsManager = class {
7246
+ constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline) {
7247
+ this.cwd = cwd;
7248
+ this.settingSourcesIncludeProject = settingSourcesIncludeProject;
7249
+ this.skillsDir = skillsDir;
7250
+ this.inline = inline;
7251
+ }
7252
+ cwd;
7253
+ settingSourcesIncludeProject;
7254
+ skillsDir;
7255
+ inline;
7256
+ skills = [];
7257
+ async initialize() {
7258
+ if (!this.settingSourcesIncludeProject) {
7259
+ this.skills = this.mergeInline([]);
7260
+ return;
7261
+ }
7262
+ await this.refresh();
7263
+ }
7264
+ async refresh() {
7265
+ const skillsRoot = this.skillsDir ?? join(this.cwd, ".theokit", "skills");
7266
+ const discovered = await discoverSkills(skillsRoot, {
7267
+ onInvalidSkill: (info) => {
7268
+ process.stderr.write(
7269
+ `[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
7270
+ `
7271
+ );
7272
+ }
7273
+ });
7274
+ this.skills = this.mergeInline(discovered);
7275
+ }
7276
+ /** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
7277
+ mergeInline(discovered) {
7278
+ if (this.inline === void 0 || this.inline.length === 0) return discovered;
7279
+ const inlineNames = new Set(this.inline.map((s) => s.name));
7280
+ return [...discovered.filter((s) => !inlineNames.has(s.name)), ...this.inline];
7281
+ }
7282
+ list() {
7283
+ return Promise.resolve(this.skills);
7284
+ }
7285
+ /**
7286
+ * SE20 — resolve a skill by name INCLUDING its body. Inline (`createSkill`)
7287
+ * skills carry `instructions` on the object; filesystem skills read the body
7288
+ * from their `source` SKILL.md (frontmatter stripped). `undefined` when no
7289
+ * enabled skill matches (malformed skills were already excluded at discovery).
7290
+ */
7291
+ async get(name) {
7292
+ const skill = this.skills.find((s) => s.name === name);
7293
+ if (skill === void 0) return void 0;
7294
+ const instructions = typeof skill.instructions === "string" ? skill.instructions : stripSkillFrontmatter(await readFile(skill.source, "utf8"));
7295
+ const references = skill.references;
7296
+ return {
7297
+ name: skill.name,
7298
+ description: skill.description,
7299
+ instructions,
7300
+ ...references !== void 0 ? { references } : {}
7301
+ };
7302
+ }
7303
+ };
7304
+
7102
7305
  // src/internal/runtime/system-prompt/local-assembly.ts
7103
- async function buildSystemPromptContext(inputs, userText, memoryFacts) {
7104
- const skills = inputs.skillsManager !== void 0 ? await inputs.skillsManager.list() : [];
7306
+ async function resolveSendSkills(inputs, userText, memoryFacts) {
7307
+ const skills = inputs.options.skills;
7308
+ if (typeof skills !== "function") {
7309
+ return { manager: inputs.skillsManager, autoInject: skills?.autoInject ?? true };
7310
+ }
7311
+ const settings = await skills({
7312
+ agentId: inputs.agentId,
7313
+ cwd: inputs.workspaceCwd,
7314
+ model: inputs.model,
7315
+ userMessage: userText,
7316
+ memory: memoryFacts.map((fact) => ({ text: fact.text }))
7317
+ });
7318
+ const manager = new SkillsManager(
7319
+ inputs.workspaceCwd,
7320
+ settings.enabled,
7321
+ inputs.settingSourcesIncludeProject,
7322
+ settings.skillsDir,
7323
+ settings.inline
7324
+ );
7325
+ await manager.initialize();
7326
+ return { manager, autoInject: settings.autoInject ?? true };
7327
+ }
7328
+ async function buildSystemPromptContext(inputs, userText, memoryFacts, manager = inputs.skillsManager) {
7329
+ const skills = manager !== void 0 ? await manager.list() : [];
7105
7330
  return {
7106
7331
  agentId: inputs.agentId,
7107
7332
  cwd: inputs.workspaceCwd,
@@ -7112,10 +7337,11 @@ async function buildSystemPromptContext(inputs, userText, memoryFacts) {
7112
7337
  };
7113
7338
  }
7114
7339
  async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
7115
- const baseCtx = await buildSystemPromptContext(inputs, userText, memoryFacts);
7340
+ const resolved = await resolveSendSkills(inputs, userText, memoryFacts);
7341
+ const baseCtx = await buildSystemPromptContext(inputs, userText, memoryFacts, resolved.manager);
7116
7342
  const assemblyCtx = {
7117
7343
  ...baseCtx,
7118
- skillsAutoInject: inputs.options.skills?.autoInject ?? true,
7344
+ skillsAutoInject: resolved.autoInject,
7119
7345
  memoryAutoInject: inputs.options.memory?.autoInject ?? true
7120
7346
  };
7121
7347
  if (baseSystemPrompt !== void 0) assemblyCtx.baseSystemPrompt = baseSystemPrompt;
@@ -8367,176 +8593,6 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
8367
8593
  return metadata;
8368
8594
  }
8369
8595
 
8370
- // src/internal/runtime/skills/discover-skills.ts
8371
- init_errors();
8372
-
8373
- // src/internal/runtime/skills/skill-frontmatter.ts
8374
- init_errors();
8375
- init_yaml_frontmatter();
8376
- function asString(v) {
8377
- return typeof v === "string" ? v : void 0;
8378
- }
8379
- function toStringFields(raw) {
8380
- const out = {};
8381
- for (const [k, v] of Object.entries(raw)) out[k] = asString(v);
8382
- return out;
8383
- }
8384
- function parseSkillFrontmatter(raw, fallbackName) {
8385
- const fields = extractAndParseFrontmatter(raw, fallbackName);
8386
- const name = resolveName(fields, fallbackName);
8387
- ensureRequiredFields(fields, name);
8388
- return buildFrontmatter(fields, name);
8389
- }
8390
- function extractAndParseFrontmatter(raw, fallbackName) {
8391
- const match = /^---\s*\n([\s\S]*?)\n---\s*\n/.exec(raw);
8392
- if (match === null) {
8393
- throw new ConfigurationError(`Skill ${fallbackName} is missing frontmatter`, {
8394
- code: "missing_frontmatter"
8395
- });
8396
- }
8397
- const frontmatter = match[1] ?? "";
8398
- try {
8399
- return toStringFields(parseSimpleYaml(frontmatter));
8400
- } catch (cause) {
8401
- const detail = cause instanceof Error ? cause.message : String(cause);
8402
- throw new ConfigurationError(
8403
- `Skill ${fallbackName} has malformed YAML frontmatter: ${detail}`,
8404
- { code: "schema_invalid", cause }
8405
- );
8406
- }
8407
- }
8408
- function resolveName(fields, fallbackName) {
8409
- if (hasContent(fields.name)) return fields.name;
8410
- if (hasContent(fallbackName)) return fallbackName;
8411
- throw new ConfigurationError("Skill at unknown path is missing required field: name", {
8412
- code: "schema_invalid"
8413
- });
8414
- }
8415
- function ensureRequiredFields(fields, name) {
8416
- if (!hasContent(fields.description)) {
8417
- throw new ConfigurationError(`Skill ${name} is missing required field: description`, {
8418
- code: "schema_invalid"
8419
- });
8420
- }
8421
- }
8422
- function buildFrontmatter(fields, name) {
8423
- const description = fields.description;
8424
- if (description === void 0) {
8425
- throw new ConfigurationError(`Skill ${name} missing description`, { code: "schema_invalid" });
8426
- }
8427
- const result = { name, description };
8428
- if (hasContent(fields.category)) result.category = fields.category;
8429
- const deps = parseDependencies(fields.dependencies);
8430
- if (deps !== void 0) result.dependencies = deps;
8431
- return result;
8432
- }
8433
- function parseDependencies(raw) {
8434
- if (!hasContent(raw)) return void 0;
8435
- const deps = raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
8436
- return deps.length > 0 ? deps : void 0;
8437
- }
8438
- function hasContent(value) {
8439
- return value !== void 0 && value.trim().length > 0;
8440
- }
8441
-
8442
- // src/internal/runtime/skills/discover-skills.ts
8443
- async function discoverSkills(dir, options) {
8444
- let entries;
8445
- try {
8446
- entries = await readWorkspaceDir(dir, "skills_read_error", "skills directory");
8447
- } catch {
8448
- return [];
8449
- }
8450
- const skills = [];
8451
- for (const entry of entries) {
8452
- if (!entry.isDirectory()) continue;
8453
- let skillDir;
8454
- try {
8455
- skillDir = safePathJoin(dir, entry.name);
8456
- assertNoSymlinkEscape(skillDir, dir);
8457
- } catch {
8458
- continue;
8459
- }
8460
- const skillPath = join(skillDir, "SKILL.md");
8461
- let raw;
8462
- try {
8463
- raw = await readFile(skillPath, "utf8");
8464
- } catch {
8465
- continue;
8466
- }
8467
- const skill = tryParseSkill(raw, entry.name, skillPath, options);
8468
- if (skill !== void 0) skills.push(skill);
8469
- }
8470
- return skills;
8471
- }
8472
- function tryParseSkill(raw, fallbackName, source, options) {
8473
- try {
8474
- const frontmatter = parseSkillFrontmatter(raw, fallbackName);
8475
- const skill = {
8476
- name: frontmatter.name,
8477
- description: frontmatter.description,
8478
- source
8479
- };
8480
- if (frontmatter.category !== void 0) skill.category = frontmatter.category;
8481
- if (frontmatter.dependencies !== void 0) skill.dependencies = frontmatter.dependencies;
8482
- return skill;
8483
- } catch (cause) {
8484
- if (cause instanceof ConfigurationError) {
8485
- options?.onInvalidSkill?.({
8486
- name: fallbackName,
8487
- source,
8488
- code: cause.code ?? "unknown",
8489
- message: cause.message
8490
- });
8491
- return void 0;
8492
- }
8493
- throw cause;
8494
- }
8495
- }
8496
-
8497
- // src/internal/runtime/skills/skills-manager.ts
8498
- var SkillsManager = class {
8499
- constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline) {
8500
- this.cwd = cwd;
8501
- this.settingSourcesIncludeProject = settingSourcesIncludeProject;
8502
- this.skillsDir = skillsDir;
8503
- this.inline = inline;
8504
- }
8505
- cwd;
8506
- settingSourcesIncludeProject;
8507
- skillsDir;
8508
- inline;
8509
- skills = [];
8510
- async initialize() {
8511
- if (!this.settingSourcesIncludeProject) {
8512
- this.skills = this.mergeInline([]);
8513
- return;
8514
- }
8515
- await this.refresh();
8516
- }
8517
- async refresh() {
8518
- const skillsRoot = this.skillsDir ?? join(this.cwd, ".theokit", "skills");
8519
- const discovered = await discoverSkills(skillsRoot, {
8520
- onInvalidSkill: (info) => {
8521
- process.stderr.write(
8522
- `[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
8523
- `
8524
- );
8525
- }
8526
- });
8527
- this.skills = this.mergeInline(discovered);
8528
- }
8529
- /** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
8530
- mergeInline(discovered) {
8531
- if (this.inline === void 0 || this.inline.length === 0) return discovered;
8532
- const inlineNames = new Set(this.inline.map((s) => s.name));
8533
- return [...discovered.filter((s) => !inlineNames.has(s.name)), ...this.inline];
8534
- }
8535
- list() {
8536
- return Promise.resolve(this.skills);
8537
- }
8538
- };
8539
-
8540
8596
  // src/internal/runtime/local-agent/local-agent-bootstrap.ts
8541
8597
  function registerLocalAgent(args) {
8542
8598
  registerAgent({
@@ -8572,16 +8628,23 @@ function bootstrapSubmanagers(args) {
8572
8628
  );
8573
8629
  }
8574
8630
  if (args.options.skills !== void 0 || args.settingSourcesIncludeProject) {
8631
+ const staticSkills = typeof args.options.skills === "function" ? void 0 : args.options.skills;
8575
8632
  out.skillsManager = new SkillsManager(
8576
8633
  args.workspaceCwd,
8577
- args.options.skills?.enabled,
8634
+ staticSkills?.enabled,
8578
8635
  args.settingSourcesIncludeProject,
8579
8636
  // M22 — custom skills directory + inline (code-defined) skills.
8580
- args.options.skills?.skillsDir,
8581
- args.options.skills?.inline
8637
+ staticSkills?.skillsDir,
8638
+ staticSkills?.inline
8582
8639
  );
8583
8640
  const localSkills = out.skillsManager;
8584
- out.skills = { list: () => localSkills.list() };
8641
+ out.skills = {
8642
+ // Project to the public shape (name + description only). Inline skills carry
8643
+ // their body + references on the object; `list()` must never leak them —
8644
+ // the body is reachable exclusively through `get()`.
8645
+ list: async () => (await localSkills.list()).map((s) => ({ name: s.name, description: s.description })),
8646
+ get: (name) => localSkills.get(name)
8647
+ };
8585
8648
  }
8586
8649
  if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
8587
8650
  out.pluginsManager = new PluginsManager(
@@ -13299,6 +13362,7 @@ function levenshtein(a, b) {
13299
13362
  }
13300
13363
 
13301
13364
  // src/internal/runtime/local-agent/real-local-run.ts
13365
+ init_async_local_storage();
13302
13366
  function createRealLocalRun(options) {
13303
13367
  const { userText, id, startTime } = prepareRunContext(options.message);
13304
13368
  const supported = /* @__PURE__ */ new Set(["stream", "wait", "cancel", "conversation"]);
@@ -13410,6 +13474,7 @@ function buildLoopInputs(options, runId, userText) {
13410
13474
  ...options.onStep !== void 0 ? { onStep: options.onStep } : {},
13411
13475
  ...options.onDelta !== void 0 ? { onDelta: options.onDelta } : {},
13412
13476
  ...options.sendOptions.toolChoice !== void 0 ? { toolChoice: options.sendOptions.toolChoice } : {},
13477
+ ...options.sendOptions.activeTools !== void 0 ? { activeTools: options.sendOptions.activeTools } : {},
13413
13478
  ...options.priorMessages !== void 0 ? { priorMessages: options.priorMessages } : {},
13414
13479
  ...options.memoryTools !== void 0 && options.memoryTools.length > 0 ? { memoryTools: options.memoryTools } : {},
13415
13480
  ...buildCustomToolsInput(
@@ -13540,7 +13605,7 @@ var RealLocalRun = class extends FixtureRunBase {
13540
13605
  }
13541
13606
  async executeAgentLoop(inputs) {
13542
13607
  try {
13543
- const output = await runAgentLoop(inputs);
13608
+ const output = inputs.activeTools !== void 0 ? await withToolWhitelist(new Set(inputs.activeTools), () => runAgentLoop(inputs)) : await runAgentLoop(inputs);
13544
13609
  this.applyAgentLoopOutput(output);
13545
13610
  this.transitionTo(output.finalStatus);
13546
13611
  } catch (cause) {
@@ -16425,7 +16490,7 @@ var LocalAgent = class {
16425
16490
  }
16426
16491
  // biome-ignore format: G8 budget — thin accessor for the assembly inputs.
16427
16492
  assemblyInputs() {
16428
- return { agentId: this.agentId, workspaceCwd: this.workspaceCwd, model: this.model, options: this.options, context: this.context, skillsManager: this.skillsManager, systemPromptPipeline: this.systemPromptPipeline };
16493
+ return { agentId: this.agentId, workspaceCwd: this.workspaceCwd, model: this.model, options: this.options, context: this.context, skillsManager: this.skillsManager, settingSourcesIncludeProject: this.settingSourcesIncludeProject, systemPromptPipeline: this.systemPromptPipeline };
16429
16494
  }
16430
16495
  async resolveSystemPrompt(userText, options, memoryFacts) {
16431
16496
  const base = await resolveSystemPromptForSend(