passport-bridge 0.8.2 → 0.10.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.
Files changed (65) hide show
  1. package/README.md +100 -3
  2. package/dist/accessClient.d.ts +128 -0
  3. package/dist/accessClient.js +436 -0
  4. package/dist/activeProfile.d.ts +21 -0
  5. package/dist/boundedFile.d.ts +2 -0
  6. package/dist/boundedMcpFetch.d.ts +6 -0
  7. package/dist/boundedResponse.d.ts +4 -0
  8. package/dist/bridge.d.ts +98 -0
  9. package/dist/bridge.js +49 -42
  10. package/dist/bridgeConfig.d.ts +1 -0
  11. package/dist/bridgePoller.d.ts +34 -0
  12. package/dist/bridgePoller.js +123 -0
  13. package/dist/bridgeShutdown.d.ts +20 -0
  14. package/dist/bridgeShutdown.js +5 -1
  15. package/dist/cli.d.ts +2 -0
  16. package/dist/cli.js +4 -0
  17. package/dist/cliAccess.d.ts +3 -0
  18. package/dist/cliAccess.js +119 -0
  19. package/dist/cliArgs.d.ts +16 -0
  20. package/dist/cliArgs.js +14 -3
  21. package/dist/cliClient.d.ts +62 -0
  22. package/dist/cliConnect.d.ts +22 -0
  23. package/dist/cliDeadline.d.ts +9 -0
  24. package/dist/cliDescribe.d.ts +8 -0
  25. package/dist/cliLogin.d.ts +3 -0
  26. package/dist/cliOffline.d.ts +6 -0
  27. package/dist/cliOutput.d.ts +7 -0
  28. package/dist/cliOutput.js +4 -0
  29. package/dist/cliPagination.d.ts +15 -0
  30. package/dist/cliProtocol.d.ts +4 -0
  31. package/dist/cliReady.d.ts +9 -0
  32. package/dist/cliResult.d.ts +7 -0
  33. package/dist/cliSession.d.ts +20 -0
  34. package/dist/cliSetup.d.ts +10 -0
  35. package/dist/cliSetup.js +157 -0
  36. package/dist/cliSupport.d.ts +102 -0
  37. package/dist/completion.d.ts +2 -0
  38. package/dist/completion.js +20 -2
  39. package/dist/credentialStorage.d.ts +12 -0
  40. package/dist/credentials.d.ts +64 -0
  41. package/dist/discover.d.ts +52 -0
  42. package/dist/doctor.d.ts +34 -0
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.js +1 -0
  45. package/dist/legacyCliSecurity.d.ts +10 -0
  46. package/dist/managedSkills.d.ts +7 -0
  47. package/dist/managedSkills.js +268 -0
  48. package/dist/managedSkillsContract.generated.d.ts +82 -0
  49. package/dist/managedSkillsContract.generated.js +32 -0
  50. package/dist/managedSkillsFiles.d.ts +23 -0
  51. package/dist/managedSkillsFiles.js +215 -0
  52. package/dist/managedSkillsIpc.d.ts +5 -0
  53. package/dist/managedSkillsIpc.js +44 -0
  54. package/dist/managedSkillsValidation.d.ts +14 -0
  55. package/dist/managedSkillsValidation.js +118 -0
  56. package/dist/passport.d.ts +7 -0
  57. package/dist/passport.js +4 -0
  58. package/dist/privateStableFile.d.ts +13 -0
  59. package/dist/recoveryCleanup.d.ts +5 -0
  60. package/dist/recoveryIdentity.d.ts +22 -0
  61. package/dist/tokenWorkspace.d.ts +3 -0
  62. package/dist/version.d.ts +1 -0
  63. package/dist/version.js +1 -1
  64. package/npm-shrinkwrap.json +2 -2
  65. package/package.json +13 -2
package/README.md CHANGED
@@ -49,7 +49,7 @@ Remote Passport servers must use HTTPS. Plain HTTP is accepted only for local
49
49
  development on `localhost`, `127.0.0.0/8`, or `::1`. Self-hosted deployments
50
50
  should terminate HTTPS before using interactive profiles or agent keys.
51
51
 
52
- Passport CLI 0.8.1 requires gateway MCP serverInfo `passport` version 0.5.0 or
52
+ Passport CLI 0.9.0 requires gateway MCP serverInfo `passport` version 0.5.0 or
53
53
  newer and the exact four-tool governed CLI protocol. Older servers fail clearly
54
54
  before the CLI makes a tool call.
55
55
 
@@ -70,6 +70,7 @@ before the CLI makes a tool call.
70
70
  | `prompts [name]` | List or get MCP prompts. |
71
71
  | `discover` | Scan supported global MCP configuration and submit a privacy-minimized fleet report. |
