@primitive.ai/prim 0.1.0-alpha.110 → 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.
Files changed (40) hide show
  1. package/README.md +11 -1
  2. package/SKILL.md +12 -2
  3. package/dist/{chunk-KQ4WBK5R.js → chunk-3KKEV7VI.js} +2 -2
  4. package/dist/{chunk-2IRLFOEL.js → chunk-6JHKKLA2.js} +79 -1
  5. package/dist/{chunk-IQZA65NV.js → chunk-7DVEH7FO.js} +1 -1
  6. package/dist/{chunk-W4ZEPZLK.js → chunk-BXLH4LDU.js} +1 -1
  7. package/dist/{chunk-GA2RXPJL.js → chunk-DWAXFXDG.js} +2 -2
  8. package/dist/{chunk-7VIMU2HR.js → chunk-FTW4ZCBA.js} +2 -2
  9. package/dist/{chunk-JJI7FU24.js → chunk-HMD5K6W7.js} +1 -1
  10. package/dist/{chunk-HTRFPXMD.js → chunk-IW5HCCOW.js} +3 -3
  11. package/dist/{chunk-UDBBJWQH.js → chunk-IZXLH3R5.js} +930 -582
  12. package/dist/{chunk-5LRKJTLA.js → chunk-J5HBSRAV.js} +7 -5
  13. package/dist/{chunk-5BLGBSDM.js → chunk-JDIAPBY7.js} +1 -1
  14. package/dist/{chunk-2Q3OGSTV.js → chunk-NEQI2VLM.js} +2 -2
  15. package/dist/{chunk-AOJ254C2.js → chunk-PJW6JZMH.js} +4 -4
  16. package/dist/{chunk-43ZKL27W.js → chunk-RTULPLS7.js} +1 -1
  17. package/dist/{chunk-CTRAJCPN.js → chunk-XV6C5ZV2.js} +1 -1
  18. package/dist/daemon/server.js +1184 -754
  19. package/dist/hook-runtime/daemon/server.js +1184 -754
  20. package/dist/hook-runtime/hooks/post-commit.js +929 -581
  21. package/dist/hook-runtime/hooks/post-rewrite.js +929 -581
  22. package/dist/hook-runtime/hooks/post-tool-use.js +1015 -588
  23. package/dist/hook-runtime/hooks/pre-commit.js +85 -6
  24. package/dist/hook-runtime/hooks/pre-tool-use.js +1018 -592
  25. package/dist/hook-runtime/hooks/prim-hook.js +1016 -589
  26. package/dist/hook-runtime/hooks/session-end.js +14 -12
  27. package/dist/hook-runtime/hooks/session-start.js +1016 -589
  28. package/dist/hook-runtime/index.js +1211 -791
  29. package/dist/hook-runtime/statusline-main.js +7 -5
  30. package/dist/hooks/post-commit.js +5 -5
  31. package/dist/hooks/post-rewrite.js +5 -5
  32. package/dist/hooks/post-tool-use.js +12 -12
  33. package/dist/hooks/pre-commit.js +3 -3
  34. package/dist/hooks/pre-tool-use.js +11 -12
  35. package/dist/hooks/prim-hook.js +12 -12
  36. package/dist/hooks/session-end.js +1 -1
  37. package/dist/hooks/session-start.js +7 -7
  38. package/dist/index.js +177 -183
  39. package/dist/statusline-main.js +7 -5
  40. package/package.json +2 -1
@@ -4,10 +4,6 @@ import {
4
4
  resolveAuthCredential
5
5
  } from "./chunk-XG7S3LIL.js";
6
6
 
7
- // src/daemon/client.ts
8
- import { createConnection } from "net";
9
- import { join } from "path";
10
-
11
7
  // src/daemon/principal.ts
12
8
  import { createHash } from "crypto";
13
9
  var PRINCIPAL_COMPONENT_MAX_LENGTH = 512;
