@boyingliu01/dsh-plugin-xp-gate 0.31.3 → 0.32.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 (52) hide show
  1. package/lib/command.d.ts +11 -5
  2. package/lib/command.d.ts.map +1 -1
  3. package/lib/command.js +19 -13
  4. package/lib/command.js.map +1 -1
  5. package/lib/credentials.d.ts +39 -0
  6. package/lib/credentials.d.ts.map +1 -0
  7. package/lib/credentials.js +57 -0
  8. package/lib/credentials.js.map +1 -0
  9. package/lib/delphi-config.d.ts +34 -3
  10. package/lib/delphi-config.d.ts.map +1 -1
  11. package/lib/delphi-config.js +117 -48
  12. package/lib/delphi-config.js.map +1 -1
  13. package/lib/delphi-run.d.ts +1 -1
  14. package/lib/delphi-run.d.ts.map +1 -1
  15. package/lib/delphi-run.js +24 -3
  16. package/lib/delphi-run.js.map +1 -1
  17. package/lib/delphi.d.ts +6 -0
  18. package/lib/delphi.d.ts.map +1 -1
  19. package/lib/delphi.js +101 -55
  20. package/lib/delphi.js.map +1 -1
  21. package/lib/evidence.d.ts +70 -0
  22. package/lib/evidence.d.ts.map +1 -0
  23. package/lib/evidence.js +92 -0
  24. package/lib/evidence.js.map +1 -0
  25. package/lib/gate-runner.d.ts +33 -2
  26. package/lib/gate-runner.d.ts.map +1 -1
  27. package/lib/gate-runner.js +53 -4
  28. package/lib/gate-runner.js.map +1 -1
  29. package/lib/git-context.d.ts +26 -0
  30. package/lib/git-context.d.ts.map +1 -0
  31. package/lib/git-context.js +30 -0
  32. package/lib/git-context.js.map +1 -0
  33. package/lib/hooks.d.ts +42 -0
  34. package/lib/hooks.d.ts.map +1 -0
  35. package/lib/hooks.js +113 -0
  36. package/lib/hooks.js.map +1 -0
  37. package/lib/index.d.ts +16 -1
  38. package/lib/index.d.ts.map +1 -1
  39. package/lib/index.js +278 -10
  40. package/lib/index.js.map +1 -1
  41. package/lib/skill-provider.d.ts +15 -0
  42. package/lib/skill-provider.d.ts.map +1 -0
  43. package/lib/skill-provider.js +205 -0
  44. package/lib/skill-provider.js.map +1 -0
  45. package/lib/sprint.d.ts +60 -0
  46. package/lib/sprint.d.ts.map +1 -0
  47. package/lib/sprint.js +92 -0
  48. package/lib/sprint.js.map +1 -0
  49. package/package.json +14 -8
  50. package/skills/delphi-review/AGENTS.md +3 -3
  51. package/skills/sprint-flow/AGENTS.md +3 -3
  52. package/skills/test-specification-alignment/AGENTS.md +3 -3
package/lib/command.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { type ShellDialect } from "./dialect.js";
2
2
  export { type ShellDialect, detectDialect, shellQuote, shq } from "./dialect.js";
3
- /** Shown when the global `xp-gate` CLI is not on PATH. */
4
- export declare const FALLBACK_MESSAGE = "[XP-Gate] xp-gate CLI not installed. Install it with: npm install -g @boyingliu01/xp-gate";
5
3
  /**
6
4
  * Allowlist of xp-gate gate aliases that are safe to invoke standalone
7
5
  * (non-preCommitOnly gates + common aliases). Anything outside this set is
@@ -22,9 +20,17 @@ export interface BuildCommandOptions {
22
20
  dialect?: ShellDialect;
23
21
  }
24
22
  /**
25
- * Build a single guarded shell command: runs `xp-gate …` when the global CLI
26
- * is present, otherwise prints the graceful-degradation hint. A single
27
- * presence check avoids a separate probe/run race.
23
+ * Build a single unconditional shell command.
24
+ *
25
+ * There is deliberately no presence probe. An earlier version wrapped the call
26
+ * in `if command -v xp-gate …; then …; else print hint; fi`, which left the exit
27
+ * code at 0 on the else branch — so a CLI that resolved but then failed produced
28
+ * empty stdout with exit 0, and the model read that as a pass.
29
+ *
30
+ * Running unconditionally turns "not installed" into an ordinary command-not-found
31
+ * (nonzero exit, empty output), which renderGateResult classifies as
32
+ * INDETERMINATE and pairs with an install hint. It also removes the branch that
33
+ * could not distinguish "absent" from "present but broken".
28
34
  */
29
35
  export declare function buildCommand(options: BuildCommandOptions): string;
