@tokenfactory/acc-runner 0.42.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/engines/account-probe.d.ts +24 -0
  2. package/dist/engines/account-probe.d.ts.map +1 -1
  3. package/dist/engines/account-probe.js +18 -1
  4. package/dist/engines/account-probe.js.map +1 -1
  5. package/dist/machine-capabilities/index.d.ts +21 -0
  6. package/dist/machine-capabilities/index.d.ts.map +1 -0
  7. package/dist/machine-capabilities/index.js +21 -0
  8. package/dist/machine-capabilities/index.js.map +1 -0
  9. package/dist/machine-capabilities/probe.d.ts +61 -0
  10. package/dist/machine-capabilities/probe.d.ts.map +1 -0
  11. package/dist/machine-capabilities/probe.js +243 -0
  12. package/dist/machine-capabilities/probe.js.map +1 -0
  13. package/dist/machine-capabilities/redact.d.ts +42 -0
  14. package/dist/machine-capabilities/redact.d.ts.map +1 -0
  15. package/dist/machine-capabilities/redact.js +160 -0
  16. package/dist/machine-capabilities/redact.js.map +1 -0
  17. package/dist/machine-capabilities/report.d.ts +107 -0
  18. package/dist/machine-capabilities/report.d.ts.map +1 -0
  19. package/dist/machine-capabilities/report.js +211 -0
  20. package/dist/machine-capabilities/report.js.map +1 -0
  21. package/dist/machine-capabilities/types.d.ts +115 -0
  22. package/dist/machine-capabilities/types.d.ts.map +1 -0
  23. package/dist/machine-capabilities/types.js +11 -0
  24. package/dist/machine-capabilities/types.js.map +1 -0
  25. package/dist/migration-seq-guard.d.ts +78 -0
  26. package/dist/migration-seq-guard.d.ts.map +1 -0
  27. package/dist/migration-seq-guard.js +304 -0
  28. package/dist/migration-seq-guard.js.map +1 -0
  29. package/dist/node-version.d.ts +132 -0
  30. package/dist/node-version.d.ts.map +1 -0
  31. package/dist/node-version.js +318 -0
  32. package/dist/node-version.js.map +1 -0
  33. package/dist/prepr-gate.d.ts +120 -0
  34. package/dist/prepr-gate.d.ts.map +1 -1
  35. package/dist/prepr-gate.js +202 -3
  36. package/dist/prepr-gate.js.map +1 -1
  37. package/dist/program.d.ts.map +1 -1
  38. package/dist/program.js +13 -0
  39. package/dist/program.js.map +1 -1
  40. package/dist/runtime/review-chunking.d.ts +101 -0
  41. package/dist/runtime/review-chunking.d.ts.map +1 -0
  42. package/dist/runtime/review-chunking.js +192 -0
  43. package/dist/runtime/review-chunking.js.map +1 -0
  44. package/dist/runtime/review-diff.d.ts +30 -0
  45. package/dist/runtime/review-diff.d.ts.map +1 -0
  46. package/dist/runtime/review-diff.js +59 -0
  47. package/dist/runtime/review-diff.js.map +1 -0
  48. package/dist/runtime/reviewer.d.ts +40 -19
  49. package/dist/runtime/reviewer.d.ts.map +1 -1
  50. package/dist/runtime/reviewer.js +252 -51
  51. package/dist/runtime/reviewer.js.map +1 -1
  52. package/dist/serve-scope/command.d.ts +12 -0
  53. package/dist/serve-scope/command.d.ts.map +1 -0
  54. package/dist/serve-scope/command.js +89 -0
  55. package/dist/serve-scope/command.js.map +1 -0
  56. package/dist/serve-scope/index.d.ts +130 -0
  57. package/dist/serve-scope/index.d.ts.map +1 -0
  58. package/dist/serve-scope/index.js +148 -0
  59. package/dist/serve-scope/index.js.map +1 -0
  60. package/dist/task-runner.d.ts +11 -0
  61. package/dist/task-runner.d.ts.map +1 -1
  62. package/dist/task-runner.js +69 -0
  63. package/dist/task-runner.js.map +1 -1
  64. package/dist/watch.d.ts +8 -0
  65. package/dist/watch.d.ts.map +1 -1
  66. package/dist/watch.js +28 -0
  67. package/dist/watch.js.map +1 -1
  68. package/package.json +1 -1
