@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/eval.js CHANGED
@@ -959,10 +959,10 @@ function buildToolPrompt(prompt) {
959
959
  Respond by calling the \`output\` tool with the structured answer that matches the schema.`;
960
960
  }
961
961
  function setupStructuredOutput(schema, maxRetries) {
962
- const z8 = requireZod();
962
+ const z9 = requireZod();
963
963
  const jsonSchema = toJsonSchema(schema, { unrepresentable: "any" });
964
964
  return {
965
- z: z8,
965
+ z: z9,
966
966
  jsonSchema,
967
967
  maxRetries: maxRetries ?? 1,
968
968
  initialUsage: { inputTokens: 0, outputTokens: 0 }
@@ -4740,7 +4740,14 @@ var init_env_policy = __esm({
4740
4740
  /[_-]PWD/i,
4741
4741
  /CREDENTIAL/i,
4742
4742
  /PRIVATE/i,
4743
- /_AUTH/i
4743
+ /_AUTH/i,
4744
+ // #54-a — value-embedded-secret conventions (no generic `*_URL` — see keep-list test).
4745
+ /DSN/i,
4746
+ /WEBHOOK/i,
4747
+ /COOKIE/i,
4748
+ /CONNECTION[_-]?STRING/i,
4749
+ // Known DB / message-broker connection-string vars (carry `user:pass@`).
4750
+ /(?:^|[_-])(?:DATABASE|DB|REDIS|MONGO(?:DB)?|POSTGRES(?:QL)?|MYSQL|MARIADB|AMQP|RABBITMQ|CLICKHOUSE|ELASTIC(?:SEARCH)?|CASSANDRA|COUCHDB|MEMCACHED|NATS|KAFKA)[_-]?(?:URL|URI|DSN|CONNECTION)/i
4744
4751
  ];
4745
4752
  CORE_VARS = [
4746
4753
  "PATH",
@@ -6038,7 +6045,7 @@ async function buildSystemPromptContext(inputs, userText, memoryFacts, manager =
6038
6045
  memory: memoryFacts.map((fact) => ({ text: fact.text }))
6039
6046
  };
6040
6047
  }
6041
- async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
6048
+ async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
6042
6049
  const resolved = await resolveSendSkills(inputs, userText, memoryFacts);
6043
6050
  const baseCtx = await buildSystemPromptContext(inputs, userText, memoryFacts, resolved.manager);
6044
6051
  const assemblyCtx = {
@@ -6051,19 +6058,21 @@ async function buildAssemblyContext(inputs, userText, baseSystemPrompt, memoryFa
6051
6058
  assemblyCtx.activeMemorySummary = activeMemorySummary;
6052
6059
  }
6053
6060
  if (inputs.context !== void 0) {
6061
+ await inputs.context.applyScope(contextPaths);
6054
6062
  const internal = inputs.context.internalAssemblySnapshot();
6055
6063
  assemblyCtx.contextSnapshot = { sources: internal.sources };
6056
6064
  if (internal.maxTokens !== void 0) assemblyCtx.contextMaxTokens = internal.maxTokens;
6057
6065
  }
6058
6066
  return assemblyCtx;
6059
6067
  }
6060
- async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary) {
6068
+ async function assembleSystemPromptForSend(inputs, userText, baseSystemPrompt, memoryFacts, activeMemorySummary, contextPaths) {
6061
6069
  const ctx = await buildAssemblyContext(
6062
6070
  inputs,
6063
6071
  userText,
6064
6072
  baseSystemPrompt,
6065
6073
  memoryFacts,
6066
- activeMemorySummary
6074
+ activeMemorySummary,
6075
+ contextPaths
6067
6076
  );
6068
6077
  return inputs.systemPromptPipeline.assemble(ctx);
6069
6078
  }
@@ -6770,6 +6779,14 @@ var init_context_discovery = __esm({
6770
6779
  followImports: false,
6771
6780
  priority: 40
6772
6781
  },
6782
+ {
6783
+ id: "theokit-rules",
6784
+ pattern: ".theokit/rules/*.md",
6785
+ scope: "globbed",
6786
+ parser: "rules-frontmatter",
6787
+ followImports: false,
6788
+ priority: 45
6789
+ },
6773
6790
  {
6774
6791
  id: "theokit-context",
6775
6792
  pattern: ".theokit/context/*.md",
@@ -6853,32 +6870,27 @@ var init_context_import_resolver = __esm({
6853
6870
  MAX_HOPS = 5;
6854
6871
  }
6855
6872
  });
6856
- function parseMdc(content) {
6857
- const m = FRONTMATTER_RE.exec(content);
6858
- if (m === null) {
6859
- return { frontmatter: { alwaysApply: true }, body: content };
6860
- }
6861
- const yamlBody = m[1] ?? "";
6862
- const body = m[2] ?? "";
6863
- try {
6864
- const parsed = parseSimpleYaml2(yamlBody);
6865
- const validated = McdFrontmatterSchema.safeParse(parsed);
6866
- if (!validated.success) return void 0;
6867
- return { frontmatter: validated.data, body };
6868
- } catch {
6869
- return void 0;
6870
- }
6873
+
6874
+ // src/internal/runtime/context/context-glob.ts
6875
+ function globToRegex(glob) {
6876
+ const compiled = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*\//g, "::GLOBSTAR_SLASH::").replace(/\*\*/g, "::GLOBSTAR::").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(/::GLOBSTAR_SLASH::/g, "(?:.*/)?").replace(/::GLOBSTAR::/g, ".*");
6877
+ return new RegExp(`^${compiled}$`);
6871
6878
  }
6872
- function shouldActivate(fm, touchedFiles) {
6873
- if (fm.alwaysApply === true) return true;
6874
- if (fm.globs === void 0 || fm.globs.length === 0) return false;
6875
- if (touchedFiles.length === 0) return false;
6876
- const globRes = fm.globs.map(globToRegex);
6877
- return touchedFiles.some((file) => globRes.some((re) => re.test(file)));
6879
+ function anyGlobMatches(patterns, paths) {
6880
+ if (patterns.length === 0 || paths.length === 0) return false;
6881
+ const res = patterns.map(globToRegex);
6882
+ return paths.some((p) => res.some((re) => re.test(p)));
6878
6883
  }
6879
- function globToRegex(glob) {
6880
- const escaped = glob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "::DOUBLESTAR::").replace(/\*/g, "[^/]*").replace(/::DOUBLESTAR::/g, ".*").replace(/\?/g, ".");
6881
- return new RegExp(`^${escaped}$`);
6884
+ var init_context_glob = __esm({
6885
+ "src/internal/runtime/context/context-glob.ts"() {
6886
+ }
6887
+ });
6888
+
6889
+ // src/internal/runtime/context/context-yaml-lite.ts
6890
+ function splitFrontmatter3(content) {
6891
+ const m = FRONTMATTER_RE.exec(content);
6892
+ if (m === null) return { yaml: void 0, body: content };
6893
+ return { yaml: m[1] ?? "", body: m[2] ?? "" };
6882
6894
  }
6883
6895
  function parseSimpleYaml2(yaml) {
6884
6896
  const out = {};
@@ -6925,15 +6937,76 @@ function parseScalar(s) {
6925
6937
  if (/^-?\d+$/.test(s)) return parseInt(s, 10);
6926
6938
  return s.replace(/^["']|["']$/g, "");
6927
6939
  }
6928
- var McdFrontmatterSchema, FRONTMATTER_RE;
6940
+ var FRONTMATTER_RE;
6941
+ var init_context_yaml_lite = __esm({
6942
+ "src/internal/runtime/context/context-yaml-lite.ts"() {
6943
+ FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
6944
+ }
6945
+ });
6946
+ function parseMdc(content) {
6947
+ const { yaml, body } = splitFrontmatter3(content);
6948
+ if (yaml === void 0) {
6949
+ return { frontmatter: { alwaysApply: true }, body: content };
6950
+ }
6951
+ try {
6952
+ const parsed = parseSimpleYaml2(yaml);
6953
+ const validated = McdFrontmatterSchema.safeParse(parsed);
6954
+ if (!validated.success) return void 0;
6955
+ return { frontmatter: validated.data, body };
6956
+ } catch {
6957
+ return void 0;
6958
+ }
6959
+ }
6960
+ function shouldActivate(fm, touchedFiles) {
6961
+ if (fm.alwaysApply === true) return true;
6962
+ if (fm.globs === void 0 || fm.globs.length === 0) return false;
6963
+ return anyGlobMatches(fm.globs, touchedFiles);
6964
+ }
6965
+ var McdFrontmatterSchema;
6929
6966
  var init_context_mdc_parser = __esm({
6930
6967
  "src/internal/runtime/context/context-mdc-parser.ts"() {
6968
+ init_context_glob();
6969
+ init_context_yaml_lite();
6931
6970
  McdFrontmatterSchema = z.object({
6932
6971
  description: z.string().optional(),
6933
6972
  globs: z.array(z.string()).optional(),
6934
6973
  alwaysApply: z.boolean().optional()
6935
6974
  });
6936
- FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;
6975
+ }
6976
+ });
6977
+ function parseRules(content) {
6978
+ const { yaml, body } = splitFrontmatter3(content);
6979
+ if (yaml === void 0) {
6980
+ return { frontmatter: { alwaysApply: true }, body: content };
6981
+ }
6982
+ try {
6983
+ const parsed = parseSimpleYaml2(yaml);
6984
+ const validated = RulesFrontmatterSchema.safeParse(parsed);
6985
+ if (!validated.success) return void 0;
6986
+ return { frontmatter: validated.data, body };
6987
+ } catch {
6988
+ return void 0;
6989
+ }
6990
+ }
6991
+ function shouldActivateRule(fm, inScopePaths) {
6992
+ if (fm.enabled === false) return false;
6993
+ if (fm.alwaysApply === true) return true;
6994
+ const patterns = [...fm.paths ?? [], ...fm.globs ?? []];
6995
+ if (patterns.length === 0) return false;
6996
+ return anyGlobMatches(patterns, inScopePaths);
6997
+ }
6998
+ var RulesFrontmatterSchema;
6999
+ var init_context_rules_frontmatter = __esm({
7000
+ "src/internal/runtime/context/context-rules-frontmatter.ts"() {
7001
+ init_context_glob();
7002
+ init_context_yaml_lite();
7003
+ RulesFrontmatterSchema = z.object({
7004
+ description: z.string().optional(),
7005
+ paths: z.array(z.string()).optional(),
7006
+ globs: z.array(z.string()).optional(),
7007
+ alwaysApply: z.boolean().optional(),
7008
+ enabled: z.boolean().optional()
7009
+ });
6937
7010
  }
6938
7011
  });
6939
7012
  async function runDiscovery(opts) {
@@ -6969,6 +7042,9 @@ async function loadOneSource(spec, path, opts, gitRoot) {
6969
7042
  if (spec.parser === "mdc") {
6970
7043
  return loadMdcSource(spec, path, id, opts);
6971
7044
  }
7045
+ if (spec.parser === "rules-frontmatter") {
7046
+ return loadRulesSource(spec, path, id, opts);
7047
+ }
6972
7048
  if (spec.parser === "frontmatter-zod") {
6973
7049
  return void 0;
6974
7050
  }
@@ -6992,6 +7068,24 @@ async function loadMdcSource(spec, path, id, opts) {
6992
7068
  truncated: false
6993
7069
  };
6994
7070
  }
7071
+ async function loadRulesSource(spec, path, id, opts) {
7072
+ let raw;
7073
+ try {
7074
+ raw = await readFile(path, "utf8");
7075
+ } catch {
7076
+ return void 0;
7077
+ }
7078
+ const parsed = parseRules(raw);
7079
+ if (parsed === void 0) return void 0;
7080
+ if (!shouldActivateRule(parsed.frontmatter, opts.touchedFiles ?? [])) return void 0;
7081
+ return {
7082
+ id,
7083
+ source: path,
7084
+ content: parsed.body,
7085
+ priority: spec.priority,
7086
+ truncated: false
7087
+ };
7088
+ }
6995
7089
  async function loadPlainMarkdownSource(spec, path, id, opts) {
6996
7090
  const loaded = await loadPlainMarkdown(path, { maxBytesPerFile: opts.maxBytesPerFile });
6997
7091
  if (loaded === void 0) return void 0;
@@ -7017,6 +7111,7 @@ var init_context_discovery_runner = __esm({
7017
7111
  init_context_import_resolver();
7018
7112
  init_context_loaders();
7019
7113
  init_context_mdc_parser();
7114
+ init_context_rules_frontmatter();
7020
7115
  }
7021
7116
  });
7022
7117
  var ContextSourceFrontmatterSchema;
@@ -7152,6 +7247,10 @@ function matchesGlob(pattern, path) {
7152
7247
  function tokenizeContent(content) {
7153
7248
  return content.split(/\s+/).filter((token) => token.length > 0);
7154
7249
  }
7250
+ function sameScope(a, b) {
7251
+ if (a.length !== b.length) return false;
7252
+ return a.every((v, i) => v === b[i]);
7253
+ }
7155
7254
  var FileContextManager;
7156
7255
  var init_context_manager = __esm({
7157
7256
  "src/internal/runtime/context/context-manager.ts"() {
@@ -7172,6 +7271,13 @@ var init_context_manager = __esm({
7172
7271
  settings;
7173
7272
  settingSourcesIncludeProject;
7174
7273
  state;
7274
+ /**
7275
+ * The in-scope file set used by the most recent `refresh`. Tracked so
7276
+ * `applyScope` only touches state when the scope actually changes — a
7277
+ * caller that never scopes (the common case) keeps the create-time
7278
+ * snapshot untouched, at zero per-send cost.
7279
+ */
7280
+ lastScope = [];
7175
7281
  async initialize() {
7176
7282
  if (!this.settingSourcesIncludeProject && this.settings.manager !== "file") {
7177
7283
  this.state = { config: { sources: [] }, loadedSources: [] };
@@ -7179,14 +7285,31 @@ var init_context_manager = __esm({
7179
7285
  }
7180
7286
  await this.refresh();
7181
7287
  }
7182
- async refresh() {
7288
+ /**
7289
+ * Re-run discovery for a specific per-send in-scope file set (T3). Path-scoped
7290
+ * rules (`.theokit/rules/*.md`, `.cursor/rules/*.mdc` globs) activate iff a
7291
+ * pattern matches one of `contextPaths`. Idempotent: unchanged scope is a
7292
+ * no-op, and `undefined` scope while never previously scoped never touches
7293
+ * state (preserves the create-time snapshot for non-users).
7294
+ */
7295
+ async applyScope(contextPaths) {
7296
+ const scope = contextPaths ?? [];
7297
+ if (scope.length === 0 && this.lastScope.length === 0) return;
7298
+ if (sameScope(scope, this.lastScope)) return;
7299
+ await this.refresh({ touchedFiles: scope });
7300
+ }
7301
+ async refresh(opts) {
7302
+ const touchedFiles = opts?.touchedFiles ?? [];
7303
+ this.lastScope = [...touchedFiles];
7183
7304
  const config = await loadContextConfig(this.cwd);
7184
7305
  const legacy = await loadSources(config, this.cwd);
7185
7306
  const maxBytesPerFile = this.settings.maxBytesPerFile ?? DEFAULT_MAX_BYTES_PER_FILE;
7186
7307
  const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
7187
7308
  const discovered = await runDiscovery({
7188
7309
  cwd: this.cwd,
7189
- maxBytesPerFile});
7310
+ maxBytesPerFile,
7311
+ touchedFiles
7312
+ });
7190
7313
  const legacyAsAggregator = legacy.map((src) => ({
7191
7314
  id: src.name,
7192
7315
  source: src.path,
@@ -7621,15 +7744,19 @@ async function collectChildToolResults(run) {
7621
7744
  ${lines.join("\n")}
7622
7745
  </subagent-tool-results>`;
7623
7746
  }
7624
- async function runChildAgent(spec, input, signal, maxSteps, inherited) {
7625
- const { Agent: Agent2 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
7747
+ function buildChildCreateOptions(spec, inherited) {
7626
7748
  const model = spec.model ? { id: spec.model } : inherited?.model;
7627
- const agent = await Agent2.create({
7749
+ return {
7628
7750
  ...inherited?.apiKey !== void 0 ? { apiKey: inherited.apiKey } : {},
7629
7751
  ...model !== void 0 ? { model } : {},
7752
+ ...inherited?.plugins !== void 0 ? { plugins: inherited.plugins } : {},
7630
7753
  systemPrompt: spec.instructions,
7631
7754
  tools: spec.tools ?? []
7632
- });
7755
+ };
7756
+ }
7757
+ async function runChildAgent(spec, input, signal, maxSteps, inherited) {
7758
+ const { Agent: Agent2 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
7759
+ const agent = await Agent2.create(buildChildCreateOptions(spec, inherited));
7633
7760
  try {
7634
7761
  const sendOptions = {
7635
7762
  ...signal !== void 0 ? { signal } : {},
@@ -9532,7 +9659,10 @@ async function runAgentLoop(inputs) {
9532
9659
  }
9533
9660
  budget.consume();
9534
9661
  inputs.budgetTracker?.nextIteration?.();
9535
- if (inputs.signal?.aborted === true) break;
9662
+ if (inputs.signal?.aborted === true) {
9663
+ ctx.finalStatus = "cancelled";
9664
+ break;
9665
+ }
9536
9666
  }
9537
9667
  if (lastTurnDecision === "continue" && budget.shouldContinue() === false) {
9538
9668
  ctx.stoppedAtIterationLimit = true;
@@ -9717,15 +9847,15 @@ async function guardAndTransformToolResults(inputs, raw, ctx) {
9717
9847
  }
9718
9848
  async function continueOrTerminate(inputs, ctx, llmOutput) {
9719
9849
  if (llmOutput.errored) return "error";
9720
- if (llmOutput.text.length > 0) {
9721
- await emitAssistantTextStep(inputs, ctx, llmOutput.text);
9850
+ const tCtx = { agentId: inputs.agentId, runId: inputs.runId };
9851
+ const text = llmOutput.text.length > 0 ? await transformLlmOutputText(inputs, llmOutput.text, tCtx) : llmOutput.text;
9852
+ if (text.length > 0) {
9853
+ await emitAssistantTextStep(inputs, ctx, text);
9722
9854
  }
9723
9855
  if (llmOutput.stopReason !== "tool_use" || llmOutput.toolCalls.length === 0) {
9724
9856
  return finishOrReflect(inputs, ctx, llmOutput);
9725
9857
  }
9726
- const tCtx = { agentId: inputs.agentId, runId: inputs.runId };
9727
- const outText = await transformLlmOutputText(inputs, llmOutput.text, tCtx);
9728
- ctx.messages.push(buildAssistantTurn(outText, llmOutput.toolCalls));
9858
+ ctx.messages.push(buildAssistantTurn(text, llmOutput.toolCalls));
9729
9859
  const rawResults = await dispatchTools(
9730
9860
  // SE12 — forward a read-only text projection of the transcript-so-far to tool
9731
9861
  // handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
@@ -13049,7 +13179,12 @@ var init_client = __esm({
13049
13179
  code: "mcp_http_error"
13050
13180
  });
13051
13181
  }
13052
- return await response.json();
13182
+ try {
13183
+ return await response.json();
13184
+ } catch (cause) {
13185
+ if (isAbortLike(cause)) throw mcpTimeoutError(this.name, timeoutMs);
13186
+ throw cause;
13187
+ }
13053
13188
  }
13054
13189
  };
13055
13190
  }
@@ -13289,9 +13424,11 @@ function declarativeSubagentTools(agentOptions, parentTools) {
13289
13424
  return subAgentToolsFromDefinitions(agents2, parentTools);
13290
13425
  }
13291
13426
  function bindParentCredentials(tools, agentOptions) {
13427
+ const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
13292
13428
  const credentials = {
13293
13429
  ...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
13294
- ...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {}
13430
+ ...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
13431
+ ...parentPlugins !== void 0 ? { plugins: parentPlugins } : {}
13295
13432
  };
13296
13433
  for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
13297
13434
  }
@@ -15816,10 +15953,11 @@ var init_local_agent_memory = __esm({
15816
15953
  }
15817
15954
  buildTelemetryRecallArgs(telemetry) {
15818
15955
  const userId = typeof this.options.memoryContext?.userId === "string" ? this.options.memoryContext.userId : void 0;
15956
+ const tenantId = typeof this.options.memoryContext?.tenantId === "string" ? this.options.memoryContext.tenantId : void 0;
15819
15957
  return {
15820
15958
  ...telemetry !== void 0 ? { telemetry } : {},
15821
15959
  ...userId !== void 0 ? { userId } : {},
15822
- namespace: "default",
15960
+ namespace: tenantId ?? "default",
15823
15961
  scope: "session"
15824
15962
  };
15825
15963
  }
@@ -17116,7 +17254,8 @@ async function executeSendLocked(inputs, message, options) {
17116
17254
  userText,
17117
17255
  baseSystemPrompt,
17118
17256
  memoryFacts,
17119
- activeMemorySummary
17257
+ activeMemorySummary,
17258
+ options.contextPaths
17120
17259
  );
17121
17260
  const projectedSystemPrompt = await projectCurrentObjective(
17122
17261
  inputs.storageHandle,
@@ -18004,7 +18143,7 @@ var init_local_agent = __esm({
18004
18143
  runPreHook: (ut) => this.runPreHook(ut),
18005
18144
  // biome-ignore format: G8 budget — callbacks wire to private methods.
18006
18145
  resolveSystemPromptForSend: (ut, o, mf) => this.resolveSystemPrompt(ut, o, mf),
18007
- assembleSystemPromptForSend: (ut, bp, mf, ams) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams),
18146
+ assembleSystemPromptForSend: (ut, bp, mf, ams, cp) => assembleSystemPromptForSend(this.assemblyInputs(), ut, bp, mf, ams, cp),
18008
18147
  dispatchRun: (msg, o, sp, mf, pm, mt, mp) => this.dispatchRun(msg, o, sp, mf, pm, mt, mp)
18009
18148
  },
18010
18149
  message,
@@ -19704,14 +19843,6 @@ async function llmJudgeScore(options) {
19704
19843
  init_env_policy();
19705
19844
 
19706
19845
  // src/sandbox/types.ts
19707
- var SandboxSecurityError = class extends Error {
19708
- code = "sandbox_security";
19709
- constructor(message) {
19710
- super(message);
19711
- this.name = "SandboxSecurityError";
19712
- }
19713
- };
19714
- var SHELL_METACHARACTERS = /[;&|`$(){}]/;
19715
19846
  var SandboxBackend = class {
19716
19847
  config;
19717
19848
  constructor(config = {}) {
@@ -19754,13 +19885,6 @@ var SandboxBackend = class {
19754
19885
  if (result.exitCode !== 0) return [];
19755
19886
  return result.stdout.trim().split("\n").filter(Boolean);
19756
19887
  }
19757
- validateCommand(command) {
19758
- if (SHELL_METACHARACTERS.test(command)) {
19759
- throw new SandboxSecurityError(
19760
- `Command contains shell metacharacters: ${command.slice(0, 80)}`
19761
- );
19762
- }
19763
- }
19764
19888
  truncateOutput(output) {
19765
19889
  const max = this.config.maxOutputBytes ?? 5 * 1024 * 1024;
19766
19890
  if (Buffer.byteLength(output) > max) {