@primitive.ai/prim 0.1.0-alpha.117 → 0.1.0-alpha.119

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 (50) hide show
  1. package/README.md +21 -21
  2. package/SKILL.md +3 -3
  3. package/dist/{chunk-FTW4ZCBA.js → chunk-2AKDX4RU.js} +1 -1
  4. package/dist/{chunk-D3ZDZZYS.js → chunk-2JA524SC.js} +31 -17
  5. package/dist/{chunk-I3J344DF.js → chunk-4L7TAM5S.js} +122 -287
  6. package/dist/{chunk-3TIKBQHV.js → chunk-5BQ2NEMP.js} +2741 -2540
  7. package/dist/{chunk-LEUZDTNT.js → chunk-A6M2M5A2.js} +1 -1
  8. package/dist/{chunk-JKJ22ONL.js → chunk-CCGFRNAA.js} +6 -6
  9. package/dist/{chunk-CXMLAWC2.js → chunk-CSE44DPA.js} +2 -2
  10. package/dist/{chunk-NEQI2VLM.js → chunk-D235RJNO.js} +5 -5
  11. package/dist/{chunk-4SN5BCIG.js → chunk-GYQOZGGF.js} +2 -2
  12. package/dist/{chunk-LLKJAET2.js → chunk-HXICZG5J.js} +8 -16
  13. package/dist/chunk-JSBRDJBE.js +30 -0
  14. package/dist/chunk-KZB4ABIB.js +13 -0
  15. package/dist/{chunk-KGBMU76T.js → chunk-LBCPRHNG.js} +1 -1
  16. package/dist/{chunk-HMD5K6W7.js → chunk-LTTF4MBE.js} +2 -2
  17. package/dist/{chunk-JKO6PZWQ.js → chunk-MWNRXAEB.js} +26 -48
  18. package/dist/{chunk-6IRAGUYK.js → chunk-NQFRQ56V.js} +2 -2
  19. package/dist/{chunk-XG7S3LIL.js → chunk-P2O7NLVN.js} +887 -918
  20. package/dist/{chunk-J5HBSRAV.js → chunk-SLDZJD6Q.js} +1 -1
  21. package/dist/{chunk-4OEJ2ONG.js → chunk-TC4FTRYO.js} +2 -13
  22. package/dist/{chunk-6JHKKLA2.js → chunk-U67RBNIZ.js} +46 -46
  23. package/dist/{chunk-S55JKCHQ.js → chunk-VOC4KOOP.js} +2 -2
  24. package/dist/chunk-W27EFR7W.js +271 -0
  25. package/dist/{chunk-RLBASQJD.js → chunk-XWAKFL3T.js} +9 -7
  26. package/dist/daemon/server.js +2733 -2531
  27. package/dist/hook-runtime/daemon/server.js +2734 -2531
  28. package/dist/hook-runtime/hooks/post-commit.js +2741 -2538
  29. package/dist/hook-runtime/hooks/post-rewrite.js +2741 -2538
  30. package/dist/hook-runtime/hooks/post-tool-use.js +2883 -2579
  31. package/dist/hook-runtime/hooks/pre-commit.js +1 -0
  32. package/dist/hook-runtime/hooks/pre-tool-use-worker.js +35089 -0
  33. package/dist/hook-runtime/hooks/pre-tool-use.js +109 -35539
  34. package/dist/hook-runtime/hooks/prim-hook.js +2875 -2571
  35. package/dist/hook-runtime/hooks/session-end.js +19 -16
  36. package/dist/hook-runtime/hooks/session-start.js +2834 -2632
  37. package/dist/hook-runtime/index.js +3030 -2830
  38. package/dist/hook-runtime/statusline-main.js +6 -2
  39. package/dist/hooks/post-commit.js +8 -7
  40. package/dist/hooks/post-rewrite.js +7 -6
  41. package/dist/hooks/post-tool-use.js +26 -22
  42. package/dist/hooks/pre-commit.js +5 -4
  43. package/dist/hooks/pre-tool-use-worker.js +264 -0
  44. package/dist/hooks/pre-tool-use.js +93 -250
  45. package/dist/hooks/prim-hook.js +26 -22
  46. package/dist/hooks/session-end.js +10 -7
  47. package/dist/hooks/session-start.js +22 -19
  48. package/dist/index.js +59 -54
  49. package/dist/statusline-main.js +5 -2
  50. package/package.json +3 -3
