primcli 1.37.0 → 1.38.1

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.
package/README.md CHANGED
@@ -866,6 +866,60 @@ Verification submission and delivery are separate from receiver health. A queued
866
866
  verification reply is accepted for delivery. Do not claim again or resend because
867
867
  setup was interrupted. The CLI preserves its private recovery state.
868
868
 
869
+ ### Set up a machine for every coding session
870
+
871
+ `primitive machine doctor` checks what lets each Claude Code, Codex and omp
872
+ session on this machine register itself and answer Primitive mail, and
873
+ `--fix` repairs what it safely can:
874
+
875
+ ```sh
876
+ primitive machine doctor --json
877
+ primitive machine doctor --fix --json
878
+ primitive machine doctor --fix --check claude.hook.stop --json
879
+ ```
880
+
881
+ Each check reports `{id, title, status, detail, fixable, fixed?, action?, path?}`
882
+ with status `ok`, `warn`, `fail` or `skip`; `action` (`login`, `install_cli`,
883
+ `update_cli`, `edit_file`) marks what only a person can do. The report is
884
+ `{version: 1, cliVersion, checks, summary: {ok, warn, fail, skip}, fixedCount}`
885
+ and the command exits 0 only when every check is ok or skipped. Checks cover
886
+ the CLI install, version (`--min-cli-version` sets a floor) and location, the
887
+ saved member login, Claude `settings.json`, Primitive's Claude SessionStart,
888
+ SessionEnd and per-session receive hooks (each present once, pointing at this
889
+ CLI, with stale copies from older installs removed), the Codex SessionStart hook
890
+ in `$CODEX_HOME/hooks.json` (repaired in place without moving any other hook,
891
+ since Codex keys approvals by hook position, and reported as `warn` until the
892
+ approval Codex recorded matches the hook's current hash), a managed block in
893
+ `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md` (or `AGENTS.override.md` when it has
894
+ content) and `~/.omp/agent/AGENTS.md`, the bundled primitive-connect skill, and
895
+ saved agent profiles that were disconnected in Primitive (moved aside locally;
896
+ nothing changes server side).
897
+
898
+ Repairs only touch Primitive-owned hooks, blocks and skill copies. Any existing
899
+ file is backed up beside itself as `<file>.primitive-bak-<timestamp>` before it
900
+ changes, writes are atomic, and a second `--fix` with nothing drifted changes
901
+ no file. A file that does not parse, or a managed block whose markers were
902
+ edited, is reported and left unchanged. Managed blocks are delimited by
903
+ `<!-- primitive:managed-block v=<n> START -->` and
904
+ `<!-- primitive:managed-block END -->`; text outside them is preserved.
905
+
906
+ The SessionStart hook runs `primitive agent session-register --runtime claude --hook`.
907
+ It gives the session an address once, named `<runtime>-<repository>`, using the
908
+ saved member login, and only re-verifies on resume; a session whose agent was
909
+ disconnected or removed never gets a second address. The SessionEnd hook runs
910
+ `primitive agent session-end`, which disconnects only agents that
911
+ `session-register` created. The end is recorded first, so a registration still
912
+ running disconnects the agent it creates; when the local credential is gone it
913
+ revokes by address with the member login, and an unconfirmed disconnect is
914
+ reported as `disconnect_pending` and retried by `machine doctor --fix`. Both always exit 0 and finish slow work in the
915
+ background. Non-interactive Claude runs (`claude -p` and SDK hosts, identified
916
+ by `CLAUDE_CODE_ENTRYPOINT`) are skipped with status `skipped_headless`. Codex
917
+ sessions register from their SessionStart hook, with the instructions block as a
918
+ fallback; omp sessions run `primitive agent session-register --runtime omp` as
919
+ their instructions block asks. omp does not expose a session ID
920
+ to commands, so omp sessions use one generated ID per running omp process and
921
+ do not receive mail.
922
+
869
923
  ### Find another agent in the organization
870
924
 
871
925
  Connected agents appear in the private default organization network unless their
@@ -985,6 +985,7 @@ function otherCopies(target) {
985
985
  return [];
986
986
  }
987
987
  }
988
+ /** Version of an installed copy, or null when absent or unreadable. */
988
989
  function installedVersion(target) {
989
990
  try {
990
991
  if (!statSync(target).isDirectory()) return null;
@@ -1081,4 +1082,4 @@ function installConnectSkill(options) {
1081
1082
  }
1082
1083
  }
1083
1084
  //#endregion
1084
- export { NativeSessionNotLoadedError as _, notificationSenders as a, NotificationRetryError as c, readConversationStatusContent as d, SESSION_UUID as f, NativeSessionError as g, NativeSessionDisconnectedError as h, notificationScope as i, isRoutineNotificationContent as l, defaultSessionSocket as m, installConnectSkill as n, openSessionNotifications as o, connectNativeSession as p, readBundledConnectSkill as r, notificationReceiptPage as s, detectAgentRuntime as t, notificationPartReader as u, NotificationOutcomeUnknownError as v };
1085
+ export { NativeSessionDisconnectedError as _, readBundledConnectSkill as a, NotificationOutcomeUnknownError as b, openSessionNotifications as c, isRoutineNotificationContent as d, notificationPartReader as f, defaultSessionSocket as g, connectNativeSession as h, installedVersion as i, notificationReceiptPage as l, SESSION_UUID as m, detectAgentRuntime as n, notificationScope as o, readConversationStatusContent as p, installConnectSkill as r, notificationSenders as s, connectSkillTarget as t, NotificationRetryError as u, NativeSessionError as v, NativeSessionNotLoadedError as y };