@@ -37,6 +33,7 @@ function daemonPrincipalsMatch(caller, daemon) {
37
33
  // src/daemon/protocol.ts
38
34
  var DAEMON_JSON_REQUEST_MAX_BYTES = 64 * 1024;
39
35
  var DAEMON_JSON_RESPONSE_MAX_BYTES = 8 * 1024 * 1024;
36
+ var DECISION_IDENTITY_VERSION = 7;
40
37
  function isRecord(value) {
41
38
  return typeof value === "object" && value !== null && !Array.isArray(value);
42
39
  }
@@ -49,6 +46,7 @@ function parseDaemonResponseEnvelope(value) {
49
46
  if (value.error !== void 0 && typeof value.error !== "string") return void 0;
50
47
  return {
51
48
  id: value.id,
49
+ ...typeof value.decisionIdentityVersion === "number" ? { decisionIdentityVersion: value.decisionIdentityVersion } : {},
52
50
  ok: value.ok,
53
51
  ...value.result === void 0 ? {} : { result: value.result },
54
52
  ...value.error === void 0 ? {} : { error: value.error }
@@ -56,6 +54,8 @@ function parseDaemonResponseEnvelope(value) {
56
54
  }
57
55
 
58
56
  // src/daemon/client.ts
57
+ import { createConnection } from "net";
58
+ import { join } from "path";
59
59
  var SOCK_PATH = join(primConfigDirectory(), "sock");
60
60
  var DEFAULT_TIMEOUT_MS = 250;
61
61
  var nextRequestId = 1;
@@ -128,7 +128,9 @@ function daemonRequest(method, params = {}, opts = {}) {
128
128
  return;
129
129
  }
130
130
  clearTimeout(timer);
131
- settle(res.ok && res.result !== void 0 ? res.result : null);
131
+ settle(
132
+ (!(method.startsWith("decisions_") || method.startsWith("decision_")) || res.decisionIdentityVersion === DECISION_IDENTITY_VERSION) && res.ok && res.result !== void 0 ? res.result : null
133
+ );
132
134
  } catch {
133
135
  clearTimeout(timer);
134
136
  settle(null);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isDemoStatusResponse
3
- } from "./chunk-UDBBJWQH.js";
3
+ } from "./chunk-IZXLH3R5.js";
4
4
  import {
5
5
  inspectHookRuntime
6
6
  } from "./chunk-PO5QAYD7.js";
@@ -2,10 +2,10 @@ import {
2
2
  getClient,
3
3
  getSiteUrl,
4
4
  terminalSafeLine
5
- } from "./chunk-2IRLFOEL.js";
5
+ } from "./chunk-6JHKKLA2.js";
6
6
  import {
7
7
  daemonRequest
8
- } from "./chunk-5LRKJTLA.js";
8
+ } from "./chunk-J5HBSRAV.js";
9
9
  import {
10
10
  canonicalGitRoot,
11
11
  canonicalRepositoryPath,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  formatStatusline
3
- } from "./chunk-GA2RXPJL.js";
3
+ } from "./chunk-DWAXFXDG.js";
4
4
  import {
5
5
  getSiteUrl,
6
6
  isSessionEnded,
7
7
  terminalSafeText
8
- } from "./chunk-2IRLFOEL.js";
8
+ } from "./chunk-6JHKKLA2.js";
9
9
  import {
10
10
  daemonPrincipalsMatch,
11
11
  daemonRequest,
12
12
  resolveDaemonPrincipal
13
- } from "./chunk-5LRKJTLA.js";
13
+ } from "./chunk-J5HBSRAV.js";
14
14
  import {
15
15
  decisionIngestionStatus,
16
16
  gitToplevel,
@@ -42,7 +42,7 @@ var DECISION_DIGEST_CACHE_LIMIT = 100;
42
42
  var DECISION_DIGEST_CACHE_WINDOW = "24h";
43
43
  var DECISION_DIGEST_CACHE_PATH = `/api/cli/decisions/recent?limit=${String(DECISION_DIGEST_CACHE_LIMIT)}&since=${DECISION_DIGEST_CACHE_WINDOW}`;
44
44
  var DECISION_DRAFT_DIGEST_CACHE_PATH = `${DECISION_DIGEST_CACHE_PATH}&drafts=true`;
45
- var SAFE_PRIVATE_DRAFT_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u;
45
+ var SAFE_PRIVATE_DRAFT_ID = /^dec_[0-9a-f]{8}$/u;
46
46
  function isActionablePrivateDraft(row) {
47
47
  if (typeof row !== "object" || row === null || Array.isArray(row)) return false;
48
48
  const candidate = row;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EZXEWFDG.js";
4
4
  import {
5
5
  scrubEnvironmentPaths
6
- } from "./chunk-KQ4WBK5R.js";
6
+ } from "./chunk-3KKEV7VI.js";
7
7
  import {
8
8
  isValidRepoSyncId
9
9
  } from "./chunk-XG7S3LIL.js";
@@ -11,7 +11,7 @@ import {
11
11
  saveRun,
12
12
  sessionExcluded,
13
13
  sessionKey
14
- } from "./chunk-5BLGBSDM.js";
14
+ } from "./chunk-JDIAPBY7.js";
15
15
  import {
16
16
  packageVersion
17
17
  } from "./chunk-XG7S3LIL.js";