@@ -2,7 +2,7 @@ import {
2
2
  decodeJwtPayload,
3
3
  primConfigDirectory,
4
4
  resolveAuthCredential
5
- } from "./chunk-XG7S3LIL.js";
5
+ } from "./chunk-P2O7NLVN.js";
6
6
 
7
7
  // src/daemon/principal.ts
8
8
  import { createHash } from "crypto";
@@ -2,20 +2,10 @@ import {
2
2
  cursorHooksPath,
3
3
  hasExactCursorHandler,
4
4
  readCursorHooks
5
- } from "./chunk-JKO6PZWQ.js";
5
+ } from "./chunk-MWNRXAEB.js";
6
6
  import {
7
7
  resolveRepositoryContext
8
- } from "./chunk-XG7S3LIL.js";
9
-
10
- // src/hooks/agent.ts
11
- function parseAgent(argv) {
12
- const i = argv.indexOf("--agent");
13
- const value = i !== -1 ? argv[i + 1] : void 0;
14
- if (value === "codex" || value === "cursor" || value === "hermes") {
15
- return value;
16
- }
17
- return "claude_code";
18
- }
8
+ } from "./chunk-P2O7NLVN.js";
19
9
 
20
10
  // src/hooks/cursor-coexistence.ts
21
11
  var CURSOR_EVENTS = /* @__PURE__ */ new Set([
@@ -257,7 +247,6 @@ function normalizeEnvelope(parsed, agent) {
257
247
  }
258
248
 
259
249
  export {
260
- parseAgent,
261
250
  shouldSuppressImportedCursorHandler,
262
251
  readHookStdin,
263
252
  normalizeEnvelope
@@ -23,7 +23,7 @@ import {
23
23
  syncDirectory,
24
24
  withFileLock,
25
25
  workosConnectTokenEndpoint
26
- } from "./chunk-XG7S3LIL.js";
26
+ } from "./chunk-P2O7NLVN.js";
27
27
 
28
28
  // src/decisions/identity.ts
29
29
  var PUBLIC_ID = /^dec_[0-9a-f]{8}$/u;
@@ -102,6 +102,51 @@ function publicDecisionResponse(value) {
102
102
  return replace(projected);
103
103
  }
104
104
 
105
+ // src/lib/terminal-safe.ts
106
+ function replaceIsolatedSurrogates(value) {
107
+ let out = "";
108
+ for (let index = 0; index < value.length; index += 1) {
109
+ const unit = value.charCodeAt(index);
110
+ if (unit >= 55296 && unit <= 56319) {
111
+ const next = value.charCodeAt(index + 1);
112
+ if (next >= 56320 && next <= 57343) {
113
+ out += value[index] + value[index + 1];
114
+ index += 1;
115
+ } else {
116
+ out += "\uFFFD";
117
+ }
118
+ } else if (unit >= 56320 && unit <= 57343) {
119
+ out += "\uFFFD";
120
+ } else {
121
+ out += value[index];
122
+ }
123
+ }
124
+ return out;
125
+ }
126
+ function isUnsafeTerminalCodePoint(point) {
127
+ const c0OrC1 = point <= 31 || point >= 127 && point <= 159;
128
+ const bidiOrZeroWidth = point === 173 || // soft hyphen
129
+ point === 1564 || // Arabic letter mark
130
+ point === 6158 || // Mongolian vowel separator
131
+ point >= 8203 && point <= 8207 || // zero-width + directional marks
132
+ point >= 8234 && point <= 8238 || // bidi embeddings/overrides
133
+ point >= 8288 && point <= 8303 || // word joiner + bidi isolates/controls
134
+ point >= 65529 && point <= 65531 || // interlinear annotation controls
135
+ point === 65279 || // zero-width no-break space / BOM
136
+ point >= 917504 && point <= 917631;
137
+ return c0OrC1 || bidiOrZeroWidth;
138
+ }
139
+ function terminalSafeText(value) {
140
+ return Array.from(replaceIsolatedSurrogates(value)).filter((character) => !isUnsafeTerminalCodePoint(character.codePointAt(0) ?? 0)).join("");
141
+ }
142
+ function terminalSafeLine(value) {
143
+ return terminalSafeText(value.replace(/\s+/gu, " ")).replace(/\s+/gu, " ").trim();
144
+ }
145
+ function isTerminalSafeText(value) {
146
+ return terminalSafeText(value) === value;
147
+ }
148
+ var stripControlChars = terminalSafeText;
149
+
105
150
  // src/client.ts
106
151
  import { createHash } from "crypto";
107
152
  import { chmodSync as chmodSync2, existsSync, mkdirSync, readFileSync as readFileSync2, rmSync } from "fs";
@@ -206,51 +251,6 @@ async function ingestUploaderHeaders() {
206
251
  return headers;
207
252
  }
208
253
 
209
- // src/lib/terminal-safe.ts
210
- function replaceIsolatedSurrogates(value) {
211
- let out = "";
212
- for (let index = 0; index < value.length; index += 1) {
213
- const unit = value.charCodeAt(index);
214
- if (unit >= 55296 && unit <= 56319) {
215
- const next = value.charCodeAt(index + 1);
216
- if (next >= 56320 && next <= 57343) {
217
- out += value[index] + value[index + 1];
218
- index += 1;
219
- } else {
220
- out += "\uFFFD";
221
- }
222
- } else if (unit >= 56320 && unit <= 57343) {
223
- out += "\uFFFD";
224
- } else {
225
- out += value[index];
226
- }
227
- }
228
- return out;
229
- }
230
- function isUnsafeTerminalCodePoint(point) {
231
- const c0OrC1 = point <= 31 || point >= 127 && point <= 159;
232
- const bidiOrZeroWidth = point === 173 || // soft hyphen
233
- point === 1564 || // Arabic letter mark
234
- point === 6158 || // Mongolian vowel separator
235
- point >= 8203 && point <= 8207 || // zero-width + directional marks
236
- point >= 8234 && point <= 8238 || // bidi embeddings/overrides
237
- point >= 8288 && point <= 8303 || // word joiner + bidi isolates/controls
238
- point >= 65529 && point <= 65531 || // interlinear annotation controls
239
- point === 65279 || // zero-width no-break space / BOM
240
- point >= 917504 && point <= 917631;
241
- return c0OrC1 || bidiOrZeroWidth;
242
- }
243
- function terminalSafeText(value) {
244
- return Array.from(replaceIsolatedSurrogates(value)).filter((character) => !isUnsafeTerminalCodePoint(character.codePointAt(0) ?? 0)).join("");
245
- }
246
- function terminalSafeLine(value) {
247
- return terminalSafeText(value.replace(/\s+/gu, " ")).replace(/\s+/gu, " ").trim();
248
- }
249
- function isTerminalSafeText(value) {
250
- return terminalSafeText(value) === value;
251
- }
252
- var stripControlChars = terminalSafeText;
253
-
254
254
  // src/client.ts
255
255
  var CONFIG_DIR_MODE = 448;
256
256
  var CREDENTIAL_FILE_MODE = 384;
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-EZXEWFDG.js";
4
4
  import {
5
5
  scrubEnvironmentPaths
6
- } from "./chunk-6IRAGUYK.js";
6
+ } from "./chunk-NQFRQ56V.js";
7
7
  import {
8
8
  isValidRepoSyncId
9
- } from "./chunk-XG7S3LIL.js";
9
+ } from "./chunk-P2O7NLVN.js";
10
10
 
