passport-bridge 0.11.0 → 0.11.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.
@@ -354,7 +354,11 @@ export class TokenManager {
354
354
  return this.refusedExchange(res, presented);
355
355
  const data = await this.readExchange(res);
356
356
  this.fallbackRotation = undefined;
357
- if (data.refreshToken && data.refreshToken !== presented) {
357
+ // A non-rotating manager never keeps a child. The server still mints one
358
+ // when the presented token is a parent a peer rotated moments ago (an
359
+ // in-grace sibling); it stays unused and the server retires it as soon as
360
+ // the family's live child is exchanged.
361
+ if (data.refreshToken && data.refreshToken !== presented && this.onRotate) {
358
362
  this.assertHomeWorkspace(data.refreshToken);
359
363
  this.pendingRotation = {
360
364
  previous: presented,
package/dist/cliHook.d.ts CHANGED
@@ -42,6 +42,8 @@ export type HookInput = {
42
42
  export type HookDependencies = {
43
43
  /** Deliver one report. The default posts it to the signed-in workspace. */
44
44
  send?: (report: CliHookReport, signal: AbortSignal, runtime: Runtime, args: ParsedArgs) => Promise<void>;
45
+ /** Network seam for the default delivery. */
46
+ fetch?: typeof fetch;
45
47
  };
46
48
  /** Keep the shape of the verb, never its arguments: anything that could carry a
47
49
  * path, an endpoint, or a value is dropped rather than truncated. */
package/dist/cliHook.js CHANGED
@@ -134,17 +134,19 @@ async function readStdin(runtime) {
134
134
  return Buffer.concat(chunks).toString("utf8");
135
135
  }
136
136
  /** Post one report with the same credential `passport discover` uses. Agent
137
- * keys are deliberately unsupported: a hook reports a person's own shell. */
138
- async function postReport(report, signal, runtime, args) {
139
- const auth = resolveCliAuth(args, runtime.env);
137
+ * keys are deliberately unsupported: a hook reports a person's own shell.
138
+ *
139
+ * The exchange never rotates the refresh token. The hook runs once per shell
140
+ * command under a 1.5 s budget, and a rotation cut short by that budget would
141
+ * lose the only copy of the new token, which later revokes the whole family.
142
+ * With nothing to rotate there is nothing to serialize either, so the hook
143
+ * never takes the profile lease or queues behind a serving bridge. */
144
+ async function postReport(report, signal, args, env, fetcher) {
145
+ const auth = resolveCliAuth(args, env);
140
146
  if (auth.kind !== "profile")
141
147
  return;
142
148
  const { TokenManager } = await import("./bridge.js");
143
- const { persistCurrentProfileRotation, recoverProfileRotation, withProfileLock } = await import("./credentials.js");
144
- const manager = new TokenManager(auth.endpoint, auth.refreshToken, (next, previous) => persistCurrentProfileRotation(auth.profile, previous, next, auth.endpoint), {
145
- reload: () => recoverProfileRotation(auth.profile)?.refreshToken,
146
- lock: (fn) => withProfileLock(auth.profile, fn)
147
- }, HOOK_BUDGET_MS, signal);
149
+ const manager = new TokenManager(auth.endpoint, auth.refreshToken, undefined, undefined, HOOK_BUDGET_MS, signal, fetcher);
148
150
  const response = await manager.authedFetch(`${new URL(auth.endpoint).origin}${CLI_ACTIVITY_PATH}`, {
149
151
  method: "POST",
150
152
  headers: { "content-type": "application/json", "x-passport-surface": "cli" },
@@ -178,7 +180,10 @@ async function runHook(args, runtime, deps) {
178
180
  if (!report)
179
181
  return;
180
182
  const budget = AbortSignal.any([runtime.signal, AbortSignal.timeout(HOOK_BUDGET_MS)]);
181
- await (deps.send ?? postReport)(report, budget, runtime, args);
183
+ if (deps.send)
184
+ await deps.send(report, budget, runtime, args);
185
+ else
186
+ await postReport(report, budget, args, runtime.env, deps.fetch ?? fetch);
182
187
  }
183
188
  export async function hook(args, runtime, deps = {}) {
184
189
  const action = args.positionals[0];
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.11.0";
1
+ export declare const VERSION = "0.11.1";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Keep in lockstep with bridge/package.json. The published bridge can run from
2
2
  // a compiled sidecar where package.json is not available at runtime.
3
- export const VERSION = "0.11.0";
3
+ export const VERSION = "0.11.1";
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "passport-bridge",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "passport-bridge",
9
- "version": "0.11.0",
9
+ "version": "0.11.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.11.0",
3
+ "version": "0.11.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": {