72
72
  | `session` | Process NDJSON commands through one authenticated MCP session. |
73
+ | `access` | Use signed managed access (`keygen`, `actions`, `run`, `invoke`, `status`, or `cancel`). |
73
74
  | `completion <shell>` | Generate completion for Bash, Zsh, or Fish without a profile or network. |
74
75
  | `profiles` | List stored profiles and show the active profile without a network request. |
75
76
  | `use <name>` | Select the active stored profile without a network request. |
@@ -85,6 +86,25 @@ or traffic. Managed-policy violations return exit `5`, so endpoint management
85
86
  can use it as a compliance gate without Passport silently editing client
86
87
  configuration.
87
88
 
89
+ ### Team workflows
90
+
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.
93
+
94
+ ```sh
95
+ passport setup list
96
+ passport setup install <setup-id> <workflow-key> --client codex
97
+ passport setup install <setup-id> <workflow-key> --client codex --apply
98
+ passport setup installed
99
+ passport setup rollback <skill-name> --apply
100
+ passport setup remove <skill-name> --apply
101
+ ```
102
+
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.
107
+
88
108
  ### Diagnostics
89
109
 
90
110
  Run diagnostics before opening a support ticket or promoting a CLI release:
@@ -181,9 +201,85 @@ The mode does not weaken authorization: every operation still executes through
181
201
  the governed gateway, and cached access tokens retain the normal expiry and
182
202
  401-refresh behavior.
183
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:
211
+
212
+ ```sh
213
+ passport access keygen --algorithm ES256
214
+ ```
215
+
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:
219
+
220
+ ```sh
221
+ export PASSPORT_ENDPOINT=https://passport.example.com
222
+ export PASSPORT_WORKSPACE_ID=ws_example
223
+ export PASSPORT_CLIENT_ID=ws_example~awc_example
224
+ 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.
233
+
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
+ passport access actions --json
239
+ passport access run --input run.json --json
240
+ passport access invoke --input invocation.json --caller build-job-1 --json
241
+ passport access status <invocation-id> --json
242
+ passport access cancel <run-id> --json
243
+ ```
244
+
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.
254
+
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:
261
+
262
+ ```js
263
+ import { accessClientFromEnv } from "passport-bridge/access";
264
+
265
+ const client = accessClientFromEnv(process.env, { callerId: "build-job-1" });
266
+ const actions = await client.actions();
267
+ ```
268
+
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
+
184
280
  ### Approvals and connections
185
281
 
186
- An approval-required call exits immediately with code 4 and its approval ID. `--wait <seconds>` retries only after a definite structured `approval_pending` response:
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:
187
283
 
188
284
  ```sh
189
285
  passport run github_create_issue '{"title":"Customer report"}' --wait 90
@@ -233,6 +329,7 @@ With `--json`, stdout contains exactly one JSON value and no progress text. Hint
233
329
  | `prompts` | The MCP list or get result. |
234
330
  | `discover` | `{snapshot,report,compliant}`. The snapshot contains privacy-minimized metadata only. |
235
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}`. |
236
333
  | `completion` | `{shell,script}`. Human mode emits the raw completion script. |
237
334
  | `help` | `{command, help}` |
238
335
  | `version` | `{version,profileCount,profileSelected,selectionSource,next,requiredInput?,endpoint?,profile?}` |
@@ -271,7 +368,7 @@ credential store is shared with `passport-bridge` and refresh exchanges are
271
368
  coordinated across processes. The active-profile pointer contains no
272
369
  credential and is local to this Passport credential store.
273
370
 
274
- When no explicit, environment, or active selector is present, CLI 0.8.1
371
+ When no explicit, environment, or active selector is present, CLI 0.9.0
275
372
  detects exactly one CLI-owned profile (`client: "cli"` or the exact legacy
276
373
  `cli@<workspace>` shape) and makes that existing profile active. If more than
277
374
  one CLI candidate remains, run `passport profiles`, choose with `passport use <name>`,
