opencode-swarm 7.114.9 → 7.116.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 (139) hide show
  1. package/README.md +3 -1
  2. package/dist/cli/{config-doctor-jy3mdh9t.js → config-doctor-htzxe394.js} +2 -2
  3. package/dist/cli/{curator-5xt89z05.js → curator-7s5yw6hw.js} +18 -17
  4. package/dist/cli/{curator-llm-factory-pnhvf3s3.js → curator-llm-factory-x96dr0zf.js} +18 -17
  5. package/dist/cli/{dispatch-mczsxy5s.js → dispatch-07jgc3hn.js} +1 -1
  6. package/dist/cli/{evidence-summary-service-fehwj116.js → evidence-summary-service-ef6kgtev.js} +5 -5
  7. package/dist/cli/{gate-evidence-vkpqt300.js → gate-evidence-thqt0beq.js} +4 -4
  8. package/dist/cli/{guardrail-explain-7aztgtyh.js → guardrail-explain-kwqfkwch.js} +19 -18
  9. package/dist/cli/{guardrail-log-84wnx273.js → guardrail-log-dzbqcgz9.js} +3 -3
  10. package/dist/cli/{hive-promoter-q899q2m6.js → hive-promoter-rkkx40qv.js} +18 -17
  11. package/dist/cli/{index-54sevh81.js → index-3b8n3dbd.js} +30 -22
  12. package/dist/cli/{index-8f2270hc.js → index-3yh67t1h.js} +3 -3
  13. package/dist/cli/{index-4sckv7y6.js → index-42cx6g2h.js} +9 -4
  14. package/dist/cli/index-4905hd2m.js +19 -0
  15. package/dist/cli/{index-4h2ea8h5.js → index-81vzywh3.js} +2 -2
  16. package/dist/cli/{index-6f6y2rbp.js → index-8bvh0qfa.js} +3 -3
  17. package/dist/cli/{index-yfedche9.js → index-8j5d3ytd.js} +1 -1
  18. package/dist/cli/{index-80jkseqw.js → index-a6f8b0vn.js} +1 -1
  19. package/dist/cli/{index-0p660a87.js → index-bbsaxnj5.js} +1 -1
  20. package/dist/cli/{index-yrrqs4b0.js → index-cnrhj56z.js} +1160 -47
  21. package/dist/cli/{index-n18yy0z1.js → index-jyetmzcn.js} +3 -3
  22. package/dist/cli/{index-rk6qhyng.js → index-k5ey429j.js} +4 -4
  23. package/dist/cli/{index-7jmrbp68.js → index-m43zgtjn.js} +1 -1
  24. package/dist/cli/{index-9bsmzfk3.js → index-m7hc7nn7.js} +5 -1
  25. package/dist/cli/{index-typ408f4.js → index-me46ffm2.js} +6811 -1947
  26. package/dist/cli/{index-ga4ta3cr.js → index-nprawcc0.js} +7 -1
  27. package/dist/cli/{index-a45jq4b7.js → index-nvc0nsvg.js} +6 -1
  28. package/dist/cli/{index-pa6t33pt.js → index-q2rrv0cy.js} +11 -0
  29. package/dist/cli/{index-g40r5d08.js → index-qgeeyy75.js} +1 -1
  30. package/dist/cli/{index-x12hvfpf.js → index-s385axt1.js} +3 -3
  31. package/dist/cli/{index-m9m7p49w.js → index-tvgvb5pa.js} +2 -2
  32. package/dist/cli/index.js +18 -17
  33. package/dist/cli/{knowledge-escalator-5gwp1ar8.js → knowledge-escalator-0bq62d34.js} +7 -7
  34. package/dist/cli/{knowledge-events-m304swh6.js → knowledge-events-cwwky393.js} +5 -5
  35. package/dist/cli/{knowledge-store-9babt8rd.js → knowledge-store-q8x4h82m.js} +5 -5
  36. package/dist/cli/{knowledge-validator-t9sym59g.js → knowledge-validator-zr0djm02.js} +6 -6
  37. package/dist/cli/{pending-delegations-ddbkbgxy.js → pending-delegations-rr9x47rd.js} +2 -2
  38. package/dist/cli/{pr-subscriptions-vwv7zm2p.js → pr-subscriptions-cny2jz2d.js} +3 -3
  39. package/dist/cli/runtime-ykafcwc6.js +3397 -0
  40. package/dist/cli/{schema-aymfdrsb.js → schema-bqn7g3ez.js} +3 -1
  41. package/dist/cli/{skill-generator-tav44xpm.js → skill-generator-mz267btk.js} +8 -8
  42. package/dist/cli/{telemetry-jny76r83.js → telemetry-qh78ymq4.js} +1 -1
  43. package/dist/commands/archive.d.ts +4 -4
  44. package/dist/commands/command-dispatch.d.ts +2 -0
  45. package/dist/commands/gate-audit.d.ts +28 -0
  46. package/dist/commands/gate-stats.d.ts +1 -0
  47. package/dist/commands/index.d.ts +4 -0
  48. package/dist/commands/registry.d.ts +19 -2
  49. package/dist/config/index.d.ts +2 -2
  50. package/dist/config/plan-schema.d.ts +7 -7
  51. package/dist/config/schema.d.ts +9 -0
  52. package/dist/evaluation/contracts.d.ts +545 -0
  53. package/dist/evaluation/disposable-worktree.d.ts +38 -0
  54. package/dist/evaluation/fixtures.d.ts +8 -0
  55. package/dist/evaluation/gate-audit.d.ts +32 -0
  56. package/dist/evaluation/gate-ground-truth.d.ts +43 -0
  57. package/dist/evaluation/gate-stats.d.ts +47 -0
  58. package/dist/evaluation/hashing.d.ts +34 -0
  59. package/dist/evaluation/index.d.ts +17 -0
  60. package/dist/evaluation/model-dispatcher.d.ts +30 -0
  61. package/dist/evaluation/public-api.d.ts +87 -0
  62. package/dist/evaluation/retention.d.ts +56 -0
  63. package/dist/evaluation/runner.d.ts +48 -0
  64. package/dist/evaluation/statistics.d.ts +9 -0
  65. package/dist/evaluation/store.d.ts +26 -0
  66. package/dist/evidence/manager.d.ts +18 -0
  67. package/dist/index.d.ts +4 -0
  68. package/dist/index.js +497 -450
  69. package/dist/mutation/engine.d.ts +29 -5
  70. package/dist/telemetry.d.ts +11 -1
  71. package/dist/tools/apply-patch.d.ts +21 -0
  72. package/dist/tools/plugin-registration.d.ts +2 -1
  73. package/dist/tools/sast-scan.d.ts +9 -0
  74. package/dist/tools/swarm-command.d.ts +2 -1
  75. package/dist/tools/update-task-status.d.ts +16 -4
  76. package/dist/utils/external-tool-runner.d.ts +2 -1
  77. package/dist/utils/fuzzy-match.d.ts +115 -0
  78. package/dist/utils/sequence-matcher.d.ts +83 -0
  79. package/evaluation-fixtures/tier1/boundary-error/environment/baseline.ts +3 -0
  80. package/evaluation-fixtures/tier1/boundary-error/environment/defect.test.ts +3 -0
  81. package/evaluation-fixtures/tier1/boundary-error/environment/defect.ts +3 -0
  82. package/evaluation-fixtures/tier1/boundary-error/instruction.md +1 -0
  83. package/evaluation-fixtures/tier1/boundary-error/manifest.json +1 -0
  84. package/evaluation-fixtures/tier1/branch-swap/environment/baseline.ts +3 -0
  85. package/evaluation-fixtures/tier1/branch-swap/environment/defect.test.ts +3 -0
  86. package/evaluation-fixtures/tier1/branch-swap/environment/defect.ts +3 -0
  87. package/evaluation-fixtures/tier1/branch-swap/instruction.md +1 -0
  88. package/evaluation-fixtures/tier1/branch-swap/manifest.json +1 -0
  89. package/evaluation-fixtures/tier1/curated-off-by-one/environment/baseline.ts +3 -0
  90. package/evaluation-fixtures/tier1/curated-off-by-one/environment/defect.test.ts +3 -0
  91. package/evaluation-fixtures/tier1/curated-off-by-one/environment/defect.ts +3 -0
  92. package/evaluation-fixtures/tier1/curated-off-by-one/instruction.md +1 -0
  93. package/evaluation-fixtures/tier1/curated-off-by-one/manifest.json +1 -0
  94. package/evaluation-fixtures/tier1/guard-removal/environment/baseline.ts +3 -0
  95. package/evaluation-fixtures/tier1/guard-removal/environment/defect.test.ts +3 -0
  96. package/evaluation-fixtures/tier1/guard-removal/environment/defect.ts +3 -0
  97. package/evaluation-fixtures/tier1/guard-removal/instruction.md +1 -0
  98. package/evaluation-fixtures/tier1/guard-removal/manifest.json +1 -0
  99. package/evaluation-fixtures/tier1/injection-prone-string/environment/baseline.ts +3 -0
  100. package/evaluation-fixtures/tier1/injection-prone-string/environment/defect.test.ts +3 -0
  101. package/evaluation-fixtures/tier1/injection-prone-string/environment/defect.ts +3 -0
  102. package/evaluation-fixtures/tier1/injection-prone-string/instruction.md +1 -0
  103. package/evaluation-fixtures/tier1/injection-prone-string/manifest.json +1 -0
  104. package/evaluation-fixtures/tier1/missing-auth-check/environment/baseline.ts +4 -0
  105. package/evaluation-fixtures/tier1/missing-auth-check/environment/defect.test.ts +3 -0
  106. package/evaluation-fixtures/tier1/missing-auth-check/environment/defect.ts +3 -0
  107. package/evaluation-fixtures/tier1/missing-auth-check/instruction.md +1 -0
  108. package/evaluation-fixtures/tier1/missing-auth-check/manifest.json +1 -0
  109. package/evaluation-fixtures/tier1/missing-await/environment/baseline.ts +7 -0
  110. package/evaluation-fixtures/tier1/missing-await/environment/defect.test.ts +3 -0
  111. package/evaluation-fixtures/tier1/missing-await/environment/defect.ts +4 -0
  112. package/evaluation-fixtures/tier1/missing-await/instruction.md +1 -0
  113. package/evaluation-fixtures/tier1/missing-await/manifest.json +1 -0
  114. package/evaluation-fixtures/tier1/mutation-off-by-one/environment/baseline.ts +3 -0
  115. package/evaluation-fixtures/tier1/mutation-off-by-one/environment/defect.test.ts +3 -0
  116. package/evaluation-fixtures/tier1/mutation-off-by-one/environment/defect.ts +3 -0
  117. package/evaluation-fixtures/tier1/mutation-off-by-one/instruction.md +1 -0
  118. package/evaluation-fixtures/tier1/mutation-off-by-one/manifest.json +1 -0
  119. package/evaluation-fixtures/tier1/null-substitution/environment/baseline.ts +3 -0
  120. package/evaluation-fixtures/tier1/null-substitution/environment/defect.test.ts +3 -0
  121. package/evaluation-fixtures/tier1/null-substitution/environment/defect.ts +3 -0
  122. package/evaluation-fixtures/tier1/null-substitution/instruction.md +1 -0
  123. package/evaluation-fixtures/tier1/null-substitution/manifest.json +1 -0
  124. package/evaluation-fixtures/tier1/operator-swap/environment/baseline.ts +3 -0
  125. package/evaluation-fixtures/tier1/operator-swap/environment/defect.test.ts +3 -0
  126. package/evaluation-fixtures/tier1/operator-swap/environment/defect.ts +3 -0
  127. package/evaluation-fixtures/tier1/operator-swap/instruction.md +1 -0
  128. package/evaluation-fixtures/tier1/operator-swap/manifest.json +1 -0
  129. package/evaluation-fixtures/tier1/side-effect-deletion/environment/baseline.ts +4 -0
  130. package/evaluation-fixtures/tier1/side-effect-deletion/environment/defect.test.ts +3 -0
  131. package/evaluation-fixtures/tier1/side-effect-deletion/environment/defect.ts +3 -0
  132. package/evaluation-fixtures/tier1/side-effect-deletion/instruction.md +1 -0
  133. package/evaluation-fixtures/tier1/side-effect-deletion/manifest.json +1 -0
  134. package/evaluation-fixtures/tier1/swallowed-error/environment/baseline.ts +3 -0
  135. package/evaluation-fixtures/tier1/swallowed-error/environment/defect.test.ts +3 -0
  136. package/evaluation-fixtures/tier1/swallowed-error/environment/defect.ts +3 -0
  137. package/evaluation-fixtures/tier1/swallowed-error/instruction.md +1 -0
  138. package/evaluation-fixtures/tier1/swallowed-error/manifest.json +1 -0
  139. package/package.json +2 -1
