@primitive.ai/prim 0.1.0-alpha.127 → 0.1.0-alpha.129

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 (44) hide show
  1. package/README.md +76 -5
  2. package/dist/{chunk-HZI5PBN4.js → chunk-BVGASV3B.js} +2047 -138
  3. package/dist/{chunk-72NIZMZN.js → chunk-DYXCJ6WZ.js} +15 -10
  4. package/dist/{chunk-TNWI3JWK.js → chunk-FHDTJP2C.js} +4 -2
  5. package/dist/{chunk-C4QNBSWB.js → chunk-HDL3UXYJ.js} +8 -8
  6. package/dist/{chunk-RV3JFSMX.js → chunk-IJ3W2YBM.js} +4 -4
  7. package/dist/{chunk-O65UVJZH.js → chunk-IZAEAALI.js} +2 -2
  8. package/dist/{chunk-H74RDXKP.js → chunk-KZNOT2YH.js} +2 -2
  9. package/dist/{chunk-R4EYLEIK.js → chunk-L7U3G4XR.js} +2 -2
  10. package/dist/{chunk-MGKSZSTV.js → chunk-LBZJD2I4.js} +3 -5
  11. package/dist/{chunk-UUQT5GMO.js → chunk-MMMY57UA.js} +22 -837
  12. package/dist/{chunk-H6X52UVF.js → chunk-NWWTFQP2.js} +1 -1
  13. package/dist/{chunk-WGTUNUIS.js → chunk-QSDWWEHF.js} +5 -5
  14. package/dist/{chunk-NVDPKW7Z.js → chunk-RAEOSDQ6.js} +3 -51
  15. package/dist/{chunk-KFRGVHGB.js → chunk-RS5ADTDF.js} +6 -6
  16. package/dist/{chunk-A5VTE43F.js → chunk-RWJ7WHTJ.js} +2 -2
  17. package/dist/{chunk-VVFVENU4.js → chunk-SJE7OWVS.js} +6 -6
  18. package/dist/{chunk-L6IL4N6Y.js → chunk-USJ4JGDC.js} +34 -34
  19. package/dist/{chunk-JCKOW45X.js → chunk-YPHDV5AS.js} +2 -2
  20. package/dist/{chunk-F3FDVHR7.js → chunk-YSV43WLK.js} +1 -1
  21. package/dist/{chunk-URYZDQFH.js → chunk-ZKIBD5MO.js} +3 -5
  22. package/dist/daemon/server.js +1769 -487
  23. package/dist/hook-runtime/daemon/server.js +1769 -487
  24. package/dist/hook-runtime/hooks/post-commit.js +611 -337
  25. package/dist/hook-runtime/hooks/post-rewrite.js +606 -332
  26. package/dist/hook-runtime/hooks/post-tool-use.js +1841 -683
  27. package/dist/hook-runtime/hooks/pre-commit.js +1713 -434
  28. package/dist/hook-runtime/hooks/pre-tool-use-worker.js +1308 -150
  29. package/dist/hook-runtime/hooks/prim-hook.js +1863 -705
  30. package/dist/hook-runtime/hooks/session-end.js +538 -385
  31. package/dist/hook-runtime/hooks/session-start.js +1379 -233
  32. package/dist/hook-runtime/index.js +5438 -4052
  33. package/dist/hook-runtime/statusline-main.js +547 -273
  34. package/dist/hooks/post-commit.js +7 -7
  35. package/dist/hooks/post-rewrite.js +6 -6
  36. package/dist/hooks/post-tool-use.js +18 -18
  37. package/dist/hooks/pre-commit.js +4 -4
  38. package/dist/hooks/pre-tool-use-worker.js +9 -9
  39. package/dist/hooks/prim-hook.js +16 -16
  40. package/dist/hooks/session-end.js +4 -4
  41. package/dist/hooks/session-start.js +64 -22
  42. package/dist/index.js +396 -52
  43. package/dist/statusline-main.js +547 -273
  44. package/package.json +1 -1
@@ -2,32 +2,33 @@ import {
2
2
  unattendedEnv
3
3
  } from "./chunk-OYHYCK4K.js";
