@neurcode-ai/cli 0.10.1 → 0.12.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 (171) hide show
  1. package/.telemetry-bundle/dist/contracts.d.ts +1 -1
  2. package/README.md +74 -25
  3. package/dist/commands/remediate-export.js +1 -1
  4. package/dist/commands/replay.d.ts.map +1 -1
  5. package/dist/commands/replay.js +36 -0
  6. package/dist/commands/replay.js.map +1 -1
  7. package/dist/commands/verify-output.d.ts.map +1 -1
  8. package/dist/commands/verify-output.js +66 -4
  9. package/dist/commands/verify-output.js.map +1 -1
  10. package/dist/commands/verify.d.ts +22 -1
  11. package/dist/commands/verify.d.ts.map +1 -1
  12. package/dist/commands/verify.js +446 -34
  13. package/dist/commands/verify.js.map +1 -1
  14. package/dist/daemon/server.d.ts.map +1 -1
  15. package/dist/daemon/server.js +4 -0
  16. package/dist/daemon/server.js.map +1 -1
  17. package/dist/governance/intent/drift-detector.d.ts +100 -0
  18. package/dist/governance/intent/drift-detector.d.ts.map +1 -0
  19. package/dist/governance/intent/drift-detector.js +275 -0
  20. package/dist/governance/intent/drift-detector.js.map +1 -0
  21. package/dist/governance/intent/glob-match.d.ts +43 -0
  22. package/dist/governance/intent/glob-match.d.ts.map +1 -0
  23. package/dist/governance/intent/glob-match.js +108 -0
  24. package/dist/governance/intent/glob-match.js.map +1 -0
  25. package/dist/governance/intent/import-graph.d.ts +56 -0
  26. package/dist/governance/intent/import-graph.d.ts.map +1 -0
  27. package/dist/governance/intent/import-graph.js +133 -0
  28. package/dist/governance/intent/import-graph.js.map +1 -0
  29. package/dist/governance/intent/index.d.ts +23 -0
  30. package/dist/governance/intent/index.d.ts.map +1 -0
  31. package/dist/governance/intent/index.js +48 -0
  32. package/dist/governance/intent/index.js.map +1 -0
  33. package/dist/governance/intent/intelligence-boundaries.d.ts +69 -0
  34. package/dist/governance/intent/intelligence-boundaries.d.ts.map +1 -0
  35. package/dist/governance/intent/intelligence-boundaries.js +163 -0
  36. package/dist/governance/intent/intelligence-boundaries.js.map +1 -0
  37. package/dist/governance/intent/intent-contract.d.ts +76 -0
  38. package/dist/governance/intent/intent-contract.d.ts.map +1 -0
  39. package/dist/governance/intent/intent-contract.js +397 -0
  40. package/dist/governance/intent/intent-contract.js.map +1 -0
  41. package/dist/governance/intent/intent-graph.d.ts +135 -0
  42. package/dist/governance/intent/intent-graph.d.ts.map +1 -0
  43. package/dist/governance/intent/intent-graph.js +67 -0
  44. package/dist/governance/intent/intent-graph.js.map +1 -0
  45. package/dist/governance/pipeline/computation-trace.d.ts +52 -0
  46. package/dist/governance/pipeline/computation-trace.d.ts.map +1 -0
  47. package/dist/governance/pipeline/computation-trace.js +79 -0
  48. package/dist/governance/pipeline/computation-trace.js.map +1 -0
  49. package/dist/governance/pipeline/envelope-assembly.d.ts +132 -0
  50. package/dist/governance/pipeline/envelope-assembly.d.ts.map +1 -0
  51. package/dist/governance/pipeline/envelope-assembly.js +140 -0
  52. package/dist/governance/pipeline/envelope-assembly.js.map +1 -0
  53. package/dist/governance/pipeline/fingerprint.d.ts +34 -0
  54. package/dist/governance/pipeline/fingerprint.d.ts.map +1 -0
  55. package/dist/governance/pipeline/fingerprint.js +78 -0
  56. package/dist/governance/pipeline/fingerprint.js.map +1 -0
  57. package/dist/governance/pipeline/helpers.d.ts +74 -0
  58. package/dist/governance/pipeline/helpers.d.ts.map +1 -0
  59. package/dist/governance/pipeline/helpers.js +112 -0
  60. package/dist/governance/pipeline/helpers.js.map +1 -0
  61. package/dist/governance/pipeline/index.d.ts +27 -0
  62. package/dist/governance/pipeline/index.d.ts.map +1 -0
  63. package/dist/governance/pipeline/index.js +63 -0
  64. package/dist/governance/pipeline/index.js.map +1 -0
  65. package/dist/governance/pipeline/lineage.d.ts +26 -0
  66. package/dist/governance/pipeline/lineage.d.ts.map +1 -0
  67. package/dist/governance/pipeline/lineage.js +51 -0
  68. package/dist/governance/pipeline/lineage.js.map +1 -0
  69. package/dist/governance/pipeline/orchestration/advisory-mode-contract.d.ts +15 -0
  70. package/dist/governance/pipeline/orchestration/advisory-mode-contract.d.ts.map +1 -0
  71. package/dist/governance/pipeline/orchestration/advisory-mode-contract.js +44 -0
  72. package/dist/governance/pipeline/orchestration/advisory-mode-contract.js.map +1 -0
  73. package/dist/governance/pipeline/orchestration/advisory-mode.d.ts +102 -0
  74. package/dist/governance/pipeline/orchestration/advisory-mode.d.ts.map +1 -0
  75. package/dist/governance/pipeline/orchestration/advisory-mode.js +170 -0
  76. package/dist/governance/pipeline/orchestration/advisory-mode.js.map +1 -0
  77. package/dist/governance/pipeline/orchestration/evidence-lifecycle.d.ts +133 -0
  78. package/dist/governance/pipeline/orchestration/evidence-lifecycle.d.ts.map +1 -0
  79. package/dist/governance/pipeline/orchestration/evidence-lifecycle.js +125 -0
  80. package/dist/governance/pipeline/orchestration/evidence-lifecycle.js.map +1 -0
  81. package/dist/governance/pipeline/orchestration/index.d.ts +16 -0
  82. package/dist/governance/pipeline/orchestration/index.d.ts.map +1 -0
  83. package/dist/governance/pipeline/orchestration/index.js +30 -0
  84. package/dist/governance/pipeline/orchestration/index.js.map +1 -0
  85. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.d.ts +65 -0
  86. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.d.ts.map +1 -0
  87. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.js +102 -0
  88. package/dist/governance/pipeline/orchestration/intent-drift-orchestration.js.map +1 -0
  89. package/dist/governance/pipeline/orchestration/plan-structural-analysis.d.ts +41 -0
  90. package/dist/governance/pipeline/orchestration/plan-structural-analysis.d.ts.map +1 -0
  91. package/dist/governance/pipeline/orchestration/plan-structural-analysis.js +74 -0
  92. package/dist/governance/pipeline/orchestration/plan-structural-analysis.js.map +1 -0
  93. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.d.ts +165 -0
  94. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.d.ts.map +1 -0
  95. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.js +160 -0
  96. package/dist/governance/pipeline/orchestration/policy-evaluation-summaries.js.map +1 -0
  97. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.d.ts +152 -0
  98. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.d.ts.map +1 -0
  99. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.js +188 -0
  100. package/dist/governance/pipeline/orchestration/scope-guard-orchestration.js.map +1 -0
  101. package/dist/governance/pipeline/runtime.d.ts +70 -0
  102. package/dist/governance/pipeline/runtime.d.ts.map +1 -0
  103. package/dist/governance/pipeline/runtime.js +223 -0
  104. package/dist/governance/pipeline/runtime.js.map +1 -0
  105. package/dist/governance/pipeline/shared-types.d.ts +7 -0
  106. package/dist/governance/pipeline/shared-types.d.ts.map +1 -0
  107. package/dist/governance/pipeline/shared-types.js +7 -0
  108. package/dist/governance/pipeline/shared-types.js.map +1 -0
  109. package/dist/governance/pipeline/stages/compiled-policy-stage.d.ts +28 -0
  110. package/dist/governance/pipeline/stages/compiled-policy-stage.d.ts.map +1 -0
  111. package/dist/governance/pipeline/stages/compiled-policy-stage.js +53 -0
  112. package/dist/governance/pipeline/stages/compiled-policy-stage.js.map +1 -0
  113. package/dist/governance/pipeline/stages/diff-normalization-stage.d.ts +63 -0
  114. package/dist/governance/pipeline/stages/diff-normalization-stage.d.ts.map +1 -0
  115. package/dist/governance/pipeline/stages/diff-normalization-stage.js +140 -0
  116. package/dist/governance/pipeline/stages/diff-normalization-stage.js.map +1 -0
  117. package/dist/governance/pipeline/stages/governance-synthesis-stage.d.ts +53 -0
  118. package/dist/governance/pipeline/stages/governance-synthesis-stage.d.ts.map +1 -0
  119. package/dist/governance/pipeline/stages/governance-synthesis-stage.js +129 -0
  120. package/dist/governance/pipeline/stages/governance-synthesis-stage.js.map +1 -0
  121. package/dist/governance/pipeline/stages/index.d.ts +29 -0
  122. package/dist/governance/pipeline/stages/index.d.ts.map +1 -0
  123. package/dist/governance/pipeline/stages/index.js +40 -0
  124. package/dist/governance/pipeline/stages/index.js.map +1 -0
  125. package/dist/governance/pipeline/stages/policy-lock-stage.d.ts +31 -0
  126. package/dist/governance/pipeline/stages/policy-lock-stage.d.ts.map +1 -0
  127. package/dist/governance/pipeline/stages/policy-lock-stage.js +71 -0
  128. package/dist/governance/pipeline/stages/policy-lock-stage.js.map +1 -0
  129. package/dist/governance/pipeline/stages/runtime-guard-stage.d.ts +29 -0
  130. package/dist/governance/pipeline/stages/runtime-guard-stage.d.ts.map +1 -0
  131. package/dist/governance/pipeline/stages/runtime-guard-stage.js +65 -0
  132. package/dist/governance/pipeline/stages/runtime-guard-stage.js.map +1 -0
  133. package/dist/governance/pipeline/stages/structural-analysis-stage.d.ts +24 -0
  134. package/dist/governance/pipeline/stages/structural-analysis-stage.d.ts.map +1 -0
  135. package/dist/governance/pipeline/stages/structural-analysis-stage.js +58 -0
  136. package/dist/governance/pipeline/stages/structural-analysis-stage.js.map +1 -0
  137. package/dist/governance/pipeline/summary.d.ts +14 -0
  138. package/dist/governance/pipeline/summary.d.ts.map +1 -0
  139. package/dist/governance/pipeline/summary.js +50 -0
  140. package/dist/governance/pipeline/summary.js.map +1 -0
  141. package/dist/governance/pipeline/types.d.ts +69 -0
  142. package/dist/governance/pipeline/types.d.ts.map +1 -0
  143. package/dist/governance/pipeline/types.js +30 -0
  144. package/dist/governance/pipeline/types.js.map +1 -0
  145. package/dist/index.js +29 -0
  146. package/dist/index.js.map +1 -1
  147. package/dist/utils/active-engineering-context.d.ts +16 -0
  148. package/dist/utils/active-engineering-context.d.ts.map +1 -1
  149. package/dist/utils/active-engineering-context.js +302 -0
  150. package/dist/utils/active-engineering-context.js.map +1 -1
  151. package/dist/utils/import-edge-classifier.d.ts +76 -0
  152. package/dist/utils/import-edge-classifier.d.ts.map +1 -0
  153. package/dist/utils/import-edge-classifier.js +308 -0
  154. package/dist/utils/import-edge-classifier.js.map +1 -0
  155. package/dist/utils/import-edge-extractor.d.ts +52 -0
  156. package/dist/utils/import-edge-extractor.d.ts.map +1 -0
  157. package/dist/utils/import-edge-extractor.js +223 -0
  158. package/dist/utils/import-edge-extractor.js.map +1 -0
  159. package/dist/utils/import-edge-governance.d.ts +37 -0
  160. package/dist/utils/import-edge-governance.d.ts.map +1 -0
  161. package/dist/utils/import-edge-governance.js +56 -0
  162. package/dist/utils/import-edge-governance.js.map +1 -0
  163. package/dist/utils/path-boundary-classifier.d.ts +42 -0
  164. package/dist/utils/path-boundary-classifier.d.ts.map +1 -0
  165. package/dist/utils/path-boundary-classifier.js +143 -0
  166. package/dist/utils/path-boundary-classifier.js.map +1 -0
  167. package/dist/utils/replay-html-report.d.ts +29 -0
  168. package/dist/utils/replay-html-report.d.ts.map +1 -0
  169. package/dist/utils/replay-html-report.js +309 -0
  170. package/dist/utils/replay-html-report.js.map +1 -0
  171. package/package.json +2 -2
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Pipeline execution helpers.
4
+ *
5
+ * Compresses the repetitive verify.ts wire-in pattern:
6
+ *
7
+ * const stageResult = await runStage(stage, input, ctx);
8
+ * const value = stageResult.output ?? fallback(...);
9
+ *
10
+ * into a single named helper, while preserving:
11
+ * - the underlying determinism of the wrapped function
12
+ * - the staged-pipeline ledger receipt
13
+ * - the byte-for-byte fallback semantics on isolated stage failure
14
+ *
15
+ * These are explicitly NOT a generic workflow engine. They are minimal,
16
+ * typed helpers for the four governance-pipeline wire-in patterns we
17
+ * encountered in verify.ts.
18
+ *
19
+ * - runStageOrFallback — "stage failed, compute the same thing without staging"
20
+ * - runStageWithDegradedFallback — "stage succeeded but output was null; fall back"
21
+ * - stageReceiptOrCompute — "you only want a value; the receipt is bookkeeping"
22
+ * - getLastStageOutput — "read the most recent ledger entry for a stage"
23
+ *
24
+ * Replay invariant: when the stage succeeds, the helper returns the stage's
25
+ * output; the fallback is only used when the stage failed or produced null.
26
+ * The fallback MUST be byte-equivalent to the stage's execute body — that
27
+ * way semantics are preserved regardless of which branch ran.
28
+ */
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.runStageOrFallback = runStageOrFallback;
31
+ exports.runStageOrAsyncFallback = runStageOrAsyncFallback;
32
+ exports.runStageWithReceipt = runStageWithReceipt;
33
+ exports.stageReceiptOrCompute = stageReceiptOrCompute;
34
+ exports.stageDegradedOrFailed = stageDegradedOrFailed;
35
+ exports.enumerateNonSuccessStages = enumerateNonSuccessStages;
36
+ const runtime_1 = require("./runtime");
37
+ /**
38
+ * Run a stage and unwrap its output. If the stage failed or returned null,
39
+ * invoke the supplied fallback synchronously and use that value instead.
40
+ *
41
+ * The ledger always receives a receipt regardless of outcome — the fallback
42
+ * does not produce its own receipt (that would double-count).
43
+ */
44
+ async function runStageOrFallback(stage, input, ctx, fallback) {
45
+ const result = await (0, runtime_1.runStage)(stage, input, ctx);
46
+ if (result.output !== null && result.output !== undefined) {
47
+ return result.output;
48
+ }
49
+ return fallback();
50
+ }
51
+ /**
52
+ * Same as `runStageOrFallback`, but the fallback may be async (e.g. when it
53
+ * has to re-read from disk or call out to a sibling helper).
54
+ */
55
+ async function runStageOrAsyncFallback(stage, input, ctx, fallback) {
56
+ const result = await (0, runtime_1.runStage)(stage, input, ctx);
57
+ if (result.output !== null && result.output !== undefined) {
58
+ return result.output;
59
+ }
60
+ return fallback();
61
+ }
62
+ /**
63
+ * Run a stage and return both the unwrapped output AND the full receipt.
64
+ * Useful when the caller needs to consult the receipt (e.g. for failure
65
+ * surfacing) but doesn't want to write the unwrap boilerplate.
66
+ */
67
+ async function runStageWithReceipt(stage, input, ctx, fallback) {
68
+ const result = await (0, runtime_1.runStage)(stage, input, ctx);
69
+ const value = result.output !== null && result.output !== undefined
70
+ ? result.output
71
+ : fallback();
72
+ return { value, result };
73
+ }
74
+ /**
75
+ * If a stage has already run and produced output, return that. Otherwise run
76
+ * the supplied compute function (and DO NOT append a ledger entry — this is
77
+ * "look up or compute"). Used when verify.ts has already invoked a stage
78
+ * elsewhere and a later code path needs the same value without re-emitting.
79
+ */
80
+ function stageReceiptOrCompute(ctx, stageId, compute) {
81
+ const prior = (0, runtime_1.getStageResult)(ctx, stageId);
82
+ if (prior && prior.output !== null && prior.output !== undefined) {
83
+ return prior.output;
84
+ }
85
+ return compute();
86
+ }
87
+ /**
88
+ * Convenience: did a given stage record any non-success status in the ledger?
89
+ *
90
+ * Returns true when the stage ran and its status is `degraded` or `failed`.
91
+ * Returns false when the stage succeeded OR has not yet run.
92
+ */
93
+ function stageDegradedOrFailed(ctx, stageId) {
94
+ const prior = (0, runtime_1.getStageResult)(ctx, stageId);
95
+ if (!prior)
96
+ return false;
97
+ return prior.status === 'degraded' || prior.status === 'failed';
98
+ }
99
+ /**
100
+ * Convenience: enumerate all stages in the ledger that are NOT 'succeeded'.
101
+ * Used by computation-trace explainability helpers.
102
+ */
103
+ function enumerateNonSuccessStages(ctx) {
104
+ const out = [];
105
+ for (const entry of ctx.ledger) {
106
+ if (entry.status !== 'succeeded') {
107
+ out.push({ stageId: entry.stageId, status: entry.status });
108
+ }
109
+ }
110
+ return out;
111
+ }
112
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/governance/pipeline/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;AAmBH,gDAWC;AAMD,0DAWC;AAOD,kDAYC;AAQD,sDAUC;AAQD,sDAOC;AAMD,8DAUC;AAzGD,uCAAqD;AAErD;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,KAAyC,EACzC,KAAU,EACV,GAA8B,EAC9B,QAAoB;IAEpB,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAQ,EAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACjD,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1D,OAAO,MAAM,CAAC,MAAM,CAAC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OAA0B;IAE1B,MAAM,KAAK,GAAG,IAAA,wBAAc,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,SAAgB,yBAAyB,CACvC,GAA8B;IAE9B,MAAM,GAAG,GAAqF,EAAE,CAAC;IACjG,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Canonical Governance Pipeline — public surface.
3
+ *
4
+ * The pipeline transforms the verify orchestrator from a monolithic script
5
+ * into a staged, replayable, explainable runtime. Each stage:
6
+ * - has a stable identifier from `GovernanceStageId`
7
+ * - declares its determinism classification and boundary policy
8
+ * - emits a replay-ready receipt (fingerprints, timings, dependencies)
9
+ * - participates in computation-graph lineage via `producedByStage`
10
+ *
11
+ * Wire-level types live in `@neurcode-ai/contracts`. CLI-internal types
12
+ * (context, stage definitions) live alongside this module.
13
+ */
14
+ export type { GovernancePipelineContext, GovernancePipelineStage, } from './types';
15
+ export { OBSERVABILITY_BOUNDARY, STRICT_REQUIRED_BOUNDARY, } from './types';
16
+ export { createPipelineContext, getStageResult, GovernanceStageAbortedError, runPipeline, runStage, } from './runtime';
17
+ export type { RunStageOptions } from './runtime';
18
+ export { buildPipelineSummary } from './summary';
19
+ export { fingerprintStageSignal, stableStringify, } from './fingerprint';
20
+ export { groupFindingsByStage, stampFindingLineage, } from './lineage';
21
+ export { enumerateNonSuccessStages, runStageOrAsyncFallback, runStageOrFallback, runStageWithReceipt, stageDegradedOrFailed, stageReceiptOrCompute, } from './helpers';
22
+ export { buildComputationTrace, renderComputationTrace, type GovernanceComputationTrace, type GovernanceComputationTraceRow, } from './computation-trace';
23
+ export { buildPolicyOnlyCanonicalPayload, buildVerifyCanonicalPayload, type AiDebtSummaryFragment, type ChangeContractSummaryFragment, type CompiledPolicyMetadataFragment, type GovernancePayloadFragment, type IntentProofSummaryFragment, type PolicyDecisionFragment, type PolicyLockSummaryFragment, type PolicyOnlyCanonicalPayloadInput, type PolicyPackFragment, type RuntimeGuardSummaryFragment, type VerifyCanonicalPayloadInput, } from './envelope-assembly';
24
+ export * from './orchestration';
25
+ export type { PolicyOnlySource } from './shared-types';
26
+ export * from './stages';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/governance/pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,EACV,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,2BAA2B,EAC3B,WAAW,EACX,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,sBAAsB,EACtB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,GACnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,+BAA+B,EAC/B,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,cAAc,UAAU,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /**
3
+ * Canonical Governance Pipeline — public surface.
4
+ *
5
+ * The pipeline transforms the verify orchestrator from a monolithic script
6
+ * into a staged, replayable, explainable runtime. Each stage:
7
+ * - has a stable identifier from `GovernanceStageId`
8
+ * - declares its determinism classification and boundary policy
9
+ * - emits a replay-ready receipt (fingerprints, timings, dependencies)
10
+ * - participates in computation-graph lineage via `producedByStage`
11
+ *
12
+ * Wire-level types live in `@neurcode-ai/contracts`. CLI-internal types
13
+ * (context, stage definitions) live alongside this module.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.buildVerifyCanonicalPayload = exports.buildPolicyOnlyCanonicalPayload = exports.renderComputationTrace = exports.buildComputationTrace = exports.stageReceiptOrCompute = exports.stageDegradedOrFailed = exports.runStageWithReceipt = exports.runStageOrFallback = exports.runStageOrAsyncFallback = exports.enumerateNonSuccessStages = exports.stampFindingLineage = exports.groupFindingsByStage = exports.stableStringify = exports.fingerprintStageSignal = exports.buildPipelineSummary = exports.runStage = exports.runPipeline = exports.GovernanceStageAbortedError = exports.getStageResult = exports.createPipelineContext = exports.STRICT_REQUIRED_BOUNDARY = exports.OBSERVABILITY_BOUNDARY = void 0;
31
+ var types_1 = require("./types");
32
+ Object.defineProperty(exports, "OBSERVABILITY_BOUNDARY", { enumerable: true, get: function () { return types_1.OBSERVABILITY_BOUNDARY; } });
33
+ Object.defineProperty(exports, "STRICT_REQUIRED_BOUNDARY", { enumerable: true, get: function () { return types_1.STRICT_REQUIRED_BOUNDARY; } });
34
+ var runtime_1 = require("./runtime");
35
+ Object.defineProperty(exports, "createPipelineContext", { enumerable: true, get: function () { return runtime_1.createPipelineContext; } });
36
+ Object.defineProperty(exports, "getStageResult", { enumerable: true, get: function () { return runtime_1.getStageResult; } });
37
+ Object.defineProperty(exports, "GovernanceStageAbortedError", { enumerable: true, get: function () { return runtime_1.GovernanceStageAbortedError; } });
38
+ Object.defineProperty(exports, "runPipeline", { enumerable: true, get: function () { return runtime_1.runPipeline; } });
39
+ Object.defineProperty(exports, "runStage", { enumerable: true, get: function () { return runtime_1.runStage; } });
40
+ var summary_1 = require("./summary");
41
+ Object.defineProperty(exports, "buildPipelineSummary", { enumerable: true, get: function () { return summary_1.buildPipelineSummary; } });
42
+ var fingerprint_1 = require("./fingerprint");
43
+ Object.defineProperty(exports, "fingerprintStageSignal", { enumerable: true, get: function () { return fingerprint_1.fingerprintStageSignal; } });
44
+ Object.defineProperty(exports, "stableStringify", { enumerable: true, get: function () { return fingerprint_1.stableStringify; } });
45
+ var lineage_1 = require("./lineage");
46
+ Object.defineProperty(exports, "groupFindingsByStage", { enumerable: true, get: function () { return lineage_1.groupFindingsByStage; } });
47
+ Object.defineProperty(exports, "stampFindingLineage", { enumerable: true, get: function () { return lineage_1.stampFindingLineage; } });
48
+ var helpers_1 = require("./helpers");
49
+ Object.defineProperty(exports, "enumerateNonSuccessStages", { enumerable: true, get: function () { return helpers_1.enumerateNonSuccessStages; } });
50
+ Object.defineProperty(exports, "runStageOrAsyncFallback", { enumerable: true, get: function () { return helpers_1.runStageOrAsyncFallback; } });
51
+ Object.defineProperty(exports, "runStageOrFallback", { enumerable: true, get: function () { return helpers_1.runStageOrFallback; } });
52
+ Object.defineProperty(exports, "runStageWithReceipt", { enumerable: true, get: function () { return helpers_1.runStageWithReceipt; } });
53
+ Object.defineProperty(exports, "stageDegradedOrFailed", { enumerable: true, get: function () { return helpers_1.stageDegradedOrFailed; } });
54
+ Object.defineProperty(exports, "stageReceiptOrCompute", { enumerable: true, get: function () { return helpers_1.stageReceiptOrCompute; } });
55
+ var computation_trace_1 = require("./computation-trace");
56
+ Object.defineProperty(exports, "buildComputationTrace", { enumerable: true, get: function () { return computation_trace_1.buildComputationTrace; } });
57
+ Object.defineProperty(exports, "renderComputationTrace", { enumerable: true, get: function () { return computation_trace_1.renderComputationTrace; } });
58
+ var envelope_assembly_1 = require("./envelope-assembly");
59
+ Object.defineProperty(exports, "buildPolicyOnlyCanonicalPayload", { enumerable: true, get: function () { return envelope_assembly_1.buildPolicyOnlyCanonicalPayload; } });
60
+ Object.defineProperty(exports, "buildVerifyCanonicalPayload", { enumerable: true, get: function () { return envelope_assembly_1.buildVerifyCanonicalPayload; } });
61
+ __exportStar(require("./orchestration"), exports);
62
+ __exportStar(require("./stages"), exports);
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/governance/pipeline/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;AAMH,iCAGiB;AAFf,+GAAA,sBAAsB,OAAA;AACtB,iHAAA,wBAAwB,OAAA;AAE1B,qCAMmB;AALjB,gHAAA,qBAAqB,OAAA;AACrB,yGAAA,cAAc,OAAA;AACd,sHAAA,2BAA2B,OAAA;AAC3B,sGAAA,WAAW,OAAA;AACX,mGAAA,QAAQ,OAAA;AAGV,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA;AAC7B,6CAGuB;AAFrB,qHAAA,sBAAsB,OAAA;AACtB,8GAAA,eAAe,OAAA;AAEjB,qCAGmB;AAFjB,+GAAA,oBAAoB,OAAA;AACpB,8GAAA,mBAAmB,OAAA;AAErB,qCAOmB;AANjB,oHAAA,yBAAyB,OAAA;AACzB,kHAAA,uBAAuB,OAAA;AACvB,6GAAA,kBAAkB,OAAA;AAClB,8GAAA,mBAAmB,OAAA;AACnB,gHAAA,qBAAqB,OAAA;AACrB,gHAAA,qBAAqB,OAAA;AAEvB,yDAK6B;AAJ3B,0HAAA,qBAAqB,OAAA;AACrB,2HAAA,sBAAsB,OAAA;AAIxB,yDAc6B;AAb3B,oIAAA,+BAA+B,OAAA;AAC/B,gIAAA,2BAA2B,OAAA;AAa7B,kDAAgC;AAEhC,2CAAyB"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Governance computation lineage helpers.
3
+ *
4
+ * Stamps a `producedByStage` lineage marker onto canonical findings without
5
+ * mutating their identity (id, severity, evidence) or replay checksum inputs.
6
+ *
7
+ * Use case: after a stage has emitted a set of findings, call
8
+ * `stampFindingLineage(findings, stageId)` to annotate them. This is purely
9
+ * observability — the canonical pipeline's stripping/sort/dedup logic remains
10
+ * authoritative for what reaches the envelope.
11
+ */
12
+ import type { GovernanceFinding, GovernanceStageId } from '@neurcode-ai/contracts';
13
+ /**
14
+ * Mutates each finding in place to attach `provenanceMetadata.producedByStage`.
15
+ * If a finding already has a stage stamp from an earlier wrapper, the existing
16
+ * value is preserved (closest stage wins).
17
+ *
18
+ * Returns the same array reference for chaining.
19
+ */
20
+ export declare function stampFindingLineage(findings: GovernanceFinding[], stageId: GovernanceStageId): GovernanceFinding[];
21
+ /**
22
+ * Read-only view: group findings by the stage that produced them.
23
+ * Findings with no lineage stamp are bucketed under '<unattributed>'.
24
+ */
25
+ export declare function groupFindingsByStage(findings: readonly GovernanceFinding[]): Map<string, GovernanceFinding[]>;
26
+ //# sourceMappingURL=lineage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../../../src/governance/pipeline/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,OAAO,EAAE,iBAAiB,GACzB,iBAAiB,EAAE,CAWrB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GACrC,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CASlC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * Governance computation lineage helpers.
4
+ *
5
+ * Stamps a `producedByStage` lineage marker onto canonical findings without
6
+ * mutating their identity (id, severity, evidence) or replay checksum inputs.
7
+ *
8
+ * Use case: after a stage has emitted a set of findings, call
9
+ * `stampFindingLineage(findings, stageId)` to annotate them. This is purely
10
+ * observability — the canonical pipeline's stripping/sort/dedup logic remains
11
+ * authoritative for what reaches the envelope.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.stampFindingLineage = stampFindingLineage;
15
+ exports.groupFindingsByStage = groupFindingsByStage;
16
+ /**
17
+ * Mutates each finding in place to attach `provenanceMetadata.producedByStage`.
18
+ * If a finding already has a stage stamp from an earlier wrapper, the existing
19
+ * value is preserved (closest stage wins).
20
+ *
21
+ * Returns the same array reference for chaining.
22
+ */
23
+ function stampFindingLineage(findings, stageId) {
24
+ for (const f of findings) {
25
+ if (!f.provenanceMetadata) {
26
+ f.provenanceMetadata = { producedByStage: stageId };
27
+ continue;
28
+ }
29
+ if (!f.provenanceMetadata.producedByStage) {
30
+ f.provenanceMetadata.producedByStage = stageId;
31
+ }
32
+ }
33
+ return findings;
34
+ }
35
+ /**
36
+ * Read-only view: group findings by the stage that produced them.
37
+ * Findings with no lineage stamp are bucketed under '<unattributed>'.
38
+ */
39
+ function groupFindingsByStage(findings) {
40
+ const map = new Map();
41
+ for (const f of findings) {
42
+ const key = f.provenanceMetadata?.producedByStage ?? '<unattributed>';
43
+ const list = map.get(key);
44
+ if (list)
45
+ list.push(f);
46
+ else
47
+ map.set(key, [f]);
48
+ }
49
+ return map;
50
+ }
51
+ //# sourceMappingURL=lineage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineage.js","sourceRoot":"","sources":["../../../src/governance/pipeline/lineage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAcH,kDAcC;AAMD,oDAWC;AAtCD;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,QAA6B,EAC7B,OAA0B;IAE1B,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC;YAC1B,CAAC,CAAC,kBAAkB,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;YACpD,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;YAC1C,CAAC,CAAC,kBAAkB,CAAC,eAAe,GAAG,OAAO,CAAC;QACjD,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,QAAsC;IAEtC,MAAM,GAAG,GAAG,IAAI,GAAG,EAA+B,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,CAAC,CAAC,kBAAkB,EAAE,eAAe,IAAI,gBAAgB,CAAC;QACtE,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YAClB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Advisory-mode auto-contract construction.
3
+ *
4
+ * Builds a minimal `ChangeContract` for the advisory-first branch when no
5
+ * change contract exists. Extracted from `commands/verify.ts:6769` as part of
6
+ * the advisory-mode orchestration extraction.
7
+ *
8
+ * The contract is intentionally permissive (all `enforce*` flags false) — it
9
+ * captures "what changed" as a baseline so subsequent runs have something
10
+ * to compare against, without imposing enforcement.
11
+ */
12
+ import type { DiffFile } from '@neurcode-ai/diff-parser';
13
+ import { createChangeContract } from '../../../utils/change-contract';
14
+ export declare function buildMinimalAdvisoryContractFromDiff(diffFiles: ReadonlyArray<DiffFile>, fallbackPlanId: string): ReturnType<typeof createChangeContract>;
15
+ //# sourceMappingURL=advisory-mode-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advisory-mode-contract.d.ts","sourceRoot":"","sources":["../../../../src/governance/pipeline/orchestration/advisory-mode-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAMtE,wBAAgB,oCAAoC,CAClD,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,EAClC,cAAc,EAAE,MAAM,GACrB,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAyBzC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * Advisory-mode auto-contract construction.
4
+ *
5
+ * Builds a minimal `ChangeContract` for the advisory-first branch when no
6
+ * change contract exists. Extracted from `commands/verify.ts:6769` as part of
7
+ * the advisory-mode orchestration extraction.
8
+ *
9
+ * The contract is intentionally permissive (all `enforce*` flags false) — it
10
+ * captures "what changed" as a baseline so subsequent runs have something
11
+ * to compare against, without imposing enforcement.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.buildMinimalAdvisoryContractFromDiff = buildMinimalAdvisoryContractFromDiff;
15
+ const change_contract_1 = require("../../../utils/change-contract");
16
+ function toUnixPath(filePath) {
17
+ return filePath.replace(/\\/g, '/');
18
+ }
19
+ function buildMinimalAdvisoryContractFromDiff(diffFiles, fallbackPlanId) {
20
+ const expectedFiles = [...new Set(diffFiles.map(file => toUnixPath(file.path)).filter(Boolean))];
21
+ const planFiles = expectedFiles.map(path => {
22
+ const entry = diffFiles.find(file => toUnixPath(file.path) === path);
23
+ const changeType = entry?.changeType;
24
+ const action = changeType === 'add' ? 'CREATE' : 'MODIFY';
25
+ return {
26
+ path,
27
+ action: action,
28
+ reason: 'Auto-generated advisory baseline from current diff',
29
+ };
30
+ });
31
+ return (0, change_contract_1.createChangeContract)({
32
+ planId: fallbackPlanId,
33
+ intent: 'Advisory baseline generated from current repository diff',
34
+ expectedFiles,
35
+ planFiles,
36
+ options: {
37
+ enforceExpectedFiles: false,
38
+ enforceActionMatching: false,
39
+ enforceExpectedSymbols: false,
40
+ enforceSymbolActionMatching: false,
41
+ },
42
+ });
43
+ }
44
+ //# sourceMappingURL=advisory-mode-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advisory-mode-contract.js","sourceRoot":"","sources":["../../../../src/governance/pipeline/orchestration/advisory-mode-contract.ts"],"names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branch previously inlined at
5
+ * `commands/verify.ts:4161–4321`.
6
+ *
7
+ * RESPONSIBILITIES (data-pure):
8
+ * - resolve auto-contract path when no change-contract is present
9
+ * - evaluate advisory signals (with runtime-pressure gating)
10
+ * - run structural rules (via the existing structural-analysis stage)
11
+ * - compute verdict / grade / score
12
+ * - assemble the advisory canonical payload
13
+ *
14
+ * EXPLICITLY NOT RESPONSIBLE FOR:
15
+ * - human-readable rendering (caller owns chalk + printFirstRunAdvisoryMessage)
16
+ * - emitting verify JSON (caller owns emitVerifyJson + emitCanonicalVerifyJson)
17
+ * - recording telemetry verdict (caller owns recordVerifyEvent)
18
+ * - calling exitWithEvidence (caller owns process termination)
19
+ *
20
+ * SEMANTIC PRESERVATION:
21
+ * The output `payload` is byte-equivalent to the prior inline literal at
22
+ * line ~4276 (the `emitVerifyJson({...})` call). Field order matches the
23
+ * inline implementation so JSON serialization is identical.
24
+ *
25
+ * REPLAY INVARIANT:
26
+ * - structural-analysis stage call is identical to the prior wire-in
27
+ * - advisory signals evaluation is identical to the prior call
28
+ * - structural-engine fault swallowing is preserved (try/swallow in compute)
29
+ */
30
+ import { type AdvisorySignal } from '../../../utils/advisory-signals';
31
+ import { type VerifyRuntimeContext } from '../../../utils/verify-runtime-stability';
32
+ import type { GovernancePipelineContext } from '../types';
33
+ import type { DiffFile } from '@neurcode-ai/diff-parser';
34
+ import type { DiffSummary } from '@neurcode-ai/diff-parser';
35
+ import type { StructuralViolation } from '../../../structural-rules/types';
36
+ /**
37
+ * Mode-specific subset of `ChangeContractSummary` consumed by this module.
38
+ * Defined narrowly to avoid coupling to verify.ts's internal interface.
39
+ *
40
+ * Field types match the verify.ts `ChangeContractSummary` (notably
41
+ * `valid: boolean | null` and an optional/loose `coverage` shape) so we can
42
+ * pass the summary through without explicit casts.
43
+ */
44
+ export interface AdvisoryChangeContractSummary {
45
+ path: string;
46
+ exists: boolean;
47
+ enforced: boolean;
48
+ valid: boolean | null;
49
+ planId: string | null;
50
+ contractId: string | null;
51
+ coverage?: Record<string, number> | unknown;
52
+ signature?: unknown;
53
+ violations: ReadonlyArray<unknown>;
54
+ }
55
+ export interface AdvisoryModeInput {
56
+ options: {
57
+ json?: boolean;
58
+ changeContract?: string;
59
+ demo?: boolean;
60
+ };
61
+ projectRoot: string;
62
+ diffFiles: DiffFile[];
63
+ summary: DiffSummary;
64
+ runtimeCtx: VerifyRuntimeContext;
65
+ changeContractRead: {
66
+ contract: unknown;
67
+ };
68
+ changeContractSummary: AdvisoryChangeContractSummary;
69
+ strictArtifactMode: boolean;
70
+ pipelineCtx: GovernancePipelineContext;
71
+ }
72
+ export interface AdvisoryModeResult {
73
+ /** Canonical payload ready to be passed to emitVerifyJson. */
74
+ payload: Record<string, unknown>;
75
+ /** Verdict for `recordVerifyEvent`. */
76
+ telemetry: {
77
+ verdict: 'WARN' | 'PASS';
78
+ detail: string;
79
+ files: string[];
80
+ };
81
+ /** Path of auto-generated change contract, when one was written. */
82
+ autoContractPath: string | null;
83
+ /** Auto-generated message text shown both in JSON and human modes. */
84
+ message: string;
85
+ /** Updated change-contract summary when an auto-contract was written. */
86
+ updatedChangeContractSummary: AdvisoryChangeContractSummary;
87
+ /** Advisory signals (forwarded to human render). */
88
+ advisorySignals: AdvisorySignal[];
89
+ /** Structural findings (advisory). */
90
+ advisoryStructuralViolations: StructuralViolation[];
91
+ /** Count of BLOCKING-severity structural findings in advisory mode. */
92
+ advisoryStructuralBlockingCount: number;
93
+ /** True when the advisory-signals layer was skipped due to runtime pressure. */
94
+ advisorySignalsSkipped: boolean;
95
+ }
96
+ /**
97
+ * Compute the advisory-mode result. Replaces the inline compute region.
98
+ *
99
+ * Does not emit JSON, does not log, does not exit.
100
+ */
101
+ export declare function runAdvisoryMode(input: AdvisoryModeInput): Promise<AdvisoryModeResult>;
102
+ //# sourceMappingURL=advisory-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advisory-mode.d.ts","sourceRoot":"","sources":["../../../../src/governance/pipeline/orchestration/adv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