@shapeshift-labs/frontier-swarm 0.2.0 → 0.3.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 +18 -3
- package/benchmarks/package-bench.mjs +35 -1
- package/dist/index.d.ts +350 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +541 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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.
|
|
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.
|
|
@@ -211,10 +211,13 @@ Large swarms need a control plane, not just a flat worker loop. `frontier-swarm`
|
|
|
211
211
|
import {
|
|
212
212
|
checkSwarmBudget,
|
|
213
213
|
createSwarmArtifactIndex,
|
|
214
|
+
createSwarmEventStream,
|
|
214
215
|
createSwarmLeases,
|
|
215
216
|
createSwarmMergePlan,
|
|
217
|
+
createSwarmQueueSnapshot,
|
|
216
218
|
createSwarmReviewPlan,
|
|
217
|
-
createSwarmSchedule
|
|
219
|
+
createSwarmSchedule,
|
|
220
|
+
routeSwarmEventToMailboxes
|
|
218
221
|
} from '@shapeshift-labs/frontier-swarm';
|
|
219
222
|
|
|
220
223
|
const schedule = createSwarmSchedule({
|
|
@@ -237,10 +240,16 @@ The scale APIs are runtime-neutral and serializable:
|
|
|
237
240
|
- dependency DAGs are compiled into `plan.graph`,
|
|
238
241
|
- `createSwarmSchedule` returns ready, blocked, running, completed, and failed jobs under lane/compute/contention limits,
|
|
239
242
|
- `createSwarmLeases` gives workers expiring leases with fencing tokens,
|
|
243
|
+
- lane/task `capabilities` and `resourceRequirements` can reserve browser work with lower concurrency, port pools, profile directories, and explicit capability checks,
|
|
244
|
+
- `createSwarmQueueSnapshot` and run checkpoints give durable queue/run-store adapters a stable serialization shape,
|
|
245
|
+
- `createSwarmEventStream` and `routeSwarmEventToMailboxes` route global, lane, task, and worker events into coordinator-facing JSONL streams,
|
|
240
246
|
- `checkSwarmBudget` records token/cost/time/retry budget decisions,
|
|
241
247
|
- `createSwarmArtifactIndex` groups evidence, timelines, logs, and produced files,
|
|
242
248
|
- `createSwarmReviewPlan` samples or requires reviewer assignments,
|
|
243
249
|
- `createSwarmMergePlan` blocks jobs with failed checks, required reviews, ownership violations, or conflicting changed paths,
|
|
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,
|
|
252
|
+
- `createSwarmMergeBundle` builds a compact worker `merge.json` shape with touched owned files, patch path, evidence, verification, queue items satisfied, risk, and disposition,
|
|
244
253
|
- `decomposeSwarmFeature` creates an initial task queue for feature work across lanes.
|
|
245
254
|
|
|
246
255
|
## Hierarchical Compute
|
|
@@ -260,11 +269,17 @@ That lets a parent swarm route implementation jobs to a deep model while evidenc
|
|
|
260
269
|
- `defineSwarmManifest`, `createSwarmManifest`
|
|
261
270
|
- `defineSwarmTasks`
|
|
262
271
|
- `compileSwarm`, `validateSwarmManifest`
|
|
272
|
+
- `createSwarmTaskSelection`
|
|
263
273
|
- `createSwarmPlan`, `createSwarmRun`
|
|
264
274
|
- `createSwarmSchedule`, `createSwarmLeases`
|
|
275
|
+
- `createSwarmQueueSnapshot`, `createSwarmRunCheckpoint`
|
|
276
|
+
- `createSwarmEventStream`, `createSwarmMailbox`, `routeSwarmEventToMailboxes`
|
|
265
277
|
- `checkSwarmBudget`
|
|
266
278
|
- `createSwarmArtifactIndex`
|
|
267
279
|
- `createSwarmReviewPlan`, `createSwarmMergePlan`
|
|
280
|
+
- `createSwarmMergeBundle`
|
|
281
|
+
- `classifySwarmMergeReadiness`, `classifySwarmMergeDisposition`
|
|
282
|
+
- `resolveSwarmChangedRegions`
|
|
268
283
|
- `decomposeSwarmFeature`
|
|
269
284
|
- `recordSwarmEvent`, `completeSwarmJob`
|
|
270
285
|
- `resolveSwarmCompute`
|
|
@@ -280,7 +295,7 @@ Run the package-local benchmark:
|
|
|
280
295
|
npm run bench
|
|
281
296
|
```
|
|
282
297
|
|
|
283
|
-
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,
|
|
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.
|
|
284
299
|
|
|
285
300
|
## Source Repository
|
|
286
301
|
|
|
@@ -5,12 +5,19 @@ import { fileURLToPath } from 'node:url';
|
|
|
5
5
|
import {
|
|
6
6
|
checkSwarmOwnership,
|
|
7
7
|
createSwarmManifest,
|
|
8
|
+
createSwarmEventStream,
|
|
9
|
+
createSwarmLeases,
|
|
10
|
+
createSwarmMergeBundle,
|
|
8
11
|
createSwarmPlan,
|
|
9
12
|
createSwarmProof,
|
|
13
|
+
createSwarmQueueSnapshot,
|
|
10
14
|
createSwarmRun,
|
|
15
|
+
createSwarmRunCheckpoint,
|
|
16
|
+
createSwarmSchedule,
|
|
11
17
|
decodeSwarmJsonl,
|
|
12
18
|
defineSwarmTasks,
|
|
13
19
|
encodeSwarmJsonl,
|
|
20
|
+
routeSwarmEventToMailboxes,
|
|
14
21
|
resolveSwarmCompute,
|
|
15
22
|
validateSwarmManifest
|
|
16
23
|
} from '../dist/index.js';
|
|
@@ -31,6 +38,9 @@ let plan = createSwarmPlan(manifest, tasks, { limit: 64 });
|
|
|
31
38
|
let run = createSwarmRun({ plan });
|
|
32
39
|
let jsonl = encodeSwarmJsonl([plan, run]);
|
|
33
40
|
let cursor = 0;
|
|
41
|
+
let schedule = createSwarmSchedule({ plan, maxReadyJobs: 128 });
|
|
42
|
+
let leases = createSwarmLeases({ schedule, workerId: 'bench-worker', now: 1000, leaseMs: 60000, count: 16 });
|
|
43
|
+
let eventStream = createSwarmEventStream({ runId: 'bench', root: 'agent-runs/bench/streams', lanes: manifest.lanes });
|
|
34
44
|
|
|
35
45
|
const rows = [
|
|
36
46
|
measure('create-plan-' + taskCount, 8, () => {
|
|
@@ -49,7 +59,31 @@ const rows = [
|
|
|
49
59
|
return jsonl.length;
|
|
50
60
|
}),
|
|
51
61
|
measure('jsonl-decode', 16, () => decodeSwarmJsonl(jsonl).length),
|
|
52
|
-
measure('proof', 16, () => createSwarmProof(plan).hash.length)
|
|
62
|
+
measure('proof', 16, () => createSwarmProof(plan).hash.length),
|
|
63
|
+
measure('schedule-lease-' + taskCount, 8, () => {
|
|
64
|
+
schedule = createSwarmSchedule({ plan, maxReadyJobs: 128, maxComputeConcurrency: { fast: 64, deep: 32 } });
|
|
65
|
+
leases = createSwarmLeases({ schedule, workerId: 'bench-worker', now: 1000 + cursor++, leaseMs: 60000, count: 16 });
|
|
66
|
+
return schedule.ready.length + leases.length;
|
|
67
|
+
}),
|
|
68
|
+
measure('queue-snapshot-' + taskCount, 8, () => {
|
|
69
|
+
const snapshot = createSwarmQueueSnapshot({ plan, run, leases, generatedAt: 2000 + cursor++ });
|
|
70
|
+
return snapshot.summary.jobCount + snapshot.summary.leaseCount;
|
|
71
|
+
}),
|
|
72
|
+
measure('run-checkpoint-' + taskCount, 16, () => createSwarmRunCheckpoint({ run, sequence: cursor++ }).hash.length),
|
|
73
|
+
measure('merge-bundle-' + taskCount, 32, () => createSwarmMergeBundle({
|
|
74
|
+
job: plan.jobs[cursor % plan.jobs.length],
|
|
75
|
+
result: {
|
|
76
|
+
jobId: plan.jobs[cursor++ % plan.jobs.length].id,
|
|
77
|
+
status: 'completed',
|
|
78
|
+
changedPaths: ['src/runtime/file.ts'],
|
|
79
|
+
verification: [{ status: 0 }]
|
|
80
|
+
},
|
|
81
|
+
patchPath: 'agent-runs/bench/changes.patch'
|
|
82
|
+
}).id.length),
|
|
83
|
+
measure('event-route-' + taskCount, 64, () => {
|
|
84
|
+
eventStream = createSwarmEventStream({ runId: 'bench', root: 'agent-runs/bench/streams', lanes: manifest.lanes });
|
|
85
|
+
return routeSwarmEventToMailboxes(eventStream, { type: 'agent.evidence', jobId: plan.jobs[cursor++ % plan.jobs.length].id, lane: 'runtime' }).length;
|
|
86
|
+
})
|
|
53
87
|
];
|
|
54
88
|
|
|
55
89
|
const report = {
|
package/dist/index.d.ts
CHANGED
|
@@ -9,18 +9,28 @@ export declare const FRONTIER_SWARM_RUN_KIND = "frontier.swarm.run";
|
|
|
9
9
|
export declare const FRONTIER_SWARM_RUN_VERSION = 1;
|
|
10
10
|
export declare const FRONTIER_SWARM_EVENT_KIND = "frontier.swarm.event";
|
|
11
11
|
export declare const FRONTIER_SWARM_EVENT_VERSION = 1;
|
|
12
|
+
export declare const FRONTIER_SWARM_EVENT_STREAM_KIND = "frontier.swarm.event-stream";
|
|
13
|
+
export declare const FRONTIER_SWARM_EVENT_STREAM_VERSION = 1;
|
|
14
|
+
export declare const FRONTIER_SWARM_MAILBOX_KIND = "frontier.swarm.mailbox";
|
|
15
|
+
export declare const FRONTIER_SWARM_MAILBOX_VERSION = 1;
|
|
12
16
|
export declare const FRONTIER_SWARM_PROOF_KIND = "frontier.swarm.proof";
|
|
13
17
|
export declare const FRONTIER_SWARM_PROOF_VERSION = 1;
|
|
14
18
|
export declare const FRONTIER_SWARM_SCHEDULE_KIND = "frontier.swarm.schedule";
|
|
15
19
|
export declare const FRONTIER_SWARM_SCHEDULE_VERSION = 1;
|
|
16
20
|
export declare const FRONTIER_SWARM_LEASE_KIND = "frontier.swarm.lease";
|
|
17
21
|
export declare const FRONTIER_SWARM_LEASE_VERSION = 1;
|
|
22
|
+
export declare const FRONTIER_SWARM_QUEUE_SNAPSHOT_KIND = "frontier.swarm.queue-snapshot";
|
|
23
|
+
export declare const FRONTIER_SWARM_QUEUE_SNAPSHOT_VERSION = 1;
|
|
24
|
+
export declare const FRONTIER_SWARM_RUN_CHECKPOINT_KIND = "frontier.swarm.run-checkpoint";
|
|
25
|
+
export declare const FRONTIER_SWARM_RUN_CHECKPOINT_VERSION = 1;
|
|
18
26
|
export declare const FRONTIER_SWARM_ARTIFACT_INDEX_KIND = "frontier.swarm.artifact-index";
|
|
19
27
|
export declare const FRONTIER_SWARM_ARTIFACT_INDEX_VERSION = 1;
|
|
20
28
|
export declare const FRONTIER_SWARM_REVIEW_PLAN_KIND = "frontier.swarm.review-plan";
|
|
21
29
|
export declare const FRONTIER_SWARM_REVIEW_PLAN_VERSION = 1;
|
|
22
30
|
export declare const FRONTIER_SWARM_MERGE_PLAN_KIND = "frontier.swarm.merge-plan";
|
|
23
31
|
export declare const FRONTIER_SWARM_MERGE_PLAN_VERSION = 1;
|
|
32
|
+
export declare const FRONTIER_SWARM_MERGE_BUNDLE_KIND = "frontier.swarm.merge-bundle";
|
|
33
|
+
export declare const FRONTIER_SWARM_MERGE_BUNDLE_VERSION = 1;
|
|
24
34
|
export declare const FRONTIER_SWARM_DEFAULT_CODEX_COMPUTE_ID = "codex.gpt-5.5.xhigh";
|
|
25
35
|
export declare const FRONTIER_SWARM_DEFAULT_MODEL = "gpt-5.5";
|
|
26
36
|
export declare const FRONTIER_SWARM_DEFAULT_REASONING_EFFORT = "xhigh";
|
|
@@ -29,6 +39,9 @@ export type FrontierSwarmReasoningEffort = 'minimal' | 'low' | 'medium' | 'high'
|
|
|
29
39
|
export type FrontierSwarmPolicyMode = 'advisory' | 'hard-file-ownership' | string;
|
|
30
40
|
export type FrontierSwarmTaskStatus = 'open' | 'planned' | 'running' | 'blocked' | 'failed' | 'completed' | 'verified' | string;
|
|
31
41
|
export type FrontierSwarmJobStatus = 'planned' | 'scheduled' | 'running' | 'blocked' | 'failed' | 'completed' | 'verified' | string;
|
|
42
|
+
export type FrontierSwarmMergeReadiness = 'discovery-only' | 'patch-candidate' | 'verified-patch' | 'rejected' | 'blocked' | string;
|
|
43
|
+
export type FrontierSwarmMergeDisposition = 'auto-mergeable' | 'needs-port' | 'discovery-only' | 'rejected' | 'blocked' | 'stale-against-head' | string;
|
|
44
|
+
export type FrontierSwarmRiskLevel = 'low' | 'medium' | 'high' | 'unknown' | string;
|
|
32
45
|
export interface FrontierSwarmComputeInput {
|
|
33
46
|
id: string;
|
|
34
47
|
kind?: FrontierSwarmComputeKind;
|
|
@@ -79,6 +92,25 @@ export interface FrontierSwarmLayer {
|
|
|
79
92
|
tags: string[];
|
|
80
93
|
metadata?: JsonObject;
|
|
81
94
|
}
|
|
95
|
+
export interface FrontierSwarmOwnershipRegionInput {
|
|
96
|
+
id: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
globs?: readonly string[];
|
|
100
|
+
paths?: readonly string[];
|
|
101
|
+
selectors?: readonly string[];
|
|
102
|
+
owner?: string;
|
|
103
|
+
metadata?: unknown;
|
|
104
|
+
}
|
|
105
|
+
export interface FrontierSwarmOwnershipRegion {
|
|
106
|
+
id: string;
|
|
107
|
+
title: string;
|
|
108
|
+
description?: string;
|
|
109
|
+
globs: string[];
|
|
110
|
+
selectors: string[];
|
|
111
|
+
owner?: string;
|
|
112
|
+
metadata?: JsonObject;
|
|
113
|
+
}
|
|
82
114
|
export interface FrontierSwarmLaneInput {
|
|
83
115
|
id: string;
|
|
84
116
|
title?: string;
|
|
@@ -89,6 +121,9 @@ export interface FrontierSwarmLaneInput {
|
|
|
89
121
|
allowedGlobs?: readonly string[];
|
|
90
122
|
sharedReadOnly?: readonly string[];
|
|
91
123
|
neverEdit?: readonly string[];
|
|
124
|
+
ownershipRegions?: readonly FrontierSwarmOwnershipRegionInput[];
|
|
125
|
+
capabilities?: readonly string[];
|
|
126
|
+
resourceRequirements?: FrontierSwarmResourceRequirementsInput;
|
|
92
127
|
worktreePath?: string;
|
|
93
128
|
evidencePrefix?: string;
|
|
94
129
|
evidenceOutDirPrefix?: string;
|
|
@@ -107,6 +142,9 @@ export interface FrontierSwarmLane {
|
|
|
107
142
|
allowedWrites: string[];
|
|
108
143
|
sharedReadOnly: string[];
|
|
109
144
|
neverEdit: string[];
|
|
145
|
+
ownershipRegions: FrontierSwarmOwnershipRegion[];
|
|
146
|
+
capabilities: string[];
|
|
147
|
+
resourceRequirements?: FrontierSwarmResourceRequirements;
|
|
110
148
|
worktreePath?: string;
|
|
111
149
|
evidencePrefix?: string;
|
|
112
150
|
concurrencyKey: string;
|
|
@@ -131,6 +169,36 @@ export interface FrontierSwarmCommand {
|
|
|
131
169
|
cwd?: string;
|
|
132
170
|
metadata?: JsonObject;
|
|
133
171
|
}
|
|
172
|
+
export interface FrontierSwarmBrowserResourceInput {
|
|
173
|
+
required?: boolean;
|
|
174
|
+
portPool?: readonly (string | number)[];
|
|
175
|
+
profileDir?: string;
|
|
176
|
+
profileDirPrefix?: string;
|
|
177
|
+
maxConcurrency?: number;
|
|
178
|
+
headless?: boolean;
|
|
179
|
+
metadata?: unknown;
|
|
180
|
+
}
|
|
181
|
+
export interface FrontierSwarmBrowserResource {
|
|
182
|
+
required: boolean;
|
|
183
|
+
portPool: string[];
|
|
184
|
+
profileDir?: string;
|
|
185
|
+
profileDirPrefix?: string;
|
|
186
|
+
maxConcurrency?: number;
|
|
187
|
+
headless?: boolean;
|
|
188
|
+
metadata?: JsonObject;
|
|
189
|
+
}
|
|
190
|
+
export interface FrontierSwarmResourceRequirementsInput {
|
|
191
|
+
capabilities?: readonly string[];
|
|
192
|
+
resources?: Record<string, number>;
|
|
193
|
+
browser?: FrontierSwarmBrowserResourceInput;
|
|
194
|
+
metadata?: unknown;
|
|
195
|
+
}
|
|
196
|
+
export interface FrontierSwarmResourceRequirements {
|
|
197
|
+
capabilities: string[];
|
|
198
|
+
resources: Record<string, number>;
|
|
199
|
+
browser?: FrontierSwarmBrowserResource;
|
|
200
|
+
metadata?: JsonObject;
|
|
201
|
+
}
|
|
134
202
|
export interface FrontierSwarmPolicyInput {
|
|
135
203
|
mode?: FrontierSwarmPolicyMode;
|
|
136
204
|
defaultConcurrency?: number;
|
|
@@ -217,6 +285,11 @@ export interface FrontierSwarmTaskInput {
|
|
|
217
285
|
targetRefs?: readonly string[];
|
|
218
286
|
ownedFiles?: readonly string[];
|
|
219
287
|
allowedWrites?: readonly string[];
|
|
288
|
+
ownershipRegions?: readonly FrontierSwarmOwnershipRegionInput[];
|
|
289
|
+
ownedRegions?: readonly string[];
|
|
290
|
+
changedRegions?: readonly string[];
|
|
291
|
+
capabilities?: readonly string[];
|
|
292
|
+
resourceRequirements?: FrontierSwarmResourceRequirementsInput;
|
|
220
293
|
acceptance?: readonly string[];
|
|
221
294
|
acceptanceChecks?: readonly ({
|
|
222
295
|
id?: string;
|
|
@@ -249,6 +322,11 @@ export interface FrontierSwarmTask {
|
|
|
249
322
|
sourceRefs: string[];
|
|
250
323
|
targetRefs: string[];
|
|
251
324
|
allowedWrites: string[];
|
|
325
|
+
ownershipRegions: FrontierSwarmOwnershipRegion[];
|
|
326
|
+
ownedRegions: string[];
|
|
327
|
+
changedRegions: string[];
|
|
328
|
+
capabilities: string[];
|
|
329
|
+
resourceRequirements?: FrontierSwarmResourceRequirements;
|
|
252
330
|
acceptance: string[];
|
|
253
331
|
verification: FrontierSwarmCommand[];
|
|
254
332
|
evidenceCommand?: string;
|
|
@@ -286,6 +364,38 @@ export interface FrontierSwarmPlanFilter {
|
|
|
286
364
|
limit?: number;
|
|
287
365
|
compute?: string;
|
|
288
366
|
}
|
|
367
|
+
export interface FrontierSwarmSelectionPriorityInput {
|
|
368
|
+
statuses?: Record<string, number>;
|
|
369
|
+
workKinds?: Record<string, number>;
|
|
370
|
+
defaultStatusRank?: number;
|
|
371
|
+
defaultWorkKindRank?: number;
|
|
372
|
+
statusWeight?: number;
|
|
373
|
+
workKindWeight?: number;
|
|
374
|
+
}
|
|
375
|
+
export interface FrontierSwarmTaskSelectionInput extends FrontierSwarmPlanFilter {
|
|
376
|
+
workKinds?: readonly string[];
|
|
377
|
+
spreadLanes?: boolean;
|
|
378
|
+
includeOwnershipWarnings?: boolean;
|
|
379
|
+
assignSelectionPriority?: boolean;
|
|
380
|
+
priority?: FrontierSwarmSelectionPriorityInput;
|
|
381
|
+
}
|
|
382
|
+
export interface FrontierSwarmTaskSelectionEntry {
|
|
383
|
+
task: FrontierSwarmTask;
|
|
384
|
+
lane?: FrontierSwarmLane;
|
|
385
|
+
ownershipWarnings: string[];
|
|
386
|
+
selectionPriority: number;
|
|
387
|
+
}
|
|
388
|
+
export interface FrontierSwarmTaskSelectionSummary {
|
|
389
|
+
total: number;
|
|
390
|
+
byLane: Record<string, number>;
|
|
391
|
+
byWorkKind: Record<string, number>;
|
|
392
|
+
ownershipWarningCount: number;
|
|
393
|
+
}
|
|
394
|
+
export interface FrontierSwarmTaskSelection {
|
|
395
|
+
tasks: FrontierSwarmTask[];
|
|
396
|
+
entries: FrontierSwarmTaskSelectionEntry[];
|
|
397
|
+
summary: FrontierSwarmTaskSelectionSummary;
|
|
398
|
+
}
|
|
289
399
|
export interface FrontierSwarmPlanInput extends FrontierSwarmPlanFilter {
|
|
290
400
|
id?: string;
|
|
291
401
|
runId?: string;
|
|
@@ -330,6 +440,11 @@ export interface FrontierSwarmJob {
|
|
|
330
440
|
allowedWrites: string[];
|
|
331
441
|
sharedReadOnly: string[];
|
|
332
442
|
neverEdit: string[];
|
|
443
|
+
ownershipRegions: FrontierSwarmOwnershipRegion[];
|
|
444
|
+
ownedRegions: string[];
|
|
445
|
+
changedRegions: string[];
|
|
446
|
+
capabilities: string[];
|
|
447
|
+
resourceRequirements?: FrontierSwarmResourceRequirements;
|
|
333
448
|
worktreePath?: string;
|
|
334
449
|
evidencePrefix?: string;
|
|
335
450
|
concurrencyKey: string;
|
|
@@ -454,6 +569,8 @@ export interface FrontierSwarmScheduledJob {
|
|
|
454
569
|
concurrencyKey: string;
|
|
455
570
|
priority: number;
|
|
456
571
|
dependsOn: string[];
|
|
572
|
+
capabilities: string[];
|
|
573
|
+
resourceRequirements?: FrontierSwarmResourceRequirements;
|
|
457
574
|
}
|
|
458
575
|
export interface FrontierSwarmBlockedJob extends FrontierSwarmScheduledJob {
|
|
459
576
|
reasons: string[];
|
|
@@ -464,6 +581,8 @@ export interface FrontierSwarmRunningJob {
|
|
|
464
581
|
lane: string;
|
|
465
582
|
compute: string;
|
|
466
583
|
concurrencyKey: string;
|
|
584
|
+
capabilities: string[];
|
|
585
|
+
resourceRequirements?: FrontierSwarmResourceRequirements;
|
|
467
586
|
}
|
|
468
587
|
export interface FrontierSwarmScheduleSummary {
|
|
469
588
|
jobCount: number;
|
|
@@ -493,6 +612,110 @@ export interface FrontierSwarmLease {
|
|
|
493
612
|
fencingToken: number;
|
|
494
613
|
status: 'active' | 'expired' | 'released';
|
|
495
614
|
}
|
|
615
|
+
export type FrontierSwarmQueueJobStatus = 'ready' | 'leased' | 'running' | 'completed' | 'failed' | 'blocked' | 'retrying' | 'dead-letter' | string;
|
|
616
|
+
export interface FrontierSwarmQueueJobInput {
|
|
617
|
+
jobId: string;
|
|
618
|
+
taskId?: string;
|
|
619
|
+
runId?: string;
|
|
620
|
+
status?: FrontierSwarmQueueJobStatus;
|
|
621
|
+
lane?: string;
|
|
622
|
+
compute?: string;
|
|
623
|
+
concurrencyKey?: string;
|
|
624
|
+
priority?: number;
|
|
625
|
+
attempts?: number;
|
|
626
|
+
maxAttempts?: number;
|
|
627
|
+
availableAt?: number;
|
|
628
|
+
lease?: FrontierSwarmLease;
|
|
629
|
+
lastError?: string;
|
|
630
|
+
metadata?: unknown;
|
|
631
|
+
}
|
|
632
|
+
export interface FrontierSwarmQueueJob {
|
|
633
|
+
jobId: string;
|
|
634
|
+
taskId?: string;
|
|
635
|
+
runId?: string;
|
|
636
|
+
status: FrontierSwarmQueueJobStatus;
|
|
637
|
+
lane?: string;
|
|
638
|
+
compute?: string;
|
|
639
|
+
concurrencyKey?: string;
|
|
640
|
+
priority: number;
|
|
641
|
+
attempts: number;
|
|
642
|
+
maxAttempts: number;
|
|
643
|
+
availableAt?: number;
|
|
644
|
+
lease?: FrontierSwarmLease;
|
|
645
|
+
lastError?: string;
|
|
646
|
+
metadata?: JsonObject;
|
|
647
|
+
}
|
|
648
|
+
export interface FrontierSwarmQueueSnapshotInput {
|
|
649
|
+
id?: string;
|
|
650
|
+
plan: FrontierSwarmPlan;
|
|
651
|
+
run?: FrontierSwarmRun;
|
|
652
|
+
jobs?: readonly FrontierSwarmQueueJobInput[];
|
|
653
|
+
leases?: readonly FrontierSwarmLease[];
|
|
654
|
+
generatedAt?: number;
|
|
655
|
+
metadata?: unknown;
|
|
656
|
+
}
|
|
657
|
+
export interface FrontierSwarmQueueSnapshot {
|
|
658
|
+
kind: typeof FRONTIER_SWARM_QUEUE_SNAPSHOT_KIND;
|
|
659
|
+
version: typeof FRONTIER_SWARM_QUEUE_SNAPSHOT_VERSION;
|
|
660
|
+
id: string;
|
|
661
|
+
planId: string;
|
|
662
|
+
runId: string;
|
|
663
|
+
generatedAt: number;
|
|
664
|
+
jobs: FrontierSwarmQueueJob[];
|
|
665
|
+
byStatus: Record<string, string[]>;
|
|
666
|
+
byLane: Record<string, string[]>;
|
|
667
|
+
leases: FrontierSwarmLease[];
|
|
668
|
+
metadata?: JsonObject;
|
|
669
|
+
summary: {
|
|
670
|
+
jobCount: number;
|
|
671
|
+
leaseCount: number;
|
|
672
|
+
readyCount: number;
|
|
673
|
+
leasedCount: number;
|
|
674
|
+
completedCount: number;
|
|
675
|
+
failedCount: number;
|
|
676
|
+
deadLetterCount: number;
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
export interface FrontierSwarmLeaseRenewalInput {
|
|
680
|
+
lease: FrontierSwarmLease;
|
|
681
|
+
now?: number;
|
|
682
|
+
leaseMs?: number;
|
|
683
|
+
status?: FrontierSwarmLease['status'];
|
|
684
|
+
}
|
|
685
|
+
export interface FrontierSwarmQueueAdapter {
|
|
686
|
+
snapshot(): FrontierSwarmQueueSnapshot | Promise<FrontierSwarmQueueSnapshot>;
|
|
687
|
+
enqueue?(snapshot: FrontierSwarmQueueSnapshot): FrontierSwarmQueueSnapshot | Promise<FrontierSwarmQueueSnapshot>;
|
|
688
|
+
lease?(input: FrontierSwarmLeaseInput): readonly FrontierSwarmLease[] | Promise<readonly FrontierSwarmLease[]>;
|
|
689
|
+
renew?(input: FrontierSwarmLeaseRenewalInput): FrontierSwarmLease | Promise<FrontierSwarmLease>;
|
|
690
|
+
complete?(result: FrontierSwarmJobResultInput): FrontierSwarmQueueSnapshot | Promise<FrontierSwarmQueueSnapshot>;
|
|
691
|
+
}
|
|
692
|
+
export interface FrontierSwarmRunCheckpointInput {
|
|
693
|
+
run: FrontierSwarmRun;
|
|
694
|
+
sequence?: number;
|
|
695
|
+
savedAt?: number;
|
|
696
|
+
metadata?: unknown;
|
|
697
|
+
}
|
|
698
|
+
export interface FrontierSwarmRunCheckpoint {
|
|
699
|
+
kind: typeof FRONTIER_SWARM_RUN_CHECKPOINT_KIND;
|
|
700
|
+
version: typeof FRONTIER_SWARM_RUN_CHECKPOINT_VERSION;
|
|
701
|
+
id: string;
|
|
702
|
+
runId: string;
|
|
703
|
+
planId: string;
|
|
704
|
+
sequence: number;
|
|
705
|
+
savedAt: number;
|
|
706
|
+
status: FrontierSwarmJobStatus;
|
|
707
|
+
eventCount: number;
|
|
708
|
+
resultCount: number;
|
|
709
|
+
hash: string;
|
|
710
|
+
metadata?: JsonObject;
|
|
711
|
+
}
|
|
712
|
+
export interface FrontierSwarmRunStoreAdapter {
|
|
713
|
+
loadRun(runId: string): FrontierSwarmRun | undefined | Promise<FrontierSwarmRun | undefined>;
|
|
714
|
+
saveRun(run: FrontierSwarmRun, checkpoint?: FrontierSwarmRunCheckpoint): void | Promise<void>;
|
|
715
|
+
appendEvents?(runId: string, events: readonly FrontierSwarmEventInput[]): void | Promise<void>;
|
|
716
|
+
appendResults?(runId: string, results: readonly FrontierSwarmJobResultInput[]): void | Promise<void>;
|
|
717
|
+
checkpoint?(run: FrontierSwarmRun): FrontierSwarmRunCheckpoint | Promise<FrontierSwarmRunCheckpoint>;
|
|
718
|
+
}
|
|
496
719
|
export interface FrontierSwarmArtifactInput {
|
|
497
720
|
jobId: string;
|
|
498
721
|
path: string;
|
|
@@ -634,16 +857,73 @@ export interface FrontierSwarmEvent {
|
|
|
634
857
|
data?: JsonValue;
|
|
635
858
|
metadata?: JsonObject;
|
|
636
859
|
}
|
|
860
|
+
export type FrontierSwarmMailboxScope = 'global' | 'lane' | 'job' | string;
|
|
861
|
+
export interface FrontierSwarmMailboxInput {
|
|
862
|
+
id?: string;
|
|
863
|
+
runId?: string;
|
|
864
|
+
scope?: FrontierSwarmMailboxScope;
|
|
865
|
+
lane?: string;
|
|
866
|
+
jobId?: string;
|
|
867
|
+
path?: string;
|
|
868
|
+
eventTypes?: readonly string[];
|
|
869
|
+
appendOnly?: boolean;
|
|
870
|
+
metadata?: unknown;
|
|
871
|
+
}
|
|
872
|
+
export interface FrontierSwarmMailbox {
|
|
873
|
+
kind: typeof FRONTIER_SWARM_MAILBOX_KIND;
|
|
874
|
+
version: typeof FRONTIER_SWARM_MAILBOX_VERSION;
|
|
875
|
+
id: string;
|
|
876
|
+
runId?: string;
|
|
877
|
+
scope: FrontierSwarmMailboxScope;
|
|
878
|
+
lane?: string;
|
|
879
|
+
jobId?: string;
|
|
880
|
+
path?: string;
|
|
881
|
+
eventTypes: string[];
|
|
882
|
+
appendOnly: boolean;
|
|
883
|
+
metadata?: JsonObject;
|
|
884
|
+
}
|
|
885
|
+
export interface FrontierSwarmEventStreamInput {
|
|
886
|
+
id?: string;
|
|
887
|
+
runId?: string;
|
|
888
|
+
root?: string;
|
|
889
|
+
lanes?: readonly (string | FrontierSwarmLaneInput | FrontierSwarmLane)[];
|
|
890
|
+
eventTypes?: readonly string[];
|
|
891
|
+
appendOnly?: boolean;
|
|
892
|
+
metadata?: unknown;
|
|
893
|
+
}
|
|
894
|
+
export interface FrontierSwarmEventStream {
|
|
895
|
+
kind: typeof FRONTIER_SWARM_EVENT_STREAM_KIND;
|
|
896
|
+
version: typeof FRONTIER_SWARM_EVENT_STREAM_VERSION;
|
|
897
|
+
id: string;
|
|
898
|
+
runId?: string;
|
|
899
|
+
root?: string;
|
|
900
|
+
appendOnly: boolean;
|
|
901
|
+
global: FrontierSwarmMailbox;
|
|
902
|
+
lanes: Record<string, FrontierSwarmMailbox>;
|
|
903
|
+
eventTypes: string[];
|
|
904
|
+
metadata?: JsonObject;
|
|
905
|
+
summary: {
|
|
906
|
+
mailboxCount: number;
|
|
907
|
+
laneCount: number;
|
|
908
|
+
eventTypeCount: number;
|
|
909
|
+
};
|
|
910
|
+
}
|
|
637
911
|
export interface FrontierSwarmJobResultInput {
|
|
638
912
|
jobId: string;
|
|
639
913
|
status?: FrontierSwarmJobStatus;
|
|
914
|
+
mergeReadiness?: FrontierSwarmMergeReadiness;
|
|
640
915
|
startedAt?: number;
|
|
641
916
|
finishedAt?: number;
|
|
642
917
|
exitCode?: number;
|
|
643
918
|
signal?: string;
|
|
644
919
|
changedPaths?: readonly string[];
|
|
920
|
+
changedRegions?: readonly string[];
|
|
645
921
|
ownershipViolations?: readonly string[];
|
|
646
922
|
evidencePaths?: readonly string[];
|
|
923
|
+
patchPath?: string;
|
|
924
|
+
queueItemIds?: readonly string[];
|
|
925
|
+
riskLevel?: FrontierSwarmRiskLevel;
|
|
926
|
+
mergeDisposition?: FrontierSwarmMergeDisposition;
|
|
647
927
|
verification?: readonly FrontierSwarmVerificationResultInput[];
|
|
648
928
|
lastMessage?: string;
|
|
649
929
|
error?: unknown;
|
|
@@ -672,14 +952,20 @@ export interface FrontierSwarmVerificationResult {
|
|
|
672
952
|
export interface FrontierSwarmJobResult {
|
|
673
953
|
jobId: string;
|
|
674
954
|
status: FrontierSwarmJobStatus;
|
|
955
|
+
mergeReadiness: FrontierSwarmMergeReadiness;
|
|
675
956
|
startedAt?: number;
|
|
676
957
|
finishedAt?: number;
|
|
677
958
|
durationMs?: number;
|
|
678
959
|
exitCode?: number;
|
|
679
960
|
signal?: string;
|
|
680
961
|
changedPaths: string[];
|
|
962
|
+
changedRegions: string[];
|
|
681
963
|
ownershipViolations: string[];
|
|
682
964
|
evidencePaths: string[];
|
|
965
|
+
patchPath?: string;
|
|
966
|
+
queueItemIds: string[];
|
|
967
|
+
riskLevel: FrontierSwarmRiskLevel;
|
|
968
|
+
mergeDisposition: FrontierSwarmMergeDisposition;
|
|
683
969
|
verification: FrontierSwarmVerificationResult[];
|
|
684
970
|
lastMessage?: string;
|
|
685
971
|
error?: string;
|
|
@@ -691,6 +977,57 @@ export interface FrontierSwarmOwnershipReport {
|
|
|
691
977
|
allowedWrites: string[];
|
|
692
978
|
violations: string[];
|
|
693
979
|
}
|
|
980
|
+
export interface FrontierSwarmMergeBundleInput {
|
|
981
|
+
id?: string;
|
|
982
|
+
runId?: string;
|
|
983
|
+
planId?: string;
|
|
984
|
+
job?: FrontierSwarmJob;
|
|
985
|
+
result: FrontierSwarmJobResult | FrontierSwarmJobResultInput;
|
|
986
|
+
patchPath?: string;
|
|
987
|
+
patchHash?: string;
|
|
988
|
+
evidencePaths?: readonly string[];
|
|
989
|
+
queueItemIds?: readonly string[];
|
|
990
|
+
riskLevel?: FrontierSwarmRiskLevel;
|
|
991
|
+
disposition?: FrontierSwarmMergeDisposition;
|
|
992
|
+
staleAgainstHead?: boolean;
|
|
993
|
+
branchName?: string;
|
|
994
|
+
commit?: string;
|
|
995
|
+
metadata?: unknown;
|
|
996
|
+
generatedAt?: number;
|
|
997
|
+
}
|
|
998
|
+
export interface FrontierSwarmMergeBundle {
|
|
999
|
+
kind: typeof FRONTIER_SWARM_MERGE_BUNDLE_KIND;
|
|
1000
|
+
version: typeof FRONTIER_SWARM_MERGE_BUNDLE_VERSION;
|
|
1001
|
+
id: string;
|
|
1002
|
+
runId?: string;
|
|
1003
|
+
planId?: string;
|
|
1004
|
+
jobId: string;
|
|
1005
|
+
taskId?: string;
|
|
1006
|
+
lane?: string;
|
|
1007
|
+
title?: string;
|
|
1008
|
+
generatedAt: number;
|
|
1009
|
+
status: FrontierSwarmJobStatus;
|
|
1010
|
+
mergeReadiness: FrontierSwarmMergeReadiness;
|
|
1011
|
+
disposition: FrontierSwarmMergeDisposition;
|
|
1012
|
+
riskLevel: FrontierSwarmRiskLevel;
|
|
1013
|
+
autoMergeable: boolean;
|
|
1014
|
+
changedPaths: string[];
|
|
1015
|
+
changedRegions: string[];
|
|
1016
|
+
ownedFilesTouched: string[];
|
|
1017
|
+
allowedWrites: string[];
|
|
1018
|
+
ownershipViolations: string[];
|
|
1019
|
+
patchPath?: string;
|
|
1020
|
+
patchHash?: string;
|
|
1021
|
+
evidencePaths: string[];
|
|
1022
|
+
commandsPassed: FrontierSwarmVerificationResult[];
|
|
1023
|
+
commandsFailed: FrontierSwarmVerificationResult[];
|
|
1024
|
+
queueItemIds: string[];
|
|
1025
|
+
branchName?: string;
|
|
1026
|
+
commit?: string;
|
|
1027
|
+
staleAgainstHead: boolean;
|
|
1028
|
+
reasons: string[];
|
|
1029
|
+
metadata?: JsonObject;
|
|
1030
|
+
}
|
|
694
1031
|
export interface FrontierSwarmProof {
|
|
695
1032
|
kind: typeof FRONTIER_SWARM_PROOF_KIND;
|
|
696
1033
|
version: typeof FRONTIER_SWARM_PROOF_VERSION;
|
|
@@ -708,10 +1045,20 @@ export declare function defineSwarmTasks(input?: readonly FrontierSwarmTaskInput
|
|
|
708
1045
|
export declare function compileSwarm(input: FrontierSwarmManifest | FrontierSwarmManifestInput): FrontierSwarmCompiled;
|
|
709
1046
|
export declare function validateSwarmManifest(input: FrontierSwarmManifest | FrontierSwarmManifestInput): FrontierSwarmValidation;
|
|
710
1047
|
export declare function createSwarmPlan(manifestInput: FrontierSwarmManifest | FrontierSwarmManifestInput, taskInput: readonly FrontierSwarmTaskInput[] | FrontierSwarmTaskSetInput | readonly FrontierSwarmTask[], options?: FrontierSwarmPlanInput): FrontierSwarmPlan;
|
|
1048
|
+
export declare function createSwarmTaskSelection(manifestInput: FrontierSwarmManifest | FrontierSwarmManifestInput, taskInput: readonly FrontierSwarmTaskInput[] | FrontierSwarmTaskSetInput | readonly FrontierSwarmTask[], options?: FrontierSwarmTaskSelectionInput): FrontierSwarmTaskSelection;
|
|
711
1049
|
export declare function createSwarmRun(input: FrontierSwarmRunInput): FrontierSwarmRun;
|
|
712
1050
|
export declare function recordSwarmEvent(runInput: FrontierSwarmRun, eventInput: FrontierSwarmEventInput): FrontierSwarmRun;
|
|
1051
|
+
export declare function createSwarmMailbox(input?: FrontierSwarmMailboxInput): FrontierSwarmMailbox;
|
|
1052
|
+
export declare function createSwarmEventStream(input?: FrontierSwarmEventStreamInput): FrontierSwarmEventStream;
|
|
1053
|
+
export declare function routeSwarmEventToMailboxes(stream: FrontierSwarmEventStream, eventInput: FrontierSwarmEvent | FrontierSwarmEventInput): FrontierSwarmMailbox[];
|
|
713
1054
|
export declare function completeSwarmJob(runInput: FrontierSwarmRun, resultInput: FrontierSwarmJobResultInput): FrontierSwarmRun;
|
|
714
1055
|
export declare function checkSwarmOwnership(job: FrontierSwarmJob, changedPaths: readonly string[]): FrontierSwarmOwnershipReport;
|
|
1056
|
+
export declare function resolveSwarmChangedRegions(job: FrontierSwarmJob, changedPaths: readonly string[]): string[];
|
|
1057
|
+
export declare function classifySwarmMergeReadiness(result: FrontierSwarmJobResultInput | FrontierSwarmJobResult): FrontierSwarmMergeReadiness;
|
|
1058
|
+
export declare function classifySwarmMergeDisposition(result: FrontierSwarmJobResultInput | FrontierSwarmJobResult, input?: {
|
|
1059
|
+
staleAgainstHead?: boolean;
|
|
1060
|
+
}): FrontierSwarmMergeDisposition;
|
|
1061
|
+
export declare function createSwarmMergeBundle(input: FrontierSwarmMergeBundleInput): FrontierSwarmMergeBundle;
|
|
715
1062
|
export declare function resolveSwarmCompute(manifestInput: FrontierSwarmManifest | FrontierSwarmManifestInput, taskInput: FrontierSwarmTask | FrontierSwarmTaskInput): FrontierSwarmCompute;
|
|
716
1063
|
export declare function createSwarmProof(input: FrontierSwarmManifest | FrontierSwarmPlan | FrontierSwarmRun, options?: {
|
|
717
1064
|
generatedAt?: number;
|
|
@@ -720,6 +1067,9 @@ export declare function createSwarmProof(input: FrontierSwarmManifest | Frontier
|
|
|
720
1067
|
}): FrontierSwarmProof;
|
|
721
1068
|
export declare function createSwarmSchedule(input: FrontierSwarmPlan | FrontierSwarmScheduleInput): FrontierSwarmSchedule;
|
|
722
1069
|
export declare function createSwarmLeases(input: FrontierSwarmLeaseInput): FrontierSwarmLease[];
|
|
1070
|
+
export declare function renewSwarmLease(input: FrontierSwarmLeaseRenewalInput): FrontierSwarmLease;
|
|
1071
|
+
export declare function createSwarmQueueSnapshot(input: FrontierSwarmQueueSnapshotInput): FrontierSwarmQueueSnapshot;
|
|
1072
|
+
export declare function createSwarmRunCheckpoint(input: FrontierSwarmRun | FrontierSwarmRunCheckpointInput): FrontierSwarmRunCheckpoint;
|
|
723
1073
|
export declare function checkSwarmBudget(job: FrontierSwarmJob, usageInput: FrontierSwarmUsageInput): FrontierSwarmBudgetDecision;
|
|
724
1074
|
export declare function createSwarmArtifactIndex(input: FrontierSwarmRun | {
|
|
725
1075
|
run?: FrontierSwarmRun;
|