@magnusekdahl/parallix 1.3.1 → 1.3.3

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 (67) hide show
  1. package/README.md +4 -2
  2. package/config/integration-pipelines.json +5 -0
  3. package/docs/adr/0048-fail-closed-harness-defense-against-agent-hallucinations.md +161 -0
  4. package/docs/adr/index.md +2 -0
  5. package/docs/authority-reference.md +8 -5
  6. package/lib/agents/agents.js +3 -1
  7. package/lib/agents/agents.ts +3 -1
  8. package/lib/agents/claude.js +3 -1
  9. package/lib/agents/claude.ts +3 -1
  10. package/lib/agents/codex.js +3 -1
  11. package/lib/agents/codex.ts +3 -1
  12. package/lib/agents/mistral-telemetry.js +122 -23
  13. package/lib/agents/mistral-telemetry.ts +141 -26
  14. package/lib/agents/mistral.js +1 -1
  15. package/lib/agents/mistral.ts +1 -1
  16. package/lib/agents/opencode.js +5 -3
  17. package/lib/agents/opencode.ts +5 -3
  18. package/lib/commands/active.js +21 -3
  19. package/lib/commands/active.ts +7 -2
  20. package/lib/commands/config.js +6 -1
  21. package/lib/commands/config.ts +6 -1
  22. package/lib/commands/coverage-gate.js +19 -1
  23. package/lib/commands/coverage-gate.ts +6 -1
  24. package/lib/commands/diff.js +6 -1
  25. package/lib/commands/diff.ts +6 -1
  26. package/lib/commands/draft.js +31 -1
  27. package/lib/commands/draft.ts +6 -1
  28. package/lib/commands/handoff.js +12 -1
  29. package/lib/commands/handoff.ts +6 -1
  30. package/lib/commands/integrate.js +103 -27
  31. package/lib/commands/integrate.ts +67 -31
  32. package/lib/commands/mission-start.js +12 -3
  33. package/lib/commands/mission-start.ts +7 -2
  34. package/lib/commands/rebase.js +10 -2
  35. package/lib/commands/rebase.ts +6 -2
  36. package/lib/commands/repair-handoff.js +13 -3
  37. package/lib/commands/repair-handoff.ts +7 -2
  38. package/lib/commands/resolve-conflict.js +8 -2
  39. package/lib/commands/resolve-conflict.ts +7 -2
  40. package/lib/commands/review.js +6 -1
  41. package/lib/commands/review.ts +6 -1
  42. package/lib/commands/setup-review.js +8 -3
  43. package/lib/commands/setup-review.ts +8 -3
  44. package/lib/commands/setup.js +8 -2
  45. package/lib/commands/setup.ts +7 -2
  46. package/lib/commands/stats-backfill.js +14 -3
  47. package/lib/commands/stats-backfill.ts +7 -2
  48. package/lib/commands/stats.js +33 -1
  49. package/lib/commands/stats.ts +7 -2
  50. package/lib/commands/status.js +8 -1
  51. package/lib/commands/status.ts +6 -1
  52. package/lib/commands/verify.js +11 -2
  53. package/lib/commands/verify.ts +7 -2
  54. package/lib/core/gitignore.js +9 -1
  55. package/lib/core/gitignore.ts +6 -1
  56. package/lib/core/persistent-data-migration.js +4 -2
  57. package/lib/core/persistent-data-migration.ts +4 -2
  58. package/lib/index.js +36 -36
  59. package/lib/index.ts +18 -18
  60. package/lib/review/review-loop.js +12 -7
  61. package/lib/review/review-loop.ts +10 -7
  62. package/lib/review/review.js +51 -1
  63. package/lib/review/review.ts +6 -1
  64. package/lib/tools/setup-review.js +7 -4
  65. package/lib/tools/setup-review.ts +2 -2
  66. package/package.json +1 -1
  67. package/px.js +30 -14
@@ -1,44 +1,159 @@
1
+ import fs from 'node:fs';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+
1
5
  /**
2
- * Mistral (Vibe) Telemetry Stub
6
+ * Mistral (Vibe) Telemetry Parser
7
+ *
8
+ * Mistral Vibe writes structured token-usage data to per-session meta files:
9
+ * ~/.vibe/logs/session/<session_id>/meta.json
3
10
  *
4
- * Mistral Vibe in programmatic mode does not output token-usage data to
5
- * stdout/stderr, and has no CLI endpoint for querying session usage.
6
- * This stub records honest zeros for all token columns so the stats CSV
7
- * never contains fabricated data.
11
+ * Each meta.json contains a `stats` object with token counts:
12
+ * - session_prompt_tokens → inputTokens
13
+ * - session_completion_tokens → outputTokens
14
+ * - session_total_llm_tokens → totalTokens
8
15
  *
9
- * Provider and model fields are set to "mistral" to indicate the agent family.
10
- * The actual model is determined at runtime via VIBE_ACTIVE_MODEL env var
11
- * but is not captured per-session, so model falls back to "mistral".
16
+ * This module scans that directory for the most recent meta.json, parses the
17
+ * stats block, and returns a telemetry object mirroring the shape used by
18
+ * codex-telemetry.ts.
12
19
  *
13
- * See task-1285 for the full telemetry credibility design. The blocked
14
- * verification is tracked as follow-up task-1288 ("Verify vibe/mistral
15
- * telemetry once usage-unblocked"), which names the missing evidence and the
16
- * reason it could not be collected in the task-1285 environment.
20
+ * See task-1288 for the discovery that confirmed the structured source.
21
+ */
22
+
23
+ /**
24
+ * The default directory where Vibe writes its session meta files.
25
+ * Overridden by tests via extractMistralTelemetry(basePath).
17
26
  */
