passport-bridge 0.10.0 → 0.11.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 CHANGED
@@ -1,8 +1,11 @@
1
1
  # Passport CLI and bridge
2
2
 
3
- `passport-bridge` connects MCP clients to a Passport workspace without putting a long-lived token in the client configuration. The same package also installs `passport`, a polished command-line client for terminal agents, scripts, and CI.
3
+ This package installs two binaries that reach a Passport workspace through its governed gateway:
4
4
 
5
- Both binaries use the Passport gateway. Member-authenticated CLI calls share tool access, client selection, guardrails, approvals, and activity logging with native MCP clients. Non-interactive agent keys still use their assigned pass, client selection, guardrails, middleware, and audit trail, but do not raise a member's interactive approval prompt.
5
+ - `passport`: CLI for terminal agents, scripts, and CI.
6
+ - `passport-bridge`: stdio bridge for agents that launch a local MCP server, so the agent config holds no long-lived token.
7
+
8
+ Member profiles get the same tool access, agent selection, guardrails, approvals, and activity logging as native agents. Agent keys keep their pass, selection, guardrails, and audit trail but never raise a member approval prompt.
6
9
 
7
10
  ## Install
8
11
 
@@ -10,453 +13,263 @@ Both binaries use the Passport gateway. Member-authenticated CLI calls share too
10
13
  npm install --global passport-bridge
11
14
  ```
12
15
 
13
- Node.js 22.23.2 or newer is required.
14
-
15
- ## Passport CLI
16
+ Requires Node.js 22.23.2 or newer. The CLI makes no background registry request, telemetry, or self-update; check with `npm view passport-bridge version` and upgrade with `npm install --global passport-bridge@latest`.
16
17
 
17
- Sign in once, then search and run the tools your workspace permits:
18
+ ## Quick start
18
19
 
19
20
  ```sh
20
- passport login --cloud https://passport.example.com --workspace ws_example --profile cli@ws_example
21
+ passport login --workspace ws_example --profile cli@ws_example
21
22
  passport status
22
23
  passport search "open issues"
23
24
  passport describe github_search_issues
24
25
  passport run github_search_issues '{"query":"SSO"}'
25
26
  ```
26
27
 
27
- A successful login makes the new profile active. On a machine with more than
28
- one stored profile, inspect or switch the active profile without a network
29
- request:
28
+ - `--workspace` alone signs in to Passport Cloud. Self-hosted: add `--cloud https://passport.example.com` (origin only).
29
+ - `--no-open` (or `PASSPORT_NO_OPEN=1`) prints the device URL instead of opening a browser. Use it over SSH and in headless sessions.
30
+ - Remote servers must use HTTPS. Plain HTTP works only on `localhost`, `127.0.0.0/8`, or `::1`.
31
+ - Requires a gateway reporting serverInfo `passport` 0.5.0 or newer with the four-tool CLI protocol; older servers fail before any tool call.
32
+ - `passport help [command]` documents every option. `help`, `version`, `profiles`, `use`, and `completion` work offline.
33
+
34
+ ## Commands
35
+
36
+ | Command | Purpose |
37
+ | --- | --- |
38
+ | `login` | Device sign-in; saves a rotating CLI credential and makes the profile active. |
39
+ | `logout` | Revoke the credential and always remove the local profile (warns if revocation fails). |
40
+ | `profiles` / `use <name>` | List stored profiles / select the active one. Offline. |
41
+ | `status` | Workspace, member, agent, and app connection states. |
42
+ | `doctor` | Check Node, credential-file safety, HTTPS policy, `/healthz`, auth, serverInfo, and CLI protocol. Exit 1 on a failed check, with the full report. |
43
+ | `ready` | Readiness preflight for automation; gate on its `ready` field and exit code. |
44
+ | `search [query] [--app <key>]` | Search permitted tools. Empty query lists the full catalog. |
45
+ | `describe <tool>` | One exact definition with its full parameter schema. |
46
+ | `run <tool> [json]` | Run a tool through Passport governance. |
47
+ | `connect [app...] [--alias <name>] [--open] [--wait <s>]` | Show member sign-in links and optionally wait for completion. |
48
+ | `resources [uri] [--out <file>]` | List or read MCP resources. |
49
+ | `prompts [name] [--set k=v] [--out <file>]` | List or get MCP prompts. |
50
+ | `discover` | Scan local MCP configuration and submit a privacy-minimized fleet report. Exit 5 on a managed-policy violation. |
51
+ | `hook` | Audit-only shell-command recorder for agent `PostToolUse` events (`install`, `uninstall`, `status`). |
52
+ | `setup` | Install and maintain assigned team workflows as managed skills. |
53
+ | `session` | Run NDJSON commands over one authenticated MCP session. |
54
+ | `access` | Signed managed access: `keygen`, `actions`, `run`, `invoke`, `status`, `cancel`. |
55
+ | `completion <bash\|zsh\|fish>` | Print a completion script. Offline. |
56
+ | `help [command]`, `version` | Help; package version and local profile context. |
57
+
58
+ Global options: `--profile <name>`, `--json`, `--timeout <seconds>` (default 30), `--quiet`, `--caller <id>`.
59
+
60
+ ### Tool arguments
61
+
62
+ Use exactly one form:
30
63
 
