loopforge 3.7.0 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +171 -157
  3. package/dist/audit.d.ts +53 -1
  4. package/dist/audit.d.ts.map +1 -1
  5. package/dist/audit.js +106 -22
  6. package/dist/audit.js.map +1 -1
  7. package/dist/canonical-state.d.ts +75 -69
  8. package/dist/canonical-state.d.ts.map +1 -1
  9. package/dist/canonical-state.js +276 -168
  10. package/dist/canonical-state.js.map +1 -1
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +111 -12
  13. package/dist/cli.js.map +1 -1
  14. package/dist/cognitive-facts.d.ts +13 -0
  15. package/dist/cognitive-facts.d.ts.map +1 -1
  16. package/dist/cognitive-facts.js +30 -16
  17. package/dist/cognitive-facts.js.map +1 -1
  18. package/dist/cognitive-governance.d.ts +30 -6
  19. package/dist/cognitive-governance.d.ts.map +1 -1
  20. package/dist/cognitive-governance.js +74 -18
  21. package/dist/cognitive-governance.js.map +1 -1
  22. package/dist/committed-round.d.ts +109 -24
  23. package/dist/committed-round.d.ts.map +1 -1
  24. package/dist/committed-round.js +235 -52
  25. package/dist/committed-round.js.map +1 -1
  26. package/dist/contract-items.d.ts +55 -0
  27. package/dist/contract-items.d.ts.map +1 -0
  28. package/dist/contract-items.js +180 -0
  29. package/dist/contract-items.js.map +1 -0
  30. package/dist/enforcement-gate.d.ts +43 -20
  31. package/dist/enforcement-gate.d.ts.map +1 -1
  32. package/dist/enforcement-gate.js +269 -378
  33. package/dist/enforcement-gate.js.map +1 -1
  34. package/dist/engine.d.ts +11 -6
  35. package/dist/engine.d.ts.map +1 -1
  36. package/dist/engine.js +102 -67
  37. package/dist/engine.js.map +1 -1
  38. package/dist/evidence-claims.d.ts +4 -4
  39. package/dist/evidence-claims.d.ts.map +1 -1
  40. package/dist/evidence-claims.js +16 -14
  41. package/dist/evidence-claims.js.map +1 -1
  42. package/dist/evidence-provider.d.ts +91 -90
  43. package/dist/evidence-provider.d.ts.map +1 -1
  44. package/dist/evidence-provider.js +349 -160
  45. package/dist/evidence-provider.js.map +1 -1
  46. package/dist/explain.d.ts +76 -0
  47. package/dist/explain.d.ts.map +1 -0
  48. package/dist/explain.js +127 -0
  49. package/dist/explain.js.map +1 -0
  50. package/dist/generate-schema.js +250 -53
  51. package/dist/generate-schema.js.map +1 -1
  52. package/dist/index.d.ts +8 -7
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +7 -6
  55. package/dist/index.js.map +1 -1
  56. package/dist/loop-compiler.d.ts +41 -40
  57. package/dist/loop-compiler.d.ts.map +1 -1
  58. package/dist/loop-compiler.js +275 -515
  59. package/dist/loop-compiler.js.map +1 -1
  60. package/dist/loop-extras-parser.d.ts +0 -1
  61. package/dist/loop-extras-parser.d.ts.map +1 -1
  62. package/dist/loop-extras-parser.js +0 -4
  63. package/dist/loop-extras-parser.js.map +1 -1
  64. package/dist/loop-projection.d.ts.map +1 -1
  65. package/dist/loop-projection.js +3 -1
  66. package/dist/loop-projection.js.map +1 -1
  67. package/dist/mcp/round-lifecycle.d.ts +40 -21
  68. package/dist/mcp/round-lifecycle.d.ts.map +1 -1
  69. package/dist/mcp/round-lifecycle.js +173 -120
  70. package/dist/mcp/round-lifecycle.js.map +1 -1
  71. package/dist/mcp/server.d.ts.map +1 -1
  72. package/dist/mcp/server.js +63 -10
  73. package/dist/mcp/server.js.map +1 -1
  74. package/dist/mcp/session.d.ts +53 -7
  75. package/dist/mcp/session.d.ts.map +1 -1
  76. package/dist/mcp/session.js +240 -139
  77. package/dist/mcp/session.js.map +1 -1
  78. package/dist/mcp/submission-boundary.d.ts +89 -0
  79. package/dist/mcp/submission-boundary.d.ts.map +1 -0
  80. package/dist/mcp/submission-boundary.js +203 -0
  81. package/dist/mcp/submission-boundary.js.map +1 -0
  82. package/dist/mcp/tools.d.ts.map +1 -1
  83. package/dist/mcp/tools.js +377 -125
  84. package/dist/mcp/tools.js.map +1 -1
  85. package/dist/policy-metrics.js +2 -2
  86. package/dist/policy-metrics.js.map +1 -1
  87. package/dist/policy.d.ts +65 -95
  88. package/dist/policy.d.ts.map +1 -1
  89. package/dist/policy.js +151 -39
  90. package/dist/policy.js.map +1 -1
  91. package/dist/prompt-assembler.d.ts +7 -33
  92. package/dist/prompt-assembler.d.ts.map +1 -1
  93. package/dist/prompt-assembler.js +313 -473
  94. package/dist/prompt-assembler.js.map +1 -1
  95. package/dist/prompt-policy.d.ts +1 -4
  96. package/dist/prompt-policy.d.ts.map +1 -1
  97. package/dist/prompt-policy.js +6 -7
  98. package/dist/prompt-policy.js.map +1 -1
  99. package/dist/protocol.d.ts +411 -168
  100. package/dist/protocol.d.ts.map +1 -1
  101. package/dist/protocol.js +23 -69
  102. package/dist/protocol.js.map +1 -1
  103. package/dist/replay.js +2 -2
  104. package/dist/replay.js.map +1 -1
  105. package/dist/round-contract.d.ts +69 -57
  106. package/dist/round-contract.d.ts.map +1 -1
  107. package/dist/round-contract.js +104 -64
  108. package/dist/round-contract.js.map +1 -1
  109. package/dist/round-coordinator.d.ts +55 -16
  110. package/dist/round-coordinator.d.ts.map +1 -1
  111. package/dist/round-coordinator.js +179 -57
  112. package/dist/round-coordinator.js.map +1 -1
  113. package/dist/round-driver.d.ts +7 -5
  114. package/dist/round-driver.d.ts.map +1 -1
  115. package/dist/round-driver.js +2 -1
  116. package/dist/round-driver.js.map +1 -1
  117. package/dist/round-facts.d.ts +96 -0
  118. package/dist/round-facts.d.ts.map +1 -0
  119. package/dist/round-facts.js +216 -0
  120. package/dist/round-facts.js.map +1 -0
  121. package/dist/round-transaction.d.ts +23 -9
  122. package/dist/round-transaction.d.ts.map +1 -1
  123. package/dist/round-transaction.js +99 -22
  124. package/dist/round-transaction.js.map +1 -1
  125. package/dist/self-eval.d.ts +127 -11
  126. package/dist/self-eval.d.ts.map +1 -1
  127. package/dist/self-eval.js +517 -36
  128. package/dist/self-eval.js.map +1 -1
  129. package/dist/subgoal-state.d.ts +77 -0
  130. package/dist/subgoal-state.d.ts.map +1 -0
  131. package/dist/subgoal-state.js +198 -0
  132. package/dist/subgoal-state.js.map +1 -0
  133. package/dist/token-utils.d.ts +52 -19
  134. package/dist/token-utils.d.ts.map +1 -1
  135. package/dist/token-utils.js +83 -72
  136. package/dist/token-utils.js.map +1 -1
  137. package/dist/verification-gate.d.ts +27 -46
  138. package/dist/verification-gate.d.ts.map +1 -1
  139. package/dist/verification-gate.js +308 -557
  140. package/dist/verification-gate.js.map +1 -1
  141. package/dist/version.d.ts +5 -0
  142. package/dist/version.d.ts.map +1 -0
  143. package/dist/version.js +5 -0
  144. package/dist/version.js.map +1 -0
  145. package/dist/workspace.d.ts +9 -0
  146. package/dist/workspace.d.ts.map +1 -1
  147. package/dist/workspace.js +17 -0
  148. package/dist/workspace.js.map +1 -1
  149. package/loop_policy.json +17 -25
  150. package/package.json +7 -7
  151. package/skills/perception/SKILL.md +266 -64
