@theokit/sdk 3.1.1 → 3.2.2

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 (44) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/a2a/index.cjs +188 -49
  3. package/dist/a2a/index.cjs.map +1 -1
  4. package/dist/a2a/index.js +188 -49
  5. package/dist/a2a/index.js.map +1 -1
  6. package/dist/{cron-C2jWAvlQ.d.cts → cron-4u1UdmgC.d.cts} +1 -1
  7. package/dist/{cron-BLRe166v.d.ts → cron-DuhVPer6.d.ts} +1 -1
  8. package/dist/cron.cjs +188 -49
  9. package/dist/cron.cjs.map +1 -1
  10. package/dist/cron.d.cts +2 -2
  11. package/dist/cron.d.ts +2 -2
  12. package/dist/cron.js +188 -49
  13. package/dist/cron.js.map +1 -1
  14. package/dist/{errors-D_Bfo30u.d.ts → errors-_fPS0X80.d.ts} +1 -1
  15. package/dist/{errors-DZpCGlYv.d.cts → errors-jxK4yfp5.d.cts} +1 -1
  16. package/dist/errors.d.cts +2 -2
  17. package/dist/eval.cjs +188 -64
  18. package/dist/eval.cjs.map +1 -1
  19. package/dist/eval.js +188 -64
  20. package/dist/eval.js.map +1 -1
  21. package/dist/index.cjs +197 -50
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +6 -6
  24. package/dist/index.d.ts +6 -6
  25. package/dist/index.js +197 -50
  26. package/dist/index.js.map +1 -1
  27. package/dist/internal/runtime/context/context-discovery.d.ts +1 -1
  28. package/dist/internal/runtime/context/context-glob.d.ts +1 -0
  29. package/dist/internal/runtime/context/context-manager.d.ts +18 -1
  30. package/dist/internal/runtime/context/context-mdc-parser.d.ts +7 -6
  31. package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +30 -0
  32. package/dist/internal/runtime/context/context-yaml-lite.d.ts +26 -0
  33. package/dist/project.cjs.map +1 -1
  34. package/dist/project.js.map +1 -1
  35. package/dist/{run-CLXKMRgq.d.cts → run-CrHz9BAP.d.cts} +9 -0
  36. package/dist/{run-CLXKMRgq.d.ts → run-CrHz9BAP.d.ts} +9 -0
  37. package/dist/sandbox/index.cjs +8 -9
  38. package/dist/sandbox/index.cjs.map +1 -1
  39. package/dist/sandbox/index.js +8 -9
  40. package/dist/sandbox/index.js.map +1 -1
  41. package/dist/sandbox/types.d.cts +0 -1
  42. package/dist/sandbox/types.d.ts +0 -1
  43. package/dist/types/run.d.ts +9 -0
  44. package/package.json +3 -3
package/dist/cron.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { V as Cron } from './cron-C2jWAvlQ.cjs';
2
- import './run-CLXKMRgq.cjs';
1
+ export { V as Cron } from './cron-4u1UdmgC.cjs';
2
+ import './run-CrHz9BAP.cjs';
3
3
  import 'zod';
package/dist/cron.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { V as Cron } from './cron-BLRe166v.js';
2
- import './run-CLXKMRgq.js';
1
+ export { V as Cron } from './cron-DuhVPer6.js';
2
+ import './run-CrHz9BAP.js';
3
3
  import 'zod';
package/dist/cron.js CHANGED
@@ -963,10 +963,10 @@ function buildToolPrompt(prompt) {
963
963
  Respond by calling the \`output\` tool with the structured answer that matches the schema.`;
964
964
  }