@@ -24,6 +24,15 @@
24
24
  * Wiring this scheduler onto the companion's identity broadcaster is a follow-up
25
25
  * (companion.ts is outside this track's file scope); this module is the engine
26
26
  * primitive that follow-up drives.
27
+ *
28
+ * AX-H1 (MACHINE-CAPABILITIES) rides this cadence rather than adding a second
29
+ * one. `onCapabilityTick` is an OPTIONAL hook called once per probe, after the
30
+ * identity is emitted, with the trigger that fired and the account key the probe
31
+ * resolved. That ordering is deliberate: the account key is what tells the
32
+ * capability reporter its engine rows just went stale, so the identity has to be
33
+ * resolved first. The hook is best-effort and awaited on the same serial chain —
34
+ * a slow or throwing hook delays the next probe rather than racing it, and can
35
+ * never fail an identity broadcast.
27
36
  */
28
37
  import type { EngineAccountIdentity } from "./types.js";
29
38
  /** Which cadence trigger fired a given probe. */
@@ -69,6 +78,21 @@ export interface AccountProbeSchedulerDeps {
69
78
  timer?: ProbeTimer;
70
79
  /** Best-effort audit/log sink for detected swaps + probe errors. */
71
80
  onLog?: (line: string) => void;
81
+ /**
82
+ * AX-H1 (MACHINE-CAPABILITIES): optional per-probe hook, called once after each
83
+ * identity emit with the same trigger and the account key that probe resolved.
84
+ * It exists so the host-capability probe REUSES this cadence instead of running
85
+ * a loop of its own — there is exactly one probe loop per host, and it is this
86
+ * one. Awaited on the serial chain, and a rejection is logged and swallowed: a
87
+ * capability report is telemetry and must never break identity broadcasting.
88
+ */
89
+ onCapabilityTick?: (args: {
90
+ trigger: AccountProbeTrigger;
91
+ accountKey: string;
92
+ identity: EngineAccountIdentity;
93
+ seq: number;
94
+ at: number;
95
+ }) => void | Promise<void>;
72
96
  }
73
97
  /**
74
98
  * Drives the four-trigger account-probe cadence. Probes are SERIALIZED onto one
@@ -1 +1 @@
1
- {"version":3,"file":"account-probe.d.ts","sourceRoot":"","sources":["../../src/engines/account-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGxD,iDAAiD;AACjD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;AAE1F,sEAAsE;AACtE,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,iDAAiD;IACjD,OAAO,EAAE,mBAAmB,CAAC;IAC7B;;;;OAIG;IACH,OAAO,EAAE,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BAAqB,CAAS;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IAEnC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,IAAI,CAAsC;IAClD,OAAO,CAAC,iBAAiB,CAA4B;IACrD,mFAAmF;IACnF,OAAO,CAAC,IAAI,CAAoC;gBAEnB,IAAI,EAAE,yBAAyB;IAQ5D,iEAAiE;IACjE,YAAY,IAAI,qBAAqB,GAAG,IAAI;IAI5C,8EAA8E;IAC9E,KAAK,IAAI,IAAI;IAOb;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAMhC;;;;OAIG;IACH,aAAa,IAAI,IAAI;IAQrB,iEAAiE;IACjE,IAAI,IAAI,IAAI;IAQZ,+DAA+D;IACzD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,eAAe;IAQvB,0EAA0E;IAC1E,OAAO,CAAC,OAAO;YAID,QAAQ;CA6CvB"}
@@ -1,4 +1,4 @@
1
- import { accountChanged } from "./account-identity.js";
1
+ import { accountChanged, accountKey } from "./account-identity.js";
2
2
  const DEFAULT_TIMER = {
3
3
  setTimer: (fn, ms) => setTimeout(fn, ms),
4
4
  clearTimer: (h) => clearTimeout(h),
@@ -129,6 +129,23 @@ export class AccountProbeScheduler {
129
129
  this.deps.onLog?.(`[acc-runner] account identity emit failed (${trigger}): ${err?.message ?? String(err)}`);
130
130
  }
131
131
  this.last = identity;
132
+ // AX-H1: the host-capability probe rides THIS tick. Runs after the emit so a
133
+ // slow capability probe can never delay a login-swap broadcast, and inside
134
+ // the same serial chain so it cannot overlap itself.
135
+ if (this.deps.onCapabilityTick) {
136
+ try {
137
+ await this.deps.onCapabilityTick({
138
+ trigger,
139
+ accountKey: accountKey(identity),
140
+ identity,
141
+ seq,
142
+ at,
143
+ });
144
+ }
145
+ catch (err) {
146
+ this.deps.onLog?.(`[acc-runner] machine-capability tick failed (${trigger}): ${err?.message ?? String(err)}`);
147
+ }
148
+ }
132
149
  }
133
150
  }
134
151
  //# sourceMappingURL=account-probe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account-probe.js","sourceRoot":"","sources":["../../src/engines/account-probe.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA+BvD,MAAM,aAAa,GAAe;IAChC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;IACxC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAkC,CAAC;CACpE,CAAC;AAqBF;;;;;;GAMG;AACH,MAAM,OAAO,qBAAqB;IAiBH;IAhBZ,WAAW,CAAS;IACpB,WAAW,CAAS;IACpB,qBAAqB,CAAS;IAC9B,GAAG,CAAe;IAClB,KAAK,CAAa;IAE3B,OAAO,GAAG,KAAK,CAAC;IAChB,OAAO,GAAG,KAAK,CAAC;IAChB,MAAM,GAAG,KAAK,CAAC;IACf,eAAe,GAAY,IAAI,CAAC;IAChC,GAAG,GAAG,CAAC,CAAC;IACR,IAAI,GAAiC,IAAI,CAAC;IAC1C,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACrD,mFAAmF;IAC3E,IAAI,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAEhD,YAA6B,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;QAC/D,IAAI,C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AAI,CAAC,KAAK,EAAE,CACf,gDAAgD,OAAO,MAAO,GAAa,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CACtG,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * AX-H1 (MACHINE-CAPABILITIES): probe and record what a machine can actually do.
3
+ * AUTH_APPROVAL_BRIEF.md §7, Phase H, gap G-17.
4
+ *
5
+ * Three modules, one rule (brief §7.1 — no credential ever transits ACC; presence
6
+ * and identity only):
7
+ *
8
+ * types.ts the CLOSED field set. Presence, identity, provenance. Nothing else.
9
+ * redact.ts the boundary: rebuild + mask every record before it leaves the host.
10
+ * probe.ts the host probe (gh / git / engine logins), read-only and bounded.
11
+ * report.ts the gate + the write, driven by somebody ELSE's cadence.
12
+ *
13
+ * The cadence is the AS-1 account probe (engines/account-probe.ts), reused rather
14
+ * than duplicated: `AccountProbeScheduler` calls the reporter on each of its four
15
+ * triggers, so this package still has exactly one probe loop on a host.
16
+ */
17
+ export { HOST_TOOLS, type EngineCapability, type HostTool, type MachineCapabilityReport, type MachineCapabilitySnapshot, type ToolCapability, } from "./types.js";
18
+ export { CREDENTIAL_SHAPES, looksLikeCredential, safeScopes, safeText, sanitizeEngine, sanitizeSnapshot, sanitizeTool, } from "./redact.js";
19
+ export { PROBE_TIMEOUT_MS, parseGhAuthStatus, parseVersion, probeMachineCapabilities, type MachineCapabilityProbeDeps, type ProbeExec, type ProbeExecResult, } from "./probe.js";
20
+ export { DEFAULT_PROBE_MIN_INTERVAL_MS, DEFAULT_REFRESH_MIN_INTERVAL_MS, MachineCapabilityReporter, recordMachineCapabilities, snapshotFingerprint, type MachineCapabilityReporterDeps, type MachineCapabilityTickOutcome, type MachineCapabilityTransport, } from "./report.js";
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/machine-capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,GAChC,MAAM,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * AX-H1 (MACHINE-CAPABILITIES): probe and record what a machine can actually do.
3
+ * AUTH_APPROVAL_BRIEF.md §7, Phase H, gap G-17.
4
+ *
5
+ * Three modules, one rule (brief §7.1 — no credential ever transits ACC; presence
6
+ * and identity only):
7
+ *
8
+ * types.ts the CLOSED field set. Presence, identity, provenance. Nothing else.
9
+ * redact.ts the boundary: rebuild + mask every record before it leaves the host.
10
+ * probe.ts the host probe (gh / git / engine logins), read-only and bounded.
11
+ * report.ts the gate + the write, driven by somebody ELSE's cadence.
12
+ *
13
+ * The cadence is the AS-1 account probe (engines/account-probe.ts), reused rather
14
+ * than duplicated: `AccountProbeScheduler` calls the reporter on each of its four
15
+ * triggers, so this package still has exactly one probe loop on a host.
16
+ */
17
+ export { HOST_TOOLS, } from "./types.js";
18
+ export { CREDENTIAL_SHAPES, looksLikeCredential, safeScopes, safeText, sanitizeEngine, sanitizeSnapshot, sanitizeTool, } from "./redact.js";
19
+ export { PROBE_TIMEOUT_MS, parseGhAuthStatus, parseVersion, probeMachineCapabilities, } from "./probe.js";
20
+ export { DEFAULT_PROBE_MIN_INTERVAL_MS, DEFAULT_REFRESH_MIN_INTERVAL_MS, MachineCapabilityReporter, recordMachineCapabilities, snapshotFingerprint, } from "./report.js";
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/machine-capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,UAAU,GAMX,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,GAIzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,GAIpB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { type MachineCapabilitySnapshot } from "./types.js";
2
+ /** One command invocation captured without throwing. */
3
+ export interface ProbeExecResult {
4
+ stdout: string;
5
+ stderr: string;
6
+ exitCode: number | null;
7
+ }
8
+ /** The single I/O seam: run `bin args` and report what happened. Never throws. */
9
+ export type ProbeExec = (bin: string, args: string[]) => Promise<ProbeExecResult>;
10
+ /** Per-probe timeout. A capability probe must never hold up a cadence tick. */
11
+ export declare const PROBE_TIMEOUT_MS = 5000;
12
+ export interface MachineCapabilityProbeDeps {
13
+ /** Command runner (test seam). Defaults to a bounded, non-throwing execa. */
14
+ exec?: ProbeExec;
15
+ /** Host name (test seam). Defaults to os.hostname(). */
16
+ hostname?: () => string;
17
+ /** Engine ids to probe (test seam). Defaults to the chat-engine registry. */
18
+ engineIds?: () => string[];
19
+ /** Reported runner version (test seam). Defaults to the package version. */
20
+ runnerVersion?: string;
21
+ /** platform/arch (test seam). Default to process values. */
22
+ platform?: string;
23
+ arch?: string;
24
+ }
25
+ /**
26
+ * Extract the first dotted version triple from a `--version` line. Tolerant on
27
+ * purpose: `gh version 2.62.0 (2024-11-08)`, `git version 2.46.0`,
28
+ * `1.0.30 (Claude Code)` and a bare `2.4` all resolve; anything else is null
29
+ * rather than a guess (an invented version would make an "is this old enough?"
30
+ * question answerable and wrong).
31
+ */
32
+ export declare function parseVersion(output: string): string | null;
33
+ /**
34
+ * Parse `gh auth status` output. gh prints a human block per host:
35
+ *
36
+ * github.com
37
+ * ✓ Logged in to github.com account gaurav (keyring)
38
+ * - Active account: true
39
+ * - Git operations protocol: https
40
+ * - Token: gho_************************************
41
+ * - Token scopes: 'gist', 'read:org', 'repo'
42
+ *
43
+ * The `Token:` line is already elided by gh, and we do not read it either way —
44
+ * only the account, the host, and the scope labels. Tolerant of the older
45
+ * `Logged in to github.com as gaurav (…)` spelling, and of `--json`-less GHES
46
+ * output where the host is the bare first line.
47
+ */
48
+ export declare function parseGhAuthStatus(output: string): {
49
+ account: string | null;
50
+ host: string | null;
51
+ scopes: string[];
52
+ };
53
+ /**
54
+ * Probe the whole host. Never throws and never rejects: a probe that fails is
55
+ * reported as an absent tool, because "we could not tell" and "it is not there"
56
+ * are both answers a user can act on, whereas an exception on a cadence tick is
57
+ * not. The result is passed through `sanitizeSnapshot` before it is returned, so
58
+ * a caller cannot obtain an unredacted snapshot from this module at all.
59
+ */
60
+ export declare function probeMachineCapabilities(deps?: MachineCapabilityProbeDeps): Promise<MachineCapabilitySnapshot>;
61
+ //# sourceMappingURL=probe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../src/machine-capabilities/probe.ts"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,yBAAyB,EAE/B,MAAM,YAAY,CAAC;AAEpB,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAElF,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,OAAQ,CAAC;AAqBtC,MAAM,WAAW,0BAA0B;IACzC,6EAA6E;IAC7E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACxB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;IAC3B,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG1D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IACjD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAaA;AAkID;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,GAAE,0BAA+B,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAiBpC"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * AX-H1 (MACHINE-CAPABILITIES): the host probe. Answers "what does THIS machine
3
+ * actually offer?" — gh, git, and each registered engine's login — so ACC can
4
+ * tell a user what their own machine can do instead of leaving that in the
5
+ * operator's head.
6
+ *
7
+ * WHAT IT READS, AND WHAT IT REFUSES TO READ. Every probe here is a read-only,
8
+ * short-timeout, local invocation of a tool's own status command:
9
+ *
10
+ * gh `gh --version`, `gh auth status` — presence, version, whether the
11
+ * credential works, the account login, the host, and the token's SCOPE
12
+ * LABELS. `--show-token` is NEVER passed: the scopes are the authority,
13
+ * and the authority is the answerable question ("can this machine open a
14
+ * PR?"). The token is not read, so it cannot be sent. The unit suite
15
+ * asserts no argv in this package contains `--show-token`.
16
+ * git `git --version`, `git config --get user.email` — presence, version and
17
+ * the committing identity. Git has no host-level login of its own, so
18
+ * `authenticated` is false and the credential-health question is answered
19
+ * by the separate GIT-AUTH-ALERT `ls-remote` probe (git-auth/probe.ts),
20
+ * which is where a remote round-trip belongs.
21
+ * engines the AS-1 `accountIdentity()` surface plus a `--version` presence
22
+ * check. NOT a second credential probe: the identity is exactly what the
23
+ * AS-1 cadence already computes, so the engine rows are a projection of
24
+ * a fact this process already has.
25
+ *
26
+ * Nothing here reads a keychain, a token file, or an environment variable's
27
+ * VALUE. Every free-text field goes through redact.ts before it leaves the host.
28
+ *
29
+ * FULLY injectable (exec / hostname / engines / version) so the whole probe is
30
+ * exercised with zero real subprocesses.
31
+ */
32
+ import { execa } from "execa";
33
+ import os from "node:os";
34
+ import { buildEnv } from "../bin-resolve.js";
35
+ import { chatEngineIds, getChatEngine } from "../engines/registry.js";
36
+ import { unknownAccountIdentity } from "../engines/account-identity.js";
37
+ import { PACKAGE_VERSION } from "../pkg-version.js";
38
+ import { sanitizeSnapshot } from "./redact.js";
39
+ import { HOST_TOOLS, } from "./types.js";
40
+ /** Per-probe timeout. A capability probe must never hold up a cadence tick. */
41
+ export const PROBE_TIMEOUT_MS = 5_000;
42
+ const defaultExec = async (bin, args) => {
43
+ try {
44
+ const res = await execa(bin, args, {
45
+ env: buildEnv(),
46
+ timeout: PROBE_TIMEOUT_MS,
47
+ reject: false,
48
+ });
49
+ return {
50
+ stdout: res.stdout ?? "",
51
+ stderr: res.stderr ?? "",
52
+ exitCode: res.exitCode ?? null,
53
+ };
54
+ }
55
+ catch (err) {
56
+ // A missing binary throws ENOENT rather than exiting non-zero. That is
57
+ // "absent", not "broken", and it is reported as such.
58
+ return { stdout: "", stderr: err?.message ?? "spawn failed", exitCode: null };
59
+ }
60
+ };
61
+ /**
62
+ * Extract the first dotted version triple from a `--version` line. Tolerant on
63
+ * purpose: `gh version 2.62.0 (2024-11-08)`, `git version 2.46.0`,
64
+ * `1.0.30 (Claude Code)` and a bare `2.4` all resolve; anything else is null
65
+ * rather than a guess (an invented version would make an "is this old enough?"
66
+ * question answerable and wrong).
67
+ */
68
+ export function parseVersion(output) {
69
+ const m = /\b(\d+(?:\.\d+){1,3})\b/.exec(output ?? "");
70
+ return m ? m[1] : null;
71
+ }
72
+ /**
73
+ * Parse `gh auth status` output. gh prints a human block per host:
74
+ *
75
+ * github.com
76
+ * ✓ Logged in to github.com account gaurav (keyring)
77
+ * - Active account: true
78
+ * - Git operations protocol: https
79
+ * - Token: gho_************************************
80
+ * - Token scopes: 'gist', 'read:org', 'repo'
81
+ *
82
+ * The `Token:` line is already elided by gh, and we do not read it either way —
83
+ * only the account, the host, and the scope labels. Tolerant of the older
84
+ * `Logged in to github.com as gaurav (…)` spelling, and of `--json`-less GHES
85
+ * output where the host is the bare first line.
86
+ */
87
+ export function parseGhAuthStatus(output) {
88
+ const text = output ?? "";
89
+ const account = /Logged in to \S+ account ([A-Za-z0-9._-]+)/.exec(text)?.[1] ??
90
+ /Logged in to \S+ as ([A-Za-z0-9._-]+)/.exec(text)?.[1] ??
91
+ null;
92
+ const host = /Logged in to (\S+?)(?: account| as)\b/.exec(text)?.[1] ?? null;
93
+ const scopeLine = /Token scopes:\s*(.+)/.exec(text)?.[1] ?? "";
94
+ const scopes = scopeLine
95
+ .split(",")
96
+ .map((s) => s.trim().replace(/^['"]|['"]$/g, ""))
97
+ .filter((s) => s.length > 0 && s !== "none");
98
+ return { account, host, scopes };
99
+ }
100
+ /** Probe `gh`: presence, version, whether it authenticates, and as whom. */
101
+ async function probeGh(exec) {
102
+ const ver = await exec("gh", ["--version"]);
103
+ const present = ver.exitCode === 0;
104
+ const version = present ? parseVersion(ver.stdout) : null;
105
+ if (!present) {
106
+ return {
107
+ tool: "gh",
108
+ present: false,
109
+ version: null,
110
+ authenticated: false,
111
+ identity: null,
112
+ host: null,
113
+ scopes: [],
114
+ detail: "gh not installed (or not on PATH)",
115
+ };
116
+ }
117
+ // `gh auth status` is a LOCAL token check, not a GitHub API call (see gh.ts),
118
+ // so it is unbudgeted and safe to run on every capability probe.
119
+ const status = await exec("gh", ["auth", "status"]);
120
+ const authenticated = status.exitCode === 0;
121
+ // gh has printed the status block on stdout since 2.x and on stderr before
122
+ // that; read both so an older install still resolves an identity.
123
+ const { account, host, scopes } = parseGhAuthStatus(`${status.stdout}\n${status.stderr}`);
124
+ return {
125
+ tool: "gh",
126
+ present: true,
127
+ version,
128
+ authenticated,
129
+ identity: authenticated ? account : null,
130
+ host: authenticated ? host : null,
131
+ scopes: authenticated ? scopes : [],
132
+ detail: authenticated
133
+ ? `gh ${version ?? "?"} authenticated${account ? ` as ${account}` : ""}${host ? ` on ${host}` : ""}`
134
+ : `gh ${version ?? "?"} installed but not authenticated (run \`gh auth login\`)`,
135
+ };
136
+ }
137
+ /** Probe `git`: presence, version and the committing identity. */
138
+ async function probeGit(exec) {
139
+ const ver = await exec("git", ["--version"]);
140
+ const present = ver.exitCode === 0;
141
+ if (!present) {
142
+ return {
143
+ tool: "git",
144
+ present: false,
145
+ version: null,
146
+ authenticated: false,
147
+ identity: null,
148
+ host: null,
149
+ scopes: [],
150
+ detail: "git not installed (or not on PATH)",
151
+ };
152
+ }
153
+ const version = parseVersion(ver.stdout);
154
+ const email = await exec("git", ["config", "--get", "user.email"]);
155
+ const identity = email.exitCode === 0 ? email.stdout.trim() || null : null;
156
+ return {
157
+ tool: "git",
158
+ present: true,
159
+ version,
160
+ // git holds no host login of its own; remote credential health is the
161
+ // GIT-AUTH-ALERT ls-remote probe's job, and duplicating it here would mean
162
+ // a second remote round trip on every cadence tick.
163
+ authenticated: false,
164
+ identity,
165
+ host: null,
166
+ scopes: [],
167
+ detail: identity
168
+ ? `git ${version ?? "?"} committing as ${identity}`
169
+ : `git ${version ?? "?"} (no user.email configured)`,
170
+ };
171
+ }
172
+ /**
173
+ * Probe one engine: is the binary there, and who is it logged in as? The identity
174
+ * comes from the AS-1 `accountIdentity()` surface — this is a PROJECTION of the
175
+ * probe the cadence already runs, not a second credential probe. An engine that
176
+ * predates AS-1 degrades to the honest unknown-account identity rather than being
177
+ * reported as logged out.
178
+ */
179
+ async function probeEngine(engineId, exec) {
180
+ let binary = engineId;
181
+ let channel = "none";
182
+ let identity = unknownAccountIdentity({
183
+ engineId,
184
+ channel: "none",
185
+ detail: `engine ${engineId} is not registered in this runner build`,
186
+ });
187
+ try {
188
+ const engine = getChatEngine(engineId);
189
+ binary = engine.binary;
190
+ channel = engine.authMode;
191
+ identity = engine.accountIdentity
192
+ ? await engine.accountIdentity()
193
+ : unknownAccountIdentity({
194
+ engineId: engine.id,
195
+ channel: engine.authMode,
196
+ detail: "no account-identity probe on this engine build",
197
+ });
198
+ }
199
+ catch {
200
+ // An unknown / unresolvable engine id is reported as absent, never thrown:
201
+ // one bad engine must not cost the whole snapshot.
202
+ }
203
+ const ver = await exec(binary, ["--version"]);
204
+ const present = ver.exitCode === 0;
205
+ return {
206
+ engine_id: engineId,
207
+ present,
208
+ version: present ? parseVersion(ver.stdout) : null,
209
+ // "Logged in" means a REAL named account resolved. The AS-1 honest-unknown
210
+ // identity always carries a synthetic account, so presence of that id is not
211
+ // evidence of a login — the email is.
212
+ logged_in: identity.account_email !== null,
213
+ channel: identity.channel ?? channel,
214
+ account_email: identity.account_email,
215
+ plan_hint: identity.plan_hint,
216
+ synthetic_account: identity.synthetic_account,
217
+ detail: present
218
+ ? identity.detail
219
+ : `${engineId} not installed (or not on PATH); ${identity.detail}`,
220
+ };
221
+ }
222
+ /**
223
+ * Probe the whole host. Never throws and never rejects: a probe that fails is
224
+ * reported as an absent tool, because "we could not tell" and "it is not there"
225
+ * are both answers a user can act on, whereas an exception on a cadence tick is
226
+ * not. The result is passed through `sanitizeSnapshot` before it is returned, so
227
+ * a caller cannot obtain an unredacted snapshot from this module at all.
228
+ */
229
+ export async function probeMachineCapabilities(deps = {}) {
230
+ const exec = deps.exec ?? defaultExec;
231
+ const engineIds = (deps.engineIds ?? chatEngineIds)();
232
+ const tools = await Promise.all(HOST_TOOLS.map((tool) => (tool === "gh" ? probeGh(exec) : probeGit(exec))));
233
+ const engines = await Promise.all(engineIds.map((id) => probeEngine(id, exec)));
234
+ return sanitizeSnapshot({
235
+ machine: (deps.hostname ?? (() => os.hostname()))() || "unknown-host",
236
+ platform: deps.platform ?? process.platform,
237
+ arch: deps.arch ?? process.arch,
238
+ runner_version: deps.runnerVersion ?? PACKAGE_VERSION,
239
+ tools,
240
+ engines,
241
+ });
242
+ }
243
+ //# sourceMappingURL=probe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src/machine-capabilities/probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,UAAU,GAIX,MAAM,YAAY,CAAC;AAYpB,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,KA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AAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAC3E,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhF,OAAO,gBAAgB,CAAC;QACtB,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,cAAc;QACrE,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ;QAC3C,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;QAC/B,cAAc,EAAE,IAAI,CAAC,aAAa,IAAI,eAAe;QACrD,KAAK;QACL,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type EngineCapability, type MachineCapabilitySnapshot, type ToolCapability } from "./types.js";
2
+ /**
3
+ * Credential SHAPES a developer machine actually holds, plus the two generic
4
+ * carriers. Mirrors the regexes in `acc.machine_capability_material_free`
5
+ * (0310 §2); `tests/unit/t1785160000000035-machine-capabilities.test.ts` asserts
6
+ * the mirror by running the same vectors through both spellings.
7
+ */
8
+ export declare const CREDENTIAL_SHAPES: readonly RegExp[];
9
+ /** True when `value` contains anything shaped like a credential. */
10
+ export declare function looksLikeCredential(value: string | null | undefined): boolean;
11
+ /**
12
+ * Mask + bound one free-text field. Applies `maskGitCredentials` first (the
13
+ * GIT-AUTH-ALERT masker, so URL userinfo and bare gh tokens are rewritten rather
14
+ * than dropped), then DROPS the value entirely if a credential shape survived —
15
+ * an unmaskable value is not worth a field. Length-bounded so a whitelisted
16
+ * field cannot become the smuggling channel.
17
+ */
18
+ export declare function safeText(value: string | null | undefined, maxLength: number): string | null;
19
+ /**
20
+ * Bound, dedupe and sort gh scope labels. Sorted so two snapshots of the same
21
+ * machine compare equal regardless of the order gh printed them, which is what
22
+ * makes the "did anything change?" fingerprint in report.ts stable. A label that
23
+ * looks like a credential is dropped rather than masked — a scope label is a
24
+ * short well-known word, so an unmaskable one is not a scope.
25
+ */
26
+ export declare function safeScopes(scopes: readonly string[] | null | undefined): string[];
27
+ /** Rebuild one tool row from the closed field set. */
28
+ export declare function sanitizeTool(tool: ToolCapability): ToolCapability;
29
+ /** Rebuild one engine row from the closed field set. */
30
+ export declare function sanitizeEngine(engine: EngineCapability): EngineCapability;
31
+ /**
32
+ * Rebuild a whole snapshot. The ONLY function the reporter is allowed to send
33
+ * the output of — `recordMachineCapabilities` calls it unconditionally, even on a
34
+ * snapshot this package built itself, because the point is that no future probe
35
+ * can add a field that bypasses it.
36
+ *
37
+ * Rows for tools outside `HOST_TOOLS` and engines with a blank id are dropped:
38
+ * the server-side whitelist would drop them anyway, and sending them would make
39
+ * the local snapshot disagree with the recorded one.
40
+ */
41
+ export declare function sanitizeSnapshot(snapshot: MachineCapabilitySnapshot): MachineCapabilitySnapshot;
42
+ //# sourceMappingURL=redact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/machine-capabilities/redact.ts"],"names":[],"mappings":"AA6BA,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAkB9C,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAG7E;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAMf;AAOD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAWjF;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,CAWjE;AAED,wDAAwD;AACxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAYzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,yBAAyB,GAClC,yBAAyB,CAgB3B"}