passport-bridge 0.16.6 → 0.16.8

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 (70) hide show
  1. package/README.md +32 -20
  2. package/dist/bridgeExchange.d.ts +1 -1
  3. package/dist/bridgeExchange.js +1 -1
  4. package/dist/cli.js +6 -6
  5. package/dist/cliActions.d.ts +28 -0
  6. package/dist/cliActions.js +224 -0
  7. package/dist/cliApprovalLink.d.ts +5 -0
  8. package/dist/cliApprovalLink.js +21 -0
  9. package/dist/cliArgs.d.ts +1 -1
  10. package/dist/cliArgs.js +17 -7
  11. package/dist/cliAutopilot.d.ts +3 -1
  12. package/dist/cliAutopilot.js +13 -2
  13. package/dist/cliAutopilotPolicy.d.ts +13 -0
  14. package/dist/cliExec.js +3 -3
  15. package/dist/cliGuardHealth.d.ts +3 -1
  16. package/dist/cliGuardHealth.js +6 -43
  17. package/dist/cliHook.d.ts +2 -1
  18. package/dist/cliHook.js +52 -14
  19. package/dist/cliHookClassify.d.ts +12 -0
  20. package/dist/cliHookDeliver.d.ts +16 -0
  21. package/dist/cliHookDeliver.js +12 -2
  22. package/dist/cliHookGuard.d.ts +1 -1
  23. package/dist/cliHookGuard.js +50 -7
  24. package/dist/cliHookInstall.js +1 -1
  25. package/dist/cliHookLocal.d.ts +6 -0
  26. package/dist/cliHookLocal.js +56 -3
  27. package/dist/cliHookLocalCode.d.ts +11 -0
  28. package/dist/cliHookLocalCode.js +18 -5
  29. package/dist/cliHookScripts.d.ts +51 -0
  30. package/dist/cliHookScripts.js +247 -0
  31. package/dist/cliHookStatus.js +4 -4
  32. package/dist/cliInit.js +1 -1
  33. package/dist/cliLogin.js +1 -1
  34. package/dist/cliOpaqueId.d.ts +10 -0
  35. package/dist/cliOpaqueId.js +48 -0
  36. package/dist/cliOutput.js +18 -10
  37. package/dist/cliPolicyV2.js +54 -2
  38. package/dist/cliScan.js +3 -3
  39. package/dist/cliScriptRead.d.ts +199 -0
  40. package/dist/cliScriptRead.js +512 -0
  41. package/dist/cliScriptText.d.ts +78 -0
  42. package/dist/cliScriptText.js +412 -0
  43. package/dist/cliSession.d.ts +1 -0
  44. package/dist/cliSession.js +2 -0
  45. package/dist/cliSetup.js +3 -3
  46. package/dist/cliSetupLock.d.ts +37 -0
  47. package/dist/cliSetupLock.js +330 -0
  48. package/dist/cliSetupOrg.d.ts +2 -0
  49. package/dist/cliSetupOrg.js +28 -2
  50. package/dist/cliSupport.d.ts +4 -0
  51. package/dist/completion.js +8 -4
  52. package/dist/hookFastPath.js +0 -5
  53. package/dist/initLocalSteps.js +7 -7
  54. package/dist/launcherFastPath.d.ts +4 -1
  55. package/dist/launcherFastPath.js +4 -7
  56. package/dist/lockedHooks.d.ts +99 -0
  57. package/dist/lockedHooks.js +178 -0
  58. package/dist/managedHooks.d.ts +10 -0
  59. package/dist/managedHooks.js +80 -0
  60. package/dist/managedSkills.js +4 -4
  61. package/dist/passport.js +5 -4
  62. package/dist/pluginPin.d.ts +1 -1
  63. package/dist/pluginPin.js +1 -1
  64. package/dist/recoveryIdentity.js +2 -2
  65. package/dist/version.d.ts +1 -1
  66. package/dist/version.js +1 -1
  67. package/dist/webLinks.d.ts +5 -0
  68. package/dist/webLinks.js +49 -0
  69. package/npm-shrinkwrap.json +2 -2
  70. package/package.json +1 -1
package/README.md CHANGED
@@ -68,7 +68,7 @@ passport run github_search_issues '{"query":"SSO"}'
68
68
  | `rules test "<command>" [--environment <kind>]` | What Autopilot decides for a command, why, and which environment it acts on. |
69
69
  | `sessions [--status running\|idle\|ended]` | Your agents' recent sessions with what Passport decided. |
