@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.
Files changed (40) hide show
  1. package/README.md +7 -4
  2. package/dist/{chunk-UKUAAAXE.js → chunk-27ADT6FQ.js} +2 -2
  3. package/dist/{chunk-TYAHC25F.js → chunk-2MBV7ZMV.js} +1 -1
  4. package/dist/{chunk-OTHKG76J.js → chunk-35FMRWJH.js} +1 -1
  5. package/dist/{chunk-O7YAW7G6.js → chunk-3I4GEWXQ.js} +9 -11
  6. package/dist/{chunk-DXJQR4QI.js → chunk-4GHANPWQ.js} +2 -2
  7. package/dist/{chunk-WUXFLE7X.js → chunk-7KABYYWG.js} +64 -66
  8. package/dist/{chunk-LFFLHSQO.js → chunk-AJYZB5PF.js} +63 -6
  9. package/dist/{chunk-H4UNYFUC.js → chunk-DHOQGHKQ.js} +184 -1
  10. package/dist/{chunk-2GP5UFV7.js → chunk-DWRSEC34.js} +5 -3
  11. package/dist/{chunk-ZU563PQI.js → chunk-FBPZ4YUD.js} +2 -2
  12. package/dist/{chunk-G2VMA2QO.js → chunk-LY6NJ7KL.js} +6 -4
  13. package/dist/{chunk-ZB4F75SZ.js → chunk-MXVCP33E.js} +5 -1
  14. package/dist/{chunk-ICM2XCXS.js → chunk-OW4GJBLW.js} +2 -2
  15. package/dist/{chunk-K7D2EYBS.js → chunk-QNPTWTBG.js} +2 -2
  16. package/dist/{chunk-IMK4JKTA.js → chunk-RK4ZS3HG.js} +2 -2
  17. package/dist/{chunk-OH3EZXYX.js → chunk-UO2U6IKF.js} +1 -1
  18. package/dist/{chunk-FXF4JWK2.js → chunk-XEDJ5N3M.js} +17 -2
  19. package/dist/{chunk-AXQQMX2U.js → chunk-Y5W4TZM7.js} +2 -2
  20. package/dist/{chunk-DSWT6BCC.js → chunk-ZYK3TBEW.js} +2542 -2250
  21. package/dist/daemon/server.js +2547 -2119
  22. package/dist/hook-runtime/daemon/server.js +2547 -2119
  23. package/dist/hook-runtime/hooks/post-commit.js +2547 -2119
  24. package/dist/hook-runtime/hooks/post-rewrite.js +2547 -2119
  25. package/dist/hook-runtime/hooks/post-tool-use.js +2874 -2373
  26. package/dist/hook-runtime/hooks/pre-tool-use.js +3766 -3325
  27. package/dist/hook-runtime/hooks/prim-hook.js +2973 -2440
  28. package/dist/hook-runtime/hooks/session-end.js +179 -129
  29. package/dist/hook-runtime/hooks/session-start.js +2651 -2221
  30. package/dist/hook-runtime/index.js +2596 -2126
  31. package/dist/hooks/post-commit.js +11 -11
  32. package/dist/hooks/post-rewrite.js +10 -10
  33. package/dist/hooks/post-tool-use.js +20 -20
  34. package/dist/hooks/pre-commit.js +4 -4
  35. package/dist/hooks/pre-tool-use.js +29 -17
  36. package/dist/hooks/prim-hook.js +22 -18
  37. package/dist/hooks/session-end.js +11 -5
  38. package/dist/hooks/session-start.js +26 -22
  39. package/dist/index.js +79 -60
  40. package/package.json +1 -1
@@ -24,6 +24,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  mod
25
25
  ));
26
26
 
27
+ // src/lib/credentials.ts
28
+ import { createHash } from "crypto";
29
+ import { readFileSync } from "fs";
30
+ import { join as join2 } from "path";
31
+
27
32
  // src/lib/paths.ts