31
64
  ```sh
32
- passport profiles
33
- passport use cli@ws_example
34
- passport status
65
+ passport run github_search_issues '{"query":"SSO","limit":10}'
66
+ printf '%s' '{"query":"SSO"}' | passport run github_search_issues --args -
67
+ passport run github_search_issues --set query=SSO --set-json limit=10
68
+ ```
69
+
70
+ `--set` values are strings; `--set-json` takes any JSON value. Both repeat.
71
+
72
+ ### Approvals and connections
73
+
74
+ ```sh
75
+ passport run github_create_issue '{"title":"Customer report"}' --wait 90
76
+ passport connect github --wait 120
35
77
  ```
36
78
 
37
- For Passport Cloud, `passport login --workspace <id>` can omit `--cloud`.
38
- Self-hosted deployments pass their origin explicitly. Add `--no-open` to print
39
- the device URL without launching a browser. This is the required form for SSH,
40
- CI, and other headless sessions:
79
+ - An approval-required call exits 4 with its approval ID. `--wait <s>` retries only after a definite `approval_pending` response.
80
+ - The CLI never retries after a network failure or timeout, since the outcome is unknown.
81
+ - `connect` with no app names uses one aggregate link when several apps need sign-in. Agent keys get guidance but cannot create sign-in links.
82
+
83
+ ### Resources and prompts
41
84
 
42
85
  ```sh
43
- passport login --workspace ws_example --profile cli@ws_example --no-open
86
+ passport resources passport+github://welcome
87
+ passport resources passport+github://image --out image.png
88
+ passport prompts github_summarize --set note=welcome
44
89
  ```
45
90
 
46
- `passport help [command]` documents every option. `passport help` and `passport version` work without a profile or network connection.
47
-
48
- Remote Passport servers must use HTTPS. Plain HTTP is accepted only for local
49
- development on `localhost`, `127.0.0.0/8`, or `::1`. Self-hosted deployments
50
- should terminate HTTPS before using interactive profiles or agent keys.
51
-
52
- Passport CLI 0.9.0 requires gateway MCP serverInfo `passport` version 0.5.0 or
53
- newer and the exact four-tool governed CLI protocol. Older servers fail clearly
54
- before the CLI makes a tool call.
55
-
56
- ### Commands
57
-
58
- | Command | Purpose |
59
- | -------------------- | -------------------------------------------------------------------------------------------------------------------- |
60
- | `login` | Complete device sign-in and save a rotating CLI credential. |
61
- | `logout` | Revoke the credential and remove its local profile. |
62
- | `status` | Show the workspace, member, client, and visible MCP connection states. |
63
- | `doctor` | Check runtime, credential-store safety, configuration, reachability, authentication, and CLI protocol compatibility. |
64
- | `ready` | Report whether the local CLI is ready for the requested operation. |
65
- | `search [query]` | Search permitted tool definitions. An empty query lists the complete catalog. |
66
- | `describe <tool>` | Print one exact definition and its full parameter schema. JSON also exposes `name` and `inputSchema` aliases. |
67
- | `run <tool> [json]` | Run a tool through Passport governance. |
68
- | `connect [app...]` | Show secure member connection links and optionally wait for completion. |
69
- | `resources [uri]` | List or read MCP resources. |
70
- | `prompts [name]` | List or get MCP prompts. |
71
- | `discover` | Scan supported global MCP configuration and submit a privacy-minimized fleet report. |
72
- | `session` | Process NDJSON commands through one authenticated MCP session. |
73
- | `access` | Use signed managed access (`keygen`, `actions`, `run`, `invoke`, `status`, or `cancel`). |
74
- | `completion <shell>` | Generate completion for Bash, Zsh, or Fish without a profile or network. |
75
- | `profiles` | List stored profiles and show the active profile without a network request. |
76
- | `use <name>` | Select the active stored profile without a network request. |
77
- | `help [command]` | Show general or command-specific help. |
78
- | `version` | Show the package version and locally resolvable profile context. `--json` includes readiness fields. |
79
-
80
- Every command accepts `--profile <name>`, `--json`, `--timeout <seconds>`, `--quiet`, and `--caller <id>` where applicable.
81
-
82
- `passport discover` is the cross-platform, headless Passport Discover scanner.
83
- It uploads no paths, commands or arguments, environment values, headers,
84
- credentials, endpoint paths or query strings, prompts, files, tool payloads,
85
- or traffic. Managed-policy violations return exit `5`, so endpoint management
86
- can use it as a compliance gate without Passport silently editing client
87
- configuration.
91
+ Human mode prints text content. Binary content needs `--out <file>` or `--json`.
88
92
 
