@theokit/sdk 5.4.0 → 5.5.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 (46) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/{agent-Bmy2G_ml.d.ts → agent-CjMVbhhY.d.ts} +22 -0
  3. package/dist/{agent-C1Efo7PI.d.cts → agent-DyB_lzrx.d.cts} +22 -0
  4. package/dist/{agent-MNINE73R.js → agent-G3T7Q3SQ.js} +4 -4
  5. package/dist/{agent-MNINE73R.js.map → agent-G3T7Q3SQ.js.map} +1 -1
  6. package/dist/{agent-AUVD4TI4.cjs → agent-YWSIHHFM.cjs} +5 -5
  7. package/dist/{agent-AUVD4TI4.cjs.map → agent-YWSIHHFM.cjs.map} +1 -1
  8. package/dist/{chunk-J6KZE2ZQ.cjs → chunk-2ZLQZHZC.cjs} +4 -4
  9. package/dist/{chunk-J6KZE2ZQ.cjs.map → chunk-2ZLQZHZC.cjs.map} +1 -1
  10. package/dist/{chunk-KWGSBZ2Q.js → chunk-M3ZGRGOG.js} +3 -3
  11. package/dist/{chunk-KWGSBZ2Q.js.map → chunk-M3ZGRGOG.js.map} +1 -1
  12. package/dist/{chunk-IKBLU7ZS.js → chunk-ODBID5TG.js} +11 -6
  13. package/dist/chunk-ODBID5TG.js.map +1 -0
  14. package/dist/{chunk-XD3FS5OI.js → chunk-S6B5XYC3.js} +3 -3
  15. package/dist/chunk-S6B5XYC3.js.map +1 -0
  16. package/dist/{chunk-UALC6Q3J.cjs → chunk-UKJJRU7C.cjs} +28 -23
  17. package/dist/chunk-UKJJRU7C.cjs.map +1 -0
  18. package/dist/{chunk-3FDU5JFE.cjs → chunk-VY6NKMOA.cjs} +3 -3
  19. package/dist/chunk-VY6NKMOA.cjs.map +1 -0
  20. package/dist/{context-EGM6CHXD.js → context-3HPU754C.js} +3 -3
  21. package/dist/{context-EGM6CHXD.js.map → context-3HPU754C.js.map} +1 -1
  22. package/dist/{context-4AIK26QB.cjs → context-JTGSBJT6.cjs} +6 -6
  23. package/dist/{context-4AIK26QB.cjs.map → context-JTGSBJT6.cjs.map} +1 -1
  24. package/dist/{cron-DSMdlhyF.d.cts → cron-Bgivg88c.d.cts} +1 -1
  25. package/dist/{cron-Dcdrdv_T.d.ts → cron-CNUa7PDo.d.ts} +1 -1
  26. package/dist/cron.cjs +4 -4
  27. package/dist/cron.d.cts +2 -2
  28. package/dist/cron.d.ts +2 -2
  29. package/dist/cron.js +3 -3
  30. package/dist/eval.cjs +3 -3
  31. package/dist/eval.js +2 -2
  32. package/dist/index.cjs +19 -19
  33. package/dist/index.d.cts +3 -3
  34. package/dist/index.d.ts +3 -3
  35. package/dist/index.js +5 -5
  36. package/dist/internal/runtime/hooks/hooks-executor.d.ts +10 -0
  37. package/dist/internal/runtime/hooks/hooks-source.d.ts +10 -0
  38. package/dist/subagents-loader.d.cts +1 -1
  39. package/dist/subagents-loader.d.ts +1 -1
  40. package/dist/types/hooks.d.ts +22 -0
  41. package/docs/error-codes.md +4 -4
  42. package/package.json +1 -1
  43. package/dist/chunk-3FDU5JFE.cjs.map +0 -1
  44. package/dist/chunk-IKBLU7ZS.js.map +0 -1
  45. package/dist/chunk-UALC6Q3J.cjs.map +0 -1
  46. package/dist/chunk-XD3FS5OI.js.map +0 -1
@@ -142,7 +142,7 @@ function parseClaudeCodeCommand(raw, matcher, path, ccEvent) {
142
142
  code: "hooks_invalid_command"
143
143
  });
144
144
  }
145
- const hc = { command: cmd.command };
145
+ const hc = { command: cmd.command, sourceEvent: ccEvent };
146
146
  if (matcher !== void 0) hc.matcher = matcher;
