@primitive.ai/prim 0.1.0-alpha.94 → 0.1.0-alpha.96
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-OTHKG76J.js → chunk-35FMRWJH.js} +1 -1
- 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-CU7RW7XU.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-O7YAW7G6.js → chunk-FVDBULGZ.js} +9 -11
- package/dist/{chunk-G2VMA2QO.js → chunk-LY6NJ7KL.js} +6 -4
- package/dist/{chunk-ZB4F75SZ.js → chunk-MXVCP33E.js} +5 -1
- package/dist/{chunk-TYAHC25F.js → chunk-QCBB5HFX.js} +1 -1
- package/dist/{chunk-IMK4JKTA.js → chunk-RK4ZS3HG.js} +2 -2
- package/dist/{chunk-ZU563PQI.js → chunk-ROLYLXJS.js} +2 -2
- package/dist/{chunk-OH3EZXYX.js → chunk-UO2U6IKF.js} +1 -1
- package/dist/{chunk-K7D2EYBS.js → chunk-URLLSALP.js} +2 -2
- package/dist/{chunk-FXF4JWK2.js → chunk-XEDJ5N3M.js} +17 -2
- package/dist/{chunk-AXQQMX2U.js → chunk-Y5W4TZM7.js} +2 -2
- package/dist/{chunk-ICM2XCXS.js → chunk-YYE2NLWX.js} +2 -2
- package/dist/{chunk-DSWT6BCC.js → chunk-Z6NPNLOT.js} +825 -665
- package/dist/daemon/server.js +836 -540
- package/dist/hook-runtime/daemon/server.js +836 -540
- package/dist/hook-runtime/hooks/post-commit.js +836 -540
- package/dist/hook-runtime/hooks/post-rewrite.js +836 -540
- package/dist/hook-runtime/hooks/post-tool-use.js +1160 -791
- package/dist/hook-runtime/hooks/pre-tool-use.js +2060 -1751
- package/dist/hook-runtime/hooks/prim-hook.js +1257 -856
- package/dist/hook-runtime/hooks/session-end.js +179 -129
- package/dist/hook-runtime/hooks/session-start.js +938 -640
- package/dist/hook-runtime/index.js +892 -554
- 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,30 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatStatusline
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
decisionIngestionStatus,
|
|
6
|
-
repositoryBindingState
|
|
7
|
-
} from "./chunk-DSWT6BCC.js";
|
|
3
|
+
} from "./chunk-ROLYLXJS.js";
|
|
8
4
|
import {
|
|
9
5
|
getSiteUrl,
|
|
10
6
|
isSessionEnded,
|
|
11
7
|
terminalSafeText
|
|
12
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LY6NJ7KL.js";
|
|
13
9
|
import {
|
|
14
10
|
packageVersion
|
|
15
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Y5W4TZM7.js";
|
|
16
12
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
decisionIngestionStatus,
|
|
14
|
+
gitToplevel,
|
|
15
|
+
repositoryBindingState
|
|
16
|
+
} from "./chunk-DHOQGHKQ.js";
|
|
19
17
|
import {
|
|
20
18
|
daemonPrincipalsMatch,
|
|
21
19
|
daemonRequest,
|
|
22
20
|
resolveDaemonPrincipal
|
|
23
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-35FMRWJH.js";
|
|
24
22
|
import {
|
|
25
23
|
primConfigDirectory,
|
|
26
24
|
withFileLock
|
|
27
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-DWRSEC34.js";
|
|
28
26
|
|
|
29
27
|
// src/hooks/codex-context.ts
|
|
30
28
|
import { createHash, randomBytes as randomBytes2 } from "crypto";
|
|
@@ -19,7 +19,12 @@ import {
|
|
|
19
19
|
resolveAuthCredential,
|
|
20
20
|
withFileLock,
|
|
21
21
|
workosConnectTokenEndpoint
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DWRSEC34.js";
|
|
23
|
+
|
|
24
|
+
// src/client.ts
|
|
25
|
+
import { createHash } from "crypto";
|
|
26
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync } from "fs";
|
|
27
|
+
import { dirname } from "path";
|
|
23
28
|
|
|
24
29
|
// src/lib/terminal-safe.ts
|
|
25
30
|
function replaceIsolatedSurrogates(value) {
|
|
@@ -67,9 +72,6 @@ function isTerminalSafeText(value) {
|
|
|
67
72
|
var stripControlChars = terminalSafeText;
|
|
68
73
|
|
|
69
74
|
// src/client.ts
|
|
70
|
-
import { createHash } from "crypto";
|
|
71
|
-
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync } from "fs";
|
|
72
|
-
import { dirname } from "path";
|
|
73
75
|
var CONFIG_DIR_MODE = 448;
|
|
74
76
|
var CREDENTIAL_FILE_MODE = 384;
|
|
75
77
|
var REFRESH_THRESHOLD_MS = 6e4;
|
|
@@ -253,7 +253,7 @@ var COMMAND_OPTIONS = {
|
|
|
253
253
|
longOptionalValues: set("--color")
|
|
254
254
|
},
|
|
255
255
|
grep: {
|
|
256
|
-
shortFlags: "
|
|
256
|
+
shortFlags: "EFGHIPRTUVabcdhiLlnoqrsuvwxyZz",
|
|
257
257
|
shortValues: "ABCDefm",
|
|
258
258
|
longFlags: set(
|
|
259
259
|
"--basic-regexp --binary-files-without-match --byte-offset --count --extended-regexp --files-with-matches --files-without-match --fixed-regexp --fixed-strings --help --ignore-case --initial-tab --invert-match --line-buffered --line-number --line-regexp --null --null-data --only-matching --perl-regexp --quiet --recursive --silent --unix-byte-offsets --version --with-filename --word-regexp"
|
|
@@ -264,12 +264,14 @@ var COMMAND_OPTIONS = {
|
|
|
264
264
|
longOptionalValues: set("--color")
|
|
265
265
|
},
|
|
266
266
|
head: {
|
|
267
|
+
numericCount: true,
|
|
267
268
|
shortFlags: "qvz",
|
|
268
269
|
shortValues: "cn",
|
|
269
270
|
longFlags: set("--help --quiet --verbose --version --zero-terminated"),
|
|
270
271
|
longValues: set("--bytes --lines")
|
|
271
272
|
},
|
|
272
273
|
tail: {
|
|
274
|
+
numericCount: true,
|
|
273
275
|
shortFlags: "Fqsvz",
|
|
274
276
|
shortValues: "cn",
|
|
275
277
|
longFlags: set("--help --quiet --retry --silent --verbose --version --zero-terminated"),
|
|
@@ -294,6 +296,7 @@ var COMMAND_OPTIONS = {
|
|
|
294
296
|
}
|
|
295
297
|
};
|
|
296
298
|
var GIT_INSPECTION_OPTIONS = {
|
|
299
|
+
numericCount: true,
|
|
297
300
|
shortFlags: "abcdfhiklmnprstuvwz",
|
|
298
301
|
shortValues: "ABCGLMSU",
|
|
299
302
|
longFlags: set(
|
|
@@ -436,6 +439,7 @@ function parseOptions(args, spec) {
|
|
|
436
439
|
optionsEnded = true;
|
|
437
440
|
continue;
|
|
438
441
|
}
|
|
442
|
+
if (spec.numericCount && /^-\d+$/.test(arg)) continue;
|
|
439
443
|
if (arg.startsWith("--")) {
|
|
440
444
|
const separator = arg.indexOf("=");
|
|
441
445
|
const option = separator === -1 ? arg : arg.slice(0, separator);
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
cursorHooksPath,
|
|
3
3
|
hasExactCursorHandler,
|
|
4
4
|
readCursorHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Y5W4TZM7.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveRepositoryContext
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DHOQGHKQ.js";
|
|
9
9
|
|
|
10
10
|
// src/hooks/agent.ts
|
|
11
11
|
function parseAgent(argv) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
boundedHealthError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Z6NPNLOT.js";
|
|
4
4
|
import {
|
|
5
5
|
terminalSafeLine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LY6NJ7KL.js";
|
|
7
7
|
|
|
8
8
|
// src/hooks/redact.ts
|
|
9
9
|
import { existsSync, readFileSync, statSync } from "fs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
repoActiveFlag
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DHOQGHKQ.js";
|
|
4
4
|
import {
|
|
5
5
|
atomicWriteFile
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DWRSEC34.js";
|
|
7
7
|
|
|
8
8
|
// src/lib/commit-heartbeat.ts
|
|
9
9
|
import { execFileSync } from "child_process";
|
|
@@ -60,6 +60,19 @@ function readStampAt(path) {
|
|
|
60
60
|
return void 0;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
function recordConversationCaptured(cwd, agent) {
|
|
64
|
+
try {
|
|
65
|
+
writeStamp(gitPath(cwd, `prim/conversation-captured/${agent}`), Date.now());
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function lastConversationCaptured(cwd, agent) {
|
|
70
|
+
try {
|
|
71
|
+
return readStampAt(gitPath(cwd, `prim/conversation-captured/${agent}`));
|
|
72
|
+
} catch {
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
63
76
|
function readFiredStamps(cwd) {
|
|
64
77
|
try {
|
|
65
78
|
const dir = gitPath(cwd, FIRED_DIR);
|
|
@@ -155,6 +168,8 @@ function inspectPostCommitFiring(cwd, now = Date.now()) {
|
|
|
155
168
|
|
|
156
169
|
export {
|
|
157
170
|
POST_COMMIT_GRACE_MS,
|
|
171
|
+
recordConversationCaptured,
|
|
172
|
+
lastConversationCaptured,
|
|
158
173
|
recordPostCommitFired,
|
|
159
174
|
recordHooksWired,
|
|
160
175
|
clearHooksWired,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
gitToplevel
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DHOQGHKQ.js";
|
|
4
4
|
import {
|
|
5
5
|
atomicWriteFile,
|
|
6
6
|
primConfigDirectory,
|
|
7
7
|
syncDirectory,
|
|
8
8
|
syncFile,
|
|
9
9
|
withFileLockSync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DWRSEC34.js";
|
|
11
11
|
|
|
12
12
|
// src/lib/bin-path.ts
|
|
13
13
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-EZXEWFDG.js";
|
|
4
4
|
import {
|
|
5
5
|
scrubEnvironmentPaths
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-URLLSALP.js";
|
|
7
7
|
import {
|
|
8
8
|
isValidRepoSyncId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DHOQGHKQ.js";
|
|
10
10
|
|
|
11
11
|
// src/hooks/prim-hook-core.ts
|
|
12
12
|
import { createHash, randomUUID } from "crypto";
|