89
93
  ### Team workflows
90
94
 
91
- Passport CLI 0.10.0 adds assigned workflow discovery and managed skills for
92
- Codex and Claude Code on macOS and Linux. Sign in with a member profile first.
95
+ Codex and Claude Code on macOS and Linux. Requires a member profile.
93
96
 
94
97
  ```sh
95
98
  passport setup list
96
- passport setup install <setup-id> <workflow-key> --client codex
99
+ passport setup install <setup-id> <workflow-key> --client codex # preview
97
100
  passport setup install <setup-id> <workflow-key> --client codex --apply
98
101
  passport setup installed
99
102
  passport setup rollback <skill-name> --apply
100
103
  passport setup remove <skill-name> --apply
101
104
  ```
102
105
 
103
- Installation defaults to a preview. Updates require the published manifest for
104
- the selected workspace, setup, and client. Personal edits are preserved; local
105
- removal and rollback remain available offline after access changes. Installing
106
- guidance never grants app permissions or provisions a vendor account.
106
+ Changes preview unless `--apply` is passed. Personal edits are preserved. `installed`, `remove`, and `rollback` work offline. Installing a workflow never grants app permissions or provisions accounts.
107
+
108
+ ### Shell hook
109
+
110
+ ```sh
111
+ passport hook install --client claude-code --apply
112
+ passport hook status
113
+ passport hook uninstall --client claude-code --apply
114
+ ```
107
115
 
108
- ### Diagnostics
116
+ Bare `passport hook` reads one `PostToolUse` event on stdin, classifies the shell command locally, and records the vendor, a coarse verb, and a risk class in Activity. It never blocks and never sends the command line, output, folder path, or environment. `install` defaults to Claude Code; for Codex, add a `PostToolUse` hook that runs `passport hook` by hand. `PASSPORT_HOOK_DISABLED=1` turns it off.
109
117
 
110
- Run diagnostics before opening a support ticket or promoting a CLI release:
118
+ ### Persistent sessions
111
119
 
112
120
  ```sh
113
- passport doctor --profile cli@ws_example
114
- passport doctor --profile cli@ws_example --json
121
+ printf '%s\n' \
122
+ '{"id":"find","argv":["search","open issues"]}' \
123
+ '{"id":"call","argv":["run","github_search_issues","{\"query\":\"SSO\"}"]}' \
124
+ | passport session --profile cli@ws_example
115
125
  ```
116
126
 
117
- `passport version --json` works without a profile or network and returns
118
- `version`, `profileCount`, `profileSelected`, `selectionSource`, `next`, and
119
- optional endpoint/profile fields. `passport ready --json` runs the local,
120
- authentication, server, and exact CLI-protocol preflight and returns `ready`,
121
- `ok`, auth/profile context, `server`, and `checks`; use its `ready` value and
122
- exit code as the automation gate rather than parsing human output.
123
-
124
- When profile selection is unclear, start with `passport profiles` and choose
125
- one with `passport use <name>`. Use `--profile <name>` for a one-off command or
126
- `PASSPORT_PROFILE=<name>` for a shell scope; explicit selectors take precedence
127
- over the active profile.
128
-
129
- `doctor` checks Node.js, the credential file's shape/ownership/mode, auth
130
- configuration, HTTPS policy, `/healthz`, the authenticated MCP handshake,
131
- serverInfo compatibility, and the exact four-tool CLI protocol. It never prints
132
- credential values, response bodies, member identity, or all stored profile
133
- names. A failed required check returns exit 1 while still emitting the complete
134
- diagnostic report; configuration errors include a concrete fix.
127
+ - One `{"id"?:string|number,"argv":string[]}` request per line, run in order; one JSON response per line with `ok`, `exitCode`, and `result` or error fields. `id` is echoed.
128
+ - A failed request does not close the session. EOF, SIGINT, or SIGTERM closes it cleanly.
129
+ - Limits: 1 MiB per line, 128 arguments. Set `--profile`, `--caller`, and `--timeout` on `passport session`, not per request.
130
+ - Allowed commands: `status`, `search`, `describe`, `run`, `connect`, `resources`, `prompts`, `discover`.
131
+ - Governance is unchanged; access tokens keep normal expiry and refresh.
135
132
 