30
36
  /** Resolve a model-supplied path against the session cwd; absolutes pass through. */
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,cAAc,CAAA;AAI5D,OAAO,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEhF,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,8FACgE,CAAA;AAE7F;;;;GAIG;AACH,eAAO,MAAM,cAAc,uGASjB,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,GAAG,YAAY,GAAG,MAAM,CAAA;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AA+BD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAmBjE;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAElE"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,cAAc,CAAA;AAI5D,OAAO,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEhF;;;;GAIG;AACH,eAAO,MAAM,cAAc,uGASjB,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,GAAG,YAAY,GAAG,MAAM,CAAA;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AA+BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAajE;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAElE"}
package/lib/command.js CHANGED
@@ -3,8 +3,6 @@ import { shellQuote } from "./dialect.js";
3
3
  // Re-exported so existing importers of this module keep working; the dialect
4
4
  // primitives themselves live in ./dialect.ts.
5
5
  export { detectDialect, shellQuote, shq } from "./dialect.js";
6
- /** Shown when the global `xp-gate` CLI is not on PATH. */
7
- export const FALLBACK_MESSAGE = "[XP-Gate] xp-gate CLI not installed. Install it with: npm install -g @boyingliu01/xp-gate";
8
6
  /**
9
7
  * Allowlist of xp-gate gate aliases that are safe to invoke standalone
10
8
  * (non-preCommitOnly gates + common aliases). Anything outside this set is
@@ -56,23 +54,31 @@ function buildInner(options, dialect) {
56
54
  return tokens.join(" ");
57
55
  }
58
56
  /**
59
- * Build a single guarded shell command: runs `xp-gate …` when the global CLI
60
- * is present, otherwise prints the graceful-degradation hint. A single
61
- * presence check avoids a separate probe/run race.
57
+ * Build a single unconditional shell command.
58
+ *
59
+ * There is deliberately no presence probe. An earlier version wrapped the call
60
+ * in `if command -v xp-gate …; then …; else print hint; fi`, which left the exit
61
+ * code at 0 on the else branch — so a CLI that resolved but then failed produced
62
+ * empty stdout with exit 0, and the model read that as a pass.
63
+ *
64
+ * Running unconditionally turns "not installed" into an ordinary command-not-found
65
+ * (nonzero exit, empty output), which renderGateResult classifies as
66
+ * INDETERMINATE and pairs with an install hint. It also removes the branch that
67
+ * could not distinguish "absent" from "present but broken".
62
68
  */
63
69
  export function buildCommand(options) {
64
70
  const dialect = options.dialect ?? "posix";
65
71
  const inner = buildInner(options, dialect);
66
72
  if (dialect === "posix") {
67
- return `if command -v xp-gate >/dev/null 2>&1; then ${inner}; else printf '%s\\n' ${shellQuote(FALLBACK_MESSAGE, dialect)}; fi`;
73
+ // Merge stderr into stdout so a failure that only writes to stderr still
74
+ // reaches the renderer, then echo the status so the exit code survives the
75
+ // pipeline.
76
+ return `${inner} 2>&1; printf '\\n[XP-Gate] exit:%s\\n' "$?"`;
68
77
  }
69
- // PowerShell: `Get-Command` resolves the .cmd/.ps1 shims npm writes to
70
- // %APPDATA%\npm. Those shims are invisible to a Git-Bash PATH lookup, so this
71
- // branch is more reliable than `command -v` on Windows.
72
- //
73
- // The hint branch leaves $LASTEXITCODE untouched at 0, matching the POSIX
74
- // branch's `printf` behaviour.
75
- return `if (Get-Command xp-gate -ErrorAction SilentlyContinue) { ${inner} } else { Write-Output ${shellQuote(FALLBACK_MESSAGE, dialect)} }`;
78
+ // PowerShell: merge streams and report $LASTEXITCODE explicitly. The
79
+ // .cmd/.ps1 shims npm writes under %APPDATA%\npm are visible here but not to a
80
+ // Git-Bash PATH lookup, which is why Windows uses this dialect.
81
+ return `${inner} 2>&1; Write-Output "[XP-Gate] exit:$LASTEXITCODE"`;
76
82
  }
77
83
  /** Resolve a model-supplied path against the session cwd; absolutes pass through. */