27
+ export const DEFAULT_MISTRAL_LOG_DIR = path.join(os.homedir(), '.vibe', 'logs', 'session');
28
+
29
+ interface TelemetryResult {
30
+ inputTokens: number;
31
+ outputTokens: number;
32
+ totalTokens: number;
33
+ contextTokens: number;
34
+ toolCallsAgreed: number;
35
+ toolCallsRejected: number;
36
+ toolCallsFailed: number;
37
+ toolCallsSucceeded: number;
38
+ sessionCost: number;
39
+ path?: string;
40
+ }
41
+
42
+ interface ParseableMeta {
43
+ stats?: Record<string, unknown>;
44
+ [key: string]: unknown;
45
+ }
46
+
47
+ interface StatsBlock {
48
+ session_prompt_tokens?: unknown;
49
+ session_completion_tokens?: unknown;
50
+ session_total_llm_tokens?: unknown;
51
+ context_tokens?: unknown;
52
+ tool_calls_agreed?: unknown;
53
+ tool_calls_rejected?: unknown;
54
+ tool_calls_failed?: unknown;
55
+ tool_calls_succeeded?: unknown;
56
+ session_cost?: unknown;
57
+ [key: string]: unknown;
58
+ }
18
59
 
19
60
  /**
20
- * Attempt to extract telemetry from a mistral launcher result.
21
- * Since mistral/vibe provides no parseable usage data, always returns null.
61
+ * Parse the `stats` block from a meta.json file into a telemetry object.
62
+ * Returns null when the content yields no usable signal (missing stats,
63
+ * empty object, or non-object stats).
64
+ */
65
+ export function parseMistralMeta(meta: ParseableMeta | null | undefined): TelemetryResult | null {
66
+ if (!meta || typeof meta !== 'object') {return null;}
67
+
68
+ const stats = meta.stats;
69
+ if (!stats || typeof stats !== 'object') {return null;}
70
+
71
+ const s = stats as StatsBlock;
72
+ const inputTokens = Number(s.session_prompt_tokens) || 0;
73
+ const outputTokens = Number(s.session_completion_tokens) || 0;
74
+ const totalTokens = Number(s.session_total_llm_tokens) || 0;
75
+
76
+ // Return null when there is no usable signal (all zeros).
77
+ // Mirrors the codex-telemetry pattern where honest zeros still indicate
78
+ // a parseable source was found but contained no actual usage.
79
+ if (!inputTokens && !outputTokens && !totalTokens) {return null;}
80
+
81
+ return {
82
+ inputTokens,
83
+ outputTokens,
84
+ totalTokens,
85
+ contextTokens: Number(s.context_tokens) || 0,
86
+ toolCallsAgreed: Number(s.tool_calls_agreed) || 0,
87
+ toolCallsRejected: Number(s.tool_calls_rejected) || 0,
88
+ toolCallsFailed: Number(s.tool_calls_failed) || 0,
89
+ toolCallsSucceeded: Number(s.tool_calls_succeeded) || 0,
90
+ sessionCost: Number(s.session_cost) || 0,
91
+ };
92
+ }
93
+
94
+ /**
95
+ * Scan ~/.vibe/logs/session/ for the most recent session meta.json, parse its
96
+ * stats block, and return a telemetry object.
22
97
  *
23
- * @param {object} result - The launcher result object
24
- * @returns {null} Always null — mistral/vibe has no telemetry parser
98
+ * @param result - Legacy launcher result object (ignored; kept for API compat)
99
+ * @param basePath - Override the default session log directory. Used by tests.
25
100
  */
