@primitive.ai/prim 0.1.0-alpha.94 → 0.1.0-alpha.97
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 +7 -4
- package/dist/{chunk-UKUAAAXE.js → chunk-27ADT6FQ.js} +2 -2
- package/dist/{chunk-TYAHC25F.js → chunk-2MBV7ZMV.js} +1 -1
- package/dist/{chunk-OTHKG76J.js → chunk-35FMRWJH.js} +1 -1
- package/dist/{chunk-O7YAW7G6.js → chunk-3I4GEWXQ.js} +9 -11
- package/dist/{chunk-DXJQR4QI.js → chunk-4GHANPWQ.js} +2 -2
- package/dist/{chunk-WUXFLE7X.js → chunk-7KABYYWG.js} +64 -66
- package/dist/{chunk-LFFLHSQO.js → chunk-AJYZB5PF.js} +63 -6
- package/dist/{chunk-H4UNYFUC.js → chunk-DHOQGHKQ.js} +184 -1
- package/dist/{chunk-2GP5UFV7.js → chunk-DWRSEC34.js} +5 -3
- package/dist/{chunk-ZU563PQI.js → chunk-FBPZ4YUD.js} +2 -2
- package/dist/{chunk-G2VMA2QO.js → chunk-LY6NJ7KL.js} +6 -4
- package/dist/{chunk-ZB4F75SZ.js → chunk-MXVCP33E.js} +5 -1
- package/dist/{chunk-ICM2XCXS.js → chunk-OW4GJBLW.js} +2 -2
- package/dist/{chunk-K7D2EYBS.js → chunk-QNPTWTBG.js} +2 -2
- package/dist/{chunk-IMK4JKTA.js → chunk-RK4ZS3HG.js} +2 -2
- package/dist/{chunk-OH3EZXYX.js → chunk-UO2U6IKF.js} +1 -1
- package/dist/{chunk-FXF4JWK2.js → chunk-XEDJ5N3M.js} +17 -2
- package/dist/{chunk-AXQQMX2U.js → chunk-Y5W4TZM7.js} +2 -2
- package/dist/{chunk-DSWT6BCC.js → chunk-ZYK3TBEW.js} +2542 -2250
- package/dist/daemon/server.js +2547 -2119
- package/dist/hook-runtime/daemon/server.js +2547 -2119
- package/dist/hook-runtime/hooks/post-commit.js +2547 -2119
- package/dist/hook-runtime/hooks/post-rewrite.js +2547 -2119
- package/dist/hook-runtime/hooks/post-tool-use.js +2874 -2373
- package/dist/hook-runtime/hooks/pre-tool-use.js +3766 -3325
- package/dist/hook-runtime/hooks/prim-hook.js +2973 -2440
- package/dist/hook-runtime/hooks/session-end.js +179 -129
- package/dist/hook-runtime/hooks/session-start.js +2651 -2221
- package/dist/hook-runtime/index.js +2596 -2126
- package/dist/hooks/post-commit.js +11 -11
- package/dist/hooks/post-rewrite.js +10 -10
- package/dist/hooks/post-tool-use.js +20 -20
- package/dist/hooks/pre-commit.js +4 -4
- package/dist/hooks/pre-tool-use.js +29 -17
- package/dist/hooks/prim-hook.js +22 -18
- package/dist/hooks/session-end.js +11 -5
- package/dist/hooks/session-start.js +26 -22
- package/dist/index.js +79 -60
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
recordPostCommitFired
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XEDJ5N3M.js";
|
|
5
5
|
import {
|
|
6
6
|
unattendedEnv
|
|
7
7
|
} from "../chunk-OYHYCK4K.js";
|
|
8
8
|
import {
|
|
9
9
|
commitAttributionFromEnvironment,
|
|
10
10
|
toCommitMove
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-OW4GJBLW.js";
|
|
12
12
|
import {
|
|
13
13
|
getOrCreateWorkspaceId
|
|
14
14
|
} from "../chunk-EZXEWFDG.js";
|
|
15
15
|
import {
|
|
16
16
|
appendMove,
|
|
17
17
|
resolveOrg
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import "../chunk-
|
|
18
|
+
} from "../chunk-4GHANPWQ.js";
|
|
19
|
+
import "../chunk-QNPTWTBG.js";
|
|
20
20
|
import {
|
|
21
|
-
cachedCollectScopeAdmits
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from "../chunk-DSWT6BCC.js";
|
|
25
|
-
import "../chunk-G2VMA2QO.js";
|
|
21
|
+
cachedCollectScopeAdmits
|
|
22
|
+
} from "../chunk-ZYK3TBEW.js";
|
|
23
|
+
import "../chunk-LY6NJ7KL.js";
|
|
26
24
|
import {
|
|
27
25
|
githubRepositoryFullName,
|
|
26
|
+
isRepoActiveForCapture,
|
|
27
|
+
repoSyncId,
|
|
28
28
|
resolveRepositoryContext
|
|
29
|
-
} from "../chunk-
|
|
30
|
-
import "../chunk-
|
|
29
|
+
} from "../chunk-DHOQGHKQ.js";
|
|
30
|
+
import "../chunk-DWRSEC34.js";
|
|
31
31
|
|
|
32
32
|
// src/hooks/post-commit.ts
|
|
33
33
|
import { execFileSync, spawn } from "child_process";
|
|
@@ -5,26 +5,26 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
canonicalRewritePairs,
|
|
7
7
|
toRewriteMove
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-OW4GJBLW.js";
|
|
9
9
|
import {
|
|
10
10
|
getOrCreateWorkspaceId
|
|
11
11
|
} from "../chunk-EZXEWFDG.js";
|
|
12
12
|
import {
|
|
13
13
|
appendMove,
|
|
14
14
|
resolveOrg
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
} from "../chunk-4GHANPWQ.js";
|
|
16
|
+
import "../chunk-QNPTWTBG.js";
|
|
17
17
|
import {
|
|
18
|
-
cachedCollectScopeAdmits
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "../chunk-DSWT6BCC.js";
|
|
22
|
-
import "../chunk-G2VMA2QO.js";
|
|
18
|
+
cachedCollectScopeAdmits
|
|
19
|
+
} from "../chunk-ZYK3TBEW.js";
|
|
20
|
+
import "../chunk-LY6NJ7KL.js";
|
|
23
21
|
import {
|
|
24
22
|
githubRepositoryFullName,
|
|
23
|
+
isRepoActiveForCapture,
|
|
24
|
+
repoSyncId,
|
|
25
25
|
resolveRepositoryContext
|
|
26
|
-
} from "../chunk-
|
|
27
|
-
import "../chunk-
|
|
26
|
+
} from "../chunk-DHOQGHKQ.js";
|
|
27
|
+
import "../chunk-DWRSEC34.js";
|
|
28
28
|
|
|
29
29
|
// src/hooks/post-rewrite.ts
|
|
30
30
|
import { execFileSync, spawn } from "child_process";
|
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
requireDurableIngestAcknowledgement
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-2MBV7ZMV.js";
|
|
5
5
|
import {
|
|
6
6
|
enrichHookPayloadWithFileRefs,
|
|
7
7
|
preserveHookFileMetadata
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-AJYZB5PF.js";
|
|
9
9
|
import {
|
|
10
10
|
postToolInvocationId,
|
|
11
11
|
toMove,
|
|
12
12
|
toolOutcomeFor
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-OW4GJBLW.js";
|
|
14
14
|
import {
|
|
15
15
|
getOrCreateWorkspaceId
|
|
16
16
|
} from "../chunk-EZXEWFDG.js";
|
|
17
17
|
import {
|
|
18
18
|
appendMove,
|
|
19
19
|
resolveOrg
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
} from "../chunk-4GHANPWQ.js";
|
|
21
|
+
import "../chunk-MXVCP33E.js";
|
|
22
22
|
import {
|
|
23
23
|
appendCodexContext,
|
|
24
24
|
prepareCodexContext
|
|
25
|
-
} from "../chunk-
|
|
26
|
-
import "../chunk-
|
|
25
|
+
} from "../chunk-3I4GEWXQ.js";
|
|
26
|
+
import "../chunk-FBPZ4YUD.js";
|
|
27
27
|
import {
|
|
28
28
|
scrubFromCwd
|
|
29
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-QNPTWTBG.js";
|
|
30
30
|
import {
|
|
31
31
|
bold,
|
|
32
32
|
cachedCollectScopeAdmits,
|
|
33
|
-
color
|
|
34
|
-
|
|
35
|
-
repoSyncId
|
|
36
|
-
} from "../chunk-DSWT6BCC.js";
|
|
33
|
+
color
|
|
34
|
+
} from "../chunk-ZYK3TBEW.js";
|
|
37
35
|
import {
|
|
38
36
|
getClient,
|
|
39
37
|
terminalSafeLine
|
|
40
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-LY6NJ7KL.js";
|
|
41
39
|
import {
|
|
42
40
|
normalizeEnvelope,
|
|
43
41
|
parseAgent,
|
|
44
42
|
readHookStdin,
|
|
45
43
|
shouldSuppressImportedCursorHandler
|
|
46
|
-
} from "../chunk-
|
|
47
|
-
import "../chunk-
|
|
44
|
+
} from "../chunk-RK4ZS3HG.js";
|
|
45
|
+
import "../chunk-Y5W4TZM7.js";
|
|
48
46
|
import {
|
|
49
47
|
currentBranch,
|
|
48
|
+
isRepoActiveForCapture,
|
|
49
|
+
repoSyncId,
|
|
50
50
|
resolveRepositoryContext
|
|
51
|
-
} from "../chunk-
|
|
52
|
-
import "../chunk-
|
|
53
|
-
import "../chunk-
|
|
51
|
+
} from "../chunk-DHOQGHKQ.js";
|
|
52
|
+
import "../chunk-35FMRWJH.js";
|
|
53
|
+
import "../chunk-DWRSEC34.js";
|
|
54
54
|
|
|
55
55
|
// src/hooks/post-tool-use.ts
|
|
56
56
|
import { readFileSync } from "fs";
|
|
@@ -127,7 +127,7 @@ async function emitWithAcknowledgment(output, acknowledge) {
|
|
|
127
127
|
await acknowledge?.(handedOff);
|
|
128
128
|
}
|
|
129
129
|
async function emitCursorContext(envelope) {
|
|
130
|
-
if (typeof envelope.session_id !== "string" || envelope.session_id.length === 0 || typeof envelope.cwd !== "string" || envelope.cwd.length === 0) {
|
|
130
|
+
if (!isRepoActiveForCapture(envelope.cwd ?? process.cwd()) || typeof envelope.session_id !== "string" || envelope.session_id.length === 0 || typeof envelope.cwd !== "string" || envelope.cwd.length === 0) {
|
|
131
131
|
await emit();
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
@@ -225,7 +225,7 @@ async function main() {
|
|
|
225
225
|
await finish(agent, envelope);
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
-
if (resolution.shellMutation === void 0 && resolution.fileRefs.length === 0) {
|
|
228
|
+
if (resolution.shellMutation === void 0 && resolution.fileRefs.length === 0 && !resolution.targetCheckouts?.length) {
|
|
229
229
|
await finish(agent, envelope);
|
|
230
230
|
return;
|
|
231
231
|
}
|
package/dist/hooks/pre-commit.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
checkAffectedDecisions,
|
|
4
4
|
formatDecisionsWarning
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-27ADT6FQ.js";
|
|
6
|
+
import "../chunk-LY6NJ7KL.js";
|
|
7
|
+
import "../chunk-35FMRWJH.js";
|
|
8
|
+
import "../chunk-DWRSEC34.js";
|
|
9
9
|
|
|
10
10
|
// src/hooks/pre-commit.ts
|
|
11
11
|
import { execSync } from "child_process";
|
|
@@ -12,43 +12,46 @@ import {
|
|
|
12
12
|
failOpenHermes,
|
|
13
13
|
failOpenOutput,
|
|
14
14
|
readHookMode
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-MXVCP33E.js";
|
|
16
16
|
import {
|
|
17
17
|
appendCodexContext,
|
|
18
18
|
hasVisibleCodexMessage,
|
|
19
19
|
prepareCodexContext
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
} from "../chunk-3I4GEWXQ.js";
|
|
21
|
+
import "../chunk-FBPZ4YUD.js";
|
|
22
22
|
import {
|
|
23
23
|
DEFAULT_RULES,
|
|
24
24
|
scrub
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-QNPTWTBG.js";
|
|
26
26
|
import {
|
|
27
27
|
boundedHealthError,
|
|
28
|
-
cachedCollectScopeAdmits
|
|
29
|
-
|
|
30
|
-
repoSyncId
|
|
31
|
-
} from "../chunk-DSWT6BCC.js";
|
|
28
|
+
cachedCollectScopeAdmits
|
|
29
|
+
} from "../chunk-ZYK3TBEW.js";
|
|
32
30
|
import {
|
|
31
|
+
HttpError,
|
|
33
32
|
getClient
|
|
34
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-LY6NJ7KL.js";
|
|
35
34
|
import {
|
|
36
35
|
normalizeEnvelope,
|
|
37
36
|
parseAgent,
|
|
38
37
|
readHookStdin,
|
|
39
38
|
shouldSuppressImportedCursorHandler
|
|
40
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-RK4ZS3HG.js";
|
|
41
40
|
import {
|
|
42
41
|
packageVersion
|
|
43
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-Y5W4TZM7.js";
|
|
44
43
|
import {
|
|
45
44
|
canonicalGitRoot,
|
|
46
45
|
canonicalRepositoryPath,
|
|
47
46
|
currentBranch,
|
|
48
|
-
githubRepositoryFullName
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
githubRepositoryFullName,
|
|
48
|
+
isRepoActive,
|
|
49
|
+
repoSyncId
|
|
50
|
+
} from "../chunk-DHOQGHKQ.js";
|
|
51
|
+
import "../chunk-35FMRWJH.js";
|
|
52
|
+
import {
|
|
53
|
+
resolveAuthCredential
|
|
54
|
+
} from "../chunk-DWRSEC34.js";
|
|
52
55
|
|
|
53
56
|
// src/hooks/preflight-v3.ts
|
|
54
57
|
import { Buffer } from "buffer";
|
|
@@ -216,6 +219,15 @@ function hermesAdvisory(result, aggregate) {
|
|
|
216
219
|
const message = [...new Set(parts.filter(Boolean))].join("\n");
|
|
217
220
|
return message.startsWith("[primitive]") ? message : message ? `[primitive] ${message}` : "";
|
|
218
221
|
}
|
|
222
|
+
function preflightFailure(error) {
|
|
223
|
+
if (!(error instanceof HttpError && error.status === 401)) {
|
|
224
|
+
return "enforcement service unavailable; change was not verified";
|
|
225
|
+
}
|
|
226
|
+
if (resolveAuthCredential()?.source === "environment") {
|
|
227
|
+
return "PRIM_TOKEN was rejected; change was not verified";
|
|
228
|
+
}
|
|
229
|
+
return "authentication required; run `prim auth login`; change was not verified";
|
|
230
|
+
}
|
|
219
231
|
async function emitUnverified(message, envelope) {
|
|
220
232
|
const result = unverifiedResult(message);
|
|
221
233
|
if (agent === "hermes") {
|
|
@@ -337,8 +349,8 @@ async function main() {
|
|
|
337
349
|
return;
|
|
338
350
|
}
|
|
339
351
|
result = resultForPreflight(response);
|
|
340
|
-
} catch {
|
|
341
|
-
await emitUnverified(
|
|
352
|
+
} catch (error) {
|
|
353
|
+
await emitUnverified(preflightFailure(error), envelope);
|
|
342
354
|
return;
|
|
343
355
|
}
|
|
344
356
|
const aggregate = demoteForMode(
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -8,54 +8,57 @@ import {
|
|
|
8
8
|
acknowledgeDecisionFeedback,
|
|
9
9
|
leaseDecisionFeedback,
|
|
10
10
|
renderFeedback
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-UO2U6IKF.js";
|
|
12
|
+
import {
|
|
13
|
+
recordConversationCaptured
|
|
14
|
+
} from "../chunk-XEDJ5N3M.js";
|
|
12
15
|
import {
|
|
13
16
|
unattendedEnv
|
|
14
17
|
} from "../chunk-OYHYCK4K.js";
|
|
15
18
|
import {
|
|
16
19
|
enrichHookPayloadWithFileRefs,
|
|
17
20
|
preserveHookFileMetadata
|
|
18
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-AJYZB5PF.js";
|
|
19
22
|
import {
|
|
20
23
|
postToolInvocationId,
|
|
21
24
|
shouldFlushAfter,
|
|
22
25
|
toMove
|
|
23
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-OW4GJBLW.js";
|
|
24
27
|
import {
|
|
25
28
|
getOrCreateWorkspaceId
|
|
26
29
|
} from "../chunk-EZXEWFDG.js";
|
|
27
30
|
import {
|
|
28
31
|
appendMove,
|
|
29
32
|
resolveOrg
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-
|
|
33
|
+
} from "../chunk-4GHANPWQ.js";
|
|
34
|
+
import "../chunk-MXVCP33E.js";
|
|
32
35
|
import {
|
|
33
36
|
prepareCodexContext
|
|
34
|
-
} from "../chunk-
|
|
35
|
-
import "../chunk-
|
|
37
|
+
} from "../chunk-3I4GEWXQ.js";
|
|
38
|
+
import "../chunk-FBPZ4YUD.js";
|
|
36
39
|
import {
|
|
37
40
|
scrubFromCwd,
|
|
38
41
|
writeHookDebug
|
|
39
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-QNPTWTBG.js";
|
|
40
43
|
import {
|
|
41
|
-
cachedCollectScopeAdmits
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} from "../chunk-DSWT6BCC.js";
|
|
45
|
-
import "../chunk-G2VMA2QO.js";
|
|
44
|
+
cachedCollectScopeAdmits
|
|
45
|
+
} from "../chunk-ZYK3TBEW.js";
|
|
46
|
+
import "../chunk-LY6NJ7KL.js";
|
|
46
47
|
import {
|
|
47
48
|
normalizeEnvelope,
|
|
48
49
|
parseAgent,
|
|
49
50
|
readHookStdin,
|
|
50
51
|
shouldSuppressImportedCursorHandler
|
|
51
|
-
} from "../chunk-
|
|
52
|
-
import "../chunk-
|
|
52
|
+
} from "../chunk-RK4ZS3HG.js";
|
|
53
|
+
import "../chunk-Y5W4TZM7.js";
|
|
53
54
|
import {
|
|
54
55
|
currentBranch,
|
|
56
|
+
isRepoActiveForCapture,
|
|
57
|
+
repoSyncId,
|
|
55
58
|
resolveRepositoryContext
|
|
56
|
-
} from "../chunk-
|
|
57
|
-
import "../chunk-
|
|
58
|
-
import "../chunk-
|
|
59
|
+
} from "../chunk-DHOQGHKQ.js";
|
|
60
|
+
import "../chunk-35FMRWJH.js";
|
|
61
|
+
import "../chunk-DWRSEC34.js";
|
|
59
62
|
|
|
60
63
|
// src/hooks/prim-hook.ts
|
|
61
64
|
import { spawn } from "child_process";
|
|
@@ -176,6 +179,7 @@ async function main() {
|
|
|
176
179
|
};
|
|
177
180
|
const { orgId } = resolveOrg({ sessionId: move.sessionId, cwd });
|
|
178
181
|
appendMove(move, orgId);
|
|
182
|
+
if (move.eventType === "UserPromptSubmit") recordConversationCaptured(cwd, agent);
|
|
179
183
|
if (shouldFlushAfter(move.eventType, agent)) {
|
|
180
184
|
spawnBackgroundFlush();
|
|
181
185
|
}
|
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
4
|
parseAgent,
|
|
5
5
|
readHookStdin,
|
|
6
6
|
shouldSuppressImportedCursorHandler
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import
|
|
7
|
+
} from "../chunk-RK4ZS3HG.js";
|
|
8
|
+
import "../chunk-Y5W4TZM7.js";
|
|
9
|
+
import {
|
|
10
|
+
isRepoActiveForCapture
|
|
11
|
+
} from "../chunk-DHOQGHKQ.js";
|
|
10
12
|
import {
|
|
11
13
|
daemonRequest
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-35FMRWJH.js";
|
|
15
|
+
import "../chunk-DWRSEC34.js";
|
|
14
16
|
|
|
15
17
|
// src/hooks/session-end.ts
|
|
16
18
|
var STDIN_TIMEOUT_MS = 1e3;
|
|
@@ -47,6 +49,10 @@ async function main() {
|
|
|
47
49
|
emit();
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
52
|
+
if (!isRepoActiveForCapture(envelope.cwd ?? process.cwd())) {
|
|
53
|
+
emit();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
50
56
|
await daemonRequest(
|
|
51
57
|
"session_end",
|
|
52
58
|
{ sessionId: envelope.session_id },
|
|
@@ -7,11 +7,7 @@ import {
|
|
|
7
7
|
kickDaemonEnsure,
|
|
8
8
|
refreshClaudePlugins,
|
|
9
9
|
warmBinCache
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import {
|
|
12
|
-
clearHooksWired,
|
|
13
|
-
recordHooksWired
|
|
14
|
-
} from "../chunk-FXF4JWK2.js";
|
|
10
|
+
} from "../chunk-7KABYYWG.js";
|
|
15
11
|
import {
|
|
16
12
|
buildHookOutput,
|
|
17
13
|
handoffHookOutput
|
|
@@ -21,41 +17,45 @@ import {
|
|
|
21
17
|
acknowledgeDecisionFeedback,
|
|
22
18
|
leaseDecisionFeedback,
|
|
23
19
|
renderFeedback
|
|
24
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-UO2U6IKF.js";
|
|
21
|
+
import {
|
|
22
|
+
clearHooksWired,
|
|
23
|
+
recordHooksWired
|
|
24
|
+
} from "../chunk-XEDJ5N3M.js";
|
|
25
25
|
import "../chunk-OYHYCK4K.js";
|
|
26
26
|
import {
|
|
27
27
|
getOrCreateWorkspaceId
|
|
28
28
|
} from "../chunk-EZXEWFDG.js";
|
|
29
29
|
import {
|
|
30
30
|
prepareCodexContext
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-
|
|
31
|
+
} from "../chunk-3I4GEWXQ.js";
|
|
32
|
+
import "../chunk-FBPZ4YUD.js";
|
|
33
33
|
import {
|
|
34
|
-
fetchAndCacheCollectScope
|
|
35
|
-
|
|
36
|
-
repoActiveFlag,
|
|
37
|
-
setRepoActive
|
|
38
|
-
} from "../chunk-DSWT6BCC.js";
|
|
34
|
+
fetchAndCacheCollectScope
|
|
35
|
+
} from "../chunk-ZYK3TBEW.js";
|
|
39
36
|
import {
|
|
40
37
|
getSiteUrl,
|
|
41
38
|
isSessionEnded
|
|
42
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-LY6NJ7KL.js";
|
|
43
40
|
import {
|
|
44
41
|
normalizeEnvelope,
|
|
45
42
|
parseAgent,
|
|
46
43
|
readHookStdin,
|
|
47
44
|
shouldSuppressImportedCursorHandler
|
|
48
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-RK4ZS3HG.js";
|
|
49
46
|
import {
|
|
50
47
|
MANAGED_GIT_HOOK_NAMES
|
|
51
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-Y5W4TZM7.js";
|
|
52
49
|
import {
|
|
53
|
-
gitToplevel
|
|
54
|
-
|
|
50
|
+
gitToplevel,
|
|
51
|
+
isRepoActiveForCapture,
|
|
52
|
+
repoActiveFlag,
|
|
53
|
+
setRepoActive
|
|
54
|
+
} from "../chunk-DHOQGHKQ.js";
|
|
55
55
|
import {
|
|
56
56
|
daemonRequest
|
|
57
|
-
} from "../chunk-
|
|
58
|
-
import "../chunk-
|
|
57
|
+
} from "../chunk-35FMRWJH.js";
|
|
58
|
+
import "../chunk-DWRSEC34.js";
|
|
59
59
|
|
|
60
60
|
// src/hooks/reauth-notice.ts
|
|
61
61
|
var REAUTH_NOTICE = "[prim] authentication ended \u2014 run `prim auth login` to resume decision capture";
|
|
@@ -146,13 +146,18 @@ async function processSessionStart(raw, agent, feedbackSignal) {
|
|
|
146
146
|
if (typeof envelope.session_id !== "string" || envelope.session_id.length === 0) {
|
|
147
147
|
return { output: buildHookOutput({}) };
|
|
148
148
|
}
|
|
149
|
+
const cwd = envelope.cwd ?? process.cwd();
|
|
150
|
+
if (!gitToplevel(cwd) || !isRepoActiveForCapture(cwd)) {
|
|
151
|
+
if (repoActiveFlag(cwd) === "false") clearHooksWired(cwd);
|
|
152
|
+
return { output: agent === "cursor" ? {} : buildHookOutput({}) };
|
|
153
|
+
}
|
|
154
|
+
warmBinCache();
|
|
149
155
|
kickDaemonEnsure();
|
|
150
156
|
await daemonRequest(
|
|
151
157
|
"session_start",
|
|
152
158
|
{ sessionId: envelope.session_id, callerEnv: getSiteUrl() },
|
|
153
159
|
{ timeoutMs: DAEMON_TIMEOUT_MS }
|
|
154
160
|
);
|
|
155
|
-
const cwd = envelope.cwd ?? process.cwd();
|
|
156
161
|
let projectRoot = null;
|
|
157
162
|
let active = false;
|
|
158
163
|
let skillState = { installed: 0, refreshed: 0 };
|
|
@@ -279,7 +284,6 @@ function emitOutput(output, acknowledge) {
|
|
|
279
284
|
return handoffHookOutput(output, acknowledge);
|
|
280
285
|
}
|
|
281
286
|
async function main() {
|
|
282
|
-
warmBinCache();
|
|
283
287
|
const agent = parseAgent(process.argv);
|
|
284
288
|
let raw;
|
|
285
289
|
try {
|