passport-bridge 0.13.2 → 0.14.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 +92 -17
- package/dist/cli.js +4 -3
- package/dist/cliArgs.d.ts +1 -1
- package/dist/cliArgs.js +21 -5
- package/dist/cliAutopilot.d.ts +60 -0
- package/dist/cliAutopilot.js +389 -0
- package/dist/cliAutopilotPolicy.d.ts +94 -0
- package/dist/cliAutopilotPolicy.js +193 -0
- package/dist/cliClient.d.ts +7 -0
- package/dist/cliClient.js +36 -19
- package/dist/cliHook.d.ts +20 -9
- package/dist/cliHook.js +125 -32
- package/dist/cliHookClassify.d.ts +3 -0
- package/dist/cliHookClassify.js +2 -1
- package/dist/cliHookDecide.d.ts +89 -0
- package/dist/cliHookDecide.js +167 -0
- package/dist/cliHookEnvironment.d.ts +55 -0
- package/dist/cliHookEnvironment.js +219 -0
- package/dist/cliHookGuard.d.ts +61 -12
- package/dist/cliHookGuard.js +211 -24
- package/dist/cliHookInstall.js +19 -4
- package/dist/cliHookMode.d.ts +31 -0
- package/dist/cliHookMode.js +50 -0
- package/dist/cliHookRedact.d.ts +16 -0
- package/dist/cliHookRedact.js +136 -0
- package/dist/cliInit.d.ts +4 -1
- package/dist/cliInit.js +10 -3
- package/dist/cliLogin.js +18 -2
- package/dist/cliOffline.js +9 -9
- package/dist/cliOutput.js +11 -5
- package/dist/cliPolicy.d.ts +11 -3
- package/dist/cliPolicy.js +5 -2
- package/dist/cliPolicyV2.d.ts +18 -0
- package/dist/cliPolicyV2.js +234 -0
- package/dist/cliSetupOrg.d.ts +15 -0
- package/dist/cliSetupOrg.js +241 -0
- package/dist/cliSupport.d.ts +4 -0
- package/dist/cliSupport.js +12 -9
- package/dist/completion.js +12 -3
- package/dist/doctor.js +3 -3
- package/dist/enrollment.d.ts +18 -0
- package/dist/enrollment.js +79 -0
- package/dist/hookPlugin.d.ts +7 -0
- package/dist/hookPlugin.js +54 -0
- package/dist/initAgents.d.ts +3 -1
- package/dist/initAgents.js +7 -3
- package/dist/initAutopilotStep.d.ts +24 -0
- package/dist/initAutopilotStep.js +257 -0
- package/dist/initLocalSteps.d.ts +3 -0
- package/dist/initLocalSteps.js +30 -5
- package/dist/initState.d.ts +24 -0
- package/dist/initUi.js +5 -0
- package/dist/passport.js +27 -3
- package/dist/pluginPin.d.ts +7 -0
- package/dist/pluginPin.js +7 -0
- package/dist/universalUrl.d.ts +28 -0
- package/dist/universalUrl.js +59 -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
|
@@ -23,7 +23,7 @@ New here? One command sets everything up:
|
|
|
23
23
|
npx passport-bridge@latest init
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
It scans for keys your agents can reach, signs you in (or up), connects the apps it found, adds Passport to your agents, turns on the guard, and
|
|
26
|
+
It scans for keys your agents can reach, signs you in (or up), connects the apps it found, shows the environments Passport placed, adds Passport to your agents, turns on the guard, and sets Autopilot: how much agents can do on their own. See [Set up with init](#set-up-with-init).
|
|
27
27
|
|
|
28
28
|
Or step by step:
|
|
29
29
|
|
|
@@ -52,7 +52,7 @@ passport run github_search_issues '{"query":"SSO"}'
|
|
|
52
52
|
| `login` | Browser sign-in or sign-up (or device sign-in with `--workspace`); saves a rotating CLI credential and makes the profile active. |
|
|
53
53
|
| `logout` | Revoke the credential and always remove the local profile (warns if revocation fails). |
|
|
54
54
|
| `profiles` / `use <name>` | List stored profiles / select the active one. Offline. |
|
|
55
|
-
| `status` | Workspace, member, agent, and app connection states. |
|
|
55
|
+
| `status` | Workspace, member, agent, and app connection states, plus Autopilot presets, team floors, and how old this computer's copy of your rules is. |
|
|
56
56
|
| `doctor` | Check Node, credential-file safety, HTTPS policy, `/healthz`, auth, serverInfo, and CLI protocol. Exit 1 on a failed check, with the full report. |
|
|
57
57
|
| `ready` | Readiness preflight for automation; gate on its `ready` field and exit code. |
|
|
58
58
|
| `search [query] [--app <key>]` | Search permitted tools. Empty query lists the full catalog. |
|
|
@@ -63,7 +63,11 @@ passport run github_search_issues '{"query":"SSO"}'
|
|
|
63
63
|
| `prompts [name] [--set k=v] [--out <file>]` | List or get MCP prompts. |
|
|
64
64
|
| `scan [--path <dir>] [--verbose] [--check]` | Find keys your agents can reach on this computer and what each can do. Local only, no account. `--check` scans files only (not the shell environment) and exits 5 on a high or medium key. |
|
|
65
65
|
| `discover` | Scan local MCP configuration and submit a privacy-minimized fleet report. Exit 5 on a managed-policy violation. |
|
|
66
|
-
| `hook` | Records the CLIs agents run and, with `--guard`,
|
|
66
|
+
| `hook` | Records the CLIs agents run and, with `--guard`, decides each one before it runs from your Autopilot rules (`install`, `uninstall`, `status`). |
|
|
67
|
+
| `wait <approval-id> [--timeout <s>]` | Wait for a person to decide an approval request (default 100 seconds). |
|
|
68
|
+
| `rules test "<command>" [--environment <kind>]` | What Autopilot decides for a command, why, and which environment it acts on. |
|
|
69
|
+
| `sessions [--status running\|idle\|ended]` | Your agents' recent sessions with what Passport decided. |
|
|
70
|
+
| `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). |
|
|
67
71
|
| `setup` | Install and maintain assigned team workflows as managed skills. |
|
|
68
72
|
| `session` | Run NDJSON commands over one authenticated MCP session. |
|
|
69
73
|
| `access` | Signed managed access: `keygen`, `actions`, `run`, `invoke`, `status`, `cancel`. |
|
|
@@ -123,14 +127,25 @@ npx passport-bridge@latest init --yes # accept every default; needed with
|
|
|
123
127
|
npx passport-bridge@latest init --yes --json # one summary object with each step's status
|
|
124
128
|
```
|
|
125
129
|
|
|
126
|
-
|
|
130
|
+
Seven steps, each reusing the command that owns it:
|
|
127
131
|
|
|
128
132
|
1. **Scan**: the same local scan as `passport scan`, as one summary line (`--verbose` prints the table).
|
|
129
133
|
2. **Sign in**: reuses the active or only CLI profile, asks which one when there are several, or runs the browser sign-in from `passport login`.
|
|
130
134
|
3. **Apps**: Railway, Vercel, Supabase, Cloudflare, GitHub, and Stripe, when the scan found a key or its CLI is on PATH. Missing apps are added through the same catalog rules as the web (an app your workspace reviews first says `! Stripe needs approval from your admin.`), then one sign-in page covers the rest. In a terminal init waits until they connect (Enter stops waiting); without one it prints the page and `Next: passport connect --wait 300` and moves on.
|
|
131
|
-
4. **
|
|
132
|
-
5. **
|
|
133
|
-
6. **
|
|
135
|
+
4. **Environments**: the environments Passport has placed for your apps, each with its kind: `Found 3 environments: production (Railway), preview (Vercel), qa (Railway)`. Anything Passport can't place counts as Production; change it any time in Rules. With no app connected yet it says `Environments appear once an app is connected.`
|
|
136
|
+
5. **Agents**: Passport's one MCP URL with this workspace as its hint (`https://passportmcp.com/mcp?ws=<workspace>`), with each agent's own browser sign-in; a server that doesn't serve `/mcp` yet (read from its OAuth protected-resource metadata) gets the workspace's own URL (`https://<host>/w/<workspace>/mcp`). An existing entry at either URL for this workspace counts as set up, so no token lands in a config file. Claude Code and Codex through their own CLIs (`claude mcp add --transport http --scope user`, `codex mcp add --url`), Cursor through `~/.cursor/mcp.json`, VS Code through `code --add-mcp` or its user `mcp.json`. Claude Desktop connects through Settings → Connectors, so init prints that step.
|
|
137
|
+
6. **Guard**: asks `Apply your Autopilot rules before each shell command in <agents>? [Y/n]`, then runs `passport hook install --guard` for Claude Code, Codex, and Cursor (Codex: blocks only), pointing at a stable copy of the CLI in `$PASSPORT_HOME/cli/<version>/` (never npm's cache), or at a global `passport-bridge` of the same version or newer. Once the new copy is in place, older copies are deleted unless a hook still runs them.
|
|
138
|
+
7. **Autopilot**: how much agents can do on their own, per environment:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Autopilot How much can agents do on their own?
|
|
142
|
+
Production Careful reads run, changes ask
|
|
143
|
+
Staging Balanced reads and changes run, deletes ask
|
|
144
|
+
Development Hands-off everything except irreversible runs
|
|
145
|
+
Keep these? [Y/n]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`n` chooses per environment; `--yes` keeps the defaults. A team floor stricter than a default is shown with why (`Your team requires Careful or stricter in Staging.`), and choices below it aren't offered. A CLI credential can only make presets stricter; a looser pick says so in one line and keeps the current ones. A re-run shows the presets `(already set up)` without asking. The closing summary says what will ask: `Autopilot on. You'll be asked only for Production changes, deletes outside Development, and irreversible actions.` A server without Autopilot gets the earlier Safety step instead.
|
|
134
149
|
|
|
135
150
|
What changes on disk, and how to undo it:
|
|
136
151
|
|
|
@@ -146,6 +161,25 @@ What changes on disk, and how to undo it:
|
|
|
146
161
|
|
|
147
162
|
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. 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.
|
|
148
163
|
|
|
164
|
+
### Company rollout
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
npx passport-bridge@latest setup --org pek_example --yes # Jamf, Kandji, Intune, or any script
|
|
168
|
+
npx passport-bridge@latest setup --org pek_example --clients claude-code,codex
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`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:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
Passport setup for passportmcp.com (enrollment pek_…mple)
|
|
175
|
+
Claude Code ✓ Passport added · guard on
|
|
176
|
+
Cursor ✓ Passport already set up · guard on
|
|
177
|
+
Codex ✓ Passport added · sign in: codex mcp login passport · guard on
|
|
178
|
+
Each agent asks you to sign in to Passport the first time it connects.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
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?}]}`.
|
|
182
|
+
|
|
149
183
|
### Team workflows
|
|
150
184
|
|
|
151
185
|
Codex and Claude Code on macOS and Linux. Requires a member profile.
|
|
@@ -169,17 +203,53 @@ passport hook status
|
|
|
169
203
|
passport hook uninstall --client claude-code --guard --apply # guard only
|
|
170
204
|
```
|
|
171
205
|
|
|
172
|
-
Two hooks per agent. `passport hook` runs after each shell command and records the vendor, a coarse verb,
|
|
206
|
+
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`):
|
|
207
|
+
|
|
208
|
+
- **Allow** (Claude Code `permissionDecision: "allow"`, Cursor `permission: "allow"`) only when every command in the line is a vendor command in `src/cliHookVendors.ts`, read with confidence, and allowed. Pipes into other programs, redirects, substitutions, variables, wrappers, environment prefixes, heredocs, scripts, aliases, `make`, and `npm run` mean no decision, so the agent's own permission rules apply. Codex can't receive allow; its own approvals apply.
|
|
209
|
+
- **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.
|
|
210
|
+
- 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.`
|
|
173
211
|
|
|
174
|
-
The
|
|
212
|
+
The environment comes from each vendor's own flags (`src/cliHookEnvironment.ts`): Railway `-e/--environment`, Wrangler and Sentry `-e/--env`, Vercel `--prod`/`--target` (a deploy without either is a preview), Supabase `--local`/`--linked`/`--project-ref` (`db reset` is local unless `--linked`), Stripe `--live` (test mode otherwise), `git push <remote> <branch>`, `psql` hosts (`localhost` is Development), fly and Heroku `-a/--app`, kubectl `--context`/`-n`, helm `--kube-context`/`-n`, AWS `--profile`, gcloud `--project`, plus any flags the server adds. Names follow Passport's rules (`prod|production|live|main` → Production, `stag|qa|uat|preview` → Staging, `dev|local|test|sandbox|feature|branch` → Development), and the workspace's own placement of a name wins. Anything else, or no flag at all (a linked project the hook can't see), counts as Production, and the reason says `Environment unknown, treated as Production.`
|
|
175
213
|
|
|
176
|
-
|
|
214
|
+
**Attended or unattended** (`src/cliHookMode.ts`). With a person at the keyboard, an ask is the agent's own prompt with Passport's reason. With nobody there, the guard asks Passport instead (`POST /api/my/cli/decide`, inside the hook's budget): the server knows grants already given this session, every rule, and the workspace's environments. An allow from it runs the command (for example, a retry after approval); an ask becomes an approval request on the web and the person's phone, and the agent reads `` Waiting for approval from Ramish. Run `passport wait <id>` to wait, or continue with other work. `` If Passport can't answer in time, the local decision stands and the reason adds `Passport couldn't be reached, so this computer decided.` Signals, strongest first:
|
|
215
|
+
|
|
216
|
+
| Signal | Means |
|
|
217
|
+
| --- | --- |
|
|
218
|
+
| `PASSPORT_HOOK_MODE=attended\|unattended` | Override |
|
|
219
|
+
| Claude Code `CLAUDE_CODE_SESSION_ATTENDED` (`1`/`0`), passed to every hook | Attended / unattended |
|
|
220
|
+
| Hook input `permission_mode` `dontAsk` or `bypassPermissions` (Claude Code, Codex) | Unattended: prompts are suppressed |
|
|
221
|
+
| Cursor `is_background_agent: true` | Unattended: background and cloud agents |
|
|
222
|
+
| `CLAUDE_CODE_ENTRYPOINT` `sdk-cli` (`claude -p`), `sdk-ts`, `sdk-py`, `claude-code-github-action` | Unattended (older Claude Code builds) |
|
|
223
|
+
| `CI`, `GITHUB_ACTIONS`, `GITLAB_CI`, `BUILDKITE`, `CIRCLECI`, `JENKINS_URL`, `TF_BUILD` | Unattended |
|
|
224
|
+
|
|
225
|
+
Codex has no field for `codex exec`; its prompt-free modes count as unattended, where an ask blocks for now with the waiting line.
|
|
226
|
+
|
|
227
|
+
The approval request carries a command summary with secrets removed on this computer (`src/cliHookRedact.ts`, using `passport scan`'s key formats plus secret-named flags, variables, JSON fields, URL credentials, and long opaque values; heredoc bodies are dropped). It is the only part of a command line that ever leaves the machine, and only approvers see it.
|
|
228
|
+
|
|
229
|
+
The guard decides from local data inside `HOOK_BUDGET_MS` (1.5 s) and prints first; only an unattended ask waits for the server, within the same budget. With the budget left, it reports its decision and, at most every ten minutes, refreshes a policy cache older than an hour. Any failure is silent and fails open. Neither hook sends the raw command line, output, folder path, or environment.
|
|
230
|
+
|
|
231
|
+
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.
|
|
177
232
|
|
|
178
233
|
- 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).
|
|
179
|
-
- Codex: the same events in `~/.codex/hooks.json` (`CODEX_HOME` honored). Codex
|
|
234
|
+
- Codex: the same events in `~/.codex/hooks.json` (`CODEX_HOME` honored). Codex supports deny only (ask fails the hook, and its allow rewrites commands), so the guard only blocks there. Trust the hooks in Codex's `/hooks`.
|
|
180
235
|
- 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.
|
|
181
236
|
|
|
182
|
-
`src/cliPolicy.ts` caches the member's CLI policy (`GET /api/my/cli-policy`) at `$PASSPORT_HOME/cli-policy/<profile>.json` (mode 600). `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.
|
|
237
|
+
`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.
|
|
238
|
+
|
|
239
|
+
The Passport plugin (`rsyed94/passport-plugins`) runs the same two hooks from the agent's plugin folder, with `PASSPORT_HOOK_VIA=plugin`. `passport hook status` shows those agents as `via plugin`, and `hook install`, `init`, and `setup --org` skip them (`Claude Code: already covered by the Passport plugin.`) so nothing is recorded twice. The plugin pins the CLI version in `src/pluginPin.ts`.
|
|
240
|
+
|
|
241
|
+
### Autopilot from the terminal
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
passport rules test "railway redeploy -e staging"
|
|
245
|
+
passport wait apr_123
|
|
246
|
+
passport sessions
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
- `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. 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.
|
|
250
|
+
- `wait` long-polls `GET /api/my/approvals/<id>/wait`. Approved: `Approved by Ramish. Run the command again.` (exit 0). Declined: the note for the agent, `Declined by Ramish: <note>` (exit 5, cause `approval_denied`). Expired: `Expired. The agent can ask again.` (exit 5, cause `approval_expired`). Still waiting at `--timeout` (default 100 seconds, under an agent's 2-minute command limit): exit 4 with the same command as `next`.
|
|
251
|
+
- `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.
|
|
252
|
+
- All three need a member profile; agent keys have no person to ask.
|
|
183
253
|
|
|
184
254
|
### Persistent sessions
|
|
185
255
|
|
|
@@ -237,7 +307,7 @@ passport ready --json
|
|
|
237
307
|
passport search "deployment status" --json
|
|
238
308
|
```
|
|
239
309
|
|
|
240
|
-
Set both variables together. Environment auth overrides stored profiles, persists nothing, and cannot be combined with `--profile` or `login`/`logout`. Agent keys skip member approval prompts; use a member profile for work that must pause for a human.
|
|
310
|
+
`PASSPORT_ENDPOINT` is Passport's one URL (`https://<host>/mcp`, where the agent key's own prefix says which workspace) or a workspace's own (`https://<host>/w/<workspace>/mcp`). Set both variables together. Environment auth overrides stored profiles, persists nothing, and cannot be combined with `--profile` or `login`/`logout`. Agent keys skip member approval prompts; use a member profile for work that must pause for a human.
|
|
241
311
|
|
|
242
312
|
## Managed access
|
|
243
313
|
|
|
@@ -290,7 +360,10 @@ With `--json`, stdout is exactly one JSON value; hints and warnings go to stderr
|
|
|
290
360
|
| `profiles` | `{profiles:[{name,active,client?}],active?}` |
|
|
291
361
|
| `use` | `{profile,active:true}` |
|
|
292
362
|
| `logout` | `{profile,removed,revoked}` |
|
|
293
|
-
| `status` | `{workspace,member,endpoint,auth,profile?,client,mcps,next?}` |
|
|
363
|
+
| `status` | `{workspace,member,endpoint,auth,profile?,client,mcps,autopilot?:{presets,floors,floorReason?,cache:{version,fetchedAt,ageMs}},next?}` |
|
|
364
|
+
| `wait` | `{approvalId,status:"approved",scope?,message}`; declined, expired, and still-waiting are errors with `approvalId` |
|
|
365
|
+
| `rules` | `{command,decision,cause?,explanation?,environment?,environmentAssumed?,actionClass?,source}` |
|
|
366
|
+
| `sessions` | `{sessions:[{id,client,folder,status,startedAt,lastActivityAt,counts,environments,waiting}],nextCursor}` |
|
|
294
367
|
| `doctor` | `{version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}`, also on failure |
|
|
295
368
|
| `ready` | `{ready,version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}` |
|
|
296
369
|
| `search` | Gateway payload with `results` or `catalog`, and `note` |
|
|
@@ -304,7 +377,7 @@ With `--json`, stdout is exactly one JSON value; hints and warnings go to stderr
|
|
|
304
377
|
| `access` | `keygen`: algorithm, paths, public JWK; `actions`: `{actions}`; `run`/`cancel`: `{run}`; `invoke`: governed result; `status`: `{receipt}` |
|
|
305
378
|
| `completion` | `{shell,script}` |
|
|
306
379
|
| `help` | `{command,help}` |
|
|
307
|
-
| `version` | `{version,profileCount,profileSelected,selectionSource,next,
|
|
380
|
+
| `version` | `{version,profileCount,profileSelected,selectionSource,next,endpoint?,profile?}` |
|
|
308
381
|
|
|
309
382
|
Errors: `{"error":"...","cause":"blocked","exitCode":5,"app":"github"}`, optionally with `approvalId`, `hint`, `profiles`, `next` (`argv` plus description), `remediation`, `retry`, `requiredInput`, or `connectUrl`.
|
|
310
383
|
|
|
@@ -314,8 +387,8 @@ Errors: `{"error":"...","cause":"blocked","exitCode":5,"app":"github"}`, optiona
|
|
|
314
387
|
| 1 | Network, timeout, server, or unsupported-content error |
|
|
315
388
|
| 2 | Missing, expired, or revoked authentication |
|
|
316
389
|
| 3 | App needs member sign-in |
|
|
317
|
-
| 4 | Approval pending |
|
|
318
|
-
| 5 | Policy, guardrail, selection, or approval denial |
|
|
390
|
+
| 4 | Approval pending (including `wait` still waiting at its timeout) |
|
|
391
|
+
| 5 | Policy, guardrail, selection, or approval denial (including a declined or expired approval in `wait`) |
|
|
319
392
|
| 6 | Invalid usage or unknown tool/app |
|
|
320
393
|
|
|
321
394
|
## MCP stdio bridge
|
|
@@ -339,4 +412,6 @@ passport-bridge serve --profile cursor@ws_example
|
|
|
339
412
|
|
|
340
413
|
## Maintainers
|
|
341
414
|
|
|
415
|
+
Tests never reach production Passport: `scripts/no-production-guard.mjs` is preloaded by the unit tests and, through `NODE_OPTIONS`, by every process `cli-e2e.ts` starts, and any request to passportmcp.com fails the run. Harnesses use a local server with `--cloud http://127.0.0.1:<port>` (or `PASSPORT_CLOUD`) and `PASSPORT_NO_OPEN=1`.
|
|
416
|
+
|
|
342
417
|
`npm run pack:verified` builds the npm tarball, checks required files, and writes a `.sha256` checksum file (verify with `sha256sum -c passport-bridge-<version>.tgz.sha256`). Releases publish only through the repository's npm trusted-publisher workflow.
|
package/dist/cli.js
CHANGED
|
@@ -27,9 +27,9 @@ function arg(flag, fallback = "") {
|
|
|
27
27
|
const i = process.argv.indexOf(flag);
|
|
28
28
|
return i >= 0 && process.argv[i + 1] ? process.argv[i + 1] : fallback;
|
|
29
29
|
}
|
|
30
|
-
/** `npx passport-bridge@latest scan` and `
|
|
31
|
-
*
|
|
32
|
-
const PASSPORT_ONE_LINERS = new Set(["scan", "init"]);
|
|
30
|
+
/** `npx passport-bridge@latest scan`, `init`, and `setup --org` run the
|
|
31
|
+
* `passport` CLI's own implementation, so both bins behave identically. */
|
|
32
|
+
const PASSPORT_ONE_LINERS = new Set(["scan", "init", "setup"]);
|
|
33
33
|
async function passportOneLiner() {
|
|
34
34
|
const problem = oneLinerNodeProblem();
|
|
35
35
|
if (problem) {
|
|
@@ -77,6 +77,7 @@ Commands:
|
|
|
77
77
|
logout Revoke and remove a saved profile
|
|
78
78
|
scan Find keys your agents can reach. Local, no account
|
|
79
79
|
init Set up Passport for your agents, step by step
|
|
80
|
+
setup setup --org <key>: set up every agent here for your company (MDM)
|
|
80
81
|
|
|
81
82
|
Options:
|
|
82
83
|
--profile <name> Use a named profile (default: default)
|
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", "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", "sessions", "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
|
@@ -16,6 +16,9 @@ export const COMMANDS = [
|
|
|
16
16
|
"discover",
|
|
17
17
|
"scan",
|
|
18
18
|
"hook",
|
|
19
|
+
"wait",
|
|
20
|
+
"rules",
|
|
21
|
+
"sessions",
|
|
19
22
|
"setup",
|
|
20
23
|
"session",
|
|
21
24
|
"access",
|
|
@@ -30,13 +33,15 @@ const FLAGS = {
|
|
|
30
33
|
quiet: { kind: "boolean" },
|
|
31
34
|
caller: { kind: "value" },
|
|
32
35
|
help: { kind: "boolean" },
|
|
33
|
-
cloud: { kind: "value", commands: ["login", "init"] },
|
|
36
|
+
cloud: { kind: "value", commands: ["login", "init", "setup"] },
|
|
34
37
|
workspace: { kind: "value", commands: ["login", "access"] },
|
|
35
38
|
client: { kind: "value", commands: ["login", "setup", "hook"] },
|
|
36
39
|
apply: { kind: "boolean", commands: ["setup", "hook"] },
|
|
37
40
|
guard: { kind: "boolean", commands: ["hook"] },
|
|
38
41
|
"no-open": { kind: "boolean", commands: ["login", "init"] },
|
|
39
|
-
yes: { kind: "boolean", commands: ["init"] },
|
|
42
|
+
yes: { kind: "boolean", commands: ["init", "setup"] },
|
|
43
|
+
org: { kind: "value", commands: ["setup"] },
|
|
44
|
+
clients: { kind: "value", commands: ["setup"] },
|
|
40
45
|
"skip-apps": { kind: "boolean", commands: ["init"] },
|
|
41
46
|
"skip-agents": { kind: "boolean", commands: ["init"] },
|
|
42
47
|
"skip-guard": { kind: "boolean", commands: ["init"] },
|
|
@@ -56,7 +61,9 @@ const FLAGS = {
|
|
|
56
61
|
"private-key-file": { kind: "value", commands: ["access"] },
|
|
57
62
|
"public-jwk-file": { kind: "value", commands: ["access"] },
|
|
58
63
|
"delegation-id": { kind: "value", commands: ["access"] },
|
|
59
|
-
"client-id": { kind: "value", commands: ["access"] }
|
|
64
|
+
"client-id": { kind: "value", commands: ["access"] },
|
|
65
|
+
environment: { kind: "value", commands: ["rules"] },
|
|
66
|
+
status: { kind: "value", commands: ["sessions"] }
|
|
60
67
|
};
|
|
61
68
|
export class ArgError extends Error {
|
|
62
69
|
}
|
|
@@ -160,6 +167,9 @@ function validateShape(command, positionals) {
|
|
|
160
167
|
discover: 0,
|
|
161
168
|
scan: 0,
|
|
162
169
|
hook: 1,
|
|
170
|
+
wait: 1,
|
|
171
|
+
rules: 2,
|
|
172
|
+
sessions: 0,
|
|
163
173
|
setup: 3,
|
|
164
174
|
session: 0,
|
|
165
175
|
access: 2,
|
|
@@ -167,9 +177,15 @@ function validateShape(command, positionals) {
|
|
|
167
177
|
help: 1,
|
|
168
178
|
version: 0
|
|
169
179
|
};
|
|
170
|
-
const minimum = { describe: 1, run: 1, use: 1, completion: 1 };
|
|
180
|
+
const minimum = { describe: 1, run: 1, use: 1, completion: 1, wait: 1, rules: 1 };
|
|
181
|
+
const needs = {
|
|
182
|
+
run: "a tool name",
|
|
183
|
+
completion: "bash, zsh, or fish",
|
|
184
|
+
wait: "an approval id",
|
|
185
|
+
rules: 'test "<command>"'
|
|
186
|
+
};
|
|
171
187
|
if (positionals.length < (minimum[command] ?? 0)) {
|
|
172
|
-
throw new ArgError(`${command} requires ${command
|
|
188
|
+
throw new ArgError(`${command} requires ${needs[command] ?? "a name"}.`);
|
|
173
189
|
}
|
|
174
190
|
const cap = max[command];
|
|
175
191
|
if (cap !== undefined && positionals.length > cap)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autopilot from the terminal:
|
|
3
|
+
*
|
|
4
|
+
* passport wait <approval-id> [--timeout <sec>] wait for a person to decide
|
|
5
|
+
* passport rules test "<command>" [--environment <kind>]
|
|
6
|
+
* passport sessions [--status running|idle|ended]
|
|
7
|
+
*
|
|
8
|
+
* plus the Autopilot lines `passport status` adds. Every command here uses the
|
|
9
|
+
* member API with a saved profile; agent keys have no person to wait for.
|
|
10
|
+
* `rules test` classifies the command on this machine and sends only the
|
|
11
|
+
* vendor and verb (and the environment kind), never the command line.
|
|
12
|
+
*/
|
|
13
|
+
import { type ParsedArgs } from "./cliArgs.js";
|
|
14
|
+
import { type Preset, type PresetRow } from "./cliAutopilotPolicy.js";
|
|
15
|
+
import { type MemberApi } from "./cliClient.js";
|
|
16
|
+
import { type EnvKind } from "./cliHookEnvironment.js";
|
|
17
|
+
import { type CommandResult, type Runtime } from "./cliSupport.js";
|
|
18
|
+
/** Long enough to be useful, short enough for an agent's default 2-minute
|
|
19
|
+
* command timeout. */
|
|
20
|
+
export declare const WAIT_DEFAULT_SECONDS = 100;
|
|
21
|
+
export type AutopilotDependencies = {
|
|
22
|
+
api?: MemberApi;
|
|
23
|
+
now?: () => number;
|
|
24
|
+
};
|
|
25
|
+
export declare function wait(args: ParsedArgs, runtime: Runtime, deps?: AutopilotDependencies): Promise<CommandResult>;
|
|
26
|
+
export declare function rules(args: ParsedArgs, runtime: Runtime, deps?: AutopilotDependencies): Promise<CommandResult>;
|
|
27
|
+
type SessionRow = {
|
|
28
|
+
id?: unknown;
|
|
29
|
+
client?: unknown;
|
|
30
|
+
folder?: unknown;
|
|
31
|
+
status?: unknown;
|
|
32
|
+
startedAt?: unknown;
|
|
33
|
+
lastActivityAt?: unknown;
|
|
34
|
+
counts?: {
|
|
35
|
+
ran?: unknown;
|
|
36
|
+
asked?: unknown;
|
|
37
|
+
approved?: unknown;
|
|
38
|
+
declined?: unknown;
|
|
39
|
+
blocked?: unknown;
|
|
40
|
+
};
|
|
41
|
+
environments?: unknown;
|
|
42
|
+
waiting?: unknown;
|
|
43
|
+
};
|
|
44
|
+
export declare function sessionLine(row: SessionRow, now: number, unicode?: boolean): string;
|
|
45
|
+
export declare function sessions(args: ParsedArgs, runtime: Runtime, deps?: AutopilotDependencies): Promise<CommandResult>;
|
|
46
|
+
export type AutopilotStatus = {
|
|
47
|
+
/** The three environments, and "other" (Other apps) when the server has it. */
|
|
48
|
+
presets: (Record<EnvKind, Preset> & Partial<Record<PresetRow, Preset>>) | null;
|
|
49
|
+
floors: Partial<Record<PresetRow, Preset | null>> | null;
|
|
50
|
+
floorReason?: string;
|
|
51
|
+
cache: {
|
|
52
|
+
version: 1 | 2 | null;
|
|
53
|
+
fetchedAt: number | null;
|
|
54
|
+
ageMs: number | null;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/** Read presets and floors for `passport status`. Never throws. */
|
|
58
|
+
export declare function autopilotStatus(fetchApi: (path: string, init: RequestInit) => Promise<Response>, profile: string | undefined, signal: AbortSignal, now?: number): Promise<AutopilotStatus>;
|
|
59
|
+
export declare function autopilotLines(status: AutopilotStatus): string[];
|
|
60
|
+
export {};
|