@primitive.ai/prim 0.1.0-alpha.111 → 0.1.0-alpha.113

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 +18 -5
  2. package/SKILL.md +20 -16
  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 +1047 -597
  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 +1283 -915
  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 +40 -17
  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 +189 -247
  39. package/dist/statusline-main.js +7 -5
  40. package/package.json +3 -1
@@ -1,8 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/daemon/client.ts
4
- import { createConnection } from "net";
5
- import { join as join3 } from "path";
3
+ // src/daemon/principal.ts
4
+ import { createHash as createHash2 } from "crypto";
5
+
6
+ // src/lib/credentials.ts
7
+ import { createHash } from "crypto";
8
+ import { readFileSync } from "fs";
9
+ import { join as join2 } from "path";
6
10
 
7
11
  // src/lib/paths.ts
8
12
  import { homedir } from "os";
@@ -32,14 +36,6 @@ function primConfigDirectory(options = {}) {
32
36
  return resolvePrimConfigDirectory(options).path;
33
37
  }
34
38
 
35
- // src/daemon/principal.ts
36
- import { createHash as createHash2 } from "crypto";
37
-
38
- // src/lib/credentials.ts
39
- import { createHash } from "crypto";
40
- import { readFileSync } from "fs";
41
- import { join as join2 } from "path";
42
-
43
39
  // src/lib/workos-connect.ts
44
40
  var DISCOVERY_MAX_BYTES = 16 * 1024;
45
41
  var WORKOS_CONNECT_RESPONSE_MAX_BYTES = 64 * 1024;
@@ -279,6 +275,7 @@ function resolveDaemonPrincipal(token = resolveAuthCredential()?.token) {
279
275
  // src/daemon/protocol.ts
280
276
  var DAEMON_JSON_REQUEST_MAX_BYTES = 64 * 1024;
281
277
  var DAEMON_JSON_RESPONSE_MAX_BYTES = 8 * 1024 * 1024;
278
+ var DECISION_IDENTITY_VERSION = 7;
282
279
  function isRecord(value) {
283
280
  return typeof value === "object" && value !== null && !Array.isArray(value);
284
281
  }
@@ -291,6 +288,7 @@ function parseDaemonResponseEnvelope(value) {
291
288
  if (value.error !== void 0 && typeof value.error !== "string") return void 0;
292
289
  return {
293
290
  id: value.id,
291
+ ...typeof value.decisionIdentityVersion === "number" ? { decisionIdentityVersion: value.decisionIdentityVersion } : {},
294
292
  ok: value.ok,
295
293
  ...value.result === void 0 ? {} : { result: value.result },
296
294
  ...value.error === void 0 ? {} : { error: value.error }
@@ -298,6 +296,8 @@ function parseDaemonResponseEnvelope(value) {
298
296
  }
299
297
 
300
298
  // src/daemon/client.ts
299
+ import { createConnection } from "net";
300
+ import { join as join3 } from "path";
301
301
  var SOCK_PATH = join3(primConfigDirectory(), "sock");
302
302
  var DEFAULT_TIMEOUT_MS = 250;
303
303
  var nextRequestId = 1;
@@ -370,7 +370,9 @@ function daemonRequest(method, params = {}, opts = {}) {
370
370
  return;
371
371
  }
372
372
  clearTimeout(timer);
373
- settle(res.ok && res.result !== void 0 ? res.result : null);
373
+ settle(
374
+ (!(method.startsWith("decisions_") || method.startsWith("decision_")) || res.decisionIdentityVersion === DECISION_IDENTITY_VERSION) && res.ok && res.result !== void 0 ? res.result : null
375
+ );
374
376
  } catch {
375
377
  clearTimeout(timer);
376
378
  settle(null);