passport-bridge 0.29.0 → 0.30.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 +3 -3
- package/dist/approvalNotice.js +2 -2
- package/dist/cliArgs.d.ts +1 -1
- package/dist/cliArgs.js +22 -13
- package/dist/cliChanges.js +3 -10
- package/dist/cliGuardHealth.d.ts +9 -4
- package/dist/cliGuardHealth.js +13 -6
- package/dist/cliGuardState.js +1 -1
- package/dist/cliHook.d.ts +1 -0
- package/dist/cliHook.js +15 -24
- package/dist/cliHookInput.d.ts +1 -0
- package/dist/cliHookPairing.d.ts +9 -0
- package/dist/cliHookPairing.js +42 -0
- package/dist/cliMain.js +1 -1
- package/dist/cliOutput.js +7 -7
- package/dist/cliProjectSummary.js +1 -1
- package/dist/cliSessions.d.ts +11 -11
- package/dist/cliSessions.js +18 -22
- package/dist/cliSessionsJson.js +3 -8
- package/dist/cliSessionsRender.js +3 -3
- package/dist/cliStatusGuard.js +1 -1
- package/dist/cliWait.js +1 -1
- package/dist/completion.js +2 -2
- package/dist/initLocalSteps.js +11 -0
- package/dist/initOutro.js +21 -6
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webLinks.d.ts +4 -1
- package/dist/webLinks.js +22 -9
- package/npm-shrinkwrap.json +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,9 +293,9 @@ The Passport plugin (`rsyed94/passport-plugins`) runs the same two hooks from th
|
|
|
293
293
|
passport rules test "railway redeploy -e staging"
|
|
294
294
|
passport rules test "rm -rf ~/"
|
|
295
295
|
passport wait apr_123
|
|
296
|
-
passport
|
|
297
|
-
passport
|
|
298
|
-
passport
|
|
296
|
+
passport tasks # or: --all, --running, --production-changes
|
|
297
|
+
passport tasks --project acme-api # the project's summary, then its work
|
|
298
|
+
passport tasks ses_123
|
|
299
299
|
passport changes --env production --since 1h
|
|
300
300
|
passport sync # or: passport sync --remove
|
|
301
301
|
passport env # or: passport env set railway qa staging
|
package/dist/approvalNotice.js
CHANGED
|
@@ -173,8 +173,8 @@ export function noticeContext(notices, now) {
|
|
|
173
173
|
return `- ${what}: approved by ${notice.approvedBy} ${span(now - notice.approvedAt)} ago (${when} UTC). The approval lapses in ${span(notice.expiresAt - now)}.`;
|
|
174
174
|
});
|
|
175
175
|
const lead = notices.length === 1
|
|
176
|
-
? "Passport: a command this
|
|
177
|
-
: "Passport: commands this
|
|
176
|
+
? "Passport: a command this task asked about earlier was approved after you stopped waiting. It hasn't run."
|
|
177
|
+
: "Passport: commands this task asked about earlier were approved after you stopped waiting. They haven't run.";
|
|
178
178
|
return [
|
|
179
179
|
lead,
|
|
180
180
|
...lines,
|
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", "request", "resources", "prompts", "discover", "scan", "hook", "wait", "rules", "actions", "
|
|
1
|
+
export declare const COMMANDS: readonly ["init", "login", "logout", "profiles", "use", "status", "doctor", "ready", "search", "describe", "run", "connect", "request", "resources", "prompts", "discover", "scan", "hook", "wait", "rules", "actions", "tasks", "changes", "env", "sync", "exec", "undo", "keys", "setup", "session", "access", "update", "completion", "help", "version"];
|
|
2
2
|
export type Command = (typeof COMMANDS)[number];
|
|
3
3
|
/** Old names that still run for one release, left out of help, completion,
|
|
4
4
|
* and suggestions. `discover` is part of `scan` now. */
|
package/dist/cliArgs.js
CHANGED
|
@@ -21,7 +21,7 @@ export const COMMANDS = [
|
|
|
21
21
|
"wait",
|
|
22
22
|
"rules",
|
|
23
23
|
"actions",
|
|
24
|
-
"
|
|
24
|
+
"tasks",
|
|
25
25
|
"changes",
|
|
26
26
|
"env",
|
|
27
27
|
"sync",
|
|
@@ -93,13 +93,13 @@ const FLAGS = {
|
|
|
93
93
|
"delegation-id": { kind: "value", commands: ["access"] },
|
|
94
94
|
"client-id": { kind: "value", commands: ["access"] },
|
|
95
95
|
environment: { kind: "value", commands: ["rules", "actions"] },
|
|
96
|
-
status: { kind: "value", commands: ["
|
|
97
|
-
all: { kind: "boolean", commands: ["
|
|
98
|
-
running: { kind: "boolean", commands: ["
|
|
99
|
-
"production-changes": { kind: "boolean", commands: ["
|
|
100
|
-
project: { kind: "value", commands: ["
|
|
101
|
-
pr: { kind: "value", commands: ["
|
|
102
|
-
since: { kind: "value", commands: ["
|
|
96
|
+
status: { kind: "value", commands: ["tasks"] },
|
|
97
|
+
all: { kind: "boolean", commands: ["tasks"] },
|
|
98
|
+
running: { kind: "boolean", commands: ["tasks"] },
|
|
99
|
+
"production-changes": { kind: "boolean", commands: ["tasks"] },
|
|
100
|
+
project: { kind: "value", commands: ["tasks", "changes"] },
|
|
101
|
+
pr: { kind: "value", commands: ["tasks", "changes"] },
|
|
102
|
+
since: { kind: "value", commands: ["tasks", "changes"] },
|
|
103
103
|
until: { kind: "value", commands: ["changes"] },
|
|
104
104
|
env: { kind: "value", commands: ["changes"] },
|
|
105
105
|
remove: { kind: "boolean", commands: ["sync", "keys"] },
|
|
@@ -144,8 +144,13 @@ function unknownOption(raw, command) {
|
|
|
144
144
|
const where = command && command !== "help" ? `passport help ${command}` : "passport help";
|
|
145
145
|
return new ArgError(`Unknown option "${raw}". See the options with ${where}.`);
|
|
146
146
|
}
|
|
147
|
+
/** Old names that still run: `passport sessions` is `passport tasks`. */
|
|
148
|
+
const COMMAND_ALIASES = { sessions: "tasks" };
|
|
149
|
+
function commandNamed(value) {
|
|
150
|
+
return COMMANDS.includes(value) ? value : COMMAND_ALIASES[value];
|
|
151
|
+
}
|
|
147
152
|
function knownCommand(value) {
|
|
148
|
-
return
|
|
153
|
+
return commandNamed(value) !== undefined;
|
|
149
154
|
}
|
|
150
155
|
function flagParts(raw) {
|
|
151
156
|
const body = raw.slice(2);
|
|
@@ -212,9 +217,9 @@ export function parseArgs(argv) {
|
|
|
212
217
|
continue;
|
|
213
218
|
}
|
|
214
219
|
if (!command) {
|
|
215
|
-
|
|
220
|
+
command = commandNamed(raw);
|
|
221
|
+
if (!command)
|
|
216
222
|
throw unknownCommand(raw);
|
|
217
|
-
command = raw;
|
|
218
223
|
}
|
|
219
224
|
else {
|
|
220
225
|
positionals.push(raw);
|
|
@@ -245,8 +250,12 @@ function settle(args) {
|
|
|
245
250
|
if (command === "help" && positionals[0] !== undefined && !knownCommand(positionals[0]))
|
|
246
251
|
throw unknownCommand(positionals[0], true);
|
|
247
252
|
// `help keys add` shows the page for keys, which covers its subcommands.
|
|
248
|
-
|
|
253
|
+
// `help sessions` shows the page for its new name, tasks.
|
|
254
|
+
if (command === "help") {
|
|
249
255
|
positionals.splice(1);
|
|
256
|
+
if (positionals[0] !== undefined)
|
|
257
|
+
positionals[0] = commandNamed(positionals[0]);
|
|
258
|
+
}
|
|
250
259
|
validateShape(command, positionals);
|
|
251
260
|
validateNumbers(values);
|
|
252
261
|
return { command, positionals, values, repeats, booleans };
|
|
@@ -270,7 +279,7 @@ function validateShape(command, positionals) {
|
|
|
270
279
|
hook: 1,
|
|
271
280
|
wait: 1,
|
|
272
281
|
rules: 2,
|
|
273
|
-
|
|
282
|
+
tasks: 1,
|
|
274
283
|
changes: 0,
|
|
275
284
|
env: 4,
|
|
276
285
|
sync: 0,
|
package/dist/cliChanges.js
CHANGED
|
@@ -17,7 +17,7 @@ import { failure, timeoutMs } from "./cliSupport.js";
|
|
|
17
17
|
import { appName, clientName, count, list, oneOf, record, text, time, windowOf } from "./cliSessionsJson.js";
|
|
18
18
|
import { countOf } from "./plural.js";
|
|
19
19
|
import { joinParts, mark, visibleLength, wrap, termOf } from "./term.js";
|
|
20
|
-
import { APPS_LINK, hashLink } from "./webLinks.js";
|
|
20
|
+
import { APPS_LINK, hashLink, workLink } from "./webLinks.js";
|
|
21
21
|
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
22
22
|
const RANGES = ["1h", "6h", "24h", "7d", "30d", "today"];
|
|
23
23
|
const DEFAULT_SINCE = "7d";
|
|
@@ -332,20 +332,13 @@ export async function changes(args, runtime, deps = {}) {
|
|
|
332
332
|
headers: { accept: "application/json" },
|
|
333
333
|
signal: AbortSignal.any([runtime.signal, AbortSignal.timeout(timeoutMs(args))])
|
|
334
334
|
});
|
|
335
|
-
const page = changesOf(await json(response, "This Passport server doesn't list Production changes yet. Run: passport
|
|
335
|
+
const page = changesOf(await json(response, "This Passport server doesn't list Production changes yet. Run: passport tasks --production-changes"));
|
|
336
336
|
const since = value(args, "since")?.trim() ?? DEFAULT_SINCE;
|
|
337
|
-
const web = query({
|
|
338
|
-
view: "production",
|
|
339
|
-
since: filters.since,
|
|
340
|
-
until: filters.until,
|
|
341
|
-
project: filters.project,
|
|
342
|
-
pr: filters.pr
|
|
343
|
-
});
|
|
344
337
|
return {
|
|
345
338
|
json: page,
|
|
346
339
|
human: renderChanges(page, term, now, since, {
|
|
347
340
|
environments: hashLink(client.origin, APPS_LINK),
|
|
348
|
-
more:
|
|
341
|
+
more: workLink(client.origin, "actions", { env: "production", since: filters.since, project: filters.project })
|
|
349
342
|
})
|
|
350
343
|
};
|
|
351
344
|
}
|
package/dist/cliGuardHealth.d.ts
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Home, and the bell show it. Self-reported, read-only, and counts and flags
|
|
5
5
|
* only: never a command, a path, or a setting's value.
|
|
6
6
|
*
|
|
7
|
-
* Sent from a guard run that has 300 ms of its budget left
|
|
8
|
-
* `passport exec
|
|
7
|
+
* Sent from a guard run that has 300 ms of its budget left and from
|
|
8
|
+
* `passport exec` once a day, and every time from `passport init` (after the
|
|
9
|
+
* guard step) and `passport status`.
|
|
9
10
|
*/
|
|
10
11
|
import { type GuardClient, type GuardClientReport, type GuardHealthReport, type ProblemFix } from "./cliGuardState.js";
|
|
11
12
|
import type { Env } from "./cliSupport.js";
|
|
@@ -37,6 +38,10 @@ export type ReportedAgent = {
|
|
|
37
38
|
* agent's state and fix) or null when it couldn't be sent.
|
|
38
39
|
*/
|
|
39
40
|
export declare function sendGuardHealth(api: ApiCall, profile: string, env: Env, signal: AbortSignal): Promise<ReportedAgent[] | null>;
|
|
40
|
-
/**
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The daily report, if due: claim, then send. `force` sends it now anyway,
|
|
43
|
+
* for `init` (it just turned the guard on) and `status` (someone is looking),
|
|
44
|
+
* so Agents shows each agent's guard without waiting a day.
|
|
45
|
+
*/
|
|
46
|
+
export declare function guardHeartbeat(api: ApiCall, profile: string, env: Env, signal: AbortSignal, now?: number, force?: boolean): Promise<ReportedAgent[] | null>;
|
|
42
47
|
export {};
|
package/dist/cliGuardHealth.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Home, and the bell show it. Self-reported, read-only, and counts and flags
|
|
5
5
|
* only: never a command, a path, or a setting's value.
|
|
6
6
|
*
|
|
7
|
-
* Sent from a guard run that has 300 ms of its budget left
|
|
8
|
-
* `passport exec
|
|
7
|
+
* Sent from a guard run that has 300 ms of its budget left and from
|
|
8
|
+
* `passport exec` once a day, and every time from `passport init` (after the
|
|
9
|
+
* guard step) and `passport status`.
|
|
9
10
|
*/
|
|
10
11
|
import { closeSync, constants, mkdirSync, openSync, readFileSync, statSync, utimesSync } from "node:fs";
|
|
11
12
|
import { join } from "node:path";
|
|
@@ -143,12 +144,18 @@ export async function sendGuardHealth(api, profile, env, signal) {
|
|
|
143
144
|
return null;
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
/**
|
|
148
|
+
* The daily report, if due: claim, then send. `force` sends it now anyway,
|
|
149
|
+
* for `init` (it just turned the guard on) and `status` (someone is looking),
|
|
150
|
+
* so Agents shows each agent's guard without waiting a day.
|
|
151
|
+
*/
|
|
152
|
+
export async function guardHeartbeat(api, profile, env, signal, now = Date.now(), force = false) {
|
|
153
|
+
const due = claimGuardHeartbeat(profile, now);
|
|
154
|
+
if (!due && !(force && stampHeartbeat(profile, now)))
|
|
149
155
|
return null;
|
|
150
156
|
const sent = await sendGuardHealth(api, profile, env, signal);
|
|
151
157
|
// Once a day too: has a key `passport keys move` removed come back?
|
|
152
|
-
|
|
158
|
+
if (due)
|
|
159
|
+
await (await import("./cliKeysBack.js")).checkKeysBack(api, signal, process.env, profile).catch(() => undefined);
|
|
153
160
|
return sent;
|
|
154
161
|
}
|
package/dist/cliGuardState.js
CHANGED
|
@@ -79,7 +79,7 @@ export function problemFix(kind, client) {
|
|
|
79
79
|
};
|
|
80
80
|
case "coverage-drop":
|
|
81
81
|
return {
|
|
82
|
-
text: "Open the agent's
|
|
82
|
+
text: "Open the agent's tasks on Work and look at what Passport couldn't tell.",
|
|
83
83
|
link: agent,
|
|
84
84
|
docs: `${DOCS_BASE}/member/cli-hook#decided-placed-and-blind`
|
|
85
85
|
};
|
package/dist/cliHook.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { type ParsedArgs } from "./cliArgs.js";
|
|
|
18
18
|
import { type CliFinding } from "./cliHookClassify.js";
|
|
19
19
|
import { type DecidedFinding, type GuardDecision } from "./cliHookGuard.js";
|
|
20
20
|
import { type HookInput } from "./cliHookInput.js";
|
|
21
|
+
export { pairingId } from "./cliHookPairing.js";
|
|
21
22
|
import { type CliHookReport, type HookDependencies, type HookRuntime } from "./cliHookDeliver.js";
|
|
22
23
|
export { HOOK_BUDGET_MS, HOOK_RUNTIMES, legacyReport, type CliHookReport, type HookDependencies, type HookRuntime, type ReportedFinding } from "./cliHookDeliver.js";
|
|
23
24
|
export { opaqueKind, opaqueProgram } from "./cliHookOpaque.js";
|
package/dist/cliHook.js
CHANGED
|
@@ -23,6 +23,8 @@ import { guardMachineOf } from "./cliHookGuard.js";
|
|
|
23
23
|
import { detectMode } from "./cliHookMode.js";
|
|
24
24
|
import { cappedHold, holdSeconds } from "./cliHookHold.js";
|
|
25
25
|
import { commandText, readInput } from "./cliHookInput.js";
|
|
26
|
+
import { pairingId, withPairing, withParked } from "./cliHookPairing.js";
|
|
27
|
+
export { pairingId } from "./cliHookPairing.js";
|
|
26
28
|
import { budgetSignal, expiredAsks, HOOK_BUDGET_MS, HOOK_RUNTIMES, leftovers, localProfile, localSelection, profileApi, queueAfterCommand, reportSender, runFlush, startFlushIfDue } from "./cliHookDeliver.js";
|
|
27
29
|
export { HOOK_BUDGET_MS, HOOK_RUNTIMES, legacyReport } from "./cliHookDeliver.js";
|
|
28
30
|
import { hookViaPlugin } from "./hookPlugin.js";
|
|
@@ -30,7 +32,7 @@ import { guardLocalBackups, markLocalBackups } from "./localBackups.js";
|
|
|
30
32
|
import { auditBackups, auditDecision, auditedCommand, markTrashed } from "./cliHookAudit.js";
|
|
31
33
|
import { opaqueParts } from "./cliHookOpaque.js";
|
|
32
34
|
export { opaqueKind, opaqueProgram } from "./cliHookOpaque.js";
|
|
33
|
-
import { hasExpired, holdAsk
|
|
35
|
+
import { hasExpired, holdAsk } from "./cliHookPending.js";
|
|
34
36
|
import { readCliPolicy } from "./cliPolicy.js";
|
|
35
37
|
import { saveScriptCache, scriptReader, scriptReport } from "./cliScriptRead.js";
|
|
36
38
|
import { standDownForManaged } from "./managedHooks.js";
|
|
@@ -309,7 +311,7 @@ async function runAudit(args, runtime, deps) {
|
|
|
309
311
|
const findings = line.findings;
|
|
310
312
|
saveScriptCache(scripts);
|
|
311
313
|
// v2: the same decision the guard made, so the row says why it ran.
|
|
312
|
-
const key = context(input, runtime.env, value(args, "client"));
|
|
314
|
+
const key = withPairing(context(input, runtime.env, value(args, "client")), input, event.command);
|
|
313
315
|
const { taken, backedUp } = auditBackups(findings, key, Boolean(trashed));
|
|
314
316
|
const guardAt = { ...guardAtFor(machine, input, runtime.env), ...taken };
|
|
315
317
|
const { decision, local, decided } = auditDecision(findings, policy, command, line.complete, guardAt);
|
|
@@ -323,7 +325,7 @@ async function runAudit(args, runtime, deps) {
|
|
|
323
325
|
// The guard parked what it decided before this exact command: send one row
|
|
324
326
|
// for both, "asked first, then ran" (or the server's own allow).
|
|
325
327
|
if (report && !event.cursorImported)
|
|
326
|
-
report = await withParked(report, input, profile, now);
|
|
328
|
+
report = await withParked(report, pairingId(input, event.command), profile, now);
|
|
327
329
|
if (!report && !hasExpired(now))
|
|
328
330
|
return;
|
|
329
331
|
if (!deps.send && !deps.fetch) {
|
|
@@ -339,20 +341,6 @@ async function runAudit(args, runtime, deps) {
|
|
|
339
341
|
await Promise.allSettled(reports.map((entry) => send(entry)));
|
|
340
342
|
}
|
|
341
343
|
/** One row for an ask and the run that followed it; how long the person took to say yes. */
|
|
342
|
-
async function withParked(report, input, profile, now) {
|
|
343
|
-
const toolUseId = text(input.tool_use_id, 128);
|
|
344
|
-
const parked = toolUseId ? takeAsk(report.runtime, report.sessionId, toolUseId) : null;
|
|
345
|
-
if (!parked)
|
|
346
|
-
return report;
|
|
347
|
-
const held = parked.report;
|
|
348
|
-
if (held.decision === "allow")
|
|
349
|
-
return { ...report, decision: "allow" };
|
|
350
|
-
// From the prompt to the command finishing, less its own run time.
|
|
351
|
-
const waited = now - parked.createdAt - (report.durationMs ?? 0);
|
|
352
|
-
if (profile && waited >= 0)
|
|
353
|
-
(await import("./cliSpeed.js")).noteApprovalWait(profile, report.runtime, waited, now);
|
|
354
|
-
return { ...report, decision: "ask", ran: true };
|
|
355
|
-
}
|
|
356
344
|
function outputClient(event, runtime) {
|
|
357
345
|
if (event.cursorNative)
|
|
358
346
|
return "cursor";
|
|
@@ -365,7 +353,7 @@ function outputClient(event, runtime) {
|
|
|
365
353
|
* allow, or an ask parked until the command runs). */
|
|
366
354
|
async function guardReport(base, plan, context) {
|
|
367
355
|
if (plan.server && base)
|
|
368
|
-
return serverDecidedReport(base, plan.server, context.now, plan.held);
|
|
356
|
+
return serverDecidedReport(base, plan.server, context.now, plan.held, context.pairingId);
|
|
369
357
|
// Offline, this computer's answer replaces the local Ask on the record.
|
|
370
358
|
const decided = base && plan.offline && plan.verdict ? { ...base, decision: plan.verdict } : base;
|
|
371
359
|
const report = decided && context.v2 && decided.decision === "allow" ? null : codexAskBlocked(decided);
|
|
@@ -384,21 +372,22 @@ async function guardReport(base, plan, context) {
|
|
|
384
372
|
* earlier) is parked for the run's own row; a waiting request is "asked"; a
|
|
385
373
|
* declined one is "asked, not run"; a block is a block.
|
|
386
374
|
*/
|
|
387
|
-
function serverDecidedReport(base, server, now, held) {
|
|
375
|
+
function serverDecidedReport(base, server, now, held, pairingId = base.toolUseId) {
|
|
388
376
|
if (server.decision === "none")
|
|
389
377
|
return null;
|
|
390
378
|
// Held, and approved in time: "asked first, then ran", once the run reports.
|
|
391
379
|
if (held === "approved") {
|
|
392
380
|
const asked = { ...base, decision: "ask" };
|
|
393
|
-
if (
|
|
381
|
+
if (pairingId && holdAsk(base.runtime, base.sessionId, pairingId, asked, now))
|
|
394
382
|
return null;
|
|
395
383
|
return { ...asked, ran: true };
|
|
396
384
|
}
|
|
397
385
|
if (held === "declined" || held === "expired")
|
|
398
386
|
return { ...base, decision: "ask", ran: false };
|
|
399
387
|
if (server.decision === "allow") {
|
|
400
|
-
|
|
401
|
-
|
|
388
|
+
// Cursor too (by its pairing id), so the run's own row says it was allowed, not asked.
|
|
389
|
+
if (pairingId)
|
|
390
|
+
holdAsk(base.runtime, base.sessionId, pairingId, { ...base, decision: "allow" }, now);
|
|
402
391
|
return null;
|
|
403
392
|
}
|
|
404
393
|
if (server.decision === "ask")
|
|
@@ -474,8 +463,9 @@ async function runGuard(args, runtime, deps) {
|
|
|
474
463
|
const declared = value(args, "client");
|
|
475
464
|
const client = outputClient(event, detectRuntime(input, runtime.env, declared));
|
|
476
465
|
// Which deletes will have a backup on this computer, so the rules decide knowing it.
|
|
466
|
+
const key = withPairing(context(input, runtime.env, declared), input, event.command);
|
|
477
467
|
const backups = guardLocalBackups(event.command, line, policy, {
|
|
478
|
-
...{ ...guardAtFor(machine, input, runtime.env), machine, key
|
|
468
|
+
...{ ...guardAtFor(machine, input, runtime.env), machine, key },
|
|
479
469
|
rewrite: client === "claude-code" && !event.cursorImported
|
|
480
470
|
});
|
|
481
471
|
let decision = backups.decision;
|
|
@@ -551,7 +541,8 @@ async function runGuard(args, runtime, deps) {
|
|
|
551
541
|
const report = await guardReport(withStep(base && plan.output ? base : null, input, policy), plan, {
|
|
552
542
|
v2: policy?.version === 2,
|
|
553
543
|
runtime,
|
|
554
|
-
now: clock()
|
|
544
|
+
now: clock(),
|
|
545
|
+
pairingId: pairingId(input, event.command)
|
|
555
546
|
});
|
|
556
547
|
if (!deps.send && !deps.fetch) {
|
|
557
548
|
// The agent is waiting for this process to exit: never wait on the network
|
package/dist/cliHookInput.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CliHookReport } from "./cliHookDeliver.js";
|
|
2
|
+
import type { HookInput } from "./cliHookInput.js";
|
|
3
|
+
export declare function pairingId(input: HookInput, command: string): string | undefined;
|
|
4
|
+
/** A backup key with the local pairing id, so the guard and audit runs find the same backup. */
|
|
5
|
+
export declare function withPairing<T extends {
|
|
6
|
+
toolUseId?: string;
|
|
7
|
+
}>(key: T, input: HookInput, command: string): T;
|
|
8
|
+
/** The guard parked what it decided before this exact command: one row for both, "asked first, then ran" (or the server's own allow). */
|
|
9
|
+
export declare function withParked(report: CliHookReport, toolUseId: string | undefined, profile: string | undefined, now: number): Promise<CliHookReport>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What pairs a command's guard run with its audit run on this computer: the
|
|
3
|
+
* agent's tool-use id. Cursor sends none, so its conversation, generation, and
|
|
4
|
+
* the command stand in, the same before and after the command. Only ever a
|
|
5
|
+
* local file key (parked answers, backups); never reported.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { takeAsk } from "./cliHookPending.js";
|
|
9
|
+
function text(candidate) {
|
|
10
|
+
return typeof candidate === "string" && candidate.length > 0 && candidate.length <= 128 ? candidate : undefined;
|
|
11
|
+
}
|
|
12
|
+
export function pairingId(input, command) {
|
|
13
|
+
const toolUseId = text(input.tool_use_id);
|
|
14
|
+
const cursor = input.hook_event_name === "beforeShellExecution" || input.hook_event_name === "afterShellExecution";
|
|
15
|
+
if (toolUseId || !cursor)
|
|
16
|
+
return toolUseId;
|
|
17
|
+
const conversation = text(input.conversation_id);
|
|
18
|
+
const generation = text(input.generation_id);
|
|
19
|
+
if (!conversation || !generation)
|
|
20
|
+
return undefined;
|
|
21
|
+
const digest = createHash("sha256").update(`${conversation}\u0000${generation}\u0000${command}`).digest("hex");
|
|
22
|
+
return `cursor:${digest.slice(0, 32)}`;
|
|
23
|
+
}
|
|
24
|
+
/** A backup key with the local pairing id, so the guard and audit runs find the same backup. */
|
|
25
|
+
export function withPairing(key, input, command) {
|
|
26
|
+
const toolUseId = pairingId(input, command);
|
|
27
|
+
return toolUseId ? { ...key, toolUseId } : key;
|
|
28
|
+
}
|
|
29
|
+
/** The guard parked what it decided before this exact command: one row for both, "asked first, then ran" (or the server's own allow). */
|
|
30
|
+
export async function withParked(report, toolUseId, profile, now) {
|
|
31
|
+
const parked = toolUseId ? takeAsk(report.runtime, report.sessionId, toolUseId) : null;
|
|
32
|
+
if (!parked)
|
|
33
|
+
return report;
|
|
34
|
+
const held = parked.report;
|
|
35
|
+
if (held.decision === "allow")
|
|
36
|
+
return { ...report, decision: "allow" };
|
|
37
|
+
// From the prompt to the command finishing, less its own run time.
|
|
38
|
+
const waited = now - parked.createdAt - (report.durationMs ?? 0);
|
|
39
|
+
if (profile && waited >= 0)
|
|
40
|
+
(await import("./cliSpeed.js")).noteApprovalWait(profile, report.runtime, waited, now);
|
|
41
|
+
return { ...report, decision: "ask", ran: true };
|
|
42
|
+
}
|
package/dist/cliMain.js
CHANGED
|
@@ -471,7 +471,7 @@ async function hook(args, runtime) {
|
|
|
471
471
|
/** Commands that load their own module and need nothing else from here. */
|
|
472
472
|
const LAZY_COMMANDS = {
|
|
473
473
|
wait: async () => (await import("./cliWait.js")).wait,
|
|
474
|
-
|
|
474
|
+
tasks: async () => (await import("./cliSessions.js")).sessions,
|
|
475
475
|
changes: async () => (await import("./cliChanges.js")).changes,
|
|
476
476
|
request: async () => (await import("./cliRequest.js")).request,
|
|
477
477
|
sync: async () => (await import("./cliSync.js")).sync,
|
package/dist/cliOutput.js
CHANGED
|
@@ -54,10 +54,10 @@ const EXAMPLES = {
|
|
|
54
54
|
["passport env", "Where commands in this folder land"],
|
|
55
55
|
["passport env set railway api production", "Place a resource for the workspace"]
|
|
56
56
|
],
|
|
57
|
-
|
|
58
|
-
["passport
|
|
59
|
-
["passport
|
|
60
|
-
["passport
|
|
57
|
+
tasks: [
|
|
58
|
+
["passport tasks", "Work that needs a look, by project"],
|
|
59
|
+
["passport tasks --production-changes", "What changed Production this week"],
|
|
60
|
+
["passport tasks --project api --since 24h --all", "Every work item in one project today"]
|
|
61
61
|
],
|
|
62
62
|
request: [
|
|
63
63
|
[
|
|
@@ -149,9 +149,9 @@ function helpText(verb) {
|
|
|
149
149
|
sync: "passport sync [--remove]\nAdds what your Autopilot rules run without asking (reads, and changes inside the project: tests, builds, formatters, git add, git commit) to each agent's own allowlist, so those prompts stop even offline and in Codex. Claude Code: permissions.allow in ~/.claude/settings.json. Codex: ~/.codex/rules/passport.rules. Cursor CLI: permissions.allow in ~/.cursor/cli-config.json; Cursor: terminalAllowlist in ~/.cursor/permissions.json when you keep one there. Deletes, installs, and Production never sync. Your own entries are never changed. Runs again on its own when your rules change.\n --remove take Passport's entries out and stop syncing\nJSON: {action,agents:[{agent,name,path,added,removed,skipped?}]}",
|
|
150
150
|
// copy-style-allow double-space: help columns line up
|
|
151
151
|
env: "passport env [--json]\npassport env set <vendor> <resource> <production|staging|development>\nShows where commands in this folder land, read the way each vendor's own CLI reads it: Railway, Vercel, Supabase, Wrangler, Netlify, Firebase, Convex, Neon, Fly, Heroku, kubectl, AWS, gcloud, Terraform, Stripe, and database URLs. One row per app: the resource, how Passport knows (linked, a flag, the vendor's default), and its environment. Anything Passport can't place counts as Production. Read on this computer; nothing is sent.\n set place a resource for the whole workspace. Admins choose any environment; everyone else can only say Production.\nJSON: {environments:[{vendor,resource,how,kind,assumed,note?}]}",
|
|
152
|
-
|
|
152
|
+
tasks:
|
|
153
153
|
// copy-style-allow double-space: help columns line up
|
|
154
|
-
"passport
|
|
154
|
+
"passport tasks [--all] [--running] [--production-changes] [--project <name>] [--pr <number>] [--since <when>] [--status running|ended]\npassport tasks <task-id>\nYour agents' tasks, as Work shows them: work items (a pull request or branch, every task on it rolled up) by project, each with its agents and what happened: actions, active time, failures, confirmed Production changes, unplaced changes, asks and how they ended, and how much Passport couldn't check. Notable work comes first; routine work folds into one line per project.\n --all every work item, routine ones too (pass one of --all, --running, --production-changes)\n --running work items with a running task\n --production-changes changes to confirmed Production, by app and target (7 days unless --since)\n --project <name> one project (repository, else folder)\n --pr <number> one pull request\n --since <when> today, 24h, 7d, 30d, 90d, or a date (YYYY-MM-DD)\n --status <status> running or ended tasks only\n <task-id> one task: its outcome and recent actions with what they acted on\nAlso runs as passport sessions.\nJSON: {view,groups:[{key,kind,label,apps,running,production,unplaced,items:[{key,title,project,branch,pull,agents,sessions,sessionIds,startedAt,lastActivityAt,activeMs,running,waiting,shape,reasons,severity,link}],routine}],totals,work,window,complete,nextCursor}; --production-changes: {view,sinceTs,untilTs,total,unplaced,window,apps:[{appKey,appName,count,lastTs,targets}]}; <task-id>: {view,session,outcome,approvals,timeline,nextCursor}",
|
|
155
155
|
changes:
|
|
156
156
|
// copy-style-allow double-space: help columns line up
|
|
157
157
|
"passport changes [--env production] [--since <when>] [--until <date>] [--project <name>] [--pr <number>] [--app <key>] [--agent <id>]\nWhat your agents changed in Production, the list Sessions › Production changes shows: every change, delete, and irreversible action that ran on confirmed Production in the window, grouped by app, newest first. Each row has its time and command, then the agent, the person, the pull request (else branch), Failed or Approved, and whether Passport can undo it. Blocked and declined actions never reached Production and aren't listed; changes to targets nobody placed are one count.\n --env <env> production (the only one for now)\n --since <when> 1h, 6h, 24h, 7d (default), 30d, today, or a date (YYYY-MM-DD)\n --until <date> through the end of a date (YYYY-MM-DD)\n --project <name> one project (repository, else folder)\n --pr <number> one pull request\n --app <key> one app, or several separated by commas\n --agent <id> one agent (claude-code, codex, cursor)\nJSON: {view,environment,sinceTs,untilTs,total,unplaced,complete,window,apps:[{vendor,appName,changes:[{id,ts,person,agent,agentName,appKey,vendor,appName,command,target,actionClass,result,approved,sessionId,project,branch,pull,undo}]}]}",
|
|
@@ -220,7 +220,7 @@ Commands:
|
|
|
220
220
|
rules Test what Autopilot decides for a command
|
|
221
221
|
actions Tell Passport what a project script does
|
|
222
222
|
env Show where commands in this folder land
|
|
223
|
-
|
|
223
|
+
tasks Your agents' tasks: what needs a look, and Production changes
|
|
224
224
|
changes What your agents changed in Production, one row each
|
|
225
225
|
sync Keep your agents' own allowlists in line with your rules
|
|
226
226
|
exec Run a vendor CLI with a key Passport holds
|
|
@@ -106,7 +106,7 @@ export function renderProject(project, term) {
|
|
|
106
106
|
blocks.push([
|
|
107
107
|
project.project,
|
|
108
108
|
...joinParts([
|
|
109
|
-
countOf(project.totals.sessions, "
|
|
109
|
+
countOf(project.totals.sessions, "task"),
|
|
110
110
|
...(project.totals.running ? [`${project.totals.running.toLocaleString("en-US")} running`] : []),
|
|
111
111
|
...(project.window ? [project.window.label] : [])
|
|
112
112
|
], term.width)
|
package/dist/cliSessions.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `passport sessions
|
|
3
|
-
*
|
|
2
|
+
* `passport tasks` (also `passport sessions`): your agents' tasks the way
|
|
3
|
+
* Work shows them (shared/workItemContract.ts).
|
|
4
4
|
*
|
|
5
|
-
* passport
|
|
6
|
-
*
|
|
7
|
-
* passport
|
|
8
|
-
* passport
|
|
9
|
-
* passport
|
|
10
|
-
* passport
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* passport
|
|
5
|
+
* passport tasks Notable work items by project; routine
|
|
6
|
+
* ones fold into one line per project
|
|
7
|
+
* passport tasks --all every work item
|
|
8
|
+
* passport tasks --running work items with a running task
|
|
9
|
+
* passport tasks --production-changes the Production changes ledger
|
|
10
|
+
* passport tasks --project <name> the project's summary first: where its
|
|
11
|
+
* targets are placed, its rules, and
|
|
12
|
+
* its Production changes this week
|
|
13
|
+
* passport tasks <id> one task: its outcome and recent timeline
|
|
14
14
|
*
|
|
15
15
|
* `--project`, `--pr`, `--since`, and `--status` narrow on the server
|
|
16
16
|
* (`GET /api/my/work-items`, `/api/my/production-ledger`), never on a loaded
|
package/dist/cliSessions.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `passport sessions
|
|
3
|
-
*
|
|
2
|
+
* `passport tasks` (also `passport sessions`): your agents' tasks the way
|
|
3
|
+
* Work shows them (shared/workItemContract.ts).
|
|
4
4
|
*
|
|
5
|
-
* passport
|
|
6
|
-
*
|
|
7
|
-
* passport
|
|
8
|
-
* passport
|
|
9
|
-
* passport
|
|
10
|
-
* passport
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* passport
|
|
5
|
+
* passport tasks Notable work items by project; routine
|
|
6
|
+
* ones fold into one line per project
|
|
7
|
+
* passport tasks --all every work item
|
|
8
|
+
* passport tasks --running work items with a running task
|
|
9
|
+
* passport tasks --production-changes the Production changes ledger
|
|
10
|
+
* passport tasks --project <name> the project's summary first: where its
|
|
11
|
+
* targets are placed, its rules, and
|
|
12
|
+
* its Production changes this week
|
|
13
|
+
* passport tasks <id> one task: its outcome and recent timeline
|
|
14
14
|
*
|
|
15
15
|
* `--project`, `--pr`, `--since`, and `--status` narrow on the server
|
|
16
16
|
* (`GET /api/my/work-items`, `/api/my/production-ledger`), never on a loaded
|
|
@@ -22,7 +22,7 @@ import { bool, value } from "./cliArgs.js";
|
|
|
22
22
|
import { api, json } from "./cliAutopilot.js";
|
|
23
23
|
import { failure, timeoutMs } from "./cliSupport.js";
|
|
24
24
|
import { termOf } from "./term.js";
|
|
25
|
-
import { APPS_LINK, hashLink } from "./webLinks.js";
|
|
25
|
+
import { APPS_LINK, hashLink, workLink } from "./webLinks.js";
|
|
26
26
|
import { count, ID, ledgerOf, list, mergeGroups, record, sessionOf, text, windowOf, workCountsOf, workGroupOf } from "./cliSessionsJson.js";
|
|
27
27
|
import { renderLedger, renderSession, renderWork } from "./cliSessionsRender.js";
|
|
28
28
|
import { projectOf, renderProject } from "./cliProjectSummary.js";
|
|
@@ -106,7 +106,7 @@ async function projectSummary(client, name, args, runtime, range = {}) {
|
|
|
106
106
|
// The page counts over the same window as the work list (--since).
|
|
107
107
|
const window = query({ since: range.since });
|
|
108
108
|
const raw = await read(client, `/api/my/projects/${encodeURIComponent(name)}${window}`, args, runtime, "No project.");
|
|
109
|
-
return projectOf(raw,
|
|
109
|
+
return projectOf(raw, workLink(client.origin, "history", { project: name, since: range.since }));
|
|
110
110
|
}
|
|
111
111
|
catch {
|
|
112
112
|
return null;
|
|
@@ -120,9 +120,9 @@ export async function sessions(args, runtime, deps = {}) {
|
|
|
120
120
|
return failure("Pass one of --all, --running, or --production-changes.", 6, "usage");
|
|
121
121
|
if (id !== undefined &&
|
|
122
122
|
(views.length || ["project", "pr", "since", "status"].some((flag) => value(args, flag) !== undefined)))
|
|
123
|
-
return failure("A
|
|
123
|
+
return failure("A task id takes no filters. Run: passport tasks <id>", 6, "usage");
|
|
124
124
|
if (id !== undefined && !ID.test(id))
|
|
125
|
-
return failure("That isn't a
|
|
125
|
+
return failure("That isn't a task id.", 6, "usage");
|
|
126
126
|
const filters = id === undefined ? filtersOf(args, now) : {};
|
|
127
127
|
if (views[0] === "production-changes" && filters.status)
|
|
128
128
|
return failure("--status lists work items; Production changes take --project, --pr, and --since.", 6, "usage");
|
|
@@ -172,13 +172,9 @@ export async function sessions(args, runtime, deps = {}) {
|
|
|
172
172
|
const project = view === "notable" && filters.project && !filters.pr && !filters.status
|
|
173
173
|
? await projectSummary(client, filters.project, args, runtime, { since: filters.since })
|
|
174
174
|
: null;
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
pr: filters.pr,
|
|
179
|
-
since: value(args, "since")
|
|
180
|
-
});
|
|
181
|
-
const more = cursor ? hashLink(client.origin, `#sessions${webQuery}`) : null;
|
|
175
|
+
const more = cursor
|
|
176
|
+
? workLink(client.origin, "history", { project: filters.project, since: value(args, "since") })
|
|
177
|
+
: null;
|
|
182
178
|
const filtered = Object.keys(filters).length > 0;
|
|
183
179
|
const work = renderWork(result, term, filtered, more);
|
|
184
180
|
return project
|
package/dist/cliSessionsJson.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* out; a missing count reads 0.
|
|
6
6
|
*/
|
|
7
7
|
import { isEnvKind } from "./cliHookEnvironment.js";
|
|
8
|
-
import {
|
|
8
|
+
import { taskLink, workLink } from "./webLinks.js";
|
|
9
9
|
export function text(raw, max = 200) {
|
|
10
10
|
if (typeof raw !== "string")
|
|
11
11
|
return undefined;
|
|
@@ -157,11 +157,6 @@ function itemTitle(key, branch, pull, agents) {
|
|
|
157
157
|
return clientName(agents[0]?.client ?? "agent");
|
|
158
158
|
return "No branch";
|
|
159
159
|
}
|
|
160
|
-
/** A work item's own page in Passport: its project's branch, or the
|
|
161
|
-
* project's work with no branch. */
|
|
162
|
-
function itemHash(project, branch) {
|
|
163
|
-
return `#projects/${encodeURIComponent(project)}/work${branch ? `?branch=${encodeURIComponent(branch)}` : ""}`;
|
|
164
|
-
}
|
|
165
160
|
export function workItemOf(raw, origin) {
|
|
166
161
|
const item = record(raw);
|
|
167
162
|
const key = text(item.key, 300) ?? "none";
|
|
@@ -194,7 +189,7 @@ export function workItemOf(raw, origin) {
|
|
|
194
189
|
shape: shapeOf(item.shape),
|
|
195
190
|
reasons,
|
|
196
191
|
severity: oneOf(item.severity, ["failed", "asked", "production"]),
|
|
197
|
-
link: one ?
|
|
192
|
+
link: one ? taskLink(origin, sessionIds[0]) : project ? workLink(origin, "history", { project }) : null
|
|
198
193
|
};
|
|
199
194
|
}
|
|
200
195
|
export function workGroupOf(raw, origin) {
|
|
@@ -336,7 +331,7 @@ export function sessionOf(raw, origin) {
|
|
|
336
331
|
unchecked: count(session.unchecked),
|
|
337
332
|
waiting: count(session.waiting),
|
|
338
333
|
asks: session.asks === undefined ? null : asksOf(session.asks),
|
|
339
|
-
link:
|
|
334
|
+
link: taskLink(origin, id)
|
|
340
335
|
},
|
|
341
336
|
outcome: outcome
|
|
342
337
|
? {
|
|
@@ -156,7 +156,7 @@ export function renderWork(page, term, filtered, more) {
|
|
|
156
156
|
return "Nothing is running.";
|
|
157
157
|
if (page.view === "notable" && page.totals.items)
|
|
158
158
|
return "Nothing needs a look.";
|
|
159
|
-
return "No
|
|
159
|
+
return "No tasks yet. Start your agent and its actions will show up here.";
|
|
160
160
|
}
|
|
161
161
|
const sections = page.groups.map((group) => {
|
|
162
162
|
const lines = joinParts(groupHeading(group), term.width);
|
|
@@ -171,9 +171,9 @@ export function renderWork(page, term, filtered, more) {
|
|
|
171
171
|
});
|
|
172
172
|
const notes = [];
|
|
173
173
|
if (page.view === "notable" && page.groups.some((group) => group.routine?.count))
|
|
174
|
-
notes.push("Routine work is folded.\nRun: passport
|
|
174
|
+
notes.push("Routine work is folded.\nRun: passport tasks --all");
|
|
175
175
|
if (!page.complete)
|
|
176
|
-
notes.push("Only the latest
|
|
176
|
+
notes.push("Only the latest tasks were read. Narrow it with --since or --project.");
|
|
177
177
|
if (more)
|
|
178
178
|
notes.push(`More work in Passport: ${more}`);
|
|
179
179
|
// The server's window after its counts ("Last 7 days"); an older server sent none.
|
package/dist/cliStatusGuard.js
CHANGED
|
@@ -40,7 +40,7 @@ async function coverage(api, signal) {
|
|
|
40
40
|
export async function guardStatus(api, profile, signal, now = Date.now(), env = process.env) {
|
|
41
41
|
try {
|
|
42
42
|
const local = (await localGuardStates(env)).filter((entry) => entry.state);
|
|
43
|
-
const reported = api && profile ? await guardHeartbeat(api, profile, env, signal, now) : null;
|
|
43
|
+
const reported = api && profile ? await guardHeartbeat(api, profile, env, signal, now, true) : null;
|
|
44
44
|
const agents = local.map((entry) => {
|
|
45
45
|
// Passport knows what this computer can't (an agent turned off since it was on).
|
|
46
46
|
const server = reported?.find((agent) => agent.client === entry.client);
|
package/dist/cliWait.js
CHANGED
|
@@ -29,7 +29,7 @@ function approvedLine(lead, scope) {
|
|
|
29
29
|
if (!/^Approved\b.*\.$/.test(lead))
|
|
30
30
|
return lead;
|
|
31
31
|
if (scope === "session") {
|
|
32
|
-
return lead.replace(/\.$/, " for this
|
|
32
|
+
return lead.replace(/\.$/, " for this task. Matching commands in this task run without asking.");
|
|
33
33
|
}
|
|
34
34
|
if (scope === "rule")
|
|
35
35
|
return lead.replace(/\.$/, " and saved as a rule.");
|
package/dist/completion.js
CHANGED
|
@@ -21,7 +21,7 @@ const DESCRIPTIONS = {
|
|
|
21
21
|
wait: "Wait for a person to decide an approval request",
|
|
22
22
|
rules: "Test what Autopilot decides for a command",
|
|
23
23
|
actions: "Tell Passport what a project script does",
|
|
24
|
-
|
|
24
|
+
tasks: "Your agents' tasks: what needs a look, and Production changes",
|
|
25
25
|
changes: "What your agents changed in Production, one row each",
|
|
26
26
|
env: "Show where commands in this folder land",
|
|
27
27
|
sync: "Keep your agents' own allowlists in line with your rules",
|
|
@@ -65,7 +65,7 @@ const COMMAND_FLAGS = {
|
|
|
65
65
|
setup: ["--agent", "--apply"],
|
|
66
66
|
hook: ["--agent", "--guard", "--apply"],
|
|
67
67
|
rules: ["--environment"],
|
|
68
|
-
|
|
68
|
+
tasks: ["--all", "--running", "--production-changes", "--project", "--pr", "--since", "--status"],
|
|
69
69
|
changes: ["--env", "--since", "--until", "--project", "--pr", "--app", "--agent"],
|
|
70
70
|
sync: ["--remove"],
|
|
71
71
|
exec: ["--wait", "--ask-again", "--verbose", "--agent", "--session", "--mask", "--no-masking"],
|
package/dist/initLocalSteps.js
CHANGED
|
@@ -266,6 +266,17 @@ export async function applyGuard(s, plan, mode) {
|
|
|
266
266
|
await guardSetup(s, plan, mode);
|
|
267
267
|
if (s.stable)
|
|
268
268
|
pruneOldCopies(s, s.stable);
|
|
269
|
+
await reportGuard(s);
|
|
270
|
+
}
|
|
271
|
+
/** Tell Passport now which agents have the guard, so Agents and Get started show them. Never fails init. */
|
|
272
|
+
async function reportGuard(s) {
|
|
273
|
+
const status = s.summary.steps.guard?.status;
|
|
274
|
+
if (!s.profile || !s.gateway || (status !== "done" && status !== "already_set_up" && status !== "needs_attention"))
|
|
275
|
+
return;
|
|
276
|
+
const { guardHeartbeat } = await import("./cliGuardHealth.js");
|
|
277
|
+
const signal = AbortSignal.any([s.signal, AbortSignal.timeout(1_500)]);
|
|
278
|
+
// Now when this run turned it on; otherwise only if today's report is due.
|
|
279
|
+
await guardHeartbeat((path, init) => s.api(path, init), s.profile, s.env, signal, Date.now(), status === "done").catch(() => undefined);
|
|
269
280
|
}
|
|
270
281
|
/** Keep the running version and whatever a hook still runs; drop the rest. */
|
|
271
282
|
function pruneOldCopies(s, stable) {
|
package/dist/initOutro.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* How `passport init` ends: a ✓ list of what's true now and what's left for
|
|
3
|
-
* the person, then one next
|
|
3
|
+
* the person, then one next step.
|
|
4
4
|
*
|
|
5
5
|
* Done.
|
|
6
6
|
* ✓ Passport added to Claude Code and Cursor
|
|
7
7
|
* ! Railway connects to Passport once you finish signing in
|
|
8
8
|
*
|
|
9
|
-
* Next:
|
|
9
|
+
* Next: ask your agent to work with one of your apps, like GitHub or
|
|
10
|
+
* Railway. You'll see each step on Work:
|
|
11
|
+
* https://passportmcp.com/#work
|
|
10
12
|
*/
|
|
11
13
|
import { EXEC_TOKEN_PAGES, EXEC_VENDOR_NAMES } from "./execVendors.js";
|
|
12
14
|
import { AGENT_NAMES } from "./initAgents.js";
|
|
@@ -17,6 +19,7 @@ import { desktopLine } from "./initLocalSteps.js";
|
|
|
17
19
|
import { TRY_IT, appLabel } from "./initState.js";
|
|
18
20
|
import { listOf } from "./initUi.js";
|
|
19
21
|
import { wrap } from "./term.js";
|
|
22
|
+
import { hashLink } from "./webLinks.js";
|
|
20
23
|
const done = (text) => ({ mark: "done", text });
|
|
21
24
|
const warn = (text) => ({ mark: "warn", text });
|
|
22
25
|
/** Apps this run connected, left waiting for a sign-in, skipped, or sent to an admin. */
|
|
@@ -113,14 +116,17 @@ function agentFollowUps(s) {
|
|
|
113
116
|
}
|
|
114
117
|
return items;
|
|
115
118
|
}
|
|
116
|
-
/** The one next
|
|
117
|
-
* agent, or
|
|
119
|
+
/** The one next step: put passport on PATH (then Work), finish app sign-ins,
|
|
120
|
+
* try an agent, or watch its work on Work, the page a new person's Get started
|
|
121
|
+
* is waiting on. A command or link is never wrapped. */
|
|
118
122
|
function nextCommand(s, waiting) {
|
|
119
123
|
const stable = s.stable;
|
|
120
124
|
if (stable?.binDir && !stable.onPath) {
|
|
121
125
|
const line = pathLine(stable.binDir, s.env, s.home, s.platform);
|
|
122
126
|
s.summary.pathLine = line;
|
|
123
|
-
|
|
127
|
+
// PATH first, then the step Get started waits for, so a first npx run still ends on Work.
|
|
128
|
+
const work = workNext(s, "Then");
|
|
129
|
+
return [...pathNext(line, s.terminal.width), ...(work.length ? ["", ...work] : [])];
|
|
124
130
|
}
|
|
125
131
|
if (waiting && !s.terminal.interactive)
|
|
126
132
|
return ["Run: passport connect --wait 300"];
|
|
@@ -130,7 +136,16 @@ function nextCommand(s, waiting) {
|
|
|
130
136
|
const ask = app ? TRY_IT[app] : "list your Passport tools";
|
|
131
137
|
return wrap(`Next: in Claude Code, run /mcp to sign in, then ask it to ${ask}.`, s.terminal.width);
|
|
132
138
|
}
|
|
133
|
-
|
|
139
|
+
const work = workNext(s, "Next:");
|
|
140
|
+
return work.length ? work : ["Run: passport status"];
|
|
141
|
+
}
|
|
142
|
+
/** "Next: ask your agent to work with an app…" and the Work link; nothing without a server to link to. */
|
|
143
|
+
function workNext(s, lead) {
|
|
144
|
+
const work = hashLink(s.gateway?.origin, "#work");
|
|
145
|
+
if (!work)
|
|
146
|
+
return [];
|
|
147
|
+
const step = `${lead} ask your agent to work with one of your apps, like GitHub or Railway. You'll see each step on Work:`;
|
|
148
|
+
return [...wrap(step, s.terminal.width), work];
|
|
134
149
|
}
|
|
135
150
|
/** What to do next about PATH: the step, then the command on its own line. */
|
|
136
151
|
export function pathNext(line, width) {
|
package/dist/pluginPin.d.ts
CHANGED
package/dist/pluginPin.js
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.30.1";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Keep in lockstep with bridge/package.json.
|
|
2
|
-
export const VERSION = "0.
|
|
2
|
+
export const VERSION = "0.30.1";
|
package/dist/webLinks.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/** `https://passportmcp.com` from an endpoint or origin, or null. */
|
|
2
2
|
export declare function webOrigin(endpointOrOrigin: string | undefined): string | null;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function taskLink(origin: string | undefined, sessionId: string | undefined): string | null;
|
|
4
|
+
/** Work's History (`view: "history"`) or Actions (`view: "actions"`), with the
|
|
5
|
+
* filters the web reads; empty values are left out. */
|
|
6
|
+
export declare function workLink(origin: string | undefined, view: "history" | "actions", filters?: Partial<Record<"project" | "since" | "env", string | undefined>>): string | null;
|
|
4
7
|
export declare function approvalLink(origin: string | undefined, approvalId: string | undefined, workspaceId?: string): string | null;
|
|
5
8
|
/** A page the server named by its hash (`#apps/railway/access`), or null. */
|
|
6
9
|
export declare function hashLink(origin: string | undefined, hash: unknown): string | null;
|
package/dist/webLinks.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Links into the Passport web app for things the CLI names: a
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Links into the Passport web app for things the CLI names: a task, an ask, a
|
|
3
|
+
* rule. The web app is served from the same origin as the profile's endpoint,
|
|
4
|
+
* and routes by hash:
|
|
5
5
|
*
|
|
6
|
-
* #
|
|
7
|
-
* #
|
|
6
|
+
* #work/<sessionId> one task
|
|
7
|
+
* #work?focus=<approvalId> one ask, opened on Work
|
|
8
|
+
* #work?view=history&project=<name> a list of tasks (workLink)
|
|
8
9
|
* #rules?rule=<ruleId>
|
|
9
10
|
*
|
|
10
11
|
* Each returns null when the origin or id is unusable, so callers print a link
|
|
@@ -26,18 +27,30 @@ export function webOrigin(endpointOrOrigin) {
|
|
|
26
27
|
function usable(id) {
|
|
27
28
|
return typeof id === "string" && ID.test(id);
|
|
28
29
|
}
|
|
29
|
-
export function
|
|
30
|
+
export function taskLink(origin, sessionId) {
|
|
30
31
|
const base = webOrigin(origin);
|
|
31
|
-
return base && usable(sessionId) ? `${base}/#
|
|
32
|
+
return base && usable(sessionId) ? `${base}/#work/${encodeURIComponent(sessionId)}` : null;
|
|
33
|
+
}
|
|
34
|
+
/** Work's History (`view: "history"`) or Actions (`view: "actions"`), with the
|
|
35
|
+
* filters the web reads; empty values are left out. */
|
|
36
|
+
export function workLink(origin, view, filters = {}) {
|
|
37
|
+
const base = webOrigin(origin);
|
|
38
|
+
if (!base)
|
|
39
|
+
return null;
|
|
40
|
+
const params = new URLSearchParams({ view });
|
|
41
|
+
for (const [key, value] of Object.entries(filters))
|
|
42
|
+
if (value)
|
|
43
|
+
params.set(key, value);
|
|
44
|
+
return `${base}/#work?${params.toString()}`;
|
|
32
45
|
}
|
|
33
46
|
export function approvalLink(origin, approvalId, workspaceId) {
|
|
34
47
|
const base = webOrigin(origin);
|
|
35
48
|
if (!base || !usable(approvalId))
|
|
36
49
|
return null;
|
|
37
|
-
const params = new URLSearchParams({
|
|
50
|
+
const params = new URLSearchParams({ focus: approvalId });
|
|
38
51
|
if (usable(workspaceId))
|
|
39
52
|
params.set("workspace", workspaceId);
|
|
40
|
-
return `${base}/#
|
|
53
|
+
return `${base}/#work?${params.toString()}`;
|
|
41
54
|
}
|
|
42
55
|
/** A page the server named by its hash (`#apps/railway/access`), or null. */
|
|
43
56
|
export function hashLink(origin, hash) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passport-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "passport-bridge",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.30.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.1"
|
|
@@ -363,15 +363,15 @@
|
|
|
363
363
|
}
|
|
364
364
|
},
|
|
365
365
|
"node_modules/@hono/node-server": {
|
|
366
|
-
"version": "2.
|
|
367
|
-
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.
|
|
368
|
-
"integrity": "sha512-
|
|
366
|
+
"version": "2.1.5",
|
|
367
|
+
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.5.tgz",
|
|
368
|
+
"integrity": "sha512-MgP/I06GdvsilDspMk/qmRzpk8LOUStP6jFAbSRi40W09DhoyUn+Mj7eyKICPqeYKybOjVFLVIAQzvu1bfIa7Q==",
|
|
369
369
|
"license": "MIT",
|
|
370
370
|
"engines": {
|
|
371
371
|
"node": ">=20"
|
|
372
372
|
},
|
|
373
373
|
"peerDependencies": {
|
|
374
|
-
"hono": "^4"
|
|
374
|
+
"hono": "^4 || ^5.0.0-0"
|
|
375
375
|
}
|
|
376
376
|
},
|
|
377
377
|
"node_modules/@modelcontextprotocol/sdk": {
|