@@ -0,0 +1,47 @@
1
+ import type { GateName } from './contracts.js';
2
+ export type GateModelStatistics = {
3
+ model: string;
4
+ gate: GateName;
5
+ total: number;
6
+ caught: number;
7
+ missed: number;
8
+ falseRejections: number;
9
+ negativeControls: number;
10
+ infrastructureFailures: number;
11
+ unsupported: number;
12
+ catchRate: number | null;
13
+ confidenceInterval: [number, number] | null;
14
+ falseRejectionRate: number | null;
15
+ falseRejectionConfidenceInterval: [number, number] | null;
16
+ insufficientData: boolean;
17
+ retries: {
18
+ total: number;
19
+ maximum: number;
20
+ };
21
+ cost: {
22
+ usd: number;
23
+ unavailable: number;
24
+ };
25
+ };
26
+ export type ReviewerTelemetryStatistics = {
27
+ parsed: number;
28
+ skipped: number;
29
+ genuine: number;
30
+ fallback: number;
31
+ dataQuality: number;
32
+ blocked: number;
33
+ fallbackToGenuineRatio: number | null;
34
+ };
35
+ export type GateStatisticsReport = {
36
+ runs: number;
37
+ corruptRuns: string[];
38
+ groundTruth: {
39
+ parsed: number;
40
+ malformed: number;
41
+ ambiguous: number;
42
+ unjoined: number;
43
+ };
44
+ models: GateModelStatistics[];
45
+ reviewerTelemetry: ReviewerTelemetryStatistics;
46
+ };
47
+ export declare function computeGateStatistics(directory: string, minSamples?: number, runId?: string): Promise<GateStatisticsReport>;
@@ -0,0 +1,34 @@
1
+ import { lstat, opendir, readFile, realpath } from 'node:fs/promises';
2
+ import type { EvaluationCandidateV1, EvaluationRunV1, EvaluationTaskV1, GateAuditManifestV1, TaskSetSnapshotV1 } from './contracts.js';
3
+ export declare function canonicalJson(value: unknown): string;
4
+ export declare function sha256(value: string | Uint8Array): string;
5
+ export declare function canonicalHash(value: unknown): string;
6
+ export declare function contentHashWithout<T extends Record<string, unknown>>(value: T, keys: readonly (keyof T)[]): string;
7
+ export declare function computeTaskContentHash(task: Omit<EvaluationTaskV1, 'contentHash'> | EvaluationTaskV1): string;
8
+ export declare function computeCandidateInputContentHash(projectRoot: string, candidate: Omit<EvaluationCandidateV1, 'contentHash'> | EvaluationCandidateV1): Promise<string>;
9
+ export interface TaskInputHashLimits {
10
+ /** Maximum aggregate filesystem entries (regular files plus directories). */
11
+ maxFiles?: number;
12
+ maxBytes?: number;
13
+ }
14
+ /** Hash task metadata plus the exact admitted instruction, fixture/container, and project scorer bytes. */
15
+ export declare function computeTaskInputContentHash(projectRoot: string, task: Omit<EvaluationTaskV1, 'contentHash'> | EvaluationTaskV1, limits?: TaskInputHashLimits): Promise<string>;
16
+ /**
17
+ * Hash the stable task input identity used for split isolation. Mutable catalog
18
+ * metadata is excluded so aliases cannot move identical inputs across splits.
19
+ * Derived tasks are linked to their admitted parent by the store instead.
20
+ */
21
+ export declare function computeTaskLineageInputHash(projectRoot: string, task: Omit<EvaluationTaskV1, 'contentHash'> | EvaluationTaskV1, limits?: TaskInputHashLimits): Promise<string>;
22
+ export declare function computeTaskSetContentHash(snapshot: Omit<TaskSetSnapshotV1, 'contentHash' | 'createdAt'> | TaskSetSnapshotV1): string;
23
+ export declare function computeRunIntegrityHash(run: Omit<EvaluationRunV1, 'integrityHash'> | EvaluationRunV1): string;
24
+ export declare function computeManifestContentHash(manifest: Omit<GateAuditManifestV1, 'contentHash'> | GateAuditManifestV1): string;
25
+ /** Resolve an existing path and reject traversal plus symlink/junction/reparse components. */
26
+ export declare function resolveContainedExistingPath(root: string, relativePath: string): string;
27
+ /** Async containment equivalent for I/O-heavy evaluation hashing paths. */
28
+ export declare function resolveContainedExistingPathAsync(root: string, relativePath: string): Promise<string>;
29
+ export declare const _internals: {
30
+ lstat: typeof lstat;
31
+ opendir: typeof opendir;
32
+ readFile: typeof readFile;
33
+ realpath: typeof realpath;
34
+ };
@@ -0,0 +1,17 @@
1
+ export * from './contracts.js';
2
+ export type { DisposableWorktree, WorkingTreeFingerprint, } from './disposable-worktree.js';
3
+ export { captureWorkingTreeFingerprint, createDisposableWorktree, removeDisposableWorktree, withDisposableWorktree, } from './disposable-worktree.js';
4
+ export * from './fixtures.js';
5
+ export * from './gate-audit.js';
6
+ export * from './gate-ground-truth.js';
7
+ export * from './gate-stats.js';
8
+ export type { TaskInputHashLimits } from './hashing.js';
9
+ export { canonicalHash, canonicalJson, computeCandidateInputContentHash, computeManifestContentHash, computeRunIntegrityHash, computeTaskContentHash, computeTaskInputContentHash, computeTaskLineageInputHash, computeTaskSetContentHash, contentHashWithout, resolveContainedExistingPath, sha256, } from './hashing.js';
10
+ export type { EvaluationModelDispatcher, EvaluationModelDispatchRequest, EvaluationModelDispatchResult, } from './model-dispatcher.js';
11
+ export { createEvaluationModelDispatcher, resolveEvaluationAgentName, } from './model-dispatcher.js';
12
+ export * from './public-api.js';
13
+ export * from './retention.js';
14
+ export type { EvaluationExecutor, EvaluationExecutorResult, RunEvaluationOptions, } from './runner.js';
15
+ export { createModelEvaluationExecutor, runEvaluation, } from './runner.js';
16
+ export * from './statistics.js';
17
+ export * from './store.js';
@@ -0,0 +1,30 @@
1
+ import type { Agent, OpencodeClient } from '@opencode-ai/sdk';
2
+ import { log } from '../utils/logger.js';
3
+ export type EvaluationModelDispatchRequest = {
4
+ directory: string;
5
+ agentName: string;
6
+ modelId: string;
7
+ prompt: string;
8
+ system?: string;
9
+ timeoutMs: number;
10
+ parentSessionId?: string;
11
+ preferredSwarm?: string;
12
+ abortSignal?: AbortSignal;
13
+ };
14
+ export type EvaluationModelDispatchResult = {
15
+ status: 'completed' | 'timeout' | 'cancelled' | 'error';
16
+ modelId: string;
17
+ agentName?: string;
18
+ text: string;
19
+ durationMs: number;
20
+ error?: string;
21
+ };
22
+ export type EvaluationModelDispatcher = (request: EvaluationModelDispatchRequest) => Promise<EvaluationModelDispatchResult>;
23
+ export declare function resolveEvaluationAgentName(agents: readonly Pick<Agent, 'name'>[], logicalName: string, preferredSwarm?: string): string;
24
+ declare function boundedDelete(client: OpencodeClient, sessionId: string, timeoutMs?: number): Promise<void>;
25
+ export declare const _internals: {
26
+ boundedDelete: typeof boundedDelete;
27
+ log: typeof log;
28
+ };
29
+ export declare function createEvaluationModelDispatcher(client: OpencodeClient): EvaluationModelDispatcher;
30
+ export {};
@@ -0,0 +1,87 @@
1
+ import type { EvaluationRunV1, PromotionDecisionV1, PromotionPolicyV1 } from './contracts.js';
2
+ import { recordTestImpactGateGroundTruth } from './gate-ground-truth.js';
3
+ import { computeCandidateInputContentHash, computeTaskInputContentHash } from './hashing.js';
4
+ import { type RunEvaluationOptions, runEvaluation } from './runner.js';
5
+ import { type DecidePromotionInput } from './statistics.js';
6
+ export type EvaluateCandidateV1Options = RunEvaluationOptions & {
7
+ historicalBest?: EvaluationRunV1;
8
+ policy?: Partial<PromotionPolicyV1>;
9
+ decidedAt?: string;
10
+ };
11
+ export type EvaluateCandidateV1Result = {
12
+ run: EvaluationRunV1;
13
+ decision: PromotionDecisionV1;
14
+ };
15
+ /**
16
+ * Stable package-level evaluation boundary for SkillOpt/HarnessOpt consumers.
17
+ * It freezes and executes the run, decides against baseline and historical-best,
18
+ * and durably persists the immutable promotion decision before returning.
19
+ */
20
+ export declare function evaluateCandidateV1(options: EvaluateCandidateV1Options): Promise<EvaluateCandidateV1Result>;
21
+ /**
22
+ * Callable function namespace: OpenCode's legacy plugin loader permits named
23
+ * function exports but rejects plain-object named exports. The attached methods
24
+ * retain the cohesive versioned API without jeopardizing plugin discovery.
25
+ */
26
+ export declare const evaluationV1: ((options: EvaluateCandidateV1Options) => Promise<EvaluateCandidateV1Result>) & {
27
+ evaluateCandidate: typeof evaluateCandidateV1;
28
+ runEvaluation: typeof runEvaluation;
29
+ decidePromotion: (input: DecidePromotionInput) => {
30
+ v: 1;
31
+ decisionId: string;
32
+ runId: string;
33
+ decidedAt: string;
34
+ status: "inconclusive" | "accept" | "reject";
35
+ reasons: string[];
36
+ baseline: {
37
+ baselineRunId: string;
38
+ baselineCandidateId: string;
39
+ baselineMean: number;
40
+ candidateMean: number;
41
+ pairedDelta: number;
42
+ confidenceInterval: [number, number];
43
+ validPairs: number;
44
+ missingPairs: number;
45
+ coverage: number;
46
+ };
47
+ historicalBest: {
48
+ baselineRunId: string;
49
+ baselineCandidateId: string;
50
+ baselineMean: number;
51
+ candidateMean: number;
52
+ pairedDelta: number;
53
+ confidenceInterval: [number, number];
54
+ validPairs: number;
55
+ missingPairs: number;
56
+ coverage: number;
57
+ };
58
+ deadband: number;
59
+ bootstrap: {
60
+ resamples: 10000;
61
+ confidence: 0.95;
62
+ seedHash: string;
63
+ };
64
+ categories: {
65
+ category: string;
66
+ protected: boolean;
67
+ tolerance: number;
68
+ baselineMean: number;
69
+ candidateMean: number;
70
+ pairedDelta: number;
71
+ regression: boolean;
72
+ }[];
73
+ lineage: {
74
+ baselineRunId: string;
75
+ historicalBestRunId: string;
76
+ taskSetHash: string;
77
+ baselineHash: string;
78
+ candidateHash: string;
79
+ historicalBestHash: string;
80
+ };
81
+ policyHash: string;
82
+ unavailableQualityMetrics: ("complexity_delta" | "public_api_delta")[];
83
+ };
84
+ hashTaskInput: typeof computeTaskInputContentHash;
85
+ hashCandidateInput: typeof computeCandidateInputContentHash;
86
+ recordTestImpactGroundTruth: typeof recordTestImpactGateGroundTruth;
87
+ };
@@ -0,0 +1,56 @@
1
+ export type EvaluationArtifactNamespace = 'evaluation-run' | 'gate-audit';
2
+ export type EvaluationArtifactRef = {
3
+ namespace: EvaluationArtifactNamespace;
4
+ id: string;
5
+ };
6
+ export type EvaluationRetentionFailure = {
7
+ artifact: EvaluationArtifactRef;
8
+ error: string;
9
+ };
10
+ export type EvaluationRetentionResult = {
11
+ inventory: EvaluationArtifactRef[];
12
+ selected: EvaluationArtifactRef[];
13
+ archived: EvaluationArtifactRef[];
14
+ corrupt: EvaluationArtifactRef[];
15
+ protected: EvaluationArtifactRef[];
16
+ failed: EvaluationRetentionFailure[];
17
+ };
18
+ /** Compatibility shape retained for existing direct gate-audit callers. */
19
+ export type GateAuditRetentionResult = {
20
+ selected: string[];
21
+ archived: string[];
22
+ corrupt: string[];
23
+ protected: string[];
24
+ failed: string[];
25
+ };
26
+ type Candidate = {
27
+ artifact: EvaluationArtifactRef;
28
+ createdAt: string;
29
+ target: string;
30
+ kind: 'file' | 'directory';
31
+ };
32
+ declare function protectedArtifacts(directory: string): Promise<Set<string>>;
33
+ declare function removeCandidate(candidate: Candidate): Promise<void>;
34
+ export declare const _retentionInternals: {
35
+ protectedArtifacts: typeof protectedArtifacts;
36
+ removeCandidate: typeof removeCandidate;
37
+ };
38
+ /**
39
+ * Apply one age/count policy to generic evaluation runs and gate-audit detail.
40
+ * Namespaced references prevent unrelated run IDs from protecting one another.
41
+ */
42
+ export declare function archiveEvaluationArtifacts(args: {
43
+ directory: string;
44
+ maxAgeDays: number;
45
+ maxBundles?: number;
46
+ dryRun?: boolean;
47
+ now?: Date;
48
+ }): Promise<EvaluationRetentionResult>;
49
+ export declare function archiveGateAuditResults(args: {
50
+ directory: string;
51
+ maxAgeDays: number;
52
+ maxBundles?: number;
53
+ dryRun?: boolean;
54
+ now?: Date;
55
+ }): Promise<GateAuditRetentionResult>;
56
+ export {};
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import { runExternalTool } from '../utils/external-tool-runner.js';
3
+ import type { CostRecord, EvaluationBudgetsV1Schema, EvaluationCandidateV1, EvaluationRunV1, EvaluationSplit, EvaluationTaskV1 } from './contracts.js';
4
+ import { captureWorkingTreeFingerprint, type DisposableWorktree } from './disposable-worktree.js';
5
+ import type { EvaluationModelDispatcher } from './model-dispatcher.js';
6
+ type EvaluationBudgetsV1 = z.infer<typeof EvaluationBudgetsV1Schema>;
7
+ export type EvaluationExecutorResult = {
8
+ status: 'completed' | 'timeout' | 'cancelled' | 'infrastructure_failure';
9
+ text: string;
10
+ durationMs: number;
11
+ cost: CostRecord;
12
+ error?: string;
13
+ };
14
+ export type EvaluationExecutor = (args: {
15
+ task: EvaluationTaskV1;
16
+ candidate: EvaluationCandidateV1;
17
+ isolatedRoot: string;
18
+ instruction: string;
19
+ payload: string;
20
+ seed: string;
21
+ abortSignal: AbortSignal;
22
+ }) => Promise<EvaluationExecutorResult>;
23
+ export type RunEvaluationOptions = {
24
+ projectRoot: string;
25
+ inputRoot?: string;
26
+ tasks: EvaluationTaskV1[];
27
+ baseline: EvaluationCandidateV1;
28
+ candidate: EvaluationCandidateV1;
29
+ split: EvaluationSplit;
30
+ seed: string;
31
+ models: string[];
32
+ budgets: EvaluationBudgetsV1;
33
+ executor: EvaluationExecutor;
34
+ abortSignal?: AbortSignal;
35
+ };
36
+ export declare function runEvaluation(options: RunEvaluationOptions): Promise<EvaluationRunV1>;
37
+ export declare const _internals: {
38
+ captureWorkingTreeFingerprint: typeof captureWorkingTreeFingerprint;
39
+ runExternalTool: typeof runExternalTool;
40
+ withDisposableWorktree: <T>(args: {
41
+ projectRoot: string;
42
+ baseRef: string;
43
+ abortSignal?: AbortSignal;
44
+ run: (worktree: DisposableWorktree) => Promise<T>;
45
+ }) => Promise<T>;
46
+ };
47
+ export declare function createModelEvaluationExecutor(dispatcher: EvaluationModelDispatcher, parentSessionId?: string): EvaluationExecutor;
48
+ export {};
@@ -0,0 +1,9 @@
1
+ import { type EvaluationRunV1, type PromotionDecisionV1, type PromotionPolicyV1 } from './contracts.js';
2
+ export interface DecidePromotionInput {
3
+ run: EvaluationRunV1;
4
+ historicalBest?: EvaluationRunV1;
5
+ policy?: Partial<PromotionPolicyV1>;
6
+ decidedAt?: string;
7
+ }
8
+ export declare function pairedBootstrapConfidenceInterval(deltas: readonly number[], seedHash: string, resamples?: number): [number, number];
9
+ export declare function decidePromotion(input: DecidePromotionInput): PromotionDecisionV1;
@@ -0,0 +1,26 @@
1
+ import { type EvaluationRunV1, type EvaluationTaskV1, type GateAuditManifestV1, type GateAuditResultV1, type PromotionDecisionV1, type TaskSetSnapshotV1, type TestConsumptionClaimV1 } from './contracts.js';
2
+ export declare class EvaluationConflictError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export declare class TestAlreadyConsumedError extends Error {
6
+ readonly priorClaim: TestConsumptionClaimV1;
7
+ constructor(priorClaim: TestConsumptionClaimV1);
8
+ }
9
+ export declare function admitEvaluationTask(directory: string, input: EvaluationTaskV1, inputRoot?: string): Promise<EvaluationTaskV1>;
10
+ export declare function saveTaskSetSnapshot(directory: string, input: TaskSetSnapshotV1, inputRoot?: string): Promise<TaskSetSnapshotV1>;
11
+ export declare function saveEvaluationRun(directory: string, input: EvaluationRunV1): Promise<EvaluationRunV1>;
12
+ export declare function readEvaluationRun(directory: string, runId: string): Promise<EvaluationRunV1 | undefined>;
13
+ export declare function savePromotionDecision(directory: string, input: PromotionDecisionV1): Promise<PromotionDecisionV1>;
14
+ export declare function saveGateAuditResult(directory: string, input: GateAuditResultV1): Promise<GateAuditResultV1>;
15
+ export declare function saveGateAuditManifest(directory: string, input: GateAuditManifestV1): Promise<GateAuditManifestV1>;
16
+ export declare function readGateAuditManifest(directory: string, runId: string): Promise<GateAuditManifestV1 | undefined>;
17
+ export declare function readGateAuditResult(directory: string, runId: string): Promise<GateAuditResultV1 | undefined>;
18
+ export type GateAuditReadSummary = {
19
+ results: GateAuditResultV1[];
20
+ corruptRunIds: string[];
21
+ };
22
+ /** Enumerate only validated immediate gate-audit children; never recurse. */
23
+ export declare function listGateAuditResults(directory: string): Promise<GateAuditReadSummary>;
24
+ export declare function claimHeldOutTest(directory: string, input: TestConsumptionClaimV1): Promise<TestConsumptionClaimV1>;
25
+ /** Run ids that retention must preserve to keep promotion and test lineage valid. */
26
+ export declare function getProtectedEvaluationRunIds(directory: string): Promise<Set<string>>;
@@ -1,4 +1,5 @@
1
1
  import { type BuildEvidence, type Evidence, type EvidenceBundle, type PlaceholderEvidence, type QualityBudgetEvidence, type SastEvidence, type SbomEvidence, type SecretscanEvidence, type SyntaxEvidence } from '../config/evidence-schema';
