@shapeshift-labs/frontier-swarm 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -36,7 +36,7 @@ The published Frontier package family is generated from one shared package catal
36
36
  - [`@shapeshift-labs/frontier-workflow`](https://www.npmjs.com/package/@shapeshift-labs/frontier-workflow): Serializable durable workflow/process manifests for Frontier apps, including steps, waits, approvals, timers, retries, expected patches, compensation, records, timelines, and registry graph output.
37
37
  - [`@shapeshift-labs/frontier-worker`](https://www.npmjs.com/package/@shapeshift-labs/frontier-worker): Serializable worker and edge task descriptors for Frontier apps, including queues, idempotency keys, retry and timeout policy, declared reads/writes/effects, snapshots, patch outputs, produced assets, execution records, logs, trace links, proof hashes, dedupe indexes, and registry graph output.
38
38
  - [`@shapeshift-labs/frontier-queue`](https://www.npmjs.com/package/@shapeshift-labs/frontier-queue): Serializable durable queue state, leases, retries, dedupe keys, patch-carrying jobs, dead-letter records, replay evidence, and queue inspection for Frontier apps.
39
- - [`@shapeshift-labs/frontier-swarm-codex`](https://www.npmjs.com/package/@shapeshift-labs/frontier-swarm-codex): Node Codex CLI adapter for Frontier swarm plans, including prompt rendering, worktree and snapshot workspaces, Codex argument compatibility, JSONL capture, verification commands, pid-backed stop, collect buckets, merge bundles, and result artifacts.
39
+ - [`@shapeshift-labs/frontier-swarm-codex`](https://www.npmjs.com/package/@shapeshift-labs/frontier-swarm-codex): Node Codex CLI adapter for Frontier swarm plans, including prompt rendering, worktree and snapshot workspaces, Codex argument compatibility, JSONL capture, verification commands, pid-backed stop, collect/apply workflows, merge indexes, queue overlays, merge bundles, and result artifacts.
40
40
  - [`@shapeshift-labs/frontier-kv`](https://www.npmjs.com/package/@shapeshift-labs/frontier-kv): Serializable in-memory key/value state for Frontier apps, including TTL, versioned compare-and-set, batched patch mutations, scans, watchers, snapshots, JSONL event evidence, and replay verification.
41
41
  - [`@shapeshift-labs/frontier-kv-locks`](https://www.npmjs.com/package/@shapeshift-labs/frontier-kv-locks): Lease-style lock records on top of Frontier KV, including acquire, renew, release, fencing tokens, expiration, owner evidence, and replayable lock events.
42
42
  - [`@shapeshift-labs/frontier-kv-rate-limit`](https://www.npmjs.com/package/@shapeshift-labs/frontier-kv-rate-limit): Patch-native rate limit buckets for Frontier KV, including fixed windows, sliding windows, token buckets, deterministic refill, consume evidence, and reset records.
@@ -248,8 +248,19 @@ The scale APIs are runtime-neutral and serializable:
248
248
  - `createSwarmReviewPlan` samples or requires reviewer assignments,
249
249
  - `createSwarmMergePlan` blocks jobs with failed checks, required reviews, ownership violations, or conflicting changed paths,
250
250
  - job results include merge-readiness classification: `discovery-only`, `patch-candidate`, `verified-patch`, `rejected`, or `blocked`,
251
- - `ownershipRegions` allow hot files to be split into semantic regions such as `content.docs.*` or `adminSettings.quota.*`; merge conflict detection prefers changed regions when workers report them,
251
+ - `ownershipRegions` allow hot files to be split into semantic regions such as `content.docs.*` or `adminSettings.quota.*`; merge conflict detection compares explicit changed regions when both sides report them and falls back to path conflicts when either side omits regions,
252
252
  - `createSwarmMergeBundle` builds a compact worker `merge.json` shape with touched owned files, patch path, evidence, verification, queue items satisfied, risk, and disposition,
253
+ - `createSwarmQueueOverlay` and `deriveSwarmQueueStatus` keep central queue files immutable while deriving status from worker result overlays,
254
+ - `createSwarmMergeIndex` records stale/patch status and region-aware conflicts so coordinators can review ready bundles before reading every worker directory,
255
+ - `checkSwarmRegionOwnership` makes semantic region ownership enforceable instead of only advisory,
256
+ - `createSwarmHotspotReport` highlights repeatedly touched files and suggests module/region splits for merge throughput,
257
+ - `createSwarmReviewerLanePlan` turns risky/conflicting merge bundles into reviewer-lane tasks,
258
+ - `createSwarmRunStoreShards` describes sharded event/result/checkpoint paths for large run stores,
259
+ - `createSwarmMergeAdmission` limits ready merges by count, touched paths/regions, and risk budget,
260
+ - `createSwarmPatchStackPlan` clusters compatible bundles into candidate patch stacks by lane, path, region, disposition, and risk so reviewers can evaluate batches instead of individual worker directories,
261
+ - `createSwarmContextPack` gives workers compact task context: relevant files, API maps, known failures, focused/oracle commands, expected evidence, exclusions, evidence schema, playbooks, and explicit dead ends to avoid,
262
+ - `createSwarmOracleCorpus` indexes deterministic reference artifacts such as traces, snapshots, classifications, expected outputs, or fixtures without assuming a project domain,
263
+ - `createSwarmLanePlaybook` turns successful prior bundles into persistent lane-specific guidance with commands, hot paths, evidence patterns, and avoid-investigating notes,
253
264
  - `decomposeSwarmFeature` creates an initial task queue for feature work across lanes.
254
265
 
255
266
  ## Hierarchical Compute
@@ -273,13 +284,18 @@ That lets a parent swarm route implementation jobs to a deep model while evidenc
273
284
  - `createSwarmPlan`, `createSwarmRun`
274
285
  - `createSwarmSchedule`, `createSwarmLeases`
275
286
  - `createSwarmQueueSnapshot`, `createSwarmRunCheckpoint`
287
+ - `createSwarmQueueOverlay`, `deriveSwarmQueueStatus`
276
288
  - `createSwarmEventStream`, `createSwarmMailbox`, `routeSwarmEventToMailboxes`
277
289
  - `checkSwarmBudget`
278
290
  - `createSwarmArtifactIndex`
279
- - `createSwarmReviewPlan`, `createSwarmMergePlan`
291
+ - `createSwarmReviewPlan`, `createSwarmReviewerLanePlan`, `createSwarmMergePlan`
280
292
  - `createSwarmMergeBundle`
293
+ - `createSwarmMergeIndex`, `createSwarmMergeAdmission`
294
+ - `createSwarmHotspotReport`, `createSwarmRunStoreShards`
295
+ - `createSwarmPatchStackPlan`
296
+ - `createSwarmContextPack`, `createSwarmOracleCorpus`, `createSwarmLanePlaybook`
281
297
  - `classifySwarmMergeReadiness`, `classifySwarmMergeDisposition`
282
- - `resolveSwarmChangedRegions`
298
+ - `resolveSwarmChangedRegions`, `checkSwarmRegionOwnership`
283
299
  - `decomposeSwarmFeature`
284
300
  - `recordSwarmEvent`, `completeSwarmJob`
285
301
  - `resolveSwarmCompute`
@@ -295,7 +311,7 @@ Run the package-local benchmark:
295
311
  npm run bench
296
312
  ```
297
313
 
298
- The benchmark writes `benchmarks/results/frontier-swarm-package-bench-latest.json` when run from the monorepo. These are Frontier-only package measurements for plan creation, manifest validation, hierarchical compute resolution, ownership checks, scheduling/leases, queue snapshots, merge bundle creation, event routing, run checkpoints, JSONL, and proof hashing.
314
+ The benchmark writes `benchmarks/results/frontier-swarm-package-bench-latest.json` when run from the monorepo. These are Frontier-only package measurements for plan creation, manifest validation, hierarchical compute resolution, ownership checks, scheduling/leases, queue snapshots, queue overlays, merge bundles, merge indexes, merge admission, hotspot reports, context packs, oracle corpora, lane playbooks, patch stack plans, event routing, run checkpoints, JSONL, and proof hashing.
299
315
 
300
316
  ## Source Repository
301
317
 
@@ -4,12 +4,20 @@ import { performance } from 'node:perf_hooks';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import {
6
6
  checkSwarmOwnership,
7
+ createSwarmContextPack,
8
+ createSwarmHotspotReport,
9
+ createSwarmLanePlaybook,
10
+ createSwarmMergeAdmission,
7
11
  createSwarmManifest,
8
12
  createSwarmEventStream,
9
13
  createSwarmLeases,
10
14
  createSwarmMergeBundle,
15
+ createSwarmMergeIndex,
16
+ createSwarmOracleCorpus,
17
+ createSwarmPatchStackPlan,
11
18
  createSwarmPlan,
12
19
  createSwarmProof,
20
+ createSwarmQueueOverlay,
13
21
  createSwarmQueueSnapshot,
14
22
  createSwarmRun,
15
23
  createSwarmRunCheckpoint,
@@ -41,6 +49,8 @@ let cursor = 0;
41
49
  let schedule = createSwarmSchedule({ plan, maxReadyJobs: 128 });
42
50
  let leases = createSwarmLeases({ schedule, workerId: 'bench-worker', now: 1000, leaseMs: 60000, count: 16 });
43
51
  let eventStream = createSwarmEventStream({ runId: 'bench', root: 'agent-runs/bench/streams', lanes: manifest.lanes });
52
+ let bundles = makeBundles(plan, 32);
53
+ let mergeIndex = createSwarmMergeIndex({ bundles });
44
54
 
45
55
  const rows = [
46
56
  measure('create-plan-' + taskCount, 8, () => {
@@ -80,6 +90,45 @@ const rows = [
80
90
  },
81
91
  patchPath: 'agent-runs/bench/changes.patch'
82
92
  }).id.length),
93
+ measure('queue-overlay-' + taskCount, 16, () => createSwarmQueueOverlay({ bundles, generatedAt: 3000 + cursor++ }).summary.entryCount),
94
+ measure('merge-index-' + taskCount, 8, () => {
95
+ bundles = makeBundles(plan, 32);
96
+ mergeIndex = createSwarmMergeIndex({ bundles, generatedAt: 4000 + cursor++ });
97
+ return mergeIndex.summary.entryCount + mergeIndex.summary.conflictCount;
98
+ }),
99
+ measure('merge-admission-' + taskCount, 16, () => createSwarmMergeAdmission({ index: mergeIndex, maxReady: 8, maxChangedPaths: 16 }).summary.admittedCount),
100
+ measure('hotspot-report-' + taskCount, 16, () => createSwarmHotspotReport({ bundles, threshold: 3 }).summary.recommendationCount),
101
+ measure('context-pack-' + taskCount, 32, () => createSwarmContextPack({
102
+ job: plan.jobs[cursor % plan.jobs.length],
103
+ files: ['src/runtime/file.ts', 'test/runtime-smoke.mjs'],
104
+ apiMap: {
105
+ runtime: ['createRuntime', 'stepRuntime'],
106
+ tests: ['runtime smoke gate']
107
+ },
108
+ knownFailures: ['shared renderer gate is noisy on old snapshots'],
109
+ oracleCommands: [{ name: 'focused-gate', command: 'npm', args: ['test'], required: true }],
110
+ evidenceSchema: { type: 'object', required: ['ok', 'commands'] },
111
+ avoidInvestigating: ['unrelated route snapshots'],
112
+ playbookIds: ['runtime-playbook']
113
+ }).files.length),
114
+ measure('oracle-corpus-' + taskCount, 32, () => createSwarmOracleCorpus({
115
+ artifacts: [
116
+ { id: 'trace-runtime', path: 'oracles/runtime-trace.jsonl', kind: 'trace', tags: ['runtime', 'reference'], hash: 'fnv1a32:trace' },
117
+ { id: 'snapshot-routing', path: 'oracles/routing-snapshot.json', kind: 'snapshot', tags: ['routing', 'reference'] }
118
+ ]
119
+ }).summary.artifactCount),
120
+ measure('lane-playbook-' + taskCount, 16, () => createSwarmLanePlaybook({
121
+ lane: 'runtime',
122
+ successfulBundles: bundles,
123
+ notes: ['prefer narrow patches with focused evidence'],
124
+ commands: [{ name: 'runtime-smoke', command: 'npm', args: ['test'], required: true }],
125
+ avoidInvestigating: ['generated fixtures unless task owns them'],
126
+ evidencePatterns: ['evidence.json', 'commands.md']
127
+ }).successfulJobIds.length),
128
+ measure('patch-stack-plan-' + taskCount, 16, () => createSwarmPatchStackPlan({
129
+ index: mergeIndex,
130
+ maxStackSize: 8
131
+ }).summary.stackCount),
83
132
  measure('event-route-' + taskCount, 64, () => {
84
133
  eventStream = createSwarmEventStream({ runId: 'bench', root: 'agent-runs/bench/streams', lanes: manifest.lanes });
85
134
  return routeSwarmEventToMailboxes(eventStream, { type: 'agent.evidence', jobId: plan.jobs[cursor++ % plan.jobs.length].id, lane: 'runtime' }).length;
@@ -146,6 +195,25 @@ function makeTasks(count) {
146
195
  return tasks;
147
196
  }
148
197
 
198
+ function makeBundles(plan, count) {
199
+ const bundles = [];
200
+ for (let i = 0; i < Math.min(count, plan.jobs.length); i += 1) {
201
+ const job = plan.jobs[i];
202
+ bundles.push(createSwarmMergeBundle({
203
+ job,
204
+ result: {
205
+ jobId: job.id,
206
+ status: 'verified',
207
+ changedPaths: [job.task.targetRefs[0] ?? `src/runtime/file-${i}.ts`],
208
+ changedRegions: i % 2 === 0 ? [`region.${i}`] : [],
209
+ verification: [{ status: 0 }]
210
+ },
211
+ patchPath: `agent-runs/bench/${job.id}/changes.patch`
212
+ }));
213
+ }
214
+ return bundles;
215
+ }
216
+
149
217
  function measure(fixture, operationsPerRound, fn) {
150
218
  const samples = [];
151
219
  let checksum = 0;
package/dist/index.d.ts CHANGED
@@ -31,6 +31,26 @@ export declare const FRONTIER_SWARM_MERGE_PLAN_KIND = "frontier.swarm.merge-plan
31
31
  export declare const FRONTIER_SWARM_MERGE_PLAN_VERSION = 1;
32
32
  export declare const FRONTIER_SWARM_MERGE_BUNDLE_KIND = "frontier.swarm.merge-bundle";
33
33
  export declare const FRONTIER_SWARM_MERGE_BUNDLE_VERSION = 1;
34
+ export declare const FRONTIER_SWARM_QUEUE_OVERLAY_KIND = "frontier.swarm.queue-overlay";
35
+ export declare const FRONTIER_SWARM_QUEUE_OVERLAY_VERSION = 1;
36
+ export declare const FRONTIER_SWARM_MERGE_INDEX_KIND = "frontier.swarm.merge-index";
37
+ export declare const FRONTIER_SWARM_MERGE_INDEX_VERSION = 1;
38
+ export declare const FRONTIER_SWARM_HOTSPOT_REPORT_KIND = "frontier.swarm.hotspot-report";
39
+ export declare const FRONTIER_SWARM_HOTSPOT_REPORT_VERSION = 1;
40
+ export declare const FRONTIER_SWARM_REVIEWER_LANE_PLAN_KIND = "frontier.swarm.reviewer-lane-plan";
41
+ export declare const FRONTIER_SWARM_REVIEWER_LANE_PLAN_VERSION = 1;
42
+ export declare const FRONTIER_SWARM_RUN_STORE_SHARDS_KIND = "frontier.swarm.run-store-shards";
43
+ export declare const FRONTIER_SWARM_RUN_STORE_SHARDS_VERSION = 1;
44
+ export declare const FRONTIER_SWARM_MERGE_ADMISSION_KIND = "frontier.swarm.merge-admission";
45
+ export declare const FRONTIER_SWARM_MERGE_ADMISSION_VERSION = 1;
46
+ export declare const FRONTIER_SWARM_CONTEXT_PACK_KIND = "frontier.swarm.context-pack";
47
+ export declare const FRONTIER_SWARM_CONTEXT_PACK_VERSION = 1;
48
+ export declare const FRONTIER_SWARM_ORACLE_CORPUS_KIND = "frontier.swarm.oracle-corpus";
49
+ export declare const FRONTIER_SWARM_ORACLE_CORPUS_VERSION = 1;
50
+ export declare const FRONTIER_SWARM_LANE_PLAYBOOK_KIND = "frontier.swarm.lane-playbook";
51
+ export declare const FRONTIER_SWARM_LANE_PLAYBOOK_VERSION = 1;
52
+ export declare const FRONTIER_SWARM_PATCH_STACK_PLAN_KIND = "frontier.swarm.patch-stack-plan";
53
+ export declare const FRONTIER_SWARM_PATCH_STACK_PLAN_VERSION = 1;
34
54
  export declare const FRONTIER_SWARM_DEFAULT_CODEX_COMPUTE_ID = "codex.gpt-5.5.xhigh";
35
55
  export declare const FRONTIER_SWARM_DEFAULT_MODEL = "gpt-5.5";
36
56
  export declare const FRONTIER_SWARM_DEFAULT_REASONING_EFFORT = "xhigh";
@@ -42,6 +62,8 @@ export type FrontierSwarmJobStatus = 'planned' | 'scheduled' | 'running' | 'bloc
42
62
  export type FrontierSwarmMergeReadiness = 'discovery-only' | 'patch-candidate' | 'verified-patch' | 'rejected' | 'blocked' | string;
43
63
  export type FrontierSwarmMergeDisposition = 'auto-mergeable' | 'needs-port' | 'discovery-only' | 'rejected' | 'blocked' | 'stale-against-head' | string;
44
64
  export type FrontierSwarmRiskLevel = 'low' | 'medium' | 'high' | 'unknown' | string;
65
+ export type FrontierSwarmPatchStatus = 'unknown' | 'applies' | 'missing' | 'stale' | 'failed-check' | string;
66
+ export type FrontierSwarmQueueOverlayStatus = 'satisfied' | 'ready-to-apply' | 'needs-human-port' | 'failed-evidence' | 'stale-against-head' | 'discovery-only' | 'blocked' | 'rejected' | 'unknown' | string;
45
67
  export interface FrontierSwarmComputeInput {
46
68
  id: string;
47
69
  kind?: FrontierSwarmComputeKind;
@@ -1028,6 +1050,423 @@ export interface FrontierSwarmMergeBundle {
1028
1050
  reasons: string[];
1029
1051
  metadata?: JsonObject;
1030
1052
  }
1053
+ export interface FrontierSwarmQueueOverlayInput {
1054
+ id?: string;
1055
+ runId?: string;
1056
+ bundles?: readonly FrontierSwarmMergeBundle[];
1057
+ results?: readonly (FrontierSwarmJobResult | FrontierSwarmJobResultInput)[];
1058
+ generatedAt?: number;
1059
+ metadata?: unknown;
1060
+ }
1061
+ export interface FrontierSwarmQueueOverlay {
1062
+ kind: typeof FRONTIER_SWARM_QUEUE_OVERLAY_KIND;
1063
+ version: typeof FRONTIER_SWARM_QUEUE_OVERLAY_VERSION;
1064
+ id: string;
1065
+ runId?: string;
1066
+ generatedAt: number;
1067
+ entries: FrontierSwarmQueueOverlayEntry[];
1068
+ byQueueItemId: Record<string, FrontierSwarmQueueOverlayEntry[]>;
1069
+ summary: {
1070
+ entryCount: number;
1071
+ queueItemCount: number;
1072
+ readyToApplyCount: number;
1073
+ needsHumanPortCount: number;
1074
+ failedEvidenceCount: number;
1075
+ staleAgainstHeadCount: number;
1076
+ discoveryOnlyCount: number;
1077
+ };
1078
+ metadata?: JsonObject;
1079
+ }
1080
+ export interface FrontierSwarmQueueOverlayEntry {
1081
+ queueItemId: string;
1082
+ jobId: string;
1083
+ status: FrontierSwarmQueueOverlayStatus;
1084
+ mergeReadiness: FrontierSwarmMergeReadiness;
1085
+ disposition: FrontierSwarmMergeDisposition;
1086
+ riskLevel: FrontierSwarmRiskLevel;
1087
+ patchPath?: string;
1088
+ evidencePaths: string[];
1089
+ changedPaths: string[];
1090
+ changedRegions: string[];
1091
+ reasons: string[];
1092
+ generatedAt: number;
1093
+ }
1094
+ export interface FrontierSwarmDerivedQueueStatusInput {
1095
+ snapshot: FrontierSwarmQueueSnapshot;
1096
+ overlays?: readonly FrontierSwarmQueueOverlay[];
1097
+ generatedAt?: number;
1098
+ }
1099
+ export interface FrontierSwarmDerivedQueueStatus {
1100
+ generatedAt: number;
1101
+ jobs: FrontierSwarmQueueJob[];
1102
+ byStatus: Record<string, string[]>;
1103
+ summary: FrontierSwarmQueueSnapshot['summary'];
1104
+ }
1105
+ export interface FrontierSwarmMergeIndexInput {
1106
+ id?: string;
1107
+ runId?: string;
1108
+ planId?: string;
1109
+ bundles: readonly FrontierSwarmMergeBundle[];
1110
+ patchStatuses?: Record<string, FrontierSwarmPatchStatus>;
1111
+ generatedAt?: number;
1112
+ metadata?: unknown;
1113
+ }
1114
+ export interface FrontierSwarmMergeIndex {
1115
+ kind: typeof FRONTIER_SWARM_MERGE_INDEX_KIND;
1116
+ version: typeof FRONTIER_SWARM_MERGE_INDEX_VERSION;
1117
+ id: string;
1118
+ runId?: string;
1119
+ planId?: string;
1120
+ generatedAt: number;
1121
+ entries: FrontierSwarmMergeIndexEntry[];
1122
+ conflicts: FrontierSwarmMergeConflict[];
1123
+ byDisposition: Record<string, string[]>;
1124
+ byPath: Record<string, string[]>;
1125
+ byRegion: Record<string, string[]>;
1126
+ summary: {
1127
+ entryCount: number;
1128
+ readyToApplyCount: number;
1129
+ needsHumanPortCount: number;
1130
+ failedEvidenceCount: number;
1131
+ staleAgainstHeadCount: number;
1132
+ discoveryOnlyCount: number;
1133
+ conflictCount: number;
1134
+ conflictedJobCount: number;
1135
+ };
1136
+ metadata?: JsonObject;
1137
+ }
1138
+ export interface FrontierSwarmMergeIndexEntry {
1139
+ jobId: string;
1140
+ taskId?: string;
1141
+ lane?: string;
1142
+ title?: string;
1143
+ status: FrontierSwarmJobStatus;
1144
+ mergeReadiness: FrontierSwarmMergeReadiness;
1145
+ disposition: FrontierSwarmMergeDisposition;
1146
+ riskLevel: FrontierSwarmRiskLevel;
1147
+ patchStatus: FrontierSwarmPatchStatus;
1148
+ staleAgainstHead: boolean;
1149
+ autoMergeable: boolean;
1150
+ changedPaths: string[];
1151
+ changedRegions: string[];
1152
+ conflictKeys: string[];
1153
+ conflictingJobIds: string[];
1154
+ ownedFilesTouched: string[];
1155
+ ownershipViolations: string[];
1156
+ patchPath?: string;
1157
+ patchHash?: string;
1158
+ evidencePaths: string[];
1159
+ queueItemIds: string[];
1160
+ reasons: string[];
1161
+ generatedAt: number;
1162
+ }
1163
+ export interface FrontierSwarmMergeConflict {
1164
+ jobIds: string[];
1165
+ key: string;
1166
+ kind: 'path' | 'region';
1167
+ path?: string;
1168
+ region?: string;
1169
+ }
1170
+ export interface FrontierSwarmRegionOwnershipInput {
1171
+ changedPaths?: readonly string[];
1172
+ changedRegions?: readonly string[];
1173
+ }
1174
+ export interface FrontierSwarmRegionOwnershipReport {
1175
+ ok: boolean;
1176
+ jobId: string;
1177
+ changedPaths: string[];
1178
+ changedRegions: string[];
1179
+ ownedRegions: string[];
1180
+ regionViolations: string[];
1181
+ unclassifiedChangedPaths: string[];
1182
+ }
1183
+ export interface FrontierSwarmHotspotReportInput {
1184
+ id?: string;
1185
+ bundles?: readonly FrontierSwarmMergeBundle[];
1186
+ results?: readonly (FrontierSwarmJobResult | FrontierSwarmJobResultInput)[];
1187
+ threshold?: number;
1188
+ generatedAt?: number;
1189
+ metadata?: unknown;
1190
+ }
1191
+ export interface FrontierSwarmHotspotReport {
1192
+ kind: typeof FRONTIER_SWARM_HOTSPOT_REPORT_KIND;
1193
+ version: typeof FRONTIER_SWARM_HOTSPOT_REPORT_VERSION;
1194
+ id: string;
1195
+ generatedAt: number;
1196
+ threshold: number;
1197
+ entries: FrontierSwarmHotspotEntry[];
1198
+ recommendations: FrontierSwarmHotspotRecommendation[];
1199
+ summary: {
1200
+ pathCount: number;
1201
+ hotspotCount: number;
1202
+ recommendationCount: number;
1203
+ };
1204
+ metadata?: JsonObject;
1205
+ }
1206
+ export interface FrontierSwarmHotspotEntry {
1207
+ path: string;
1208
+ touchCount: number;
1209
+ jobIds: string[];
1210
+ regions: string[];
1211
+ dispositions: string[];
1212
+ riskLevels: string[];
1213
+ }
1214
+ export interface FrontierSwarmHotspotRecommendation {
1215
+ path: string;
1216
+ reason: 'repeated-conflicts' | 'hot-file' | 'region-overlap';
1217
+ suggestedModuleId: string;
1218
+ suggestedOwnershipRegions: string[];
1219
+ jobIds: string[];
1220
+ }
1221
+ export interface FrontierSwarmReviewerLanePlanInput {
1222
+ id?: string;
1223
+ index: FrontierSwarmMergeIndex;
1224
+ admission?: FrontierSwarmMergeAdmission;
1225
+ reviewerLane?: string;
1226
+ reviewers?: readonly string[];
1227
+ includeAutoMergeable?: boolean;
1228
+ generatedAt?: number;
1229
+ metadata?: unknown;
1230
+ }
1231
+ export interface FrontierSwarmReviewerLanePlan {
1232
+ kind: typeof FRONTIER_SWARM_REVIEWER_LANE_PLAN_KIND;
1233
+ version: typeof FRONTIER_SWARM_REVIEWER_LANE_PLAN_VERSION;
1234
+ id: string;
1235
+ mergeIndexId: string;
1236
+ generatedAt: number;
1237
+ reviewerLane: string;
1238
+ assignments: FrontierSwarmReviewerLaneAssignment[];
1239
+ tasks: FrontierSwarmTaskInput[];
1240
+ summary: {
1241
+ assignmentCount: number;
1242
+ taskCount: number;
1243
+ };
1244
+ metadata?: JsonObject;
1245
+ }
1246
+ export interface FrontierSwarmReviewerLaneAssignment {
1247
+ jobId: string;
1248
+ reviewers: string[];
1249
+ required: boolean;
1250
+ reasons: string[];
1251
+ }
1252
+ export interface FrontierSwarmRunStoreShardsInput {
1253
+ id?: string;
1254
+ run?: FrontierSwarmRun;
1255
+ plan?: FrontierSwarmPlan;
1256
+ root?: string;
1257
+ shardSize?: number;
1258
+ groupBy?: 'lane' | 'hash' | 'none';
1259
+ generatedAt?: number;
1260
+ metadata?: unknown;
1261
+ }
1262
+ export interface FrontierSwarmRunStoreShards {
1263
+ kind: typeof FRONTIER_SWARM_RUN_STORE_SHARDS_KIND;
1264
+ version: typeof FRONTIER_SWARM_RUN_STORE_SHARDS_VERSION;
1265
+ id: string;
1266
+ runId?: string;
1267
+ planId?: string;
1268
+ root: string;
1269
+ generatedAt: number;
1270
+ groupBy: 'lane' | 'hash' | 'none';
1271
+ shardSize: number;
1272
+ shards: FrontierSwarmRunStoreShard[];
1273
+ summary: {
1274
+ shardCount: number;
1275
+ jobCount: number;
1276
+ };
1277
+ metadata?: JsonObject;
1278
+ }
1279
+ export interface FrontierSwarmRunStoreShard {
1280
+ id: string;
1281
+ lane?: string;
1282
+ path: string;
1283
+ eventPath: string;
1284
+ resultPath: string;
1285
+ checkpointPath: string;
1286
+ jobIds: string[];
1287
+ }
1288
+ export interface FrontierSwarmMergeAdmissionInput {
1289
+ id?: string;
1290
+ index: FrontierSwarmMergeIndex;
1291
+ maxReady?: number;
1292
+ maxChangedPaths?: number;
1293
+ maxChangedRegions?: number;
1294
+ maxHighRisk?: number;
1295
+ allowRisks?: readonly FrontierSwarmRiskLevel[];
1296
+ generatedAt?: number;
1297
+ metadata?: unknown;
1298
+ }
1299
+ export interface FrontierSwarmMergeAdmission {
1300
+ kind: typeof FRONTIER_SWARM_MERGE_ADMISSION_KIND;
1301
+ version: typeof FRONTIER_SWARM_MERGE_ADMISSION_VERSION;
1302
+ id: string;
1303
+ mergeIndexId: string;
1304
+ generatedAt: number;
1305
+ admitted: string[];
1306
+ deferred: FrontierSwarmMergeAdmissionDeferral[];
1307
+ budget: {
1308
+ maxReady: number;
1309
+ maxChangedPaths?: number;
1310
+ maxChangedRegions?: number;
1311
+ maxHighRisk?: number;
1312
+ allowRisks: string[];
1313
+ };
1314
+ summary: {
1315
+ admittedCount: number;
1316
+ deferredCount: number;
1317
+ changedPathCount: number;
1318
+ changedRegionCount: number;
1319
+ highRiskCount: number;
1320
+ };
1321
+ metadata?: JsonObject;
1322
+ }
1323
+ export interface FrontierSwarmMergeAdmissionDeferral {
1324
+ jobId: string;
1325
+ reasons: string[];
1326
+ }
1327
+ export interface FrontierSwarmContextPackInput {
1328
+ id?: string;
1329
+ job?: FrontierSwarmJob;
1330
+ task?: FrontierSwarmTask | FrontierSwarmTaskInput;
1331
+ title?: string;
1332
+ files?: readonly string[];
1333
+ apiMap?: Record<string, readonly string[]>;
1334
+ knownFailures?: readonly string[];
1335
+ commands?: readonly (string | FrontierSwarmCommandInput)[];
1336
+ oracleCommands?: readonly (string | FrontierSwarmCommandInput)[];
1337
+ evidenceSchema?: unknown;
1338
+ expectedEvidence?: readonly string[];
1339
+ exclusions?: readonly string[];
1340
+ avoidInvestigating?: readonly string[];
1341
+ playbookIds?: readonly string[];
1342
+ generatedAt?: number;
1343
+ metadata?: unknown;
1344
+ }
1345
+ export interface FrontierSwarmContextPack {
1346
+ kind: typeof FRONTIER_SWARM_CONTEXT_PACK_KIND;
1347
+ version: typeof FRONTIER_SWARM_CONTEXT_PACK_VERSION;
1348
+ id: string;
1349
+ jobId?: string;
1350
+ taskId?: string;
1351
+ lane?: string;
1352
+ title: string;
1353
+ generatedAt: number;
1354
+ files: string[];
1355
+ apiMap: Record<string, string[]>;
1356
+ knownFailures: string[];
1357
+ commands: FrontierSwarmCommand[];
1358
+ oracleCommands: FrontierSwarmCommand[];
1359
+ evidenceSchema?: JsonValue;
1360
+ expectedEvidence: string[];
1361
+ exclusions: string[];
1362
+ avoidInvestigating: string[];
1363
+ playbookIds: string[];
1364
+ metadata?: JsonObject;
1365
+ }
1366
+ export interface FrontierSwarmOracleArtifactInput {
1367
+ id: string;
1368
+ path: string;
1369
+ kind?: string;
1370
+ command?: string | FrontierSwarmCommandInput;
1371
+ hash?: string;
1372
+ sourceRef?: string;
1373
+ tags?: readonly string[];
1374
+ metadata?: unknown;
1375
+ }
1376
+ export interface FrontierSwarmOracleArtifact {
1377
+ id: string;
1378
+ path: string;
1379
+ kind: string;
1380
+ command?: FrontierSwarmCommand;
1381
+ hash?: string;
1382
+ sourceRef?: string;
1383
+ tags: string[];
1384
+ metadata?: JsonObject;
1385
+ }
1386
+ export interface FrontierSwarmOracleCorpusInput {
1387
+ id?: string;
1388
+ title?: string;
1389
+ artifacts?: readonly FrontierSwarmOracleArtifactInput[];
1390
+ generatedAt?: number;
1391
+ metadata?: unknown;
1392
+ }
1393
+ export interface FrontierSwarmOracleCorpus {
1394
+ kind: typeof FRONTIER_SWARM_ORACLE_CORPUS_KIND;
1395
+ version: typeof FRONTIER_SWARM_ORACLE_CORPUS_VERSION;
1396
+ id: string;
1397
+ title: string;
1398
+ generatedAt: number;
1399
+ artifacts: FrontierSwarmOracleArtifact[];
1400
+ byKind: Record<string, string[]>;
1401
+ byTag: Record<string, string[]>;
1402
+ summary: {
1403
+ artifactCount: number;
1404
+ kindCount: number;
1405
+ tagCount: number;
1406
+ };
1407
+ metadata?: JsonObject;
1408
+ }
1409
+ export interface FrontierSwarmLanePlaybookInput {
1410
+ id?: string;
1411
+ lane: string;
1412
+ title?: string;
1413
+ successfulBundles?: readonly FrontierSwarmMergeBundle[];
1414
+ notes?: readonly string[];
1415
+ commands?: readonly (string | FrontierSwarmCommandInput)[];
1416
+ avoidInvestigating?: readonly string[];
1417
+ evidencePatterns?: readonly string[];
1418
+ generatedAt?: number;
1419
+ metadata?: unknown;
1420
+ }
1421
+ export interface FrontierSwarmLanePlaybook {
1422
+ kind: typeof FRONTIER_SWARM_LANE_PLAYBOOK_KIND;
1423
+ version: typeof FRONTIER_SWARM_LANE_PLAYBOOK_VERSION;
1424
+ id: string;
1425
+ lane: string;
1426
+ title: string;
1427
+ generatedAt: number;
1428
+ notes: string[];
1429
+ commands: FrontierSwarmCommand[];
1430
+ avoidInvestigating: string[];
1431
+ evidencePatterns: string[];
1432
+ successfulJobIds: string[];
1433
+ hotPaths: string[];
1434
+ changedRegions: string[];
1435
+ metadata?: JsonObject;
1436
+ }
1437
+ export interface FrontierSwarmPatchStackPlanInput {
1438
+ id?: string;
1439
+ index: FrontierSwarmMergeIndex;
1440
+ maxStackSize?: number;
1441
+ generatedAt?: number;
1442
+ metadata?: unknown;
1443
+ }
1444
+ export interface FrontierSwarmPatchStackPlan {
1445
+ kind: typeof FRONTIER_SWARM_PATCH_STACK_PLAN_KIND;
1446
+ version: typeof FRONTIER_SWARM_PATCH_STACK_PLAN_VERSION;
1447
+ id: string;
1448
+ mergeIndexId: string;
1449
+ generatedAt: number;
1450
+ stacks: FrontierSwarmPatchStack[];
1451
+ summary: {
1452
+ stackCount: number;
1453
+ jobCount: number;
1454
+ conflictedStackCount: number;
1455
+ };
1456
+ metadata?: JsonObject;
1457
+ }
1458
+ export interface FrontierSwarmPatchStack {
1459
+ id: string;
1460
+ title: string;
1461
+ lane?: string;
1462
+ jobIds: string[];
1463
+ changedPaths: string[];
1464
+ changedRegions: string[];
1465
+ riskLevels: string[];
1466
+ dispositions: string[];
1467
+ conflicts: FrontierSwarmMergeConflict[];
1468
+ gateHints: string[];
1469
+ }
1031
1470
  export interface FrontierSwarmProof {
1032
1471
  kind: typeof FRONTIER_SWARM_PROOF_KIND;
1033
1472
  version: typeof FRONTIER_SWARM_PROOF_VERSION;
@@ -1059,6 +1498,18 @@ export declare function classifySwarmMergeDisposition(result: FrontierSwarmJobRe
1059
1498
  staleAgainstHead?: boolean;
1060
1499
  }): FrontierSwarmMergeDisposition;
1061
1500
  export declare function createSwarmMergeBundle(input: FrontierSwarmMergeBundleInput): FrontierSwarmMergeBundle;
1501
+ export declare function createSwarmQueueOverlay(input?: FrontierSwarmQueueOverlayInput): FrontierSwarmQueueOverlay;
1502
+ export declare function deriveSwarmQueueStatus(input: FrontierSwarmDerivedQueueStatusInput): FrontierSwarmDerivedQueueStatus;
1503
+ export declare function createSwarmMergeIndex(input: FrontierSwarmMergeIndexInput): FrontierSwarmMergeIndex;
1504
+ export declare function checkSwarmRegionOwnership(job: FrontierSwarmJob, input?: FrontierSwarmRegionOwnershipInput): FrontierSwarmRegionOwnershipReport;
1505
+ export declare function createSwarmHotspotReport(input?: FrontierSwarmHotspotReportInput): FrontierSwarmHotspotReport;
1506
+ export declare function createSwarmReviewerLanePlan(input: FrontierSwarmReviewerLanePlanInput): FrontierSwarmReviewerLanePlan;
1507
+ export declare function createSwarmRunStoreShards(input?: FrontierSwarmRunStoreShardsInput): FrontierSwarmRunStoreShards;
1508
+ export declare function createSwarmMergeAdmission(input: FrontierSwarmMergeAdmissionInput): FrontierSwarmMergeAdmission;
1509
+ export declare function createSwarmContextPack(input?: FrontierSwarmContextPackInput): FrontierSwarmContextPack;
1510
+ export declare function createSwarmOracleCorpus(input?: FrontierSwarmOracleCorpusInput): FrontierSwarmOracleCorpus;
1511
+ export declare function createSwarmLanePlaybook(input: FrontierSwarmLanePlaybookInput): FrontierSwarmLanePlaybook;
1512
+ export declare function createSwarmPatchStackPlan(input: FrontierSwarmPatchStackPlanInput): FrontierSwarmPatchStackPlan;
1062
1513
  export declare function resolveSwarmCompute(manifestInput: FrontierSwarmManifest | FrontierSwarmManifestInput, taskInput: FrontierSwarmTask | FrontierSwarmTaskInput): FrontierSwarmCompute;
1063
1514
  export declare function createSwarmProof(input: FrontierSwarmManifest | FrontierSwarmPlan | FrontierSwarmRun, options?: {
1064
1515
  generatedAt?: number;