@primitive.ai/prim 0.1.0-alpha.115 → 0.1.0-alpha.116

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 (35) hide show
  1. package/README.md +43 -0
  2. package/SKILL.md +5 -3
  3. package/dist/{chunk-IZXLH3R5.js → chunk-3TIKBQHV.js} +2584 -821
  4. package/dist/{chunk-NH3VC7YO.js → chunk-4OEJ2ONG.js} +1 -1
  5. package/dist/{chunk-DWAXFXDG.js → chunk-4SN5BCIG.js} +1 -1
  6. package/dist/{chunk-3KKEV7VI.js → chunk-6IRAGUYK.js} +1 -1
  7. package/dist/chunk-CXMLAWC2.js +96 -0
  8. package/dist/chunk-D3ZDZZYS.js +449 -0
  9. package/dist/{chunk-RUUSUF43.js → chunk-I3J344DF.js} +231 -94
  10. package/dist/{chunk-7DVEH7FO.js → chunk-JKJ22ONL.js} +1 -1
  11. package/dist/{chunk-PO5QAYD7.js → chunk-JKO6PZWQ.js} +119 -24
  12. package/dist/{chunk-BXLH4LDU.js → chunk-LEUZDTNT.js} +1 -1
  13. package/dist/{chunk-PJW6JZMH.js → chunk-LLKJAET2.js} +1 -1
  14. package/dist/{chunk-IMYELJIV.js → chunk-RLBASQJD.js} +3 -3
  15. package/dist/{chunk-RTULPLS7.js → chunk-S55JKCHQ.js} +1 -1
  16. package/dist/daemon/server.js +2583 -822
  17. package/dist/hook-runtime/daemon/server.js +2583 -822
  18. package/dist/hook-runtime/hooks/post-commit.js +2581 -820
  19. package/dist/hook-runtime/hooks/post-rewrite.js +2581 -820
  20. package/dist/hook-runtime/hooks/post-tool-use.js +2689 -921
  21. package/dist/hook-runtime/hooks/pre-tool-use.js +2922 -985
  22. package/dist/hook-runtime/hooks/prim-hook.js +2682 -914
  23. package/dist/hook-runtime/hooks/session-end.js +19 -12
  24. package/dist/hook-runtime/hooks/session-start.js +2828 -1060
  25. package/dist/hook-runtime/index.js +22900 -12209
  26. package/dist/hooks/post-commit.js +3 -3
  27. package/dist/hooks/post-rewrite.js +3 -3
  28. package/dist/hooks/post-tool-use.js +11 -11
  29. package/dist/hooks/pre-tool-use.js +78 -316
  30. package/dist/hooks/prim-hook.js +10 -10
  31. package/dist/hooks/session-end.js +2 -2
  32. package/dist/hooks/session-start.js +6 -6
  33. package/dist/index.js +66 -15
  34. package/package.json +4 -1
  35. package/dist/chunk-JDIAPBY7.js +0 -233
package/README.md CHANGED
@@ -13,6 +13,25 @@ presence — from the command line and via session + git hooks.
13
13
  > organization, gates can warn, pause, or block a conflicting edit until you resolve
14
14
  > the decision and retry. Automatic decision capture in active repositories is separate.
15
15
 
16
+ When Enforcement is enabled, the V4 gate waits for complete Decision coverage.
17
+ It polls for up to 240 seconds, limits individual requests to 10 seconds, and
18
+ pauses the tool on incomplete evaluation or service failure, including in warn
19
+ mode. A paused response includes a check ID:
20
+
21
+ ```bash
22
+ prim decisions preflight status <checkId>
23
+ prim decisions preflight resume <checkId> # Finish evaluation, then retry the tool
24
+ ```
25
+
26
+ The backend must support V4 before this CLI is rolled out. There is no V3 fallback.
27
+ Re-run `prim <agent> install` and `prim doctor` to repair the 300-second hook timeout
28
+ and check host failure protection. Claude needs 2.1.295+ (`onFailure: "block"`),
29
+ Cursor uses the verified 3.24.9+ baseline (`failClosed: true`), and Hermes needs
30
+ `fail_closed` shell-hook support. Codex supports explicit deny but does not
31
+ provide a documented fail-closed policy for a hook crash, kill, or host timeout;
32
+ Primitive cannot guarantee that host failure boundary. Reload/restart and trust
33
+ the updated hooks as directed by the installer.
34
+
16
35
  ## Installation
17
36
 
18
37
  Requires Node.js 22.23.4+, 24.22.1+, or 26.12.1+ within those major versions.
@@ -555,6 +574,30 @@ pnpm typecheck # Type-check
555
574
  pnpm lint # Lint