78
84
  export function resolveTarget(rawPath, cwd) {
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAqB,UAAU,EAAE,MAAM,cAAc,CAAA;AAE5D,6EAA6E;AAC7E,8CAA8C;AAC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ACxD,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAC9D,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Resolve the API key that a Delphi provider config points at, without assuming the
3
+ * value is in this process's environment.
4
+ *
5
+ * The credential service shipped with DSH layers environment, a provider-managed
6
+ * store, and `.env` files behind one `CredentialRef`. That is exactly the order the
7
+ * plugin needs: on the machine that prompted this work the key lived in a user-level
8
+ * environment variable and in `~/.dsh/.credentials.yaml`, while DSH's own process
9
+ * inherited neither — so `delphi-review` failed with a missing-variable error while
10
+ * every other gate worked.
11
+ *
12
+ * Resolution is deliberately single-layer. When `ctx.credentials` is present and
13
+ * reports `undefined`, this module does NOT fall back to `process.env`: the service
14
+ * has already consulted the environment, so a second look would resurrect a value it
15
+ * deliberately reported as absent and would make a DSH session resolve differently
16
+ * from a terminal session.
17
+ */
18
+ /** A credential service, narrowed to the one method this module needs. */
19
+ export interface CredentialService {
20
+ resolve(ref: unknown): Promise<{
21
+ value: string;
22
+ } | undefined>;
23
+ }
24
+ /** Resolve one environment-variable-style reference to its current value. */
25
+ export type ApiKeyResolver = (ref: string) => Promise<string | undefined>;
26
+ /**
27
+ * Build an `ApiKeyResolver` over the available credential service.
28
+ *
29
+ * @param credentials - `ctx.credentials`, or undefined when the host does not offer
30
+ * one. Absence degrades to reading the process environment directly, which keeps
31
+ * the plugin working outside DSH (CLI use, tests).
32
+ * @param env - environment to read in that fallback. Injected rather than read from
33
+ * the global so the module stays testable offline.
34
+ * @param brand - converts a raw name into the service's nominal `CredentialRef`.
35
+ * Injected so this module needs no import of the peer package and tests can pass
36
+ * an identity function.
37
+ */
38
+ export declare function createCredentialResolver(credentials: CredentialService | undefined, env: NodeJS.ProcessEnv, brand?: (value: string) => unknown): ApiKeyResolver;
39
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAA;CAC9D;AAED,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;AAYzE;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,iBAAiB,GAAG,SAAS,EAC1C,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,KAAK,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAA0B,GACnD,cAAc,CAkBhB"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Resolve the API key that a Delphi provider config points at, without assuming the
3
+ * value is in this process's environment.
4
+ *
5
+ * The credential service shipped with DSH layers environment, a provider-managed
6
+ * store, and `.env` files behind one `CredentialRef`. That is exactly the order the
7
+ * plugin needs: on the machine that prompted this work the key lived in a user-level
8
+ * environment variable and in `~/.dsh/.credentials.yaml`, while DSH's own process
9
+ * inherited neither — so `delphi-review` failed with a missing-variable error while
10
+ * every other gate worked.
11
+ *
12
+ * Resolution is deliberately single-layer. When `ctx.credentials` is present and
13
+ * reports `undefined`, this module does NOT fall back to `process.env`: the service
14
+ * has already consulted the environment, so a second look would resurrect a value it
15
+ * deliberately reported as absent and would make a DSH session resolve differently
16
+ * from a terminal session.
17
+ */
18
+ /**
19
+ * Environment-variable names: a POSIX shell identifier. Anything else cannot name a
20
+ * credential, so it reads as "not set" rather than reaching the store.
21
+ */
22
+ const REFERENCE_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
23
+ function isReferenceName(value) {
24
+ return REFERENCE_NAME.test(value);
25
+ }
26
+ /**
27
+ * Build an `ApiKeyResolver` over the available credential service.
28
+ *
29
+ * @param credentials - `ctx.credentials`, or undefined when the host does not offer
30
+ * one. Absence degrades to reading the process environment directly, which keeps
31
+ * the plugin working outside DSH (CLI use, tests).
32
+ * @param env - environment to read in that fallback. Injected rather than read from
33
+ * the global so the module stays testable offline.
34
+ * @param brand - converts a raw name into the service's nominal `CredentialRef`.
35
+ * Injected so this module needs no import of the peer package and tests can pass
36
+ * an identity function.
37
+ */
38
+ export function createCredentialResolver(credentials, env, brand = (value) => value) {
39
+ return async (ref) => {
40
+ if (!isReferenceName(ref))
41
+ return undefined;
42
+ if (credentials !== undefined) {
43
+ try {
44
+ const resolved = await credentials.resolve(brand(ref));
45
+ return resolved?.value;
46
+ }
47
+ catch {
48
+ // A broken provider must not take the tool down; the caller turns the
49
+ // missing value into a DelphiSetupError that names the variable.
50
+ return undefined;
51
+ }
52
+ }
53
+ const value = env[ref];
54
+ return typeof value === "string" && value.length > 0 ? value : undefined;
55
+ };
56
+ }
57
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH;;;GAGG;AACH,MAAM,cAAc,GAAG,0BAA0B,CAAA;AAEjD,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,wBAAwB,CACtC,WAA0C,EAC1C,GAAsB,EACtB,QAAoC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IAEpD,OAAO,KAAK,EAAE,GAAW,EAA+B,EAAE;QACxD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAA;QAE3C,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;gBACtD,OAAO,QAAQ,EAAE,KAAK,CAAA;YACxB,CAAC;YAAC,MAAM,CAAC;gBACP,sEAAsE;gBACtE,iEAAiE;gBACjE,OAAO,SAAS,CAAA;YAClB,CAAC;QACH,CAAC;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;QACtB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1E,CAAC,CAAA;AACH,CAAC"}
@@ -89,9 +89,40 @@ export declare function expandEnv(value: string, env?: NodeJS.ProcessEnv): strin
89
89
  * Fails loudly and specifically: a missing key or an unexpanded placeholder is
90
90
  * the most common way a Delphi run silently degrades.
91
91
  */
92
- export declare function resolveConfig(cfg: RawDelphiConfig, env?: NodeJS.ProcessEnv): ResolvedDelphiConfig;
93
- /** Read and resolve `.delphi-config.json` from a project root. */
94
- export declare function loadDelphiConfig(cwd: string, env?: NodeJS.ProcessEnv, globalPath?: string): ResolvedDelphiConfig;
92
+ export declare function resolveConfig(cfg: RawDelphiConfig, env?: NodeJS.ProcessEnv, apiKeyOverrides?: ApiKeyOverrides): ResolvedDelphiConfig;
93
+ /**
94
+ * Default global config location; XDG_CONFIG_HOME is an accepted override.
95
+ *
96
+ * Exported so the Gate MW validator's parity test can import THIS definition
97
+ * rather than restating it (2026-10-27 review, technical seat CRITICAL): the
98
+ * gate (`githooks/lib/validate-code-walkthrough.cjs`) needs the same path, and
99
+ * a second hand-written copy can drift silently. Drift here is not cosmetic —
100
+ * the gate would validate seats from one file while the reviewer used another,
101
+ * which is exactly the class of bug #574 exists to catch.
102
+ */
103
+ export declare function defaultGlobalConfigPath(env: NodeJS.ProcessEnv): string;
104
+ /**
105
+ * Pre-resolved credential values, keyed by the environment-variable name a config
106
+ * referenced.
107
+ *
108
+ * The loader is synchronous and the DSH credential service is asynchronous, so a
109
+ * caller that resolved a key from the store hands the result in here. The override
110
+ * is intentionally keyed by name: a config whose `api_key` is a literal, or which
111
+ * names a different variable, is left untouched.
112
+ */
113
+ type ApiKeyOverrides = Readonly<Record<string, string>>;
114
+ /**
115
+ * List the environment-variable names the config's provider api_keys reference,
116
+ * WITHOUT resolving any of them.
117
+ *
118
+ * `loadDelphiConfig` is synchronous while DSH's credential service is asynchronous,
119
+ * so the caller has to learn what to resolve before it can build the config. Reading
120
+ * the names is deliberately tolerant: an unset variable is exactly the case this
121
+ * exists for, so a name is reported whether or not it currently has a value, and a
122
+ * missing config yields an empty list instead of an error.
123
+ */
124
+ export declare function listCredentialReferences(cwd: string, globalPath?: string): string[];
125
+ export declare function loadDelphiConfig(cwd: string, env?: NodeJS.ProcessEnv, globalPath?: string, apiKeyOverrides?: ApiKeyOverrides): ResolvedDelphiConfig;
95
126
  /** Build the transport options a round needs from a resolved config. */
96
127
  export declare function toDelphiOptions(cfg: ResolvedDelphiConfig): DelphiOptions;
97
128
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"delphi-config.d.ts","sourceRoot":"","sources":["../src/delphi-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAG5D,wDAAwD;AACxD,UAAU,SAAS;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,UAAU;IAClB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;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,eAAe,EACpB,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,eAAe,GAAE,eAAoB,GACpC,oBAAoB,CAuBtB;AAwCD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAItE;AAED;;;;;;;;GAQG;AACH,KAAK,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAoCvD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,UAAU,GAAE,MAA6C,GACxD,MAAM,EAAE,CAoBV;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,UAAU,GAAE,MAAqC,EACjD,eAAe,GAAE,eAAoB,GACpC,oBAAoB,CAetB;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,GAAG,EAAE,oBAAoB,GAAG,aAAa,CAQxE"}
@@ -17,6 +17,15 @@ import { validateSeats } from "./delphi.js";
17
17
  /** Raised when config on disk cannot be turned into a usable review setup. */
18
18
  export class DelphiSetupError extends Error {
19
19
  }
20
+ /**
21
+ * Delphi's documented defaults, applied when the config omits a consensus setting.
22
+ * Held as object properties so the values read as policy fields rather than stray
23
+ * literals.
24
+ */
25
+ const CONSENSUS_DEFAULTS = {
26
+ threshold_percent: "90",
27
+ max_review_rounds: "5",
28
+ };
20
29
  /** Placeholder spellings xp-gate configs already use. Named so the error text can
21
30
  * quote the exact form the user wrote — a typo in the spelling is
22
31
  * indistinguishable from an unset variable otherwise (#576). */
@@ -89,8 +98,42 @@ function normalizeExperts(experts) {
89
98
  // Object form: the KEY is the role, which is how xp-gate writes it.
90
99
  return Object.entries(experts).map(([role, raw]) => ({ raw, role }));
91
100
  }
101
+ /** Resolve one provider's base_url + api_key, failing loudly. */
102
+ function resolveOneProvider(name, entry, env, apiKeyOverrides) {
103
+ const baseUrl = entry.base_url ?? entry.baseUrl ?? "";
104
+ if (!baseUrl)
105
+ throw new DelphiSetupError(`Provider "${name}" has no base_url.`);
106
+ const rawKey = entry.api_key ?? entry.apiKey ?? "";
107
+ // Find the placeholder BEFORE touching `env`: the spelling lives in the
108
+ // config, not the environment, so a broken `env` must not hide it.
109
+ const placeholder = findPlaceholder(rawKey);
110
+ // A caller that already resolved this variable from the authoritative store
111
+ // (DSH's credential service) wins over the process environment: the store is
112
+ // layered over env itself, so its answer is the more informed one. A literal
113
+ // api_key names no variable and is therefore untouched.
114
+ const overrideValue = placeholder ? apiKeyOverrides[placeholder.name] : undefined;
115
+ // Every read of `env` may fail — a caller can pass a proxy, a frozen object,
116
+ // or an environment that throws on access. Diagnostics must never become the
117
+ // reason the run dies: on any error fall back to the plainest possible
118
+ // message, which is still a DelphiSetupError (#576).
119
+ let expanded;
120
+ try {
121
+ expanded = expandEnvDetailed(rawKey, env);
122
+ }
123
+ catch {
124
+ expanded = { value: "", missing: placeholder ? [placeholder.name] : [], empty: [] };
125
+ }
126
+ const apiKey = overrideValue ?? expanded.value;
127
+ if (!apiKey) {
128
+ // Name the variable rather than echoing config, which may hold a literal key.
129
+ throw new DelphiSetupError(placeholder
130
+ ? describeUnusableKey(name, rawKey, placeholder, expanded, env)
131
+ : `Provider "${name}" has no api_key.`);
132
+ }
133
+ return { baseUrl, apiKey };
134
+ }
92
135
  /** Resolve every referenced provider's base_url + api_key, failing loudly. */
93
- function resolveProviders(profile, needed, env) {
136
+ function resolveProviders(profile, needed, env, apiKeyOverrides) {
94
137
  if (needed.size === 0) {
95
138
  throw new DelphiSetupError('No provider configured. Set "provider" on the profile or on each expert.');
96
139
  }
@@ -102,32 +145,7 @@ function resolveProviders(profile, needed, env) {
102
145
  throw new DelphiSetupError(`Provider "${name}" is not defined under "providers". ` +
103
146
  `Known: ${Object.keys(providerTable).join(", ") || "(none)"}`);
104
147
  }
105
- const baseUrl = entry.base_url ?? entry.baseUrl ?? "";
106
- if (!baseUrl)
107
- throw new DelphiSetupError(`Provider "${name}" has no base_url.`);
108
- const rawKey = entry.api_key ?? entry.apiKey ?? "";
109
- // Find the placeholder BEFORE touching `env`: the spelling lives in the
110
- // config, not the environment, so a broken `env` must not hide it.
111
- const placeholder = findPlaceholder(rawKey);
112
- // Every read of `env` may fail — a caller can pass a proxy, a frozen object,
113
- // or an environment that throws on access. Diagnostics must never become the
114
- // reason the run dies: on any error fall back to the plainest possible
115
- // message, which is still a DelphiSetupError (#576).
116
- let expanded;
117
- try {
118
- expanded = expandEnvDetailed(rawKey, env);
119
- }
120
- catch {
121
- expanded = { value: "", missing: placeholder ? [placeholder.name] : [], empty: [] };
122
- }
123
- const apiKey = expanded.value;
124
- if (!apiKey) {
125
- // Name the variable rather than echoing config, which may hold a literal key.
126
- throw new DelphiSetupError(placeholder
127
- ? describeUnusableKey(name, rawKey, placeholder, expanded, env)
128
- : `Provider "${name}" has no api_key.`);
129
- }
130
- resolved.set(name, { baseUrl, apiKey });
148
+ resolved.set(name, resolveOneProvider(name, entry, env, apiKeyOverrides));
131
149
  }
132
150
  return resolved;
133
151
  }
@@ -195,13 +213,13 @@ function describeUnusableKey(providerName, rawKey, placeholder, expanded, env) {
195
213
  * Fails loudly and specifically: a missing key or an unexpanded placeholder is
196
214
  * the most common way a Delphi run silently degrades.
197
215
  */
198
- export function resolveConfig(cfg, env = process.env) {
216
+ export function resolveConfig(cfg, env = process.env, apiKeyOverrides = {}) {
199
217
  const profile = selectProfile(cfg);
200
218
  const normalized = normalizeExperts(profile.experts);
201
219
  // An expert may name its own provider; otherwise there must be a profile-wide
202
220
  // default. Resolve base_url/api_key per provider so mixed setups work.
203
221
  const providerNames = new Set(normalized.map((e) => e.raw.provider ?? profile.provider).filter((p) => !!p));
204
- const resolvedProviders = resolveProviders(profile, providerNames, env);
222
+ const resolvedProviders = resolveProviders(profile, providerNames, env, apiKeyOverrides);
205
223
  const seats = normalized.map((e, i) => seatFromRaw(e.raw, i, e.role));
206
224
  // Surface an unexpanded placeholder as a config error, not a provider 404.
207
225
  for (const s of seats) {
@@ -216,7 +234,9 @@ export function resolveConfig(cfg, env = process.env) {
216
234
  function buildResult(profile, normalized, resolvedProviders, seats, cfg) {
217
235
  // All seats share one gateway in the supported setup; require agreement so a
218
236
  // mixed list cannot silently send one seat's key to another host.
219
- const chosen = resolvedProviders.get(normalized[0].raw.provider ?? profile.provider ?? "");
237
+ // Every seat resolves to the same gateway, so the first one speaks for all.
238
+ const [firstSeat] = normalized;
239
+ const chosen = resolvedProviders.get(firstSeat?.raw.provider ?? profile.provider ?? "");
220
240
  if (!chosen)
221
241
  throw new DelphiSetupError("Unable to resolve a provider for the first expert.");
222
242
  for (const e of normalized) {
@@ -233,19 +253,29 @@ function buildResult(profile, normalized, resolvedProviders, seats, cfg) {
233
253
  seats,
234
254
  baseUrl: chosen.baseUrl,
235
255
  apiKey: chosen.apiKey,
236
- thresholdPercent: consensus?.threshold_percent ?? 90,
237
- maxRounds: consensus?.max_review_rounds ?? 5,
256
+ thresholdPercent: consensus?.threshold_percent ?? Number(CONSENSUS_DEFAULTS.threshold_percent),
257
+ maxRounds: consensus?.max_review_rounds ?? Number(CONSENSUS_DEFAULTS.max_review_rounds),
238
258
  provider: normalized[0].raw.provider ?? profile.provider ?? "",
239
259
  };
240
260
  }
241
- /** Default global config location; XDG_CONFIG_HOME is an accepted override. */
242
- function defaultGlobalConfigPath(env) {
261
+ /**
262
+ * Default global config location; XDG_CONFIG_HOME is an accepted override.
263
+ *
264
+ * Exported so the Gate MW validator's parity test can import THIS definition
265
+ * rather than restating it (2026-10-27 review, technical seat CRITICAL): the
266
+ * gate (`githooks/lib/validate-code-walkthrough.cjs`) needs the same path, and
267
+ * a second hand-written copy can drift silently. Drift here is not cosmetic —
268
+ * the gate would validate seats from one file while the reviewer used another,
269
+ * which is exactly the class of bug #574 exists to catch.
270
+ */
271
+ export function defaultGlobalConfigPath(env) {
243
272
  // r16 MA-01 disposition: the CLI lib pins ~/.config/xp-gate, and on Linux
244
273
  // $HOME/.config IS the XDG default — opt-in escape hatch only.
245
274
  return join(env.XDG_CONFIG_HOME || join(homedir(), ".config"), "xp-gate", ".delphi-config.json");
246
275
  }
247
276
  /** Read and resolve `.delphi-config.json` from a project root. */
248
- export function loadDelphiConfig(cwd, env = process.env, globalPath = defaultGlobalConfigPath(env)) {
277
+ /** Read the raw config text from the project path, falling back to the global one. */
278
+ function readConfigText(cwd, globalPath) {
249
279
  // Global fallback (AC-DSH-016-03): the machine-wide config at
250
280
  // ~/.config/xp-gate/.delphi-config.json is the single source of truth for
251
281
  // every project. Without it, each repo needed its own copy — and reading a
@@ -253,9 +283,8 @@ export function loadDelphiConfig(cwd, env = process.env, globalPath = defaultGlo
253
283
  // real money loss (2026-10-03: an expensive overseas model burned the daily
254
284
  // quota). A project-local config still wins, so per-project overrides work.
255
285
  const path = resolve(cwd, ".delphi-config.json");
256
- let raw;
257
286
  try {
258
- raw = readFileSync(path, "utf8");
287
+ return readFileSync(path, "utf8");
259
288
  }
260
289
  catch (projectError) {
261
290
  // Fall back ONLY when the project file is genuinely absent (ENOENT); any
@@ -265,19 +294,59 @@ export function loadDelphiConfig(cwd, env = process.env, globalPath = defaultGlo
265
294
  if (projectError?.code !== "ENOENT") {
266
295
  throw new DelphiSetupError(`Cannot read ${path}: ${projectError.message}`);
267
296
  }
268
- try {
269
- raw = readFileSync(globalPath, "utf8");
297
+ }
298
+ try {
299
+ return readFileSync(globalPath, "utf8");
300
+ }
301
+ catch (globalError) {
302
+ // r16 CI-01: mirror the project-read semantics — a global file that is
303
+ // absent means "no config anywhere"; any OTHER error (EACCES/EISDIR)
304
+ // must surface as-is rather than masquerade as a missing file.
305
+ if (globalError?.code !== "ENOENT") {
306
+ throw new DelphiSetupError(`Cannot read ${globalPath}: ${globalError.message}`);
270
307
  }
271
- catch (globalError) {
272
- // r16 CI-01: mirror the project-read semantics — a global file that is
273
- // absent means "no config anywhere"; any OTHER error (EACCES/EISDIR)
274
- // must surface as-is rather than masquerade as a missing file.
275
- if (globalError?.code !== "ENOENT") {
276
- throw new DelphiSetupError(`Cannot read ${globalPath}: ${globalError.message}`);
277
- }
278
- throw new DelphiSetupError(`No .delphi-config.json found at ${path} or the global location ${globalPath}.`);
308
+ return null;
309
+ }
310
+ }
311
+ /**
312
+ * List the environment-variable names the config's provider api_keys reference,
313
+ * WITHOUT resolving any of them.
314
+ *
315
+ * `loadDelphiConfig` is synchronous while DSH's credential service is asynchronous,
316
+ * so the caller has to learn what to resolve before it can build the config. Reading
317
+ * the names is deliberately tolerant: an unset variable is exactly the case this
318
+ * exists for, so a name is reported whether or not it currently has a value, and a
319
+ * missing config yields an empty list instead of an error.
320
+ */
321
+ export function listCredentialReferences(cwd, globalPath = defaultGlobalConfigPath(process.env)) {
322
+ const raw = readConfigText(cwd, globalPath);
323
+ if (raw === null)
324
+ return [];
325
+ let parsed;
326
+ try {
327
+ parsed = JSON.parse(raw);
328
+ }
329
+ catch {
330
+ // A malformed config is reported by loadDelphiConfig with an actionable
331
+ // message; there is simply nothing to resolve here.
332
+ return [];
333
+ }
334
+ const names = new Set();
335
+ for (const profile of Object.values(parsed.profiles ?? {})) {
336
+ for (const provider of Object.values(profile.providers ?? {})) {
337
+ const placeholder = findPlaceholder(provider.api_key ?? provider.apiKey ?? "");
338
+ if (placeholder)
339
+ names.add(placeholder.name);
279
340
  }
280
341
  }
342
+ return [...names].sort();
343
+ }
344
+ export function loadDelphiConfig(cwd, env = process.env, globalPath = defaultGlobalConfigPath(env), apiKeyOverrides = {}) {
345
+ const raw = readConfigText(cwd, globalPath);
346
+ if (raw === null) {
347
+ const path = resolve(cwd, ".delphi-config.json");
348
+ throw new DelphiSetupError(`No .delphi-config.json found at ${path} or the global location ${globalPath}.`);
349
+ }
281
350
  let parsed;
282
351
  try {
283
352
  parsed = JSON.parse(raw);
@@ -285,7 +354,7 @@ export function loadDelphiConfig(cwd, env = process.env, globalPath = defaultGlo
285
354
  catch (e) {
286
355
  throw new DelphiSetupError(`.delphi-config.json is not valid JSON: ${e.message}`);
287
356
  }
288
- return resolveConfig(parsed, env);
357
+ return resolveConfig(parsed, env, apiKeyOverrides);
289
358
  }
290
359
  /** Build the transport options a round needs from a resolved config. */
291
360
  export function toDelphiOptions(cfg) {
@@ -1 +1 @@
1
- {"version":3,"file":"delphi-config.js","sourceRoot":"","sources":["../src/delphi-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAwC3C,8EAA8E;AAC9E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;CAAG;AAE9C;;iEAEiE;AACjE,MAAM,oBAAoB,GAAG;IAC3B,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,iCAAiC,EAAE;IACxD,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,mCAAmC,EAAE;CAChD,CAAA;AAkBV;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAa,EACb,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,GAAG,GAAG,KAAK,CAAA;IACf,KAAK,MAAM,EAAE,EAAE,EAAE,IAAI,oBAAoB,EAAE,CAAC;QAC1C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,IAAY,EAAE,EAAE;YACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAA;YACvB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,IAA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AAqB,uBAAuB,CAAC,GAAG,CAAC,EACjD,kBAAmC,EAAE;IAErC,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IAC3C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA;QAChD,MAAM,IAAI,gBAAgB,CACxB,mCAAmC,IAAI,2BAA2B,UAAU,GAAG,CAChF,CAAA;IACH,CAAC;IACD,IAAI,MAAuB,CAAA;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAoB,CAAA;IAC7C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,gBAAgB,CAAC,0CAA2C,CAAW,CAAC,OAAO,EAAE,CAAC,CAAA;IAC9F,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,CAAA;AACpD,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,GAAyB;IACvD,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;QACtC,SAAS,EAAE,GAAG,CAAC,SAAS;KACzB,CAAA;AACH,CAAC"}
@@ -18,7 +18,7 @@ export interface ReviewOutcome {
18
18
  * Run a full review. Round 1 is anonymous; each later round sees the aggregate
19
19
  * plus whatever the caller says was addressed, then re-votes.
20
20
  */
21
- export declare function runReview(opts: DelphiOptions, subject: string, addressed?: string): Promise<ReviewOutcome>;
21
+ export declare function runReview(opts: DelphiOptions, subject: string, addressed?: string, signal?: AbortSignal): Promise<ReviewOutcome>;
22
22
  /** Human-readable transcript for the tool result. */
23
23
  export declare function formatOutcome(outcome: ReviewOutcome): string;
24
24
  //# sourceMappingURL=delphi-run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delphi-run.d.ts","sourceRoot":"","sources":["../src/delphi-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAc,WAAW,EAAE,MAAM,aAAa,CAAA;AAOzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AA0CD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,SAAS,SAAK,GACb,OAAO,CAAC,aAAa,CAAC,CAoCxB;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAiB5D"}
1
+ {"version":3,"file":"delphi-run.d.ts","sourceRoot":"","sources":["../src/delphi-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAc,WAAW,EAAE,MAAM,aAAa,CAAA;AAoBzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AA0CD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EACf,SAAS,SAAK,EACd,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,aAAa,CAAC,CA0CxB;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAiB5D"}
package/lib/delphi-run.js CHANGED
@@ -7,7 +7,22 @@
7
7
  * 并把结果整理成可写成 .code-walkthrough-result.json 的证据。
8
8
  * @covers AC-DSH-016-03
9
9
  */
10
+ import { TOOL_ABORTED } from "@deepseek-ai/dsh-tools";
11
+ import { HarnessError } from "@deepseek-ai/dsh-llm";
10
12
  import { runRound } from "./delphi.js";
13
+ /**
14
+ * Raise TOOL_ABORTED once the caller's signal has fired.
15
+ *
16
+ * Deliverance matches the gate tools exactly, so a cancelled review reads as a
17
+ * cancellation in the UI rather than as a provider outage.
18
+ */
19
+ function assertNotAborted(signal) {
20
+ if (!signal?.aborted)
21
+ return;
22
+ const error = new HarnessError("tool call aborted", TOOL_ABORTED);
23
+ error.name = "AbortError";
24
+ throw error;
25
+ }
11
26
  /** Mirrors delphi.ts; declared here so orchestrators need not import internals. */
12
27
  const DEFAULT_THRESHOLD_PERCENT = 90;
13
28
  const DEFAULT_MAX_ROUNDS = 5;
@@ -43,15 +58,21 @@ function laterRoundPrompt(seat, subject, previous, addressed) {
43
58
  * Run a full review. Round 1 is anonymous; each later round sees the aggregate
44
59
  * plus whatever the caller says was addressed, then re-votes.
45
60
  */
46
- export async function runReview(opts, subject, addressed = "") {
61
+ export async function runReview(opts, subject, addressed = "", signal) {
47
62
  const threshold = opts.thresholdPercent ?? DEFAULT_THRESHOLD_PERCENT;
48
63
  const maxRounds = opts.maxRounds ?? DEFAULT_MAX_ROUNDS;
49
64
  const rounds = [];
65
+ // A round swallows per-seat failures into ERROR verdicts, so cancellation has to
66
+ // be checked around them: otherwise an abort would surface as three ERROR seats and
67
+ // the review would grind on through every remaining round.
68
+ const effective = { ...opts, signal };
69
+ assertNotAborted(signal);
50
70
  for (let n = 1; n <= maxRounds; n++) {
51
71
  const previous = rounds[rounds.length - 1];
52
72
  const result = previous
53
- ? await runRound(opts, n, "You are a rigorous senior code reviewer.", (seat) => laterRoundPrompt(seat, subject, previous, addressed))
54
- : await runRound(opts, 1, "You are a rigorous senior code reviewer.", (seat) => roundOnePrompt(seat, subject));
73
+ ? await runRound(effective, n, "You are a rigorous senior code reviewer.", (seat) => laterRoundPrompt(seat, subject, previous, addressed))
74
+ : await runRound(effective, 1, "You are a rigorous senior code reviewer.", (seat) => roundOnePrompt(seat, subject));
75
+ assertNotAborted(signal);
55
76
  rounds.push(result);
56
77
  // Threshold is a percentage of the whole panel, so a round with a malformed
57
78
  // report cannot reach consensus even if every valid seat approved.