136
133
  ### Shell completion
137
134
 
138
- Completion is generated locally and performs no profile or network lookup:
139
-
140
135
  ```sh
141
- # Bash
142
- mkdir -p ~/.local/share/bash-completion/completions
143
136
  passport completion bash > ~/.local/share/bash-completion/completions/passport
144
-
145
- # Zsh (ensure ~/.zfunc is in fpath before compinit)
146
- mkdir -p ~/.zfunc
147
- passport completion zsh > ~/.zfunc/_passport
148
-
149
- # Fish
150
- mkdir -p ~/.config/fish/completions
137
+ passport completion zsh > ~/.zfunc/_passport # ~/.zfunc must be in fpath before compinit
151
138
  passport completion fish > ~/.config/fish/completions/passport.fish
152
139
  ```
153
140
 
154
- ### Tool arguments
141
+ ## Profiles
155
142
 
156
- Pass a JSON object positionally:
143
+ Credentials live in `~/.passport/credentials.json` (mode `0600`, atomic updates); `PASSPORT_HOME` changes the directory. The store is shared with `passport-bridge`, and refreshes are coordinated across processes.
157
144
 
158
- ```sh
159
- passport run github_search_issues '{"query":"SSO","limit":10}'
160
- ```
145
+ Resolution order:
161
146
 
162
- Read the object from stdin:
147
+ 1. `--profile <name>`
148
+ 2. `PASSPORT_PROFILE`
149
+ 3. Active profile (`passport use <name>`)
150
+ 4. Exactly one CLI-owned profile, which becomes active
151
+ 5. The sole stored profile
163
152
 
164
- ```sh
165
- printf '%s' '{"query":"SSO"}' | passport run github_search_issues --args -
166
- ```
153
+ Otherwise Passport refuses to guess: run `passport profiles`, then `passport use <name>`. Names are 1-80 letters, numbers, `.`, `_`, `@`, or `-`, starting with a letter or number.
167
154
 
168
- Or build it without shell JSON escaping:
155
+ A distinct agent identity for policy, selection, devices, and activity, while keeping the CLI credential surface:
169
156
 
170
157
  ```sh
171
- passport run github_search_issues --set query=SSO --set-json limit=10
158
+ passport login --workspace ws_example --client claude-code --profile claude-code@ws_example
172
159
  ```
173
160
 
174
- These forms are mutually exclusive. `--set` produces strings and `--set-json` accepts any valid JSON value.
161
+ ### Caller attribution
175
162
 
176
- ### Persistent agent sessions
163
+ `--caller <id>` (1-24 lowercase letters, numbers, hyphens) adds activity detail for the agent behind a call. Without it, the CLI detects Claude Code, Codex, OpenCode, Cursor, or Gemini CLI from environment markers. Attribution is self-reported, not attested, and is accepted only from CLI-surface credentials or CLI agent-key requests.
177
164
 
178
- Agents performing several operations can avoid repeated process startup, token
179
- exchange, MCP initialization, and protocol checks by keeping one CLI process
180
- open:
165
+ ## Headless and CI
181
166
 
182
167
  ```sh
183
- printf '%s\n' \
184
- '{"id":"find","argv":["search","open issues"]}' \
185
- '{"id":"call","argv":["run","github_search_issues","{\"query\":\"SSO\"}"]}' \
186
- | passport session --profile cli@ws_example
168
+ export PASSPORT_ENDPOINT=https://passport.example.com/mcp
169
+ export PASSPORT_AGENT_KEY="$CI_PASSPORT_AGENT_KEY"
170
+ passport ready --json
171
+ passport search "deployment status" --json
187
172
  ```
188
173
 
189
- `passport session` reads one `{"id"?:string|number,"argv":string[]}` request
190
- per line and emits one JSON response per non-empty line. Requests run
191
- sequentially. Each response contains `ok`, `exitCode`, and either `result` or
192
- the standard CLI error fields; `id` is echoed for every valid request. A request failure
193
- does not close the session. EOF or SIGINT/SIGTERM closes the MCP transport
194
- cleanly.
195
-
196
- Session input is limited to 1 MiB per line and 128 arguments. Set global
197
- `--profile`, `--caller`, and `--timeout` options on `passport session`, not in
198
- individual request `argv` values. Supported request commands are `status`,
199
- `search`, `describe`, `run`, `connect`, `resources`, `prompts`, and `discover`.
200
- The mode does not weaken authorization: every operation still executes through
201
- the governed gateway, and cached access tokens retain the normal expiry and
202
- 401-refresh behavior.
203
-
204
- ### Managed access
205
-
206
- Managed access uses a registered workload credential and a signed
207
- `private_key_jwt` client assertion. It is separate from the interactive profile
208
- commands above. Generate a key pair on the workload machine; `keygen` refuses
209
- to overwrite existing files, writes the private PEM with owner-only
210
- permissions, and writes the public JWK to a separate file:
174
+ 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.
175
+
176
+ ## Managed access
177
+
178
+ Workload credentials that sign `private_key_jwt` assertions. Requires PostgreSQL and Enterprise workspace controls, with connections and grants set up in **Agents & access**. Creating new delegations is retired; existing delegation IDs still work.
211
179
 