28
33
  import { homedir } from "os";
29
34
  import { isAbsolute, join, normalize } from "path";
@@ -353,9 +358,6 @@ async function pollWorkosDeviceAuthorization(configuration, authorization, optio
353
358
  }
354
359
 
355
360
  // src/lib/credentials.ts
356
- import { createHash } from "crypto";
357
- import { readFileSync } from "fs";
358
- import { join as join2 } from "path";
359
361
  var CONFIG_DIRECTORY = primConfigDirectory();
360
362
  var TOKEN_FILE_PATH = join2(CONFIG_DIRECTORY, "token");
361
363
  var REFRESH_TOKEN_PATH = join2(CONFIG_DIRECTORY, "refresh_token");
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-DSWT6BCC.js";
3
+ } from "./chunk-ZYK3TBEW.js";
4
4
  import {
5
5
  stripControlChars
6
- } from "./chunk-G2VMA2QO.js";
6
+ } from "./chunk-LY6NJ7KL.js";
7
7
 
8
8
  // src/lib/delivery-backlog.ts
9
9
  var MS_PER_SECOND = 1e3;
@@ -19,7 +19,12 @@ import {
19
19
  resolveAuthCredential,
20
20
  withFileLock,
21
21
  workosConnectTokenEndpoint
22
- } from "./chunk-2GP5UFV7.js";
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: "EFGHIPRTUVabcdhLlnqrsuvwxyZz",
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);
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-EZXEWFDG.js";
4
4
  import {
5
5
  scrubEnvironmentPaths
6
- } from "./chunk-K7D2EYBS.js";
6
+ } from "./chunk-QNPTWTBG.js";
7
7
  import {
8
8
  isValidRepoSyncId
9
- } from "./chunk-DSWT6BCC.js";
9
+ } from "./chunk-DHOQGHKQ.js";
10
10
 
11
11
  // src/hooks/prim-hook-core.ts
12
12
  import { createHash, randomUUID } from "crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-DSWT6BCC.js";
3
+ } from "./chunk-ZYK3TBEW.js";
4
4
  import {
5
5
  terminalSafeLine
6
- } from "./chunk-G2VMA2QO.js";
6
+ } from "./chunk-LY6NJ7KL.js";
7
7
 
8
8
  // src/hooks/redact.ts
9
9
  import { existsSync, readFileSync, statSync } from "fs";
@@ -2,10 +2,10 @@ import {
2
2
  cursorHooksPath,
3
3
  hasExactCursorHandler,
4
4
  readCursorHooks
5
- } from "./chunk-AXQQMX2U.js";
5
+ } from "./chunk-Y5W4TZM7.js";
6
6
  import {
7
7
  resolveRepositoryContext
8
- } from "./chunk-H4UNYFUC.js";
8
+ } from "./chunk-DHOQGHKQ.js";
9
9
 
10
10
  // src/hooks/agent.ts
11
11
  function parseAgent(argv) {
@@ -3,7 +3,7 @@ import {
3
3
  isTerminalSafeText,
4
4
  terminalSafeLine,
5
5
  terminalSafeText
6
- } from "./chunk-G2VMA2QO.js";
6
+ } from "./chunk-LY6NJ7KL.js";
7
7
 
8
8
  // src/decisions/feedback.ts
9
9
  var FEEDBACK_PROTOCOL_VERSION = 2;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  repoActiveFlag
3
- } from "./chunk-DSWT6BCC.js";
3
+ } from "./chunk-DHOQGHKQ.js";
4
4
  import {
5
5
  atomicWriteFile
6
- } from "./chunk-2GP5UFV7.js";
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-H4UNYFUC.js";
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-2GP5UFV7.js";
10
+ } from "./chunk-DWRSEC34.js";
11
11
 
12
12
  // src/lib/bin-path.ts
13
13
  import { existsSync, readFileSync } from "fs";