@primitive.ai/prim 0.1.0-alpha.116 → 0.1.0-alpha.118
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/README.md +21 -21
- package/SKILL.md +3 -3
- package/dist/{chunk-XG7S3LIL.js → chunk-3NJ4FUPK.js} +889 -919
- package/dist/{chunk-J5HBSRAV.js → chunk-4HEWA4IO.js} +1 -1
- package/dist/{chunk-LEUZDTNT.js → chunk-B3FVP7VQ.js} +1 -1
- package/dist/{chunk-4OEJ2ONG.js → chunk-C2AEY4AI.js} +2 -13
- package/dist/{chunk-S55JKCHQ.js → chunk-C2AJBMP2.js} +2 -2
- package/dist/{chunk-D3ZDZZYS.js → chunk-CHRICRVE.js} +17 -10
- package/dist/{chunk-HMD5K6W7.js → chunk-ECP7EGOD.js} +2 -2
- package/dist/{chunk-FTW4ZCBA.js → chunk-FPDOBG3H.js} +1 -1
- package/dist/{chunk-3TIKBQHV.js → chunk-JGOFEG6T.js} +6 -4
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/{chunk-KGBMU76T.js → chunk-JXQVXU2K.js} +1 -1
- package/dist/chunk-KZB4ABIB.js +13 -0
- package/dist/{chunk-I3J344DF.js → chunk-L3NUFCOD.js} +5 -5
- package/dist/{chunk-6IRAGUYK.js → chunk-LEEWUN74.js} +2 -2
- package/dist/{chunk-JKJ22ONL.js → chunk-OHLVHT6R.js} +6 -6
- package/dist/{chunk-RLBASQJD.js → chunk-OIXHRN32.js} +4 -4
- package/dist/{chunk-LLKJAET2.js → chunk-PYIIYC3A.js} +8 -16
- package/dist/{chunk-NEQI2VLM.js → chunk-Q4CWXKNV.js} +5 -5
- package/dist/{chunk-4SN5BCIG.js → chunk-QX7QFMLF.js} +2 -2
- package/dist/{chunk-CXMLAWC2.js → chunk-SCOEPFOV.js} +2 -2
- package/dist/{chunk-6JHKKLA2.js → chunk-UMSJ4DU2.js} +46 -46
- package/dist/{chunk-JKO6PZWQ.js → chunk-VEI7KUOU.js} +26 -48
- package/dist/hook-runtime/daemon/server.js +1 -0
- package/dist/hook-runtime/hooks/post-commit.js +1 -0
- package/dist/hook-runtime/hooks/post-rewrite.js +1 -0
- package/dist/hook-runtime/hooks/post-tool-use.js +29 -29
- package/dist/hook-runtime/hooks/pre-commit.js +1 -0
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +34746 -0
- package/dist/hook-runtime/hooks/pre-tool-use.js +82 -35549
- package/dist/hook-runtime/hooks/prim-hook.js +22 -22
- package/dist/hook-runtime/hooks/session-end.js +14 -14
- package/dist/hook-runtime/hooks/session-start.js +100 -100
- package/dist/hook-runtime/index.js +244 -256
- package/dist/hook-runtime/statusline-main.js +1 -0
- package/dist/hooks/post-commit.js +8 -7
- package/dist/hooks/post-rewrite.js +7 -6
- package/dist/hooks/post-tool-use.js +25 -22
- package/dist/hooks/pre-commit.js +5 -4
- package/dist/hooks/pre-tool-use-worker.js +222 -0
- package/dist/hooks/pre-tool-use.js +73 -257
- package/dist/hooks/prim-hook.js +25 -22
- package/dist/hooks/session-end.js +10 -7
- package/dist/hooks/session-start.js +22 -19
- package/dist/index.js +54 -53
- package/package.json +3 -3
|
@@ -1,271 +1,87 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
boundedClientVersion,
|
|
7
|
-
editPreview,
|
|
8
|
-
hasCompleteCoverage,
|
|
9
|
-
pausedResult,
|
|
10
|
-
proposalFor,
|
|
11
|
-
proposalIsTruncated,
|
|
12
|
-
resolvePreflightTargets,
|
|
13
|
-
resultForPreflight,
|
|
14
|
-
toolInputDigest,
|
|
15
|
-
waitForPreflight
|
|
16
|
-
} from "../chunk-D3ZDZZYS.js";
|
|
17
|
-
import {
|
|
18
|
-
observeDemoInvocation
|
|
19
|
-
} from "../chunk-CXMLAWC2.js";
|
|
20
|
-
import {
|
|
21
|
-
appendCodexContext,
|
|
22
|
-
hasVisibleCodexMessage,
|
|
23
|
-
prepareCodexContext
|
|
24
|
-
} from "../chunk-LLKJAET2.js";
|
|
25
|
-
import {
|
|
26
|
-
buildCodexOutput,
|
|
27
|
-
buildCursorOutput,
|
|
28
|
-
buildHermesOutput,
|
|
29
|
-
buildHookOutput,
|
|
30
|
-
demoteForMode,
|
|
31
|
-
failOpenCodex,
|
|
32
|
-
failOpenCursor,
|
|
33
|
-
failOpenHermes,
|
|
34
|
-
failOpenOutput,
|
|
35
|
-
readHookMode
|
|
36
|
-
} from "../chunk-I3J344DF.js";
|
|
37
|
-
import "../chunk-4SN5BCIG.js";
|
|
38
|
-
import "../chunk-6IRAGUYK.js";
|
|
39
|
-
import {
|
|
40
|
-
cachedCollectScopeAdmits
|
|
41
|
-
} from "../chunk-3TIKBQHV.js";
|
|
42
|
-
import {
|
|
43
|
-
HttpError
|
|
44
|
-
} from "../chunk-6JHKKLA2.js";
|
|
45
|
-
import {
|
|
46
|
-
normalizeEnvelope,
|
|
47
|
-
parseAgent,
|
|
48
|
-
readHookStdin,
|
|
49
|
-
shouldSuppressImportedCursorHandler
|
|
50
|
-
} from "../chunk-4OEJ2ONG.js";
|
|
51
|
-
import "../chunk-JKO6PZWQ.js";
|
|
52
|
-
import "../chunk-J5HBSRAV.js";
|
|
53
|
-
import {
|
|
54
|
-
currentBranch,
|
|
55
|
-
githubRepositoryFullName,
|
|
56
|
-
isRepoActive,
|
|
57
|
-
packageVersion,
|
|
58
|
-
repoSyncId,
|
|
59
|
-
resolveAuthCredential
|
|
60
|
-
} from "../chunk-XG7S3LIL.js";
|
|
3
|
+
parseAgent
|
|
4
|
+
} from "../chunk-KZB4ABIB.js";
|
|
5
|
+
import "../chunk-JSBRDJBE.js";
|
|
61
6
|
|
|
62
7
|
// src/hooks/pre-tool-use.ts
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var
|
|
8
|
+
import { spawn } from "child_process";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
var BUDGET_MS = 2e3;
|
|
11
|
+
var OUTPUT_RESERVE_MS = 150;
|
|
12
|
+
var MAX_OUTPUT_BYTES = 262144;
|
|
66
13
|
var agent = parseAgent(process.argv);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
async function emitWithAcknowledgment(output, acknowledge) {
|
|
78
|
-
const handedOff = await emit(output);
|
|
79
|
-
await acknowledge?.(handedOff);
|
|
80
|
-
}
|
|
81
|
-
function failOpen() {
|
|
82
|
-
if (agent === "hermes") return failOpenHermes();
|
|
83
|
-
if (agent === "cursor") return failOpenCursor();
|
|
84
|
-
return agent === "codex" ? failOpenCodex() : failOpenOutput();
|
|
85
|
-
}
|
|
86
|
-
function invocationId(envelope) {
|
|
87
|
-
const value = agent === "hermes" ? envelope.extra?.tool_call_id : envelope.tool_use_id;
|
|
88
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
89
|
-
}
|
|
90
|
-
function hermesAdvisory(result, aggregate) {
|
|
91
|
-
const parts = [];
|
|
92
|
-
if (aggregate === "warn") parts.push(result.reason);
|
|
93
|
-
if (result.verdict === "unavailable") {
|
|
94
|
-
parts.push(result.unavailable ?? result.reason);
|
|
95
|
-
}
|
|
96
|
-
if (result.additionalContext && result.additionalContext !== result.reason) {
|
|
97
|
-
parts.push(result.additionalContext);
|
|
98
|
-
}
|
|
99
|
-
const message = [...new Set(parts.filter(Boolean))].join("\n");
|
|
100
|
-
return message.startsWith("[primitive]") ? message : message ? `[primitive] ${message}` : "";
|
|
101
|
-
}
|
|
102
|
-
function preflightFailure(error) {
|
|
103
|
-
if (!(error instanceof HttpError && error.status === 401)) {
|
|
104
|
-
return "enforcement service unavailable; change was not verified";
|
|
105
|
-
}
|
|
106
|
-
if (resolveAuthCredential()?.source === "environment") {
|
|
107
|
-
return "PRIM_TOKEN was rejected; change was not verified";
|
|
108
|
-
}
|
|
109
|
-
return "authentication required; run `prim auth login`; change was not verified";
|
|
110
|
-
}
|
|
111
|
-
async function emitUnverified(message, checkId) {
|
|
112
|
-
const result = pausedResult(message, checkId);
|
|
113
|
-
const output = agent === "hermes" ? buildHermesOutput("deny", [result]) : agent === "cursor" ? buildCursorOutput("deny", [result]) : agent === "codex" ? buildCodexOutput("deny", [result]) : buildHookOutput("deny", [result]);
|
|
114
|
-
await emit(output);
|
|
115
|
-
}
|
|
116
|
-
async function main() {
|
|
117
|
-
const mode = readHookMode(process.env);
|
|
118
|
-
if (mode === "off") {
|
|
119
|
-
await emit(failOpen());
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
let raw;
|
|
123
|
-
try {
|
|
124
|
-
raw = await readHookStdin(STDIN_TIMEOUT_MS);
|
|
125
|
-
} catch {
|
|
126
|
-
await emitUnverified("The tool input could not be read completely");
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
let envelope;
|
|
14
|
+
var silent = agent === "cursor" ? { permission: "allow" } : agent === "claude_code" ? {
|
|
15
|
+
hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "allow" }
|
|
16
|
+
} : {};
|
|
17
|
+
var remaining = Math.max(0, BUDGET_MS - process.uptime() * 1e3 - OUTPUT_RESERVE_MS);
|
|
18
|
+
var child;
|
|
19
|
+
var finished = false;
|
|
20
|
+
var stdout = "";
|
|
21
|
+
var stderr = "";
|
|
22
|
+
function stopWorker() {
|
|
23
|
+
if (!child?.pid) return;
|
|
130
24
|
try {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
throw new Error("The hook envelope must be an object");
|
|
134
|
-
}
|
|
135
|
-
const fields = incoming;
|
|
136
|
-
if (agent !== "cursor" && shouldSuppressImportedCursorHandler(fields, "prim-pre-tool-use")) {
|
|
137
|
-
await emit(failOpenCursor());
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
envelope = normalizeEnvelope(fields, agent);
|
|
141
|
-
if (typeof envelope.hook_event_name !== "string" || !envelope.hook_event_name) {
|
|
142
|
-
throw new Error("The hook event identity is unavailable");
|
|
143
|
-
}
|
|
25
|
+
if (process.platform !== "win32") process.kill(-child.pid, "SIGKILL");
|
|
26
|
+
else child.kill("SIGKILL");
|
|
144
27
|
} catch {
|
|
145
|
-
await emitUnverified("The tool invocation could not be identified safely");
|
|
146
|
-
return;
|
|
147
28
|
}
|
|
29
|
+
}
|
|
30
|
+
function finish(output = silent, diagnostics = "") {
|
|
31
|
+
if (finished) return;
|
|
32
|
+
finished = true;
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
process.stdin.unpipe();
|
|
35
|
+
process.stdin.pause();
|
|
36
|
+
stopWorker();
|
|
37
|
+
if (diagnostics) process.stderr.write(diagnostics);
|
|
38
|
+
process.stdout.write(`${JSON.stringify(output)}
|
|
39
|
+
`, () => process.exit(0));
|
|
40
|
+
}
|
|
41
|
+
var timer = setTimeout(() => finish(), remaining);
|
|
42
|
+
process.once("SIGTERM", () => finish());
|
|
43
|
+
process.once("SIGINT", () => finish());
|
|
44
|
+
process.once("exit", stopWorker);
|
|
45
|
+
if (remaining <= 0) finish();
|
|
46
|
+
else {
|
|
148
47
|
try {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const toolName = envelope.tool_name;
|
|
164
|
-
const cwd = typeof envelope.cwd === "string" && envelope.cwd.length > 0 ? envelope.cwd : process.cwd();
|
|
165
|
-
const targets = resolvePreflightTargets({
|
|
166
|
-
toolName,
|
|
167
|
-
toolInput: envelope.tool_input,
|
|
168
|
-
agent,
|
|
169
|
-
cwd
|
|
170
|
-
});
|
|
171
|
-
if (targets.mutation === "none") {
|
|
172
|
-
await emit(failOpen());
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
if (!isRepoActive(cwd)) {
|
|
176
|
-
await emit(failOpen());
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
activeMutation = true;
|
|
180
|
-
if (targets.paths.length === 0 && !targets.definite) {
|
|
181
|
-
await emitUnverified(
|
|
182
|
-
"shell command write targets could not be determined; change was not verified"
|
|
183
|
-
);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (agent === "cursor" && targets.coverage === "unverified") {
|
|
187
|
-
await emitUnverified("tool targets were ambiguous or outside the active repository");
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const binding = repoSyncId(cwd);
|
|
191
|
-
const branch = currentBranch(cwd);
|
|
192
|
-
const sessionId = envelope.session_id;
|
|
193
|
-
const callId = invocationId(envelope);
|
|
194
|
-
if (!binding || typeof sessionId !== "string" || !sessionId || !callId) {
|
|
195
|
-
await emitUnverified(
|
|
196
|
-
"GitHub repo connection is required for repository-specific file attribution, Conflict Gate verification, and commit correlation; or tool invocation identity is unavailable"
|
|
48
|
+
child = spawn(
|
|
49
|
+
process.execPath,
|
|
50
|
+
[
|
|
51
|
+
fileURLToPath(new URL("./pre-tool-use-worker.js", import.meta.url)),
|
|
52
|
+
"--agent",
|
|
53
|
+
agent,
|
|
54
|
+
String(Date.now() + remaining - 50)
|
|
55
|
+
],
|
|
56
|
+
{
|
|
57
|
+
detached: process.platform !== "win32",
|
|
58
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
59
|
+
}
|
|
197
60
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
paths: targets.paths,
|
|
218
|
-
coverage: targets.coverage,
|
|
219
|
-
...branch === void 0 ? {} : { branch },
|
|
220
|
-
proposal: collectScopeAdmits ? proposalFor(envelope.tool_input) : ""
|
|
221
|
-
};
|
|
222
|
-
let result;
|
|
223
|
-
try {
|
|
224
|
-
const response = await waitForPreflight(request, {
|
|
225
|
-
deadline,
|
|
226
|
-
onProgress: ({ evaluationCoverage: coverage }) => {
|
|
227
|
-
process.stderr.write(
|
|
228
|
-
`[primitive] Checking Decisions: ${coverage.evaluatedCount + coverage.bypassedCount}/${coverage.candidateCount}${coverage.discoveryComplete ? "" : "+"} covered.
|
|
229
|
-
`
|
|
230
|
-
);
|
|
61
|
+
child.on("error", () => finish());
|
|
62
|
+
child.stdin?.on("error", () => finish());
|
|
63
|
+
child.stderr?.setEncoding("utf8").on("data", (chunk) => {
|
|
64
|
+
stderr = (stderr + chunk).slice(0, MAX_OUTPUT_BYTES);
|
|
65
|
+
});
|
|
66
|
+
child.stdout?.setEncoding("utf8").on("data", (chunk) => {
|
|
67
|
+
stdout += chunk;
|
|
68
|
+
if (stdout.length > MAX_OUTPUT_BYTES) return finish();
|
|
69
|
+
if (!stdout.includes("\n")) return;
|
|
70
|
+
try {
|
|
71
|
+
const message = JSON.parse(stdout);
|
|
72
|
+
if (!message || typeof message !== "object" || !("output" in message) || !("confirmed" in message))
|
|
73
|
+
return finish();
|
|
74
|
+
if (!message.output || typeof message.output !== "object" || Array.isArray(message.output))
|
|
75
|
+
return finish();
|
|
76
|
+
if (message.confirmed === true) finish(message.output, stderr);
|
|
77
|
+
else finish();
|
|
78
|
+
} catch {
|
|
79
|
+
finish();
|
|
231
80
|
}
|
|
232
81
|
});
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
result = resultForPreflight(
|
|
238
|
-
response,
|
|
239
|
-
editPreview(toolName, envelope.tool_input, targets.paths),
|
|
240
|
-
request,
|
|
241
|
-
collectScopeAdmits && (toolName === "Bash" || toolName === "Shell") && proposalIsTruncated(envelope.tool_input)
|
|
242
|
-
);
|
|
243
|
-
} catch (error) {
|
|
244
|
-
await emitUnverified(
|
|
245
|
-
error instanceof PreflightPausedError ? error.message : preflightFailure(error),
|
|
246
|
-
error instanceof PreflightPausedError ? error.checkId : void 0
|
|
247
|
-
);
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
const aggregate = demoteForMode(result.verdict === "unavailable" ? "deny" : result.verdict, mode);
|
|
251
|
-
if (agent === "hermes" && aggregate !== "deny" && aggregate !== "ask") {
|
|
252
|
-
const advisory = hermesAdvisory(result, aggregate);
|
|
253
|
-
if (advisory) process.stderr.write(`${advisory}
|
|
254
|
-
`);
|
|
255
|
-
}
|
|
256
|
-
let output = agent === "hermes" ? buildHermesOutput(aggregate, [result]) : agent === "cursor" ? buildCursorOutput(aggregate, [result]) : agent === "codex" ? buildCodexOutput(aggregate, [result]) : buildHookOutput(aggregate, [result]);
|
|
257
|
-
if (agent === "codex" && hasVisibleCodexMessage(output) && typeof sessionId === "string" && sessionId.length > 0) {
|
|
258
|
-
try {
|
|
259
|
-
const context = await prepareCodexContext({ cwd, sessionId, includeDigest: false });
|
|
260
|
-
output = appendCodexContext(output, context.context);
|
|
261
|
-
await emitWithAcknowledgment(output, context.acknowledge);
|
|
262
|
-
return;
|
|
263
|
-
} catch {
|
|
264
|
-
}
|
|
82
|
+
child.on("exit", () => finish());
|
|
83
|
+
if (child.stdin) process.stdin.pipe(child.stdin);
|
|
84
|
+
} catch {
|
|
85
|
+
finish();
|
|
265
86
|
}
|
|
266
|
-
await emit(output);
|
|
267
87
|
}
|
|
268
|
-
main().catch(async () => {
|
|
269
|
-
if (activeMutation) await emitUnverified("The Decision check could not complete");
|
|
270
|
-
else await emit(failOpen());
|
|
271
|
-
});
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -8,59 +8,62 @@ import {
|
|
|
8
8
|
acknowledgeDecisionFeedback,
|
|
9
9
|
leaseDecisionFeedback,
|
|
10
10
|
renderFeedback
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-FPDOBG3H.js";
|
|
12
12
|
import {
|
|
13
13
|
recordConversationCaptured
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-JXQVXU2K.js";
|
|
15
15
|
import {
|
|
16
16
|
unattendedEnv
|
|
17
17
|
} from "../chunk-OYHYCK4K.js";
|
|
18
18
|
import {
|
|
19
19
|
enrichHookPayloadWithFileRefs,
|
|
20
20
|
preserveHookFileMetadata
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-OIXHRN32.js";
|
|
22
|
+
import {
|
|
23
|
+
prepareCodexContext
|
|
24
|
+
} from "../chunk-PYIIYC3A.js";
|
|
25
|
+
import "../chunk-QX7QFMLF.js";
|
|
22
26
|
import {
|
|
23
27
|
postToolInvocationId,
|
|
24
28
|
shouldFlushAfter,
|
|
25
29
|
toMove
|
|
26
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-C2AJBMP2.js";
|
|
27
31
|
import {
|
|
28
32
|
getOrCreateWorkspaceId
|
|
29
33
|
} from "../chunk-EZXEWFDG.js";
|
|
30
34
|
import {
|
|
31
35
|
appendMove,
|
|
32
36
|
resolveOrg
|
|
33
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-ECP7EGOD.js";
|
|
38
|
+
import "../chunk-4HEWA4IO.js";
|
|
34
39
|
import {
|
|
35
40
|
observeDemoInvocation
|
|
36
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-SCOEPFOV.js";
|
|
37
42
|
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
normalizeEnvelope,
|
|
44
|
+
readHookStdin,
|
|
45
|
+
shouldSuppressImportedCursorHandler
|
|
46
|
+
} from "../chunk-C2AEY4AI.js";
|
|
47
|
+
import "../chunk-L3NUFCOD.js";
|
|
48
|
+
import "../chunk-VEI7KUOU.js";
|
|
42
49
|
import {
|
|
43
50
|
scrubFromCwd,
|
|
44
51
|
writeHookDebug
|
|
45
|
-
} from "../chunk-
|
|
52
|
+
} from "../chunk-LEEWUN74.js";
|
|
46
53
|
import {
|
|
47
54
|
cachedCollectScopeAdmits
|
|
48
|
-
} from "../chunk-
|
|
49
|
-
import "../chunk-
|
|
50
|
-
import {
|
|
51
|
-
normalizeEnvelope,
|
|
52
|
-
parseAgent,
|
|
53
|
-
readHookStdin,
|
|
54
|
-
shouldSuppressImportedCursorHandler
|
|
55
|
-
} from "../chunk-4OEJ2ONG.js";
|
|
56
|
-
import "../chunk-JKO6PZWQ.js";
|
|
57
|
-
import "../chunk-J5HBSRAV.js";
|
|
55
|
+
} from "../chunk-JGOFEG6T.js";
|
|
56
|
+
import "../chunk-UMSJ4DU2.js";
|
|
58
57
|
import {
|
|
59
58
|
currentBranch,
|
|
60
59
|
isRepoActiveForCapture,
|
|
61
60
|
repoSyncId,
|
|
62
61
|
resolveRepositoryContext
|
|
63
|
-
} from "../chunk-
|
|
62
|
+
} from "../chunk-3NJ4FUPK.js";
|
|
63
|
+
import {
|
|
64
|
+
parseAgent
|
|
65
|
+
} from "../chunk-KZB4ABIB.js";
|
|
66
|
+
import "../chunk-JSBRDJBE.js";
|
|
64
67
|
|
|
65
68
|
// src/hooks/prim-hook.ts
|
|
66
69
|
import { spawn } from "child_process";
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
daemonRequest
|
|
4
|
+
} from "../chunk-4HEWA4IO.js";
|
|
2
5
|
import {
|
|
3
6
|
normalizeEnvelope,
|
|
4
|
-
parseAgent,
|
|
5
7
|
readHookStdin,
|
|
6
8
|
shouldSuppressImportedCursorHandler
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import {
|
|
10
|
-
daemonRequest
|
|
11
|
-
} from "../chunk-J5HBSRAV.js";
|
|
9
|
+
} from "../chunk-C2AEY4AI.js";
|
|
10
|
+
import "../chunk-VEI7KUOU.js";
|
|
12
11
|
import {
|
|
13
12
|
isRepoActiveForCapture
|
|
14
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-3NJ4FUPK.js";
|
|
14
|
+
import {
|
|
15
|
+
parseAgent
|
|
16
|
+
} from "../chunk-KZB4ABIB.js";
|
|
17
|
+
import "../chunk-JSBRDJBE.js";
|
|
15
18
|
|
|
16
19
|
// src/hooks/session-end.ts
|
|
17
20
|
var STDIN_TIMEOUT_MS = 1e3;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
kickDaemonEnsure,
|
|
8
8
|
refreshClaudePlugins,
|
|
9
9
|
warmBinCache
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-OHLVHT6R.js";
|
|
11
11
|
import {
|
|
12
12
|
buildHookOutput,
|
|
13
13
|
handoffHookOutput
|
|
@@ -17,44 +17,47 @@ import {
|
|
|
17
17
|
acknowledgeDecisionFeedback,
|
|
18
18
|
leaseDecisionFeedback,
|
|
19
19
|
renderFeedback
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-FPDOBG3H.js";
|
|
21
21
|
import {
|
|
22
22
|
clearHooksWired,
|
|
23
23
|
recordHooksWired
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-JXQVXU2K.js";
|
|
25
25
|
import "../chunk-OYHYCK4K.js";
|
|
26
|
-
import {
|
|
27
|
-
getOrCreateWorkspaceId
|
|
28
|
-
} from "../chunk-EZXEWFDG.js";
|
|
29
26
|
import {
|
|
30
27
|
prepareCodexContext
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-
|
|
28
|
+
} from "../chunk-PYIIYC3A.js";
|
|
29
|
+
import "../chunk-QX7QFMLF.js";
|
|
33
30
|
import {
|
|
34
|
-
|
|
35
|
-
} from "../chunk-
|
|
31
|
+
getOrCreateWorkspaceId
|
|
32
|
+
} from "../chunk-EZXEWFDG.js";
|
|
36
33
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} from "../chunk-6JHKKLA2.js";
|
|
34
|
+
daemonRequest
|
|
35
|
+
} from "../chunk-4HEWA4IO.js";
|
|
40
36
|
import {
|
|
41
37
|
normalizeEnvelope,
|
|
42
|
-
parseAgent,
|
|
43
38
|
readHookStdin,
|
|
44
39
|
shouldSuppressImportedCursorHandler
|
|
45
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-C2AEY4AI.js";
|
|
46
41
|
import {
|
|
47
42
|
MANAGED_GIT_HOOK_NAMES
|
|
48
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-VEI7KUOU.js";
|
|
49
44
|
import {
|
|
50
|
-
|
|
51
|
-
} from "../chunk-
|
|
45
|
+
fetchAndCacheCollectScope
|
|
46
|
+
} from "../chunk-JGOFEG6T.js";
|
|
47
|
+
import {
|
|
48
|
+
getSiteUrl,
|
|
49
|
+
isSessionEnded
|
|
50
|
+
} from "../chunk-UMSJ4DU2.js";
|
|
52
51
|
import {
|
|
53
52
|
gitToplevel,
|
|
54
53
|
isRepoActiveForCapture,
|
|
55
54
|
repoActiveFlag,
|
|
56
55
|
setRepoActive
|
|
57
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-3NJ4FUPK.js";
|
|
57
|
+
import {
|
|
58
|
+
parseAgent
|
|
59
|
+
} from "../chunk-KZB4ABIB.js";
|
|
60
|
+
import "../chunk-JSBRDJBE.js";
|
|
58
61
|
|
|
59
62
|
// src/hooks/reauth-notice.ts
|
|
60
63
|
var REAUTH_NOTICE = "[prim] authentication ended \u2014 run `prim auth login` to resume decision capture";
|