212
180
  ```sh
213
- passport access keygen --algorithm ES256
181
+ passport access keygen --algorithm ES256 # or RS256; never overwrites; private PEM is owner-only
214
182
  ```
215
183
 
216
- Register only the public JWK in **Agents & access**, then configure the
217
- workload with the generated workspace-prefixed client ID and the local private
218
- key path. Set the endpoint to the Passport origin, for example:
184
+ Register only the public JWK in **Agents & access**, then configure the workload:
219
185
 
220
186
  ```sh
221
187
  export PASSPORT_ENDPOINT=https://passport.example.com
222
- export PASSPORT_WORKSPACE_ID=ws_example
223
188
  export PASSPORT_CLIENT_ID=ws_example~awc_example
224
189
  export PASSPORT_PRIVATE_KEY_FILE=/run/secrets/passport-access.pem
225
- export PASSPORT_CALLER_ID=build-job-1
226
- ```
227
-
228
- The client assertion uses `iss` and `sub` equal to `PASSPORT_CLIENT_ID` and
229
- `aud` equal to `${PASSPORT_ENDPOINT}/oauth/token`. Passport returns a
230
- short-lived access token for the protected resource
231
- `${PASSPORT_ENDPOINT}/w/${PASSPORT_WORKSPACE_ID}/mcp`; the CLI and SDK do not
232
- print that token.
190
+ export PASSPORT_WORKSPACE_ID=ws_example # optional; defaults to the client ID prefix
191
+ export PASSPORT_CALLER_ID=build-job-1 # or --caller; required for invoke
233
192
 
234
- Inspect the exact actions allowed by the credential and its grants, create a
235
- bounded run, and invoke one action:
236
-
237
- ```sh
238
193
  passport access actions --json
239
194
  passport access run --input run.json --json
240
- passport access invoke --input invocation.json --caller build-job-1 --json
195
+ passport access invoke --input invocation.json --json
241
196
  passport access status <invocation-id> --json
242
197
  passport access cancel <run-id> --json
243
198
  ```
244
199
 
245
- `run.json` contains a non-empty `capabilities` list copied from `actions`,
246
- with optional `delegationId`, `expiresInSeconds` (60 seconds to 24 hours), and
247
- `callLimit` (1 to 10,000). `invocation.json` contains `runId`, a stable unique
248
- `invocationId`, the selected `appId`, `tool`, `resource`, `connectionId`, and
249
- the tool's `args` object. Keep the same invocation file when resuming a
250
- definite approval-pending result. After a human approves it in Passport,
251
- invoke again with the same caller and exact arguments. For a timeout or
252
- unknown result, inspect `access status` before considering another write; the
253
- CLI and SDK never retry provider writes automatically.
200
+ - `run.json`: non-empty `capabilities` copied from `actions`; optional `delegationId`, `expiresInSeconds` (60 to 86,400), `callLimit` (1 to 10,000).
201
+ - `invocation.json`: `runId`, a stable unique `invocationId`, `appId`, `tool`, `resource`, `connectionId`, and `args`.
202
+ - Approval pending: after a human approves, invoke again with the same file and caller. Timeout or unknown result: check `access status` before any new write. Provider writes are never retried automatically.
203
+ - Delegated work: `passport access actions --delegation-id <id> --json`, then include the same `delegationId` in `run.json`. The agent and the delegated person both need matching allow grants.
204
+ - Tokens are never printed.
254
205
 
255
- For delegated work, first run `passport access actions --delegation-id <id> --json`.
256
- Copy those capabilities into the run input and include the same `delegationId`.
257
- The agent and the delegated person both need matching allow grants.
258
-
259
- The SDK is available from either the package root or the explicit access
260
- subpath:
206
+ SDK, from the package root or `passport-bridge/access`:
261
207
 
262
208
  ```js
263
209
  import { accessClientFromEnv } from "passport-bridge/access";
264
210
 
265
211
  const client = accessClientFromEnv(process.env, { callerId: "build-job-1" });
266
- const actions = await client.actions();
212
+ const actions = await client.actions(); // or client.actions(delegationId)
267
213
  ```