556
575
  ```
557
576
 
577
+ ### Actual host validation
578
+
579
+ After `pnpm build`, optional E2E checks drive a real host's tool loop against a
580
+ local deterministic model provider. They use temporary HOME/configuration and a
581
+ sentinel file, synthetic credentials, and no real model requests or user account.
582
+ They never install or upgrade the host or change your host settings.
583
+
584
+ ```bash
585
+ pnpm test:preflight-host # Installed Codex
586
+ pnpm test:preflight-host:claude # Claude 2.1.295+ on PATH
587
+ pnpm test:preflight-host:claude --binary /path/to/compatible/claude
588
+ # CLI_CLAUDE_BIN also selects the Claude binary.
589
+ ```
590
+
591
+ Each check covers completed allow, paused evaluation in warn mode, malformed
592
+ backend JSON, CLI deadline expiry, hook crash, and host watchdog expiry. Deadline
593
+ expiry uses an accelerated remaining 240-second budget; the watchdog uses a
594
+ one-second timeout. These checks do not wait 240/300 seconds. Claude's
595
+ `onFailure: "block"` blocks the crash and watchdog cases. The Codex check records
596
+ its current limitation by expecting execution in those two cases; explicit CLI
597
+ denials still block. Unsupported Claude versions fail before the fixture runs.
598
+ The separate `pnpm test:preflight-v4 --schema /path/to/cli-http-v1.schema.json`
599
+ check validates the built CLI against a supplied authoritative backend contract.
600
+
558
601
  ## License
559
602
 
560
603
  [MIT](LICENSE)
package/SKILL.md CHANGED
@@ -40,9 +40,11 @@ When Enforcement is enabled, before an edit (Claude Code: Edit/Write/MultiEdit;
40
40
 
41
41
  - **deny** -- the edit is blocked. Name each governing Decision and the proposed conflicting edit. Overriding a Decision requires explicit human approval for that specific override. Reconcile bypasses are disabled until a host can provide verifiable human approval; keep the edit blocked and choose a compatible approach.
42
42
  - **warn / additional context** -- the edit proceeds, but a relevant prior decision is surfaced. Read it. Cursor, Codex, and Hermes map a would-be `ask` to **deny**. Do not change gate settings, use sandbox escalation, or request prefix permissions to evade the block. Automatic approval review, `--yes`, and an agent assertion are not human approval.
43
- - **"decision check skipped / not verified" or "... partial / truncated"** -- the check could not fully run. Treat constraints as UNKNOWN, not clear; never read silence as approval.
43
+ - **"Operation paused"** -- the check has not covered every eligible Decision. The tool is denied, including in warn mode. Use the supplied `prim decisions preflight resume <checkId>` command, then retry the tool call. `prim decisions preflight status <checkId>` inspects progress without restarting it.
44
44
 
45
- When enabled, the gate sends its preflight check directly to Primitive and fail-opens on infrastructure errors (for example, a network failure or org-unbound token) -- a service problem would not block your edit. That is why an "unavailable" note matters: it is the honest signal that the check, not your edit, is what failed.
45
+ When enabled, the V4 gate polls durable evaluation for up to 240 seconds, with each request bounded to 10 seconds. Incomplete coverage, network/auth failures, malformed responses, and expired checks pause the tool operation. Completed checks retain normal block/warn policy. The full tool input is hashed before the proposal is redacted and truncated, so a changed retry cannot reuse another proposal’s evaluation. The backend must support V4; the CLI never falls back to V3.
46
+
47
+ Run `prim <agent> install` to repair the 300-second hook timeout and host failure policy, then `prim doctor`. Claude requires 2.1.295+ (`onFailure: "block"`); Cursor requires the verified 3.24.9+ baseline (`failClosed: true`); Hermes requires installed `fail_closed` support. Codex honors an explicit deny but has no documented fail-closed policy for a crashed, killed, or host-timed-out hook; doctor reports that limitation. Restart or refresh the host as directed after changing hook settings.
46
48
 
47
49
  ## Read the graph before large or load-bearing edits
48
50
 
@@ -358,7 +360,7 @@ Examples:
358
360
  ## Pitfalls
359
361
 
360
362
  - **An "unavailable" / "not verified" decision check is not an all-clear.** Treat constraints as UNKNOWN and proceed deliberately; never read the silence as approval — the same holds for Conflict Gates once enabled.
361
- - **When Enforcement is enabled, a `deny` means a real prior decision conflicts.** Keep the edit blocked and pick an approach that respects it; intention alone never authorizes an override.
363
+ - **When Enforcement is enabled, `deny` blocks the edit for a conflict or an incomplete check.** Read the reason. Resolve the conflict or resume the check; intention alone never authorizes an override.
362
364
  - **Reconcile bypasses are disabled.** Human approval cannot be inferred from tool execution or automatic review.
363
365
  - **Capture of coding activity is automatic only in active repos; never inject moves by hand.** If an active repo's decisions aren't showing up, check that the session hooks are installed (`claude status` / `cursor status` / `codex status` / `hermes status`) and the daemon is running. Deliberately authoring a higher-order fork—either at the user's request or under the conservative proactive policy above—is a separate, supported path through `decisions create`; in an inactive repo, honor the per-invocation approval boundary above.
364
366
  - **Don't fabricate rationale on a confirmation.** If you don't know why a decision was made, say so rather than guessing.