965
965
  function setupStructuredOutput(schema, maxRetries) {
966
- const z7 = requireZod();
966
+ const z8 = requireZod();
967
967
  const jsonSchema = toJsonSchema(schema, { unrepresentable: "any" });
968
968
  return {
969
- z: z7,
969
+ z: z8,
970
970
  jsonSchema,
971
971
  maxRetries: maxRetries ?? 1,
972
972
  initialUsage: { inputTokens: 0, outputTokens: 0 }
@@ -4744,7 +4744,14 @@ var init_env_policy = __esm({
4744
4744
  /[_-]PWD/i,
4745
4745
  /CREDENTIAL/i,
4746
4746
  /PRIVATE/i,
4747
- /_AUTH/i
4747
+ /_AUTH/i,
4748
+ // #54-a — value-embedded-secret conventions (no generic `*_URL` — see keep-list test).
4749
+ /DSN/i,
4750
+ /WEBHOOK/i,
4751
+ /COOKIE/i,
4752
+ /CONNECTION[_-]?STRING/i,
4753
+ // Known DB / message-broker connection-string vars (carry `user:pass@`).
4754
+ /(?:^|[_-])(?:DATABASE|DB|REDIS|MONGO(?:DB)?|POSTGRES(?:QL)?|MYSQL|MARIADB|AMQP|RABBITMQ|CLICKHOUSE|ELASTIC(?:SEARCH)?|CASSANDRA|COUCHDB|MEMCACHED|NATS|KAFKA)[_-]?(?:URL|URI|DSN|CONNECTION)/i
4748
4755
  ];
4749
4756
  CORE_VARS = [
4750
4757
  "PATH",
@@ -6042,7 +6049,7 @@ async function buildSystemPromptContext(inputs, userText, memoryFacts, manager =
6042
6049
  memory: memoryFacts.map((fact) => ({ text: fact.text }))
6043
6050
  };
6044
6051
  }
6045
- async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
6052
+ async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
6046
6053
  const resolved = await resolveSendSkills(inputs, userText, memoryFacts);
6047
6054
  const baseCtx = await buildSystemPromptContext(inputs, userText, memoryFacts, resolved.manager);
6048
6055
  const assemblyCtx = {
@@ -6055,19 +6062,21 @@ async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFa
6055
6062
  assemblyCtx.activeMemorySummary = activeMemorySummary;
6056
6063
  }
6057
6064
  if (inputs.context !== void 0) {
6065
+ await inputs.context.applyScope(contextPaths);
6058
6066
  const internal = inputs.context.internalAssemblySnapshot();
6059
6067
  assemblyCtx.contextSnapshot = { sources: internal.sources };
6060
6068
  if (internal.maxTokens !== void 0) assemblyCtx.contextMaxTokens = internal.maxTokens;
6061
6069
  }
6062
6070
  return assemblyCtx;
6063
6071
  }
6064
- async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
6072
+ async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
6065
6073
  const ctx = await buildAssemblyContext(
6066
6074
  inputs,
6067
6075
  userText,
6068
6076
  baseSystemPrompt,
6069
6077
  memoryFacts,
6070
- activeMemorySummary
6078
+ activeMemorySummary,
6079
+ contextPaths
6071
6080
  );
6072
6081
  return inputs.systemPromptPipeline.assemble(ctx);
6073
6082
  }
@@ -6774,6 +6783,14 @@ var init_context_discovery = __esm({
6774
6783
  followImports: false,
6775
6784
  priority: 40
6776
6785
  },
6786
+ {
6787
+ id: "theokit-rules",
6788
+ pattern: ".theokit/rules/*.md",
6789
+ scope: "globbed",
6790
+ parser: "rules-frontmatter",
6791
+ followImports: false,
6792
+ priority: 45
6793
+ },
6777
6794
  {
6778
6795
  id: "theokit-context",
6779
6796
  pattern: ".theokit/context/*.md",
@@ -6857,32 +6874,27 @@ var init_context_import_resolver = __esm({
6857
6874
  MAX_HOPS = 5;
6858
6875
  }
6859
6876
  });
6860
- function parseMdc(content) {
6861
- const m = FRONTMATTER_RE.exec(content);
6862
- if (m === null) {
6863
- return { frontmatter: { alwaysApply: true }, body: content };
6864
- }
6865
- const yamlBody = m[1] ?? "";
6866
- const body = m[2] ?? "";
6867
- try {
6868
- const parsed = parseSimpleYaml2(yamlBody);
6869
- const validated = McdFrontmatterSchema.safeParse(parsed);
6870
- if (!validated.success) return void 0;
6871
- return { frontmatter: validated.data, body };
6872
- } catch {
6873
- return void 0;
6874
- }
6877
+
6878
+ // src/internal/runtime/context/context-glob.ts
6879
+ function globToRegex(glob) {
6880
+ const compiled = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*\//g, "::GLOBSTAR_SLASH::").replace(/\*\*/g, "::GLOBSTAR::").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(/::GLOBSTAR_SLASH::/g, "(?:.*/)?").replace(/::GLOBSTAR::/g, ".*");
6881
+ return new RegExp(`^${compiled}$`);
6875
6882
  }
6876
- function shouldActivate(fm, touchedFiles) {
6877
- if (fm.alwaysApply === true) return true;
6878
- if (fm.globs === void 0 || fm.globs.length === 0) return false;
6879
- if (touchedFiles.length === 0) return false;
6880
- const globRes = fm.globs.map(globToRegex);
6881
- return touchedFiles.some((file) => globRes.some((re) => re.test(file)));
6883
+ function anyGlobMatches(patterns, paths) {
6884
+ if (patterns.length === 0 || paths.length === 0) return false;
6885
+ const res = patterns.map(globToRegex);
6886
+ return paths.some((p) => res.some((re) => re.test(p)));
6882
6887
  }
6883
- function globToRegex(glob) {
6884
- const escaped = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "::DOUBLESTAR::").replace(/\*/g, "[^/]*").replace(/::DOUBLESTAR::/g, ".*").replace(/\?/g, ".");
6885
- return new RegExp(`^${escaped}$`);
6888
+ var init_context_glob = __esm({
6889
+ "src/internal/runtime/context/context-glob.ts"() {
6890
+ }
6891
+ });
6892
+
6893
+ // src/internal/runtime/context/context-yaml-lite.ts
6894
+ function splitFrontmatter3(content) {
6895
+ const m = FRONTMATTER_RE.exec(content);
6896
+ if (m === null) return { yaml: void 0, body: content };
6897
+ return { yaml: m[1] ?? "", body: m[2] ?? "" };
6886
6898
  }
6887
6899
  function parseSimpleYaml2(yaml) {
6888
6900
  const out = {};
@@ -6929,15 +6941,76 @@ function parseScalar(s) {
6929
6941
  if (/^-?\d+$/.test(s)) return parseInt(s, 10);
6930
6942
  return s.replace(/^["']|["']$/g, "");
6931
6943
  }
6932
- var McdFrontmatterSchema, FRONTMATTER_RE;
6944
+ var FRONTMATTER_RE;
6945
+ var init_context_yaml_lite = __esm({
6946
+ "src/internal/runtime/context/context-yaml-lite.ts"() {
6947
+ FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
6948
+ }
6949
+ });
6950
+ function parseMdc(content) {
6951
+ const { yaml, body } = splitFrontmatter3(content);
6952
+ if (yaml === void 0) {
6953
+ return { frontmatter: { alwaysApply: true }, body: content };
6954
+ }
6955
+ try {
6956
+ const parsed = parseSimpleYaml2(yaml);
6957
+ const validated = McdFrontmatterSchema.safeParse(parsed);
6958
+ if (!validated.success) return void 0;
6959
+ return { frontmatter: validated.data, body };
6960
+ } catch {
6961
+ return void 0;
6962
+ }
6963
+ }
6964
+ function shouldActivate(fm, touchedFiles) {
6965
+ if (fm.alwaysApply === true) return true;
6966
+ if (fm.globs === void 0 || fm.globs.length === 0) return false;
6967
+ return anyGlobMatches(fm.globs, touchedFiles);
6968
+ }
6969
+ var McdFrontmatterSchema;
6933
6970
  var init_context_mdc_parser = __esm({
6934
6971
  "src/internal/runtime/context/context-mdc-parser.ts"() {
6972
+ init_context_glob();
6973
+ init_context_yaml_lite();
6935
6974
  McdFrontmatterSchema = z.object({
6936
6975
  description: z.string().optional(),
6937
6976
  globs: z.array(z.string()).optional(),
6938
6977
  alwaysApply: z.boolean().optional()
6939
6978
  });
6940
- FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
6979
+ }
6980
+ });
6981
+ function parseRules(content) {
6982
+ const { yaml, body } = splitFrontmatter3(content);
6983
+ if (yaml === void 0) {
6984
+ return { frontmatter: { alwaysApply: true }, body: content };
6985
+ }
6986
+ try {
6987
+ const parsed = parseSimpleYaml2(yaml);
6988
+ const validated = RulesFrontmatterSchema.safeParse(parsed);
6989
+ if (!validated.success) return void 0;
6990
+ return { frontmatter: validated.data, body };
6991
+ } catch {
6992
+ return void 0;
6993
+ }
6994
+ }
6995
+ function shouldActivateRule(fm, inScopePaths) {
6996
+ if (fm.enabled === false) return false;
6997
+ if (fm.alwaysApply === true) return true;
6998
+ const patterns = [...fm.paths ?? [], ...fm.globs ?? []];
6999
+ if (patterns.length === 0) return false;
7000
+ return anyGlobMatches(patterns, inScopePaths);
7001
+ }
7002
+ var RulesFrontmatterSchema;
7003
+ var init_context_rules_frontmatter = __esm({
7004
+ "src/internal/runtime/context/context-rules-frontmatter.ts"() {
7005
+ init_context_glob();
7006
+ init_context_yaml_lite();
7007
+ RulesFrontmatterSchema = z.object({
7008
+ description: z.string().optional(),
7009
+ paths: z.array(z.string()).optional(),
7010
+ globs: z.array(z.string()).optional(),
7011
+ alwaysApply: z.boolean().optional(),
7012
+ enabled: z.boolean().optional()
7013
+ });
6941
7014
  }
6942
7015
  });
6943
7016
  async function runDiscovery(opts) {
@@ -6973,6 +7046,9 @@ async function loadOneSource(spec, path, opts, gitRoot) {
6973
7046
  if (spec.parser === "mdc") {
6974
7047
  return loadMdcSource(spec, path, id, opts);
6975
7048
  }
7049
+ if (spec.parser === "rules-frontmatter") {
7050
+ return loadRulesSource(spec, path, id, opts);
7051
+ }
6976
7052
  if (spec.parser === "frontmatter-zod") {
6977
7053
  return void 0;
6978
7054
  }
@@ -6996,6 +7072,24 @@ async function loadMdcSource(spec, path, id, opts) {
6996
7072
  truncated: false
6997
7073
  };
6998
7074
  }
7075
+ async function loadRulesSource(spec, path, id, opts) {
7076
+ let raw;
7077
+ try {
7078
+ raw = await readFile(path, "utf8");
7079
+ } catch {
7080
+ return void 0;
7081
+ }
7082
+ const parsed = parseRules(raw);
7083
+ if (parsed === void 0) return void 0;
7084
+ if (!shouldActivateRule(parsed.frontmatter, opts.touchedFiles ?? [])) return void 0;
7085
+ return {
7086
+ id,
7087
+ source: path,
7088
+ content: parsed.body,
7089
+ priority: spec.priority,
7090
+ truncated: false
7091
+ };
7092
+ }
6999
7093
  async function loadPlainMarkdownSource(spec, path, id, opts) {
7000
7094
  const loaded = await loadPlainMarkdown(path, { maxBytesPerFile: opts.maxBytesPerFile });
7001
7095
  if (loaded === void 0) return void 0;
@@ -7021,6 +7115,7 @@ var init_context_discovery_runner = __esm({
7021
7115
  init_context_import_resolver();
7022
7116
  init_context_loaders();
7023
7117
  init_context_mdc_parser();
7118
+ init_context_rules_frontmatter();
7024
7119
  }
7025
7120
  });
7026
7121
  var ContextSourceFrontmatterSchema;
@@ -7156,6 +7251,10 @@ function matchesGlob(pattern, path) {
7156
7251
  function tokenizeContent(content) {
7157
7252
  return content.split(/\s+/).filter((token) => token.length > 0);
7158
7253
  }
7254
+ function sameScope(a, b) {
7255
+ if (a.length !== b.length) return false;
7256
+ return a.every((v, i) => v === b[i]);
7257
+ }
7159
7258
  var FileContextManager;
7160
7259
  var init_context_manager = __esm({
7161
7260
  "src/internal/runtime/context/context-manager.ts"() {
@@ -7176,6 +7275,13 @@ var init_context_manager = __esm({
7176
7275
  settings;
7177
7276
  settingSourcesIncludeProject;
7178
7277
  state;
7278
+ /**
7279
+ * The in-scope file set used by the most recent `refresh`. Tracked so
7280
+ * `applyScope` only touches state when the scope actually changes — a
7281
+ * caller that never scopes (the common case) keeps the create-time
7282
+ * snapshot untouched, at zero per-send cost.
7283
+ */
7284
+ lastScope = [];
7179
7285
  async initialize() {
7180
7286
  if (!this.settingSourcesIncludeProject && this.settings.manager !== "file") {
7181
7287
  this.state = { config: { sources: [] }, loadedSources: [] };
@@ -7183,14 +7289,31 @@ var init_context_manager = __esm({
7183
7289
  }
7184
7290
  await this.refresh();
7185
7291
  }
7186
- async refresh() {
7292
+ /**
7293
+ * Re-run discovery for a specific per-send in-scope file set (T3). Path-scoped
7294
+ * rules (`.theokit/rules/*.md`, `.cursor/rules/*.mdc` globs) activate iff a
7295
+ * pattern matches one of `contextPaths`. Idempotent: unchanged scope is a
7296
+ * no-op, and `undefined` scope while never previously scoped never touches
7297
+ * state (preserves the create-time snapshot for non-users).
7298
+ */
7299
+ async applyScope(contextPaths) {
7300
+ const scope = contextPaths ?? [];
7301
+ if (scope.length === 0 && this.lastScope.length === 0) return;
7302
+ if (sameScope(scope, this.lastScope)) return;
7303
+ await this.refresh({ touchedFiles: scope });
7304
+ }
7305
+ async refresh(opts) {
7306
+ const touchedFiles = opts?.touchedFiles ?? [];
7307
+ this.lastScope = [...touchedFiles];
7187
7308
  const config = await loadContextConfig(this.cwd);
7188
7309
  const legacy = await loadSources(config, this.cwd);
7189
7310
  const maxBytesPerFile = this.settings.maxBytesPerFile ?? DEFAULT_MAX_BYTES_PER_FILE;
7190
7311
  const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
7191
7312
  const discovered = await runDiscovery({
7192
7313
  cwd: this.cwd,
7193
- maxBytesPerFile});
7314
+ maxBytesPerFile,
7315
+ touchedFiles
7316
+ });
7194
7317
  const legacyAsAggregator = legacy.map((src) => ({
7195
7318
  id: src.name,
7196
7319
  source: src.path,
@@ -7625,15 +7748,19 @@ async function collectChildToolResults(run) {
7625
7748
  ${lines.join("\n")}
7626
7749
  </subagent-tool-results>`;
7627
7750
  }
7628
- async function runChildAgent(spec, input, signal, maxSteps, inherited) {
7629
- const { Agent: Agent2 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
7751
+ function buildChildCreateOptions(spec, inherited) {
7630
7752
  const model = spec.model ? { id: spec.model } : inherited?.model;
7631
- const agent = await Agent2.create({
7753
+ return {
7632
7754
  ...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
7633
7755
  ...model !== void 0 ? { model } : {},
7756
+ ...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
7634
7757
  systemPrompt: spec.instructions,
7635
7758
  tools: spec.tools ?? []
7636
- });
7759
+ };
7760
+ }
7761
+ async function runChildAgent(spec, input, signal, maxSteps, inherited) {
7762
+ const { Agent: Agent2 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
7763
+ const agent = await Agent2.create(buildChildCreateOptions(spec, inherited));
7637
7764
  try {
7638
7765
  const sendOptions = {
7639
7766
  ...signal !== void 0 ? { signal } : {},
@@ -9536,7 +9663,10 @@ async function runAgentLoop(inputs) {
9536
9663
  }
9537
9664
  budget.consume();
9538
9665
  inputs.budgetTracker?.nextIteration?.();
9539
- if (inputs.signal?.aborted === true) break;
9666
+ if (inputs.signal?.aborted === true) {
9667
+ ctx.finalStatus = "cancelled";
9668
+ break;
9669
+ }
9540
9670
  }
9541
9671
  if (lastTurnDecision === "continue" && budget.shouldContinue() === false) {
9542
9672
  ctx.stoppedAtIterationLimit = true;
@@ -9721,15 +9851,15 @@ async function guardAndTransformToolResults(inputs, raw, ctx) {
9721
9851
  }
9722
9852
  async function continueOrTerminate(inputs, ctx, llmOutput) {
9723
9853
  if (llmOutput.errored) return "error";
9724
- if (llmOutput.text.length > 0) {
9725
- await emitAssistantTextStep(inputs, ctx, llmOutput.text);
9854
+ const tCtx = { agentId: inputs.agentId, runId: inputs.runId };
9855
+ const text = llmOutput.text.length > 0 ? await transformLlmOutputText(inputs, llmOutput.text, tCtx) : llmOutput.text;
9856
+ if (text.length > 0) {
9857
+ await emitAssistantTextStep(inputs, ctx, text);
9726
9858
  }
9727
9859
  if (llmOutput.stopReason !== "tool_use" || llmOutput.toolCalls.length === 0) {
9728
9860
  return finishOrReflect(inputs, ctx, llmOutput);
9729
9861
  }
9730
- const tCtx = { agentId: inputs.agentId, runId: inputs.runId };
9731
- const outText = await transformLlmOutputText(inputs, llmOutput.text, tCtx);
9732
- ctx.messages.push(buildAssistantTurn(outText, llmOutput.toolCalls));
9862
+ ctx.messages.push(buildAssistantTurn(text, llmOutput.toolCalls));
9733
9863
  const rawResults = await dispatchTools(
9734
9864
  // SE12 — forward a read-only text projection of the transcript-so-far to tool
9735
9865
  // handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
@@ -13053,7 +13183,12 @@ var init_client = __esm({
13053
13183
  code: "mcp_http_error"
13054
13184
  });
13055
13185
  }
13056
- return await response.json();
13186
+ try {
13187
+ return await response.json();
13188
+ } catch (cause) {
13189
+ if (isAbortLike(cause)) throw mcpTimeoutError(this.name, timeoutMs);
13190
+ throw cause;
13191
+ }
13057
13192
  }
13058
13193
  };
13059
13194
  }
@@ -13293,9 +13428,11 @@ function declarativeSubagentTools(agentOptions, parentTools) {
13293
13428
  return subAgentToolsFromDefinitions(agents2, parentTools);
13294
13429
  }
13295
13430
  function bindParentCredentials(tools, agentOptions) {
13431
+ const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
13296
13432
  const credentials = {
13297
13433
  ...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
13298
- ...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {}
13434
+ ...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
13435
+ ...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
13299
13436
  };
13300
13437
  for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
13301
13438
  }
@@ -15820,10 +15957,11 @@ var init_local_agent_memory = __esm({
15820
15957
  }
15821
15958
  buildTelemetryRecallArgs(telemetry) {
15822
15959
  const userId = typeof this.options.memoryContext?.userId === "string" ? this.options.memoryContext.userId : void 0;
15960
+ const tenantId = typeof this.options.memoryContext?.tenantId === "string" ? this.options.memoryContext.tenantId : void 0;
15823
15961
  return {
15824
15962
  ...telemetry !== void 0 ? { telemetry } : {},
15825
15963
  ...userId !== void 0 ? { userId } : {},
15826
- namespace: "default",
15964
+ namespace: tenantId ?? "default",
15827
15965
  scope: "session"
15828
15966
  };
15829
15967
  }
@@ -17120,7 +17258,8 @@ async function executeSendLocked(inputs, message, options) {
17120
17258
  userText,
17121
17259
  baseSystemPrompt,
17122
17260
  memoryFacts,
17123
- activeMemorySummary
17261
+ activeMemorySummary,
17262
+ options.contextPaths
17124
17263
  );
17125
17264
  const projectedSystemPrompt = await projectCurrentObjective(
17126
17265
  inputs.storageHandle,
@@ -18008,7 +18147,7 @@ var init_local_agent = __esm({
18008
18147
  runPreHook: (ut) => this.runPreHook(ut),
18009
18148
  // biome-ignore format: G8 budget — callbacks wire to private methods.
18010
18149
  resolveSystemPromptForSend: (ut, o, mf) => this.resolveSystemPrompt(ut, o, mf),
18011
- assembleSystemPromptForSend: (ut, bp, mf, ams) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams),
18150
+ assembleSystemPromptForSend: (ut, bp, mf, ams, cp) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams, cp),
18012
18151
  dispatchRun: (msg, o, sp, mf, pm, mt, mp) => this.dispatchRun(msg, o, sp, mf, pm, mt, mp)
18013
18152
  },
18014
18153
  message,