268
214
 
269
- `AccessGatewayClient` exposes `actions`, `createRun`, `invoke`, `status`, and
270
- `cancel`. Invocations require a stable caller ID; pass it in the constructor or
271
- to `invoke`. Inputs are read from bounded files by the CLI, and authentication
272
- failures are reported without response bodies or credential values.
273
- For delegated discovery, call `client.actions(delegationId)` and include that
274
- same `delegationId` when calling `createRun`.
275
-
276
- Managed execution requires PostgreSQL and Enterprise workspace controls. Set up
277
- organization connections, grants, and delegations in **Agents & access** before
278
- the workload requests actions.
279
-
280
- ### Approvals and connections
281
-
282
- An approval-required `passport run` call exits immediately with code 4 and its approval ID. `--wait <seconds>` retries only after a definite structured `approval_pending` response:
283
-
284
- ```sh
285
- passport run github_create_issue '{"title":"Customer report"}' --wait 90
286
- ```
287
-
288
- The CLI never retries a call after a network failure or timeout because the execution outcome may be unknown.
289
-
290
- For an MCP that needs member sign-in:
291
-
292
- ```sh
293
- passport connect github --wait 120
294
- ```
295
-
296
- Without app names, `connect` uses one aggregate link when several visible MCPs need sign-in. Agent-key principals receive status and member guidance but cannot mint browser links.
297
-
298
- ### Resources and prompts
299
-
300
- ```sh
301
- passport resources
302
- passport resources passport+github://welcome
303
- passport resources passport+github://image --out image.png
304
-
305
- passport prompts
306
- passport prompts github_summarize --set note=welcome
307
- ```
308
-
309
- Human mode writes text content to stdout. Binary or other non-text content requires `--out <file>` or `--json`.
215
+ `AccessGatewayClient` exposes `actions`, `createRun`, `invoke`, `status`, and `cancel`.
310
216
 
311
217
  ## Output contract
312
218
 