11
11
  // src/hooks/prim-hook-core.ts
12
12
  import { createHash, randomUUID } from "crypto";
@@ -0,0 +1,271 @@
1
+ // src/hooks/pre-tool-use-scoring.ts
2
+ import { isAbsolute, relative, sep } from "path";
3
+ function anyUnverified(results) {
4
+ return results.some((r) => r.verdict === "unavailable" || r.truncated);
5
+ }
6
+ function unverifiedNote(results) {
7
+ const causes = [];
8
+ const unavailable = results.find((r) => r.verdict === "unavailable");
9
+ if (unavailable) {
10
+ causes.push(
11
+ unavailable.unavailable ? `decision check skipped \u2014 ${unavailable.unavailable}` : "decision check skipped \u2014 not verified"
12
+ );
13
+ }
14
+ if (results.some((r) => r.truncated)) {
15
+ causes.push("decision check partial \u2014 conflict set truncated (per-file cap hit)");
16
+ }
17
+ return causes.map((c) => `[primitive] ${c}`).join("\n");
18
+ }
19
+ function blockingReason(results) {
20
+ const parts = results.filter((result) => result.verdict === "ask" || result.verdict === "deny").flatMap((result) => [result.reason, result.additionalContext]).filter((value) => value.length > 0);
21
+ return [...new Set(parts)].join("\n\n") || "[primitive] conflict detected (no detail available)";
22
+ }
23
+ function approvalReason(results) {
24
+ const summaries = results.filter((result) => result.verdict === "ask" || result.verdict === "deny").map((result) => result.reason).filter(Boolean);
25
+ return [
26
+ ...new Set(summaries),
27
+ "Approve runs this edit once; it does not change these decisions."
28
+ ].join("\n");
29
+ }
30
+ function agentContext(results) {
31
+ return [...new Set(results.map((result) => result.additionalContext).filter(Boolean))].join(
32
+ "\n\n"
33
+ );
34
+ }
35
+ function advisoryNote(aggregate, results) {
36
+ const details = results.flatMap((result) => [
37
+ ...aggregate === "warn" ? [result.reason] : [],
38
+ result.additionalContext
39
+ ]);
40
+ if (anyUnverified(results)) details.push(unverifiedNote(results));
41
+ return [...new Set(details.filter((value) => value.length > 0))].join("\n\n");
42
+ }
43
+ function buildHookOutput(aggregate, results) {
44
+ if (aggregate === "ask") {
45
+ const context = agentContext(results);
46
+ return {
47
+ hookSpecificOutput: {
48
+ hookEventName: "PreToolUse",
49
+ permissionDecision: "ask",
50
+ permissionDecisionReason: approvalReason(results),
51
+ ...context ? { additionalContext: context } : {}
52
+ }
53
+ };
54
+ }
55
+ if (aggregate === "deny") {
56
+ return {
57
+ hookSpecificOutput: {
58
+ hookEventName: "PreToolUse",
59
+ permissionDecision: aggregate,
60
+ permissionDecisionReason: blockingReason(results)
61
+ }
62
+ };
63
+ }
64
+ const notes = advisoryNote(aggregate, results);
65
+ if (notes.length > 0) {
66
+ return {
67
+ systemMessage: notes,
68
+ hookSpecificOutput: {
69
+ hookEventName: "PreToolUse",
70
+ permissionDecision: "allow",
71
+ additionalContext: notes
72
+ }
73
+ };
74
+ }
75
+ return {
76
+ hookSpecificOutput: {
77
+ hookEventName: "PreToolUse",
78
+ permissionDecision: "allow"
79
+ }
80
+ };
81
+ }
82
+ function buildCodexOutput(aggregate, results) {
83
+ if (aggregate === "deny" || aggregate === "ask") {
84
+ return {
85
+ hookSpecificOutput: {
86
+ hookEventName: "PreToolUse",
87
+ permissionDecision: "deny",
88
+ permissionDecisionReason: blockingReason(results)
89
+ }
90
+ };
91
+ }
92
+ const notes = advisoryNote(aggregate, results);
93
+ return notes ? {
94
+ systemMessage: notes,
95
+ hookSpecificOutput: { hookEventName: "PreToolUse", additionalContext: notes }
96
+ } : {};
97
+ }
98
+ function buildCursorOutput(aggregate, results) {
99
+ if (aggregate === "deny" || aggregate === "ask") {
100
+ const reason = blockingReason(results);
101
+ return { permission: "deny", user_message: reason, agent_message: reason };
102
+ }
103
+ const notes = advisoryNote(aggregate, results);
104
+ return notes ? { permission: "allow", agent_message: notes } : { permission: "allow" };
105
+ }
106
+ function failOpenOutput() {
107
+ return {
108
+ hookSpecificOutput: {
109
+ hookEventName: "PreToolUse",
110
+ permissionDecision: "allow"
111
+ }
112
+ };
113
+ }
114
+ function failOpenCodex() {
115
+ return {};
116
+ }
117
+ function failOpenCursor() {
118
+ return { permission: "allow" };
119
+ }
120
+ function buildHermesOutput(aggregate, results) {
121
+ if (aggregate !== "deny" && aggregate !== "ask") {
122
+ return {};
123
+ }
124
+ const reason = results.filter((r) => r.verdict === "deny" || r.verdict === "ask").map((r) => r.reason).filter((s) => s.length > 0).join("\n\n");
125
+ const directive = results.map((r) => r.additionalContext).filter((s) => s.length > 0 && s !== reason).join("\n");
126
+ const message = [reason, directive].filter((s) => s.length > 0).join("\n\n") || "[primitive] conflict detected (no detail available)";
127
+ return { action: "block", message };
128
+ }
129
+ function failOpenHermes() {
130
+ return {};
131
+ }
132
+ var SUPPORTED_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
133
+ var APPLY_PATCH_FILE_RE = /^\*\*\* (?:Update|Add|Delete) File: (?<path>.+)$/;
134
+ var MOVE_FILE_RE = /^\*\*\* Move File:\s*(?<src>.+?)\s*->\s*(?<dst>.+?)\s*$/;
135
+ var MOVE_TO_RE = /^\*\*\* Move to: (?<dst>.+)$/;
136
+ var LINE_SPLIT_RE = /\r?\n/;
137
+ function parseApplyPatchTargets(command) {
138
+ const paths = /* @__PURE__ */ new Set();
139
+ let activeUpdate = false;
140
+ let complete = true;
141
+ for (const line of command.split(LINE_SPLIT_RE)) {
142
+ const path = APPLY_PATCH_FILE_RE.exec(line)?.groups?.path;
143
+ if (path) {
144
+ paths.add(path);
145
+ activeUpdate = line.startsWith("*** Update File:");
146
+ continue;
147
+ }
148
+ const moveTo = MOVE_TO_RE.exec(line)?.groups?.dst;
149
+ if (moveTo) {
150
+ if (activeUpdate) paths.add(moveTo);
151
+ else complete = false;
152
+ activeUpdate = false;
153
+ continue;
154
+ }
155
+ const move = MOVE_FILE_RE.exec(line)?.groups;
156
+ if (move?.src) {
157
+ paths.add(move.src);
158
+ if (move.dst) {
159
+ paths.add(move.dst);
160
+ }
161
+ activeUpdate = false;
162
+ continue;
163
+ }
164
+ if (line === "*** Begin Patch" || line === "*** End Patch") activeUpdate = false;
165
+ else if (line.startsWith("*** ")) complete = false;
166
+ }
167
+ return { paths: [...paths], complete: complete && paths.size > 0 };
168
+ }
169
+ function extractCodexFileTargets(toolName, toolInput) {
170
+ if (toolName !== "apply_patch") {
171
+ return null;
172
+ }
173
+ const text = codexPatchText(toolInput);
174
+ return text !== null ? parseApplyPatchTargets(text) : { paths: [], complete: false };
175
+ }
176
+ function codexPatchText(toolInput) {
177
+ if (typeof toolInput === "string") return toolInput;
178
+ if (!toolInput || typeof toolInput !== "object") return null;
179
+ const input = toolInput;
180
+ for (const key of ["command", "input", "patch"]) {
181
+ const value = input[key];
182
+ if (typeof value === "string") return value;
183
+ }
184
+ return null;
185
+ }
186
+ var HERMES_EDITING_TOOLS = /* @__PURE__ */ new Set(["write_file", "patch"]);
187
+ function extractHermesFileTargets(toolName, toolInput) {
188
+ if (!HERMES_EDITING_TOOLS.has(toolName)) {
189
+ return null;
190
+ }
191
+ if (!toolInput || typeof toolInput !== "object") {
192
+ return { paths: [], complete: false };
193
+ }
194
+ const input = toolInput;
195
+ if (toolName === "patch" && input.mode === "patch") {
196
+ return typeof input.patch === "string" ? parseApplyPatchTargets(input.patch) : { paths: [], complete: false };
197
+ }
198
+ const paths = typeof input.path === "string" && input.path.length > 0 ? [input.path] : [];
199
+ const mode = input.mode;
200
+ return { paths, complete: paths.length > 0 && (mode === void 0 || mode === "replace") };
201
+ }
202
+ function extractCursorFileTargets(toolName, toolInput) {
203
+ if (toolName !== "Write" && toolName !== "Delete") return null;
204
+ if (!toolInput || typeof toolInput !== "object" || Array.isArray(toolInput)) {
205
+ return { paths: [], complete: false };
206
+ }
207
+ const input = toolInput;
208
+ const candidates = [input.file_path, input.path].filter(
209
+ (value) => typeof value === "string" && value.length > 0
210
+ );
211
+ const paths = [...new Set(candidates)];
212
+ return { paths, complete: paths.length === 1 };
213
+ }
214
+ function extractFileTargets(toolName, toolInput, agent = "claude_code") {
215
+ if (agent === "codex") {
216
+ return extractCodexFileTargets(toolName, toolInput);
217
+ }
218
+ if (agent === "cursor") {
219
+ return extractCursorFileTargets(toolName, toolInput);
220
+ }
221
+ if (agent === "hermes") {
222
+ return extractHermesFileTargets(toolName, toolInput);
223
+ }
224
+ if (!SUPPORTED_TOOLS.has(toolName)) {
225
+ return null;
226
+ }
227
+ if (!toolInput || typeof toolInput !== "object") {
228
+ return { paths: [], complete: false };
229
+ }
230
+ const input = toolInput;
231
+ if (toolName === "NotebookEdit") {
232
+ const paths2 = typeof input.notebook_path === "string" && input.notebook_path.length > 0 ? [input.notebook_path] : [];
233
+ return { paths: paths2, complete: paths2.length > 0 };
234
+ }
235
+ const paths = typeof input.file_path === "string" && input.file_path.length > 0 ? [input.file_path] : [];
236
+ return { paths, complete: paths.length > 0 };
237
+ }
238
+ function readHookMode(env) {
239
+ if (env.PRIM_BYPASS === "1" || env.PRIM_BYPASS === "true") {
240
+ return "off";
241
+ }
242
+ const mode = env.PRIM_HOOK_MODE;
243
+ if (mode === "off" || mode === "warn") {
244
+ return mode;
245
+ }
246
+ return "block";
247
+ }
248
+ function demoteForMode(verdict, mode) {
249
+ if (mode === "off") {
250
+ return "allow";
251
+ }
252
+ if (mode === "warn" && (verdict === "ask" || verdict === "deny")) {
253
+ return "warn";
254
+ }
255
+ return verdict;
256
+ }
257
+
258
+ export {
259
+ buildHookOutput,
260
+ buildCodexOutput,
261
+ buildCursorOutput,
262
+ failOpenOutput,
263
+ failOpenCodex,
264
+ failOpenCursor,
265
+ buildHermesOutput,
266
+ failOpenHermes,
267
+ parseApplyPatchTargets,
268
+ extractFileTargets,
269
+ readHookMode,
270
+ demoteForMode
271
+ };
@@ -2,22 +2,24 @@ import {
2
2
  getOrCreateWorkspaceId
3
3
  } from "./chunk-EZXEWFDG.js";
