@theokit/sdk 5.6.0 → 5.7.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.
- package/CHANGELOG.md +66 -0
- package/dist/{agent-G6g-uwcB.d.ts → agent-Bqzdhkqr.d.ts} +1 -1
- package/dist/{agent-82d_DrCL.d.cts → agent-Dya5SmhY.d.cts} +1 -1
- package/dist/{agent-JJZM2VIK.js → agent-EQ5HKTWV.js} +11 -10
- package/dist/{agent-JJZM2VIK.js.map → agent-EQ5HKTWV.js.map} +1 -1
- package/dist/{agent-47NS6ZVL.cjs → agent-KA63WDQH.cjs} +12 -11
- package/dist/{agent-47NS6ZVL.cjs.map → agent-KA63WDQH.cjs.map} +1 -1
- package/dist/agent.d.ts +11 -0
- package/dist/{chunk-VUHXC74Q.cjs → chunk-33A27NFX.cjs} +15 -15
- package/dist/{chunk-VUHXC74Q.cjs.map → chunk-33A27NFX.cjs.map} +1 -1
- package/dist/{chunk-HUDNLFY4.js → chunk-3VXQEQE4.js} +13 -4
- package/dist/chunk-3VXQEQE4.js.map +1 -0
- package/dist/{chunk-DZG77WU7.cjs → chunk-3XSWF5AP.cjs} +3 -3
- package/dist/{chunk-DZG77WU7.cjs.map → chunk-3XSWF5AP.cjs.map} +1 -1
- package/dist/{chunk-FPIY5CLV.js → chunk-6JG2RFGK.js} +3 -3
- package/dist/{chunk-FPIY5CLV.js.map → chunk-6JG2RFGK.js.map} +1 -1
- package/dist/{chunk-N2KAIZ5D.js → chunk-7C3HWGCW.js} +3 -19
- package/dist/chunk-7C3HWGCW.js.map +1 -0
- package/dist/{chunk-LD6HASA5.cjs → chunk-7KBNBPFK.cjs} +12 -2
- package/dist/chunk-7KBNBPFK.cjs.map +1 -0
- package/dist/{chunk-GCHZMH42.cjs → chunk-A575WPBL.cjs} +88 -84
- package/dist/chunk-A575WPBL.cjs.map +1 -0
- package/dist/{chunk-5NELQ6LB.js → chunk-A6PDYH55.js} +12 -3
- package/dist/chunk-A6PDYH55.js.map +1 -0
- package/dist/{chunk-2QKV4CGK.js → chunk-CZWN4C6A.js} +3 -3
- package/dist/{chunk-2QKV4CGK.js.map → chunk-CZWN4C6A.js.map} +1 -1
- package/dist/chunk-DQNI52VV.js +20 -0
- package/dist/chunk-DQNI52VV.js.map +1 -0
- package/dist/{chunk-52FDUJSV.cjs → chunk-E6QXZZKE.cjs} +8 -8
- package/dist/{chunk-52FDUJSV.cjs.map → chunk-E6QXZZKE.cjs.map} +1 -1
- package/dist/{chunk-EIOMN5VA.cjs → chunk-EFETPSJZ.cjs} +17 -8
- package/dist/chunk-EFETPSJZ.cjs.map +1 -0
- package/dist/{chunk-HG4UN4MN.cjs → chunk-ER5BOIYD.cjs} +4 -4
- package/dist/{chunk-HG4UN4MN.cjs.map → chunk-ER5BOIYD.cjs.map} +1 -1
- package/dist/{chunk-2UXQASTX.js → chunk-FUUSIT2T.js} +16 -12
- package/dist/chunk-FUUSIT2T.js.map +1 -0
- package/dist/{chunk-7IZKTQ5G.cjs → chunk-GK3UG7YQ.cjs} +2 -21
- package/dist/chunk-GK3UG7YQ.cjs.map +1 -0
- package/dist/{chunk-GFFBXSQT.cjs → chunk-HNAYCTX4.cjs} +5 -5
- package/dist/{chunk-GFFBXSQT.cjs.map → chunk-HNAYCTX4.cjs.map} +1 -1
- package/dist/{chunk-KZSKIUXZ.js → chunk-N7VAE6DZ.js} +31 -3
- package/dist/chunk-N7VAE6DZ.js.map +1 -0
- package/dist/{chunk-7MMTZBTT.js → chunk-P5S3WCSZ.js} +3 -3
- package/dist/{chunk-7MMTZBTT.js.map → chunk-P5S3WCSZ.js.map} +1 -1
- package/dist/{chunk-BZ3YMAMP.js → chunk-R3LBRQAN.js} +3 -3
- package/dist/{chunk-BZ3YMAMP.js.map → chunk-R3LBRQAN.js.map} +1 -1
- package/dist/{chunk-STGSMJMJ.js → chunk-YRLI5DVC.js} +3 -3
- package/dist/{chunk-STGSMJMJ.js.map → chunk-YRLI5DVC.js.map} +1 -1
- package/dist/chunk-YYN6BB7R.cjs +24 -0
- package/dist/chunk-YYN6BB7R.cjs.map +1 -0
- package/dist/{chunk-C4ZQPWXJ.cjs → chunk-ZLMU5EU3.cjs} +33 -4
- package/dist/chunk-ZLMU5EU3.cjs.map +1 -0
- package/dist/{compact-session-7FMYJXQ7.cjs → compact-session-75KD2FCM.cjs} +15 -11
- package/dist/{compact-session-7FMYJXQ7.cjs.map → compact-session-75KD2FCM.cjs.map} +1 -1
- package/dist/{compact-session-YSEK7NQF.js → compact-session-QT6RJOKO.js} +3 -3
- package/dist/{compact-session-YSEK7NQF.js.map → compact-session-QT6RJOKO.js.map} +1 -1
- package/dist/context/index.cjs +11 -7
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +7 -3
- package/dist/context/index.js.map +1 -1
- package/dist/{context-HR4KMXMA.cjs → context-7RP5JXGM.cjs} +7 -6
- package/dist/{context-HR4KMXMA.cjs.map → context-7RP5JXGM.cjs.map} +1 -1
- package/dist/context-OJIIXJCV.js +7 -0
- package/dist/{context-J5BJ3LBS.js.map → context-OJIIXJCV.js.map} +1 -1
- package/dist/{cron-DWv69ZSD.d.cts → cron-BwxDUscv.d.cts} +1 -1
- package/dist/{cron-GynWtAax.d.ts → cron-D8uB1Xh5.d.ts} +1 -1
- package/dist/cron.cjs +11 -10
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +10 -9
- package/dist/eval.cjs +10 -9
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +9 -8
- package/dist/eval.js.map +1 -1
- package/dist/{index-manager-BBHDKMQS.cjs → index-manager-W7RHSL6G.cjs} +6 -6
- package/dist/{index-manager-BBHDKMQS.cjs.map → index-manager-W7RHSL6G.cjs.map} +1 -1
- package/dist/{index-manager-27WLNQEE.js → index-manager-Z4XMRVWQ.js} +5 -5
- package/dist/{index-manager-27WLNQEE.js.map → index-manager-Z4XMRVWQ.js.map} +1 -1
- package/dist/index.cjs +42 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -3
- package/dist/index.d.ts +32 -3
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-PC73TMP2.cjs → inject-session-L6MIIELT.cjs} +4 -4
- package/dist/{inject-session-PC73TMP2.cjs.map → inject-session-L6MIIELT.cjs.map} +1 -1
- package/dist/{inject-session-J4LBWAPH.js → inject-session-XWWN4DAA.js} +3 -3
- package/dist/{inject-session-J4LBWAPH.js.map → inject-session-XWWN4DAA.js.map} +1 -1
- package/dist/internal/memory/storage/index.cjs +32 -32
- package/dist/internal/memory/storage/index.js +3 -3
- package/dist/internal/runtime/context/context-discovery.d.ts +27 -0
- package/dist/internal/session/compact-session.d.ts +36 -0
- package/dist/project.cjs +3 -3
- package/dist/project.js +1 -1
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/agent.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-2UXQASTX.js.map +0 -1
- package/dist/chunk-5NELQ6LB.js.map +0 -1
- package/dist/chunk-7IZKTQ5G.cjs.map +0 -1
- package/dist/chunk-C4ZQPWXJ.cjs.map +0 -1
- package/dist/chunk-EIOMN5VA.cjs.map +0 -1
- package/dist/chunk-GCHZMH42.cjs.map +0 -1
- package/dist/chunk-HUDNLFY4.js.map +0 -1
- package/dist/chunk-KZSKIUXZ.js.map +0 -1
- package/dist/chunk-LD6HASA5.cjs.map +0 -1
- package/dist/chunk-N2KAIZ5D.js.map +0 -1
- package/dist/context-J5BJ3LBS.js +0 -6
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var chunkTY56BKSK_cjs = require('./chunk-TY56BKSK.cjs');
|
|
4
4
|
var chunkJ7J7J2GN_cjs = require('./chunk-J7J7J2GN.cjs');
|
|
5
5
|
var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
|
|
6
|
-
var async_hooks = require('async_hooks');
|
|
7
6
|
var fs = require('fs');
|
|
8
7
|
var promises = require('fs/promises');
|
|
9
8
|
var path = require('path');
|
|
@@ -177,26 +176,8 @@ function parseClaudeCodeCommand(raw, matcher, path, ccEvent) {
|
|
|
177
176
|
return hc;
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
// src/internal/personality/context.ts
|
|
181
|
-
var storage = new async_hooks.AsyncLocalStorage();
|
|
182
|
-
function withPersonalityContext(ctx, fn) {
|
|
183
|
-
return storage.run(ctx, fn);
|
|
184
|
-
}
|
|
185
|
-
function currentPersonalityContext() {
|
|
186
|
-
return storage.getStore();
|
|
187
|
-
}
|
|
188
|
-
function warnPersonalitySwitchInsideFork(agentId) {
|
|
189
|
-
warnOnce(
|
|
190
|
-
`personality-switch-in-fork-${agentId}`,
|
|
191
|
-
`[theokit-sdk] usePersonality is a no-op inside a fork (D168). Subagents inherit the parent's active personality at fork-construction time.`
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
exports.currentPersonalityContext = currentPersonalityContext;
|
|
196
179
|
exports.loadHookConfig = loadHookConfig;
|
|
197
180
|
exports.warnFailureOnce = warnFailureOnce;
|
|
198
181
|
exports.warnOnce = warnOnce;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
//# sourceMappingURL=chunk-7IZKTQ5G.cjs.map
|
|
202
|
-
//# sourceMappingURL=chunk-7IZKTQ5G.cjs.map
|
|
182
|
+
//# sourceMappingURL=chunk-GK3UG7YQ.cjs.map
|
|
183
|
+
//# sourceMappingURL=chunk-GK3UG7YQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime/hooks/hooks-source.ts"],"names":["diag","diagFailure","existsSync","join","theokitConfigRoot","projectConfigRoots","readFile","ConfigurationError"],"mappings":";;;;;;;;;AA8DO,IAAM,qBAAA,GAA6D;AAAA,EACxE,UAAA,EAAY,YAAA;AAAA,EACZ,WAAA,EAAa,aAAA;AAAA,EACb,gBAAA,EAAkB,QAAA;AAAA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AAG;AACtD,IAAA,EAAA,CAAG,SAAA,GAAY,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,UAAU,GAAI,CAAA;AAAA,EAC9C;AACA,EAAA,OAAO,EAAA;AACT","file":"chunk-GK3UG7YQ.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 is Claude Code's `settings.json` hooks:\n * { \"hooks\": { \"PreToolUse\": [ { \"matcher\": \"shell\",\n * \"hooks\": [ { \"type\": \"command\", \"command\": \"…\", \"timeout\": 30 } ] } ] } }\n *\n * The shape, not the event COVERAGE. Four of the thirty-three documented events are fired by this\n * runtime — see {@link CLAUDE_CODE_EVENT_MAP} for which, why the rest are refused rather than\n * mapped, and the order in which they should be added. An event outside the set is reported to the\n * operator rather than skipped in silence.\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, diagFailure } 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 * The Claude Code event names this runtime actually FIRES, and the internal event each becomes.\n *\n * Exported so the supported set is stated rather than implied. It used to be private, and the\n * docblock above claimed a shape \"identical to Claude Code's `settings.json` hooks\" while accepting\n * four of the thirty-three documented events — a claim nothing could contradict.\n *\n * A Claude Code event with no firing point here — `SessionStart`, `SubagentStop`, `PreCompact`,\n * `Notification`, `SessionEnd` among them — is skipped with a report rather than silently accepted,\n * because it would never run.\n *\n * ## Why this map is not simply grown\n *\n * Mapping a name the runtime does not fire is strictly WORSE than refusing it. An operator declaring\n * `PreCompact` today gets a report saying it will not fire; with the name mapped they would get\n * silence and a guard that never runs — a declared veto that does not exist. The map grows when the\n * seam exists, one event at a time.\n *\n * ## Priority, when it does grow\n *\n * The blocking events first. An unwired veto loses a CAPABILITY; an unwired observer loses a\n * SIGNAL. Thirteen of the sixteen the spec marks \"Can block? Yes\" are unwired, and\n * `tests/internal/runtime/hooks/the-supported-event-set-is-stated.test.ts` lists them in the order\n * they should be taken, so the next person does not re-derive which is which.\n *\n * `postRun` is reachable through this SDK's own config and has no entry here on purpose: it fires\n * per RUN, and no documented Claude Code event means that. `SessionEnd` is the near miss, and a\n * session is not a run.\n */\nexport const 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/**\n * A warn-once that is NOT dropped when the host installed no diagnostics sink.\n *\n * `diag` is silent by default and that is right for chatter — a library must not assume the host's\n * stderr is a free-form log, because in a TUI it is the render surface. A configuration the operator\n * WROTE and this runtime will not honour is not chatter. `diagFailure`'s own docblock records the\n * precedent, `theokit-sdk#189`: an MCP server failed to start, the only report went to `diag()`, the\n * embedding UI never read it, and \"the user saw an agent with missing tools and no reason given\".\n *\n * A dropped hook is that shape with a sharper edge, because the missing thing is a guard: the\n * operator declared a refusal, it silently does not exist, and nothing distinguishes that from a\n * refusal that ran and approved.\n *\n * The asymmetry that decides it is quoted from the same place: a corrupted frame is visible and\n * recoverable, while a silently dropped failure is neither.\n *\n * @internal\n */\nexport function warnFailureOnce(key: string, message: string): void {\n if (warned.has(key)) return;\n warned.add(key);\n diagFailure(`${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 // The operator wrote this event and it will not fire. Reported through the channel that\n // survives an absent sink — see `warnFailureOnce`.\n warnFailureOnce(\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/**\n * Fields a Claude Code hook entry may declare that this runtime does not implement.\n *\n * Listed rather than lumped into \"unknown\" because the two are different facts to the operator\n * reading the error: a typo is theirs to fix, and a field written for another runtime is a tree\n * that was never going to work here. The same split is made for subagent frontmatter, for the same\n * reason — an operator migrating a `.claude/` tree learned one key per round trip otherwise.\n *\n * `if` is the one that made refusal the right answer rather than a warning. Dropped, it fails OPEN:\n * a deny hook narrowed to one dangerous command shape silently becomes a deny hook over every call\n * of that tool. Every other field in this set loses a convenience; this one inverts the intent.\n */\nconst UNIMPLEMENTED_CLAUDE_CODE_HOOK_FIELDS = new Set([\n \"if\",\n \"args\",\n \"statusMessage\",\n \"once\",\n \"async\",\n \"asyncRewake\",\n \"shell\",\n]);\n\n/** What `parseClaudeCodeCommand` reads. Anything else is refused. */\nconst ACCEPTED_HOOK_FIELDS = new Set([\"type\", \"command\", \"timeout\"]);\n\n/**\n * Refuse a hook entry that declares a field this parser does not read.\n *\n * The parser used to take `type`, `command` and `timeout` and discard the rest in silence, while\n * `packages/agents` — reading the same file one layer up — already refused an unknown key loudly\n * through a `.strict()` schema. Two layers disagreeing about whether a field is an error is bad on\n * its own; the permissive one being the layer that actually runs the hook is the defect.\n */\nfunction rejectUnreadHookFields(cmd: Record<string, unknown>, path: string, ccEvent: string): void {\n for (const key of Object.keys(cmd)) {\n if (ACCEPTED_HOOK_FIELDS.has(key)) continue;\n const origin = UNIMPLEMENTED_CLAUDE_CODE_HOOK_FIELDS.has(key)\n ? ` — \"${key}\" is a Claude Code hook field that this runtime does not implement. The same ` +\n `applies to: ${[...UNIMPLEMENTED_CLAUDE_CODE_HOOK_FIELDS].filter((f) => f !== key).join(\", \")}`\n : \"\";\n throw new ConfigurationError(\n `hooks.${ccEvent}: unsupported field \"${key}\" (accepted: ${[...ACCEPTED_HOOK_FIELDS].join(\", \")}) in ${path}${origin}`,\n { code: \"hooks_unsupported_field\" },\n );\n }\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 // After the type/command checks, so a `{ type: \"http\", url }` entry still fails for its own\n // reason rather than for its `url`.\n rejectUnreadHookFields(cmd, path, ccEvent);\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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkKRD3GQAA_cjs = require('./chunk-KRD3GQAA.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunk7KBNBPFK_cjs = require('./chunk-7KBNBPFK.cjs');
|
|
5
5
|
var chunk7A6535RA_cjs = require('./chunk-7A6535RA.cjs');
|
|
6
6
|
var chunkGZV6AVRL_cjs = require('./chunk-GZV6AVRL.cjs');
|
|
7
7
|
var chunkDQZU7JK6_cjs = require('./chunk-DQZU7JK6.cjs');
|
|
@@ -27,7 +27,7 @@ function projectMemoryDir(cwd) {
|
|
|
27
27
|
function claudeProjectMemoryDir(cwd) {
|
|
28
28
|
const home = process.env.CLAUDE_CONFIG_DIR?.trim();
|
|
29
29
|
const root = home !== void 0 && home.length > 0 ? home : path.join(os.homedir(), ".claude");
|
|
30
|
-
return path.join(root, "projects", chunkGZV6AVRL_cjs.encodeProjectDir(
|
|
30
|
+
return path.join(root, "projects", chunkGZV6AVRL_cjs.encodeProjectDir(chunk7KBNBPFK_cjs.findGitRoot(cwd) ?? cwd), "memory");
|
|
31
31
|
}
|
|
32
32
|
function resolveMemoryRoot(cwd, config) {
|
|
33
33
|
const declared = config?.directory;
|
|
@@ -691,7 +691,7 @@ function defaultIndexPath(root) {
|
|
|
691
691
|
}
|
|
692
692
|
function requireLance() {
|
|
693
693
|
try {
|
|
694
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
694
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-HNAYCTX4.cjs', document.baseURI).href)));
|
|
695
695
|
return r("@lancedb/lancedb");
|
|
696
696
|
} catch (cause) {
|
|
697
697
|
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
@@ -839,5 +839,5 @@ exports.sha256 = sha256;
|
|
|
839
839
|
exports.truncateSnippet = truncateSnippet;
|
|
840
840
|
exports.wikiDir = wikiDir;
|
|
841
841
|
exports.writeSessionSummary = writeSessionSummary;
|
|
842
|
-
//# sourceMappingURL=chunk-
|
|
843
|
-
//# sourceMappingURL=chunk-
|
|
842
|
+
//# sourceMappingURL=chunk-HNAYCTX4.cjs.map
|
|
843
|
+
//# sourceMappingURL=chunk-HNAYCTX4.cjs.map
|