313
- With `--json`, stdout contains exactly one JSON value and no progress text. Hints and warnings use stderr. The success value for each command is:
314
-
315
- | Command | JSON value |
316
- | ------------ | --------------------------------------------------------------------------------------------------------- |
317
- | `login` | `{profile, endpoint, client, surface, active, next}` |
318
- | `profiles` | `{profiles:[{name,active,client?}],active?}` |
319
- | `use` | `{profile,active:true}` |
320
- | `logout` | `{profile, removed, revoked}` |
321
- | `status` | `{workspace, member, endpoint, auth, profile?, client, mcps, next?}` |
322
- | `doctor` | `{version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}` (also emitted when checks fail). |
323
- | `ready` | `{ready,version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}` |
324
- | `search` | The gateway search payload, including `results` or `catalog` and `note`. |
325
- | `describe` | One tool definition; JSON keeps `tool`/`parameters` and adds `name`/`inputSchema` compatibility aliases. |
326
- | `run` | The complete governed MCP tool result, preserving every content block and upstream `structuredContent`. |
327
- | `connect` | The gateway connection payload, including `connections` and optional `connectAllUrl`. |
328
- | `resources` | The MCP list or read result. |
329
- | `prompts` | The MCP list or get result. |
330
- | `discover` | `{snapshot,report,compliant}`. The snapshot contains privacy-minimized metadata only. |
331
- | `session` | NDJSON envelopes: `{id?,ok,exitCode,result?}` or `{id?,ok:false,error,cause,exitCode,...}`. |
332
- | `access` | `keygen` returns algorithm, file paths, and the public JWK; `actions` returns `{actions}`; `run` returns `{run}`; `invoke` returns the governed result; `status` returns `{receipt}`; `cancel` returns `{run}`. |
333
- | `completion` | `{shell,script}`. Human mode emits the raw completion script. |
334
- | `help` | `{command, help}` |
335
- | `version` | `{version,profileCount,profileSelected,selectionSource,next,requiredInput?,endpoint?,profile?}` |
336
-
337
- JSON errors have a stable base shape and may add safe remediation fields such
338
- as `hint`, `profiles`, `next` (`argv` plus a description), `remediation`,
339
- `retry`, `requiredInput`, or `connectUrl`:
340
-
341
- ```json
342
- { "error": "...", "cause": "blocked", "exitCode": 5, "app": "github" }
343
- ```
344
-
345
- `approvalId` and `app` are included when supplied by the gateway.
346
-
347
- | Exit | Meaning |
348
- | ---: | ------------------------------------------------------ |
349
- | 0 | Success |
350
- | 1 | Network, timeout, server, or unsupported-content error |
351
- | 2 | Missing, expired, or revoked authentication |
352
- | 3 | The MCP needs member sign-in |
353
- | 4 | Approval is pending |
354
- | 5 | Policy, guardrail, selection, or approval denial |
355
- | 6 | Invalid usage or unknown tool/app |
356
-
357
- ## Profiles
358
-
359
- Credentials are named slots in one file, `~/.passport/credentials.json`, with mode `0600`. Set `PASSPORT_HOME` to change its directory. Profile resolution is:
360
-
361
- 1. `--profile <name>`
362
- 2. `PASSPORT_PROFILE`
363
- 3. the active profile selected by `passport use <name>`
364
- 4. the sole stored profile
365
-
366
- If several profiles exist and none is active, select one explicitly. The
367
- credential store is shared with `passport-bridge` and refresh exchanges are
368
- coordinated across processes. The active-profile pointer contains no
369
- credential and is local to this Passport credential store.
370
-
371
- When no explicit, environment, or active selector is present, CLI 0.9.0
372
- detects exactly one CLI-owned profile (`client: "cli"` or the exact legacy
373
- `cli@<workspace>` shape) and makes that existing profile active. If more than
374
- one CLI candidate remains, run `passport profiles`, choose with `passport use <name>`,
375
- or pass an explicit `--profile`; Passport refuses to guess.
376
-
377
- Profile names are 1-80 letters, numbers, dots, underscores, `@` signs, or hyphens, and must start with a letter or number. Credential updates are atomically replaced at mode `0600`, including when several profiles rotate concurrently.
378
-
379
- `logout` always removes the local slot. If Passport cannot be reached to confirm server-side revocation, it prints a warning so the user knows the remote credential could not be revoked.
380
-
381
- Use a distinct policy identity for a particular agent while keeping the CLI protocol:
382
-
383
- ```sh
384
- passport login \
385
- --cloud https://passport.example.com \
386
- --workspace ws_example \
387
- --client claude-code \
388
- --profile claude-code@ws_example
389
- ```
390
-
391
- The credential surface remains `cli`; `claude-code` is the separate client identity used for policy, selection, devices, and activity attribution.
392
-
393
- ## Caller attribution
394
-
395
- `--caller <id>` adds cooperative activity detail for the agent behind the CLI call. Values use lowercase letters, numbers, and hyphens, up to 24 characters. The CLI otherwise detects Claude Code, Codex, OpenCode, Cursor, or Gemini CLI from their environment markers.
396
-
397
- Caller attribution is self-reported, not an attested identity. The gateway only accepts it from a CLI-surface credential or a CLI agent-key request.
398
-
399
- ## Headless and CI authentication
400
-
401
- Supply an existing Passport agent key from the job's secret manager:
402
-
403
- ```sh
404
- export PASSPORT_ENDPOINT=https://passport.example.com/mcp
405
- export PASSPORT_AGENT_KEY="$CI_PASSPORT_AGENT_KEY"
406
- passport search "deployment status" --json
407
- passport version --json
408
- passport ready --json
409
- ```
410
-
411
- Environment authentication wins over stored profiles, persists nothing, and sends the agent key directly to the gateway. Do not combine it with `--profile`. `PASSPORT_PROFILE` is only for stored interactive credentials.
412
-
413
- Agent keys are deliberately non-interactive. Their assigned pass, app selection,
414
- guardrails, middleware, and audit trail still apply, but action-time member
415
- approval prompts do not. Use a member profile for work that must pause for a
416
- human's one-off approval.
417
-
418
- ## Package verification and updates
419
-
420
- Maintainers can build the exact npm tarball, validate its required files, and
421
- write a SHA-256 sidecar without registry credentials:
422
-
423
- ```sh
424
- npm run pack:verified
425
- sha256sum -c passport-bridge-<version>.tgz.sha256
426
- ```
427
-
428
- The command also reports npm's SHA-1 shasum and SHA-512 integrity value for
429
- release notes or an external artifact manifest. The package declares public
430
- access and points support/source inquiries at Passport's public release repo.
431
-
432
- The CLI deliberately performs no background registry request, telemetry, or
433
- automatic self-update. Check explicitly with `npm view passport-bridge version`
434
- and upgrade with `npm install --global passport-bridge@latest`. Releases publish
435
- only through the repository's npm trusted-publisher workflow with short-lived
436
- OIDC credentials, exact-source gates, verified tarball integrity, and registry
437
- signature checks. npm does not expose public provenance attestations for a
438
- private source repository, so Passport does not claim one. Platform signing is
439
- not applicable to these JavaScript npm bins.
219
+ With `--json`, stdout is exactly one JSON value; hints and warnings go to stderr.
220
+
221
+ | Command | JSON value |
222
+ | --- | --- |
223
+ | `login` | `{profile,endpoint,client,surface,active,next}` |
224
+ | `profiles` | `{profiles:[{name,active,client?}],active?}` |
225
+ | `use` | `{profile,active:true}` |
226
+ | `logout` | `{profile,removed,revoked}` |
227
+ | `status` | `{workspace,member,endpoint,auth,profile?,client,mcps,next?}` |
228
+ | `doctor` | `{version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}`, also on failure |
229
+ | `ready` | `{ready,version,ok,auth,profile?,profileCount,endpointOrigin?,server?,checks}` |
230
+ | `search` | Gateway payload with `results` or `catalog`, and `note` |
231
+ | `describe` | Tool definition (`tool`, `parameters`) plus `name`/`inputSchema` aliases |
232
+ | `run` | Full governed MCP tool result, including `structuredContent` |
233
+ | `connect` | Gateway payload with `connections` and optional `connectAllUrl` |
234
+ | `resources`, `prompts` | MCP list, read, or get result |
235
+ | `discover` | `{snapshot,report,compliant}` |
236
+ | `session` | NDJSON `{id?,ok,exitCode,result?}` or `{id?,ok:false,error,cause,exitCode,...}` |
237
+ | `access` | `keygen`: algorithm, paths, public JWK; `actions`: `{actions}`; `run`/`cancel`: `{run}`; `invoke`: governed result; `status`: `{receipt}` |
238
+ | `completion` | `{shell,script}` |
239
+ | `help` | `{command,help}` |
240
+ | `version` | `{version,profileCount,profileSelected,selectionSource,next,requiredInput?,endpoint?,profile?}` |
241
+
242
+ Errors: `{"error":"...","cause":"blocked","exitCode":5,"app":"github"}`, optionally with `approvalId`, `hint`, `profiles`, `next` (`argv` plus description), `remediation`, `retry`, `requiredInput`, or `connectUrl`.
243
+
244
+ | Exit | Meaning |
245
+ | ---: | --- |
246
+ | 0 | Success |
247
+ | 1 | Network, timeout, server, or unsupported-content error |
248
+ | 2 | Missing, expired, or revoked authentication |
249
+ | 3 | App needs member sign-in |
250
+ | 4 | Approval pending |
251
+ | 5 | Policy, guardrail, selection, or approval denial |
252
+ | 6 | Invalid usage or unknown tool/app |
440
253
 