@@ -0,0 +1,128 @@
1
+ export type AccessAlgorithm = "ES256" | "RS256";
2
+ export type AccessCapability = {
3
+ appId: string;
4
+ tool: string;
5
+ resource: string;
6
+ connectionId: string;
7
+ actionRevision: string;
8
+ };
9
+ export type AccessAction = {
10
+ capability: AccessCapability;
11
+ tool: string;
12
+ actionRevision: string;
13
+ readonly: boolean;
14
+ inputSchema: Record<string, unknown>;
15
+ };
16
+ export type AccessRunInput = {
17
+ capabilities: AccessCapability[];
18
+ delegationId?: string;
19
+ expiresInSeconds?: number;
20
+ callLimit?: number;
21
+ };
22
+ export type AccessRun = AccessRunInput & {
23
+ id: string;
24
+ workspaceId: string;
25
+ actorId: string;
26
+ actorEpoch: number;
27
+ status: "active" | "cancelled";
28
+ createdAt: number;
29
+ expiresAt: number;
30
+ calls: number;
31
+ };
32
+ export type AccessInvocationInput = {
33
+ runId: string;
34
+ invocationId: string;
35
+ appId: string;
36
+ tool: string;
37
+ resource: string;
38
+ connectionId: string;
39
+ args: Record<string, unknown>;
40
+ };
41
+ export type AccessReceipt = {
42
+ id: string;
43
+ runId: string;
44
+ actorId: string;
45
+ subjectId?: string;
46
+ state: string;
47
+ createdAt: number;
48
+ expiresAt: number;
49
+ appId: string;
50
+ tool: string;
51
+ resource: string;
52
+ connectionId: string;
53
+ resultExposure?: string;
54
+ message?: string;
55
+ };
56
+ export type AccessInvocationResult = {
57
+ content?: unknown[];
58
+ isError?: boolean;
59
+ structuredContent?: Record<string, unknown>;
60
+ [key: string]: unknown;
61
+ };
62
+ export type AccessGatewayClientOptions = {
63
+ endpoint: string;
64
+ workspaceId: string;
65
+ clientId: string;
66
+ privateKeyFile: string;
67
+ /** Optional when the PEM's algorithm can be inspected. */
68
+ algorithm?: AccessAlgorithm;
69
+ /** Stable caller attribution is mandatory for invocations. */
70
+ callerId?: string;
71
+ timeoutMs?: number;
72
+ signal?: AbortSignal;
73
+ fetch?: typeof fetch;
74
+ now?: () => number;
75
+ };
76
+ export type GeneratedAccessKey = {
77
+ algorithm: AccessAlgorithm;
78
+ privateKeyPem: string;
79
+ publicJwk: Record<string, unknown>;
80
+ };
81
+ export declare class AccessGatewayError extends Error {
82
+ readonly status?: number | undefined;
83
+ readonly code?: string | undefined;
84
+ constructor(message: string, status?: number | undefined, code?: string | undefined);
85
+ }
86
+ export declare function assertCallerId(value: string): string;
87
+ export declare function defaultAccessPrivateKeyFile(env?: NodeJS.ProcessEnv): string;
88
+ export declare function defaultAccessPublicJwkFile(privateKeyFile: string): string;
89
+ export declare function generateAccessKey(algorithm: AccessAlgorithm): GeneratedAccessKey;
90
+ /** Publish a new workload key pair without ever printing private key material.
91
+ * The public file is a standalone JWK ready for the admin registration request. */
92
+ export declare function writeGeneratedAccessKey(generated: GeneratedAccessKey, privateKeyFile: string, publicJwkFile?: string): {
93
+ privateKeyFile: string;
94
+ publicJwkFile: string;
95
+ publicJwk: Record<string, unknown>;
96
+ };
97
+ export declare function parseAccessInputFile(path: string): Record<string, unknown>;
98
+ export declare class AccessGatewayClient {
99
+ private readonly base;
100
+ private readonly workspaceId;
101
+ private readonly clientId;
102
+ private readonly privateKey;
103
+ private readonly algorithm;
104
+ private readonly callerId?;
105
+ private readonly timeoutMs;
106
+ private readonly signal?;
107
+ private readonly httpFetch;
108
+ private readonly now;
109
+ private accessToken?;
110
+ private tokenInFlight?;
111
+ constructor(options: AccessGatewayClientOptions);
112
+ get resourceEndpoint(): string;
113
+ get protectedActionsEndpoint(): string;
114
+ actions(delegationId?: string): Promise<AccessAction[]>;
115
+ createRun(input: AccessRunInput): Promise<AccessRun>;
116
+ invoke(input: AccessInvocationInput, callerId?: string | undefined): Promise<AccessInvocationResult>;
117
+ status(invocationId: string): Promise<AccessReceipt>;
118
+ cancel(runId: string): Promise<AccessRun>;
119
+ /** Compatibility spelling for callers that mirror the HTTP route name. */
120
+ cancelRun(runId: string): Promise<AccessRun>;
121
+ private token;
122
+ private exchangeToken;
123
+ private request;
124
+ private fetchWithTimeout;
125
+ private readResponse;
126
+ private serverError;
127
+ }
128
+ export declare function accessClientFromEnv(env?: NodeJS.ProcessEnv, overrides?: Partial<Pick<AccessGatewayClientOptions, "endpoint" | "workspaceId" | "clientId" | "privateKeyFile" | "callerId" | "algorithm">>): AccessGatewayClient;