26
- function extractMistralTelemetry() {
27
- // Mistral Vibe does not emit token usage data. Honest zero.
101
+ export function extractMistralTelemetry(result: unknown, basePath?: string): TelemetryResult | null {
102
+ void result; // legacy param, ignored — telemetry comes from on-disk meta.json
103
+
104
+ const scanDir = basePath || DEFAULT_MISTRAL_LOG_DIR;
105
+
106
+ // Scan session subdirectories for the newest meta.json.
107
+ // Basenames are session_<YYYYMMDD>_<HHMMSS>_<id>, so alphabetical sort = chronological.
108
+ let sessionDirs: string[];
109
+ try {
110
+ sessionDirs = fs.readdirSync(scanDir);
111
+ } catch (_) {
112
+ return null;
113
+ }
114
+
115
+ const dirs = sessionDirs
116
+ .filter((d: string) => {
117
+ if (!d.startsWith('session_')) {return false;}
118
+ const full = path.join(scanDir, d);
119
+ try { return fs.statSync(full).isDirectory(); } catch (_) { return false; }
120
+ })
121
+ .sort();
122
+
123
+ if (dirs.length === 0) {return null;}
124
+
125
+ // Walk newest-first; return the first session that has a parseable meta.json.
126
+ for (let i = dirs.length - 1; i >= 0; i--) {
127
+ const metaPath = path.join(scanDir, dirs[i], 'meta.json');
128
+ if (!fs.existsSync(metaPath)) {continue;}
129
+
130
+ let content: string;
131
+ try {
132
+ content = fs.readFileSync(metaPath, 'utf8');
133
+ } catch (_) {
134
+ continue;
135
+ }
136
+
137
+ let meta: ParseableMeta;
138
+ try {
139
+ meta = JSON.parse(content);
140
+ } catch (_) {
141
+ continue;
142
+ }
143
+
144
+ const telemetry = parseMistralMeta(meta);
145
+ if (!telemetry) {continue;}
146
+
147
+ return { ...telemetry, path: metaPath };
148
+ }
149
+
28
150
  return null;
29
151
  }
30
152
 
31
153
  /**
32
154
  * Return the provider/model pair for mistral tasks.
33
155
  * Used as fallback when telemetry is null.
34
- *
35
- * @returns {{provider: string, model: string}}
36
156
  */
37
- function getMistralProviderModel() {
157
+ export function getMistralProviderModel(): { provider: string; model: string } {
38
158
  return { provider: 'mistral', model: 'mistral' };
39
159
  }
40
-
41
- export {
42
- extractMistralTelemetry,
43
- getMistralProviderModel,
44
- };
@@ -14,7 +14,7 @@ const spawn_tee_js_1 = require("../core/spawn-tee.js");
14
14
  // Current session ID format in meta.json: UUID like "a3dd3d4d-f97d-d57d-4942-a1f694e3a922"
15
15
  // Directory naming uses first 8 chars: session_20260521_162703_a3dd3d4d
16
16
  // No stdout marker detected in testing, so we leave this as null.
17
- // Telemetry: mistral/vibe does not expose token-usage data. See mistral-telemetry.js
17
+ // Telemetry: mistral/vibe does not expose token-usage data. See mistral-telemetry.ts
18
18
  // for the honest-zero stub. Stats hooks in active.js and review-loop.js call
19
19
  // recordStageStats which defaults to '0' for tokens when telemetry is null.
20
20
  function extractMistralSessionId(stdout) {
@@ -22,7 +22,7 @@ interface StartMistralAgentOptions extends MistralInvocationOptions {
22
22
  // Current session ID format in meta.json: UUID like "a3dd3d4d-f97d-d57d-4942-a1f694e3a922"
23
23
  // Directory naming uses first 8 chars: session_20260521_162703_a3dd3d4d
24
24
  // No stdout marker detected in testing, so we leave this as null.
25
- // Telemetry: mistral/vibe does not expose token-usage data. See mistral-telemetry.js
25
+ // Telemetry: mistral/vibe does not expose token-usage data. See mistral-telemetry.ts
26
26
  // for the honest-zero stub. Stats hooks in active.js and review-loop.js call
27
27
  // recordStageStats which defaults to '0' for tokens when telemetry is null.
28
28
 
@@ -17,11 +17,13 @@ const spawn_tee_js_1 = require("../core/spawn-tee.js");
17
17
  const opencode_telemetry_js_1 = require("./opencode-telemetry.js");
18
18
  const opencode_export_js_1 = require("./opencode-export.js");
19
19
  const limit_hit_js_1 = require("./limit-hit.js");
20
+ const node_module_1 = require("node:module");
20
21
  // tools/sessions and core/subagent-limit are still CJS (not converted in this
21
22
  // wave); require keeps them untyped (any) without pulling non-included .js into
22
23
  // the typecheck program.
23
- const sessions = require('../tools/sessions');
24
- const { buildSubagentLimitPrefix } = require('../core/subagent-limit');
24
+ const _require = (0, node_module_1.createRequire)(__filename);
25
+ const sessions = _require('../tools/sessions');
26
+ const { buildSubagentLimitPrefix } = _require('../core/subagent-limit');
25
27
  // Injectable I/O for tests. Production uses the real spawn-tee / export capture.
26
28
  let _spawnAndTee = spawn_tee_js_1.spawnAndTee;
27
29
  let _captureExport = opencode_export_js_1.captureOpencodeExport;
@@ -93,7 +95,7 @@ function checkJsonFormatSupport() {
93
95
  return _jsonFormatSupported;
94
96
  }
95
97
  try {
96
- const { spawnSync } = require('node:child_process');
98
+ const { spawnSync } = _require('node:child_process');
97
99
  const result = spawnSync('opencode', ['--format', 'json', '--help'], {
98
100
  timeout: 3000,
99
101
  stdio: ['ignore', 'pipe', 'pipe'],
@@ -2,11 +2,13 @@ import { spawnAndTee } from '../core/spawn-tee.js';
2
2
  import { extractOpencodeTelemetryFromExport } from './opencode-telemetry.js';
3
3
  import { captureOpencodeExport } from './opencode-export.js';
4
4
  import { detectLimitHit } from './limit-hit.js';
5
+ import { createRequire } from 'node:module';
5
6
  // tools/sessions and core/subagent-limit are still CJS (not converted in this
6
7
  // wave); require keeps them untyped (any) without pulling non-included .js into
7
8
  // the typecheck program.
8
- const sessions = require('../tools/sessions');
9
- const { buildSubagentLimitPrefix } = require('../core/subagent-limit');
9
+ const _require = createRequire(__filename);
10
+ const sessions = _require('../tools/sessions');
11
+ const { buildSubagentLimitPrefix } = _require('../core/subagent-limit');
10
12
 
11
13
  interface BuildOpencodeInvocationOptions {
12
14
  prompt: string;
@@ -105,7 +107,7 @@ function checkJsonFormatSupport() {
105
107
  return _jsonFormatSupported;
106
108
  }
107
109
  try {
108
- const { spawnSync } = require('node:child_process');
110
+ const { spawnSync } = _require('node:child_process');
109
111
  const result = spawnSync('opencode', ['--format', 'json', '--help'], {
110
112
  timeout: 3000,
111
113
  stdio: ['ignore', 'pipe', 'pipe'],
@@ -32,12 +32,26 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.active = void 0;
40
+ exports.buildExecutePrompt = buildExecutePrompt;
41
+ exports.buildCheckpointContext = buildCheckpointContext;
42
+ exports.runHandoffAndReview = runHandoffAndReview;
43
+ exports.applyExecuteFallback = applyExecuteFallback;
44
+ exports.selectLaunchAndRecord = selectLaunchAndRecord;
45
+ exports.validateCheckpointsBeforeHandoff = validateCheckpointsBeforeHandoff;
46
+ exports.attemptAgentRelaunch = attemptAgentRelaunch;
47
+ exports.enforceExecuteCommitSafety = enforceExecuteCommitSafety;
48
+ exports.unquoteGitStatusPath = unquoteGitStatusPath;
35
49
  // @ts-nocheck
36
50
  const git_js_1 = require("../core/git.js");
37
51
  const fs = __importStar(require("node:fs"));
38
52
  const path = __importStar(require("node:path"));
39
53
  const fmt = __importStar(require("../core/fmt.js"));
40
- const missionStart = __importStar(require("./mission-start.js"));
54
+ const mission_start_js_1 = __importDefault(require("./mission-start.js"));
41
55
  const agents = __importStar(require("../agents/agents.js"));
42
56
  const mission_utils_js_1 = require("../core/mission-utils.js");
43
57
  const handoff = __importStar(require("./handoff.js"));
@@ -53,7 +67,7 @@ const EXECUTE_PROMPT_PATH = path.join(__dirname, '..', '..', 'prompts', 'execute
53
67
  * @param {{inferSlugFn?: Function, missionStartFn?: Function, resolveWorktreeFn?: Function, readAgentConfigOrExitFn?: Function, resolveTaskFileFn?: Function, buildCheckpointContextFn?: Function, buildExecutePromptFn?: Function, selectLaunchAndRecordFn?: Function, enforceExecuteCommitSafetyFn?: Function, runHandoffAndReviewFn?: Function, exitFn?: Function, logFn?: Function, errorFn?: Function}} [options]
54
68
  */
55
69
  async function active(args, options = {}) {
56
- const { inferSlugFn = mission_utils_js_1.inferSlug, missionStartFn = missionStart, resolveWorktreeFn = mission_utils_js_1.resolveWorktree, readAgentConfigOrExitFn = agents.readAgentConfigOrExit, resolveTaskFileFn = backlog_js_1.resolveTaskFile, buildCheckpointContextFn = buildCheckpointContext, buildExecutePromptFn = buildExecutePrompt, selectLaunchAndRecordFn = selectLaunchAndRecord, enforceExecuteCommitSafetyFn = enforceExecuteCommitSafety, runHandoffAndReviewFn = runHandoffAndReview, exitFn = process.exit, logFn = fmt.log.info, errorFn = fmt.log.fail } = options;
70
+ const { inferSlugFn = mission_utils_js_1.inferSlug, missionStartFn = mission_start_js_1.default, resolveWorktreeFn = mission_utils_js_1.resolveWorktree, readAgentConfigOrExitFn = agents.readAgentConfigOrExit, resolveTaskFileFn = backlog_js_1.resolveTaskFile, buildCheckpointContextFn = buildCheckpointContext, buildExecutePromptFn = buildExecutePrompt, selectLaunchAndRecordFn = selectLaunchAndRecord, enforceExecuteCommitSafetyFn = enforceExecuteCommitSafety, runHandoffAndReviewFn = runHandoffAndReview, exitFn = process.exit, logFn = fmt.log.info, errorFn = fmt.log.fail } = options;
57
71
  const explicitSlug = args[0];
58
72
  const slug = inferSlugFn(explicitSlug);
59
73
  if (!slug) {
@@ -591,4 +605,8 @@ function enforceExecuteCommitSafety(opts) {
591
605
  }
592
606
  /** @type {typeof active & {buildExecutePrompt: typeof buildExecutePrompt, buildCheckpointContext: typeof buildCheckpointContext, runHandoffAndReview: typeof runHandoffAndReview, applyExecuteFallback: typeof applyExecuteFallback, selectLaunchAndRecord: typeof selectLaunchAndRecord, validateCheckpointsBeforeHandoff: typeof validateCheckpointsBeforeHandoff, attemptAgentRelaunch: typeof attemptAgentRelaunch, enforceExecuteCommitSafety: typeof enforceExecuteCommitSafety, unquoteGitStatusPath: typeof unquoteGitStatusPath}} */
593
607
  const _activeExport = Object.assign(active, { buildExecutePrompt, buildCheckpointContext, runHandoffAndReview, applyExecuteFallback, selectLaunchAndRecord, validateCheckpointsBeforeHandoff, attemptAgentRelaunch, enforceExecuteCommitSafety, unquoteGitStatusPath });
594
- module.exports = _activeExport;
608
+ exports.active = _activeExport;
609
+ exports.default = _activeExport;
610
+ if (typeof module !== 'undefined') {
611
+ module.exports = _activeExport;
612
+ }
@@ -3,7 +3,7 @@ import { git, getWorktreeStatus } from '../core/git.js';
3
3
  import * as fs from 'node:fs';
4
4
  import * as path from 'node:path';
5
5
  import * as fmt from '../core/fmt.js';
6
- import * as missionStart from './mission-start.js';
6
+ import missionStart from './mission-start.js';
7
7
  import * as agents from '../agents/agents.js';
8
8
  import { findMissionDir, findCheckpoints, getFirstLine, resolveWorktree, inferSlug, getMissionYear, missionDirForSlug, isWorkflowGeneratedArtifact } from '../core/mission-utils.js';
9
9
  import * as handoff from './handoff.js';
@@ -662,4 +662,9 @@ function enforceExecuteCommitSafety(opts) {
662
662
 
663
663
  /** @type {typeof active & {buildExecutePrompt: typeof buildExecutePrompt, buildCheckpointContext: typeof buildCheckpointContext, runHandoffAndReview: typeof runHandoffAndReview, applyExecuteFallback: typeof applyExecuteFallback, selectLaunchAndRecord: typeof selectLaunchAndRecord, validateCheckpointsBeforeHandoff: typeof validateCheckpointsBeforeHandoff, attemptAgentRelaunch: typeof attemptAgentRelaunch, enforceExecuteCommitSafety: typeof enforceExecuteCommitSafety, unquoteGitStatusPath: typeof unquoteGitStatusPath}} */
664
664
  const _activeExport = Object.assign(active, { buildExecutePrompt, buildCheckpointContext, runHandoffAndReview, applyExecuteFallback, selectLaunchAndRecord, validateCheckpointsBeforeHandoff, attemptAgentRelaunch, enforceExecuteCommitSafety, unquoteGitStatusPath });
665
- export = _activeExport;
665
+ export default _activeExport;
666
+ export { _activeExport as active, buildExecutePrompt, buildCheckpointContext, runHandoffAndReview, applyExecuteFallback, selectLaunchAndRecord, validateCheckpointsBeforeHandoff, attemptAgentRelaunch, enforceExecuteCommitSafety, unquoteGitStatusPath };
667
+
668
+ // CJS compat: ensure require() returns the function directly
669
+ declare const module: { exports: any } | undefined;
670
+ if (typeof module !== 'undefined') { module.exports = _activeExport; }
@@ -33,6 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  return result;
34
34
  };
35
35
  })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.config = config;
36
38
  const fmt = __importStar(require("../core/fmt.js"));
37
39
  const product_config_js_1 = require("../core/product-config.js");
38
40
  // `node parallix config` — read-only. Prints the effective configuration:
@@ -68,4 +70,7 @@ async function config(_args = [], opts = {}) {
68
70
  }
69
71
  logFn(JSON.stringify((0, product_config_js_1.loadEffectiveConfig)(rootDir), null, 2));
70
72
  }
71
- module.exports = config;
73
+ exports.default = config;
74
+ if (typeof module !== 'undefined') {
75
+ module.exports = config;
76
+ }
@@ -44,4 +44,9 @@ async function config(_args: string[] = [], opts: ConfigOptions = {}) {
44
44
  logFn(JSON.stringify(loadEffectiveConfig(rootDir), null, 2));
45
45
  }
46
46
 
47
- export = config;
47
+ export default config;
48
+ export { config };
49
+
50
+ // CJS compat: ensure require() returns the function directly
51
+ declare const module: { exports: any } | undefined;
52
+ if (typeof module !== 'undefined') { module.exports = config; }
@@ -80,6 +80,18 @@ var __importStar = (this && this.__importStar) || (function () {
80
80
  return result;
81
81
  };
82
82
  })();
83
+ Object.defineProperty(exports, "__esModule", { value: true });
84
+ exports.DEFAULT_TEST_TIMEOUT_MS = exports.COVERAGE_INCLUDES = exports.COVERAGE_EXCLUDES = void 0;
85
+ exports.run = run;
86
+ exports.cleanupPerRunScratch = cleanupPerRunScratch;
87
+ exports.createPerRunScratchDirs = createPerRunScratchDirs;
88
+ exports.discoverTestFiles = discoverTestFiles;
89
+ exports.listTempEntries = listTempEntries;
90
+ exports.registerExitHandlers = registerExitHandlers;
91
+ exports.resetPerRunScratchState = resetPerRunScratchState;
92
+ exports.resolveTestTimeoutMs = resolveTestTimeoutMs;
93
+ exports.runTests = runTests;
94
+ exports.shouldCleanTempDir = shouldCleanTempDir;
83
95
  const node_child_process_1 = require("node:child_process");
84
96
  const fs = __importStar(require("node:fs"));
85
97
  const os = __importStar(require("node:os"));
@@ -109,6 +121,7 @@ const COVERAGE_INCLUDES = [
109
121
  'index.js',
110
122
  'lib/**/*.js'
111
123
  ];
124
+ exports.COVERAGE_INCLUDES = COVERAGE_INCLUDES;
112
125
  const COVERAGE_EXCLUDES = [
113
126
  'test/**',
114
127
  'prompts/**',
@@ -116,10 +129,12 @@ const COVERAGE_EXCLUDES = [
116
129
  '.workflow/**',
117
130
  'node_modules/**'
118
131
  ];
132
+ exports.COVERAGE_EXCLUDES = COVERAGE_EXCLUDES;
119
133
  // The full suite regularly exceeds 10 minutes in this repository, especially
120
134
  // under cold caches. Keep the gate generous so it can finish without a manual
121
135
  // override while still failing on real hangs.
122
136
  const DEFAULT_TEST_TIMEOUT_MS = 3_600_000;
137
+ exports.DEFAULT_TEST_TIMEOUT_MS = DEFAULT_TEST_TIMEOUT_MS;
123
138
  const PER_RUN_SCRATCH = [];
124
139
  let threshold = 90;
125
140
  let dryRun = false;
@@ -387,4 +402,7 @@ run.resetPerRunScratchState = resetPerRunScratchState;
387
402
  run.resolveTestTimeoutMs = resolveTestTimeoutMs;
388
403
  run.runTests = runTests;
389
404
  run.shouldCleanTempDir = shouldCleanTempDir;
390
- module.exports = run;
405
+ exports.default = run;
406
+ if (typeof module !== 'undefined') {
407
+ module.exports = run;
408
+ }
@@ -359,4 +359,9 @@ function run(args: string[], options: CoverageGateOptions = {}) {
359
359
  (run as any).resolveTestTimeoutMs = resolveTestTimeoutMs;
360
360
  (run as any).runTests = runTests;
361
361
  (run as any).shouldCleanTempDir = shouldCleanTempDir;
362
- export = run;
362
+ export default run;
363
+ export { run, cleanupPerRunScratch, createPerRunScratchDirs, COVERAGE_EXCLUDES, COVERAGE_INCLUDES, DEFAULT_TEST_TIMEOUT_MS, discoverTestFiles, listTempEntries, registerExitHandlers, resetPerRunScratchState, resolveTestTimeoutMs, runTests, shouldCleanTempDir };
364
+
365
+ // CJS compat: ensure require() returns the function directly
366
+ declare const module: { exports: any } | undefined;
367
+ if (typeof module !== 'undefined') { module.exports = run; }
@@ -35,6 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.diff = diff;
38
40
  const node_child_process_1 = __importDefault(require("node:child_process"));
39
41
  const node_path_1 = __importDefault(require("node:path"));
40
42
  const git_js_1 = require("../core/git.js");
@@ -143,4 +145,7 @@ async function diff(args, { gitFn = git_js_1.git, spawnSyncFn = node_child_proce
143
145
  fmt.log.info(`Refer to ${fmt.path('docs/developer-setup/review-tooling.md')} for setup guidance.`);
144
146
  exitFn(1);
145
147
  }
146
- module.exports = diff;
148
+ exports.default = diff;
149
+ if (typeof module !== 'undefined') {
150
+ module.exports = diff;
151
+ }
@@ -122,4 +122,9 @@ async function diff(args: any, {
122
122
  exitFn(1);
123
123
  }
124
124
 
125
- export = diff;
125
+ export default diff;
126
+ export { diff };
127
+
128
+ // CJS compat: ensure require() returns the function directly
129
+ declare const module: { exports: any } | undefined;
130
+ if (typeof module !== 'undefined') { module.exports = diff; }
@@ -32,6 +32,32 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.draft = void 0;
37
+ exports.runDraftCommand = runDraftCommand;
38
+ exports.recordDraftStats = recordDraftStats;
39
+ exports.buildDraftPrompt = buildDraftPrompt;
40
+ exports.recordDraftImplementer = recordDraftImplementer;
41
+ exports.enforceDraftCommitSafety = enforceDraftCommitSafety;
42
+ exports.fallbackDraftCommitMessage = fallbackDraftCommitMessage;
43
+ exports.bootstrapBacklogTask = bootstrapBacklogTask;
44
+ exports.ensureGraphifyWorkspace = ensureGraphifyWorkspace;
45
+ exports.ensureGraphifyIgnore = ensureGraphifyIgnore;
46
+ exports.ensureMissionBranch = ensureMissionBranch;
47
+ exports.ensureMissionBaseBranchRecorded = ensureMissionBaseBranchRecorded;
48
+ exports.ensureWorktree = ensureWorktree;
49
+ exports.ensureMissionFile = ensureMissionFile;
50
+ exports.ensureDraftRepoConfigCommitted = ensureDraftRepoConfigCommitted;
51
+ exports.ensureRepoExists = ensureRepoExists;
52
+ exports.classifyDraftEntries = classifyDraftEntries;
53
+ exports.isUnmergedStatus = isUnmergedStatus;
54
+ exports.isDeletedStatus = isDeletedStatus;
55
+ exports.isMissionTaskPath = isMissionTaskPath;
56
+ exports.isExpectedDraftPath = isExpectedDraftPath;
57
+ exports.validateDraftClassification = validateDraftClassification;
58
+ exports.normalizeDraftClassification = normalizeDraftClassification;
59
+ exports.buildRestartPrompt = buildRestartPrompt;
60
+ exports.restartDraftAgent = restartDraftAgent;
35
61
  // @ts-nocheck
36
62
  const fs = __importStar(require("node:fs"));
37
63
  const path = __importStar(require("node:path"));
@@ -887,4 +913,8 @@ function recordDraftStats({ slug, rootDir, agentFamily, result, log = fmt.log.pl
887
913
  }
888
914
  /** @type {typeof draft & {draft: typeof draft, runDraftCommand: typeof runDraftCommand, recordDraftStats: typeof recordDraftStats, buildDraftPrompt: typeof buildDraftPrompt, recordDraftImplementer: typeof recordDraftImplementer, enforceDraftCommitSafety: typeof enforceDraftCommitSafety, fallbackDraftCommitMessage: typeof fallbackDraftCommitMessage, bootstrapBacklogTask: typeof bootstrapBacklogTask, ensureGraphifyWorkspace: typeof ensureGraphifyWorkspace, ensureGraphifyIgnore: typeof ensureGraphifyIgnore, ensureMissionBranch: typeof ensureMissionBranch, ensureMissionBaseBranchRecorded: typeof ensureMissionBaseBranchRecorded, ensureWorktree: typeof ensureWorktree, ensureMissionFile: typeof ensureMissionFile, ensureDraftRepoConfigCommitted: typeof ensureDraftRepoConfigCommitted, ensureRepoExists: typeof ensureRepoExists, classifyDraftEntries: typeof classifyDraftEntries, isUnmergedStatus: typeof isUnmergedStatus, isDeletedStatus: typeof isDeletedStatus, isMissionTaskPath: typeof isMissionTaskPath, isExpectedDraftPath: typeof isExpectedDraftPath, validateDraftClassification: typeof validateDraftClassification, normalizeDraftClassification: typeof normalizeDraftClassification, buildRestartPrompt: typeof buildRestartPrompt, restartDraftAgent: typeof restartDraftAgent}} */
889
915
  const _draftExport = Object.assign(draft, { draft, runDraftCommand, recordDraftStats, buildDraftPrompt, recordDraftImplementer, enforceDraftCommitSafety, fallbackDraftCommitMessage, bootstrapBacklogTask, ensureGraphifyWorkspace, ensureGraphifyIgnore, ensureMissionBranch, ensureMissionBaseBranchRecorded, ensureWorktree, ensureMissionFile, ensureDraftRepoConfigCommitted, ensureRepoExists, classifyDraftEntries, isUnmergedStatus, isDeletedStatus, isMissionTaskPath, isExpectedDraftPath, validateDraftClassification, normalizeDraftClassification, buildRestartPrompt, restartDraftAgent });
890
- module.exports = _draftExport;
916
+ exports.draft = _draftExport;
917
+ exports.default = _draftExport;
918
+ if (typeof module !== 'undefined') {
919
+ module.exports = _draftExport;
920
+ }
@@ -1018,4 +1018,9 @@ function recordDraftStats({ slug, rootDir, agentFamily, result, log = fmt.log.pl
1018
1018
 
1019
1019
  /** @type {typeof draft & {draft: typeof draft, runDraftCommand: typeof runDraftCommand, recordDraftStats: typeof recordDraftStats, buildDraftPrompt: typeof buildDraftPrompt, recordDraftImplementer: typeof recordDraftImplementer, enforceDraftCommitSafety: typeof enforceDraftCommitSafety, fallbackDraftCommitMessage: typeof fallbackDraftCommitMessage, bootstrapBacklogTask: typeof bootstrapBacklogTask, ensureGraphifyWorkspace: typeof ensureGraphifyWorkspace, ensureGraphifyIgnore: typeof ensureGraphifyIgnore, ensureMissionBranch: typeof ensureMissionBranch, ensureMissionBaseBranchRecorded: typeof ensureMissionBaseBranchRecorded, ensureWorktree: typeof ensureWorktree, ensureMissionFile: typeof ensureMissionFile, ensureDraftRepoConfigCommitted: typeof ensureDraftRepoConfigCommitted, ensureRepoExists: typeof ensureRepoExists, classifyDraftEntries: typeof classifyDraftEntries, isUnmergedStatus: typeof isUnmergedStatus, isDeletedStatus: typeof isDeletedStatus, isMissionTaskPath: typeof isMissionTaskPath, isExpectedDraftPath: typeof isExpectedDraftPath, validateDraftClassification: typeof validateDraftClassification, normalizeDraftClassification: typeof normalizeDraftClassification, buildRestartPrompt: typeof buildRestartPrompt, restartDraftAgent: typeof restartDraftAgent}} */
1020
1020
  const _draftExport = Object.assign(draft, { draft, runDraftCommand, recordDraftStats, buildDraftPrompt, recordDraftImplementer, enforceDraftCommitSafety, fallbackDraftCommitMessage, bootstrapBacklogTask, ensureGraphifyWorkspace, ensureGraphifyIgnore, ensureMissionBranch, ensureMissionBaseBranchRecorded, ensureWorktree, ensureMissionFile, ensureDraftRepoConfigCommitted, ensureRepoExists, classifyDraftEntries, isUnmergedStatus, isDeletedStatus, isMissionTaskPath, isExpectedDraftPath, validateDraftClassification, normalizeDraftClassification, buildRestartPrompt, restartDraftAgent });
1021
- export = _draftExport;
1021
+ export default _draftExport;
1022
+ export { _draftExport as draft, draft, runDraftCommand, recordDraftStats, buildDraftPrompt, recordDraftImplementer, enforceDraftCommitSafety, fallbackDraftCommitMessage, bootstrapBacklogTask, ensureGraphifyWorkspace, ensureGraphifyIgnore, ensureMissionBranch, ensureMissionBaseBranchRecorded, ensureWorktree, ensureMissionFile, ensureDraftRepoConfigCommitted, ensureRepoExists, classifyDraftEntries, isUnmergedStatus, isDeletedStatus, isMissionTaskPath, isExpectedDraftPath, validateDraftClassification, normalizeDraftClassification, buildRestartPrompt, restartDraftAgent };
1023
+
1024
+ // CJS compat: ensure require() returns the function directly
1025
+ declare const module: { exports: any } | undefined;
1026
+ if (typeof module !== 'undefined') { module.exports = _draftExport; }
@@ -32,6 +32,12 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.gatekeeper = exports.handoff = void 0;
37
+ exports.verifyHandoff = verifyHandoff;
38
+ exports.performHandoff = performHandoff;
39
+ exports.runDeclaredGates = runDeclaredGates;
40
+ exports.captureNelAtHandoff = captureNelAtHandoff;
35
41
  // @ts-nocheck
36
42
  const fs = __importStar(require("node:fs"));
37
43
  const path = __importStar(require("node:path"));
@@ -43,6 +49,7 @@ const forgejo = __importStar(require("../tools/forgejo.js"));
43
49
  const review_state_js_1 = require("../review/review-state.js");
44
50
  const setupReview = __importStar(require("../tools/setup-review.js"));
45
51
  const gatekeeper = __importStar(require("../tools/gatekeeper.js"));
52
+ exports.gatekeeper = gatekeeper;
46
53
  const fmt = __importStar(require("../core/fmt.js"));
47
54
  const verification_js_1 = require("../core/verification.js");
48
55
  const product_config_js_1 = require("../core/product-config.js");
@@ -666,4 +673,8 @@ const _exports = {
666
673
  const _namedExports = { verifyHandoff, performHandoff, gatekeeper, runDeclaredGates, captureNelAtHandoff };
667
674
  /** @type {typeof handoffCommand & {verifyHandoff: typeof verifyHandoff, performHandoff: typeof performHandoff, gatekeeper: typeof gatekeeper, runDeclaredGates: typeof runDeclaredGates, captureNelAtHandoff: typeof captureNelAtHandoff}} */
668
675
  const _handoffExport = Object.assign(handoffCommand, _namedExports);
669
- module.exports = _handoffExport;
676
+ exports.handoff = _handoffExport;
677
+ exports.default = _handoffExport;
678
+ if (typeof module !== 'undefined') {
679
+ module.exports = _handoffExport;
680
+ }
@@ -691,4 +691,9 @@ const _exports = {
691
691
  const _namedExports = { verifyHandoff, performHandoff, gatekeeper, runDeclaredGates, captureNelAtHandoff };
692
692
  /** @type {typeof handoffCommand & {verifyHandoff: typeof verifyHandoff, performHandoff: typeof performHandoff, gatekeeper: typeof gatekeeper, runDeclaredGates: typeof runDeclaredGates, captureNelAtHandoff: typeof captureNelAtHandoff}} */
693
693
  const _handoffExport = Object.assign(handoffCommand, _namedExports);
694
- export = _handoffExport;
694
+ export default _handoffExport;
695
+ export { _handoffExport as handoff, verifyHandoff, performHandoff, gatekeeper, runDeclaredGates, captureNelAtHandoff };
696
+
697
+ // CJS compat: ensure require() returns the function directly
698
+ declare const module: { exports: any } | undefined;
699
+ if (typeof module !== 'undefined') { module.exports = _handoffExport; }