opencode-swarm 7.155.0 → 7.156.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 (70) hide show
  1. package/dist/cli/{coder-settlement-2kdtysrg.js → coder-settlement-jm7024zm.js} +3 -3
  2. package/dist/cli/{config-doctor-s6p9aqfv.js → config-doctor-q9v8yscr.js} +2 -2
  3. package/dist/cli/{core-ev2ebc4v.js → core-ev3bn503.js} +1 -1
  4. package/dist/cli/{curator-adp0dsv4.js → curator-dnjf9ser.js} +22 -22
  5. package/dist/cli/{curator-llm-factory-kd8v16jj.js → curator-llm-factory-cnatbky1.js} +22 -22
  6. package/dist/cli/{dispatch-w0rzasz3.js → dispatch-7r46tfr9.js} +10 -8
  7. package/dist/cli/{evidence-summary-service-kpjpd86j.js → evidence-summary-service-5drv65qh.js} +8 -8
  8. package/dist/cli/{gate-evidence-etbcms2v.js → gate-evidence-dcyvst7g.js} +2 -2
  9. package/dist/cli/{guardrail-explain-wqb5h7kk.js → guardrail-explain-z8f6qhz2.js} +23 -23
  10. package/dist/cli/{guardrail-log-614g1pta.js → guardrail-log-zwec6ann.js} +3 -3
  11. package/dist/cli/{guardrail-reset-0wdj53cp.js → guardrail-reset-ga6e11r9.js} +22 -22
  12. package/dist/cli/{hashing-mjwn6j4y.js → hashing-r4hbav6j.js} +1 -1
  13. package/dist/cli/{hive-promoter-b1wv52fs.js → hive-promoter-mpez5tqh.js} +22 -22
  14. package/dist/cli/{index-ketfp4rv.js → index-00hyhg47.js} +3 -3
  15. package/dist/cli/{index-dw2q720x.js → index-164c64z8.js} +2 -2
  16. package/dist/cli/{index-qzqpq75z.js → index-17h6ewqp.js} +43 -24
  17. package/dist/cli/{index-kyc2c7hq.js → index-4m3j9q9z.js} +2 -2
  18. package/dist/cli/{index-26cvxrym.js → index-5r3zrw81.js} +1 -1
  19. package/dist/cli/{index-34wn2ztk.js → index-5w87j6j4.js} +21 -3
  20. package/dist/cli/{index-mm7ase9k.js → index-68098cfj.js} +5 -1
  21. package/dist/cli/{index-kgdbtwfm.js → index-6g6qwr8z.js} +5 -5
  22. package/dist/cli/{index-qj9jrjvr.js → index-98j6z038.js} +3 -3
  23. package/dist/cli/{index-e90g4dsw.js → index-9n555qz4.js} +1 -1
  24. package/dist/cli/{index-79qymsxf.js → index-b91qwpms.js} +1 -1
  25. package/dist/cli/{index-ctsct3hy.js → index-dfmr6pj5.js} +4 -4
  26. package/dist/cli/{index-t3xqpece.js → index-fd7wj6fy.js} +2 -2
  27. package/dist/cli/{index-caqe8x14.js → index-fpg4tzf7.js} +1 -1
  28. package/dist/cli/{index-veajr5x7.js → index-g37454vj.js} +1 -1
  29. package/dist/cli/{index-c9nabqzd.js → index-gthnsbzf.js} +1 -1
  30. package/dist/cli/{index-x9tbe9v7.js → index-kxk8cnx7.js} +2 -2
  31. package/dist/cli/{index-zvp68qx6.js → index-mdypz60w.js} +1 -1
  32. package/dist/cli/{index-2gfe61qp.js → index-ppx8bnzd.js} +3685 -881
  33. package/dist/cli/{index-wwv3cbv1.js → index-q2khkey7.js} +4 -4
  34. package/dist/cli/{index-xn23xnnk.js → index-sfdg1xg5.js} +3 -3
  35. package/dist/cli/{index-rb4t72we.js → index-sm2t1awr.js} +1 -1
  36. package/dist/cli/{index-y8552snf.js → index-txdagbh7.js} +6 -1
  37. package/dist/cli/{index-c590qxts.js → index-wn0xm2e8.js} +1 -1
  38. package/dist/cli/{index-spbxf9vn.js → index-za6bb2fd.js} +1 -1
  39. package/dist/cli/{index-egnpzfe3.js → index-zdgdf0e9.js} +3 -3
  40. package/dist/cli/index.js +22 -22
  41. package/dist/cli/{knowledge-escalator-z09aqvfe.js → knowledge-escalator-cq4e6v2j.js} +6 -6
  42. package/dist/cli/{knowledge-events-03f1rwm8.js → knowledge-events-sr5fqqaq.js} +4 -4
  43. package/dist/cli/{knowledge-store-sn28k13f.js → knowledge-store-2dww3dqz.js} +1 -1
  44. package/dist/cli/{knowledge-validator-rwrt3yja.js → knowledge-validator-yprsj4ye.js} +2 -2
  45. package/dist/cli/{pending-delegations-qe16vfrj.js → pending-delegations-7qvag076.js} +1 -1
  46. package/dist/cli/{runner-k1rkbjm8.js → runner-gheaxd5r.js} +3 -3
  47. package/dist/cli/{scan-cursor-h3mfzjc9.js → scan-cursor-6awybk8b.js} +2 -2
  48. package/dist/cli/{schema-c37h5xw4.js → schema-bf3smw7k.js} +5 -1
  49. package/dist/cli/{scope-persistence-35z42pj5.js → scope-persistence-kc42c6ph.js} +4 -4
  50. package/dist/cli/{skill-generator-60px2mvb.js → skill-generator-9k1ztt7c.js} +7 -7
  51. package/dist/cli/{worktree-collision-ownership-2pc20ypq.js → worktree-collision-ownership-ej10dhwe.js} +1 -1
  52. package/dist/cli/{worktree-isolation-w4yamc3b.js → worktree-isolation-r7qqy6ca.js} +22 -22
  53. package/dist/commands/command-dispatch.d.ts +2 -1
  54. package/dist/commands/harness.d.ts +14 -0
  55. package/dist/commands/index.d.ts +3 -1
  56. package/dist/commands/registry.d.ts +114 -1
  57. package/dist/config/schema.d.ts +34 -0
  58. package/dist/harness/contracts.d.ts +492 -0
  59. package/dist/harness/factory.d.ts +72 -0
  60. package/dist/harness/hash.d.ts +4 -0
  61. package/dist/harness/index.d.ts +6 -0
  62. package/dist/harness/patch.d.ts +3 -0
  63. package/dist/harness/public-api.d.ts +105 -0
  64. package/dist/harness/source-candidate.d.ts +45 -0
  65. package/dist/harness/store.d.ts +256 -0
  66. package/dist/index.d.ts +2 -0
  67. package/dist/index.js +256 -234
  68. package/dist/lang/manifest-files.d.ts +25 -0
  69. package/dist/security/write-authority.d.ts +2 -1
  70. package/package.json +1 -1
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ import { type HarnessBlueprintV1, type HarnessConstraintsV1, type ToolSpecV1 } from './contracts.js';
3
+ import { loadHarnessPromptArtifact } from './store.js';
4
+ declare const RuntimeAgentDefinitionSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ description: z.ZodOptional<z.ZodString>;
7
+ config: z.ZodObject<{
8
+ mode: z.ZodEnum<{
9
+ primary: "primary";
10
+ subagent: "subagent";
11
+ }>;
12
+ model: z.ZodOptional<z.ZodString>;
13
+ variant: z.ZodOptional<z.ZodString>;
14
+ reasoning: z.ZodOptional<z.ZodObject<{
15
+ effort: z.ZodEnum<{
16
+ none: "none";
17
+ low: "low";
18
+ medium: "medium";
19
+ high: "high";
20
+ max: "max";
21
+ xhigh: "xhigh";
22
+ minimal: "minimal";
23
+ ultra: "ultra";
24
+ }>;
25
+ }, z.core.$strict>>;
26
+ thinking: z.ZodOptional<z.ZodObject<{
27
+ type: z.ZodEnum<{
28
+ enabled: "enabled";
29
+ disabled: "disabled";
30
+ }>;
31
+ budget_tokens: z.ZodOptional<z.ZodNumber>;
32
+ }, z.core.$strict>>;
33
+ temperature: z.ZodNumber;
34
+ prompt: z.ZodString;
35
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
36
+ }, z.core.$strict>;
37
+ harnessPromptProvenance: z.ZodOptional<z.ZodObject<{
38
+ source: z.ZodEnum<{
39
+ candidate: "candidate";
40
+ static: "static";
41
+ }>;
42
+ promptId: z.ZodString;
43
+ sha256: z.ZodString;
44
+ candidateId: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strict>>;
46
+ }, z.core.$strict>;
47
+ export type RuntimeAgentDefinition = z.infer<typeof RuntimeAgentDefinitionSchema>;
48
+ export declare function computeRuntimeDefinitionsHash(runtimeDefinitions: readonly RuntimeAgentDefinition[]): string;
49
+ export declare function createToolFactory(registeredToolIds: readonly string[]): {
50
+ projectTools(toolIds: readonly string[]): ToolSpecV1[];
51
+ materializeTools(tools: readonly ToolSpecV1[]): string[];
52
+ };
53
+ export declare function createAgentFactory(options: {
54
+ runtimeDefinitions: readonly RuntimeAgentDefinition[];
55
+ registeredToolIds: readonly string[];
56
+ defaultConstraints?: HarnessConstraintsV1;
57
+ }): {
58
+ definitionsHash: string;
59
+ projectBlueprint(args: {
60
+ blueprintId: string;
61
+ agentNames?: readonly string[];
62
+ defaultAgent?: string;
63
+ constraints?: HarnessConstraintsV1;
64
+ }): HarnessBlueprintV1;
65
+ materializeBlueprint(blueprint: HarnessBlueprintV1, options?: {
66
+ directory?: string;
67
+ }): RuntimeAgentDefinition[];
68
+ };
69
+ export declare const _factoryInternals: {
70
+ loadHarnessPromptArtifact: typeof loadHarnessPromptArtifact;
71
+ };
72
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function canonicalJson(value: unknown): string;
2
+ export declare function sha256(value: string | Uint8Array): string;
3
+ export declare function canonicalHash(value: unknown): string;
4
+ export declare function contentHashWithout<T extends Record<string, unknown>>(value: T, keys: readonly (keyof T)[]): string;
@@ -0,0 +1,6 @@
1
+ export * from './contracts.js';
2
+ export * from './factory.js';
3
+ export * from './hash.js';
4
+ export * from './patch.js';
5
+ export * from './source-candidate.js';
6
+ export * from './store.js';
@@ -0,0 +1,3 @@
1
+ import { type BlueprintPatchOperationV1, type HarnessBlueprintV1 } from './contracts.js';
2
+ export declare function deriveBlueprintPatchRiskTier(operations: readonly BlueprintPatchOperationV1[]): 'low' | 'medium' | 'high';
3
+ export declare function applyBlueprintPatch(base: HarnessBlueprintV1, patch: unknown): HarnessBlueprintV1;
@@ -0,0 +1,105 @@
1
+ import type { AgentDefinition } from '../agents/index.js';
2
+ import { type HarnessBlueprintV1, parseHarnessBlueprint } from './contracts.js';
3
+ import { applyBlueprintPatch } from './patch.js';
4
+ import { validateSourceCandidate } from './source-candidate.js';
5
+ import { activateHarnessCandidate, auditHarnessLedger, listHarnessHistory, loadHarnessCurrent, recordHarnessCandidate, recoverHarnessCorruptTail, rollbackHarnessVersion, saveHarnessVersion } from './store.js';
6
+ declare function projectStaticBlueprint(agents: Record<string, AgentDefinition>): {
7
+ v: 1;
8
+ blueprintId: string;
9
+ definitionsHash: string;
10
+ tools: {
11
+ v: 1;
12
+ toolId: string;
13
+ description?: string | undefined;
14
+ }[];
15
+ agents: {
16
+ v: 1;
17
+ agentName: string;
18
+ mode: "primary" | "subagent";
19
+ temperature: number;
20
+ prompt: {
21
+ v: 1;
22
+ promptId: string;
23
+ ref: string;
24
+ sha256: string;
25
+ };
26
+ tools: string[];
27
+ description?: string | undefined;
28
+ model?: string | undefined;
29
+ variant?: string | undefined;
30
+ reasoning?: {
31
+ effort: "none" | "low" | "medium" | "high" | "max" | "xhigh" | "minimal" | "ultra";
32
+ } | undefined;
33
+ thinking?: {
34
+ type: "enabled" | "disabled";
35
+ budget_tokens?: number | undefined;
36
+ } | undefined;
37
+ disabledTools?: string[] | undefined;
38
+ }[];
39
+ orchestration: {
40
+ v: 1;
41
+ defaultAgent: string;
42
+ activation: "manual";
43
+ execution: "disabled";
44
+ multiSwarm: boolean;
45
+ };
46
+ constraints: {
47
+ v: 1;
48
+ sourceAllowlist: string[];
49
+ extraProtectedPaths: string[];
50
+ maxPatchBytes: number;
51
+ maxFiles: number;
52
+ maxFileBytes: number;
53
+ maxTotalBytes: number;
54
+ maxChangedLines: number;
55
+ maxVersions: number;
56
+ maxReplayRecords: number;
57
+ maxOutputBytes: number;
58
+ };
59
+ contentHash: string;
60
+ };
61
+ declare function diffHarnessBlueprints(left: HarnessBlueprintV1, right: HarnessBlueprintV1): {
62
+ changes: Record<string, {
63
+ before: unknown;
64
+ after: unknown;
65
+ }>;
66
+ summary: {
67
+ changeCount: number;
68
+ changedKeys: string[];
69
+ };
70
+ };
71
+ /**
72
+ * Callable package namespace for explicit HarnessOpt consumers. Importing it is
73
+ * pure; no filesystem, Git, agent, or activation work occurs until a method is
74
+ * invoked. The live plugin manifest never calls this function during init.
75
+ */
76
+ export declare const harnessMutationV1: (() => /*elided*/ any & {
77
+ validateBlueprint: typeof parseHarnessBlueprint;
78
+ projectStaticBlueprint: typeof projectStaticBlueprint;
79
+ applyPatchSet: typeof applyBlueprintPatch;
80
+ validateSourceCandidate: typeof validateSourceCandidate;
81
+ saveCandidate: typeof recordHarnessCandidate;
82
+ saveVersion: typeof saveHarnessVersion;
83
+ activate: typeof activateHarnessCandidate;
84
+ rollback: typeof rollbackHarnessVersion;
85
+ current: typeof loadHarnessCurrent;
86
+ history: typeof listHarnessHistory;
87
+ diff: typeof diffHarnessBlueprints;
88
+ auditLedger: typeof auditHarnessLedger;
89
+ recoverCorruptTail: typeof recoverHarnessCorruptTail;
90
+ }) & {
91
+ validateBlueprint: typeof parseHarnessBlueprint;
92
+ projectStaticBlueprint: typeof projectStaticBlueprint;
93
+ applyPatchSet: typeof applyBlueprintPatch;
94
+ validateSourceCandidate: typeof validateSourceCandidate;
95
+ saveCandidate: typeof recordHarnessCandidate;
96
+ saveVersion: typeof saveHarnessVersion;
97
+ activate: typeof activateHarnessCandidate;
98
+ rollback: typeof rollbackHarnessVersion;
99
+ current: typeof loadHarnessCurrent;
100
+ history: typeof listHarnessHistory;
101
+ diff: typeof diffHarnessBlueprints;
102
+ auditLedger: typeof auditHarnessLedger;
103
+ recoverCorruptTail: typeof recoverHarnessCorruptTail;
104
+ };
105
+ export {};
@@ -0,0 +1,45 @@
1
+ import { lstatSync } from 'node:fs';
2
+ import type { HarnessEvolutionConfig } from '../config/schema.js';
3
+ import { type HarnessCandidateFileV1, type HarnessCandidateManifestV1 } from './contracts.js';
4
+ export type HarnessSourceCandidateFileV1 = HarnessCandidateFileV1;
5
+ export type HarnessSourceCandidateV1 = HarnessCandidateManifestV1 & {
6
+ /** Inert evidence only. No production API applies this patch. */
7
+ patch?: string;
8
+ };
9
+ type ValidationFailureCode = 'ALLOWLIST_EMPTY' | 'INVALID_BASE_SHA' | 'STALE_BASE' | 'PATCH_TOO_LARGE' | 'UNSUPPORTED_PATCH' | 'PATH_REJECTED' | 'PATH_NOT_ALLOWLISTED' | 'PROTECTED_PATH' | 'GIT_FAILED' | 'UNTRACKED_PATH' | 'UNSUPPORTED_TRACKED_MODE' | 'SYMLINK_PATH' | 'HARDLINK_PATH' | 'BINARY_FILE' | 'FILE_TOO_LARGE' | 'TOTAL_TOO_LARGE' | 'FILE_COUNT_EXCEEDED' | 'LINE_COUNT_EXCEEDED' | 'PATH_CHANGED_DURING_VALIDATION' | 'PATCH_DOES_NOT_APPLY';
10
+ export type SourceCandidateValidationResult = {
11
+ ok: true;
12
+ candidate: HarnessSourceCandidateV1;
13
+ } | {
14
+ ok: false;
15
+ code: ValidationFailureCode;
16
+ reason: string;
17
+ };
18
+ interface GitCommandResult {
19
+ ok: boolean;
20
+ code: number;
21
+ stdout: string;
22
+ stderr: string;
23
+ }
24
+ interface GitBinaryCommandResult {
25
+ ok: boolean;
26
+ code: number;
27
+ stdout: Uint8Array;
28
+ stderr: string;
29
+ }
30
+ export declare function validateSourceCandidate(args: {
31
+ directory: string;
32
+ config: HarnessEvolutionConfig;
33
+ candidateId: string;
34
+ baseSha: string;
35
+ origin: string;
36
+ patch: string;
37
+ }): Promise<SourceCandidateValidationResult>;
38
+ declare function runGitCommand(directory: string, args: string[]): Promise<GitCommandResult>;
39
+ declare function runGitBinaryCommand(directory: string, args: string[], maxOutputBytes?: number): Promise<GitBinaryCommandResult>;
40
+ export declare const _internals: {
41
+ runGitCommand: typeof runGitCommand;
42
+ runGitBinaryCommand: typeof runGitBinaryCommand;
43
+ lstatSync: typeof lstatSync;
44
+ };
45
+ export {};
@@ -0,0 +1,256 @@
1
+ import { type WriteApprovalRequest } from '../security/write-authority.js';
2
+ import { type BlueprintPatchV1, type HarnessBlueprintV1, type PromptArtifactV1 } from './contracts.js';
3
+ import type { HarnessSourceCandidateV1 } from './source-candidate.js';
4
+ type RetainedCandidateBinding = {
5
+ candidateId: string;
6
+ manifestHash: string;
7
+ };
8
+ export interface StoredHarnessCandidateV1 {
9
+ v: 1;
10
+ candidate: HarnessSourceCandidateV1;
11
+ promptArtifacts?: PromptArtifactV1[];
12
+ baseBlueprint?: HarnessBlueprintV1;
13
+ targetBlueprint?: HarnessBlueprintV1;
14
+ blueprintPatch?: BlueprintPatchV1;
15
+ recordedAt: string;
16
+ }
17
+ export interface HarnessVersionV1 {
18
+ v: 1;
19
+ versionId: string;
20
+ candidateId: string;
21
+ manifestHash: string;
22
+ allowedPathDigest: string;
23
+ generation: number;
24
+ sourceKind: 'activation' | 'rollback';
25
+ parentVersionId: string | null;
26
+ restoredFromVersionId: string | null;
27
+ approvalFactId: string;
28
+ blueprint?: HarnessBlueprintV1;
29
+ recordedAt: string;
30
+ }
31
+ export interface HarnessCurrentProjectionV1 {
32
+ v: 1;
33
+ currentVersionId: string | null;
34
+ currentCandidateId: string | null;
35
+ currentManifestHash: string | null;
36
+ currentHash: string;
37
+ generation: number;
38
+ versionIds: string[];
39
+ updatedAt: string;
40
+ ledgerHeadSegment: string | null;
41
+ ledgerHeadSeq: number;
42
+ ledgerHeadHash: string;
43
+ }
44
+ export interface HarnessLedgerRecordV1 {
45
+ v: 1;
46
+ seq: number;
47
+ timestamp: string;
48
+ kind: 'candidate_recorded' | 'activated' | 'rolled_back' | 'recovered_tail' | 'compacted';
49
+ candidateId: string;
50
+ versionId: string | null;
51
+ parentVersionId: string | null;
52
+ restoredFromVersionId: string | null;
53
+ approvalFactId: string | null;
54
+ payloadHash: string;
55
+ generation: number;
56
+ currentHashBefore: string;
57
+ currentHashAfter: string;
58
+ nextCurrentVersionId: string | null;
59
+ nextCurrentCandidateId: string | null;
60
+ nextCurrentManifestHash: string | null;
61
+ nextVersionIds: string[];
62
+ nextUpdatedAt: string;
63
+ ledgerSegment: string;
64
+ prunedVersionIds: string[];
65
+ recoverySegment: string | null;
66
+ recoveredBytes: number | null;
67
+ retainedCandidates: RetainedCandidateBinding[];
68
+ compactedRecords: number | null;
69
+ hashBefore: string;
70
+ hashAfter: string;
71
+ }
72
+ export type RecordHarnessCandidateResult = {
73
+ status: 'recorded';
74
+ candidate: StoredHarnessCandidateV1;
75
+ retentionReconciled: boolean;
76
+ retentionFailures: string[];
77
+ } | {
78
+ status: 'conflict';
79
+ reason: string;
80
+ };
81
+ export type ActivateHarnessCandidateResult = {
82
+ status: 'activated';
83
+ version: HarnessVersionV1;
84
+ current: HarnessCurrentProjectionV1;
85
+ projectionReconciled: boolean;
86
+ prunedArtifactsReconciled: boolean;
87
+ prunedArtifactFailures: string[];
88
+ retentionReconciled: boolean;
89
+ retentionFailures: string[];
90
+ } | {
91
+ status: 'candidate_not_found';
92
+ reason: string;
93
+ } | {
94
+ status: 'candidate_not_activatable';
95
+ reason: string;
96
+ } | {
97
+ status: 'consumer_mismatch';
98
+ reason: string;
99
+ } | {
100
+ status: 'approval_required';
101
+ reason: string;
102
+ } | {
103
+ status: 'retention_conflict';
104
+ reason: string;
105
+ maxVersions: number;
106
+ requiredVersionIds: string[];
107
+ } | {
108
+ status: 'stale_current';
109
+ reason: string;
110
+ };
111
+ export type RollbackHarnessVersionResult = {
112
+ status: 'rolled_back';
113
+ version: HarnessVersionV1;
114
+ current: HarnessCurrentProjectionV1;
115
+ projectionReconciled: boolean;
116
+ prunedArtifactsReconciled: boolean;
117
+ prunedArtifactFailures: string[];
118
+ retentionReconciled: boolean;
119
+ retentionFailures: string[];
120
+ } | {
121
+ status: 'version_not_found';
122
+ reason: string;
123
+ } | {
124
+ status: 'consumer_mismatch';
125
+ reason: string;
126
+ } | {
127
+ status: 'approval_required';
128
+ reason: string;
129
+ } | {
130
+ status: 'retention_conflict';
131
+ reason: string;
132
+ maxVersions: number;
133
+ requiredVersionIds: string[];
134
+ } | {
135
+ status: 'stale_current';
136
+ reason: string;
137
+ };
138
+ export type SaveHarnessVersionResult = {
139
+ status: 'saved';
140
+ version: HarnessVersionV1;
141
+ } | {
142
+ status: 'conflict';
143
+ reason: string;
144
+ };
145
+ export interface HarnessHistoryResult {
146
+ records: HarnessLedgerRecordV1[];
147
+ truncated: boolean;
148
+ quarantinePath: string | null;
149
+ totalRecordCount: number;
150
+ limit: number;
151
+ totalSegments: number;
152
+ }
153
+ export type HarnessLedgerAuditResult = {
154
+ outcome: 'ok';
155
+ records: HarnessLedgerRecordV1[];
156
+ truncated: boolean;
157
+ quarantinePath: string | null;
158
+ totalSegments: number;
159
+ } | {
160
+ outcome: 'scope_exceeded';
161
+ maxSegments: number;
162
+ totalSegments: number;
163
+ replayBoundExceeded?: true;
164
+ maxReplayRecords?: number;
165
+ };
166
+ export declare class HarnessStoreIntegrityError extends Error {
167
+ readonly artifactPath: string;
168
+ readonly code = "HARNESS_STORE_INTEGRITY";
169
+ constructor(artifactPath: string, message: string);
170
+ }
171
+ export declare class HarnessReplayBoundExceededError extends Error {
172
+ readonly maxReplayRecords: number;
173
+ readonly code = "HARNESS_REPLAY_BOUND_EXCEEDED";
174
+ constructor(maxReplayRecords: number);
175
+ }
176
+ declare function appendLedgerLine(directory: string, line: string, expectedSegmentName?: string): void;
177
+ declare function removeVersionArtifact(filePath: string): void;
178
+ declare function writeCurrentProjection(directory: string, current: HarnessCurrentProjectionV1): Promise<void>;
179
+ declare function removeCandidateArtifact(directory: string): void;
180
+ declare function removeLedgerArtifact(target: string): void;
181
+ export declare function buildHarnessActivationApprovalRequest(args: {
182
+ targetSessionId: string;
183
+ candidate: StoredHarnessCandidateV1;
184
+ expectedCurrentHash: string | null;
185
+ expectedCurrentGeneration: number;
186
+ targetContentHash: string;
187
+ allowedPathDigest: string;
188
+ }): WriteApprovalRequest;
189
+ export declare function buildHarnessRollbackApprovalRequest(args: {
190
+ targetSessionId: string;
191
+ currentVersionId: string;
192
+ targetVersionId: string;
193
+ expectedCurrentHash: string;
194
+ expectedCurrentGeneration: number;
195
+ targetContentHash: string;
196
+ allowedPathDigest: string;
197
+ }): WriteApprovalRequest;
198
+ export declare function recordHarnessCandidate(args: {
199
+ directory: string;
200
+ candidate: StoredHarnessCandidateV1;
201
+ maxReplayRecords?: number;
202
+ maxInactiveCandidates?: number;
203
+ }): Promise<RecordHarnessCandidateResult>;
204
+ export declare function saveHarnessVersion(args: {
205
+ directory: string;
206
+ version: HarnessVersionV1;
207
+ }): Promise<SaveHarnessVersionResult>;
208
+ export declare function loadHarnessCurrent(directory: string, maxReplayRecords?: number): Promise<HarnessCurrentProjectionV1>;
209
+ /** Explicitly reconcile the derived projection; read paths never mutate state. */
210
+ export declare function reconcileHarnessCurrent(directory: string, maxReplayRecords?: number): Promise<HarnessCurrentProjectionV1>;
211
+ export declare function loadHarnessCandidate(directory: string, candidateId: string, maxReplayRecords?: number): Promise<StoredHarnessCandidateV1 | null>;
212
+ export declare function loadHarnessPromptArtifact(directory: string, candidateId: string, promptHash: string): PromptArtifactV1 | null;
213
+ export declare function loadHarnessVersion(directory: string, versionId: string): Promise<HarnessVersionV1 | null>;
214
+ export declare function listHarnessHistory(directory: string, options?: number | {
215
+ maxReplayRecords?: number;
216
+ limit?: number;
217
+ }): Promise<HarnessHistoryResult>;
218
+ export declare function auditHarnessLedger(directory: string, options: {
219
+ maxReplayRecords?: number;
220
+ maxSegments: number;
221
+ }): Promise<HarnessLedgerAuditResult>;
222
+ export declare function recoverHarnessCorruptTail(directory: string, maxReplayRecords?: number): Promise<HarnessHistoryResult>;
223
+ export declare function activateHarnessCandidate(args: {
224
+ directory: string;
225
+ candidateId: string;
226
+ consumerSessionId: string;
227
+ targetSessionId?: string;
228
+ expectedCurrentHash: string | null;
229
+ expectedCurrentGeneration: number;
230
+ targetContentHash: string;
231
+ allowedPathDigest: string;
232
+ maxVersions?: number;
233
+ maxReplayRecords?: number;
234
+ maxInactiveCandidates?: number;
235
+ }): Promise<ActivateHarnessCandidateResult>;
236
+ export declare function rollbackHarnessVersion(args: {
237
+ directory: string;
238
+ targetVersionId: string;
239
+ consumerSessionId: string;
240
+ targetSessionId?: string;
241
+ expectedCurrentHash: string;
242
+ expectedCurrentGeneration: number;
243
+ targetContentHash: string;
244
+ allowedPathDigest: string;
245
+ maxVersions?: number;
246
+ maxReplayRecords?: number;
247
+ maxInactiveCandidates?: number;
248
+ }): Promise<RollbackHarnessVersionResult>;
249
+ export declare const _storeInternals: {
250
+ appendLedgerLine: typeof appendLedgerLine;
251
+ writeCurrentProjection: typeof writeCurrentProjection;
252
+ removeVersionArtifact: typeof removeVersionArtifact;
253
+ removeCandidateArtifact: typeof removeCandidateArtifact;
254
+ removeLedgerArtifact: typeof removeLedgerArtifact;
255
+ };
256
+ export {};
package/dist/index.d.ts CHANGED
@@ -63,3 +63,5 @@ export type { EvaluatePrReviewRecoveryV1Options } from './evaluation/pr-review-r
63
63
  export { evaluatePrReviewRecoveryV1 } from './evaluation/pr-review-recovery.js';
64
64
  export type { EvaluateCandidateV1Options, EvaluateCandidateV1Result, } from './evaluation/public-api.js';
65
65
  export { evaluateCandidateV1, evaluationV1, } from './evaluation/public-api.js';
66
+ export type { AgentBlueprintV1, BlueprintPatchV1, HarnessBlueprintV1, HarnessCandidateManifestV1, OrchestrationSpecV1, PromptArtifactV1, ToolSpecV1, } from './harness/contracts.js';
67
+ export { harnessMutationV1 } from './harness/public-api.js';