@primitive.ai/prim 0.1.0-alpha.111 → 0.1.0-alpha.112
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 +11 -1
- package/SKILL.md +12 -2
- package/dist/{chunk-KQ4WBK5R.js → chunk-3KKEV7VI.js} +2 -2
- package/dist/{chunk-2IRLFOEL.js → chunk-6JHKKLA2.js} +79 -1
- package/dist/{chunk-IQZA65NV.js → chunk-7DVEH7FO.js} +1 -1
- package/dist/{chunk-W4ZEPZLK.js → chunk-BXLH4LDU.js} +1 -1
- package/dist/{chunk-GA2RXPJL.js → chunk-DWAXFXDG.js} +2 -2
- package/dist/{chunk-7VIMU2HR.js → chunk-FTW4ZCBA.js} +2 -2
- package/dist/{chunk-JJI7FU24.js → chunk-HMD5K6W7.js} +1 -1
- package/dist/{chunk-HTRFPXMD.js → chunk-IW5HCCOW.js} +3 -3
- package/dist/{chunk-UDBBJWQH.js → chunk-IZXLH3R5.js} +930 -582
- package/dist/{chunk-5LRKJTLA.js → chunk-J5HBSRAV.js} +7 -5
- package/dist/{chunk-5BLGBSDM.js → chunk-JDIAPBY7.js} +1 -1
- package/dist/{chunk-2Q3OGSTV.js → chunk-NEQI2VLM.js} +2 -2
- package/dist/{chunk-AOJ254C2.js → chunk-PJW6JZMH.js} +4 -4
- package/dist/{chunk-43ZKL27W.js → chunk-RTULPLS7.js} +1 -1
- package/dist/{chunk-CTRAJCPN.js → chunk-XV6C5ZV2.js} +1 -1
- package/dist/daemon/server.js +1184 -754
- package/dist/hook-runtime/daemon/server.js +1184 -754
- package/dist/hook-runtime/hooks/post-commit.js +929 -581
- package/dist/hook-runtime/hooks/post-rewrite.js +929 -581
- package/dist/hook-runtime/hooks/post-tool-use.js +1015 -588
- package/dist/hook-runtime/hooks/pre-commit.js +85 -6
- package/dist/hook-runtime/hooks/pre-tool-use.js +1017 -591
- package/dist/hook-runtime/hooks/prim-hook.js +1016 -589
- package/dist/hook-runtime/hooks/session-end.js +14 -12
- package/dist/hook-runtime/hooks/session-start.js +1016 -589
- package/dist/hook-runtime/index.js +1211 -791
- package/dist/hook-runtime/statusline-main.js +7 -5
- package/dist/hooks/post-commit.js +5 -5
- package/dist/hooks/post-rewrite.js +5 -5
- package/dist/hooks/post-tool-use.js +12 -12
- package/dist/hooks/pre-commit.js +3 -3
- package/dist/hooks/pre-tool-use.js +10 -11
- package/dist/hooks/prim-hook.js +12 -12
- package/dist/hooks/session-end.js +1 -1
- package/dist/hooks/session-start.js +7 -7
- package/dist/index.js +177 -183
- package/dist/statusline-main.js +7 -5
- package/package.json +2 -1
|
@@ -382,10 +382,6 @@ function getSiteUrlForEnvironment(primApiUrl) {
|
|
|
382
382
|
}
|
|
383
383
|
var CLI_MANAGEMENT_RESPONSE_MAX_BYTES = 2 * 1024 * 1024;
|
|
384
384
|
|
|
385
|
-
// src/daemon/client.ts
|
|
386
|
-
import { createConnection } from "net";
|
|
387
|
-
import { join as join7 } from "path";
|
|
388
|
-
|
|
389
385
|
// src/daemon/principal.ts
|
|
390
386
|
import { createHash as createHash3 } from "crypto";
|
|
391
387
|
var PRINCIPAL_COMPONENT_MAX_LENGTH = 512;
|
|
@@ -412,6 +408,7 @@ function resolveDaemonPrincipal(token = resolveAuthCredential()?.token) {
|
|
|
412
408
|
// src/daemon/protocol.ts
|
|
413
409
|
var DAEMON_JSON_REQUEST_MAX_BYTES = 64 * 1024;
|
|
414
410
|
var DAEMON_JSON_RESPONSE_MAX_BYTES = 8 * 1024 * 1024;
|
|
411
|
+
var DECISION_IDENTITY_VERSION = 7;
|
|
415
412
|
function isRecord(value) {
|
|
416
413
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
417
414
|
}
|
|
@@ -424,6 +421,7 @@ function parseDaemonResponseEnvelope(value) {
|
|
|
424
421
|
if (value.error !== void 0 && typeof value.error !== "string") return void 0;
|
|
425
422
|
return {
|
|
426
423
|
id: value.id,
|
|
424
|
+
...typeof value.decisionIdentityVersion === "number" ? { decisionIdentityVersion: value.decisionIdentityVersion } : {},
|
|
427
425
|
ok: value.ok,
|
|
428
426
|
...value.result === void 0 ? {} : { result: value.result },
|
|
429
427
|
...value.error === void 0 ? {} : { error: value.error }
|
|
@@ -431,6 +429,8 @@ function parseDaemonResponseEnvelope(value) {
|
|
|
431
429
|
}
|
|
432
430
|
|
|
433
431
|
// src/daemon/client.ts
|
|
432
|
+
import { createConnection } from "net";
|
|
433
|
+
import { join as join7 } from "path";
|
|
434
434
|
var SOCK_PATH = join7(primConfigDirectory(), "sock");
|
|
435
435
|
var DEFAULT_TIMEOUT_MS = 250;
|
|
436
436
|
var nextRequestId = 1;
|
|
@@ -503,7 +503,9 @@ function daemonRequest(method, params = {}, opts = {}) {
|
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
505
505
|
clearTimeout(timer);
|
|
506
|
-
settle(
|
|
506
|
+
settle(
|
|
507
|
+
(!(method.startsWith("decisions_") || method.startsWith("decision_")) || res.decisionIdentityVersion === DECISION_IDENTITY_VERSION) && res.ok && res.result !== void 0 ? res.result : null
|
|
508
|
+
);
|
|
507
509
|
} catch {
|
|
508
510
|
clearTimeout(timer);
|
|
509
511
|
settle(null);
|
|
@@ -8,19 +8,19 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
commitAttributionFromEnvironment,
|
|
10
10
|
toCommitMove
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-RTULPLS7.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-HMD5K6W7.js";
|
|
19
|
+
import "../chunk-3KKEV7VI.js";
|
|
20
20
|
import {
|
|
21
21
|
cachedCollectScopeAdmits
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-IZXLH3R5.js";
|
|
23
|
+
import "../chunk-6JHKKLA2.js";
|
|
24
24
|
import {
|
|
25
25
|
githubRepositoryFullName,
|
|
26
26
|
isRepoActiveForCapture,
|
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
canonicalRewritePairs,
|
|
7
7
|
toRewriteMove
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-RTULPLS7.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-HMD5K6W7.js";
|
|
16
|
+
import "../chunk-3KKEV7VI.js";
|
|
17
17
|
import {
|
|
18
18
|
cachedCollectScopeAdmits
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-
|
|
19
|
+
} from "../chunk-IZXLH3R5.js";
|
|
20
|
+
import "../chunk-6JHKKLA2.js";
|
|
21
21
|
import {
|
|
22
22
|
githubRepositoryFullName,
|
|
23
23
|
isRepoActiveForCapture,
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
requireDurableIngestAcknowledgement
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-BXLH4LDU.js";
|
|
5
5
|
import {
|
|
6
6
|
enrichHookPayloadWithFileRefs,
|
|
7
7
|
preserveHookFileMetadata
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-IW5HCCOW.js";
|
|
9
9
|
import {
|
|
10
10
|
postToolInvocationId,
|
|
11
11
|
toMove,
|
|
12
12
|
toolOutcomeFor
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-RTULPLS7.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-
|
|
20
|
+
} from "../chunk-HMD5K6W7.js";
|
|
21
21
|
import {
|
|
22
22
|
observeDemoInvocation
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-XV6C5ZV2.js";
|
|
24
24
|
import {
|
|
25
25
|
appendCodexContext,
|
|
26
26
|
prepareCodexContext
|
|
27
|
-
} from "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
27
|
+
} from "../chunk-PJW6JZMH.js";
|
|
28
|
+
import "../chunk-JDIAPBY7.js";
|
|
29
|
+
import "../chunk-DWAXFXDG.js";
|
|
30
30
|
import {
|
|
31
31
|
scrubFromCwd
|
|
32
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-3KKEV7VI.js";
|
|
33
33
|
import {
|
|
34
34
|
bold,
|
|
35
35
|
cachedCollectScopeAdmits,
|
|
36
36
|
color
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-IZXLH3R5.js";
|
|
38
38
|
import {
|
|
39
39
|
getClient,
|
|
40
40
|
terminalSafeLine
|
|
41
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-6JHKKLA2.js";
|
|
42
42
|
import {
|
|
43
43
|
normalizeEnvelope,
|
|
44
44
|
parseAgent,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
shouldSuppressImportedCursorHandler
|
|
47
47
|
} from "../chunk-NH3VC7YO.js";
|
|
48
48
|
import "../chunk-PO5QAYD7.js";
|
|
49
|
-
import "../chunk-
|
|
49
|
+
import "../chunk-J5HBSRAV.js";
|
|
50
50
|
import {
|
|
51
51
|
currentBranch,
|
|
52
52
|
isRepoActiveForCapture,
|
package/dist/hooks/pre-commit.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
checkAffectedDecisions,
|
|
4
4
|
formatDecisionsWarning
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-NEQI2VLM.js";
|
|
6
|
+
import "../chunk-6JHKKLA2.js";
|
|
7
|
+
import "../chunk-J5HBSRAV.js";
|
|
8
8
|
import "../chunk-XG7S3LIL.js";
|
|
9
9
|
|
|
10
10
|
// src/hooks/pre-commit.ts
|
|
@@ -13,27 +13,27 @@ import {
|
|
|
13
13
|
failOpenOutput,
|
|
14
14
|
observeDemoInvocation,
|
|
15
15
|
readHookMode
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-XV6C5ZV2.js";
|
|
17
17
|
import {
|
|
18
18
|
appendCodexContext,
|
|
19
19
|
hasVisibleCodexMessage,
|
|
20
20
|
prepareCodexContext
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-PJW6JZMH.js";
|
|
22
|
+
import "../chunk-JDIAPBY7.js";
|
|
23
|
+
import "../chunk-DWAXFXDG.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_RULES,
|
|
26
26
|
scrub
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-3KKEV7VI.js";
|
|
28
28
|
import {
|
|
29
29
|
boundedHealthError,
|
|
30
30
|
cachedCollectScopeAdmits
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-IZXLH3R5.js";
|
|
32
32
|
import {
|
|
33
33
|
HttpError,
|
|
34
34
|
getClient,
|
|
35
35
|
terminalSafeLine
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-6JHKKLA2.js";
|
|
37
37
|
import {
|
|
38
38
|
normalizeEnvelope,
|
|
39
39
|
parseAgent,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
shouldSuppressImportedCursorHandler
|
|
42
42
|
} from "../chunk-NH3VC7YO.js";
|
|
43
43
|
import "../chunk-PO5QAYD7.js";
|
|
44
|
-
import "../chunk-
|
|
44
|
+
import "../chunk-J5HBSRAV.js";
|
|
45
45
|
import {
|
|
46
46
|
canonicalGitRoot,
|
|
47
47
|
canonicalRepositoryPath,
|
|
@@ -58,7 +58,6 @@ var MAX_EXCERPT_CHARS = 80;
|
|
|
58
58
|
var MAX_TITLE_CHARS = 140;
|
|
59
59
|
var MAX_PATH_CHARS = 120;
|
|
60
60
|
var MAX_VISIBLE_CONFLICTS = 3;
|
|
61
|
-
var SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u;
|
|
62
61
|
function displayText(value, maxChars) {
|
|
63
62
|
const redacted = scrub(value, DEFAULT_RULES);
|
|
64
63
|
const clean = terminalSafeLine(typeof redacted === "string" ? redacted : "");
|
|
@@ -86,7 +85,7 @@ Proposed replacement: \u201C${after}\u201D` : `Edit ${targets}.`;
|
|
|
86
85
|
return `Change ${targets}.`;
|
|
87
86
|
}
|
|
88
87
|
function decisionLabel(conflict) {
|
|
89
|
-
const id = typeof conflict.shortId === "string" &&
|
|
88
|
+
const id = typeof conflict.shortId === "string" && /^[0-9a-f]{8}$/u.test(conflict.shortId) ? `dec_${conflict.shortId}` : typeof conflict.decisionId === "string" && /^dec_[0-9a-f]{8}$/u.test(conflict.decisionId) ? conflict.decisionId : "unknown";
|
|
90
89
|
const title = typeof conflict.title === "string" ? displayText(conflict.title, MAX_TITLE_CHARS) : "";
|
|
91
90
|
return title ? `Decision ${id}: \u201C${title}\u201D.` : `Decision ${id}: details unavailable; inspect it before approving.`;
|
|
92
91
|
}
|
|
@@ -219,7 +218,7 @@ function resultForPreflight(response, preview = "Review the requested change.")
|
|
|
219
218
|
const directives = response.conflicts.flatMap((value) => {
|
|
220
219
|
if (!value || typeof value !== "object") return [];
|
|
221
220
|
const { decisionId, shortId } = value;
|
|
222
|
-
const id = typeof shortId === "string" &&
|
|
221
|
+
const id = typeof shortId === "string" && /^[0-9a-f]{8}$/u.test(shortId) ? `dec_${shortId}` : typeof decisionId === "string" && /^dec_[0-9a-f]{8}$/u.test(decisionId) ? decisionId : void 0;
|
|
223
222
|
if (!id) return [];
|
|
224
223
|
return [
|
|
225
224
|
`To reconcile, run: prim reconcile ${id}`,
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
acknowledgeDecisionFeedback,
|
|
9
9
|
leaseDecisionFeedback,
|
|
10
10
|
renderFeedback
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-FTW4ZCBA.js";
|
|
12
12
|
import {
|
|
13
13
|
recordConversationCaptured
|
|
14
14
|
} from "../chunk-KGBMU76T.js";
|
|
@@ -18,35 +18,35 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
enrichHookPayloadWithFileRefs,
|
|
20
20
|
preserveHookFileMetadata
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-IW5HCCOW.js";
|
|
22
22
|
import {
|
|
23
23
|
postToolInvocationId,
|
|
24
24
|
shouldFlushAfter,
|
|
25
25
|
toMove
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-RTULPLS7.js";
|
|
27
27
|
import {
|
|
28
28
|
getOrCreateWorkspaceId
|
|
29
29
|
} from "../chunk-EZXEWFDG.js";
|
|
30
30
|
import {
|
|
31
31
|
appendMove,
|
|
32
32
|
resolveOrg
|
|
33
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-HMD5K6W7.js";
|
|
34
34
|
import {
|
|
35
35
|
observeDemoInvocation
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-XV6C5ZV2.js";
|
|
37
37
|
import {
|
|
38
38
|
prepareCodexContext
|
|
39
|
-
} from "../chunk-
|
|
40
|
-
import "../chunk-
|
|
41
|
-
import "../chunk-
|
|
39
|
+
} from "../chunk-PJW6JZMH.js";
|
|
40
|
+
import "../chunk-JDIAPBY7.js";
|
|
41
|
+
import "../chunk-DWAXFXDG.js";
|
|
42
42
|
import {
|
|
43
43
|
scrubFromCwd,
|
|
44
44
|
writeHookDebug
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-3KKEV7VI.js";
|
|
46
46
|
import {
|
|
47
47
|
cachedCollectScopeAdmits
|
|
48
|
-
} from "../chunk-
|
|
49
|
-
import "../chunk-
|
|
48
|
+
} from "../chunk-IZXLH3R5.js";
|
|
49
|
+
import "../chunk-6JHKKLA2.js";
|
|
50
50
|
import {
|
|
51
51
|
normalizeEnvelope,
|
|
52
52
|
parseAgent,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
shouldSuppressImportedCursorHandler
|
|
55
55
|
} from "../chunk-NH3VC7YO.js";
|
|
56
56
|
import "../chunk-PO5QAYD7.js";
|
|
57
|
-
import "../chunk-
|
|
57
|
+
import "../chunk-J5HBSRAV.js";
|
|
58
58
|
import {
|
|
59
59
|
currentBranch,
|
|
60
60
|
isRepoActiveForCapture,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
kickDaemonEnsure,
|
|
8
8
|
refreshClaudePlugins,
|
|
9
9
|
warmBinCache
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-7DVEH7FO.js";
|
|
11
11
|
import {
|
|
12
12
|
buildHookOutput,
|
|
13
13
|
handoffHookOutput
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
acknowledgeDecisionFeedback,
|
|
18
18
|
leaseDecisionFeedback,
|
|
19
19
|
renderFeedback
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-FTW4ZCBA.js";
|
|
21
21
|
import {
|
|
22
22
|
clearHooksWired,
|
|
23
23
|
recordHooksWired
|
|
@@ -28,15 +28,15 @@ import {
|
|
|
28
28
|
} from "../chunk-EZXEWFDG.js";
|
|
29
29
|
import {
|
|
30
30
|
prepareCodexContext
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-
|
|
31
|
+
} from "../chunk-PJW6JZMH.js";
|
|
32
|
+
import "../chunk-DWAXFXDG.js";
|
|
33
33
|
import {
|
|
34
34
|
fetchAndCacheCollectScope
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-IZXLH3R5.js";
|
|
36
36
|
import {
|
|
37
37
|
getSiteUrl,
|
|
38
38
|
isSessionEnded
|
|
39
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-6JHKKLA2.js";
|
|
40
40
|
import {
|
|
41
41
|
normalizeEnvelope,
|
|
42
42
|
parseAgent,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
} from "../chunk-PO5QAYD7.js";
|
|
49
49
|
import {
|
|
50
50
|
daemonRequest
|
|
51
|
-
} from "../chunk-
|
|
51
|
+
} from "../chunk-J5HBSRAV.js";
|
|
52
52
|
import {
|
|
53
53
|
gitToplevel,
|
|
54
54
|
isRepoActiveForCapture,
|