147
147
  if (typeof cmd.timeout === "number" && cmd.timeout > 0) {
148
148
  hc.timeoutMs = Math.round(cmd.timeout * 1e3);
@@ -170,5 +170,5 @@ exports.loadHookConfig = loadHookConfig;
170
170
  exports.warnOnce = warnOnce;
171
171
  exports.warnPersonalitySwitchInsideFork = warnPersonalitySwitchInsideFork;
172
172
  exports.withPersonalityContext = withPersonalityContext;
173
- //# sourceMappingURL=chunk-3FDU5JFE.cjs.map
174
- //# sourceMappingURL=chunk-3FDU5JFE.cjs.map
173
+ //# sourceMappingURL=chunk-VY6NKMOA.cjs.map
174
+ //# sourceMappingURL=chunk-VY6NKMOA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internal/runtime/hooks/hooks-source.ts","../src/internal/personality/context.ts"],"names":["diag","existsSync","join","theokitConfigRoot","projectConfigRoots","readFile","ConfigurationError","AsyncLocalStorage"],"mappings":";;;;;;;;;;AAkCA,IAAM,qBAAA,GAA6D;AAAA,EACjE,UAAA,EAAY,YAAA;AAAA,EACZ,WAAA,EAAa,aAAA;AAAA,EACb,gBAAA,EAAkB,QAAA;AAAA,EAClB,IAAA,EAAM;AACR,CAAA;AA+BA,IAAM,MAAA,uBAAa,GAAA,EAAY;AAYxB,SAAS,QAAA,CAAS,KAAa,OAAA,EAAuB;AAC3D,EAAA,IAAI,MAAA,CAAO,GAAA,CAAI,GAAG,CAAA,EAAG;AACrB,EAAA,MAAA,CAAO,IAAI,GAAG,CAAA;AACd,EAAAA,sBAAA,CAAK,GAAG,OAAO;AAAA,CAAI,CAAA;AACrB;AAcA,eAAsB,cAAA,CACpB,GAAA,EACA,aAAA,GAAoD,EAAC,EAChC;AACrB,EAAA,MAAM,SAAqB,EAAC;AAC5B,EAAA,IAAI,MAAA,GAAS,KAAA;AACb,EAAA,KAAA,MAAW,IAAA,IAAQ,oBAAA,CAAqB,GAAA,EAAK,aAAa,CAAA,EAAG;AAC3D,IAAA,IAAI,CAACC,aAAA,CAAW,IAAI,CAAA,EAAG;AACvB,IAAA,MAAA,GAAS,IAAA;AAIT,IAAA,SAAA,CAAU,QAAQ,WAAA,CAAY,MAAM,aAAa,IAAI,CAAA,EAAG,IAAI,CAAC,CAAA;AAAA,EAC/D;AACA,EAAA,IAAI,CAAC,UAAUA,aAAA,CAAWC,SAAA,CAAKC,oCAAkB,GAAG,CAAA,EAAG,OAAO,CAAC,CA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AO,GAAA,CAAI,OAAA,KAAY,YAAY,GAAA,CAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC/D,IAAA,MAAM,IAAIA,oCAAA,CAAmB,CAAA,+CAAA,EAAkD,IAAI,CAAA,CAAA,EAAI;AAAA,MACrF,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AACA,EAAA,MAAM,KAAkB,EAAE,OAAA,EAAS,GAAA,CAAI,OAAA,EAAS,aAAa,OAAA,EAAQ;AACrE,EAAA,IAAI,OAAA,KAAY,MAAA,EAAW,EAAA,CAAG,OAAA,GAAU,OAAA;AACxC,EAAA,IAAI,OAAO,GAAA,CAAI,OAAA,KAAY,QAAA,IAAY,GAAA,CAAI,UAAU,CAAA,EAAG;AACtD,IAAA,EAAA,CAAG,SAAA,GAAY,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,UAAU,GAAI,CAAA;AAAA,EAC9C;AACA,EAAA,OAAO,EAAA;AACT;;;ACzRA,IAAM,OAAA,GAAU,IAAIC,6BAAA,EAA0C;AAQvD,SAAS,sBAAA,CACd,KACA,EAAA,EACY;AACZ,EAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,GAAA,EAAK,EAAE,CAAA;AAC5B;AAQO,SAAS,yBAAA,GAAgE;AAC9E,EAAA,OAAO,QAAQ,QAAA,EAAS;AAC1B;AASO,SAAS,gCAAgC,OAAA,EAAuB;AACrE,EAAA,QAAA;AAAA,IACE,8BAA8B,OAAO,CAAA,CAAA;AAAA,IACrC,CAAA,0IAAA;AAAA,GACF;AACF","file":"chunk-VY6NKMOA.cjs","sourcesContent":["/**\n * Single source of truth for loading the hooks config (ADR 0016 — reverses\n * D74/D77 for hooks: JSON is canonical again, in the Claude Code shape).\n *\n * `.theokit/hooks.json` (Claude-Code-shaped JSON) is the only supported form.\n * A stray legacy `.theokit/hooks/*.md` dir (no hooks.json) is NOT loaded — it\n * warns to migrate and yields no hooks. Absent both → empty config.\n *\n * Consumed by `hooks-executor.ts` (runtime dispatch).\n *\n * Config shape (identical to Claude Code's `settings.json` hooks):\n * { \"hooks\": { \"PreToolUse\": [ { \"matcher\": \"shell\",\n * \"hooks\": [ { \"type\": \"command\", \"command\": \"…\", \"timeout\": 30 } ] } ] } }\n *\n * @internal\n */\n\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { ConfigurationError } from \"../../../errors.js\";\nimport { diag } from \"../../diagnostics.js\";\nimport { projectConfigRoots, theokitConfigRoot } from \"../../persistence/paths.js\";\nimport type { CompatSourceDeclaration } from \"../compat/foreign-config-sources.js\";\n\n/** The five lifecycle events the SDK runtime actually fires. */\nexport type HookEvent = \"preRun\" | \"postRun\" | \"preToolUse\" | \"postToolUse\" | \"stop\";\n\n/**\n * Claude Code event name → the SDK firing event. Only events the runtime\n * genuinely emits are mapped; a Claude Code event with no SDK firing point\n * (SessionStart / SubagentStop / PreCompact / Notification / SessionEnd) is\n * skipped with a warn rather than silently accepted (it would never run).\n */\nconst CLAUDE_CODE_EVENT_MAP: Readonly<Record<string, HookEvent>> = {\n PreToolUse: \"preToolUse\",\n PostToolUse: \"postToolUse\",\n UserPromptSubmit: \"preRun\",\n Stop: \"stop\",\n};\n\nexport interface HookCommand {\n command: string;\n matcher?: string;\n timeoutMs?: number;\n /**\n * #637 — the event key as written in the config file (`PreToolUse`), carried so the approval\n * gate can report the vocabulary the consumer's stored fingerprint was taken against.\n *\n * REQUIRED, not optional: `parseClaudeCodeCommand` is the only producer of a `HookCommand` in\n * this package, so every command has one. An optional field would hand every reader a fallback\n * branch for a case that cannot occur — and if an in-memory producer is added later, required is\n * what forces it to supply a value instead of inheriting a silent `undefined`.\n */\n sourceEvent: string;\n /**\n * The config file this command was declared in.\n *\n * Carried so the executor can supply the runtime contract the declaring DIALECT presumes — a\n * command from `.claude/settings.json` is written against Claude Code's runtime and expects\n * `$CLAUDE_PROJECT_DIR` to exist (#522). Absent for a command built in memory, which is native by\n * construction.\n */\n sourcePath?: string;\n}\n\nexport interface HookConfig {\n hooks?: Partial<Record<HookEvent, HookCommand[]>>;\n}\n\nconst warned = new Set<string>();\n\n/**\n * Emit a stderr warn once per process per unique key. Helps surface the\n * deprecation path without spamming when the loader is called many times\n * during a session (cron + send + skills all hit this).\n *\n * Note: spawned workers (cron, subagent) start fresh processes — warn\n * re-emits there, by design (1 per process boot, not per call).\n *\n * @internal\n */\nexport function warnOnce(key: string, message: string): void {\n if (warned.has(key)) return;\n warned.add(key);\n diag(`${message}\\n`);\n}\n\n/** Reset for tests; not exported via barrel. @internal */\nexport function _resetWarnOnceForTests(): void {\n warned.clear();\n}\n\n/**\n * Load hooks from `.theokit/hooks.json` (Claude-Code-shaped — the only supported\n * form). A stray legacy `.theokit/hooks/*.md` markdown dir (no `hooks.json`) is\n * NOT loaded — it emits a one-time migration warn and yields no hooks.\n *\n * @internal\n */\nexport async function loadHookConfig(\n cwd: string,\n compatSources: readonly CompatSourceDeclaration[] = [],\n): Promise<HookConfig> {\n const merged: HookConfig = {};\n let sawAny = false;\n for (const path of hookConfigCandidates(cwd, compatSources)) {\n if (!existsSync(path)) continue;\n sawAny = true;\n // Stamped at merge, where the file is still known. One line later the commands are pooled per\n // event and every trace of which dialect declared them is gone — which is how a Claude Code\n // command came to be run without Claude Code's runtime (#522).\n mergeInto(merged, stampSource(await readHookFile(path), path));\n }\n if (!sawAny && existsSync(join(theokitConfigRoot(cwd), \"hooks\"))) {\n warnOnce(\n \"hooks-md-unsupported\",\n \"[theokit-sdk] .theokit/hooks/*.md hooks are no longer supported (ADR 0016) — migrate to a Claude-Code-shaped .theokit/hooks.json\",\n );\n }\n return merged;\n}\n\n/**\n * Every file that may declare hooks, in precedence order.\n *\n * `hooks.json` under each project config root, then the Claude Code CLI's own settings files — which\n * is where the CLI actually keeps hooks, so a repository set up for it presents its hooks here\n * without being converted. `settings.local.json` is the CLI's personal-override file and sits beside\n * the shared one rather than replacing it.\n *\n * The shape never needed translating: `parseClaudeCodeConfig` reads the `hooks` key off whatever\n * object it is given, and a settings file is that same object with other keys alongside.\n */\nfunction hookConfigCandidates(\n cwd: string,\n compatSources: readonly CompatSourceDeclaration[],\n): string[] {\n const roots = projectConfigRoots(cwd, compatSources, \"hooks\");\n return [\n ...roots.map((root) => join(root, \"hooks.json\")),\n ...roots.map((root) => join(root, \"settings.json\")),\n ...roots.map((root) => join(root, \"settings.local.json\")),\n ];\n}\n\n/**\n * Record which file each command came from.\n *\n * A command already carrying a `sourcePath` keeps it: nothing produces that today, and a nested\n * config that declared its own origin would be describing something this function cannot see.\n */\nfunction stampSource(config: HookConfig, sourcePath: string): HookConfig {\n if (config.hooks === undefined) return config;\n const hooks: NonNullable<HookConfig[\"hooks\"]> = {};\n for (const [event, commands] of Object.entries(config.hooks) as [\n HookEvent,\n HookCommand[] | undefined,\n ][]) {\n if (commands === undefined) continue;\n hooks[event] = commands.map((c) => ({ sourcePath, ...c }));\n }\n return { hooks };\n}\n\n/**\n * Append one source's commands onto the accumulator, per event.\n *\n * MERGED, not first-wins, and the distinction is deliberate. An agent or a skill is a NAMED\n * declaration: two files claiming one name collide, and the explicit namespace should win. Hooks are\n * unnamed lists — two files declaring `PreToolUse` are two sets of commands an operator wrote, and\n * keeping only one drops the other in silence, which is the failure class this package guards\n * against everywhere else.\n */\nfunction mergeInto(target: HookConfig, source: HookConfig): void {\n for (const [event, commands] of Object.entries(source.hooks ?? {}) as [\n HookEvent,\n HookCommand[] | undefined,\n ][]) {\n if (commands === undefined || commands.length === 0) continue;\n target.hooks ??= {};\n target.hooks[event] = [...(target.hooks[event] ?? []), ...commands];\n }\n}\n\nasync function readHookFile(jsonPath: string): Promise<HookConfig> {\n let raw: string;\n try {\n raw = await readFile(jsonPath, \"utf8\");\n } catch (cause) {\n throw new ConfigurationError(`Failed to read hooks config: ${jsonPath}`, {\n code: \"hooks_read_error\",\n cause,\n });\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (cause) {\n throw new ConfigurationError(`Invalid JSON in hooks config: ${jsonPath}`, {\n code: \"hooks_json_invalid\",\n cause,\n });\n }\n return parseClaudeCodeConfig(parsed, jsonPath);\n}\n\n/**\n * Narrow an unknown to a record, or throw a typed config error.\n *\n * `hint` names the shape that WOULD be accepted, and exists because the message without it names\n * only the validator's expectation. Measured on a consumer in 2026-09: a flat `hooks` array in a\n * `.theokit/settings.json` made this throw on every turn, and `expected an object at \"hooks\"` gave\n * the operator nothing to act on — the file parses fine for the product that wrote it, and it is\n * this independent read of the same path that fails. An error on a refusal path should carry the\n * fix, not the diagnosis.\n */\nfunction asRecord(\n value: unknown,\n path: string,\n where: string,\n hint?: string,\n): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new ConfigurationError(\n `hooks: expected an object at ${where} in ${path}${hint === undefined ? \"\" : ` — ${hint}`}`,\n { code: \"hooks_json_invalid\" },\n );\n }\n return value as Record<string, unknown>;\n}\n\n/**\n * The shape this loader accepts, quoted back on the one refusal an operator is most likely to hit:\n * `hooks` keyed by event, each event an array of matcher groups.\n */\nconst HOOKS_SHAPE_HINT =\n 'hooks are keyed by event, e.g. { \"hooks\": { \"PreToolUse\": [ { \"hooks\": ' +\n '[ { \"type\": \"command\", \"command\": \"…\" } ] } ] } }';\n\n/** Narrow an unknown to an array, or throw a typed config error. */\nfunction asArray(value: unknown, path: string, where: string): unknown[] {\n if (!Array.isArray(value)) {\n throw new ConfigurationError(`hooks: expected an array at ${where} in ${path}`, {\n code: \"hooks_json_invalid\",\n });\n }\n return value;\n}\n\n/**\n * Parse Claude Code's nested hooks config into the SDK's flat internal shape:\n * `{ hooks: { PreToolUse: [{ matcher?, hooks: [{ type:\"command\", command, timeout? }] }] } }`\n * → `{ hooks: { preToolUse: [{ command, matcher?, timeoutMs? }] } }`. Each group's\n * `matcher` applies to every command it wraps; `timeout` (seconds) → `timeoutMs`.\n */\nfunction parseClaudeCodeConfig(raw: unknown, path: string): HookConfig {\n const root = asRecord(raw, path, \"the root\");\n if (root.hooks === undefined) return {};\n const hooksRec = asRecord(root.hooks, path, `\"hooks\"`, HOOKS_SHAPE_HINT);\n const grouped: Partial<Record<HookEvent, HookCommand[]>> = {};\n\n for (const [ccEvent, groups] of Object.entries(hooksRec)) {\n const event = CLAUDE_CODE_EVENT_MAP[ccEvent];\n if (event === undefined) {\n warnOnce(\n `hooks-event-${ccEvent}`,\n `[theokit-sdk] hooks: event \"${ccEvent}\" is not fired by the SDK runtime (supported: ${Object.keys(CLAUDE_CODE_EVENT_MAP).join(\", \")}) — skipping`,\n );\n continue;\n }\n grouped[event] = [...(grouped[event] ?? []), ...flattenEventGroups(groups, path, ccEvent)];\n }\n return { hooks: grouped };\n}\n\n/** Flatten one Claude Code event's matcher-groups into internal HookCommands. */\nfunction flattenEventGroups(groups: unknown, path: string, ccEvent: string): HookCommand[] {\n const commands: HookCommand[] = [];\n for (const rawGroup of asArray(groups, path, `hooks.${ccEvent}`)) {\n const group = asRecord(rawGroup, path, `hooks.${ccEvent}[]`);\n const matcher = group.matcher === undefined ? undefined : String(group.matcher);\n for (const rawCmd of asArray(group.hooks, path, `hooks.${ccEvent}[].hooks`)) {\n commands.push(parseClaudeCodeCommand(rawCmd, matcher, path, ccEvent));\n }\n }\n return commands;\n}\n\n/** One `{ type:\"command\", command, timeout? }` entry → an internal HookCommand. */\nfunction parseClaudeCodeCommand(\n raw: unknown,\n matcher: string | undefined,\n path: string,\n ccEvent: string,\n): HookCommand {\n const cmd = asRecord(raw, path, `hooks.${ccEvent}[].hooks[]`);\n if (cmd.type !== \"command\") {\n throw new ConfigurationError(\n `hooks: only { \"type\": \"command\" } is supported (got ${JSON.stringify(cmd.type)}) in ${path}`,\n { code: \"hooks_unsupported_type\" },\n );\n }\n if (typeof cmd.command !== \"string\" || cmd.command.length === 0) {\n throw new ConfigurationError(`hooks: \"command\" must be a non-empty string in ${path}`, {\n code: \"hooks_invalid_command\",\n });\n }\n const hc: HookCommand = { command: cmd.command, sourceEvent: ccEvent };\n if (matcher !== undefined) hc.matcher = matcher;\n if (typeof cmd.timeout === \"number\" && cmd.timeout > 0) {\n hc.timeoutMs = Math.round(cmd.timeout * 1000);\n }\n return hc;\n}\n","/**\n * Personality fork-context (ADR D168 + EC-A snapshot semantic).\n *\n * Uses Node's `AsyncLocalStorage` so a fork's execution chain can know\n * that it is running inside a fork AND can see the slug that was active\n * on the parent **at fork-construction time**.\n *\n * **EC-A:** The slug stored here is captured ONCE at the wrap site\n * (`localAgentFork`) — passing `parentStore.active(parentAgentId)`\n * returns a primitive `string | undefined`, which is then frozen\n * inside the ALS context object. Subsequent `usePersonality` calls on\n * the parent do NOT mutate the fork's view, because the fork reads from\n * its own ALS frame, not from the parent's store.\n *\n * @internal\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n\nimport { warnOnce } from \"../runtime/hooks/hooks-source.js\";\n\n/**\n * Snapshot data carried into a fork's async context.\n *\n * @internal\n */\nexport interface PersonalityForkContext {\n /** Parent's active personality slug at fork-construction time. */\n readonly slug: string | undefined;\n /** Always `true` inside this scope (used by guards). */\n readonly isFork: true;\n}\n\nconst storage = new AsyncLocalStorage<PersonalityForkContext>();\n\n/**\n * Run `fn` with `ctx` bound as the active fork context. Nested calls\n * shadow the outer context (EC-22).\n *\n * @internal\n */\nexport function withPersonalityContext<T>(\n ctx: PersonalityForkContext,\n fn: () => Promise<T>,\n): Promise<T> {\n return storage.run(ctx, fn);\n}\n\n/**\n * Return the active fork context, or `undefined` when called outside a\n * fork scope.\n *\n * @internal\n */\nexport function currentPersonalityContext(): PersonalityForkContext | undefined {\n return storage.getStore();\n}\n\n/**\n * Emit one warning per agentId stating that personality switches inside\n * a fork are no-ops. The fork inherits the parent snapshot — runtime\n * mutation is intentionally rejected to keep fork voice deterministic.\n *\n * @internal\n */\nexport function warnPersonalitySwitchInsideFork(agentId: string): void {\n warnOnce(\n `personality-switch-in-fork-${agentId}`,\n `[theokit-sdk] usePersonality is a no-op inside a fork (D168). Subagents inherit the parent's active personality at fork-construction time.`,\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
- export { currentPersonalityContext, warnPersonalitySwitchInsideFork, withPersonalityContext } from './chunk-XD3FS5OI.js';
1
+ export { currentPersonalityContext, warnPersonalitySwitchInsideFork, withPersonalityContext } from './chunk-S6B5XYC3.js';
2
2
  import './chunk-NSLHPAC7.js';
3
3
  import './chunk-ALUN2B4W.js';
4
4
  import './chunk-CZJ6Q7CW.js';
5
- //# sourceMappingURL=context-EGM6CHXD.js.map
6
- //# sourceMappingURL=context-EGM6CHXD.js.map
5
+ //# sourceMappingURL=context-3HPU754C.js.map
6
+ //# sourceMappingURL=context-3HPU754C.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"context-EGM6CHXD.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"context-3HPU754C.js"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk3FDU5JFE_cjs = require('./chunk-3FDU5JFE.cjs');
3
+ var chunkVY6NKMOA_cjs = require('./chunk-VY6NKMOA.cjs');
4
4
  require('./chunk-43YXGD3P.cjs');
5
5
  require('./chunk-J7J7J2GN.cjs');
6
6
  require('./chunk-6LHQPOMI.cjs');
@@ -9,15 +9,15 @@ require('./chunk-6LHQPOMI.cjs');
9
9
 
10
10
  Object.defineProperty(exports, "currentPersonalityContext", {
11
11
  enumerable: true,
12
- get: function () { return chunk3FDU5JFE_cjs.currentPersonalityContext; }
12
+ get: function () { return chunkVY6NKMOA_cjs.currentPersonalityContext; }
13
13
  });
14
14
  Object.defineProperty(exports, "warnPersonalitySwitchInsideFork", {
15
15
  enumerable: true,
16
- get: function () { return chunk3FDU5JFE_cjs.warnPersonalitySwitchInsideFork; }
16
+ get: function () { return chunkVY6NKMOA_cjs.warnPersonalitySwitchInsideFork; }
17
17
  });
18
18
  Object.defineProperty(exports, "withPersonalityContext", {
19
19
  enumerable: true,
20
- get: function () { return chunk3FDU5JFE_cjs.withPersonalityContext; }
20
+ get: function () { return chunkVY6NKMOA_cjs.withPersonalityContext; }
21
21
  });
22
- //# sourceMappingURL=context-4AIK26QB.cjs.map
23
- //# sourceMappingURL=context-4AIK26QB.cjs.map
22
+ //# sourceMappingURL=context-JTGSBJT6.cjs.map
23
+ //# sourceMappingURL=context-JTGSBJT6.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"context-4AIK26QB.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"context-JTGSBJT6.cjs"}
@@ -1,6 +1,6 @@
1
1
  import { Workflow, WorkflowRun } from './workflow.cjs';
2
2
  import { aa as SDKUserMessage, b as Run } from './run-CTAdRU3U.cjs';
3
- import { A as AgentOptions, d as ListResult } from './agent-C1Efo7PI.cjs';
3
+ import { A as AgentOptions, d as ListResult } from './agent-DyB_lzrx.cjs';
4
4
 
5
5
  /**
6
6
  * Owner: `internal/cron/` (4 of 5 importers). Derived from the import graph, not declared —
@@ -1,6 +1,6 @@
1
1
  import { Workflow, WorkflowRun } from './workflow.js';
2
2
  import { aa as SDKUserMessage, b as Run } from './run-CTAdRU3U.js';
3
- import { A as AgentOptions, d as ListResult } from './agent-Bmy2G_ml.js';
3
+ import { A as AgentOptions, d as ListResult } from './agent-CjMVbhhY.js';
4
4
 
5
5
  /**
6
6
  * Owner: `internal/cron/` (4 of 5 importers). Derived from the import graph, not declared —
package/dist/cron.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkJ6KZE2ZQ_cjs = require('./chunk-J6KZE2ZQ.cjs');
4
- require('./chunk-UALC6Q3J.cjs');
3
+ var chunk2ZLQZHZC_cjs = require('./chunk-2ZLQZHZC.cjs');
4
+ require('./chunk-UKJJRU7C.cjs');
5
5
  require('./chunk-KVSAY6NZ.cjs');
6
6
  require('./chunk-DZG77WU7.cjs');
7
7
  require('./chunk-BUUUWQMB.cjs');
8
8
  require('./chunk-Z2JFX372.cjs');
9
- require('./chunk-3FDU5JFE.cjs');
9
+ require('./chunk-VY6NKMOA.cjs');
10
10
  require('./chunk-BV2MWEMV.cjs');
11
11
  require('./chunk-D6POWE7E.cjs');
12
12
  require('./chunk-GHX4P3V2.cjs');
@@ -62,7 +62,7 @@ require('./chunk-6LHQPOMI.cjs');
62
62
 
63
63
  Object.defineProperty(exports, "Cron", {
64
64
  enumerable: true,
65
- get: function () { return chunkJ6KZE2ZQ_cjs.Cron; }
65
+ get: function () { return chunk2ZLQZHZC_cjs.Cron; }
66
66
  });
67
67
  //# sourceMappingURL=cron.cjs.map
68
68
  //# sourceMappingURL=cron.cjs.map
package/dist/cron.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import './workflow.cjs';
2
2
  import './run-CTAdRU3U.cjs';
3
- import './agent-C1Efo7PI.cjs';
4
- export { C as Cron } from './cron-DSMdlhyF.cjs';
3
+ import './agent-DyB_lzrx.cjs';
4
+ export { C as Cron } from './cron-Bgivg88c.cjs';
5
5
  import 'zod';
6
6
  import './sdk-agent-BOiKqOgL.cjs';
7
7
  import './errors-base-B5g01neU.cjs';
package/dist/cron.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import './workflow.js';
2
2
  import './run-CTAdRU3U.js';
3
- import './agent-Bmy2G_ml.js';
4
- export { C as Cron } from './cron-Dcdrdv_T.js';
3
+ import './agent-CjMVbhhY.js';
4
+ export { C as Cron } from './cron-CNUa7PDo.js';
5
5
  import 'zod';
6
6
  import './sdk-agent-D4a_BR_6.js';
7
7
  import './errors-base-B5g01neU.js';
package/dist/cron.js CHANGED
@@ -1,10 +1,10 @@
1
- export { Cron } from './chunk-KWGSBZ2Q.js';
2
- import './chunk-IKBLU7ZS.js';
1
+ export { Cron } from './chunk-M3ZGRGOG.js';
2
+ import './chunk-ODBID5TG.js';
3
3
  import './chunk-K2VMFZQ5.js';
4
4
  import './chunk-2QKV4CGK.js';
5
5
  import './chunk-K2BQQ445.js';
6
6
  import './chunk-7SZAV6QG.js';
7
- import './chunk-XD3FS5OI.js';
7
+ import './chunk-S6B5XYC3.js';
8
8
  import './chunk-2SFBB54R.js';
9
9
  import './chunk-55GB6JYQ.js';
10
10
  import './chunk-H73MEMQB.js';
package/dist/eval.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkUADQJBHR_cjs = require('./chunk-UADQJBHR.cjs');
4
- var chunkUALC6Q3J_cjs = require('./chunk-UALC6Q3J.cjs');
4
+ var chunkUKJJRU7C_cjs = require('./chunk-UKJJRU7C.cjs');
5
5
  require('./chunk-KVSAY6NZ.cjs');
6
6
  require('./chunk-DZG77WU7.cjs');
7
7
  var chunkBUUUWQMB_cjs = require('./chunk-BUUUWQMB.cjs');
8
8
  require('./chunk-Z2JFX372.cjs');
9
- require('./chunk-3FDU5JFE.cjs');
9
+ require('./chunk-VY6NKMOA.cjs');
10
10
  require('./chunk-BV2MWEMV.cjs');
11
11
  require('./chunk-D6POWE7E.cjs');
12
12
  require('./chunk-GHX4P3V2.cjs');
@@ -795,7 +795,7 @@ function makeDefaultEmbedder(opts) {
795
795
  let runtime;
796
796
  return (texts) => {
797
797
  if (runtime === void 0) {
798
- runtime = chunkUALC6Q3J_cjs.openRouterMemoryEmbeddingProviderAdapter.create(embedderCreateOptions(opts));
798
+ runtime = chunkUKJJRU7C_cjs.openRouterMemoryEmbeddingProviderAdapter.create(embedderCreateOptions(opts));
799
799
  }
800
800
  return runtime.then((rt) => rt.embed(texts));
801
801
  };
package/dist/eval.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { shellEscapePosix, LocalSandbox } from './chunk-O6USDERH.js';
2
- import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-IKBLU7ZS.js';
2
+ import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-ODBID5TG.js';
3
3
  import './chunk-K2VMFZQ5.js';
4
4
  import './chunk-2QKV4CGK.js';
5
5
  import { getTracer } from './chunk-K2BQQ445.js';
6
6
  import './chunk-7SZAV6QG.js';
7
- import './chunk-XD3FS5OI.js';
7
+ import './chunk-S6B5XYC3.js';
8
8
  import './chunk-2SFBB54R.js';
9
9
  import './chunk-55GB6JYQ.js';
10
10
  import './chunk-H73MEMQB.js';
package/dist/index.cjs CHANGED
@@ -9,13 +9,13 @@ require('./chunk-7JJ3A6AT.cjs');
9
9
  var chunk4HS6FFGL_cjs = require('./chunk-4HS6FFGL.cjs');
10
10
  require('./chunk-4A3SKJ53.cjs');
11
11
  require('./chunk-VTYY7XL5.cjs');
12
- var chunkJ6KZE2ZQ_cjs = require('./chunk-J6KZE2ZQ.cjs');
13
- var chunkUALC6Q3J_cjs = require('./chunk-UALC6Q3J.cjs');
12
+ var chunk2ZLQZHZC_cjs = require('./chunk-2ZLQZHZC.cjs');
13
+ var chunkUKJJRU7C_cjs = require('./chunk-UKJJRU7C.cjs');
14
14
  var chunkKVSAY6NZ_cjs = require('./chunk-KVSAY6NZ.cjs');
15
15
  require('./chunk-DZG77WU7.cjs');
16
16
  require('./chunk-BUUUWQMB.cjs');
17
17
  require('./chunk-Z2JFX372.cjs');
18
- require('./chunk-3FDU5JFE.cjs');
18
+ require('./chunk-VY6NKMOA.cjs');
19
19
  require('./chunk-BV2MWEMV.cjs');
20
20
  require('./chunk-D6POWE7E.cjs');
21
21
  require('./chunk-GHX4P3V2.cjs');
@@ -74,8 +74,8 @@ var path = require('path');
74
74
  // src/agent-factory.ts
75
75
  function createAgentFactory(common) {
76
76
  return {
77
- forSession: (agentId, overrides) => chunkUALC6Q3J_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
78
- getOrCreate: (agentId, overrides) => chunkUALC6Q3J_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
77
+ forSession: (agentId, overrides) => chunkUKJJRU7C_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
78
+ getOrCreate: (agentId, overrides) => chunkUKJJRU7C_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
79
79
  };
80
80
  }
81
81
  function mergeAgentOptions(common, overrides, agentId) {
@@ -1335,7 +1335,7 @@ var Memory = {
1335
1335
  return await peer.IndexManager.open(openArgs);
1336
1336
  }
1337
1337
  const { IndexManager } = await import('./index-manager-3UNPYH34.cjs');
1338
- openArgs.embedding = await resolveEmbedding(opts.embedding, chunkUALC6Q3J_cjs.MEMORY_EMBEDDING_ADAPTERS);
1338
+ openArgs.embedding = await resolveEmbedding(opts.embedding, chunkUKJJRU7C_cjs.MEMORY_EMBEDDING_ADAPTERS);
1339
1339
  return await IndexManager.open(openArgs);
1340
1340
  },
1341
1341
  /**
@@ -1346,7 +1346,7 @@ var Memory = {
1346
1346
  */
1347
1347
  async runDreamingSweep(opts) {
1348
1348
  const peer = await tryLoadSdkMemoryPeer();
1349
- const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkUALC6Q3J_cjs.MEMORY_EMBEDDING_ADAPTERS;
1349
+ const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkUKJJRU7C_cjs.MEMORY_EMBEDDING_ADAPTERS;
1350
1350
  const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
1351
1351
  const result = peer !== null ? (
1352
1352
  // biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
@@ -1770,7 +1770,7 @@ function guardSessionDestruction(sessionId, live) {
1770
1770
  // src/session-messages.ts
1771
1771
  async function readSessionMessages2(options) {
1772
1772
  const cwd = options.cwd ?? process.cwd();
1773
- const baseDir = chunkUALC6Q3J_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
1773
+ const baseDir = chunkUKJJRU7C_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
1774
1774
  return chunkYIFFF23U_cjs.readSessionMessages(new chunk7FDKWDA2_cjs.FsSessionStore({ baseDir, cwd }), options.sessionId);
1775
1775
  }
1776
1776
 
@@ -1787,7 +1787,7 @@ function isBuiltAgent(m) {
1787
1787
  return typeof m.send === "function";
1788
1788
  }
1789
1789
  async function materialize(def, index) {
1790
- const { Agent: Agent2 } = await import('./agent-AUVD4TI4.cjs');
1790
+ const { Agent: Agent2 } = await import('./agent-YWSIHHFM.cjs');
1791
1791
  return Agent2.create({
1792
1792
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1793
1793
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -1929,7 +1929,7 @@ var FIXTURE_USER = {
1929
1929
  };
1930
1930
  var FIXTURE_MODELS = [
1931
1931
  {
1932
- id: chunkUALC6Q3J_cjs.DEFAULT_AGENTIC_MODEL_ID,
1932
+ id: chunkUKJJRU7C_cjs.DEFAULT_AGENTIC_MODEL_ID,
1933
1933
  name: "Gemini 2.0 Flash",
1934
1934
  displayName: "Gemini 2.0 Flash",
1935
1935
  parameters: [
@@ -2132,7 +2132,7 @@ var Theokit = class {
2132
2132
  envVars: p.envVars
2133
2133
  }));
2134
2134
  },
2135
- embeddingAdapters: () => Object.entries(chunkUALC6Q3J_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2135
+ embeddingAdapters: () => Object.entries(chunkUKJJRU7C_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2136
2136
  id,
2137
2137
  transport: adapter.transport,
2138
2138
  defaultModel: adapter.defaultModel
@@ -2351,35 +2351,35 @@ Object.defineProperty(exports, "fn", {
2351
2351
  });
2352
2352
  Object.defineProperty(exports, "Cron", {
2353
2353
  enumerable: true,
2354
- get: function () { return chunkJ6KZE2ZQ_cjs.Cron; }
2354
+ get: function () { return chunk2ZLQZHZC_cjs.Cron; }
2355
2355
  });
2356
2356
  Object.defineProperty(exports, "Agent", {
2357
2357
  enumerable: true,
2358
- get: function () { return chunkUALC6Q3J_cjs.Agent; }
2358
+ get: function () { return chunkUKJJRU7C_cjs.Agent; }
2359
2359
  });
2360
2360
  Object.defineProperty(exports, "AgentBuilder", {
2361
2361
  enumerable: true,
2362
- get: function () { return chunkUALC6Q3J_cjs.AgentBuilder; }
2362
+ get: function () { return chunkUKJJRU7C_cjs.AgentBuilder; }
2363
2363
  });
2364
2364
  Object.defineProperty(exports, "Tool", {
2365
2365
  enumerable: true,
2366
- get: function () { return chunkUALC6Q3J_cjs.Tool; }
2366
+ get: function () { return chunkUKJJRU7C_cjs.Tool; }
2367
2367
  });
2368
2368
  Object.defineProperty(exports, "ToolError", {
2369
2369
  enumerable: true,
2370
- get: function () { return chunkUALC6Q3J_cjs.ToolError; }
2370
+ get: function () { return chunkUKJJRU7C_cjs.ToolError; }
2371
2371
  });
2372
2372
  Object.defineProperty(exports, "UsageAccumulator", {
2373
2373
  enumerable: true,
2374
- get: function () { return chunkUALC6Q3J_cjs.UsageAccumulator; }
2374
+ get: function () { return chunkUKJJRU7C_cjs.UsageAccumulator; }
2375
2375
  });
2376
2376
  Object.defineProperty(exports, "computeCost", {
2377
2377
  enumerable: true,
2378
- get: function () { return chunkUALC6Q3J_cjs.computeCost; }
2378
+ get: function () { return chunkUKJJRU7C_cjs.computeCost; }
2379
2379
  });
2380
2380
  Object.defineProperty(exports, "getPricingEntry", {
2381
2381
  enumerable: true,
2382
- get: function () { return chunkUALC6Q3J_cjs.getPricingEntry; }
2382
+ get: function () { return chunkUKJJRU7C_cjs.getPricingEntry; }
2383
2383
  });
2384
2384
  Object.defineProperty(exports, "emitRunEvent", {
2385
2385
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -2,15 +2,15 @@ import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01n
2
2
  export { a as ErrorCode } from './errors-base-B5g01neU.cjs';
3
3
  import { F as RunEvent, j as CostBreakdown, at as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as RunEventSink$1, S as SDKMessage } from './run-CTAdRU3U.cjs';
4
4
  export { A as AgentConversationTurn, e as AssistantMessage, f as CompletionCheck, g as CompletionCheckResult, h as ConversationStep, i as ConversationTurn, j as CostBreakdown, k as CostSource, l as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, m as GenerateRunResult, I as ImageBlock, n as InputProcessorContext, o as InteractionUpdate, p as McpAuthConfig, q as McpHttpServerConfig, r as McpOAuthConfig, s as McpStdioServerConfig, t as MessageOrigin, u as ModelParameterValue, O as OutputProcessorContext, v as PartialToolCallUpdate, w as ProcessorControls, x as ProcessorTripwire, y as ProcessorViolation, z as RunCompactBoundaryEvent, B as RunCompletionCheckEvent, E as RunErrorDetail, F as RunEvent, H as RunGitInfo, J as RunMemoryDegradedEvent, K as RunOperation, L as RunPermissionDeniedEvent, N as RunRateLimitEvent, Q as RunStatus, U as RunTaskCompletedEvent, V as RunTaskStartedEvent, W as RunTaskUpdatedEvent, X as RunTimelineEvent, Y as RunToCompletionOptions, Z as RunToCompletionResult, _ as RunToolProgressEvent, $ as RunTripwireEvent, a0 as SDKAssistantMessage, a1 as SDKImage, a2 as SDKImageDimension, a3 as SDKObjectDelta, a4 as SDKRequestMessage, a5 as SDKStatusMessage, a6 as SDKSystemMessage, a7 as SDKTaskMessage, a8 as SDKThinkingMessage, a9 as SDKToolUseMessage, aa as SDKUserMessage, ab as SDKUserMessageEvent, ac as SendOptions, ad as ShellCommand, ae as ShellConversationTurn, af as ShellOutput, ag as ShellOutputDeltaUpdate, ah as StepCompletedUpdate, ai as StepStartedUpdate, aj as StreamToCompletionResult, ak as SummaryCompletedUpdate, al as SummaryStartedUpdate, am as SummaryUpdate, an as TextBlock, ao as TextDeltaUpdate, ap as ThinkingCompletedUpdate, aq as ThinkingDeltaUpdate, ar as ThinkingMessage, as as TokenDeltaUpdate, at as TokenUsage, au as ToolCall, av as ToolCallCompletedUpdate, aw as ToolCallStartedUpdate, ax as ToolContextMessage, ay as ToolResult, az as ToolResultGuardOptions, aA as ToolUseBlock, aB as TurnEndedUpdate, aC as UserMessage, aD as UserMessageAppendedUpdate } from './run-CTAdRU3U.cjs';
5
- import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-C1Efo7PI.cjs';
6
- export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-C1Efo7PI.cjs';
5
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-DyB_lzrx.cjs';
6
+ export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-DyB_lzrx.cjs';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-DrDEgyz1.cjs';
10
10
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-DrDEgyz1.cjs';
11
11
  import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-BOiKqOgL.cjs';
12
12
  export { A as AgentMemory, e as AgentOperation, f as ContextBudget, g as ContextManagerKind, h as ContextSnapshot, i as ContextSource, j as ContextSourceStatus, I as InvalidateCacheOptions, k as MemoryAdapter, l as MemoryAdapterCapabilities, m as MemoryContext, n as MemoryFact, o as MemoryRevision, p as MemoryToolSchema, q as MemoryTurnMessage, r as PersonalityPreset, s as ProviderCapability, t as ProviderRoute, R as ResolvedProviderRoute, u as RunUntilIterator, v as SDKAgentPlugins, w as SDKAgentSkillDetail, x as SDKAgentSkills, y as SDKArtifact, z as SDKContextManager, B as SDKPluginMetadata, D as SDKProvidersManager, E as SystemPromptSkillRef, V as Verdict } from './sdk-agent-BOiKqOgL.cjs';
13
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-DSMdlhyF.cjs';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-Bgivg88c.cjs';
14
14
  import { StepResult } from './workflow.cjs';
15
15
  export { Workflow, agentStep, fn } from './workflow.cjs';
16
16
 
package/dist/index.d.ts CHANGED
@@ -2,15 +2,15 @@ import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01n
2
2
  export { a as ErrorCode } from './errors-base-B5g01neU.js';
3
3
  import { F as RunEvent, j as CostBreakdown, at as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as RunEventSink$1, S as SDKMessage } from './run-CTAdRU3U.js';
4
4
  export { A as AgentConversationTurn, e as AssistantMessage, f as CompletionCheck, g as CompletionCheckResult, h as ConversationStep, i as ConversationTurn, j as CostBreakdown, k as CostSource, l as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, m as GenerateRunResult, I as ImageBlock, n as InputProcessorContext, o as InteractionUpdate, p as McpAuthConfig, q as McpHttpServerConfig, r as McpOAuthConfig, s as McpStdioServerConfig, t as MessageOrigin, u as ModelParameterValue, O as OutputProcessorContext, v as PartialToolCallUpdate, w as ProcessorControls, x as ProcessorTripwire, y as ProcessorViolation, z as RunCompactBoundaryEvent, B as RunCompletionCheckEvent, E as RunErrorDetail, F as RunEvent, H as RunGitInfo, J as RunMemoryDegradedEvent, K as RunOperation, L as RunPermissionDeniedEvent, N as RunRateLimitEvent, Q as RunStatus, U as RunTaskCompletedEvent, V as RunTaskStartedEvent, W as RunTaskUpdatedEvent, X as RunTimelineEvent, Y as RunToCompletionOptions, Z as RunToCompletionResult, _ as RunToolProgressEvent, $ as RunTripwireEvent, a0 as SDKAssistantMessage, a1 as SDKImage, a2 as SDKImageDimension, a3 as SDKObjectDelta, a4 as SDKRequestMessage, a5 as SDKStatusMessage, a6 as SDKSystemMessage, a7 as SDKTaskMessage, a8 as SDKThinkingMessage, a9 as SDKToolUseMessage, aa as SDKUserMessage, ab as SDKUserMessageEvent, ac as SendOptions, ad as ShellCommand, ae as ShellConversationTurn, af as ShellOutput, ag as ShellOutputDeltaUpdate, ah as StepCompletedUpdate, ai as StepStartedUpdate, aj as StreamToCompletionResult, ak as SummaryCompletedUpdate, al as SummaryStartedUpdate, am as SummaryUpdate, an as TextBlock, ao as TextDeltaUpdate, ap as ThinkingCompletedUpdate, aq as ThinkingDeltaUpdate, ar as ThinkingMessage, as as TokenDeltaUpdate, at as TokenUsage, au as ToolCall, av as ToolCallCompletedUpdate, aw as ToolCallStartedUpdate, ax as ToolContextMessage, ay as ToolResult, az as ToolResultGuardOptions, aA as ToolUseBlock, aB as TurnEndedUpdate, aC as UserMessage, aD as UserMessageAppendedUpdate } from './run-CTAdRU3U.js';
5
- import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-Bmy2G_ml.js';
6
- export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-Bmy2G_ml.js';
5
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-CjMVbhhY.js';
6
+ export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-CjMVbhhY.js';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-CLOAyuiv.js';
10
10
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-CLOAyuiv.js';
11
11
  import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-D4a_BR_6.js';
12
12
  export { A as AgentMemory, e as AgentOperation, f as ContextBudget, g as ContextManagerKind, h as ContextSnapshot, i as ContextSource, j as ContextSourceStatus, I as InvalidateCacheOptions, k as MemoryAdapter, l as MemoryAdapterCapabilities, m as MemoryContext, n as MemoryFact, o as MemoryRevision, p as MemoryToolSchema, q as MemoryTurnMessage, r as PersonalityPreset, s as ProviderCapability, t as ProviderRoute, R as ResolvedProviderRoute, u as RunUntilIterator, v as SDKAgentPlugins, w as SDKAgentSkillDetail, x as SDKAgentSkills, y as SDKArtifact, z as SDKContextManager, B as SDKPluginMetadata, D as SDKProvidersManager, E as SystemPromptSkillRef, V as Verdict } from './sdk-agent-D4a_BR_6.js';
13
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-Dcdrdv_T.js';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-CNUa7PDo.js';
14
14
  import { StepResult } from './workflow.js';
15
15
  export { Workflow, agentStep, fn } from './workflow.js';
16
16
 
package/dist/index.js CHANGED
@@ -8,15 +8,15 @@ import { Workflow, agentStep } from './chunk-HFEJE7AC.js';
8
8
  export { Workflow, agentStep, fn } from './chunk-HFEJE7AC.js';
9
9
  import './chunk-GBCVPKHE.js';
10
10
  import './chunk-HY66GLM6.js';
11
- export { Cron } from './chunk-KWGSBZ2Q.js';
12
- import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-IKBLU7ZS.js';
13
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-IKBLU7ZS.js';
11
+ export { Cron } from './chunk-M3ZGRGOG.js';
12
+ import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-ODBID5TG.js';
13
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-ODBID5TG.js';
14
14
  import { configure, submit, list, get, cancel, subscribe } from './chunk-K2VMFZQ5.js';
15
15
  export { emitRunEvent } from './chunk-K2VMFZQ5.js';
16
16
  import './chunk-2QKV4CGK.js';
17
17
  import './chunk-K2BQQ445.js';
18
18
  import './chunk-7SZAV6QG.js';
19
- import './chunk-XD3FS5OI.js';
19
+ import './chunk-S6B5XYC3.js';
20
20
  import './chunk-2SFBB54R.js';
21
21
  import './chunk-55GB6JYQ.js';
22
22
  import './chunk-H73MEMQB.js';
@@ -1792,7 +1792,7 @@ function isBuiltAgent(m) {
1792
1792
  return typeof m.send === "function";
1793
1793
  }
1794
1794
  async function materialize(def, index) {
1795
- const { Agent: Agent2 } = await import('./agent-MNINE73R.js');
1795
+ const { Agent: Agent2 } = await import('./agent-G3T7Q3SQ.js');
1796
1796
  return Agent2.create({
1797
1797
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1798
1798
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -6,6 +6,16 @@ export interface HookCommand {
6
6
  matcher?: string;
7
7
  /** Optional timeout in ms; defaults to 30s. */
8
8
  timeoutMs?: number;
9
+ /**
10
+ * #637 — the event key as the config file spelled it (`PreToolUse`), for the approval gate.
11
+ *
12
+ * Declared here AND in `hooks-source.ts`, because this interface has two independent copies —
13
+ * the same duplication `types/hooks.ts` records for `HookEvent`. Adding the field to one only
14
+ * would break at the assignment boundary in one direction and pass silently in the other.
15
+ * Consolidating the pair is a separate change with its own blast radius, per the decision
16
+ * recorded at the head of `types/hooks.ts`.
17
+ */
18
+ sourceEvent: string;
9
19
  /**
10
20
  * The config file this command was declared in.
11
21
  *
@@ -20,6 +20,16 @@ export interface HookCommand {
20
20
  command: string;
21
21
  matcher?: string;
22
22
  timeoutMs?: number;
23
+ /**
24
+ * #637 — the event key as written in the config file (`PreToolUse`), carried so the approval
25
+ * gate can report the vocabulary the consumer's stored fingerprint was taken against.
26
+ *
27
+ * REQUIRED, not optional: `parseClaudeCodeCommand` is the only producer of a `HookCommand` in
28
+ * this package, so every command has one. An optional field would hand every reader a fallback
29
+ * branch for a case that cannot occur — and if an in-memory producer is added later, required is
30
+ * what forces it to supply a value instead of inheriting a silent `undefined`.
31
+ */
32
+ sourceEvent: string;
23
33
  /**
24
34
  * The config file this command was declared in.
25
35
  *
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-C1Efo7PI.cjs';
1
+ import { a as AgentDefinition } from './agent-DyB_lzrx.cjs';
2
2
  import './sdk-agent-BOiKqOgL.cjs';
3
3
  import './run-CTAdRU3U.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-Bmy2G_ml.js';
1
+ import { a as AgentDefinition } from './agent-CjMVbhhY.js';
2
2
  import './sdk-agent-D4a_BR_6.js';
3
3
  import './run-CTAdRU3U.js';
4
4
  import 'zod';
@@ -34,6 +34,28 @@ export interface HookApprovalRequest {
34
34
  readonly event: HookEvent;
35
35
  readonly sourcePath?: string;
36
36
  readonly matcher?: string;
37
+ /**
38
+ * #637 — the timeout the runtime WILL apply, in milliseconds, default already resolved.
39
+ *
40
+ * A config that omits `timeout` still runs under one (30s). Reporting `undefined` there would
41
+ * make a consumer reimplement this package's default in order to compute the same fingerprint,
42
+ * and a default duplicated across a boundary is a default that drifts.
43
+ */
44
+ readonly timeoutMs: number;
45
+ /**
46
+ * #637 — the event key exactly as the config file spelled it (`PreToolUse`), which is NOT
47
+ * `event` (`preToolUse`).
48
+ *
49
+ * A consumer's approval is taken against the file it showed the user, so its stored fingerprint
50
+ * is over the file's vocabulary. Without this the two sides hash different strings and no hook
51
+ * can ever be approved — only refused. The literal key rather than a published mapping table,
52
+ * because a mapping is a second thing to keep in step with the first.
53
+ *
54
+ * `string` and not a union of the keys this SDK currently recognises: the vocabulary belongs to
55
+ * whichever dialect declared the hook, so narrowing it would make adding a dialect a breaking
56
+ * change to this public type. A consumer hashes it; it does not need to switch on it.
57
+ */
58
+ readonly sourceEvent: string;
37
59
  }
38
60
  /**
39
61
  * #631 — a consumer's decision point before this package spawns a hook.
@@ -79,10 +79,10 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
79
79
  | `handoff_target_required` | domain | ConfigurationError | `packages/sdk-handoff/src/handoff.ts:111` |
80
80
  | `hitl_timeout` | domain | HitlTimeoutError | `packages/sdk/src/internal/runtime/tools/hitl-middleware.ts:42` +1 |
81
81
  | `hook_denied` | domain | ConfigurationError | `packages/sdk/src/internal/local-agent/local-agent.ts:454` |
82
- | `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:295` |
83
- | `hooks_json_invalid` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:190` +2 |
84
- | `hooks_read_error` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:181` |
85
- | `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:289` |
82
+ | `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:305` |
83
+ | `hooks_json_invalid` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:200` +2 |
84
+ | `hooks_read_error` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:191` |
85
+ | `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:299` |
86
86
  | `interactive_unavailable` | domain | InteractiveUnavailableError | `packages/sdk/src/interactive/types.ts:28` +1 |
87
87
  | `INTERNAL_SERVER_ERROR` | domain | — | `packages/sdk/src/server/errors-envelope.ts:100` |
88
88
  | `invalid_argument` | domain | TheokitAgentError | `packages/sdk/src/compaction.ts:79` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheokit/theokit-sdk#readme",