4
4
  import {
5
- GIT_HOOK_CONTRACT_VERSION,
6
- blockMarkers,
7
- canonicalHookBlock,
8
- cursorConfigDirectory,
9
- hookBlockContractVersion,
10
- inspectGitHookEntrypoint,
11
- managedHookBlock
12
- } from "./chunk-UUQT5GMO.js";
5
+ cursorConfigDirectory
6
+ } from "./chunk-MMMY57UA.js";
13
7
  import {
14
8
  HttpError,
15
9
  getClient,
16
10
  getSiteUrl
17
- } from "./chunk-NVDPKW7Z.js";
11
+ } from "./chunk-RAEOSDQ6.js";
18
12
  import {
19
13
  CLOUD_CREDENTIALS_REMEDY,
14
+ CLOUD_REJECTED_CREDENTIALS_NOTICE,
15
+ GIT_HOOK_CONTRACT_VERSION,
20
16
  MachineAuthError,
21
17
  NETWORK_TOKEN_AUTH,
22
18
  atomicWriteFile,
23
19
  binFile,
20
+ blockMarkers,
21
+ canonicalHookBlock,
24
22
  compareSemver,
25
23
  gitToplevel,
26
24
  githubRepositoryFullName,
27
25
  hasMachineConfiguration,
26
+ hookBlockContractVersion,
27
+ inspectGitHookEntrypoint,
28
28
  isClaudeCloudSession,
29
29
  isValidRepoSyncId,
30
30
  machineApiUrl,
31
+ managedHookBlock,
31
32
  originIdentifiesRepository,
32
33
  pinnedHookCommand,
33
34
  pinnedNpxCommand,
@@ -36,7 +37,7 @@ import {
36
37
  setRepoSyncId,
37
38
  setRepositoryBindingState,
38
39
  withFileLock
39
- } from "./chunk-HZI5PBN4.js";
40
+ } from "./chunk-BVGASV3B.js";
40
41
 
41
42
  // src/commands/skill.ts
42
43
  import { createHash as createHash3 } from "crypto";
@@ -854,6 +855,9 @@ function unreachable(what, failure, remedy) {
854
855
  return `${what} did not answer in time. If this persists, check that you ${remedy.replace(/^add /u, "added ")}.`;
855
856
  return `${what} could not be reached (${failure}). Check the environment's network access: ${remedy}.`;
856
857
  }
858
+ function credentialRejected(error) {
859
+ return error instanceof HttpError && error.status === 401;
860
+ }
857
861
  async function diagnoseCloudSession(options = {}) {
858
862
  const env = options.env ?? process.env;
859
863
  if (!isClaudeCloudSession(env)) return void 0;
@@ -868,6 +872,7 @@ async function diagnoseCloudSession(options = {}) {
868
872
  }
869
873
  if (!machine && !resolveStoredCredential(env))
870
874
  return `${prefix}: it has no credentials. To fix it, ${CLOUD_CREDENTIALS_REMEDY}.`;
875
+ if (machine && credentialRejected(options.bindFailure)) return CLOUD_REJECTED_CREDENTIALS_NOTICE;
871
876
  if (options.cwd !== void 0 && !githubRepositoryFullName(options.cwd))
872
877
  return `${prefix}: ${repositoryIdentityRemedy(options.cwd)}.`;
873
878
  const fetchImpl = options.fetch ?? fetch;
@@ -1,9 +1,11 @@
1
1
  import {
2
- getClient,
2
+ getClient
3
+ } from "./chunk-RAEOSDQ6.js";
4
+ import {
3
5
  isTerminalSafeText,
4
6
  terminalSafeLine,
5
7
  terminalSafeText
6
- } from "./chunk-NVDPKW7Z.js";
8
+ } from "./chunk-BVGASV3B.js";
7
9
 
8
10
  // src/decisions/feedback.ts
9
11
  var FEEDBACK_PROTOCOL_VERSION = 2;
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  analyzeShellTargets,
3
3
  extractFileTargets