70
70
  | `undo <action-id>\|--last [--option <id>] [--yes]` | Undo an action Passport took a backup before, within 7 days. See [Undo](#undo). |
71
- | `setup --org <pek_key> [--yes] [--clients <list>]` | Set up every agent on this computer for your company without asking anything (MDM and scripts). See [Company rollout](#company-rollout). |
71
+ | `setup --org <pek_key> [--yes] [--agents <list>] [--lock [--strict]]` | Set up every agent on this computer for your company without asking anything (MDM and scripts); `--lock` (root) locks the guard on. See [Company rollout](#company-rollout). |
72
72
  | `setup` | Install and maintain assigned team workflows as managed skills. |
73
73
  | `session` | Run NDJSON commands over one authenticated MCP session. |
74
74
  | `access` | Signed managed access: `keygen`, `actions`, `run`, `invoke`, `status`, `cancel`. |
@@ -152,15 +152,15 @@ Eight steps, each reusing the command that owns it:
152
152
 
153
153
  What changes on disk, and how to undo it:
154
154
 
155
- | Where | What | Undo |
156
- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- | -------------------------------------------------- |
157
- | `~/.passport/credentials.json` | A `cli@<workspace>` profile, as `passport login` writes | `passport logout` |
158
- | `~/.passport/cli/` | A copy of this CLI, the `bin/passport` launchers hooks run, and a `current` link | Delete the folder (after removing the hooks) |
159
- | `~/.claude.json` | A `passport` MCP server entry, via `claude mcp add` | `claude mcp remove --scope user passport` |
160
- | `~/.codex/config.toml` | `[mcp_servers.passport]`, via `codex mcp add` | `codex mcp remove passport` |
161
- | `~/.cursor/mcp.json` | `mcpServers.passport` | Delete that entry |
162
- | VS Code user `mcp.json` | `servers.passport` | `MCP: List Servers`, then remove it |
163
- | `~/.claude/settings.json`, `~/.codex/hooks.json`, `~/.cursor/hooks.json` | Passport's audit and guard hooks | `passport hook uninstall --client <agent> --apply` |
155
+ | Where | What | Undo |
156
+ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- | ------------------------------------------------- |
157
+ | `~/.passport/credentials.json` | A `cli@<workspace>` profile, as `passport login` writes | `passport logout` |
158
+ | `~/.passport/cli/` | A copy of this CLI, the `bin/passport` launchers hooks run, and a `current` link | Delete the folder (after removing the hooks) |
159
+ | `~/.claude.json` | A `passport` MCP server entry, via `claude mcp add` | `claude mcp remove --scope user passport` |
160
+ | `~/.codex/config.toml` | `[mcp_servers.passport]`, via `codex mcp add` | `codex mcp remove passport` |
161
+ | `~/.cursor/mcp.json` | `mcpServers.passport` | Delete that entry |
162
+ | VS Code user `mcp.json` | `servers.passport` | `MCP: List Servers`, then remove it |
163
+ | `~/.claude/settings.json`, `~/.codex/hooks.json`, `~/.cursor/hooks.json` | Passport's audit and guard hooks | `passport hook uninstall --agent <agent> --apply` |
164
164
 
165
165
  Before editing a file it didn't create, init says which file and keeps one copy of the original as `<file>.passport-backup`. It changes only Passport's own entries, writes atomically, refuses a malformed file with one line, and leaves an existing Passport entry alone unless it points at npm's cache or a file that's gone. Ctrl-C at any point stops cleanly; run init again to pick up where it left off. A question only takes keys typed after it appears, so an Enter pressed during a pause never answers it. Any wait longer than a moment shows what it's for in the step's row (`Sign in Checking your sign-in…`); off a terminal nothing extra prints. If Passport can't be reached, init says `Couldn't reach Passport at <origin>. Check your connection, then run passport init again.` and exits 1. Without a terminal, `init` needs `--yes` (exit 6 otherwise), and `--json` needs `--yes`. It never edits your shell profile: it prints the one `PATH` line to add if you want `passport` everywhere.
166
166
 
@@ -168,7 +168,7 @@ Before editing a file it didn't create, init says which file and keeps one copy
168
168
 
169
169
  ```sh
170
170
  npx passport-bridge@latest setup --org pek_example --yes # Jamf, Kandji, Intune, or any script
171
- npx passport-bridge@latest setup --org pek_example --clients claude-code,codex
171
+ npx passport-bridge@latest setup --org pek_example --agents claude-code,codex
172
172
  ```
173
173
 
174
174
  `init` for MDM: it never asks anything and never signs in. It installs the stable copy of the CLI, adds Passport to every detected agent (Claude Code, Cursor, Codex, VS Code; Claude Desktop gets the connector step) at the one URL with the enrollment key as its hint (`https://passportmcp.com/mcp?enroll=pek_…`), turns on the guard and audit hooks for Claude Code, Codex, and Cursor, and records the key in `$PASSPORT_HOME/enrollment.json` (mode 600). It prints one line per agent:
@@ -181,7 +181,14 @@ Codex ✓ Passport added · sign in: codex mcp login passport · guard o
181
181
  Each agent asks you to sign in to Passport the first time it connects.
182
182
  ```
183
183
 
184
- The first line names the workspace the key pre-selects (`GET /api/auth/enrollment/<key>`, public, no credential). It exits 0 even with no agents (`No supported agents found. Nothing to set up.`), so an MDM run never fails a computer without them. A malformed key or `--clients` list exits 6, and so does a key the server doesn't know or has revoked, with the server's one line (`This enrollment key isn't valid.` or `This enrollment key was revoked. Ask your admin for a new one.`) before anything changes. `passport login` on that computer later passes the recorded key: as the browser sign-in hint (`POST /api/auth/cli/start { enroll }`) and for rollout attribution when the CLI credential is minted (`enrollmentKey`). A server that doesn't serve the one URL yet still gets the CLI, hooks, and key, and the agents wait for `passport init`. Run it again any time: it changes nothing that's in place and repairs what drifted (a removed hook, an entry pointing at npm's cache). The enrollment key is a workspace hint, not a credential: people still sign in as themselves. `--cloud <origin>` (or `PASSPORT_CLOUD`) points it at a self-hosted Passport. `--json` prints `{version,origin,universal,url?,workspace?:{id,name},enrollment,clients:[{agent,name,mcp,guard,message?,next?}]}`.
184
+ The first line names the workspace the key pre-selects (`GET /api/auth/enrollment/<key>`, public, no credential). It exits 0 even with no agents (`No supported agents found. Nothing to set up.`), so an MDM run never fails a computer without them. A malformed key or `--agents` list (`--clients` still works) exits 6, and so does a key the server doesn't know or has revoked, with the server's one line (`This enrollment key isn't valid.` or `This enrollment key was revoked. Ask your admin for a new one.`) before anything changes. `passport login` on that computer later passes the recorded key: as the browser sign-in hint (`POST /api/auth/cli/start { enroll }`) and for rollout attribution when the CLI credential is minted (`enrollmentKey`). A server that doesn't serve the one URL yet still gets the CLI, hooks, and key, and the agents wait for `passport init`. Run it again any time: it changes nothing that's in place and repairs what drifted (a removed hook, an entry pointing at npm's cache). The enrollment key is a workspace hint, not a credential: people still sign in as themselves. `--cloud <origin>` (or `PASSPORT_CLOUD`) points it at a self-hosted Passport. `--json` prints `{version,origin,universal,url?,workspace?:{id,name},enrollment,clients:[{agent,name,mcp,guard,message?,next?}]}`.
185
+
186
+ ```sh
187
+ sudo npx passport-bridge@latest setup --org pek_example --yes --lock # lock the guard on
188
+ sudo npx passport-bridge@latest setup --org pek_example --yes --lock --strict # and allow only managed hooks
189
+ ```
190
+
191
+ `--lock`, run as root, puts the guard and audit hooks in each agent's managed settings instead of the per-person steps (as root those would write into root's home), so people can't turn them off (`src/cliSetupLock.ts`, `src/lockedHooks.ts`, a checked copy of `shared/lockedHooks.ts`). It writes a root-owned launcher (`/Library/Application Support/Passport/bin/passport` on macOS, `/opt/passport/bin/passport` on Linux, 0755) that sets `PASSPORT_HOOK_VIA=managed` and runs the person's own `$PASSPORT_HOME/cli/bin/passport`; without one it lets the command run, or with `--strict` blocks it with `Passport's guard isn't set up for you yet. Run: npx passport-bridge@latest init`. Then per agent: Claude Code gets the drop-in `managed-settings.d/50-passport.json`; Codex's `/etc/codex/requirements.toml` gets Passport's `[features]`/`[hooks]` lines between `# >>> passport` and `# <<< passport`; Cursor's system `hooks.json` gets Passport's two entries beside everyone else's. `--strict` adds `allowManagedHooksOnly` and `onFailure: "block"` (Claude Code), `allow_managed_hooks_only = true` (Codex), and `failClosed` (Cursor). A file it can't merge safely (someone else's drop-in or `[hooks]`, `hooks = false`, `disableAllHooks`, invalid JSON) is left untouched with the fix. Atomic writes, files 0644. Without root, or on Windows, it writes nothing and prints `Locking needs administrator rights. Run it with sudo, or deploy these through MDM:` with each path. `--clients` narrows it; `--strict` without `--lock` exits 6. It exits 0 and prints one line per agent (`Claude Code Locked · <path>`, `Already locked`, or `! Not locked: <reason>`); `--json` prints `{version,lock:{strict,shim,agents:[{agent,state,path,message?}]}}` with `state` one of `locked`, `already_locked`, `conflict`, `needs_admin`, `failed`. A hook from the person's own settings stands down when managed settings already run Passport's guard (`src/managedHooks.ts`). `PASSPORT_MANAGED_ROOT` puts every managed path under a folder (tests). Vendor docs: code.claude.com/docs/en/settings, code.claude.com/docs/en/hooks, learn.chatgpt.com/docs/enterprise/managed-configuration, cursor.com/docs/agent/hooks.
185
192
 
186
193
  ### Team workflows
187
194
 
@@ -189,8 +196,8 @@ Codex and Claude Code on macOS and Linux. Requires a member profile.
189
196
 
190
197
  ```sh
191
198
  passport setup list
192
- passport setup install <setup-id> <workflow-key> --client codex # preview
193
- passport setup install <setup-id> <workflow-key> --client codex --apply
199
+ passport setup install <setup-id> <workflow-key> --agent codex # preview
200
+ passport setup install <setup-id> <workflow-key> --agent codex --apply
194
201
  passport setup installed
195
202
  passport setup rollback <skill-name> --apply
196
203
  passport setup remove <skill-name> --apply
@@ -201,9 +208,9 @@ Changes preview unless `--apply` is passed. Personal edits are preserved. `insta
201
208
  ### Shell hook
202
209
 
203
210
  ```sh
204
- passport hook install --client claude-code --guard --apply # or codex, cursor
211
+ passport hook install --agent claude-code --guard --apply # or codex, cursor
205
212
  passport hook status
206
- passport hook uninstall --client claude-code --guard --apply # guard only
213
+ passport hook uninstall --agent claude-code --guard --apply # guard only
207
214
  ```
208
215
 
209
216
  Two hooks per agent. `passport hook` runs after each shell command and records the vendor, a coarse verb, a risk class, and (with Autopilot) the environment name the flags gave and the guard's decision in Activity; the server works out the class and cause. `passport hook guard` runs before it and decides from the member's Autopilot rules (`src/cliHookGuard.ts`):
@@ -212,7 +219,9 @@ Two hooks per agent. `passport hook` runs after each shell command and records t
212
219
  - **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.
213
220
  - Each reason names its cause in one line: `Passport: railway redeploy changes Production. Approve to run it.`, or `Blocked by Passport: Team rule, no deletes in Production. Ask an admin to run it, or request an exception in Passport.`
214
221
 
215
- **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`, `npm test`, `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.
222
+ **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.
223
+
224
+ **Script reading** (`src/cliScriptRead.ts`, `src/cliScriptText.ts`). For the project's own code, `./x.sh`, `bash x.sh`, `source x.sh`, `make <targets>` (prerequisites first, variables resolved once), and `npm|pnpm|yarn run <name>` or `npm test` (with `pre`/`post` scripts), the guard reads the file and classifies every line like a typed command; the strictest finding wins and says where it came from (`railway up changes Production (from --environment, in deploy.sh)`; Sessions shows `· from deploy.sh`). A line it can't follow makes that part **Partly checked**: no allow, reported as unchecked, with a hash (`opaqueIds`) instead of its name, keyed with 32 random bytes made on the computer and kept in `$PASSPORT_HOME/opaque-salt` (0600), never sent; suggestion counts are therefore per computer. Limits: 256 KB a file, 20 files and 3 levels a command, 30 ms a call. Results are cached in `$PASSPORT_HOME/scan-cache.json` (0600) by path, mtime, and size, then SHA-256; findings only. The after-hook reads it again and reports `drift` when it changed in between. Package scripts no longer take the launcher's fast path, since Node reads them. With a warm cache, a 60-line script adds a few milliseconds; `bench:guard --check` fails over 20 ms.
216
225
 
217
226
  **Everyday commands** (`src/cliHookLocal.ts`, tables in `src/localCommands.ts`, `localTools.ts`, `localFiles.ts`, `localGit.ts`, `localNetwork.ts`). Local commands are placed by what they touch on this computer. The project folder (the git root, else the agent's folder; never `/` or the home folder) is Development: reads such as `ls`, `rg`, `git status`, test runners, linters, builds, and type checks are Reads; `git commit`, formatters with `--write`, package scripts, and `mv`/`cp` are Changes; `rm`, `git clean -fd`, and `git reset --hard` are Deletes. Package installs (`npm install`, `pip install`, `brew install`) are Changes in Other apps. `git push` to the default branch (origin's HEAD, else `main`/`master`) is a Change in Production, to any other branch a Change in Development; deleting a remote branch (`--delete`, `:branch`) is a Delete in Other apps because teammates share it. Temporary folders (`/tmp`, `$TMPDIR`) count as Development; deleting one whole is Irreversible. Outside the project: deleting the home folder, `/`, system paths, or the whole project is Irreversible; other writes are Changes and deletes are Deletes in Other apps; writes to keys, shell startup files, or an agent's own settings are Deletes, and reads of them are no decision. `curl`/`wget` GETs are Reads and anything that sends data is a Change, in Other apps (Development for localhost). docker `ps`/`logs` read, `run`/`build`/`compose up` change, `rm`/`prune` delete. `sudo` never runs silently. The project's own code run directly (`node scripts/check.mjs`, `npx tsx scripts/x.ts`, `bash scripts/ci.sh`, `./scripts/ci.sh`, `make test`) is a Change in Development, like a package script; Passport can't read inside it, so it is never allowed and never recorded as opaque. `tsx --test` and `./node_modules/.bin/<tool>` are their tools, `bash -lc '…'` and `sh -c '…'` are read as the line inside, and Codex's `apply_patch <<'PATCH'` is a change to the files the patch names. A checkout an agent keeps for itself (`~/.codex/worktrees/…`, `~/.cursor/worktrees/…`) is the project, not the agent's settings. Symlinks are resolved before deciding, `cd` is followed through `&&`, `;`, and subshells, and redirects are writes where they land. The server keeps a generated copy of the tables (`node scripts/generate-local-commands.mjs`) for `rules test` on the web. Allowed project work and reads are counted on the machine ("Answered for you") rather than recorded one by one; installs, pushes, and anything that asks or blocks are recorded like vendor commands, with the environment kind and never a path.
218
227
 
@@ -260,6 +269,8 @@ passport wait apr_123
260
269
  passport sessions
261
270
  passport sync # or: passport sync --remove
262
271
  passport env # or: passport env set railway qa staging
272
+ passport actions add scripts/deploy.py --environment production --class change
273
+ passport actions sync # propose this repository's .passport/actions.toml
263
274
  ```
264
275
 
265
276
  - `env` lists where commands in this folder land, read the way each vendor's own CLI reads it (`src/envResolve.ts`; order: flag, the folder's link, the vendor's default, the workspace's saved mapping, the whole-word naming rule, else Production). Link readers: `src/envLinksHosting.ts` (Railway `~/.railway/config.json`, Vercel `.vercel/project.json` / `repo.json`, Supabase `supabase/.temp/project-ref`, Wrangler config, Netlify `.netlify/state.json`, Firebase `.firebaserc` + configstore, Convex `CONVEX_DEPLOYMENT`, Neon `.neon`), `src/envLinksCloud.ts` (Fly, Heroku git remotes, kubeconfig, AWS profile, gcloud configuration, Terraform workspace, Stripe key mode), and `src/envDatabase.ts` (database URLs: only `DATABASE_URL`, `DIRECT_URL`, `POSTGRES_URL*`, `DATABASE_URL_UNPOOLED`, reduced to a host-derived key; the URL, user, and password never leave the function). Files are read fresh for every command, size-capped, and a link file symlinked out of the project is ignored (`src/envLinkFs.ts`). For a placed id its mapping decides, and a different name in the link file is treated as a rename (sent as the new label, which the server stores). A name in a link file never loosens anything: an unplaced id is named only by a label the server confirmed through the connected app (`resources[].confirmed`), which the naming rule then reads (`source: "name"`, shown as `Staging (from its name)`); without one, or when it says nothing, it is assumed Production. The table keeps its columns when every row fits the terminal and stacks each row otherwise. Findings to a server that sends `resources` in cli-policy v2 carry `{kind, source, resourceKey?, label?, platform?, flag?, via}`. `env set` calls `PUT /api/my/environments/:platform/:key`; members may only say Production.
@@ -269,7 +280,8 @@ passport env # or: passport env set railway qa staging
269
280
  - `sessions` lists recent sessions (`GET /api/my/agent-sessions`): status, agent, folder, start, `42 ran · 2 asked · 1 blocked`, environments touched, and `Waiting for you` when approvals are pending.
270
281
  - `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`, `setup --org`, every rules refresh, and `passport sync`; `hook uninstall`, `sync --remove`, and signing out of the last profile take the entries out.
271
282
  - `status` adds each agent's guard (`Guard: Claude Code On · Codex Not trusted`), the coverage line, and each fix, and sends the daily guard report when due. It also adds today's speed line, `Passport added 0.3 s 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`.
272
- - `rules test`, `sessions`, and `sync` need a member profile. `wait` also works for a cloud agent's key, on the approval its own `passport exec` opened.
283
+ - `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.
284
+ - `rules test`, `sessions`, `actions`, and `sync` need a member profile. `wait` also works for a cloud agent's key, on the approval its own `passport exec` opened.
273
285
 
274
286
  ### Keys and passport exec
275
287
 
@@ -338,7 +350,7 @@ Otherwise Passport refuses to guess: run `passport profiles`, then `passport use
338
350
  A distinct agent identity for policy, selection, devices, and activity, while keeping the CLI credential surface:
339
351
 
340
352
  ```sh
341
- passport login --workspace ws_example --client claude-code --profile claude-code@ws_example
353
+ passport login --workspace ws_example --agent claude-code --profile claude-code@ws_example
342
354
  ```
343
355
 
344
356
  ### Caller attribution
@@ -443,7 +455,7 @@ Errors: `{"error":"...","cause":"blocked","exitCode":5,"app":"github"}`, optiona
443
455
 
444
456
  ```sh
445
457
  passport-bridge login --cloud https://passport.example.com --workspace ws_example \
446
- --client cursor --profile cursor@ws_example
458
+ --agent cursor --profile cursor@ws_example
447
459
  ```
448
460
 
449
461
  Configure the agent to launch:
@@ -4,7 +4,7 @@
4
4
  * started serving. We fail closed rather than silently attribute activity to the
5
5
  * wrong workspace.
6
6
  */
7
- export declare const TENANT_FLIP_MESSAGE = "This machine's Passport credential now belongs to a different workspace. Reconnect this agent from the Passport web app or run `passport-bridge login`.";
7
+ export declare const TENANT_FLIP_MESSAGE = "This computer's Passport sign-in now belongs to a different workspace. Reconnect this agent from the Passport web app or run `passport-bridge login`.";
8
8
  /** The saved credential itself was refused: 401 (revoked or expired) or 409
9
9
  * (superseded by a newer rotation that this process cannot see on disk). */
10
10
  export declare class BridgeCredentialError extends Error {
@@ -17,7 +17,7 @@ function safeHostname() {
17
17
  * started serving. We fail closed rather than silently attribute activity to the
18
18
  * wrong workspace.
19
19
  */
20
- export const TENANT_FLIP_MESSAGE = "This machine's Passport credential now belongs to a different workspace. Reconnect this agent from the Passport web app or run `passport-bridge login`.";
20
+ export const TENANT_FLIP_MESSAGE = "This computer's Passport sign-in now belongs to a different workspace. Reconnect this agent from the Passport web app or run `passport-bridge login`.";
21
21
  const ROTATION_PERSISTENCE_MESSAGE = "Passport rotated the credential, but durable local recovery is still pending. Repair the credential store and retry.";
22
22
  /** The saved credential itself was refused: 401 (revoked or expired) or 409
23
23
  * (superseded by a newer rotation that this process cannot see on disk). */
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import { ensureOneLinerRuntime, oneLinerNodeProblem } from "./nodeVersion.js";
14
14
  /**
15
15
  * passport-bridge — the local tier.
16
16
  *
17
- * passport-bridge login [--cloud URL] [--client AICLIENT] [--profile NAME] [--target T]
17
+ * passport-bridge login [--cloud URL] [--agent NAME] [--profile NAME] [--target T]
18
18
  * passport-bridge serve [--profile NAME] (what agents launch)
19
19
  * passport-bridge status
20
20
  * passport-bridge logout [--profile NAME]
@@ -72,7 +72,7 @@ Usage: passport-bridge [command] [options]
72
72
 
73
73
  Commands:
74
74
  serve Connect an agent using a saved profile (default)
75
- login Sign in and save a rotating bridge credential
75
+ login Sign in and save a rotating bridge sign-in
76
76
  status Check saved bridge profiles
77
77
  logout Revoke and remove a saved profile
78
78
  scan Find keys your agents can reach. Local, no account
@@ -83,8 +83,8 @@ Options:
83
83
  --profile <name> Use a named profile (default: default)
84
84
  --cloud <url> Passport URL for login
85
85
  --workspace <id> Workspace for login
86
- --client <name> agent identity for login
87
- --target <target> Credential target for login
86
+ --agent <name> agent identity for login (--client still works)
87
+ --target <target> Sign-in target for login
88
88
  -h, --help Show this help
89
89
  -V, --version Show the package version
90
90
  `);
@@ -103,7 +103,7 @@ async function serve() {
103
103
  if (!refreshToken || !endpoint) {
104
104
  const saved = getProfile(profile);
105
105
  if (!saved) {
106
- log(`no credential for profile "${profile}". Run: passport-bridge login --profile ${profile}`);
106
+ log(`no sign-in for profile "${profile}". Run: passport-bridge login --profile ${profile}`);
107
107
  process.exit(1);
108
108
  }
109
109
  endpoint = saved.endpoint;
@@ -274,7 +274,7 @@ async function login() {
274
274
  // The agent this credential is for (claude-code, cursor, …). Defaults to
275
275
  // the profile name for back-compat; the install instructions always pass it
276
276
  // explicitly so the gateway labels the device and applies policy correctly.
277
- const client = arg("--client", profile);
277
+ const client = arg("--agent", arg("--client", profile));
278
278
  // Which workspace to sign into. A multi-tenant cloud with the demo off can't
279
279
  // resolve a tenant from a bare device/start (there's no session yet), so the
280
280
  // install instructions always pass this; the whole approve chain stays in it.
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `passport actions` (Batch A item 5): tell Passport what a project's own
3
+ * script does, so the guard can check it.
4
+ *
5
+ * passport actions the workspace's project scripts
6
+ * passport actions add <script> [args…] --environment <kind> --class <class>
7
+ * passport actions add --id <op_…> --environment <kind> --class <class>
8
+ * passport actions sync propose this repository's .passport/actions.toml
9
+ *
10
+ * The CLI sends the script's path in the repository, its arguments as a glob,
11
+ * the repository's remote fingerprint and name, and the SHA-256 of what it runs
12
+ * (so Passport can say "changed since set"). Never the script's contents.
13
+ * `--id` resolves a Session row's "Tell Passport what this does" on this
14
+ * computer, from the scan cache: the server only ever had the keyed hash.
15
+ *
16
+ * A member may say a script changes, deletes, or can't be undone in
17
+ * Production; anything else is proposed until an admin approves it.
18
+ */
19
+ import { type ParsedArgs } from "./cliArgs.js";
20
+ import { type MemberApi } from "./cliClient.js";
21
+ import { type LocalFs } from "./cliHookLocal.js";
22
+ import { type CommandResult, type Runtime } from "./cliSupport.js";
23
+ export type ActionsDependencies = {
24
+ api?: MemberApi;
25
+ fs?: LocalFs;
26
+ cwd?: string;
27
+ };
28
+ export declare function actions(args: ParsedArgs, runtime: Runtime, deps?: ActionsDependencies): Promise<CommandResult>;
@@ -0,0 +1,224 @@
1
+ /**
2
+ * `passport actions` (Batch A item 5): tell Passport what a project's own
3
+ * script does, so the guard can check it.
4
+ *
5
+ * passport actions the workspace's project scripts
6
+ * passport actions add <script> [args…] --environment <kind> --class <class>
7
+ * passport actions add --id <op_…> --environment <kind> --class <class>
8
+ * passport actions sync propose this repository's .passport/actions.toml
9
+ *
10
+ * The CLI sends the script's path in the repository, its arguments as a glob,
11
+ * the repository's remote fingerprint and name, and the SHA-256 of what it runs
12
+ * (so Passport can say "changed since set"). Never the script's contents.
13
+ * `--id` resolves a Session row's "Tell Passport what this does" on this
14
+ * computer, from the scan cache: the server only ever had the keyed hash.
15
+ *
16
+ * A member may say a script changes, deletes, or can't be undone in
17
+ * Production; anything else is proposed until an admin approves it.
18
+ */
19
+ import { posix } from "node:path";
20
+ import { readBoundedJson } from "./boundedResponse.js";
21
+ import { value } from "./cliArgs.js";
22
+ import { memberApi } from "./cliClient.js";
23
+ import { localMachine, NODE_FS } from "./cliHookLocal.js";
24
+ import { lookupOpaqueId, normalizeRemote, originUrl, remoteFingerprint, sha256 } from "./cliScriptRead.js";
25
+ import { linesDigestInput, makeLines, packageLines, parseRepoActions } from "./cliScriptText.js";
26
+ import { callerFrom, failure, resolveCliAuth, safeApiError, timeoutMs } from "./cliSupport.js";
27
+ const ENVIRONMENTS = new Set(["production", "staging", "development"]);
28
+ const CLASSES = new Set(["read", "change", "delete", "irreversible"]);
29
+ const RUNNERS = new Set(["make", "npm", "pnpm", "yarn"]);
30
+ const ENV_WORD = { production: "Production", staging: "Staging", development: "Development" };
31
+ function api(args, runtime, deps) {
32
+ if (deps.api)
33
+ return deps.api;
34
+ const auth = resolveCliAuth(args, runtime.env);
35
+ if (auth.kind !== "profile") {
36
+ return failure("This needs a member profile.", 6, "member_profile_required", { hint: "Run: passport login" });
37
+ }
38
+ return memberApi({ auth, caller: callerFrom(args, runtime.env), timeoutMs: timeoutMs(args), signal: runtime.signal });
39
+ }
40
+ /** The repository here: its root, fingerprint, and name. */
41
+ function repository(cwd, runtime, fs) {
42
+ const machine = localMachine(cwd, runtime.env, fs);
43
+ const root = machine.projectRoot;
44
+ const read = (path) => fs.readScript?.(path)?.text ?? fs.readText(path);
45
+ const remote = root ? normalizeRemote(originUrl(root, read) ?? "") : null;
46
+ return {
47
+ root,
48
+ cwd: machine.cwd,
49
+ ...(remote ? { repo: remoteFingerprint(remote), repoName: remote.split("/").pop() } : {})
50
+ };
51
+ }
52
+ /** What `<script> [args…]` names, with the hash of what it runs today. */
53
+ function describeScript(words, explicitArgs, repo, fs) {
54
+ const [first, ...rest] = words;
55
+ if (!first)
56
+ return "Name the script: passport actions add scripts/deploy.sh --environment production --class change";
57
+ const cwd = repo.cwd ?? repo.root;
58
+ if (!cwd)
59
+ return "Run this inside the project.";
60
+ const ids = { ...(repo.repo ? { repo: repo.repo, repoName: repo.repoName } : {}) };
61
+ if (RUNNERS.has(first)) {
62
+ // `make deploy`, `npm run deploy`: what the target or package script runs.
63
+ const target = first === "make" ? rest.join(" ") : `run ${rest.filter((word) => word !== "run").join(" ")}`;
64
+ const args = explicitArgs ?? target;
65
+ const file = first === "make"
66
+ ? ["GNUmakefile", "makefile", "Makefile"].map((name) => posix.join(cwd, name)).find((path) => fs.isFile(path))
67
+ : posix.join(cwd, "package.json");
68
+ const text = file ? fs.readScript?.(file)?.text : undefined;
69
+ const lines = text
70
+ ? first === "make"
71
+ ? makeLines(text, rest)
72
+ : packageLines(text, rest.filter((word) => word !== "run")[0] ?? "")
73
+ : null;
74
+ return {
75
+ program: first,
76
+ args,
77
+ ...ids,
78
+ ...(lines && !lines.partial ? { contentHash: sha256(linesDigestInput(lines)) } : {})
79
+ };
80
+ }
81
+ const path = first.startsWith("/") ? posix.normalize(first) : posix.join(cwd, first);
82
+ if (!fs.isFile(path))
83
+ return `There's no ${first} here.`;
84
+ const real = fs.realpath(path) ?? path;
85
+ const relative = repo.root ? posix.relative(fs.realpath(repo.root) ?? repo.root, real) : posix.basename(real);
86
+ if (!relative || relative.startsWith(".."))
87
+ return "That script is outside this project.";
88
+ const file = fs.readScript?.(real);
89
+ return {
90
+ program: relative,
91
+ args: explicitArgs ?? (rest.length ? rest.join(" ") : "*"),
92
+ ...ids,
93
+ ...(file ? { contentHash: sha256(file.text) } : {})
94
+ };
95
+ }
96
+ function fromOpaque(target) {
97
+ return {
98
+ program: target.program,
99
+ args: target.args || "*",
100
+ ...(target.repo ? { repo: target.repo } : {}),
101
+ ...(target.hash ? { contentHash: target.hash } : {})
102
+ };
103
+ }
104
+ async function post(client, body, args, runtime) {
105
+ const response = await client.fetchApi("/api/my/project-actions", {
106
+ method: "POST",
107
+ headers: { "content-type": "application/json", accept: "application/json" },
108
+ body: JSON.stringify(body),
109
+ signal: AbortSignal.any([runtime.signal, AbortSignal.timeout(timeoutMs(args))])
110
+ });
111
+ if (!response.ok)
112
+ return { error: await safeApiError(response, "Passport couldn't save it."), status: response.status };
113
+ const parsed = (await readBoundedJson(response).catch(() => ({})));
114
+ return { action: parsed.action ?? {} };
115
+ }
116
+ function line(action, fallback) {
117
+ const label = action.label ?? fallback;
118
+ const where = action.environment ? (ENV_WORD[action.environment] ?? action.environment) : "";
119
+ const what = action.actionClass ?? "";
120
+ return action.status === "proposed"
121
+ ? `${label}: proposed (${what} in ${where}). An admin approves it in Passport Rules › Environments.`
122
+ : `${label}: ${what} in ${where}. Passport checks it from now on.`;
123
+ }
124
+ function classified(args) {
125
+ const environment = value(args, "environment")?.toLowerCase() ?? "";
126
+ const actionClass = value(args, "class")?.toLowerCase() ?? "";
127
+ if (!ENVIRONMENTS.has(environment)) {
128
+ return failure("--environment takes production, staging, or development.", 6, "usage");
129
+ }
130
+ if (!CLASSES.has(actionClass))
131
+ return failure("--class takes read, change, delete, or irreversible.", 6, "usage");
132
+ return { environment, class: actionClass };
133
+ }
134
+ async function add(args, runtime, deps) {
135
+ const kind = classified(args);
136
+ const fs = deps.fs ?? NODE_FS;
137
+ const id = value(args, "id");
138
+ let target;
139
+ if (id) {
140
+ const known = lookupOpaqueId(id);
141
+ if (!known) {
142
+ return failure("This computer doesn't know that script. Run the command on the computer that ran it, or name the script.", 6, "unknown_id");
143
+ }
144
+ target = fromOpaque(known);
145
+ }
146
+ else {
147
+ target = describeScript(args.positionals.slice(1), value(args, "args"), repository(deps.cwd ?? process.cwd(), runtime, fs), fs);
148
+ }
149
+ if (typeof target === "string")
150
+ return failure(target, 6, "usage");
151
+ const client = api(args, runtime, deps);
152
+ const saved = await post(client, { ...target, ...kind, source: id ? "session" : "cli" }, args, runtime);
153
+ if ("error" in saved) {
154
+ return failure(saved.error, saved.status === 403 ? 5 : saved.status === 400 ? 6 : 1, "server");
155
+ }
156
+ return { json: { action: saved.action }, human: line(saved.action, target.program), essential: true };
157
+ }
158
+ /** Propose every entry of this repository's `.passport/actions.toml`. */
159
+ async function sync(args, runtime, deps) {
160
+ const fs = deps.fs ?? NODE_FS;
161
+ const repo = repository(deps.cwd ?? process.cwd(), runtime, fs);
162
+ if (!repo.root)
163
+ return failure("Run this inside the project.", 6, "usage");
164
+ const text = fs.readScript?.(posix.join(repo.root, ".passport", "actions.toml"))?.text;
165
+ if (!text)
166
+ return failure("This project has no .passport/actions.toml.", 6, "usage");
167
+ const entries = parseRepoActions(text).filter((entry) => ENVIRONMENTS.has(entry.environment) && CLASSES.has(entry.class));
168
+ if (!entries.length)
169
+ return failure(".passport/actions.toml has no actions Passport can read.", 6, "usage");
170
+ const client = api(args, runtime, deps);
171
+ const lines = [];
172
+ const results = [];
173
+ for (const entry of entries) {
174
+ const target = describeScript([entry.program], entry.args, repo, fs);
175
+ if (typeof target === "string") {
176
+ lines.push(`${entry.program}: ${target}`);
177
+ continue;
178
+ }
179
+ const saved = await post(client, { ...target, environment: entry.environment, class: entry.class, source: "repo" }, args, runtime);
180
+ if ("error" in saved)
181
+ lines.push(`${entry.program}: ${saved.error}`);
182
+ else {
183
+ results.push(saved.action);
184
+ lines.push(line(saved.action, entry.program));
185
+ }
186
+ }
187
+ return { json: { actions: results }, human: lines.join("\n"), essential: true };
188
+ }
189
+ async function list(args, runtime, deps) {
190
+ const client = api(args, runtime, deps);
191
+ const response = await client.fetchApi("/api/my/autopilot", {
192
+ headers: { accept: "application/json" },
193
+ signal: AbortSignal.any([runtime.signal, AbortSignal.timeout(timeoutMs(args))])
194
+ });
195
+ if (!response.ok)
196
+ return failure(await safeApiError(response, "Passport couldn't list them."), 1, "server");
197
+ const body = (await readBoundedJson(response).catch(() => ({})));
198
+ const actions = body.projectActions ?? [];
199
+ const human = actions.length
200
+ ? actions
201
+ .map((action) => {
202
+ const where = action.environment ? (ENV_WORD[action.environment] ?? action.environment) : "";
203
+ const notes = [
204
+ action.repoName ?? "Any repository",
205
+ ...(action.setByName ? [`Set by ${action.setByName}`] : []),
206
+ ...(action.status === "proposed" ? ["Proposed"] : []),
207
+ ...(action.changedAt ? ["Changed since set"] : [])
208
+ ];
209
+ return `${action.label ?? "script"} ${where} · ${action.actionClass ?? ""} ${notes.join(" · ")}`;
210
+ })
211
+ .join("\n")
212
+ : "No project scripts yet. Add one: passport actions add <script> --environment <kind> --class <class>";
213
+ return { json: { actions }, human };
214
+ }
215
+ export async function actions(args, runtime, deps = {}) {
216
+ const action = args.positionals[0];
217
+ if (action === undefined || action === "list")
218
+ return list(args, runtime, deps);
219
+ if (action === "add")
220
+ return add(args, runtime, deps);
221
+ if (action === "sync")
222
+ return sync(args, runtime, deps);
223
+ return failure("Use passport actions, actions add, or actions sync.", 6, "usage");
224
+ }
@@ -0,0 +1,5 @@
1
+ import type { ParsedArgs } from "./cliArgs.js";
2
+ import { type CliFailure, type Env } from "./cliSupport.js";
3
+ /** A failure that names an approval also names where to answer it. Returns
4
+ * the same failure, so the CLI's catch can link it in one step. */
5
+ export declare function linkApproval(error: CliFailure, args: ParsedArgs | undefined, env: Env): CliFailure;
@@ -0,0 +1,21 @@
1
+ import { resolveCliAuth } from "./cliSupport.js";
2
+ import { workspaceOfToken } from "./tokenWorkspace.js";
3
+ import { approvalLink } from "./webLinks.js";
4
+ /** A failure that names an approval also names where to answer it. Returns
5
+ * the same failure, so the CLI's catch can link it in one step. */
6
+ export function linkApproval(error, args, env) {
7
+ const id = error.details.approvalId;
8
+ if (!args || !id || error.details.approvalUrl || error.cause === "unknown_approval")
9
+ return error;
10
+ try {
11
+ const auth = resolveCliAuth(args, env);
12
+ const workspace = auth.kind === "profile" ? workspaceOfToken(auth.refreshToken) : "";
13
+ const url = approvalLink(auth.endpoint, id, workspace || undefined);
14
+ if (url)
15
+ error.details.approvalUrl = url;
16
+ }
17
+ catch {
18
+ // No profile to read the origin from: the approval id alone still works.
19
+ }
20
+ return error;
21
+ }
package/dist/cliArgs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const COMMANDS: readonly ["init", "login", "logout", "profiles", "use", "status", "doctor", "ready", "search", "describe", "run", "connect", "resources", "prompts", "discover", "scan", "hook", "wait", "rules", "sessions", "env", "sync", "exec", "undo", "keys", "setup", "session", "access", "completion", "help", "version"];
1
+ export declare const COMMANDS: readonly ["init", "login", "logout", "profiles", "use", "status", "doctor", "ready", "search", "describe", "run", "connect", "resources", "prompts", "discover", "scan", "hook", "wait", "rules", "actions", "sessions", "env", "sync", "exec", "undo", "keys", "setup", "session", "access", "completion", "help", "version"];
2
2
  export type Command = (typeof COMMANDS)[number];
3
3
  export declare class ArgError extends Error {
4
4
  }
package/dist/cliArgs.js CHANGED
@@ -18,6 +18,7 @@ export const COMMANDS = [
18
18
  "hook",
19
19
  "wait",
20
20
  "rules",
21
+ "actions",
21
22
  "sessions",
22
23
  "env",
23
24
  "sync",
@@ -47,12 +48,16 @@ const FLAGS = {
47
48
  yes: { kind: "boolean", commands: ["init", "setup", "keys", "undo"] },
48
49
  org: { kind: "value", commands: ["setup"] },
49
50
  clients: { kind: "value", commands: ["setup"] },
51
+ lock: { kind: "boolean", commands: ["setup"] },
52
+ strict: { kind: "boolean", commands: ["setup"] },
50
53
  "skip-apps": { kind: "boolean", commands: ["init"] },
51
54
  "skip-agents": { kind: "boolean", commands: ["init"] },
52
55
  "skip-guard": { kind: "boolean", commands: ["init"] },
53
56
  "move-keys": { kind: "boolean", commands: ["init"] },
54
57
  app: { kind: "value", commands: ["search"] },
55
- args: { kind: "value", commands: ["run"] },
58
+ args: { kind: "value", commands: ["run", "actions"] },
59
+ id: { kind: "value", commands: ["actions"] },
60
+ class: { kind: "value", commands: ["actions"] },
56
61
  set: { kind: "repeat", commands: ["run", "prompts"] },
57
62
  "set-json": { kind: "repeat", commands: ["run"] },
58
63
  wait: { kind: "value", commands: ["run", "connect", "exec"] },
@@ -69,12 +74,16 @@ const FLAGS = {
69
74
  "public-jwk-file": { kind: "value", commands: ["access"] },
70
75
  "delegation-id": { kind: "value", commands: ["access"] },
71
76
  "client-id": { kind: "value", commands: ["access"] },
72
- environment: { kind: "value", commands: ["rules"] },
77
+ environment: { kind: "value", commands: ["rules", "actions"] },
73
78
  status: { kind: "value", commands: ["sessions"] },
74
79
  remove: { kind: "boolean", commands: ["sync"] },
75
80
  last: { kind: "boolean", commands: ["undo"] },
76
81
  option: { kind: "value", commands: ["undo"] }
77
82
  };
83
+ /** `--agent` is the documented name; `--client` keeps working everywhere. */
84
+ const FLAG_ALIASES = { agent: "client", agents: "clients" };
85
+ const shownFlag = (name) => Object.keys(FLAG_ALIASES).find((alias) => FLAG_ALIASES[alias] === name) ?? name;
86
+ const passedTwice = (name) => shownFlag(name) === name ? `--${name} may only be passed once.` : `Pass --${shownFlag(name)} or --${name} once.`;
78
87
  export class ArgError extends Error {
79
88
  }
80
89
  function knownCommand(value) {
@@ -109,10 +118,11 @@ export function parseArgs(argv) {
109
118
  command = "version";
110
119
  continue;
111
120
  }
112
- const { name, inline } = flagParts(raw);
121
+ const { name: given, inline } = flagParts(raw);
122
+ const name = FLAG_ALIASES[given] ?? given;
113
123
  const spec = FLAGS[name];
114
124
  if (!spec)
115
- throw new ArgError(`Unknown option: --${name}`);
125
+ throw new ArgError(`Unknown option: --${given}`);
116
126
  if (spec.kind === "boolean") {
117
127
  if (inline !== undefined)
118
128
  throw new ArgError(`--${name} does not take a value.`);
@@ -123,13 +133,13 @@ export function parseArgs(argv) {
123
133
  }
124
134
  const value = inline !== undefined ? inline : argv[++i];
125
135
  if (value === undefined)
126
- throw new ArgError(`--${name} requires a value.`);
136
+ throw new ArgError(`--${given} requires a value.`);
127
137
  if (spec.kind === "repeat") {
128
138
  (repeats[name] ??= []).push(value);
129
139
  }
130
140
  else {
131
141
  if (Object.hasOwn(values, name))
132
- throw new ArgError(`--${name} may only be passed once.`);
142
+ throw new ArgError(passedTwice(name));
133
143
  values[name] = value;
134
144
  }
135
145
  continue;
@@ -158,7 +168,7 @@ export function parseArgs(argv) {
158
168
  for (const name of [...Object.keys(values), ...Object.keys(repeats), ...booleans]) {
159
169
  const allowed = FLAGS[name]?.commands;
160
170
  if (allowed && !allowed.includes(command))
161
- throw new ArgError(`--${name} is not valid with ${command}.`);
171
+ throw new ArgError(`--${shownFlag(name)} is not valid with ${command}.`);
162
172
  }
163
173
  validateShape(command, positionals);
164
174
  validateNumbers(values);
@@ -18,6 +18,7 @@ import { type LocalMachine } from "./cliHookLocal.js";
18
18
  import { type EnvKind } from "./cliHookEnvironment.js";
19
19
  import { type LinkFs } from "./envLinkFs.js";
20
20
  export { env } from "./cliEnv.js";
21
+ export { actions } from "./cliActions.js";
21
22
  import { type CommandResult, type Runtime } from "./cliSupport.js";
22
23
  /** Long enough to be useful, short enough for an agent's default 2-minute
23
24
  * command timeout. */
@@ -89,4 +90,5 @@ export type AutopilotStatus = {
89
90
  export { localMidnight } from "./cliSpeed.js";
90
91
  /** Read presets and floors for `passport status`. Never throws. */
91
92
  export declare function autopilotStatus(fetchApi: (path: string, init: RequestInit) => Promise<Response>, profile: string | undefined, signal: AbortSignal, now?: number): Promise<AutopilotStatus>;
92
- export declare function autopilotLines(status: AutopilotStatus): string[];
93
+ /** `passport status` lines; with the web origin, a link to change the rules. */
94
+ export declare function autopilotLines(status: AutopilotStatus, webOrigin?: string): string[];