441
254
  ## MCP stdio bridge
442
255
 
443
- Create a bridge profile:
444
-
445
256
  ```sh
446
- passport-bridge login \
447
- --cloud https://passport.example.com \
448
- --workspace ws_example \
449
- --client cursor \
450
- --profile cursor@ws_example
257
+ passport-bridge login --cloud https://passport.example.com --workspace ws_example \
258
+ --client cursor --profile cursor@ws_example
451
259
  ```
452
260
 
453
- Configure the MCP client to launch:
261
+ Configure the agent to launch:
454
262
 
455
263
  ```sh
456
264
  passport-bridge serve --profile cursor@ws_example
457
265
  ```
458
266
 
459
- The bridge exchanges its file-backed refresh credential for short-lived access tokens, persists rotations, coordinates concurrent processes, and forwards tools, resources, prompts, cancellation, progress, and tool-list changes over stdio. `passport-bridge status` checks stored bridge profiles, and `passport-bridge logout --profile <name>` revokes one.
267
+ - `serve` is the default command. It exchanges the stored refresh credential for short-lived access tokens, persists rotations, and forwards tools, resources, prompts, cancellation, progress, and tool-list changes over stdio.
268
+ - Agents that share a profile coordinate through it. If Passport is unreachable or the saved credential is refused, `serve` stays up with one reconnect tool and recovers on its own when Passport returns or a valid credential is saved, then tells the agent its tools changed.
269
+ - `PASSPORT_REFRESH_TOKEN` plus `PASSPORT_ENDPOINT` supply a credential without a profile; rotations are not persisted.
270
+ - `passport-bridge status` checks stored profiles and reports `needs re-login` only when Passport refused the credential. `passport-bridge logout --profile <name>` revokes one. `--profile` defaults to `default`.
271
+ - `passport-bridge --help` lists all options; `--version` prints the package version.
272
+
273
+ ## Maintainers
460
274
 
461
- Run `passport-bridge --help` for the complete bridge command surface or
462
- `passport-bridge --version` to print the installed package version.
275
+ `npm run pack:verified` builds the npm tarball, checks required files, and writes a `.sha256` sidecar (verify with `sha256sum -c passport-bridge-<version>.tgz.sha256`). Releases publish only through the repository's npm trusted-publisher workflow.