passport-bridge 0.13.0 → 0.13.1

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
@@ -339,4 +339,4 @@ passport-bridge serve --profile cursor@ws_example
339
339
 
340
340
  ## Maintainers
341
341
 
342
- `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.
342
+ `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.
@@ -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 client from the Passport app.";
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`.";
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,14 +17,14 @@ 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 client from the Passport app.";
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`.";
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). */
24
24
  export class BridgeCredentialError extends Error {
25
25
  status;
26
26
  constructor(status) {
27
- super(`token exchange failed (${status}); reconnect this client from the Passport app (or run \`passport-bridge login\`)`);
27
+ super(`token exchange failed (${status}); reconnect this agent from the Passport web app (or run \`passport-bridge login\`)`);
28
28
  this.status = status;
29
29
  this.name = "BridgeCredentialError";
30
30
  }
@@ -160,7 +160,7 @@ export class TokenManager {
160
160
  return;
161
161
  if (!this.tenantFlipLogged) {
162
162
  this.tenantFlipLogged = true;
163
- log(`refusing to adopt an on-disk credential for ${workspace}; this bridge serves ${this.homeWorkspace}.`, "Reconnect this client from the Passport app.");
163
+ log(`refusing to adopt an on-disk credential for ${workspace}; this bridge serves ${this.homeWorkspace}.`, "Reconnect this agent from the Passport web app or run `passport-bridge login`.");
164
164
  }
165
165
  throw new Error(TENANT_FLIP_MESSAGE);
166
166
  }
@@ -1,5 +1,5 @@
1
1
  /** Where a degraded bridge looks for a credential another process wrote: a
2
- * sibling's rotation, `passport-bridge login`, or the desktop app. */
2
+ * sibling's rotation or `passport-bridge login`. */
3
3
  export type BridgeCredentialSource = {
4
4
  /** The saved credential as it is now, endpoint already validated. */
5
5
  read: () => {
package/dist/cli.js CHANGED
@@ -50,10 +50,6 @@ async function main() {
50
50
  const command = process.argv[2] ?? "serve";
51
51
  if (PASSPORT_ONE_LINERS.has(command))
52
52
  return passportOneLiner();
53
- if (command === "managed-skills") {
54
- const { managedSkillsIpcMain } = await import("./managedSkillsIpc.js");
55
- return managedSkillsIpcMain();
56
- }
57
53
  if (process.argv.includes("--help") || process.argv.includes("-h") || command === "help")
58
54
  return help();
59
55
  if (command === "--version" || command === "-V" || command === "version")
@@ -142,8 +138,8 @@ async function serve() {
142
138
  process.exit(1);
143
139
  }
144
140
  }
145
- /** A degraded bridge heals from whatever a sibling, `login`, or the desktop
146
- * app saved for this profile. Read-only: a pending rotation journal is
141
+ /** A degraded bridge heals from whatever a sibling or `login` saved for this
142
+ * profile. Read-only: a pending rotation journal is
147
143
  * settled by the next exchange, under the profile lock. */
148
144
  function savedProfileSource(profile) {
149
145
  return {
@@ -204,7 +204,7 @@ export function classifyEntry(raw, context, agent) {
204
204
  if (profileWorkspace && profileWorkspace !== context.workspaceId) {
205
205
  return { kind: "other", message: `${name} uses Passport for another workspace. Left as is.` };
206
206
  }
207
- // A working local bridge, such as the one Passport Desktop manages.
207
+ // A working local bridge entry.
208
208
  return { kind: "current" };
209
209
  }
210
210
  function jsonState(path, rootKey, context, agent) {
@@ -4,8 +4,8 @@
4
4
  * `npx passport-bridge init` runs from npm's cache, which npm may clear at any
5
5
  * time. A hook that points there breaks silently. So init copies the running
6
6
  * package once into `$PASSPORT_HOME/cli/<version>/` (with its dependencies) and
7
- * registers `"<node>" "<that copy>/dist/passport.js"`, both absolute, the way
8
- * Passport Desktop resolves node for the bridge. A global `passport` from npm
7
+ * registers `"<node>" "<that copy>/dist/passport.js"`, both absolute, so hooks
8
+ * do not depend on the agent's PATH. A global `passport` from npm
9
9
  * that is the same version or newer is used instead of a copy.
10
10
  *
11
11
  * Every write is atomic: the copy is built in a temporary folder and renamed
@@ -85,7 +85,7 @@ function defaultVersionOf(node) {
85
85
  return undefined;
86
86
  }
87
87
  }
88
- /** The well-known node folders Passport Desktop checks, newest nvm first. */
88
+ /** Well-known node folders, newest nvm first. */
89
89
  function wellKnownNodeDirectories(home) {
90
90
  const directories = [
91
91
  "/opt/homebrew/bin",
@@ -1,5 +1,4 @@
1
1
  import type { ManagedSkillPackage, ManagedSkillSource, ManagedSkillsRequest } from "./managedSkillsContract.generated.js";
2
- export declare const MANAGED_SKILL_INPUT_LIMIT: number;
3
2
  export declare const MANAGED_SKILL_FILE_LIMIT: number;
4
3
  export declare const MANAGED_SKILL_RECORD_LIMIT: number;
5
4
  export declare const MANAGED_SKILL_JOURNAL_LIMIT: number;
@@ -1,5 +1,4 @@
1
1
  import { createHash } from "node:crypto";
2
- export const MANAGED_SKILL_INPUT_LIMIT = 1024 * 1024;
3
2
  export const MANAGED_SKILL_FILE_LIMIT = 256 * 1024;
4
3
  export const MANAGED_SKILL_RECORD_LIMIT = 1024 * 1024;
5
4
  export const MANAGED_SKILL_JOURNAL_LIMIT = 2 * 1024 * 1024;
@@ -7,9 +7,9 @@ export type RecoveryIdentity = {
7
7
  /**
8
8
  * Resolve the identity of a saved profile without inventing a new device.
9
9
  *
10
- * Desktop profiles created before recovery metadata was persisted have a
11
- * qualified slot name (`<client>@<workspace>`), which is enough to recover
12
- * the policy client but not the installation id. The server receives the
10
+ * Profiles created before recovery metadata was persisted have a qualified
11
+ * slot name (`<client>@<workspace>`) or a bare well-known client name, which
12
+ * is enough to recover the policy client but not the installation id. The server receives the
13
13
  * previous credential as a private recovery hint and resolves that exact
14
14
  * device. A metadata-free profile derives its route target from the saved
15
15
  * endpoint; an unrecognized endpoint is intentionally rejected instead of
@@ -2,7 +2,7 @@ const VALID_INSTANCE_ID = /^[A-Za-z0-9._:-]{1,128}$/;
2
2
  const VALID_CLIENT = /^[A-Za-z0-9._-]{1,40}$/;
3
3
  const QUALIFIED_PROFILE = /^([A-Za-z0-9._-]{1,40})(?:@([A-Za-z0-9_-]{1,80}))?$/;
4
4
  const TARGET_KEY = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
5
- const BARE_DESKTOP_CLIENTS = new Set(["claude", "claude-code", "cursor", "vscode", "codex"]);
5
+ const BARE_CLIENT_PROFILES = new Set(["claude", "claude-code", "cursor", "vscode", "codex"]);
6
6
  function targetFromEndpoint(raw) {
7
7
  try {
8
8
  const parsed = new URL(raw);
@@ -30,9 +30,9 @@ function targetFromEndpoint(raw) {
30
30
  /**
31
31
  * Resolve the identity of a saved profile without inventing a new device.
32
32
  *
33
- * Desktop profiles created before recovery metadata was persisted have a
34
- * qualified slot name (`<client>@<workspace>`), which is enough to recover
35
- * the policy client but not the installation id. The server receives the
33
+ * Profiles created before recovery metadata was persisted have a qualified
34
+ * slot name (`<client>@<workspace>`) or a bare well-known client name, which
35
+ * is enough to recover the policy client but not the installation id. The server receives the
36
36
  * previous credential as a private recovery hint and resolves that exact
37
37
  * device. A metadata-free profile derives its route target from the saved
38
38
  * endpoint; an unrecognized endpoint is intentionally rejected instead of
@@ -44,21 +44,21 @@ function targetFromEndpoint(raw) {
44
44
  */
45
45
  export function recoveryIdentity(profile, storedProfile, expectedWorkspace, endpoint) {
46
46
  const qualified = profile.match(QUALIFIED_PROFILE);
47
- const profileClient = qualified && (qualified[2] !== undefined || BARE_DESKTOP_CLIENTS.has(qualified[1])) ? qualified[1] : undefined;
47
+ const profileClient = qualified && (qualified[2] !== undefined || BARE_CLIENT_PROFILES.has(qualified[1])) ? qualified[1] : undefined;
48
48
  if (qualified?.[2] && expectedWorkspace && qualified[2] !== expectedWorkspace) {
49
- throw new Error("Passport couldn't safely recover this profile's workspace identity. Reconnect this client from the Passport app.");
49
+ throw new Error("Passport couldn't safely recover this profile's workspace identity. Reconnect this agent from the Passport web app.");
50
50
  }
51
51
  const storedClient = storedProfile?.client;
52
52
  const exactQualifiedPoison = Boolean(storedClient && storedClient === profile && profileClient && profileClient !== profile);
53
53
  if (storedClient !== undefined && !VALID_CLIENT.test(storedClient) && !exactQualifiedPoison) {
54
- throw new Error("Passport couldn't safely recover this profile's client identity. Reconnect this client from the Passport app.");
54
+ throw new Error("Passport couldn't safely recover this profile's client identity. Reconnect this agent from the Passport web app.");
55
55
  }
56
56
  // Explicit metadata is authoritative even when a user-chosen profile name
57
57
  // has a different prefix (for example a dynamic CLI profile). Only the
58
58
  // exact old poison shape above is rewritten from the qualified slot name.
59
59
  const client = exactQualifiedPoison ? profileClient : (storedClient ?? profileClient);
60
60
  if (!client || !VALID_CLIENT.test(client)) {
61
- throw new Error("Passport couldn't safely infer this profile's client identity. Reconnect this client from the Passport app.");
61
+ throw new Error("Passport couldn't safely infer this profile's client identity. Reconnect this agent from the Passport web app.");
62
62
  }
63
63
  const endpointTarget = endpoint ? targetFromEndpoint(endpoint) : undefined;
64
64
  const target = storedProfile?.target ?? endpointTarget;
@@ -67,10 +67,10 @@ export function recoveryIdentity(profile, storedProfile, expectedWorkspace, endp
67
67
  /[\u0000-\u001f\u007f]/.test(target) ||
68
68
  (endpoint !== undefined && endpointTarget === undefined) ||
69
69
  (endpointTarget !== undefined && target !== endpointTarget)) {
70
- throw new Error("Passport couldn't safely recover this profile's target. Reconnect this client from the Passport app.");
70
+ throw new Error("Passport couldn't safely recover this profile's target. Reconnect this agent from the Passport web app.");
71
71
  }
72
72
  if (storedProfile?.instanceId !== undefined && !VALID_INSTANCE_ID.test(storedProfile.instanceId)) {
73
- throw new Error("Passport couldn't safely recover this profile's installation identity. Reconnect this client from the Passport app.");
73
+ throw new Error("Passport couldn't safely recover this profile's installation identity. Reconnect this agent from the Passport web app.");
74
74
  }
75
75
  return {
76
76
  client,
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.13.0";
1
+ export declare const VERSION = "0.13.1";
package/dist/version.js CHANGED
@@ -1,3 +1,2 @@
1
- // Keep in lockstep with bridge/package.json. The published bridge can run from
2
- // a compiled sidecar where package.json is not available at runtime.
3
- export const VERSION = "0.13.0";
1
+ // Keep in lockstep with bridge/package.json.
2
+ export const VERSION = "0.13.1";
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "passport-bridge",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "passport-bridge",
9
- "version": "0.13.0",
9
+ "version": "0.13.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@modelcontextprotocol/sdk": "1.30.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passport-bridge",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Passport CLI for governed terminal and CI agents, plus the local stdio-to-cloud MCP bridge.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,5 +0,0 @@
1
- export declare function managedSkillIpcArgsSupported(argv: readonly string[]): boolean;
2
- export declare function readManagedSkillInput(input: AsyncIterable<string | Uint8Array>): Promise<unknown>;
3
- /** Fixed local-only sidecar entry. Never print input, filesystem exceptions,
4
- * stderr from children, or workflow instructions. */
5
- export declare function managedSkillsIpcMain(): Promise<void>;
@@ -1,44 +0,0 @@
1
- import { runManagedSkills } from "./managedSkills.js";
2
- import { MANAGED_SKILL_INPUT_LIMIT } from "./managedSkillsValidation.js";
3
- export function managedSkillIpcArgsSupported(argv) {
4
- return JSON.stringify(argv.slice(-3)) === JSON.stringify(["managed-skills", "--stdin", "--json"]);
5
- }
6
- export async function readManagedSkillInput(input) {
7
- const chunks = [];
8
- let size = 0;
9
- for await (const chunk of input) {
10
- const bytes = Buffer.from(chunk);
11
- size += bytes.byteLength;
12
- if (size > MANAGED_SKILL_INPUT_LIMIT)
13
- throw new Error("Managed workflow input is too large.");
14
- chunks.push(bytes);
15
- }
16
- const text = new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks));
17
- return JSON.parse(text);
18
- }
19
- /** Fixed local-only sidecar entry. Never print input, filesystem exceptions,
20
- * stderr from children, or workflow instructions. */
21
- export async function managedSkillsIpcMain() {
22
- let result;
23
- try {
24
- // Node includes the script path while a compiled Deno sidecar does not;
25
- // the final three arguments are stable in both launch modes.
26
- if (!managedSkillIpcArgsSupported(process.argv))
27
- throw new Error("Unsupported arguments.");
28
- result = runManagedSkills(await readManagedSkillInput(process.stdin));
29
- if (Buffer.byteLength(JSON.stringify(result)) > 256 * 1024)
30
- throw new Error("Local inventory is too large.");
31
- }
32
- catch {
33
- result = {
34
- protocol: "passport.managed-skills",
35
- version: 1,
36
- ok: false,
37
- operation: "status",
38
- state: "failed",
39
- filesChanged: 0,
40
- message: "Passport could not read a valid managed workflow request."
41
- };
42
- }
43
- process.stdout.write(`${JSON.stringify(result)}\n`);
44
- }