passport-bridge 0.24.0 → 0.26.0
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 +72 -31
- package/dist/approvalNotice.d.ts +73 -0
- package/dist/approvalNotice.js +211 -0
- package/dist/cliArgs.d.ts +1 -1
- package/dist/cliArgs.js +17 -6
- package/dist/cliAutopilot.js +15 -4
- package/dist/cliAutopilotPolicy.d.ts +8 -0
- package/dist/cliAutopilotPolicy.js +23 -1
- package/dist/cliChanges.d.ts +80 -0
- package/dist/cliChanges.js +340 -0
- package/dist/cliClient.d.ts +5 -0
- package/dist/cliClient.js +15 -3
- package/dist/cliExec.js +2 -2
- package/dist/cliHook.d.ts +1 -1
- package/dist/cliHook.js +40 -35
- package/dist/cliHookAudit.d.ts +44 -0
- package/dist/cliHookAudit.js +57 -0
- package/dist/cliHookClients.d.ts +3 -1
- package/dist/cliHookClients.js +1 -1
- package/dist/cliHookDecide.js +3 -1
- package/dist/cliHookDeliver.d.ts +8 -0
- package/dist/cliHookDeliver.js +25 -0
- package/dist/cliHookGuard.d.ts +16 -1
- package/dist/cliHookGuard.js +31 -10
- package/dist/cliHookInput.d.ts +3 -0
- package/dist/cliHookInput.js +13 -0
- package/dist/cliHookLocal.d.ts +3 -2
- package/dist/cliHookLocal.js +5 -2
- package/dist/cliHookNotice.d.ts +22 -0
- package/dist/cliHookNotice.js +49 -0
- package/dist/cliHookRewrite.d.ts +2 -0
- package/dist/cliHookRewrite.js +1 -1
- package/dist/cliKeys.js +11 -1
- package/dist/cliKeysRotate.d.ts +24 -0
- package/dist/cliKeysRotate.js +149 -0
- package/dist/cliMain.js +56 -15
- package/dist/cliOutput.js +41 -5
- package/dist/cliPolicyV2.js +14 -0
- package/dist/cliProjectSummary.d.ts +9 -0
- package/dist/cliProjectSummary.js +134 -0
- package/dist/cliProtocol.d.ts +10 -0
- package/dist/cliProtocol.js +15 -0
- package/dist/cliRequest.d.ts +27 -0
- package/dist/cliRequest.js +92 -0
- package/dist/cliRestoreRequests.d.ts +57 -0
- package/dist/cliRestoreRequests.js +186 -0
- package/dist/cliSessions.d.ts +3 -0
- package/dist/cliSessions.js +24 -1
- package/dist/cliSessionsJson.d.ts +48 -2
- package/dist/cliSessionsJson.js +7 -9
- package/dist/cliSessionsRender.d.ts +8 -3
- package/dist/cliSessionsRender.js +16 -7
- package/dist/cliUndo.d.ts +1 -3
- package/dist/cliUndo.js +9 -15
- package/dist/cliUndoLocal.d.ts +27 -0
- package/dist/cliUndoLocal.js +105 -0
- package/dist/cliUpdate.d.ts +29 -0
- package/dist/cliUpdate.js +195 -0
- package/dist/cliWait.js +2 -2
- package/dist/completion.js +6 -1
- package/dist/doctor.js +4 -0
- package/dist/execNoKey.d.ts +4 -4
- package/dist/execNoKey.js +17 -11
- package/dist/gitBackup.d.ts +111 -0
- package/dist/gitBackup.js +391 -0
- package/dist/gitSnapshot.d.ts +82 -0
- package/dist/gitSnapshot.js +478 -0
- package/dist/holdNotice.js +7 -1
- package/dist/hookMain.js +10 -1
- package/dist/hookPromptFast.d.ts +26 -0
- package/dist/hookPromptFast.js +82 -0
- package/dist/initInstall.d.ts +22 -0
- package/dist/initInstall.js +70 -1
- package/dist/localBackups.d.ts +102 -0
- package/dist/localBackups.js +233 -0
- package/dist/localGit.d.ts +24 -0
- package/dist/localGit.js +44 -0
- package/dist/localRestore.d.ts +42 -0
- package/dist/localRestore.js +94 -0
- package/dist/localTrash.d.ts +97 -0
- package/dist/localTrash.js +394 -0
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/plural.d.ts +2 -0
- package/dist/plural.js +13 -0
- package/dist/regenerable.d.ts +24 -0
- package/dist/regenerable.js +219 -0
- package/dist/selfUpdate.d.ts +92 -0
- package/dist/selfUpdate.js +361 -0
- package/dist/selfUpdateContract.d.ts +20 -0
- package/dist/selfUpdateContract.js +56 -0
- package/dist/updateTrigger.d.ts +18 -0
- package/dist/updateTrigger.js +77 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Member profiles get the same tool access, agent selection, guardrails, approvals
|
|
|
13
13
|
npm install --global passport-bridge
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Requires Node.js 22.23.2 or newer. `npx passport-bridge@latest scan` and `npx passport-bridge@latest init` need no install and run on Node.js 20 or newer; `scan` also needs no account. `@latest` keeps an older global install from running instead. The CLI makes no background registry request
|
|
16
|
+
Requires Node.js 22.23.2 or newer. `npx passport-bridge@latest scan` and `npx passport-bridge@latest init` need no install and run on Node.js 20 or newer; `scan` also needs no account. `@latest` keeps an older global install from running instead. The CLI makes no background registry request or telemetry. It updates itself only to the exact version Passport names, when you or your admin ask for it on **Agents** or you run `passport update` (see [Updates](#updates)); `npm install --global passport-bridge@<version>` works too.
|
|
17
17
|
|
|
18
18
|
## Quick start
|
|
19
19
|
|
|
@@ -44,6 +44,7 @@ passport run github_search_issues '{"query":"SSO"}'
|
|
|
44
44
|
- `--no-open` (or `PASSPORT_NO_OPEN=1`) prints the sign-in link instead of opening a browser. Use it over SSH and in headless sessions; open the link on any device.
|
|
45
45
|
- Remote servers must use HTTPS. Plain HTTP works only on `localhost`, `127.0.0.0/8`, or `::1`.
|
|
46
46
|
- Requires a gateway reporting serverInfo `passport` 0.5.0 or newer with the four-tool CLI protocol; older servers fail before any tool call.
|
|
47
|
+
- A profile saved by `passport-bridge login` belongs to an agent, not the CLI. `status`, `doctor`, and every gateway command say so (`This sign-in was made for an agent by passport-bridge login, so Passport CLI can't use it.`, exit 2, cause `agent_sign_in`) and name `passport login` (with `--cloud <origin>` off passportmcp.com); the agent keeps its own sign-in.
|
|
47
48
|
- `passport help [command]` documents every option. `help`, `version`, `profiles`, `use`, and `completion` work offline.
|
|
48
49
|
|
|
49
50
|
## Commands
|
|
@@ -62,6 +63,7 @@ passport run github_search_issues '{"query":"SSO"}'
|
|
|
62
63
|
| `describe <tool>` | One exact definition with its full parameter schema. |
|
|
63
64
|
| `run <tool> [json]` | Run a tool through Passport governance. |
|
|
64
65
|
| `connect [app...] [--alias <name>] [--open] [--wait <s>]` | Show member sign-in links and optionally wait for completion. |
|
|
66
|
+
| `request <app> [--full] --reason "<why>"` | Ask an admin for an app you don't have, or for Full access where you have Read-only. A person decides in Passport; nothing is granted here. See [Asking for access](#asking-for-access). |
|
|
65
67
|
| `resources [uri] [--out <file>]` | List or read MCP resources. |
|
|
66
68
|
| `prompts [name] [--set k=v] [--out <file>]` | List or get MCP prompts. |
|
|
67
69
|
| `scan [--path <dir>] [--verbose] [--check]` | Find keys your agents can reach on this computer and what each can do, without an account. Signed in, also report the MCP servers set up in your agents to your workspace and exit 5 when its policy doesn't allow one. `--check` scans files only (not the shell environment), never reports, and exits 5 on a high or medium key. |
|
|
@@ -69,10 +71,12 @@ passport run github_search_issues '{"query":"SSO"}'
|
|
|
69
71
|
| `wait <approval-id> [--timeout <s>]` | Wait for a person to decide an approval request, until they do or it expires. Agents run it in the background. |
|
|
70
72
|
| `rules test "<command>" [--environment <kind>]` | What Autopilot decides for a command, why, and which environment it acts on. |
|
|
71
73
|
| `sessions [--all\|--running\|--production-changes] [--project <name>] [--pr <n>] [--since <when>]`, `sessions <id>` | Your agents' work items by project, Notable first; the Production changes ledger; or one session's outcome and recent actions. |
|
|
74
|
+
| `changes [--env production] [--since <when>] [--until <date>]` | What your agents changed in Production, one row each, grouped by app and newest first. |
|
|
72
75
|
| `undo <action-id>\|--last [--option <id>] [--yes]` | Undo an action Passport took a backup before, within 7 days. See [Undo](#undo). |
|
|
73
76
|
| `setup` | Install and maintain assigned team workflows as managed skills. |
|
|
74
77
|
| `session` | Run NDJSON commands over one authenticated MCP session. |
|
|
75
78
|
| `access` | Signed managed access: `keygen`, `actions`, `run`, `invoke`, `status`, `cancel`. |
|
|
79
|
+
| `update`, `update check`, `update off\|on` | Install the exact version Passport names, check what runs here, or turn automatic updates off on this computer. See [Updates](#updates). |
|
|
76
80
|
| `completion <bash\|zsh\|fish>` | Print a completion script. Offline. |
|
|
77
81
|
| `help [command]`, `version` | Help; package version and local profile context. |
|
|
78
82
|
|
|
@@ -101,6 +105,17 @@ passport connect github --wait 120
|
|
|
101
105
|
- The CLI never retries after a network failure or timeout, since the outcome is unknown.
|
|
102
106
|
- `connect` with no app names uses one aggregate link when several apps need sign-in. Agent tokens get guidance but cannot create sign-in links.
|
|
103
107
|
|
|
108
|
+
### Asking for access
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
passport request github --full --reason "Open the release pull request for the fix"
|
|
112
|
+
passport request linear --reason "Triage this week's bugs"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- `request` files the same request an agent's `passport_request_access` files (`POST /api/my/app-requests`), into the queue admins already answer. It prints `Asked: Full access to GitHub. An admin at Acme decides.` and `Run your command again once it's approved.`; asking again for the same thing says `Already asked`. Where the workspace lets you add the app yourself, or you already have it, it says so and files nothing. `--json` prints `{filed:true,requestId,status,what,created,app}` or `{filed:false,message,app}`.
|
|
116
|
+
- The reason (10 to 280 characters) goes to the admin. Agent tokens can't ask: their owner does. Ten requests an hour per person, shared with agents.
|
|
117
|
+
- A Read-only or No access block names it: `You have read-only access to GitHub in Passport, so only reads run. Ask an admin for full access: passport request github --full --reason "<why>"`, then the app's Access link on the next line.
|
|
118
|
+
|
|
104
119
|
### Resources and prompts
|
|
105
120
|
|
|
106
121
|
```sh
|
|
@@ -221,7 +236,7 @@ Two hooks per agent. `passport hook` runs after each shell command and records t
|
|
|
221
236
|
|
|
222
237
|
- **Allow** (Claude Code `permissionDecision: "allow"`, Cursor `permission: "allow"`) only when every part of the line is understood and allowed: vendor commands in `src/cliHookVendors.ts` read with confidence, and everyday commands (below). Substitutions, heredocs, variables in a path, unknown wrappers or environment prefixes, scripts, aliases, `make`, and programs Passport doesn't know mean no decision, so the agent's own permission rules apply. Codex can't receive allow; its own approvals apply (see `passport sync`).
|
|
223
238
|
- **Ask** or **deny** when any recognized command needs it. The strictest part of a compound command wins and names itself. `--help` and `--dry-run` never ask.
|
|
224
|
-
- Each reason names its cause in one line: `Passport: railway redeploy changes Production. Approve to run it
|
|
239
|
+
- Each reason names its cause in one line: `Passport: railway redeploy changes Production. Approve to run it.` A change a safety pack raises says what it does and how it's decided: `Passport: railway variables --set changes Production. Rules decide it like a delete. Approve to run it.` (`rules test` shows `Class: Change, decided like a Delete`), or `Blocked by a team rule: no deletes in Production. Ask an admin to run it, or request an exception in Passport.` (a cause that isn't a rule reads `Blocked by Passport: <cause>`).
|
|
225
240
|
|
|
226
241
|
**Speed.** Hooks must never slow agents down. The launcher `$PASSPORT_HOME/cli/bin/passport` (written by `src/initInstall.ts`) answers plain reads and local dev commands in POSIX sh without starting Node (`src/launcherFastPath.ts`): `ls`, `cat`, `rg`, `git status`, `cargo check`, and the rest of a fixed list, joined only by single pipes, with relative paths that stay in the folder and pass through no symlink or hidden file. It answers only while `cli-policy/fastpath.ok` is armed: a full guard run arms it for five minutes when the cached rules give those commands exactly the launcher's answer (`src/hookFastPath.ts`), and a policy or profile change removes it. Each answer appends one line (agent, session id, program names, never an argument) to `cli-policy/fastpath.spool`, which the next full run counts. Anything else, or any doubt, starts Node with the same input, through `dist/hookMain.js`, which loads only the guard. `src/launcherFastPath.test.ts` holds the launcher to the full guard's exact answer across both corpora and generated variants. `PASSPORT_HOOK_FAST=0` turns it off. The after-hook and the guard's own report never wait on the network: they queue to `$PASSPORT_HOME/hook-outbox/` and a detached `passport hook flush` sends them within the budget (`src/hookOutbox.ts`). Each guard run records its timings (numbers only, `src/cliSpeed.ts`), sent every five minutes with the answered counts. `npm run bench:guard` times it all on the compiled CLI.
|
|
227
242
|
|
|
@@ -250,19 +265,21 @@ The guard decides from local data inside `HOOK_BUDGET_MS` (1.5 s) and prints fir
|
|
|
250
265
|
|
|
251
266
|
An ask becomes one Activity row. In Claude Code, with the audit hook registered, the guard parks its report in `$PASSPORT_HOME/hook-pending/` (`src/cliHookPending.ts`, mode 600, claimed by atomic rename). The audit hook for the same tool-use id sends the run with `decision: "ask", ran: true` ("asked first, then ran"). An ask nobody claims within 30 minutes (no agent fires a hook for a declined prompt) is sent by the next hook run as `ran: false` ("asked first, not run"). An allow the server gave is parked the same way, so the run's row says `Approved earlier this session`. Cursor has no tool-use id to match, so its asks are sent at once as their own "asked first" row. Denies are always sent at once; asks and blocks the server decided are recorded by the server.
|
|
252
267
|
|
|
253
|
-
- Claude Code: `PreToolUse`, plus `PostToolUse` and `PostToolUseFailure` (failed or interrupted calls, recorded as ran with a non-zero exit), in `~/.claude/settings.json` (`CLAUDE_CONFIG_DIR` honored).
|
|
268
|
+
- Claude Code: `PreToolUse`, plus `PostToolUse` and `PostToolUseFailure` (failed or interrupted calls, recorded as ran with a non-zero exit), in `~/.claude/settings.json` (`CLAUDE_CONFIG_DIR` honored). The audit entry also runs on `SessionStart`, `SessionEnd`, and (0.26.0+) `UserPromptSubmit`, for late approvals below.
|
|
254
269
|
- Codex: the same events in `~/.codex/hooks.json` (`CODEX_HOME` honored). Codex sends every shell command as `tool_name: "Bash"` with the model's raw command string in `tool_input.command` (never shell-wrapped), so it is read exactly like Claude Code's; its `apply_patch` tool is a file edit, not a shell command, and isn't recorded. Codex supports deny only (an ask fails the hook open, and its allow rewrites commands), so an ask is a deny there that says why (`Codex can't ask from a hook, so Passport blocked it. Approve it in Passport or run it yourself.`), recorded as a block. With a member profile and Autopilot, it goes to Passport like an unattended ask: an approval request, then the waiting line. Trust the hooks in Codex's `/hooks`.
|
|
255
270
|
- Cursor: `beforeShellExecution`/`afterShellExecution` in `~/.cursor/hooks.json`. Cursor also imports Claude Code's hooks by default; that imported copy records nothing when Passport's own Cursor entry exists, so rows aren't doubled.
|
|
256
271
|
|
|
257
272
|
**Hold for approval** (`src/cliHookHold.ts`). When nobody is at the keyboard and Passport opens an approval request, the guard holds for a person before answering: `hook install --guard` and `init` write `passport hook guard --hold 25` with the entry's `timeout` at 40 seconds for Claude Code (`--hold <0-45>` changes it; `0` writes today's entry; `hook install` also fixes a timeout that's too short). At runtime the hold is capped by the timeout Claude Code enforces on that entry, read from its settings, and an entry the guard can't find means no hold. If someone approves in time, the guard asks Passport again with the same request, which consumes the approval once and re-checks every rule, and only that allow runs the original command, with no retry. Anything else (no decision, a decline, expiry, an error, or a slow answer) declines the command with one line: who decides, when the request expires, and `Run "passport wait <id>" as a background command; it exits when someone decides. Then run this command again.` A decline during the hold carries the person's note. An entry without `--hold` never holds, because Claude Code runs a command when its hook outlives the timeout; `PASSPORT_HOOK_HOLD` can shorten a hold, never lengthen it. Codex never holds (its hook can't run an approved command), and neither does Cursor (what it does when a hook outlives its timeout isn't documented). Managed installs (`init --org`) don't hold yet, since a person's older CLI wouldn't know the flag. A guard from before the hold (no `--hold`, or a timeout too short for it) is named once a day, and once per CLI version, after an interactive command on a terminal: `Approvals can now continue automatically. Run: passport hook install --apply` (stderr; never from the hook, piped, or with `--json`). `passport doctor` shows the same as a warning, and `hook install --apply` keeps an existing guard current without `--guard`. Each approval binds to a normalized command key (`src/cliHookKey.ts`): every word and redirect target is redacted first, then quoting, pipes into read-only filters whose flags are all on that filter's harmless list, `2>&1`, output sent to /dev/null, and a trailing `|| true` are ignored, so an equivalent retry matches the same request. A key that still shows anything the summary hides falls back to the summary, and a key over 400 characters is sent as a SHA-256 of the whole key.
|
|
258
273
|
|
|
274
|
+
**Late approvals** (`src/approvalNotice.ts`, 0.26.0+). A guarded command's request stays open a day even after the agent stops waiting (its hold ended, its turn finished, or the session closed), including a `passport exec` that waited at the keyboard. Approving it then leaves a one-time pass for that exact command in that session: the agent's next try (the same command key, the same session id) gets the server's allow, once, and the pass lapses a day after the approval. A decline stays final. Nothing runs by itself. So the agent knows, the guard (and `exec`) leaves a marker per Claude Code session when it opens a request (`$PASSPORT_HOME/hook-approvals/<digest>.json`, mode 600, a time only, at most 200, two days), and the audit entry, on that session's next `SessionStart` (a resume) or `UserPromptSubmit`, asks `POST /api/my/cli/approved` with `{runtime, sessionId}` inside the hook's budget. Passport answers what it approved there that the agent hasn't used or heard about, marking each told, and the hook prints Claude Code's `hookSpecificOutput.additionalContext`: `Passport: a command this session asked about earlier was approved after you stopped waiting. It hasn't run.`, one line per approval with the command, who approved it (a display name, never an email), when, and when it lapses, then `If it's still needed, run the exact same command again; the approval lets it run once. Otherwise, ignore this.` The marker goes once nothing in the session waits. A prompt with no marker on the computer never touches the network or loads the hook: `src/hookPromptFast.ts` reads the event first and exits (about Node's own start, ~4 ms more on an M-series Mac). Codex and Cursor take no such context: their pass is used when the agent tries the command again. Existing installs add the `UserPromptSubmit` entry with `passport hook install --apply`.
|
|
275
|
+
|
|
259
276
|
**Guard health** (`src/cliGuardHealth.ts`, states and fixes in `src/cliGuardState.ts`, a checked copy of `shared/guardContract.ts`). `passport hook status` and `passport status` show each agent's guard in the web's words, **On**, **Off**, **Outdated**, **Not trusted**, or **Locked**, and each problem's fix (on a terminal the command goes on its own `Run:` line): `passport hook install --agent <agent> --guard --apply`, `npx passport-bridge@latest init`, or `Open Codex → /hooks and trust Passport's hooks.` At most once a day (`$PASSPORT_HOME/guard/.<profile>.heartbeat`) the CLI sends `POST /api/my/guard-health` with `{cliVersion, launcherTarget?, clients: [{client, present, mode, guard, plugin, codexTrust?, locked?, disabledEnv?}]}`: flags only, never a command, path, or value. It goes from a guard run with at least 300 ms of its budget left (a hook's first one waits a day), from `passport exec`, and from `passport status`. Codex trust (`src/cliCodexTrust.ts`) compares `trusted_hash` in `~/.codex/config.toml` `[hooks.state."<hooks.json>:pre_tool_use:<group>:<handler>"]` with Codex's own hash of Passport's guard entry: SHA-256 of the sorted-key JSON of `{event_name, matcher?, hooks: [{type, command, timeout (600 when unset), async, statusMessage?, additionalContextLimit? (when not 2500)}]}`, as in openai/codex `hook_hash`/`version_for_toml`, checked against codex-cli 0.146.0's `hooks/list`. Missing is **Not trusted**, a different hash is **Not trusted** (modified), `enabled = false` is **Off**. **Locked** means managed settings hold Passport's guard: `/Library/Application Support/ClaudeCode/managed-settings.json` (and `managed-settings.d/`), `/etc/claude-code/…`, `/etc/codex/requirements.toml`, `/Library/Application Support/Cursor/hooks.json`, or `/etc/cursor/hooks.json` (`PASSPORT_MANAGED_ROOT` points tests elsewhere).
|
|
260
277
|
|
|
261
278
|
**Coverage** (`src/cliSeen.ts`). The guard counts every command it saw, per agent per day, one character per command in `$PASSPORT_HOME/seen/<profile>.<agent>.<day>.log` (an app's action, not checked, or neither), and Cursor's imported copy of Claude Code's hook doesn't count twice. Counts go in their own batches, at most every five minutes, as `seen: {batch, day, count, governed, opaque}` on `POST /api/my/cli-activity`, never inside a report that can expire. `passport status` prints `Checked: 94% of commands Passport saw this week`.
|
|
262
279
|
|
|
263
280
|
**When Passport can't be reached.** A local run, block, or attended ask stands as decided. When the guard needs Passport (an unattended ask, Codex, or a Production action someone else approves) and it doesn't answer within the budget, the environment's `offline` setting from cli-policy v2 decides: ask, block, or allow (ask everywhere by default). An ask nobody can answer (unattended, or Codex) blocks, a second-person action is always blocked, and allow never covers an irreversible action or an ask from a team floor, team or workspace rule, approver rule, or approved exception. A policy synced more than 7 days ago uses the default. The reason ends with one line saying why, such as `Nobody is here to approve it and Passport couldn't be reached, so it's blocked.`
|
|
264
281
|
|
|
265
|
-
**App access.** The person's pass for the app a `passport exec` CLI acts on (Railway for `railway`, GitHub for `gh`, and so on) comes with cli-policy v2 as `access`, one record per CLI whose app limits the person (an older server's `appAccess` map is read the same way). The guard applies it before any rule, and no rule or exception lifts it. No access blocks every command of that CLI with `You don't have access to Railway in Passport. Ask an admin
|
|
282
|
+
**App access.** The person's pass for the app a `passport exec` CLI acts on (Railway for `railway`, GitHub for `gh`, and so on) comes with cli-policy v2 as `access`, one record per CLI whose app limits the person (an older server's `appAccess` map is read the same way). The guard applies it before any rule, and no rule or exception lifts it. No access blocks every command of that CLI with `You don't have access to Railway in Passport. Ask an admin: passport request railway --reason "<why>"` and, on the next line, a link to the app's Access tab; read-only blocks everything but reads and names `passport request railway --full --reason "<why>"`. `passport exec` says the same (exit 5, cause `no_access`, with `Access: <link>`). A CLI whose app isn't in the workspace keeps working from its key.
|
|
266
283
|
|
|
267
284
|
`src/cliPolicy.ts` caches the member's CLI policy (`GET /api/my/cli-policy`) at `$PASSPORT_HOME/cli-policy/<profile>.json` (mode 600). Servers with Autopilot send version 2 (`src/cliPolicyV2.ts`: presets, floors, CLI rules, irreversible and delete verbs, environment flags, placed environments); older servers send version 1, and then the guard keeps its earlier shape: ask or deny before destructive verbs, never allow, no server call, and reports without the Autopilot fields. `passport login` and `passport status` refresh it and `passport logout` removes it. A 404 or error keeps the previous copy; with no copy the guard asks before every destructive verb. `PASSPORT_HOOK_DISABLED=1` turns both hooks off.
|
|
268
285
|
|
|
@@ -277,7 +294,9 @@ passport rules test "railway redeploy -e staging"
|
|
|
277
294
|
passport rules test "rm -rf ~/"
|
|
278
295
|
passport wait apr_123
|
|
279
296
|
passport sessions # or: --all, --running, --production-changes
|
|
297
|
+
passport sessions --project acme-api # the project's page, then its work
|
|
280
298
|
passport sessions ses_123
|
|
299
|
+
passport changes --env production --since 1h
|
|
281
300
|
passport sync # or: passport sync --remove
|
|
282
301
|
passport env # or: passport env set railway qa staging
|
|
283
302
|
passport actions add scripts/deploy.py --environment production --class change
|
|
@@ -288,7 +307,8 @@ passport actions sync # propose this repository's .passport/actions.toml
|
|
|
288
307
|
|
|
289
308
|
- `rules test` classifies the command here and sends only its app and verb (and the environment kind) to `POST /api/my/rules/test`, never the command line. An everyday command goes as a finding (`{finding: {vendor, verb, risk, environment}}`), because only this computer can place its paths. It prints the decision, its cause, the environment, and the class. Without a server answer it decides from this computer's copy and says how old it is. `--environment` picks one when the flags don't say.
|
|
290
309
|
- `wait` long-polls `GET /api/my/approvals/<id>/wait` (30 s per request), after a short first look that names who decides, until a person decides or the request expires; `--timeout <s>` caps it. Agents run it as a background command and are woken when it exits. Once Passport says the request is still pending (never for one that doesn't exist or is already decided), on a terminal it prints the approval link and one live line (`Waiting for Erin · 1:32 left`); piped, `Waiting for a decision on <id> (until it expires at 14:05).` and `Open in Passport: <url>`. Ctrl-C exits 4 with `The request is still open. Keep waiting any time.` and `Run: passport wait <id>`. Approved: `Approved by Ramish (once). Run the command again.`, or `… for this session. Matching commands in this session run without asking.` (exit 0). Declined: the person's note, cleaned and labelled, `Declined by Ramish. Their note: "Use staging first"` (exit 5, cause `approval_denied`). Expired: `Expired at 14:05 with no decision. Run the command again to ask again.` (exit 5, cause `approval_expired`). Still waiting at `--timeout`: exit 4 with the same command as `next`.
|
|
291
|
-
- `sessions` lists work items the way the Sessions page does (`GET /api/my/work-items`): a pull request or branch with every session on it rolled up, grouped by project (or, for app connections, by the apps they used). Each item has its agents, then one shape line: actions, active time, failed, confirmed Production changes, unplaced changes, asks with how they ended, blocked, data checks, undone, and the share Passport couldn't check. Notable items come first; the rest fold into `14 routine work items · 3,200 reads · nothing needed you`. `--all` lists every item, `--running` only those with a running session, and `--production-changes` prints the ledger (`GET /api/my/production-ledger`, 7 days unless `--since`): changes to confirmed Production by app and target, then the unplaced count with a link to set environments. `--project`, `--pr`, `--since` (`today`, `24h`, `7d`, `30d`, `90d`, or a date read in local time), and `--status running|ended` go to the server, which applies them to every session in the window, never to a loaded page. The CLI follows up to five pages and then links the rest. `sessions <id>` reads one session (`GET /api/my/agent-sessions/<id>`): its title, place, agent, and active time; the web page's summary strip (actions, shipped, Production, failed, asked, not checked, undo, data checks); and its 15 latest actions with what each acted on, where it landed, and how it ended. On a terminal parts wrap only between `·` and the timeline stacks when it doesn't fit; piped output never wraps and has no color.
|
|
310
|
+
- `sessions` lists work items the way the Sessions page does (`GET /api/my/work-items`): a pull request or branch with every session on it rolled up, grouped by project (or, for app connections, by the apps they used). Each item has its agents, then one shape line: actions, active time, failed, confirmed Production changes, unplaced changes, asks with how they ended, blocked, data checks, undone, and the share Passport couldn't check. Notable items come first; the rest fold into `14 routine work items · 3,200 reads · nothing needed you`. `--all` lists every item, `--running` only those with a running session, and `--production-changes` prints the ledger (`GET /api/my/production-ledger`, 7 days unless `--since`): changes to confirmed Production by app and target, then the unplaced count with a link to set environments. `--project`, `--pr`, `--since` (`today`, `24h`, `7d`, `30d`, `90d`, or a date read in local time), and `--status running|ended` go to the server, which applies them to every session in the window, never to a loaded page. The CLI follows up to five pages and then links the rest. `--project <name>` on its own (no lens, `--pr`, or `--status`) opens with the web project page's summary (`GET /api/my/projects/<name>`): sessions and how many run, Environments (the repository's placement, then each platform its changes reached and how many were unplaced), the rules for the apps and scripts it uses, and its Production changes in the last 7 days, then the work list; `--json` adds it as `project` (`{project,link,sinceTs,environments:[{appKey,appName,role,label,kind,source,reached,unplaced}],rules:[{id,kind,label,decision}],moreRules,production:{total,unplaced,apps},totals}`), and a server without the page prints the list alone. A work item with several sessions links to its own page (`#projects/<name>/work?branch=`). `sessions <id>` reads one session (`GET /api/my/agent-sessions/<id>`): its title, place, agent, and active time; the web page's summary strip (actions, shipped, Production, failed, asked, not checked, undo, data checks); and its 15 latest actions with what each acted on, where it landed, and how it ended. On a terminal parts wrap only between `·` and the timeline stacks when it doesn't fit; piped output never wraps and has no color.
|
|
311
|
+
- `changes` lists every change, delete, and irreversible action that ran on confirmed Production in the window (`GET /api/my/production-changes`), the list Sessions › Production changes shows: grouped by app, newest first, each with its time and command (and what it acted on), then the agent, the person, the pull request (else branch), Failed or Approved, and Undo available, Undone by, or Undo expired. Consecutive alike changes (same command, target, agent, person, repository, and branch) fold into one line, `git push → main ×28` with their span of times, unless one failed, was approved, or has an undo state; `--json` keeps every change. With changes from more than one repository, each line names its repository. Blocked and declined actions never reached Production and aren't listed; unplaced changes are one count with a link to set environments. `--since` takes `1h`, `6h`, `24h` (the default), `7d`, `30d`, `today`, or a date read in local time; `--until` a date; `--project`, `--pr`, `--app`, and `--agent` narrow on the server. `--env` accepts only `production` for now. When the window holds more than one read returns, it says so and links the web page. The deploy and error lanes are web-only.
|
|
292
312
|
- `sync` writes the allows Passport is sure of into each agent's own permission settings, so those prompts disappear offline and in Codex (`src/nativeSync.ts`). Only reads, test runners, builds and type checks, linters that only check, `git status`, `git add`, and `git commit`, checked against the person's rules. Formatters, fixing linters, `mv`/`cp`, and package scripts stay with the hook, which sees what they touch; deletes, installs, pushes, and Production never sync. Claude Code: `Bash(npm test *)` in `permissions.allow` of `~/.claude/settings.json`. Codex: `prefix_rule(pattern = ["npm", "test"], decision = "allow")` in `~/.codex/rules/passport.rules`, a file Passport owns. Cursor CLI: `Shell(npm:test*)` in `permissions.allow` of `~/.cursor/cli-config.json`. Cursor: `npm test` in `terminalAllowlist` of `~/.cursor/permissions.json`, only when that list already exists there (defining it replaces Cursor's in-app list). Entries Passport added are listed in `$PASSPORT_HOME/native-sync.json`; an entry you had before is never claimed or removed, and a file Passport can't parse exactly (JSONC) is left alone. Sync runs on `init`, `init --org`, every rules refresh, and `passport sync`; `hook uninstall`, `sync --remove`, and signing out of the last profile take the entries out.
|
|
293
313
|
- `status` is one screen, like `gh auth status`, with a label per row (`You` with the name you signed in as, `Computer`, `Guard`, `Autopilot`, `Apps`, `Keys`, `Shims`, `This folder`, `Allowlists`, `CLI`); under 60 columns each label gets its own row, and piped it never wraps. `Guard` lists each agent's guard (`✓ Claude Code On`, `! Codex Not trusted`) with its fix on the line under it, the coverage line, and sends the daily guard report when due. It also adds today's speed line, `Passport adds ~20 ms per action and asked you twice today. 412 actions ran on their own.` (across your computers when the server keeps speed numbers, else `(this computer)`), and `Answered for you: N prompts today` (allows the hook gave in Claude Code and Cursor, and Codex commands Passport synced, counted only when the agent would have prompted) and which agents' allowlists are synced. Under the presets, one line per exception that lets something run your presets would ask about, in the web's words: `! 1 exception: deletes run in Production without asking, even without a backup.` Counts are appended locally (`$PASSPORT_HOME/answered/`) and sent in batches at most every five minutes as `answered: {batch, count}` on `POST /api/my/cli-activity`.
|
|
294
314
|
- `actions` tells Passport what a project script does (`src/cliActions.ts`): `actions add <script> [args…] --environment <kind> --class <class>` sends the path in the repository (or `make`, `npm`, `pnpm`, `yarn` with the target), an argument glob, the repository's remote fingerprint and name, and the SHA-256 of what it runs, never its contents, to `POST /api/my/project-actions`. `--id <op_…>` resolves a Session row's **Tell Passport what this does** from this computer's scan cache. `actions sync` proposes each entry of `.passport/actions.toml`. A change, delete, or irreversible in Production applies at once; anything looser waits for an admin. The guard then decides a matching run as vendor `project` with that class and environment; it never makes a line allowed on its own, and a changed script stops matching (`projectChanged`) until it's set again. `.passport/actions.toml` entries apply locally only when they ask or block.
|
|
@@ -301,6 +321,7 @@ passport keys move # confirm each key [y/N], store it in Passport, si
|
|
|
301
321
|
passport keys move railway # only the Railway key
|
|
302
322
|
passport keys # what Passport holds, and what's still on this computer
|
|
303
323
|
passport keys add railway # store a key you paste (stdin, never echoed)
|
|
324
|
+
passport keys rotate railway # replace it with a new key, checked with Railway first
|
|
304
325
|
passport exec -- railway up -e staging
|
|
305
326
|
passport keys shim # the CLIs that run through Passport when you type them
|
|
306
327
|
```
|
|
@@ -313,8 +334,9 @@ passport keys shim # the CLIs that run through Passport when you type
|
|
|
313
334
|
- Keys stay in Passport: while Passport holds a working key for a CLI (the exec marker), the guard denies that CLI's own sign-in (`railway login`, `gh auth login`, `aws sso login`, `fly auth login`, …) in Claude Code, Codex, and Cursor with `Passport holds your Railway key; run it through Passport: passport exec -- railway <command>.`, and `exec` (so a shim) refuses it the same way. `keys move` signs a browser sign-in out (Railway, Vercel, and Wrangler session fields only) when Passport already holds a working key, without sending it anywhere. The first interactive `keys move` asks once, `Keep my CLIs signed out? … [y/N]`; with yes, the daily check removes a returned key while Passport holds a working one and reports it as `autoRemoved` (the server records a `cli_key_removed` silent fix for each). `passport keys signed-out [on|off]` changes the answer. Both choices live in `$PASSPORT_HOME/keys-choices/<profile>.json` (vendor names and the answer only).
|
|
314
335
|
- Dev loops: `railway run|shell|connect`, `vercel dev|build`, and `supabase functions serve` stay refused by `exec`; `wrangler dev` runs through it only when Passport hands out a short-lived Cloudflare key (otherwise exec refuses before the command runs). `passport keys keep <cli> [--remove]` keeps a CLI signed in here on purpose: the guard lets its sign-in run, Passport never removes it, its shim goes, and the report counts it under `kept` (with local copy `dev` on the key), never as a key left to move. The release computer's Railway key is kept the same way (`releases`). `remaining` is counted one way everywhere: one per CLI sign-in `keys move` can act on, by provider.
|
|
315
336
|
- `keys move` finds CLI sign-ins (Railway, GitHub CLI, Vercel, Wrangler API tokens, Supabase, Stripe test keys, the AWS `default` profile) and tokens in Claude Code's settings `env`. For each it asks `[y/N]` (Enter keeps it; `--yes` moves them all; `keys move <cli>` only that CLI's), stores the key in Passport (`POST /api/my/keys`), then signs that CLI out by removing only the credential: the token fields of `~/.railway/config.json` (project links stay), `token` in Vercel's `auth.json` (not revoked; the current team stays), Wrangler's sign-in keys in `default.toml`, the Supabase `access-token` file and its keychain token (saved database passwords stay), the Stripe profile's API keys and its live key in the keychain (account, color, and other profiles stay), the AWS profile's key lines, or the one settings entry. Files are written atomically with their mode kept. Vendor sign-outs don't run because they do more (`railway logout` unlinks every project, `vercel logout` revokes the token Passport just stored); only the GitHub CLI's `gh auth logout --hostname github.com` runs, adding `--user <active>` when several accounts are signed in, so other hosts and accounts stay. Keychain items are deleted by exact service and account (`security delete-generic-password` on macOS, `secret-tool clear` on Linux); where that isn't possible the row says which keychain copy may stay. Wrangler OAuth tokens are removed locally, not revoked. A sign-out that fails leaves the key in Passport and says what's left on disk. `.env` files are never touched: "Used by your app, so Passport leaves it." Browser-session sign-ins (Railway, Vercel, Wrangler OAuth) can't move; the line says how to make a token instead. A different key than the one already in Passport is replaced only when the person types the CLI's name at a terminal (`Type railway to confirm, or press Enter to cancel:`); no flag does it, so an agent's script can never swap a key. The CLI then names the key it replaces (`replace: <keyId>` on `POST /api/my/keys`). The server alerts the owner and admins with an Undo, records it in the audit trail, and keeps the old value encrypted for seven days (`POST /api/my/keys/:id/restore` from the browser, or the alert). Without a person at a terminal (`--yes`, no terminal), both keys stay, and the line says `Replacing a key in Passport needs you at a terminal. Run passport keys move railway yourself.` The scan report sent afterwards carries provider counts only.
|
|
337
|
+
- `keys rotate <app>` (an app like `github` or `cloudflare`, or its CLI) replaces a key Passport holds. It needs a person at a terminal: without one, or with `--json`, it exits 6 and nothing is read or sent, and no flag answers for you. It reads `GET /api/my/keys` for the key and its rotation guide, prints where to make the new key (`Make a new Railway key at https://railway.com/account/tokens` and one step), asks `Paste the new Railway key (it won't be shown): ` with echo off (AWS: the id and secret on one line), and sends it once to `POST /api/my/keys/:id/rotate` with this computer's name. Passport checks it with one harmless read at the provider (Railway `me`, GitHub `/user`, Vercel `/v2/user`, Cloudflare token verify, Supabase projects, Stripe balance, AWS `GetCallerIdentity`, Neon `/users/me`, Fly.io `viewer`) before it swaps anything, in one locked update that refuses if the key changed meanwhile. A refused, unchecked, or unchanged key exits 1 with `Railway didn't accept that key. Your old key is unchanged.` (or the matching line). On success it prints `✓ Railway accepted the new key. Agents use it from now on.`, then `Now revoke the old key at Railway: <page>` and the step. Like every replace from the CLI, the old value stays restorable for seven days and the owner and admins get an alert with an Undo; **Done** in the web records the revoke. The value is never printed, logged, or in `--json`; the audit trail says who rotated which app's key, when, and from which computer.
|
|
316
338
|
- `exec -- <cli> …` runs railway, gh, vercel, wrangler, supabase, stripe, aws, neonctl, or flyctl from PATH. It classifies the command here, asks `POST /api/my/exec/authorize`, and on allow sets only that vendor's variables (`GH_TOKEN`, `RAILWAY_API_TOKEN`, `VERCEL_TOKEN`, `CLOUDFLARE_API_TOKEN`, `SUPABASE_ACCESS_TOKEN`, `STRIPE_API_KEY`, `AWS_*`, `NEON_API_KEY`, `FLY_API_TOKEN`) in the child's environment, removing Passport's own and any stray vendor tokens. Output and exit code pass through. Afterwards it reports the exit code and duration (`POST /api/my/exec/result`, best effort, two seconds at most) so the session row reads Ran or Failed. It refuses paths, shells, `env`, and subcommands that would print the key, sign in again, mint longer-lived tokens, or run another program with the key (`railway run`, `gh auth`, gh extensions, `aws configure`, `vercel dev`, `fly tokens`).
|
|
317
|
-
- Asks wait for your approval in Passport (web or push) when you're at the keyboard or with `--wait <sec>`; otherwise exit 4 with the approval id: run `passport wait <id>`, then the command again. While it waits, the approval link prints at once and, on a terminal, one live line counts down (`Waiting for Erin · 1:32 left`); piped, it prints the waiting line and `Open in Passport: <url>`. Ctrl-C exits 4: `The request is still open. Keep waiting, then run the command again.` and `Run: passport wait <id>`. An approval is used once. Blocked or declined: exit 5. A decline answers the same command for ten minutes, said with who and when: `Declined 2 minutes ago by Erin: Not during the freeze.` and `Run with --ask-again to request again.`; `--ask-again` opens a new request. No key, or it stopped working: exit 3 (`No Railway key in Passport yet
|
|
339
|
+
- Asks wait for your approval in Passport (web or push) when you're at the keyboard or with `--wait <sec>`; otherwise exit 4 with the approval id: run `passport wait <id>`, then the command again. While it waits, the approval link prints at once and, on a terminal, one live line counts down (`Waiting for Erin · 1:32 left`); piped, it prints the waiting line and `Open in Passport: <url>`. Ctrl-C exits 4: `The request is still open. Keep waiting, then run the command again.` and `Run: passport wait <id>`. An approval is used once. Blocked or declined: exit 5. A decline answers the same command for ten minutes, said with who and when: `Declined 2 minutes ago by Erin: Not during the freeze.` and `Run with --ask-again to request again.`; `--ask-again` opens a new request. No key, or it stopped working: exit 3 (`No Railway key in Passport yet.` with `Run: passport keys add railway`, or `Your Railway key in Passport stopped working. Update it in Apps.`). When this computer still has the Railway CLI's own sign-in, the no-key line is `No Railway key in Passport yet, but this computer has one.` with `Run: passport keys move railway` instead (read here; Passport never sees this computer's files). Offline: exit 1, nothing runs, and exec never uses a key on this computer instead. A team that requires the guard refuses exec for an agent whose computer hasn't reported its guard On in 48 hours: exit 5 with `Blocked by Passport: guard required…` and the fix.
|
|
318
340
|
- In Claude Code, the guard rewrites a plain vendor command whose key is in Passport to `passport exec` (PreToolUse `updatedInput` with allow; a block stays a deny). When the rules ask, or someone is at the keyboard, the rewrite adds `--wait 120`, so the agent holds while the person approves: "Approve it on your phone or in Passport." Codex and Cursor get no rewrite: use `passport exec` there.
|
|
319
341
|
- Cloud agents (Agents → Cloud agents) run exec and MCP with their agent token in `PASSPORT_AGENT_KEY` and `PASSPORT_ENDPOINT`: the owner's rules decide, the owner's keys are used, and approvals go to the owner.
|
|
320
342
|
- Backups: for `gh issue close`, `gh pr close`, `gh api -X DELETE` of a branch, `vercel env rm`, `vercel rollback`, and `vercel promote`, exec also sends the ids Passport needs to take a backup first (repo and number or branch; the linked Vercel project and variable name from `.vercel/project.json`), never a value. After the run it prints `Backup taken. Undo within 7 days: passport undo <action-id>`, or `No backup: <reason>` for a delete it couldn't back up.
|
|
@@ -324,8 +346,13 @@ passport keys shim # the CLIs that run through Passport when you type
|
|
|
324
346
|
```sh
|
|
325
347
|
passport undo act_123
|
|
326
348
|
passport undo --last --yes
|
|
349
|
+
passport undo --local
|
|
350
|
+
passport undo --local <id> --yes
|
|
327
351
|
```
|
|
328
352
|
|
|
353
|
+
- `--local` lists the backups the guard kept on this computer in the last 7 days (`bridge/src/localBackups.ts`): `rm` of project or home paths moved to a per-project trash (Claude Code: the guard rewrites the command to `passport hook trash`), work `git reset --hard`/`clean`/`checkout --`/`restore` threw away (a commit through a temporary index under `refs/passport/backups/<id>`), dropped stashes, and refs `git branch -d`/`tag -d`/`update-ref -d`/`push --delete`/`push --force` moved. With an id (8+ characters) it shows what comes back, asks, and puts it back; anything there now is replaced only after its own question (left as it is without a terminal). Exit 0 when everything is back, 1 when some of it was left. The audit row of such a command carries `backup: "taken"` and the backup's id, so the row in Passport says **Undo on** this computer with the exact command.
|
|
354
|
+
- **Send to** this computer in Passport queues a restore here. The next time you run `passport` in a terminal (or `passport undo --local`), it shows what comes back and asks; nothing is put back without that yes, never from the hook, a script, or `--yes`. Passport's row then says what happened.
|
|
355
|
+
|
|
329
356
|
- Shows what comes back and what won't, how old the backup is, and how long undo stays available, then asks `Undo it? [y/N]` (and which option, when there are several). Without a terminal it prints the preview and `passport undo <id> --yes`; `--option <id>` picks an option.
|
|
330
357
|
- Passport decides an undo from the CLI like a change in that environment. Asks first: exit 4 with the approval id; run `passport wait <id>`, then the undo again. Blocked or declined: exit 5. Done: exit 0, with each step (`✓`/`✗`). Partly done or failed: exit 1. Expired, already undone, or otherwise unavailable: exit 5 with the reason. No backup: exit 6. Needs a member profile.
|
|
331
358
|
|
|
@@ -344,6 +371,18 @@ printf '%s\n' \
|
|
|
344
371
|
- Allowed commands: `status`, `search`, `describe`, `run`, `connect`, `resources`, `prompts` (and `discover`, the old inventory name, for one release).
|
|
345
372
|
- Governance is unchanged; access tokens keep normal expiry and refresh.
|
|
346
373
|
|
|
374
|
+
### Updates
|
|
375
|
+
|
|
376
|
+
`passport update` moves this computer's Passport CLI to the exact `passport-bridge` version Passport names (`src/cliUpdate.ts`, `src/selfUpdate.ts`): the one you or your admin asked for on **Agents** (`Update`, or `Update all N` on **Agents → Everyone**), else the newest published version (a server-side constant, `LATEST_PUBLISHED_BRIDGE_VERSION` in `shared/agentUpdateContract.ts`). A range, a tag, a prerelease, or a version not newer than this one is never installed.
|
|
377
|
+
|
|
378
|
+
- **Passport's own copy** (`$PASSPORT_HOME/cli/<version>/`, what `init` and the plugin install): `npm view passport-bridge@<version> version` must answer exactly that version, then `npm install passport-bridge@<version> --ignore-scripts --omit=dev` into a temporary folder (the package's `npm-shrinkwrap.json` pins its dependencies). The staged copy must say it is that version and answer `version --json` with it; then it is copied to `cli/<version>/` and the launchers and `cli/current` switch over with one rename each. The launcher hooks run (`cli/bin/passport`) must then answer `version --json` with the new version, or the old launchers and link go back byte for byte and the new folder is removed. Hook entries never change, so Claude Code, Codex (its `trusted_hash` stays valid), Cursor, managed (`--lock`) installs, and the Passport plugin (which reads the launcher's `exec '<node>' '<entry>'` line) all follow. The old version's folder stays, so a command running from it keeps running.
|
|
379
|
+
- **A global npm install**: `npm install --global passport-bridge@<version> --ignore-scripts`, then the same check; if the new version doesn't start, the old version is installed again.
|
|
380
|
+
- **npx or any other copy**: left alone, and reported as such.
|
|
381
|
+
|
|
382
|
+
npm runs without a shell (the npm next to this Node, else `npm` on PATH), one update at a time per computer (`$PASSPORT_HOME/update/.lock`). Only version numbers, the install kind (`copy`, `global`, `npx`, `other`), and a reason code (`off`, `npx`, `unmanaged`, `not-published`, `permission`, `network`, `install-failed`, `verify-failed`) reach Passport; npm's output never leaves the computer.
|
|
383
|
+
|
|
384
|
+
**Automatic updates.** On a signed-in computer, after a command that worked (not `scan`), and from the hooks' detached flush, at most every 15 minutes per computer (`$PASSPORT_HOME/update/.checked`), the CLI starts a detached `passport update --background` (`src/updateTrigger.ts`) and returns; nothing waits for it. It sends `POST /api/my/agent-update/check {version, auto, install}` and installs only a version someone requested, then reports `POST /api/my/agent-update/report {from, version, outcome, reason?, install}`. `passport update off` (stored in `$PASSPORT_HOME/update/settings.json`) keeps checking so Agents can say "Automatic updates are off on this computer.", but never installs; `PASSPORT_AUTO_UPDATE=off` also stops the checks. There are no checks in CI (`CI`), from an agent token, inside an update, or from npx's cache. `passport update` by hand works with automatic updates off.
|
|
385
|
+
|
|
347
386
|
### Shell completion
|
|
348
387
|
|
|
349
388
|
```sh
|
|
@@ -438,31 +477,33 @@ Questions follow one convention (`src/cliAsk.ts`), only on a terminal: `[Y/n]` f
|
|
|
438
477
|
|
|
439
478
|
On a terminal, human output comes from one renderer (`src/term.ts`): it wraps to the window's width (at least 40 columns, at most 100) without breaking a URL or a `passport` command, hangs wrapped lines under their label or mark, stacks a table one row at a time when its columns don't fit, and clips a live line (a countdown, a "Checking…" row) to one row so it's always replaced cleanly. Marks always sit next to words (`✓ On`, `! Not trusted`, `– skipped`), with `+`, `!`, `-` where the terminal can't show them. Piped output never wraps, has no color, and draws no live lines. `NO_COLOR` and `TERM=dumb` turn color off.
|
|
440
479
|
|
|
441
|
-
| Command | JSON value
|
|
442
|
-
| ---------------------- |
|
|
443
|
-
| `login` | `{profile,endpoint,client,surface,active,workspaceId,workspaceName?,memberName?,next}`; without a terminal or with `--json`, step one is `{status:"pending",verification_url,code,expires_in,next_step,login_id,next}`
|
|
444
|
-
| `profiles` | `{profiles:[{name,active,client?}],active?}`
|
|
445
|
-
| `use` | `{profile,active:true}`
|
|
446
|
-
| `logout` | `{profile,removed,revoked,shimsRemoved?}`
|
|
447
|
-
| `status` | `{workspace,member,endpoint,auth,profile?,client,mcps,autopilot?:{presets,floors,floorReason?,exceptions?,cache:{version,fetchedAt,ageMs}},next?,computer,keys?,keysOnThisComputer?,folder,cli:{version},signedInAs?,shims?:[{vendor,command,state}]}`
|
|
448
|
-
| `wait` | `{approvalId,status:"approved",scope?,message}`; declined, expired, and still-waiting are errors with `approvalId`
|
|
449
|
-
| `rules` | `{command,decision,cause?,explanation?,environment?,environmentAssumed?,actionClass?,source}`
|
|
450
|
-
| `sessions` | `{view,groups:[{key,kind,label,apps,running,production,unplaced,items:[{key,title,project,branch,pull,agents,sessions,sessionIds,startedAt,lastActivityAt,activeMs,running,waiting,shape,reasons,severity,link}],routine:{count,sessions,actions,reads,items}\|null}],totals,complete,nextCursor}
|
|
451
|
-
| `
|
|
452
|
-
| `
|
|
453
|
-
| `
|
|
454
|
-
| `
|
|
455
|
-
| `
|
|
456
|
-
| `
|
|
457
|
-
| `
|
|
458
|
-
| `
|
|
459
|
-
| `
|
|
460
|
-
| `
|
|
461
|
-
| `
|
|
462
|
-
| `
|
|
463
|
-
| `
|
|
464
|
-
| `
|
|
465
|
-
| `
|
|
480
|
+
| Command | JSON value |
|
|
481
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
482
|
+
| `login` | `{profile,endpoint,client,surface,active,workspaceId,workspaceName?,memberName?,next}`; without a terminal or with `--json`, step one is `{status:"pending",verification_url,code,expires_in,next_step,login_id,next}` |
|
|
483
|
+
| `profiles` | `{profiles:[{name,active,client?}],active?}` |
|
|
484
|
+
| `use` | `{profile,active:true}` |
|
|
485
|
+
| `logout` | `{profile,removed,revoked,shimsRemoved?}` |
|
|
486
|
+
| `status` | `{workspace,member,endpoint,auth,profile?,client,mcps,autopilot?:{presets,floors,floorReason?,exceptions?,cache:{version,fetchedAt,ageMs}},next?,computer,keys?,keysOnThisComputer?,folder,cli:{version},signedInAs?,shims?:[{vendor,command,state}]}` |
|
|
487
|
+
| `wait` | `{approvalId,status:"approved",scope?,message}`; declined, expired, and still-waiting are errors with `approvalId` |
|
|
488
|
+
| `rules` | `{command,decision,cause?,explanation?,environment?,environmentAssumed?,actionClass?,source}` |
|
|
489
|
+
| `sessions` | `{view,groups:[{key,kind,label,apps,running,production,unplaced,items:[{key,title,project,branch,pull,agents,sessions,sessionIds,startedAt,lastActivityAt,activeMs,running,waiting,shape,reasons,severity,link}],routine:{count,sessions,actions,reads,items}\|null}],totals,complete,nextCursor}` (`--project <name>` alone adds `project`); `--production-changes`: `{view,sinceTs,untilTs,total,unplaced,apps:[{appKey,appName,count,lastTs,targets:[{target,tool,actionClass,count,failed,firstTs,lastTs}]}]}`; `<id>`: `{view,session,outcome,approvals,timeline,nextCursor}` |
|
|
490
|
+
| `changes` | `{view,environment,sinceTs,untilTs,total,unplaced,complete,apps:[{vendor,appName,changes:[{id,ts,person,agent,agentName,appKey,vendor,appName,command,target,actionClass,result,approved,sessionId,project,branch,pull,undo}]}]}` |
|
|
491
|
+
| `undo` | `{actionId,status,message,steps:[{label,ok,detail?}],option,undoActionId?}`; without `--yes` off a terminal, `{actionId,status:"preview",preview,next}`; pending, blocked, and declined are errors |
|
|
492
|
+
| `doctor` | `{version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}`, also on failure |
|
|
493
|
+
| `ready` | `{ready,version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}` |
|
|
494
|
+
| `search` | Gateway payload with `results` or `catalog`, and `note` |
|
|
495
|
+
| `describe` | Tool definition (`tool`, `parameters`) plus `name`/`inputSchema` aliases |
|
|
496
|
+
| `run` | Full governed MCP tool result, including `structuredContent` |
|
|
497
|
+
| `connect` | Gateway payload with `connections` and optional `connectAllUrl` |
|
|
498
|
+
| `resources`, `prompts` | MCP list, read, or get result |
|
|
499
|
+
| `discover` | `{snapshot,report,compliant}` (the old name of `scan`'s inventory step, for one release) |
|
|
500
|
+
| `scan` | `{version:1,findings:[{id,provider,kind,label,severity,location,locations,blastRadius}],agents,unreadable,checked,inventory?:{snapshot,report,compliant}}`; `inventory` only when signed in, or `{error}` when it couldn't be sent |
|
|
501
|
+
| `session` | NDJSON `{id?,ok,exitCode,result?}` or `{id?,ok:false,error,cause,exitCode,...}` |
|
|
502
|
+
| `access` | `keygen`: algorithm, paths, public JWK; `actions`: `{actions}`; `run`/`cancel`: `{run}`; `invoke`: governed result; `status`: `{receipt}` |
|
|
503
|
+
| `update` | `{version,latest,requested,auto,install,outcome?,to?}`; `check` leaves out `outcome`; `off`/`on`: `{auto}`. A failed update is an error with `cause: "update_failed"` and a `hint`. |
|
|
504
|
+
| `completion` | `{shell,script}` |
|
|
505
|
+
| `help` | `{command,help}` |
|
|
506
|
+
| `version` | `{version,profileCount,profileSelected,selectionSource,next,endpoint?,profile?}` |
|
|
466
507
|
|
|
467
508
|
Errors: `{"error":"...","cause":"blocked","exitCode":5,"app":"github"}`, optionally with `approvalId`, `hint`, `profiles`, `next` (`argv` plus description), `remediation`, `retry`, `requiredInput`, or `connectUrl`.
|
|
468
509
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Late approvals, told to the agent. When a guarded command waits for a
|
|
3
|
+
* person and the agent stops waiting (its turn ended, the session closed),
|
|
4
|
+
* the person can still approve it for a day. That leaves a one-time pass for
|
|
5
|
+
* the same command in the same session, used on the agent's next try.
|
|
6
|
+
*
|
|
7
|
+
* So the agent knows, Claude Code's next hook in that session (SessionStart
|
|
8
|
+
* when it is resumed, or UserPromptSubmit when the person types again) asks
|
|
9
|
+
* Passport what was approved and adds one line of context per approval: what,
|
|
10
|
+
* by whom (a display name), and when. Passport marks each one told, so the
|
|
11
|
+
* agent hears about it once. Nothing runs here: the agent decides whether to
|
|
12
|
+
* run the command again.
|
|
13
|
+
*
|
|
14
|
+
* Every prompt runs this hook, so it asks Passport only for a session this
|
|
15
|
+
* computer saw wait for a person: the guard (and `passport exec`) leaves a
|
|
16
|
+
* small marker per session when it opens a request, and the hook removes it
|
|
17
|
+
* once nothing in the session waits or is left to tell. Codex and Cursor have
|
|
18
|
+
* no such context: their pass is used when the agent tries the command again.
|
|
19
|
+
*
|
|
20
|
+
* Markers are owner-only files named by a digest of the agent and session id,
|
|
21
|
+
* hold only a time, and are bounded in count and age. Never throws.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CLI_APPROVED_PATH = "/api/my/cli/approved";
|
|
24
|
+
/** A request stays open a day, and its pass a day after approval. */
|
|
25
|
+
export declare const MARKER_MAX_AGE_MS: number;
|
|
26
|
+
/** The hook events that can carry context into the agent. */
|
|
27
|
+
export declare const NOTICE_EVENTS: Set<string>;
|
|
28
|
+
type ApiCall = (path: string, init: RequestInit) => Promise<Response>;
|
|
29
|
+
export type ApprovedNotice = {
|
|
30
|
+
approvalId: string;
|
|
31
|
+
action: string;
|
|
32
|
+
command?: string;
|
|
33
|
+
approvedBy: string;
|
|
34
|
+
approvedAt: number;
|
|
35
|
+
expiresAt: number;
|
|
36
|
+
};
|
|
37
|
+
/** The guard or `passport exec` opened a request a person answers: remember
|
|
38
|
+
* the session, so its next prompt asks Passport. False when it couldn't. */
|
|
39
|
+
export declare function noteWaitingSession(runtime: string, sessionId: string | undefined, now?: number): boolean;
|
|
40
|
+
/** Whether this session left a marker recently enough to ask about. */
|
|
41
|
+
export declare function sessionWaited(runtime: string, sessionId: string, now?: number): boolean;
|
|
42
|
+
export declare function forgetSession(runtime: string, sessionId: string): void;
|
|
43
|
+
/** Validate what Passport said. Anything unexpected is no answer. */
|
|
44
|
+
export declare function parseApproved(raw: unknown): {
|
|
45
|
+
approved: ApprovedNotice[];
|
|
46
|
+
waiting: number;
|
|
47
|
+
} | null;
|
|
48
|
+
/** Ask Passport, or null when it couldn't answer in time. Never throws. */
|
|
49
|
+
export declare function fetchApproved(api: ApiCall, runtime: string, sessionId: string, signal: AbortSignal): Promise<{
|
|
50
|
+
approved: ApprovedNotice[];
|
|
51
|
+
waiting: number;
|
|
52
|
+
} | null>;
|
|
53
|
+
/** "40 minutes", "3 hours" (at least a minute). */
|
|
54
|
+
export declare function span(ms: number): string;
|
|
55
|
+
/** What the agent reads: one line per approval, and what to do about it. */
|
|
56
|
+
export declare function noticeContext(notices: readonly ApprovedNotice[], now: number): string;
|
|
57
|
+
/** Claude Code's shape for context a hook adds to the conversation. */
|
|
58
|
+
export declare function contextOutput(event: string, context: string): Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* The notice for one hook event, or null. Asks Passport only for a Claude
|
|
61
|
+
* Code session that waited for a person, inside the hook's budget.
|
|
62
|
+
*/
|
|
63
|
+
export declare function approvalNotice(input: {
|
|
64
|
+
hook_event_name?: unknown;
|
|
65
|
+
session_id?: unknown;
|
|
66
|
+
cursor_version?: unknown;
|
|
67
|
+
}, context: {
|
|
68
|
+
runtime: string;
|
|
69
|
+
openApi: () => Promise<ApiCall | null>;
|
|
70
|
+
signal: AbortSignal;
|
|
71
|
+
now: () => number;
|
|
72
|
+
}): Promise<Record<string, unknown> | null>;
|
|
73
|
+
export {};
|