passport-bridge 0.31.0 → 0.32.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 +1 -1
- package/dist/cliAutopilotPolicy.d.ts +2 -0
- package/dist/cliChanges.d.ts +2 -0
- package/dist/cliChanges.js +6 -2
- package/dist/cliExec.js +10 -26
- package/dist/cliGuardState.d.ts +2 -0
- package/dist/cliGuardState.js +1 -1
- package/dist/cliHook.d.ts +1 -1
- package/dist/cliHook.js +23 -22
- package/dist/cliHookAfter.d.ts +11 -3
- package/dist/cliHookAfter.js +59 -17
- package/dist/cliHookAudit.d.ts +4 -4
- package/dist/cliHookAudit.js +8 -6
- package/dist/cliHookDeliver.d.ts +9 -0
- package/dist/cliHookDeliver.js +27 -1
- package/dist/cliHookExtras.d.ts +3 -2
- package/dist/cliHookExtras.js +5 -5
- package/dist/cliHookLifecycle.d.ts +1 -1
- package/dist/cliHookLifecycle.js +7 -6
- package/dist/cliHookLinks.d.ts +45 -0
- package/dist/cliHookLinks.js +301 -0
- package/dist/cliHookLocal.d.ts +6 -0
- package/dist/cliHookLocal.js +10 -4
- package/dist/cliHookOpaque.d.ts +7 -0
- package/dist/cliHookOpaque.js +6 -0
- package/dist/cliHookProject.d.ts +2 -0
- package/dist/cliHookProject.js +14 -0
- package/dist/cliHookPushed.d.ts +18 -0
- package/dist/cliHookPushed.js +32 -0
- package/dist/cliPolicyV2.js +2 -0
- package/dist/cliSessionsJson.d.ts +4 -0
- package/dist/cliSessionsJson.js +7 -1
- package/dist/cliSessionsRender.js +6 -3
- package/dist/cliStatus.js +10 -5
- package/dist/execLinks.d.ts +66 -0
- package/dist/execLinks.js +124 -0
- package/dist/externalLinks.d.ts +51 -0
- package/dist/externalLinks.js +332 -0
- package/dist/hookFastPath.js +1 -1
- package/dist/launcherFastAnswers.d.ts +26 -0
- package/dist/launcherFastAnswers.js +44 -0
- package/dist/launcherFastPath.d.ts +1 -21
- package/dist/launcherFastPath.js +2 -39
- package/dist/localBackups.js +4 -1
- package/dist/localBackupsGate.d.ts +15 -0
- package/dist/localBackupsGate.js +24 -0
- package/dist/localGit.d.ts +7 -0
- package/dist/localGit.js +44 -16
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/signInFailure.d.ts +6 -2
- package/dist/signInFailure.js +6 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -278,7 +278,7 @@ An ask becomes one Activity row. In Claude Code, with the audit hook registered,
|
|
|
278
278
|
|
|
279
279
|
**Guard health** (`src/cliGuardHealth.ts`, states and fixes in `src/cliGuardState.ts`, a checked copy of `shared/guardContract.ts`). `passport hook status` and `passport status` show each agent's guard in the web's words, **On**, **Off**, **Outdated**, **Not trusted**, or **Locked**, and each problem's fix (on a terminal the command goes on its own `Run:` line): `passport hook install --agent <agent> --guard --apply`, `npx passport-bridge@latest init`, or `Open Codex → /hooks and trust Passport's hooks.` At most once a day (`$PASSPORT_HOME/guard/.<profile>.heartbeat`) the CLI sends `POST /api/my/guard-health` with `{cliVersion, launcherTarget?, clients: [{client, present, mode, guard, plugin, codexTrust?, locked?, disabledEnv?}]}`: flags only, never a command, path, or value. It goes from a guard run with at least 300 ms of its budget left (a hook's first one waits a day), from `passport exec`, and from `passport status`. Codex trust (`src/cliCodexTrust.ts`) compares `trusted_hash` in `~/.codex/config.toml` `[hooks.state."<hooks.json>:pre_tool_use:<group>:<handler>"]` with Codex's own hash of Passport's guard entry: SHA-256 of the sorted-key JSON of `{event_name, matcher?, hooks: [{type, command, timeout (600 when unset), async, statusMessage?, additionalContextLimit? (when not 2500)}]}`, as in openai/codex `hook_hash`/`version_for_toml`, checked against codex-cli 0.146.0's `hooks/list`. Missing is **Not trusted**, a different hash is **Not trusted** (modified), `enabled = false` is **Off**. **Locked** means managed settings hold Passport's guard: `/Library/Application Support/ClaudeCode/managed-settings.json` (and `managed-settings.d/`), `/etc/claude-code/…`, `/etc/codex/requirements.toml`, `/Library/Application Support/Cursor/hooks.json`, or `/etc/cursor/hooks.json` (`PASSPORT_MANAGED_ROOT` points tests elsewhere).
|
|
280
280
|
|
|
281
|
-
**Coverage** (`src/cliSeen.ts`). The guard counts every command it saw, per agent per day, one character per command in `$PASSPORT_HOME/seen/<profile>.<agent>.<day>.log` (an app's action, not checked, or neither), and Cursor's imported copy of Claude Code's hook doesn't count twice. Counts go in their own batches, at most every five minutes, as `seen: {batch, day, count, governed, opaque}` on `POST /api/my/cli-activity`, never inside a report that can expire. `passport status` prints `
|
|
281
|
+
**Coverage** (`src/cliSeen.ts`). The guard counts every command it saw, per agent per day, one character per command in `$PASSPORT_HOME/seen/<profile>.<agent>.<day>.log` (an app's action, not checked, or neither), and Cursor's imported copy of Claude Code's hook doesn't count twice. Counts go in their own batches, at most every five minutes, as `seen: {batch, day, count, governed, opaque}` on `POST /api/my/cli-activity`, never inside a report that can expire. `passport status` prints `Rules could decide 82% of commands Passport saw this week · 1,204 not checked` and a link to those commands on Work (from a server before the buckets: `Checked 94% of commands Passport saw this week`).
|
|
282
282
|
|
|
283
283
|
**When Passport can't be reached.** A local run, block, or attended ask stands as decided. When the guard needs Passport (an unattended ask, Codex, or a Production action someone else approves) and it doesn't answer within the budget, the environment's `offline` setting from cli-policy v2 decides: ask, block, or allow (ask everywhere by default). An ask nobody can answer (unattended, or Codex) blocks, a second-person action is always blocked, and allow never covers an irreversible action or an ask from a team floor, team or workspace rule, approver rule, or approved exception. A policy synced more than 7 days ago uses the default. The reason ends with one line saying why, such as `Nobody is here to approve it and Passport couldn't be reached, so it's blocked.`
|
|
284
284
|
|
|
@@ -162,6 +162,8 @@ export type AutopilotPolicy = {
|
|
|
162
162
|
/** The server keeps what the after-hook learns (cli-policy v2 `afterFacts`):
|
|
163
163
|
* a sign-in that failed, what a command created or removed, a retry streak. */
|
|
164
164
|
reportsAfterFacts?: boolean;
|
|
165
|
+
/** The server keeps links to what a command acted on (cli-policy v2 `links`). */
|
|
166
|
+
reportsLinks?: boolean;
|
|
165
167
|
/** "Stop retry loops" is on for this person (cli-policy v2 `retryLoops`):
|
|
166
168
|
* the guard asks before a command that failed 5 times in a row runs again. */
|
|
167
169
|
retryLoops?: boolean;
|
package/dist/cliChanges.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export type ChangeJson = {
|
|
|
48
48
|
undo: UndoJson | null;
|
|
49
49
|
/** A deploy-like change: what Passport saw in the 15 minutes after it. */
|
|
50
50
|
watch: WatchJson | null;
|
|
51
|
+
/** Where it landed in the vendor's own app: allowlisted URLs, the thing itself first. */
|
|
52
|
+
links: string[];
|
|
51
53
|
};
|
|
52
54
|
export type WatchJson = {
|
|
53
55
|
state: "watching" | "healthy" | "errors" | "unchecked";
|
package/dist/cliChanges.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { value } from "./cliArgs.js";
|
|
15
15
|
import { api, json } from "./cliMemberCall.js";
|
|
16
16
|
import { failure, timeoutMs } from "./cliSupport.js";
|
|
17
|
-
import { appName, clientName, count, list, oneOf, record, text, time, windowOf } from "./cliSessionsJson.js";
|
|
17
|
+
import { appName, clientName, count, linkUrls, 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
20
|
import { APPS_LINK, hashLink, workLink } from "./webLinks.js";
|
|
@@ -147,7 +147,8 @@ function changeOf(raw) {
|
|
|
147
147
|
? { number: pullNumber, title: pullTitle, url: pullUrl && /^https:\/\//.test(pullUrl) ? pullUrl : null }
|
|
148
148
|
: null,
|
|
149
149
|
undo: undoOf(entry.undo),
|
|
150
|
-
watch: watchOf(entry.watch)
|
|
150
|
+
watch: watchOf(entry.watch),
|
|
151
|
+
links: linkUrls(entry.links)
|
|
151
152
|
};
|
|
152
153
|
}
|
|
153
154
|
function watchOf(raw) {
|
|
@@ -264,6 +265,9 @@ export function changeParts(change, projects = false) {
|
|
|
264
265
|
const watch = watchPart(change.watch);
|
|
265
266
|
if (watch)
|
|
266
267
|
parts.push(watch);
|
|
268
|
+
// Its primary link, last: a terminal opens it.
|
|
269
|
+
if (change.links[0])
|
|
270
|
+
parts.push(change.links[0]);
|
|
267
271
|
return parts;
|
|
268
272
|
}
|
|
269
273
|
/** A change keeps its own line when it failed, was approved, or has an undo state worth seeing. */
|
package/dist/cliExec.js
CHANGED
|
@@ -186,7 +186,6 @@ export function spawnVendor(command, args, options, mask) {
|
|
|
186
186
|
});
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
const defaultSpawn = (command, args, options) => spawnVendor(command, args, options);
|
|
190
189
|
/**
|
|
191
190
|
* Masking is on when stdout isn't a terminal: an agent's shell, a pipe, a CI
|
|
192
191
|
* log, a transcript, where a printed key would be kept and read later. In a
|
|
@@ -516,8 +515,12 @@ export async function exec(args, runtime, deps = {}) {
|
|
|
516
515
|
let code;
|
|
517
516
|
const startedAt = (deps.now ?? Date.now)();
|
|
518
517
|
const needles = maskingWanted(args, runtime.env, runtime.stdout) ? secretNeedles(credential) : [];
|
|
518
|
+
// Links (bridge 0.32.0): a bounded copy of what it prints, only when that isn't a terminal.
|
|
519
|
+
const wanted = linksWanted(auth.kind === "profile" ? readCliPolicy(auth.profile) : null);
|
|
520
|
+
const capture = execCapture(wanted, runtime.stdout);
|
|
521
|
+
const piped = outputTarget(runtime, needles, capture);
|
|
519
522
|
const options = {
|
|
520
|
-
stdio:
|
|
523
|
+
stdio: piped ? ["inherit", "pipe", "pipe"] : "inherit",
|
|
521
524
|
env: childEnvironment(runtime.env, credential),
|
|
522
525
|
shell: false,
|
|
523
526
|
cwd: prepared.cwd
|
|
@@ -527,13 +530,7 @@ export async function exec(args, runtime, deps = {}) {
|
|
|
527
530
|
try {
|
|
528
531
|
code = deps.spawn
|
|
529
532
|
? await deps.spawn(prepared.executable, prepared.rest, options)
|
|
530
|
-
:
|
|
531
|
-
? await spawnVendor(prepared.executable, prepared.rest, options, {
|
|
532
|
-
needles,
|
|
533
|
-
stdout: runtime.stdout,
|
|
534
|
-
stderr: runtime.stderr
|
|
535
|
-
})
|
|
536
|
-
: await defaultSpawn(prepared.executable, prepared.rest, options);
|
|
533
|
+
: await spawnVendor(prepared.executable, prepared.rest, options, piped);
|
|
537
534
|
}
|
|
538
535
|
catch {
|
|
539
536
|
return failure(`${binary} couldn't start.`, 1, "not_installed");
|
|
@@ -542,7 +539,9 @@ export async function exec(args, runtime, deps = {}) {
|
|
|
542
539
|
await lease.stop();
|
|
543
540
|
}
|
|
544
541
|
if (typeof decided.actionId === "string") {
|
|
545
|
-
|
|
542
|
+
const durationMs = Math.max(0, Math.round((deps.now ?? Date.now)() - startedAt));
|
|
543
|
+
const links = execLinks(wanted, prepared, capture, deps.home);
|
|
544
|
+
await reportExecResult(client, { actionId: decided.actionId, exitCode: code, durationMs }, links, runtime);
|
|
546
545
|
}
|
|
547
546
|
const line = backupLine(decided, code);
|
|
548
547
|
if (line && !bool(args, "quiet"))
|
|
@@ -550,20 +549,5 @@ export async function exec(args, runtime, deps = {}) {
|
|
|
550
549
|
return { json: { exitCode: code }, silent: true, exitCode: code };
|
|
551
550
|
}
|
|
552
551
|
import { backupLine } from "./execBackupLine.js";
|
|
552
|
+
import { execCapture, execLinks, linksWanted, outputTarget, reportExecResult } from "./execLinks.js";
|
|
553
553
|
export { backupLine };
|
|
554
|
-
/** How the command ended, so its session row reads Ran or Failed. Best
|
|
555
|
-
* effort: two seconds at most, silent on failure, never the exit code. */
|
|
556
|
-
async function reportResult(client, actionId, exitCode, durationMs, runtime) {
|
|
557
|
-
try {
|
|
558
|
-
const response = await client.fetchApi(EXEC_RESULT_PATH, {
|
|
559
|
-
method: "POST",
|
|
560
|
-
headers: { "content-type": "application/json", accept: "application/json" },
|
|
561
|
-
body: JSON.stringify({ actionId, exitCode, durationMs: Math.max(0, Math.round(durationMs)) }),
|
|
562
|
-
signal: AbortSignal.any([runtime.signal, AbortSignal.timeout(2_000)])
|
|
563
|
-
});
|
|
564
|
-
await response.body?.cancel().catch(() => undefined);
|
|
565
|
-
}
|
|
566
|
-
catch {
|
|
567
|
-
/* the command already ran; its exit code is what matters */
|
|
568
|
-
}
|
|
569
|
-
}
|
package/dist/cliGuardState.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export type ProblemFix = {
|
|
|
38
38
|
link: string;
|
|
39
39
|
docs: string;
|
|
40
40
|
};
|
|
41
|
+
/** Work's Actions view, the commands Passport couldn't check. */
|
|
42
|
+
export declare const UNCHECKED_LINK = "#work?view=actions&outcome=unchecked";
|
|
41
43
|
export declare function versionBelow(version: string, minimum: string): boolean;
|
|
42
44
|
/** The state this computer can see on its own: no history (Removed) and no
|
|
43
45
|
* staleness, which only Passport knows. */
|
package/dist/cliGuardState.js
CHANGED
|
@@ -25,7 +25,7 @@ export const GUARD_MIN_CLI_VERSION = "0.16.0";
|
|
|
25
25
|
export const GUARD_HEARTBEAT_MS = 24 * 60 * 60_000;
|
|
26
26
|
export const DOCS_BASE = "https://docs.passportmcp.com";
|
|
27
27
|
/** Work's Actions view, the commands Passport couldn't check. */
|
|
28
|
-
const UNCHECKED_LINK = "#work?view=actions&outcome=unchecked";
|
|
28
|
+
export const UNCHECKED_LINK = "#work?view=actions&outcome=unchecked";
|
|
29
29
|
function versionParts(version) {
|
|
30
30
|
const [major, minor, patch] = version.split(".").map((part) => Number.parseInt(part, 10));
|
|
31
31
|
return [major || 0, minor || 0, patch || 0];
|
package/dist/cliHook.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare function safeVerb(raw: string | null): string;
|
|
|
45
45
|
* hooks by default.
|
|
46
46
|
*/
|
|
47
47
|
export declare function detectRuntime(input: HookInput, env: Env, declared?: string): HookRuntime;
|
|
48
|
-
export declare function buildReport(input: HookInput, findings: CliFinding[], env: Env, declared?: string, decided?: DecidedFinding[], local?: boolean, scripts?: ScriptReader, backedUp?: ReadonlySet<CliFinding>): CliHookReport | null
|
|
48
|
+
export declare function buildReport(input: HookInput, findings: CliFinding[], env: Env, declared?: string, decided?: DecidedFinding[], local?: boolean, scripts?: ScriptReader, backedUp?: ReadonlySet<CliFinding>): Promise<CliHookReport | null>;
|
|
49
49
|
/** What the guard answered, and for which findings. The audit row that
|
|
50
50
|
* follows a command that ran carries its outcome and any opaque parts. */
|
|
51
51
|
export declare function buildDecisionReport(input: HookInput, decision: GuardDecision, env: Env, declared?: string, local?: boolean): CliHookReport | null;
|
package/dist/cliHook.js
CHANGED
|
@@ -21,17 +21,13 @@ import { projectOf } from "./cliHookProject.js";
|
|
|
21
21
|
import { codexAskBlocked, planGuard } from "./cliHookDecide.js";
|
|
22
22
|
import { guardMachineOf } from "./cliHookGuard.js";
|
|
23
23
|
import { detectMode } from "./cliHookMode.js";
|
|
24
|
-
import { cappedHold, holdSeconds } from "./cliHookHold.js";
|
|
25
24
|
import { commandText, readInput } from "./cliHookInput.js";
|
|
26
25
|
import { pairingId, withPairing, withParked } from "./cliHookPairing.js";
|
|
27
26
|
export { pairingId } from "./cliHookPairing.js";
|
|
28
27
|
import { budgetSignal, expiredAsks, HOOK_BUDGET_MS, HOOK_RUNTIMES, leftovers, localProfile, localSelection, profileApi, queueAfterCommand, reportSender, runFlush, startFlushIfDue } from "./cliHookDeliver.js";
|
|
29
28
|
export { HOOK_BUDGET_MS, HOOK_RUNTIMES, legacyReport } from "./cliHookDeliver.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { auditBackups, auditDecision, auditedCommand, markTrashed } from "./cliHookAudit.js";
|
|
33
|
-
import { uncheckedNames } from "./cliHookUncheckedName.js";
|
|
34
|
-
import { opaqueParts } from "./cliHookOpaque.js";
|
|
29
|
+
import { guardBackups, mayBackUp } from "./localBackupsGate.js";
|
|
30
|
+
import { opaqueNames } from "./cliHookOpaque.js";
|
|
35
31
|
export { opaqueKind, opaqueProgram } from "./cliHookOpaque.js";
|
|
36
32
|
import { hasExpired, holdAsk } from "./cliHookPending.js";
|
|
37
33
|
import { readCliPolicy } from "./cliPolicy.js";
|
|
@@ -144,7 +140,7 @@ function reportable(findings, decided = [], local = false, backedUp) {
|
|
|
144
140
|
function autopilotDecision(decision) {
|
|
145
141
|
return decision?.cause ? { decision: decision.verdict } : {};
|
|
146
142
|
}
|
|
147
|
-
export function buildReport(input, findings, env, declared, decided = [], local = false, scripts, backedUp) {
|
|
143
|
+
export async function buildReport(input, findings, env, declared, decided = [], local = false, scripts, backedUp) {
|
|
148
144
|
const summary = summarize(findings);
|
|
149
145
|
const extra = scriptReport(scripts);
|
|
150
146
|
// A script that changed under a project action is worth a row of its own.
|
|
@@ -153,17 +149,19 @@ export function buildReport(input, findings, env, declared, decided = [], local
|
|
|
153
149
|
const governed = reportable(summary.governed, decided, local, backedUp);
|
|
154
150
|
if (!governed.length && !summary.opaque && !extra.projectChanged && !extra.drift)
|
|
155
151
|
return null;
|
|
156
|
-
|
|
157
|
-
const names =
|
|
152
|
+
// What couldn't be read is named only when there is some (`cliHookOpaque.ts`, `cliHookUncheckedName.ts`).
|
|
153
|
+
const { kinds, programs, names } = summary.opaque
|
|
154
|
+
? await opaqueNames(summary.unknown, MAX_OPAQUE_KINDS)
|
|
155
|
+
: { kinds: [], programs: [], names: [] };
|
|
158
156
|
const where = context(input, env, declared);
|
|
159
157
|
return {
|
|
160
158
|
...where,
|
|
161
159
|
...outcomeOfInput(input),
|
|
162
|
-
findings: markLocalBackups(governed, where),
|
|
160
|
+
findings: mayBackUp(governed) ? (await import("./localBackups.js")).markLocalBackups(governed, where) : governed,
|
|
163
161
|
opaque: summary.opaque,
|
|
164
|
-
...(
|
|
165
|
-
...(
|
|
166
|
-
...(
|
|
162
|
+
...(kinds.length ? { opaqueKinds: kinds } : {}),
|
|
163
|
+
...(programs.length ? { opaquePrograms: programs } : {}),
|
|
164
|
+
...(names.length ? { opaqueNames: names } : {}),
|
|
167
165
|
...extra
|
|
168
166
|
};
|
|
169
167
|
}
|
|
@@ -208,7 +206,7 @@ export function shellEvent(input) {
|
|
|
208
206
|
/** Only hold an ask when the audit hook will be there to claim it. */
|
|
209
207
|
async function claudeAuditRegistered(runtime) {
|
|
210
208
|
// The Passport plugin ships the audit hook alongside this guard.
|
|
211
|
-
if (hookViaPlugin(runtime.env))
|
|
209
|
+
if ((await import("./hookPlugin.js")).hookViaPlugin(runtime.env))
|
|
212
210
|
return true;
|
|
213
211
|
try {
|
|
214
212
|
const { registeredEntries } = await import("./cliHookInstall.js");
|
|
@@ -272,11 +270,13 @@ async function runAudit(args, runtime, deps) {
|
|
|
272
270
|
const profile = localProfile(args, runtime.env);
|
|
273
271
|
const policy = profile ? readCliPolicy(profile) : null;
|
|
274
272
|
const now = (deps.now ?? Date.now)();
|
|
275
|
-
const
|
|
273
|
+
const declared = value(args, "client");
|
|
274
|
+
const runtimeName = detectRuntime(input, runtime.env, declared);
|
|
276
275
|
const after = await import("./cliHookAfter.js");
|
|
277
276
|
const facts = { input, profile, policy, runtimeName, cursorImported: event.cursorImported, now };
|
|
278
277
|
const base = () => context(input, runtime.env, value(args, "client"));
|
|
279
|
-
const
|
|
278
|
+
const audit = await import("./cliHookAudit.js");
|
|
279
|
+
const audited = await audit.auditedCommand(event.command);
|
|
280
280
|
// `passport exec` records its own row; what it created or kept failing at still counts.
|
|
281
281
|
if (!audited)
|
|
282
282
|
return void (await after.afterExec({ ...facts, command: event.command, args, runtime, deps, base }));
|
|
@@ -290,17 +290,17 @@ async function runAudit(args, runtime, deps) {
|
|
|
290
290
|
saveScriptCache(scripts);
|
|
291
291
|
// v2: the same decision the guard made, so the row says why it ran.
|
|
292
292
|
const key = withPairing(context(input, runtime.env, value(args, "client")), input, event.command);
|
|
293
|
-
const { taken, backedUp } = auditBackups(findings, key, Boolean(trashed));
|
|
293
|
+
const { taken, backedUp } = await audit.auditBackups(findings, key, Boolean(trashed));
|
|
294
294
|
const guardAt = { ...guardAtFor(machine, input, runtime.env), ...taken };
|
|
295
|
-
const { decision, local, decided } = auditDecision(findings, policy, command, line.complete, guardAt);
|
|
296
|
-
let report = buildReport(input, findings, runtime.env,
|
|
295
|
+
const { decision, local, decided } = audit.auditDecision(findings, policy, command, line.complete, guardAt);
|
|
296
|
+
let report = await buildReport(input, findings, runtime.env, declared, decided, local, scripts, backedUp);
|
|
297
297
|
if (report && trashed)
|
|
298
|
-
report = markTrashed(report, trashed.key);
|
|
298
|
+
report = audit.markTrashed(report, trashed.key);
|
|
299
299
|
if (report && policy?.version === 2) {
|
|
300
300
|
report = withStep({ ...report, ...autopilotDecision(decision) }, input, policy);
|
|
301
301
|
}
|
|
302
302
|
// A sign-in that expired, what it created, a retry loop: the report, and what Claude Code reads.
|
|
303
|
-
const told = after.afterCommand({ ...facts, command, findings, report, base });
|
|
303
|
+
const told = await after.afterCommand({ ...facts, command, findings, report, base });
|
|
304
304
|
report = told.report;
|
|
305
305
|
if (told.output)
|
|
306
306
|
runtime.stdout.write(`${JSON.stringify(told.output)}\n`);
|
|
@@ -463,7 +463,7 @@ async function runGuard(args, runtime, deps) {
|
|
|
463
463
|
const client = outputClient(event, detectRuntime(input, runtime.env, declared));
|
|
464
464
|
// Which deletes will have a backup on this computer, so the rules decide knowing it.
|
|
465
465
|
const key = withPairing(context(input, runtime.env, declared), input, event.command);
|
|
466
|
-
const backups =
|
|
466
|
+
const backups = await guardBackups(event.command, line, policy, {
|
|
467
467
|
...{ ...guardAtFor(machine, input, runtime.env), machine, key },
|
|
468
468
|
rewrite: client === "claude-code" && !event.cursorImported
|
|
469
469
|
});
|
|
@@ -507,6 +507,7 @@ async function runGuard(args, runtime, deps) {
|
|
|
507
507
|
deadline: startedAt + HOOK_BUDGET_MS - PRINT_RESERVE_MS,
|
|
508
508
|
now: deps.now ?? Date.now,
|
|
509
509
|
hold: async () => {
|
|
510
|
+
const { cappedHold, holdSeconds } = await import("./cliHookHold.js");
|
|
510
511
|
const seconds = holdSeconds(value(args, "hold"), runtime.env);
|
|
511
512
|
if (seconds <= 0)
|
|
512
513
|
return 0;
|
package/dist/cliHookAfter.d.ts
CHANGED
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
* - a vendor sign-in that expired here (`signInFailure.ts`, from the last
|
|
7
7
|
* 4 KB of output, read locally and never sent);
|
|
8
8
|
* - what it created or removed that keeps running (`cliHookCreates.ts`);
|
|
9
|
-
* - how many times in a row the same command failed (`cliHookSessionState.ts`)
|
|
9
|
+
* - how many times in a row the same command failed (`cliHookSessionState.ts`);
|
|
10
|
+
* - the non-default branch a `git push` that succeeded sent (`cliHookPushed.ts`),
|
|
11
|
+
* for the session's title, to any server (an older one refuses it and the
|
|
12
|
+
* report goes again without it);
|
|
13
|
+
* - links to what it acted on in the vendor's own app (`cliHookLinks.ts`):
|
|
14
|
+
* allowlisted URLs only, to a server whose cli-policy says `links`.
|
|
10
15
|
*
|
|
11
16
|
* The report carries only the vendor, kinds, names, and counts, and only to
|
|
12
17
|
* a server that keeps them (cli-policy v2 `afterFacts`). The agent hears
|
|
@@ -20,6 +25,7 @@ import type { HookInput } from "./cliHookInput.js";
|
|
|
20
25
|
import type { CachedCliPolicy } from "./cliPolicy.js";
|
|
21
26
|
import type { Runtime } from "./cliSupport.js";
|
|
22
27
|
import { type ExecVendor } from "./execVendors.js";
|
|
28
|
+
import type { LinksMachine } from "./cliHookLinks.js";
|
|
23
29
|
/** The agent hears about a retry loop from this many failures in a row. */
|
|
24
30
|
export declare const RETRY_TELL_AT = 3;
|
|
25
31
|
/** What Claude Code reads when the sign-in expired. */
|
|
@@ -40,16 +46,18 @@ type AfterContext = {
|
|
|
40
46
|
now: number;
|
|
41
47
|
/** `passport exec` ran it with the key Passport holds: a sign-in here isn't the cause. */
|
|
42
48
|
exec?: true;
|
|
49
|
+
/** Where links are read from. Tests only; the computer's own files otherwise. */
|
|
50
|
+
linksMachine?: LinksMachine;
|
|
43
51
|
};
|
|
44
52
|
/**
|
|
45
53
|
* After a command: the report with what the hook learned, and what Claude
|
|
46
54
|
* Code should read (or null). Codex and Cursor are told by the guard on the
|
|
47
55
|
* next try, from this session's state.
|
|
48
56
|
*/
|
|
49
|
-
export declare function afterCommand(context: AfterContext): {
|
|
57
|
+
export declare function afterCommand(context: AfterContext): Promise<{
|
|
50
58
|
report: CliHookReport | null;
|
|
51
59
|
output: Record<string, unknown> | null;
|
|
52
|
-
}
|
|
60
|
+
}>;
|
|
53
61
|
/**
|
|
54
62
|
* `passport exec` records its own action, so the after-hook sends no row for
|
|
55
63
|
* it; what the command inside it created, removed, or kept failing at is
|
package/dist/cliHookAfter.js
CHANGED
|
@@ -6,23 +6,23 @@
|
|
|
6
6
|
* - a vendor sign-in that expired here (`signInFailure.ts`, from the last
|
|
7
7
|
* 4 KB of output, read locally and never sent);
|
|
8
8
|
* - what it created or removed that keeps running (`cliHookCreates.ts`);
|
|
9
|
-
* - how many times in a row the same command failed (`cliHookSessionState.ts`)
|
|
9
|
+
* - how many times in a row the same command failed (`cliHookSessionState.ts`);
|
|
10
|
+
* - the non-default branch a `git push` that succeeded sent (`cliHookPushed.ts`),
|
|
11
|
+
* for the session's title, to any server (an older one refuses it and the
|
|
12
|
+
* report goes again without it);
|
|
13
|
+
* - links to what it acted on in the vendor's own app (`cliHookLinks.ts`):
|
|
14
|
+
* allowlisted URLs only, to a server whose cli-policy says `links`.
|
|
10
15
|
*
|
|
11
16
|
* The report carries only the vendor, kinds, names, and counts, and only to
|
|
12
17
|
* a server that keeps them (cli-policy v2 `afterFacts`). The agent hears
|
|
13
18
|
* about a sign-in or a retry loop in its own words: Claude Code as
|
|
14
19
|
* `additionalContext` now; Codex and Cursor from the guard on their next try.
|
|
15
20
|
*/
|
|
16
|
-
import { resourcesOf } from "./cliHookCreates.js";
|
|
17
21
|
import { classifyLine, localMachine, workingFolder } from "./cliHookLocal.js";
|
|
18
22
|
import { execInner } from "./cliHookRewrite.js";
|
|
19
23
|
import { nextRetry, readSessionState, writeSessionState } from "./cliHookSessionState.js";
|
|
20
|
-
import { readExecVendors } from "./execMarker.js";
|
|
21
24
|
import { EXEC_VENDOR_NAMES, vendorCommand } from "./execVendors.js";
|
|
22
|
-
import { readKeysChoices } from "./keysKept.js";
|
|
23
|
-
import { outputTail, signInFailureOf } from "./signInFailure.js";
|
|
24
25
|
import { outcomeOfInput } from "./cliHookOutcome.js";
|
|
25
|
-
import { RETRY_ASK_AT } from "./cliHookStuck.js";
|
|
26
26
|
/** The agent hears about a retry loop from this many failures in a row. */
|
|
27
27
|
export const RETRY_TELL_AT = 3;
|
|
28
28
|
/** What Claude Code reads when the sign-in expired. */
|
|
@@ -41,21 +41,49 @@ export function retryContext(streak, program, asksNext) {
|
|
|
41
41
|
}
|
|
42
42
|
/** Whether Passport holds a key for this vendor (this computer's list, or the
|
|
43
43
|
* rules Passport sent), and whether the guard sends the CLI through it. */
|
|
44
|
-
function heldKey(profile, policy, vendor) {
|
|
44
|
+
async function heldKey(profile, policy, vendor) {
|
|
45
45
|
if (!profile)
|
|
46
46
|
return { held: false, rerouted: false };
|
|
47
|
+
const [{ readExecVendors }, { readKeysChoices }] = await Promise.all([
|
|
48
|
+
import("./execMarker.js"),
|
|
49
|
+
import("./keysKept.js")
|
|
50
|
+
]);
|
|
47
51
|
const marked = readExecVendors(profile).has(vendor);
|
|
48
52
|
const told = policy?.version === 2 && (policy.autopilot.heldKeys ?? []).includes(vendor);
|
|
49
53
|
return { held: marked || told, rerouted: marked && !readKeysChoices(profile).kept[vendor] };
|
|
50
54
|
}
|
|
51
|
-
|
|
55
|
+
/** Each fact's code loads only when the command could carry it: a sign-in
|
|
56
|
+
* only after a failure, resources and a pushed branch only after a success. */
|
|
57
|
+
async function learn(context, state) {
|
|
52
58
|
const { exitCode } = outcomeOfInput(context.input);
|
|
53
59
|
const failed = exitCode !== undefined && exitCode !== 0;
|
|
54
|
-
const signIn = failed && !context.exec
|
|
55
|
-
|
|
60
|
+
const signIn = failed && !context.exec
|
|
61
|
+
? await import("./signInFailure.js").then(({ outputTail, signInFailureOf }) => signInFailureOf(context.findings, outputTail(context.input), exitCode))
|
|
62
|
+
: null;
|
|
63
|
+
const resources = failed || !context.findings.length
|
|
64
|
+
? { creates: [], removes: [] }
|
|
65
|
+
: (await import("./cliHookCreates.js")).resourcesOf(context.findings);
|
|
56
66
|
const retry = nextRetry(state, context.command, exitCode, context.now);
|
|
57
67
|
const program = retry.state.retry?.program;
|
|
58
|
-
|
|
68
|
+
const pushes = context.findings.some((finding) => finding.vendor === "git" && finding.verb === "push");
|
|
69
|
+
const pushed = failed || !pushes ? undefined : (await import("./cliHookPushed.js")).pushedOf(context.findings);
|
|
70
|
+
return {
|
|
71
|
+
learned: {
|
|
72
|
+
signIn,
|
|
73
|
+
resources,
|
|
74
|
+
streak: retry.streak,
|
|
75
|
+
...(program ? { program } : {}),
|
|
76
|
+
...(pushed ? { pushed } : {})
|
|
77
|
+
},
|
|
78
|
+
state: retry.state
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** The branch a push sent, on the report (built for it when there was none). Sessions only. */
|
|
82
|
+
function withPushed(context, report, pushed) {
|
|
83
|
+
if (!pushed)
|
|
84
|
+
return report;
|
|
85
|
+
const base = report ?? { ...context.base(), findings: [], opaque: false };
|
|
86
|
+
return base.sessionId ? { ...base, pushed } : report;
|
|
59
87
|
}
|
|
60
88
|
/** The report's new facts, only for a server that keeps them. */
|
|
61
89
|
function withFacts(context, learned) {
|
|
@@ -74,17 +102,29 @@ function withFacts(context, learned) {
|
|
|
74
102
|
return context.report;
|
|
75
103
|
return { ...(context.report ?? { ...context.base(), findings: [], opaque: false }), ...facts };
|
|
76
104
|
}
|
|
105
|
+
/** Links to what the command acted on, on its own row, for a server that keeps them. */
|
|
106
|
+
async function withLinks(context, report) {
|
|
107
|
+
if (!report?.findings.length || context.exec)
|
|
108
|
+
return report;
|
|
109
|
+
if (context.policy?.version !== 2 || !context.policy.autopilot.reportsLinks)
|
|
110
|
+
return report;
|
|
111
|
+
// A `passport exec` part in the line sends its own command's links with its result.
|
|
112
|
+
const execPart = /\bpassport'?\s+'?exec\b/.test(context.command);
|
|
113
|
+
const { linksOf } = await import("./cliHookLinks.js");
|
|
114
|
+
const links = linksOf(context.findings, context.input, context.linksMachine, execPart);
|
|
115
|
+
return links.length ? { ...report, links } : report;
|
|
116
|
+
}
|
|
77
117
|
/**
|
|
78
118
|
* After a command: the report with what the hook learned, and what Claude
|
|
79
119
|
* Code should read (or null). Codex and Cursor are told by the guard on the
|
|
80
120
|
* next try, from this session's state.
|
|
81
121
|
*/
|
|
82
|
-
export function afterCommand(context) {
|
|
122
|
+
export async function afterCommand(context) {
|
|
83
123
|
const sessionId = context.report?.sessionId ?? context.base().sessionId;
|
|
84
124
|
const before = readSessionState(context.runtimeName, sessionId, context.now);
|
|
85
|
-
const { learned, state } = learn(context, before);
|
|
125
|
+
const { learned, state } = await learn(context, before);
|
|
86
126
|
const key = learned.signIn
|
|
87
|
-
? heldKey(context.profile, context.policy, learned.signIn)
|
|
127
|
+
? await heldKey(context.profile, context.policy, learned.signIn)
|
|
88
128
|
: { held: false, rerouted: false };
|
|
89
129
|
const claude = context.runtimeName === "claude-code" && !context.cursorImported;
|
|
90
130
|
const next = learned.signIn && !claude
|
|
@@ -92,14 +132,16 @@ export function afterCommand(context) {
|
|
|
92
132
|
: state;
|
|
93
133
|
if (JSON.stringify(next) !== JSON.stringify(before))
|
|
94
134
|
writeSessionState(context.runtimeName, sessionId, next);
|
|
95
|
-
const report = withFacts(context, learned);
|
|
135
|
+
const report = await withLinks(context, withPushed(context, withFacts(context, learned), learned.pushed));
|
|
96
136
|
if (!claude)
|
|
97
137
|
return { report, output: null };
|
|
98
138
|
const asksNext = context.policy?.version === 2 && context.policy.autopilot.retryLoops === true;
|
|
139
|
+
// The loop's ask threshold (`cliHookStuck.ts`) matters only once the agent is told.
|
|
140
|
+
const askAt = learned.streak >= RETRY_TELL_AT ? (await import("./cliHookStuck.js")).RETRY_ASK_AT : Infinity;
|
|
99
141
|
const lines = [
|
|
100
142
|
...(learned.signIn ? [signInContext(learned.signIn, key.held, key.rerouted && claude)] : []),
|
|
101
143
|
...(learned.streak >= RETRY_TELL_AT
|
|
102
|
-
? [retryContext(learned.streak, learned.program, asksNext && learned.streak >=
|
|
144
|
+
? [retryContext(learned.streak, learned.program, asksNext && learned.streak >= askAt)]
|
|
103
145
|
: [])
|
|
104
146
|
];
|
|
105
147
|
const event = typeof context.input.hook_event_name === "string" ? context.input.hook_event_name : "PostToolUse";
|
|
@@ -119,7 +161,7 @@ export async function afterExec(context) {
|
|
|
119
161
|
return;
|
|
120
162
|
const machine = localMachine(workingFolder(context.input), context.runtime.env);
|
|
121
163
|
const findings = classifyLine(inner, machine).findings;
|
|
122
|
-
const { report, output } = afterCommand({ ...context, command: inner, findings, report: null, exec: true });
|
|
164
|
+
const { report, output } = await afterCommand({ ...context, command: inner, findings, report: null, exec: true });
|
|
123
165
|
if (output)
|
|
124
166
|
context.runtime.stdout.write(`${JSON.stringify(output)}\n`);
|
|
125
167
|
if (!report)
|
package/dist/cliHookAudit.d.ts
CHANGED
|
@@ -16,24 +16,24 @@ export declare function isPassportExec(command: string): boolean;
|
|
|
16
16
|
* own action (`passport exec`). An rm the guard sent to its trash is recorded
|
|
17
17
|
* as the agent's own rm, with the backup's id.
|
|
18
18
|
*/
|
|
19
|
-
export declare function auditedCommand(command: string): {
|
|
19
|
+
export declare function auditedCommand(command: string): Promise<{
|
|
20
20
|
command: string;
|
|
21
21
|
trashed?: {
|
|
22
22
|
key: string;
|
|
23
23
|
};
|
|
24
|
-
} | null
|
|
24
|
+
} | null>;
|
|
25
25
|
/**
|
|
26
26
|
* What the guard backed up before this exact command (for the decision), and
|
|
27
27
|
* the findings whose row is where an Undo lives: real backups, not folders a
|
|
28
28
|
* build makes again.
|
|
29
29
|
*/
|
|
30
|
-
export declare function auditBackups(findings: CliFinding[], key: BackupKey, trashed: boolean): {
|
|
30
|
+
export declare function auditBackups(findings: CliFinding[], key: BackupKey, trashed: boolean): Promise<{
|
|
31
31
|
taken: {
|
|
32
32
|
backups: Set<CliFinding>;
|
|
33
33
|
regenerable: Set<CliFinding>;
|
|
34
34
|
};
|
|
35
35
|
backedUp: Set<CliFinding>;
|
|
36
|
-
}
|
|
36
|
+
}>;
|
|
37
37
|
/** v2: the same decision the guard made, and where each command landed even without one. */
|
|
38
38
|
export declare function auditDecision(findings: CliFinding[], policy: CachedCliPolicy | null, command: string, complete: boolean, guardAt: Parameters<typeof decideEach>[2]): {
|
|
39
39
|
decision: GuardDecision | null;
|
package/dist/cliHookAudit.js
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* and the same decision the guard made.
|
|
6
6
|
*/
|
|
7
7
|
import { decideEach, decideGuard } from "./cliHookGuard.js";
|
|
8
|
-
import {
|
|
9
|
-
import { trashedLine } from "./localTrash.js";
|
|
8
|
+
import { mayBackUp } from "./localBackupsGate.js";
|
|
10
9
|
/** `passport exec` records its own action, with its decision and credential. */
|
|
11
10
|
export function isPassportExec(command) {
|
|
12
11
|
// The guard's own rewrites: passport exec, and rm through the trash.
|
|
@@ -17,8 +16,9 @@ export function isPassportExec(command) {
|
|
|
17
16
|
* own action (`passport exec`). An rm the guard sent to its trash is recorded
|
|
18
17
|
* as the agent's own rm, with the backup's id.
|
|
19
18
|
*/
|
|
20
|
-
export function auditedCommand(command) {
|
|
21
|
-
|
|
19
|
+
export async function auditedCommand(command) {
|
|
20
|
+
// Only the trash's own line is read by `localTrash.ts`.
|
|
21
|
+
const trashed = command.includes("hook trash -- ") ? (await import("./localTrash.js")).trashedLine(command) : null;
|
|
22
22
|
if (trashed)
|
|
23
23
|
return { command: trashed.command, trashed: { key: trashed.key } };
|
|
24
24
|
return isPassportExec(command) ? null : { command };
|
|
@@ -28,8 +28,10 @@ export function auditedCommand(command) {
|
|
|
28
28
|
* the findings whose row is where an Undo lives: real backups, not folders a
|
|
29
29
|
* build makes again.
|
|
30
30
|
*/
|
|
31
|
-
export function auditBackups(findings, key, trashed) {
|
|
32
|
-
const taken =
|
|
31
|
+
export async function auditBackups(findings, key, trashed) {
|
|
32
|
+
const taken = mayBackUp(findings)
|
|
33
|
+
? (await import("./localBackups.js")).takenLocalBackups(findings, key)
|
|
34
|
+
: { backups: new Set(), regenerable: new Set() };
|
|
33
35
|
if (trashed)
|
|
34
36
|
for (const finding of findings)
|
|
35
37
|
if (finding.vendor === "rm")
|
package/dist/cliHookDeliver.d.ts
CHANGED
|
@@ -106,6 +106,15 @@ export type CliHookReport = {
|
|
|
106
106
|
};
|
|
107
107
|
/** It waited for another session's deploy lease, or didn't run because of one. Names only. */
|
|
108
108
|
lease?: LeaseNote;
|
|
109
|
+
/** A `git push` that succeeded sent this non-default branch, from a folder
|
|
110
|
+
* in this repository (`cliHookPushed.ts`). The two names only. */
|
|
111
|
+
pushed?: {
|
|
112
|
+
branch: string;
|
|
113
|
+
project?: string;
|
|
114
|
+
};
|
|
115
|
+
/** Links to what it acted on in the vendor's own app (`cliHookLinks.ts`):
|
|
116
|
+
* allowlisted URLs only, at most three, the thing itself first. */
|
|
117
|
+
links?: string[];
|
|
109
118
|
};
|
|
110
119
|
/** One governed command as reported: never its arguments. v2 adds the
|
|
111
120
|
* environment: a short name the flags gave, or a kind. */
|
package/dist/cliHookDeliver.js
CHANGED
|
@@ -90,6 +90,11 @@ function hasAutopilotFields(report) {
|
|
|
90
90
|
finding.from !== undefined ||
|
|
91
91
|
finding.projectAction !== undefined));
|
|
92
92
|
}
|
|
93
|
+
/** Whether a report still says something once a field an older server refuses is gone. */
|
|
94
|
+
function worthSending(report) {
|
|
95
|
+
const facts = report.signIn ?? report.creates ?? report.removes ?? report.retry ?? report.lease;
|
|
96
|
+
return report.findings.length > 0 || report.opaque || Boolean(report.sessionStarted || report.sessionEnded || facts);
|
|
97
|
+
}
|
|
93
98
|
async function postWith(api, initial, signal) {
|
|
94
99
|
const post = (body) => api(CLI_ACTIVITY_PATH, {
|
|
95
100
|
method: "POST",
|
|
@@ -97,9 +102,30 @@ async function postWith(api, initial, signal) {
|
|
|
97
102
|
body: JSON.stringify(body),
|
|
98
103
|
signal
|
|
99
104
|
});
|
|
105
|
+
if (initial.links === undefined)
|
|
106
|
+
return postFallbacks(post, initial);
|
|
107
|
+
// A server from before links (bridge 0.32.0) refuses the field: the rest goes again without it.
|
|
108
|
+
const response = await post(initial);
|
|
109
|
+
await response.body?.cancel().catch(() => undefined);
|
|
110
|
+
if (response.status !== 400)
|
|
111
|
+
return;
|
|
112
|
+
const { links: _links, ...rest } = initial;
|
|
113
|
+
return postFallbacks(post, rest);
|
|
114
|
+
}
|
|
115
|
+
/** One report, and again without each field an older server refuses. */
|
|
116
|
+
async function postFallbacks(post, initial) {
|
|
100
117
|
let report = initial;
|
|
101
118
|
let response = await post(report);
|
|
102
119
|
await response.body?.cancel().catch(() => undefined);
|
|
120
|
+
// A server from before pushed branches (bridge 0.31.1) refuses the field.
|
|
121
|
+
if (response.status === 400 && report.pushed !== undefined) {
|
|
122
|
+
const { pushed: _pushed, ...rest } = report;
|
|
123
|
+
report = rest;
|
|
124
|
+
if (!worthSending(report))
|
|
125
|
+
return;
|
|
126
|
+
response = await post(report);
|
|
127
|
+
await response.body?.cancel().catch(() => undefined);
|
|
128
|
+
}
|
|
103
129
|
// A server from before unchecked names and repo rules (bridge 0.31.0) refuses them.
|
|
104
130
|
if (response.status === 400 && (report.opaqueNames !== undefined || report.repoRules !== undefined)) {
|
|
105
131
|
const { opaqueNames: _names, repoRules: _rules, ...rest } = report;
|
|
@@ -345,7 +371,7 @@ export async function leftovers(queued, context) {
|
|
|
345
371
|
// can expire), and the computer's daily guard report.
|
|
346
372
|
const extras = await import("./cliHookExtras.js");
|
|
347
373
|
const seen = extras.claimSeen(profile, now);
|
|
348
|
-
const heartbeat = extras.heartbeatDue(profile, now);
|
|
374
|
+
const heartbeat = await extras.heartbeatDue(profile, now);
|
|
349
375
|
// Token numbers, read here from transcripts the hooks noted: never on a hook's path.
|
|
350
376
|
const usage = await import("./cliUsage.js");
|
|
351
377
|
const keepsUsage = context.policy?.version === 2 && context.policy.autopilot.reportsUsage === true;
|
package/dist/cliHookExtras.d.ts
CHANGED
|
@@ -21,8 +21,9 @@ sessionId?: string): Promise<void>;
|
|
|
21
21
|
export declare function claimSeen(profile: string, now: number): Claimed | null;
|
|
22
22
|
/** A batch as servers from before the buckets take it: `opaque` already is the blind count. */
|
|
23
23
|
export declare function legacySeen(seen: SeenBatch): LegacySeen;
|
|
24
|
-
/** A guard run's first report waits a day; later ones go when due.
|
|
25
|
-
|
|
24
|
+
/** A guard run's first report waits a day; later ones go when due. The
|
|
25
|
+
* report's code (`cliGuardHealth.ts`) loads only here, never on a guard's own path. */
|
|
26
|
+
export declare function heartbeatDue(profile: string, now: number): Promise<boolean>;
|
|
26
27
|
/** Send one coverage batch under its agent; it counts as sent once Passport took it. */
|
|
27
28
|
export declare function sendSeen(claimed: Claimed, post: (batch: {
|
|
28
29
|
seen: SeenBatch;
|