4
- } from "./chunk-MGKSZSTV.js";
4
+ } from "./chunk-LBZJD2I4.js";
5
5
  import {
6
6
  DEFAULT_RULES,
7
7
  scrub
8
- } from "./chunk-R4EYLEIK.js";
8
+ } from "./chunk-L7U3G4XR.js";
9
9
  import {
10
10
  boundedHealthError,
11
11
  isPreflightResponseV4
12
- } from "./chunk-WGTUNUIS.js";
12
+ } from "./chunk-QSDWWEHF.js";
13
13
  import {
14
- getClient,
15
- terminalSafeLine
16
- } from "./chunk-NVDPKW7Z.js";
14
+ getClient
15
+ } from "./chunk-RAEOSDQ6.js";
17
16
  import {
18
17
  canonicalGitRoot,
19
- canonicalRepositoryPath
20
- } from "./chunk-HZI5PBN4.js";
18
+ canonicalRepositoryPath,
19
+ terminalSafeLine
20
+ } from "./chunk-BVGASV3B.js";
21
21
 
22
22
  // src/hooks/approval-copy.ts
23
23
  var MAX_EXCERPT_CHARS = 80;
@@ -4,20 +4,20 @@ import {
4
4
  import {
5
5
  analyzeShellTargets,
6
6
  extractFileTargets
7
- } from "./chunk-MGKSZSTV.js";
7
+ } from "./chunk-LBZJD2I4.js";
8
8
  import {
9
9
  scrubEnvironmentPaths
10
- } from "./chunk-R4EYLEIK.js";
10
+ } from "./chunk-L7U3G4XR.js";
11
11
  import {
12
12
  cachedCollectScopeAdmits
13
- } from "./chunk-WGTUNUIS.js";
13
+ } from "./chunk-QSDWWEHF.js";
14
14
  import {
15
15
  canonicalRepositoryPath,
16
16
  currentBranch,
17
17
  isRepoActiveForCapture,
18
18
  relatedWorktreeTarget,
19
19
  repoSyncId
20
- } from "./chunk-HZI5PBN4.js";
20
+ } from "./chunk-BVGASV3B.js";
21
21
 
22
22
  // src/hooks/file-refs.ts
23
23
  var MAX_PREFLIGHT_FILE_TARGETS = 25;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getSiteUrl
3
- } from "./chunk-NVDPKW7Z.js";
3
+ } from "./chunk-RAEOSDQ6.js";
4
4
  import {
5
5
  atomicWriteFile,
6
6
  ensureDurableDirectory,
@@ -13,7 +13,7 @@ import {
13
13
  machinePendingBucket,
14
14
  primConfigDirectory,
15
15
  resolveAuthCredential
16
- } from "./chunk-HZI5PBN4.js";
16
+ } from "./chunk-BVGASV3B.js";
17
17
 
18
18
  // src/journal.ts
19
19
  import {
@@ -2,10 +2,10 @@ import {
2
2
  cursorHooksPath,
3
3
  hasExactCursorHandler,
4
4
  readCursorHooks
5
- } from "./chunk-UUQT5GMO.js";
5
+ } from "./chunk-MMMY57UA.js";
6
6
  import {
7
7
  resolveRepositoryContext
8
- } from "./chunk-HZI5PBN4.js";
8
+ } from "./chunk-BVGASV3B.js";
9
9
 
10
10
  // src/hooks/cursor-coexistence.ts
11
11
  var CURSOR_EVENTS = /* @__PURE__ */ new Set([
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-WGTUNUIS.js";
3
+ } from "./chunk-QSDWWEHF.js";
4
4
  import {
5
5
  terminalSafeLine
6
- } from "./chunk-NVDPKW7Z.js";
6
+ } from "./chunk-BVGASV3B.js";
7
7
 
8
8
  // src/hooks/redact.ts
9
9
  import { existsSync, readFileSync, statSync } from "fs";
@@ -1,15 +1,13 @@
1
- import {
2
- inspectHookRuntime
3
- } from "./chunk-UUQT5GMO.js";
4
1
  import {
5
2
  isDemoStatusResponse
6
- } from "./chunk-WGTUNUIS.js";
3
+ } from "./chunk-QSDWWEHF.js";
7
4
  import {
8
5
  atomicWriteFile,
6
+ inspectHookRuntime,
9
7
  primConfigDirectory,
10
8
  withFileLock,
11
9
  withFileLockSync
12
- } from "./chunk-HZI5PBN4.js";
10
+ } from "./chunk-BVGASV3B.js";
13
11
 
14
12
  // src/hooks/pre-tool-use-scoring.ts
15
13
  import { isAbsolute, relative, sep } from "path";