@@ -7,7 +7,7 @@
7
7
  * audit and handoff purposes.
8
8
  *
9
9
  * Rules (honesty first — machine evidence is the only upgrade path):
10
- * - every `success_criteria_met` entry is a claim, `claimed` by default;
10
+ * - every met `criterion_claims` entry is a claim, `claimed` by default;
11
11
  * - upgraded to `verified` only when a machine-verifiable test pass is
12
12
  * observed (test results with 0 failures AND a passed after-phase
13
13
  * command snapshot);
@@ -15,7 +15,7 @@
15
15
  * the machine contradicted the claim.
16
16
  */
17
17
  import type { VaultEntry } from "./loop-store.js";
18
- import type { ProviderSnapshot } from "./evidence-provider.js";
18
+ import type { MachineObservation } from "./protocol.js";
19
19
  import type { SelfEvaluation, VerificationFlag } from "./protocol.js";
20
20
  export interface DerivedClaim {
21
21
  /** Success criterion text as reported by the agent. */
@@ -35,11 +35,11 @@ export interface ClaimView {
35
35
  }
36
36
  /** Derive the runtime claim view for a round. No file-level or text-level
37
37
  * guessing: git observations only serve the evidence_integrity warn. */
38
- export declare function deriveClaimView(selfEval: SelfEvaluation, evidenceSnapshots: ProviderSnapshot[]): ClaimView;
38
+ export declare function deriveClaimView(selfEval: SelfEvaluation, evidenceSnapshots: MachineObservation[]): ClaimView;
39
39
  /** Re-derive a claim view including the contradiction downgrade driven by
40
40
  * verification flags. Used by audit and listVerifiedClaims on persisted
41
41
  * snapshots; the live round path uses deriveClaimView only. */
42
- export declare function rederiveClaimViewWithFlags(selfEval: SelfEvaluation, evidenceSnapshots: ProviderSnapshot[], flags: VerificationFlag[]): ClaimView;
42
+ export declare function rederiveClaimViewWithFlags(selfEval: SelfEvaluation, evidenceSnapshots: MachineObservation[], flags: VerificationFlag[]): ClaimView;
43
43
  /** Files actually changed in a committed round (git provider, after evidence
44
44
  * preferred). Returns null when the round has no observable git snapshot. */
45
45
  export declare function resolveRoundFiles(vaultEntries: VaultEntry[], loopId: string, round: number): string[] | null;
@@ -1 +1 @@
1
- {"version":3,"file":"evidence-claims.d.ts","sourceRoot":"","sources":["../src/evidence-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;IAChD,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,cAAc,CAAC;IAC1D,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MA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;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AA2BD;yEACyE;AACzE,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,cAAc,EACxB,iBAAiB,EAAE,kBAAkB,EAAE,GACtC,SAAS,CAoBX;AAED;;gEAEgE;AAChE,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,cAAc,EACxB,iBAAiB,EAAE,kBAAkB,EAAE,EACvC,KAAK,EAAE,gBAAgB,EAAE,GACxB,SAAS,CAcX;AAED;8EAC8E;AAC9E,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,UAAU,EAAE,EAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,EAAE,GAAG,IAAI,CAUjB;AAED;;iEAEiE;AACjE,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,UAAU,EAAE,EAC1B,MAAM,EAAE,MAAM,GACb,MAAM,EAAE,CAeV"}
@@ -7,15 +7,16 @@
7
7
  * audit and handoff purposes.
8
8
  *
9
9
  * Rules (honesty first — machine evidence is the only upgrade path):
10
- * - every `success_criteria_met` entry is a claim, `claimed` by default;
10
+ * - every met `criterion_claims` entry is a claim, `claimed` by default;
11
11
  * - upgraded to `verified` only when a machine-verifiable test pass is
12
12
  * observed (test results with 0 failures AND a passed after-phase
13
13
  * command snapshot);
14
14
  * - downgraded to `contradicted` when error-level verification flags say
15
15
  * the machine contradicted the claim.
16
16
  */
17
- import { committedRoundsFromEntries, machineEvidenceForRound } from "./committed-round.js";
18
- import { isRecord } from "./token-utils.js";
17
+ import { machineEvidenceForRound, readOnlyRounds } from "./committed-round.js";
18
+ import { isPassedAfterObservation } from "./evidence-provider.js";
19
+ import { claimedMetCriteria } from "./self-eval.js";
19
20
  /** Contradicting error flags that invalidate agent claims. */
20
21
  // NOTE: keep these as literals — importing the CHECK_* constants here would
21
22
  // create a verification-gate ⇄ evidence-claims import cycle.
@@ -25,22 +26,23 @@ const CONTRADICTING_CHECKS = new Set([
25
26
  "success_with_remaining_criteria",
26
27
  ]);
27
28
  function hasPassingTestEvidence(selfEval) {
28
- const results = selfEval.execution_evidence?.test_results;
29
+ const results = selfEval.execution_report?.tests_reported;
29
30
  return results !== null &&
30
31
  results !== undefined &&
31
32
  results.failed === 0 &&
32
33
  results.passed > 0;
33
34
  }
34
- function hasPassedAfterCommand(snapshots) {
35
- return snapshots.some((snapshot) => isRecord(snapshot.data) &&
36
- snapshot.data.kind === "command" &&
37
- snapshot.data.phase === "after" &&
38
- snapshot.data.status === "passed");
35
+ function hasPassedAfterCommand(observations) {
36
+ // v3.8: ONE predicate — the gate's entrypoint-tamper exclusion and this
37
+ // module's check were two divergent definitions of "machine-backed".
38
+ const git = observations.find((item) => item.providerId === "git") ?? null;
39
+ const changed = git ? new Set(git.files) : null;
40
+ return observations.some((item) => isPassedAfterObservation(item, changed));
39
41
  }
40
42
  /** Derive the runtime claim view for a round. No file-level or text-level
41
43
  * guessing: git observations only serve the evidence_integrity warn. */
42
44
  export function deriveClaimView(selfEval, evidenceSnapshots) {
43
- const met = selfEval.execution_evidence?.success_criteria_met ?? [];
45
+ const met = claimedMetCriteria(selfEval.execution_report);
44
46
  const machineVerified = hasPassingTestEvidence(selfEval) &&
45
47
  hasPassedAfterCommand(evidenceSnapshots);
46
48
  const claims = met.map((targetId) => ({
@@ -53,7 +55,7 @@ export function deriveClaimView(selfEval, evidenceSnapshots) {
53
55
  verifiedCount: claims.filter((claim) => claim.status === "verified").length,
54
56
  contradictedCount: 0,
55
57
  // v3.3: machine evidence requires a passed after-phase command observed
56
- // by the runtime itself — the agent's self-reported test_results are a
58
+ // by the runtime itself — the agent's self-reported tests_reported are a
57
59
  // claim, not evidence. Without a passed command, R8 and the
58
60
  // criteria-claims check can no longer be satisfied by fabrication.
59
61
  hasMachineEvidence: hasPassingTestEvidence(selfEval) &&
@@ -80,12 +82,12 @@ export function rederiveClaimViewWithFlags(selfEval, evidenceSnapshots, flags) {
80
82
  /** Files actually changed in a committed round (git provider, after evidence
81
83
  * preferred). Returns null when the round has no observable git snapshot. */
82
84
  export function resolveRoundFiles(vaultEntries, loopId, round) {
83
- const committed = committedRoundsFromEntries(vaultEntries)
85
+ const committed = readOnlyRounds(vaultEntries)
84
86
  .find((view) => view.loopId === loopId && view.round === round);
85
87
  if (!committed)
86
88
  return null;
87
89
  const evidence = machineEvidenceForRound(committed);
88
- const git = evidence.find((item) => isRecord(item) && item.provider === "git" && Array.isArray(item.files));
90
+ const git = evidence.find((item) => item.providerId === "git" && Array.isArray(item.files));
89
91
  if (!git)
90
92
  return null;
91
93
  return git.files.filter((file) => typeof file === "string");
@@ -95,7 +97,7 @@ export function resolveRoundFiles(vaultEntries, loopId, round) {
95
97
  * know the objective; this returns the raw verified targets. */
96
98
  export function listVerifiedClaims(vaultEntries, loopId) {
97
99
  const verified = new Set();
98
- for (const round of committedRoundsFromEntries(vaultEntries)) {
100
+ for (const round of readOnlyRounds(vaultEntries)) {
99
101
  if (round.loopId !== loopId || !round.evaluation)
100
102
  continue;
101
103
  const evidence = machineEvidenceForRound(round);
@@ -1 +1 @@
1
- {"version":3,"file":"evidence-claims.js","sourceRoot":"","sources":["../src/evidence-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG3F,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAmB5C,8DAA8D;AAC9D,4EAA4E;AAC5E,6DAA6D;AAC7D,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,yBAAyB;IACzB,2BAA2B;IAC3B,iCAAiC;CAClC,CAAC,CAAC;AAEH,SAAS,sBAAsB,CAAC,QAAwB;IACtD,MAAM,OAAO,GAAG,QAAQ,CAAC,kBAAkB,EAAE,YAAY,CAAC;IAC1D,OAAO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AC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;AACvB,CAAC"}
@@ -1,25 +1,16 @@
1
- /** EvidenceProvider — Pluggable evidence capture interface (v1.18).
1
+ /** EvidenceProvider — Pluggable machine-observation capture (v1.18 / v3.8).
2
2
  *
3
- * This module defines an abstract EvidenceProvider interface so
4
- * additional evidence sources (test runners, linters, bundle analysis)
5
- * can be added without touching the verification pipeline.
3
+ * v3.8: providers produce `MachineObservation`s, not ad-hoc snapshots. A
4
+ * configured provider ALWAYS yields an observation: unavailability, timeouts,
5
+ * errors and aborts are recorded as observations with the matching status and
6
+ * are never silently filtered out of the round's factual record. Only
7
+ * observations can create a `verified` fact — agent self-reports never can.
6
8
  *
7
- * Built-in provider: GitEvidenceProvider — git file state capture with
8
- * parallel async execution (v2.0.1) and a synchronous fallback.
9
+ * Built-in: GitEvidenceProvider — git file state capture with parallel async
10
+ * execution (v2.0.1), plus explicitly configured shell-free command providers.
9
11
  */
10
- import type { CommandEvidencePolicy } from "./policy.js";
11
- /** A snapshot of evidence captured by a single provider. */
12
- export interface ProviderSnapshot {
13
- /** Provider name (e.g. "git", "jest", "eslint"). */
14
- provider: string;
15
- /** Unix-ms timestamp of capture. */
16
- timestamp: number;
17
- /** File paths relevant to this evidence (for backward compat with
18
- * runtimeFilesChanged). */
19
- files: string[];
20
- /** Provider-specific structured data. */
21
- data: Record<string, unknown>;
22
- }
12
+ import type { CommandObservation, ConfiguredCapability, EvidenceCapability, GitObservation, MachineObservation, ObservedCapability } from "./protocol.js";
13
+ import type { CommandEvidencePolicy, LoopPolicy } from "./policy.js";
23
14
  /** Interface for evidence capture providers.
24
15
  *
25
16
  * Implementations may be synchronous or asynchronous. Async implementations
@@ -30,13 +21,19 @@ export interface EvidenceCaptureContext {
30
21
  timeoutMs: number;
31
22
  loopId?: string;
32
23
  phase: "before" | "after";
24
+ /** Workspace root override (tests capture against temp repos). */
25
+ cwd?: string;
33
26
  }
34
- export type EvidenceCaptureResult = ProviderSnapshot | null | Promise<ProviderSnapshot | null>;
27
+ export type EvidenceCaptureResult = MachineObservation | null | Promise<MachineObservation | null>;
35
28
  export interface EvidenceProvider {
36
29
  /** Unique provider name. Used in policy to enable/disable. */
37
30
  readonly name: string;
38
- /** Capture evidence. Returns null if the provider is unavailable
39
- * (e.g. git not installed, no test config found). */
31
+ /** Observation kind this provider produces (used for the synthetic
32
+ * unavailable/timeout/error observations too). */
33
+ readonly kind: MachineObservation["kind"];
34
+ /** Capture an observation. Returns null when the provider is structurally
35
+ * unavailable (e.g. not a git repository); the collector converts that
36
+ * into an explicit `unavailable` observation rather than dropping it. */
40
37
  capture(context?: EvidenceCaptureContext): EvidenceCaptureResult;
41
38
  }
42
39
  export interface EvidenceCollectOptions {
@@ -48,52 +45,74 @@ export type EvidenceProviderFactory = () => EvidenceProvider;
48
45
  /** Register a provider factory used by policy-driven collectors. */
49
46
  export declare function registerEvidenceProvider(name: string, factory: EvidenceProviderFactory): void;
50
47
  export declare function unregisterEvidenceProvider(name: string): boolean;
51
- /** Collects evidence from all configured providers (always async — the
52
- * synchronous collect() was removed in v3.7).
48
+ /** v3.8: Whether a provider factory is registered for this name. Readiness
49
+ * of the RUNTIME (PATH resolution, executables) is a `doctor` concern and is
50
+ * deliberately not part of the hashed capability. */
51
+ export declare function isProviderRegistered(name: string): boolean;
52
+ /** v3.8: The ONE machine-backed predicate. A command observation proves a
53
+ * claim only when it is an after-phase command that PASSED and whose
54
+ * entrypoint was not modified in the same round. Before-phase observations
55
+ * are the baseline and never evidence. When no git delta is available the
56
+ * entrypoint arm fails open (matching the historical behaviour).
53
57
  *
54
- * Usage:
55
- * const collector = new EvidenceCollector([new GitEvidenceProvider()]);
56
- * const snapshots = await collector.collectAsync({ phase: "before" });
57
- * // snapshots = [{ provider: "git", files: [...], data: {...} }]
58
- */
58
+ * v3.8 replaced two divergent implementations (the gate excluded tampered
59
+ * commands, evidence-claims did not) with this single function. */
60
+ export declare function isPassedAfterObservation(observation: MachineObservation, gitChangedFiles: ReadonlySet<string> | null): boolean;
61
+ /** v3.8: The changed-file set of a round's git observation, or null when no
62
+ * git observation exists (entrypoint checks then fail open). */
63
+ export declare function gitChangedFiles(observations: ReadonlyArray<MachineObservation>): Set<string> | null;
64
+ /** v3.8: Live capability derived from observations. Rendered only — never
65
+ * hashed, never persisted independently (it is a pure function of the
66
+ * observations it is given). */
67
+ export declare function deriveObservedCapability(observations: ReadonlyArray<MachineObservation>, configured: ConfiguredCapability): ObservedCapability;
68
+ /** v3.8: Human-readable capability warnings for start/resume/status. A loop
69
+ * with no machine verification can still run — its success claims are simply
70
+ * recorded as `insufficient` instead of `verified`. */
71
+ export declare function capabilityWarnings(configured: ConfiguredCapability, observed?: ObservedCapability): string[];
72
+ /** v3.8: The ONE capability derivation. Everything that speaks about
73
+ * capability — `RoundDriver.prepare()`, MCP start/resume/next/status, the
74
+ * capability warnings — reads this, so the surfaces cannot drift into
75
+ * different stories about what the runtime can observe.
76
+ *
77
+ * `available` is provider-REGISTRY state (code, not policy): it is rendered
78
+ * and reported by `doctor`, never hashed. The hashed half stays
79
+ * `deriveConfiguredCapability(policy)` inside the canonical state. */
80
+ export declare function deriveEvidenceCapability(policy: LoopPolicy, observations?: ReadonlyArray<MachineObservation>): EvidenceCapability;
81
+ /** Collects observations from all configured providers (always async).
82
+ *
83
+ * v3.8: every configured provider produces exactly one observation per
84
+ * collection. A provider that returns null, throws, times out, or is aborted
85
+ * yields an observation with `unavailable` / `error` / `timeout` / `aborted`
86
+ * — the round's factual record keeps the gap instead of hiding it. */
59
87
  export declare class EvidenceCollector {
60
88
  private providers;
61
89
  constructor(providers: EvidenceProvider[]);
62
- /** Build the collector described by loop_policy.json. Unknown provider
63
- * names are ignored so newer configs remain backward compatible. */
90
+ /** Build the collector described by loop_policy.json. Every configured name
91
+ * yields exactly one provider, in configuration order: a name with no
92
+ * registered factory gets `unregisteredProvider`, which records
93
+ * `unavailable` rather than letting a configured provider vanish without a
94
+ * trace. */
64
95
  static fromProviderNames(providerNames: string[]): EvidenceCollector;
65
96
  /** Build built-ins and explicitly configured command providers. */
66
97
  static fromPolicy(): EvidenceCollector;
67
98
  /** Capture all providers concurrently with per-provider timeout isolation. */
68
- collectAsync(options?: EvidenceCollectOptions): Promise<ProviderSnapshot[]>;
69
- }
70
- export interface CommandEvidenceData extends Record<string, unknown> {
71
- kind: "command";
72
- commandName: string;
73
- required: boolean;
74
- phase: "before" | "after";
75
- status: "passed" | "failed" | "timeout" | "missing" | "invalid_cwd" | "aborted";
76
- exitCode: number | null;
77
- signal: string | null;
78
- durationMs: number;
79
- stdout: string;
80
- stderr: string;
81
- truncated: boolean;
82
- /** v3.3: Workspace files this command depends on (resolved at capture
83
- * time from executable + args, plus package.json). The verification gate
84
- * cross-checks these against the round's git diff to detect verification
85
- * domain tampering — a command whose entrypoint changed this round is not
86
- * trustworthy. Forward-slash paths (git convention). Empty = unresolvable
87
- * (external command like `bash -c`) — the gate fails open. */
88
- entrypointFiles: string[];
99
+ collectAsync(options?: EvidenceCollectOptions): Promise<MachineObservation[]>;
89
100
  }
101
+ /** The workspace files a command's execution depends on, resolved
102
+ * statically: the script it names on its own command line, plus package.json
103
+ * when a package manager is what runs it. Exported for the pure-function
104
+ * test — spawning a real package manager is not portable (a bare `npm`
105
+ * cannot be spawned without a shell, and the runtime uses `shell: false`). */
106
+ export declare function resolveEntrypointFiles(executable: string, args: string[], cwd: string): string[];
90
107
  /** Explicit, shell-free verification command. Disabled unless configured. */
91
108
  export declare class CommandEvidenceProvider implements EvidenceProvider {
92
109
  readonly name: string;
110
+ readonly kind: "command";
93
111
  private readonly config;
112
+ private readonly configHash;
94
113
  constructor(config: CommandEvidencePolicy);
95
- capture(context?: EvidenceCaptureContext): Promise<ProviderSnapshot | null>;
96
- private snapshot;
114
+ capture(context?: EvidenceCaptureContext): Promise<CommandObservation | null>;
115
+ private observation;
97
116
  }
98
117
  /** v1.17: Result of capturing git file state across all three categories. */
99
118
  export interface GitFileState {
@@ -119,44 +138,26 @@ export interface GitFileState {
119
138
  * Performance: wall-clock time is max(single-command), not sum(3).
120
139
  * On a normal repo (~200ms/command): ~200ms vs ~600ms sequential.
121
140
  * On Windows with antivirus (~4s/command): ~4s vs ~12s sequential. */
122
- export declare function captureGitFileStateAsync(signal?: AbortSignal, timeoutMs?: number): Promise<GitFileState | null>;
123
- /** v3.7: async capture only — the synchronous captureGitFileState() fallback
124
- * was removed together with the sync lifecycle (prepareSync). */
141
+ export declare function captureGitFileStateAsync(signal?: AbortSignal, timeoutMs?: number,
142
+ /** Workspace root; injectable so tests can capture against a temp repo.
143
+ * Defaults to the process cwd, matching the evidence providers. */
144
+ cwd?: string): Promise<GitFileState | null>;
125
145
  export declare class GitEvidenceProvider implements EvidenceProvider {
126
146
  readonly name = "git";
127
- capture(context?: EvidenceCaptureContext): Promise<ProviderSnapshot | null>;
147
+ readonly kind: "git";
148
+ capture(context?: EvidenceCaptureContext): Promise<GitObservation | null>;
128
149
  }
129
- /** Extract merged file list from evidence snapshots for backward compat
130
- * with runtimeFilesChanged (string[] | null).
131
- *
132
- * Looks for the "git" provider first; falls back to merging all
133
- * providers' files arrays (deduplicated). */
134
- export declare function extractFilesFromSnapshots(snapshots: ProviderSnapshot[]): string[] | null;
135
- /** Return provider snapshots narrowed to evidence produced during this round.
136
- * The full provider payload remains available in data, while files contains
137
- * only added/removed/content-changed paths. */
138
- export declare function diffSnapshotCollections(before: ProviderSnapshot[], after: ProviderSnapshot[]): ProviderSnapshot[];
139
- export declare function diffSnapshots(before: ProviderSnapshot[], after: ProviderSnapshot[]): string[] | null;
140
- /** v3.3.1: Implement the v2.13 policy switch `engine.backtrack_auto_restore` —
141
- * automatically restore the workspace after a backtrack:
142
- * 1. `git stash push -u` — every uncommitted change (tracked + untracked)
143
- * is preserved in a stash, never destroyed (an untracked file the agent
144
- * created in the failed rounds is not silently deleted).
145
- * 2. `git reset --hard <restoreHead>` — when the failed rounds created
146
- * commits, discard them back to the clean round's commit (the v2.12
147
- * restore-point HEAD).
150
+ /** Extract merged file list from observations for backward compat with
151
+ * runtimeFilesChanged (string[] | null).
148
152
  *
149
- * Runs only inside the workspace (cwd, shell: false, 30s timeout), and the
150
- * caller gates it behind the policy flag — DANGEROUS by design, off by
151
- * default. Failures are reported, never thrown: the verification gate still
152
- * checks workspace cleanliness afterwards, and the backtrack prompt already
153
- * instructs manual restore as the fallback. An empty workspace ("No local
154
- * changes") is not a failure. */
155
- export declare function runBacktrackAutoRestore(gitHead: string | undefined, round: number,
156
- /** v3.3.1: workspace root; injectable so tests can run against a temp
157
- * repo. Defaults to the process cwd, matching the evidence providers. */
158
- cwd?: string): Promise<{
159
- ok: boolean;
160
- detail: string;
161
- }>;
153
+ * Looks for the "git" provider first; falls back to merging all providers'
154
+ * files arrays (deduplicated). */
155
+ export declare function extractFilesFromSnapshots(observations: MachineObservation[]): string[] | null;
156
+ /** v3.8: The round delta of two observation collections (before → after):
157
+ * files that appeared, disappeared, or changed content. The full payload of
158
+ * each after-observation is preserved; only `files` is narrowed. This is the
159
+ * single derivation the transaction persists and every reader consumes. */
160
+ export declare function diffSnapshotCollections(before: MachineObservation[], after: MachineObservation[]): MachineObservation[];
161
+ /** Compute a diff between two observation collections (before → after). */
162
+ export declare function diffSnapshots(before: MachineObservation[], after: MachineObservation[]): string[] | null;
162
163
  //# sourceMappingURL=evidence-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evidence-provider.d.ts","sourceRoot":"","sources":["../src/evidence-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAMzD,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB;gCAC4B;IAC5B,KAAK,EAAE,MAA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