2
+ import { type EvaluationRetentionResult } from '../evaluation/retention.js';
2
3
  /**
3
4
  * Discriminated union returned by loadEvidence.
4
5
  * - 'found': file exists and passed Zod schema validation
@@ -92,7 +93,22 @@ export declare function checkRequirementCoverage(phase: number, directory: strin
92
93
  * If maxBundles is provided, enforces a maximum bundle count by deleting oldest first.
93
94
  * Returns array of archived (deleted) task IDs.
94
95
  */
96
+ export type EvidenceArchiveReport = {
97
+ inventoryEvidence: string[];
98
+ selectedEvidence: string[];
99
+ selectedEvidenceByAge: string[];
100
+ selectedEvidenceByCount: string[];
101
+ archivedEvidence: string[];
102
+ failedEvidence: string[];
103
+ evaluation: EvaluationRetentionResult;
104
+ };
105
+ export type EvidenceArchiveReportOptions = {
106
+ report: true;
107
+ dryRun?: boolean;
108
+ now?: Date;
109
+ };
95
110
  export declare function archiveEvidence(directory: string, maxAgeDays: number, maxBundles?: number): Promise<string[]>;
111
+ export declare function archiveEvidence(directory: string, maxAgeDays: number, maxBundles: number | undefined, options: EvidenceArchiveReportOptions): Promise<EvidenceArchiveReport>;
96
112
  /**
97
113
  * Validates evidence through Zod. Exposed via _internals for DI testing.
98
114
  */
@@ -108,5 +124,7 @@ export declare const _internals: {
108
124
  validateProjectRoot: typeof validateProjectRoot;
109
125
  validateEvidence: typeof validateEvidence;
110
126
  saveEvidence: typeof saveEvidence;
127
+ deleteEvidence: typeof deleteEvidence;
128
+ now: () => Date;
111
129
  };
112
130
  export {};
package/dist/index.d.ts CHANGED
@@ -13,3 +13,7 @@ declare const _default: {
13
13
  export default _default;
14
14
  export type { AgentDefinition } from './agents';
15
15
  export type { AgentName, AutomationCapabilities, AutomationConfig, AutomationMode, PipelineAgentName, PluginConfig, QAAgentName, } from './config';
16
+ export { loadTier1EvaluationTasks } from './evaluation/fixtures.js';
17
+ export { recordTestImpactGateGroundTruth } from './evaluation/gate-ground-truth.js';
18
+ export type { EvaluateCandidateV1Options, EvaluateCandidateV1Result, } from './evaluation/public-api.js';
19
+ export { evaluateCandidateV1, evaluationV1, } from './evaluation/public-api.js';