4
4
  import {
5
- analyzeShellTargets,
6
- extractFileTargets
7
- } from "./chunk-I3J344DF.js";
5
+ analyzeShellTargets
6
+ } from "./chunk-4L7TAM5S.js";
8
7
  import {
9
8
  scrubEnvironmentPaths
10
- } from "./chunk-6IRAGUYK.js";
9
+ } from "./chunk-NQFRQ56V.js";
11
10
  import {
12
11
  cachedCollectScopeAdmits
13
- } from "./chunk-3TIKBQHV.js";
12
+ } from "./chunk-5BQ2NEMP.js";
14
13
  import {
15
14
  canonicalRepositoryPath,
16
15
  currentBranch,
17
16
  isRepoActiveForCapture,
18
17
  relatedWorktreeTarget,
19
18
  repoSyncId
20
- } from "./chunk-XG7S3LIL.js";
19
+ } from "./chunk-P2O7NLVN.js";
20
+ import {
21
+ extractFileTargets
22
+ } from "./chunk-W27EFR7W.js";
21
23
 
22
24
  // src/hooks/file-refs.ts
23
25
  var MAX_PREFLIGHT_FILE_TARGETS = 25;
@@ -42,7 +44,7 @@ function preserveHookFileMetadata(payload, resolution) {
42
44
  function resolveHookFileRefs(args) {
43
45
  const isShellTool = (args.agent === "claude_code" || args.agent === "codex") && args.toolName === "Bash" || args.agent === "cursor" && args.toolName === "Shell";
44
46
  const command = isShellTool ? typeof args.toolInput === "string" ? args.toolInput : args.toolInput && typeof args.toolInput === "object" && typeof args.toolInput.command === "string" ? args.toolInput.command : void 0 : void 0;
45
- const shell = command === void 0 ? void 0 : analyzeShellTargets(command);
47
+ const shell = command === void 0 ? void 0 : analyzeShellTargets(command, args.cwd);
46
48
  const shellMutation = shell?.mutation === "none" ? "none" : shell?.coverage === "complete" ? "resolved" : shell ? "unresolved" : void 0;
47
49
  const readPath = args.agent === "claude_code" && args.toolName === "Read" && args.toolInput && typeof args.toolInput === "object" && typeof args.toolInput.file_path === "string" ? [args.toolInput.file_path] : void 0;
48
50
  const nativeTargets = shell ? null : readPath ? { paths: readPath, complete: true } : extractFileTargets(args.toolName, args.toolInput, args.agent);