@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.
- package/README.md +21 -21
- package/SKILL.md +3 -3
- package/dist/{chunk-FTW4ZCBA.js → chunk-2AKDX4RU.js} +1 -1
- package/dist/{chunk-D3ZDZZYS.js → chunk-2JA524SC.js} +31 -17
- package/dist/{chunk-I3J344DF.js → chunk-4L7TAM5S.js} +122 -287
- package/dist/{chunk-3TIKBQHV.js → chunk-5BQ2NEMP.js} +2741 -2540
- package/dist/{chunk-LEUZDTNT.js → chunk-A6M2M5A2.js} +1 -1
- package/dist/{chunk-JKJ22ONL.js → chunk-CCGFRNAA.js} +6 -6
- package/dist/{chunk-CXMLAWC2.js → chunk-CSE44DPA.js} +2 -2
- package/dist/{chunk-NEQI2VLM.js → chunk-D235RJNO.js} +5 -5
- package/dist/{chunk-4SN5BCIG.js → chunk-GYQOZGGF.js} +2 -2
- package/dist/{chunk-LLKJAET2.js → chunk-HXICZG5J.js} +8 -16
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/chunk-KZB4ABIB.js +13 -0
- package/dist/{chunk-KGBMU76T.js → chunk-LBCPRHNG.js} +1 -1
- package/dist/{chunk-HMD5K6W7.js → chunk-LTTF4MBE.js} +2 -2
- package/dist/{chunk-JKO6PZWQ.js → chunk-MWNRXAEB.js} +26 -48
- package/dist/{chunk-6IRAGUYK.js → chunk-NQFRQ56V.js} +2 -2
- package/dist/{chunk-XG7S3LIL.js → chunk-P2O7NLVN.js} +887 -918
- package/dist/{chunk-J5HBSRAV.js → chunk-SLDZJD6Q.js} +1 -1
- package/dist/{chunk-4OEJ2ONG.js → chunk-TC4FTRYO.js} +2 -13
- package/dist/{chunk-6JHKKLA2.js → chunk-U67RBNIZ.js} +46 -46
- package/dist/{chunk-S55JKCHQ.js → chunk-VOC4KOOP.js} +2 -2
- package/dist/chunk-W27EFR7W.js +271 -0
- package/dist/{chunk-RLBASQJD.js → chunk-XWAKFL3T.js} +9 -7
- package/dist/daemon/server.js +2733 -2531
- package/dist/hook-runtime/daemon/server.js +2734 -2531
- package/dist/hook-runtime/hooks/post-commit.js +2741 -2538
- package/dist/hook-runtime/hooks/post-rewrite.js +2741 -2538
- package/dist/hook-runtime/hooks/post-tool-use.js +2883 -2579
- package/dist/hook-runtime/hooks/pre-commit.js +1 -0
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +35089 -0
- package/dist/hook-runtime/hooks/pre-tool-use.js +109 -35539
- package/dist/hook-runtime/hooks/prim-hook.js +2875 -2571
- package/dist/hook-runtime/hooks/session-end.js +19 -16
- package/dist/hook-runtime/hooks/session-start.js +2834 -2632
- package/dist/hook-runtime/index.js +3030 -2830
- package/dist/hook-runtime/statusline-main.js +6 -2
- package/dist/hooks/post-commit.js +8 -7
- package/dist/hooks/post-rewrite.js +7 -6
- package/dist/hooks/post-tool-use.js +26 -22
- package/dist/hooks/pre-commit.js +5 -4
- package/dist/hooks/pre-tool-use-worker.js +264 -0
- package/dist/hooks/pre-tool-use.js +93 -250
- package/dist/hooks/prim-hook.js +26 -22
- package/dist/hooks/session-end.js +10 -7
- package/dist/hooks/session-start.js +22 -19
- package/dist/index.js +59 -54
- package/dist/statusline-main.js +5 -2
- package/package.json +3 -3
|
@@ -1,269 +1,112 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
PreflightPausedError,
|
|
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";
|
|
3
|
+
parseAgent
|
|
4
|
+
} from "../chunk-KZB4ABIB.js";
|
|
17
5
|
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
6
|
readHookMode
|
|
36
|
-
} from "../chunk-
|
|
37
|
-
import "../chunk-
|
|
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";
|
|
7
|
+
} from "../chunk-W27EFR7W.js";
|
|
8
|
+
import "../chunk-JSBRDJBE.js";
|
|
61
9
|
|
|
62
10
|
// src/hooks/pre-tool-use.ts
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var
|
|
11
|
+
import { spawn } from "child_process";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
13
|
+
var BUDGET_MS = 2e3;
|
|
14
|
+
var OUTPUT_RESERVE_MS = 150;
|
|
15
|
+
var MAX_OUTPUT_BYTES = 262144;
|
|
66
16
|
var agent = parseAgent(process.argv);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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;
|
|
17
|
+
var silent = agent === "cursor" ? { permission: "allow" } : agent === "claude_code" ? {
|
|
18
|
+
hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "allow" }
|
|
19
|
+
} : {};
|
|
20
|
+
var remaining = Math.max(0, BUDGET_MS - process.uptime() * 1e3 - OUTPUT_RESERVE_MS);
|
|
21
|
+
var child;
|
|
22
|
+
var finished = false;
|
|
23
|
+
var stdout = "";
|
|
24
|
+
var stderr = "";
|
|
25
|
+
var input = "";
|
|
26
|
+
var pauseReason = "[primitive] Operation paused: shell evaluation did not finish within two seconds. Retry the tool call to validate the current invocation.";
|
|
27
|
+
function fallback() {
|
|
28
|
+
if (readHookMode(process.env) === "off" || agent !== "claude_code" && agent !== "codex")
|
|
29
|
+
return silent;
|
|
123
30
|
try {
|
|
124
|
-
|
|
31
|
+
const envelope = JSON.parse(input);
|
|
32
|
+
if (envelope?.hook_event_name !== "PreToolUse" || envelope?.tool_name !== "Bash") return silent;
|
|
125
33
|
} catch {
|
|
126
|
-
|
|
127
|
-
return;
|
|
34
|
+
return silent;
|
|
128
35
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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");
|
|
36
|
+
return {
|
|
37
|
+
hookSpecificOutput: {
|
|
38
|
+
hookEventName: "PreToolUse",
|
|
39
|
+
permissionDecision: "deny",
|
|
40
|
+
permissionDecisionReason: pauseReason
|
|
143
41
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
process.stdin.setEncoding("utf8").on("data", (chunk) => {
|
|
45
|
+
input += chunk;
|
|
46
|
+
});
|
|
47
|
+
function stopWorker() {
|
|
48
|
+
if (!child?.pid) return;
|
|
148
49
|
try {
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
50
|
+
if (process.platform !== "win32") process.kill(-child.pid, "SIGKILL");
|
|
51
|
+
else child.kill("SIGKILL");
|
|
153
52
|
} catch {
|
|
154
53
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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 emit(failOpen());
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (agent === "cursor" && targets.coverage === "unverified") {
|
|
185
|
-
await emitUnverified("tool targets were ambiguous or outside the active repository");
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const binding = repoSyncId(cwd);
|
|
189
|
-
const branch = currentBranch(cwd);
|
|
190
|
-
const sessionId = envelope.session_id;
|
|
191
|
-
const callId = invocationId(envelope);
|
|
192
|
-
if (!binding || typeof sessionId !== "string" || !sessionId || !callId) {
|
|
193
|
-
await emitUnverified(
|
|
194
|
-
"GitHub repo connection is required for repository-specific file attribution, Conflict Gate verification, and commit correlation; or tool invocation identity is unavailable"
|
|
195
|
-
);
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
const collectScopeAdmits = cachedCollectScopeAdmits(cwd, {
|
|
199
|
-
repository: githubRepositoryFullName(cwd) ?? void 0,
|
|
200
|
-
branch,
|
|
201
|
-
agent,
|
|
202
|
-
paths: targets.paths,
|
|
203
|
-
pathsComplete: targets.coverage === "complete"
|
|
204
|
-
});
|
|
205
|
-
const request = {
|
|
206
|
-
protocolVersion: PREFLIGHT_PROTOCOL_VERSION,
|
|
207
|
-
operation: "start",
|
|
208
|
-
toolInputDigest: toolInputDigest(toolName, envelope.tool_input),
|
|
209
|
-
agent,
|
|
210
|
-
clientMode: mode,
|
|
211
|
-
clientVersion: boundedClientVersion(packageVersion()),
|
|
212
|
-
sessionId,
|
|
213
|
-
invocationId: callId,
|
|
214
|
-
repoSyncId: binding,
|
|
215
|
-
paths: targets.paths,
|
|
216
|
-
coverage: targets.coverage,
|
|
217
|
-
...branch === void 0 ? {} : { branch },
|
|
218
|
-
proposal: collectScopeAdmits ? proposalFor(envelope.tool_input) : ""
|
|
219
|
-
};
|
|
220
|
-
let result;
|
|
54
|
+
}
|
|
55
|
+
function finish(output = fallback(), diagnostics = "") {
|
|
56
|
+
if (finished) return;
|
|
57
|
+
finished = true;
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
process.stdin.unpipe();
|
|
60
|
+
process.stdin.pause();
|
|
61
|
+
stopWorker();
|
|
62
|
+
if (diagnostics) process.stderr.write(diagnostics);
|
|
63
|
+
process.stdout.write(`${JSON.stringify(output)}
|
|
64
|
+
`, () => process.exit(0));
|
|
65
|
+
}
|
|
66
|
+
var timer = setTimeout(() => finish(), remaining);
|
|
67
|
+
process.once("SIGTERM", () => finish());
|
|
68
|
+
process.once("SIGINT", () => finish());
|
|
69
|
+
process.once("exit", stopWorker);
|
|
70
|
+
if (remaining <= 0) finish();
|
|
71
|
+
else {
|
|
221
72
|
try {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
)
|
|
73
|
+
child = spawn(
|
|
74
|
+
process.execPath,
|
|
75
|
+
[
|
|
76
|
+
fileURLToPath(new URL("./pre-tool-use-worker.js", import.meta.url)),
|
|
77
|
+
"--agent",
|
|
78
|
+
agent,
|
|
79
|
+
String(Date.now() + remaining - 50)
|
|
80
|
+
],
|
|
81
|
+
{
|
|
82
|
+
detached: process.platform !== "win32",
|
|
83
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
229
84
|
}
|
|
230
|
-
});
|
|
231
|
-
if (!hasCompleteCoverage(response)) {
|
|
232
|
-
await emitUnverified(response.message || response.reasonCode, response.checkId);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
result = resultForPreflight(
|
|
236
|
-
response,
|
|
237
|
-
editPreview(toolName, envelope.tool_input, targets.paths),
|
|
238
|
-
request,
|
|
239
|
-
collectScopeAdmits && (toolName === "Bash" || toolName === "Shell") && proposalIsTruncated(envelope.tool_input)
|
|
240
85
|
);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
86
|
+
child.on("error", () => finish());
|
|
87
|
+
child.stdin?.on("error", () => finish());
|
|
88
|
+
child.stderr?.setEncoding("utf8").on("data", (chunk) => {
|
|
89
|
+
stderr = (stderr + chunk).slice(0, MAX_OUTPUT_BYTES);
|
|
90
|
+
});
|
|
91
|
+
child.stdout?.setEncoding("utf8").on("data", (chunk) => {
|
|
92
|
+
stdout += chunk;
|
|
93
|
+
if (stdout.length > MAX_OUTPUT_BYTES) return finish();
|
|
94
|
+
if (!stdout.includes("\n")) return;
|
|
95
|
+
try {
|
|
96
|
+
const message = JSON.parse(stdout);
|
|
97
|
+
if (!message || typeof message !== "object" || !("output" in message) || !("confirmed" in message))
|
|
98
|
+
return finish();
|
|
99
|
+
if (!message.output || typeof message.output !== "object" || Array.isArray(message.output))
|
|
100
|
+
return finish();
|
|
101
|
+
if (message.confirmed === true) finish(message.output, stderr);
|
|
102
|
+
else finish();
|
|
103
|
+
} catch {
|
|
104
|
+
finish();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
child.on("exit", () => finish());
|
|
108
|
+
if (child.stdin) process.stdin.pipe(child.stdin);
|
|
109
|
+
} catch {
|
|
110
|
+
finish();
|
|
263
111
|
}
|
|
264
|
-
await emit(output);
|
|
265
112
|
}
|
|
266
|
-
main().catch(async () => {
|
|
267
|
-
if (activeMutation) await emitUnverified("The Decision check could not complete");
|
|
268
|
-
else await emit(failOpen());
|
|
269
|
-
});
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -8,59 +8,63 @@ import {
|
|
|
8
8
|
acknowledgeDecisionFeedback,
|
|
9
9
|
leaseDecisionFeedback,
|
|
10
10
|
renderFeedback
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-2AKDX4RU.js";
|
|
12
12
|
import {
|
|
13
13
|
recordConversationCaptured
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-LBCPRHNG.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-XWAKFL3T.js";
|
|
22
|
+
import {
|
|
23
|
+
prepareCodexContext
|
|
24
|
+
} from "../chunk-HXICZG5J.js";
|
|
25
|
+
import "../chunk-GYQOZGGF.js";
|
|
22
26
|
import {
|
|
23
27
|
postToolInvocationId,
|
|
24
28
|
shouldFlushAfter,
|
|
25
29
|
toMove
|
|
26
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-VOC4KOOP.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-LTTF4MBE.js";
|
|
38
|
+
import "../chunk-SLDZJD6Q.js";
|
|
34
39
|
import {
|
|
35
40
|
observeDemoInvocation
|
|
36
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-CSE44DPA.js";
|
|
37
42
|
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
normalizeEnvelope,
|
|
44
|
+
readHookStdin,
|
|
45
|
+
shouldSuppressImportedCursorHandler
|
|
46
|
+
} from "../chunk-TC4FTRYO.js";
|
|
47
|
+
import "../chunk-4L7TAM5S.js";
|
|
48
|
+
import "../chunk-MWNRXAEB.js";
|
|
42
49
|
import {
|
|
43
50
|
scrubFromCwd,
|
|
44
51
|
writeHookDebug
|
|
45
|
-
} from "../chunk-
|
|
52
|
+
} from "../chunk-NQFRQ56V.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-5BQ2NEMP.js";
|
|
56
|
+
import "../chunk-U67RBNIZ.js";
|
|
58
57
|
import {
|
|
59
58
|
currentBranch,
|
|
60
59
|
isRepoActiveForCapture,
|
|
61
60
|
repoSyncId,
|
|
62
61
|
resolveRepositoryContext
|
|
63
|
-
} from "../chunk-
|
|
62
|
+
} from "../chunk-P2O7NLVN.js";
|
|
63
|
+
import {
|
|
64
|
+
parseAgent
|
|
65
|
+
} from "../chunk-KZB4ABIB.js";
|
|
66
|
+
import "../chunk-W27EFR7W.js";
|
|
67
|
+
import "../chunk-JSBRDJBE.js";
|
|
64
68
|
|
|
65
69
|
// src/hooks/prim-hook.ts
|
|
66
70
|
import { spawn } from "child_process";
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
daemonRequest
|
|
4
|
+
} from "../chunk-SLDZJD6Q.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-TC4FTRYO.js";
|
|
10
|
+
import "../chunk-MWNRXAEB.js";
|
|
12
11
|
import {
|
|
13
12
|
isRepoActiveForCapture
|
|
14
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-P2O7NLVN.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-CCGFRNAA.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-2AKDX4RU.js";
|
|
21
21
|
import {
|
|
22
22
|
clearHooksWired,
|
|
23
23
|
recordHooksWired
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-LBCPRHNG.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-HXICZG5J.js";
|
|
29
|
+
import "../chunk-GYQOZGGF.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-SLDZJD6Q.js";
|
|
40
36
|
import {
|
|
41
37
|
normalizeEnvelope,
|
|
42
|
-
parseAgent,
|
|
43
38
|
readHookStdin,
|
|
44
39
|
shouldSuppressImportedCursorHandler
|
|
45
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-TC4FTRYO.js";
|
|
46
41
|
import {
|
|
47
42
|
MANAGED_GIT_HOOK_NAMES
|
|
48
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-MWNRXAEB.js";
|
|
49
44
|
import {
|
|
50
|
-
|
|
51
|
-
} from "../chunk-
|
|
45
|
+
fetchAndCacheCollectScope
|
|
46
|
+
} from "../chunk-5BQ2NEMP.js";
|
|
47
|
+
import {
|
|
48
|
+
getSiteUrl,
|
|
49
|
+
isSessionEnded
|
|
50
|
+
} from "../chunk-U67RBNIZ.js";
|
|
52
51
|
import {
|
|
53
52
|
gitToplevel,
|
|
54
53
|
isRepoActiveForCapture,
|
|
55
54
|
repoActiveFlag,
|
|
56
55
|
setRepoActive
|
|
57
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-P2O7NLVN.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";
|