@shapeshift-labs/frontier-swarm 0.5.9 → 0.5.11
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 +62 -3
- package/benchmarks/package-bench-fixtures.mjs +95 -0
- package/benchmarks/package-bench-rows.mjs +190 -0
- package/benchmarks/package-bench-runtime.mjs +94 -0
- package/benchmarks/package-bench.mjs +20 -307
- package/dist/adaptive-load-decisions.d.ts +6 -0
- package/dist/adaptive-load-decisions.d.ts.map +1 -0
- package/dist/adaptive-load-decisions.js +130 -0
- package/dist/adaptive-load-decisions.js.map +1 -0
- package/dist/adaptive-load-limits.d.ts +8 -0
- package/dist/adaptive-load-limits.d.ts.map +1 -0
- package/dist/adaptive-load-limits.js +105 -0
- package/dist/adaptive-load-limits.js.map +1 -0
- package/dist/adaptive-load-observations.d.ts +16 -0
- package/dist/adaptive-load-observations.d.ts.map +1 -0
- package/dist/adaptive-load-observations.js +248 -0
- package/dist/adaptive-load-observations.js.map +1 -0
- package/dist/adaptive-load-types.d.ts +108 -0
- package/dist/adaptive-load-types.d.ts.map +1 -0
- package/dist/adaptive-load-types.js +3 -0
- package/dist/adaptive-load-types.js.map +1 -0
- package/dist/adaptive-load.d.ts +10 -0
- package/dist/adaptive-load.d.ts.map +1 -0
- package/dist/adaptive-load.js +87 -0
- package/dist/adaptive-load.js.map +1 -0
- package/dist/adaptive-types.d.ts +118 -0
- package/dist/adaptive-types.d.ts.map +1 -0
- package/dist/adaptive-types.js +2 -0
- package/dist/adaptive-types.js.map +1 -0
- package/dist/artifact-routing-runtime.d.ts +3 -0
- package/dist/artifact-routing-runtime.d.ts.map +1 -0
- package/dist/artifact-routing-runtime.js +72 -0
- package/dist/artifact-routing-runtime.js.map +1 -0
- package/dist/auto-review.d.ts +47 -0
- package/dist/auto-review.d.ts.map +1 -0
- package/dist/auto-review.js +69 -0
- package/dist/auto-review.js.map +1 -0
- package/dist/blackboard.d.ts +81 -0
- package/dist/blackboard.d.ts.map +1 -0
- package/dist/blackboard.js +60 -0
- package/dist/blackboard.js.map +1 -0
- package/dist/coercion.d.ts +12 -0
- package/dist/coercion.d.ts.map +1 -0
- package/dist/coercion.js +48 -0
- package/dist/coercion.js.map +1 -0
- package/dist/constants.d.ts +94 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +94 -0
- package/dist/constants.js.map +1 -0
- package/dist/context-pack-runtime.d.ts +3 -0
- package/dist/context-pack-runtime.d.ts.map +1 -0
- package/dist/context-pack-runtime.js +77 -0
- package/dist/context-pack-runtime.js.map +1 -0
- package/dist/context-types.d.ts +188 -0
- package/dist/context-types.d.ts.map +1 -0
- package/dist/context-types.js +2 -0
- package/dist/context-types.js.map +1 -0
- package/dist/coordinator-dashboard-helpers.d.ts +14 -0
- package/dist/coordinator-dashboard-helpers.d.ts.map +1 -0
- package/dist/coordinator-dashboard-helpers.js +106 -0
- package/dist/coordinator-dashboard-helpers.js.map +1 -0
- package/dist/coordinator-dashboard-types.d.ts +161 -0
- package/dist/coordinator-dashboard-types.d.ts.map +1 -0
- package/dist/coordinator-dashboard-types.js +3 -0
- package/dist/coordinator-dashboard-types.js.map +1 -0
- package/dist/coordinator-dashboard.d.ts +4 -0
- package/dist/coordinator-dashboard.d.ts.map +1 -0
- package/dist/coordinator-dashboard.js +161 -0
- package/dist/coordinator-dashboard.js.map +1 -0
- package/dist/coordinator-scoring.d.ts +8 -0
- package/dist/coordinator-scoring.d.ts.map +1 -0
- package/dist/coordinator-scoring.js +134 -0
- package/dist/coordinator-scoring.js.map +1 -0
- package/dist/coordinator-types.d.ts +164 -0
- package/dist/coordinator-types.d.ts.map +1 -0
- package/dist/coordinator-types.js +2 -0
- package/dist/coordinator-types.js.map +1 -0
- package/dist/debug-runtime.d.ts +4 -0
- package/dist/debug-runtime.d.ts.map +1 -0
- package/dist/debug-runtime.js +93 -0
- package/dist/debug-runtime.js.map +1 -0
- package/dist/debug-types.d.ts +194 -0
- package/dist/debug-types.d.ts.map +1 -0
- package/dist/debug-types.js +2 -0
- package/dist/debug-types.js.map +1 -0
- package/dist/diagnostic-helpers.d.ts +5 -0
- package/dist/diagnostic-helpers.d.ts.map +1 -0
- package/dist/diagnostic-helpers.js +54 -0
- package/dist/diagnostic-helpers.js.map +1 -0
- package/dist/evidence-index-helpers.d.ts +10 -0
- package/dist/evidence-index-helpers.d.ts.map +1 -0
- package/dist/evidence-index-helpers.js +78 -0
- package/dist/evidence-index-helpers.js.map +1 -0
- package/dist/evidence-index.d.ts +4 -0
- package/dist/evidence-index.d.ts.map +1 -0
- package/dist/evidence-index.js +59 -0
- package/dist/evidence-index.js.map +1 -0
- package/dist/evidence-types.d.ts +151 -0
- package/dist/evidence-types.d.ts.map +1 -0
- package/dist/evidence-types.js +2 -0
- package/dist/evidence-types.js.map +1 -0
- package/dist/fixtures.d.ts +45 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +39 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/governance-types.d.ts +172 -0
- package/dist/governance-types.d.ts.map +1 -0
- package/dist/governance-types.js +2 -0
- package/dist/governance-types.js.map +1 -0
- package/dist/index.d.ts +35 -2933
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -4526
- package/dist/index.js.map +1 -1
- package/dist/instrumentation-runtime.d.ts +6 -0
- package/dist/instrumentation-runtime.d.ts.map +1 -0
- package/dist/instrumentation-runtime.js +111 -0
- package/dist/instrumentation-runtime.js.map +1 -0
- package/dist/internal.d.ts +11 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +49 -0
- package/dist/internal.js.map +1 -0
- package/dist/leases.d.ts +32 -0
- package/dist/leases.d.ts.map +1 -0
- package/dist/leases.js +36 -0
- package/dist/leases.js.map +1 -0
- package/dist/manifest-normalization.d.ts +8 -0
- package/dist/manifest-normalization.d.ts.map +1 -0
- package/dist/manifest-normalization.js +191 -0
- package/dist/manifest-normalization.js.map +1 -0
- package/dist/manifest-types.d.ts +227 -0
- package/dist/manifest-types.d.ts.map +1 -0
- package/dist/manifest-types.js +2 -0
- package/dist/manifest-types.js.map +1 -0
- package/dist/manifest.d.ts +7 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +126 -0
- package/dist/manifest.js.map +1 -0
- package/dist/merge-admission.d.ts +3 -0
- package/dist/merge-admission.d.ts.map +1 -0
- package/dist/merge-admission.js +71 -0
- package/dist/merge-admission.js.map +1 -0
- package/dist/merge-bundles.d.ts +13 -0
- package/dist/merge-bundles.d.ts.map +1 -0
- package/dist/merge-bundles.js +144 -0
- package/dist/merge-bundles.js.map +1 -0
- package/dist/merge-classification.d.ts +6 -0
- package/dist/merge-classification.d.ts.map +1 -0
- package/dist/merge-classification.js +36 -0
- package/dist/merge-classification.js.map +1 -0
- package/dist/merge-index.d.ts +3 -0
- package/dist/merge-index.d.ts.map +1 -0
- package/dist/merge-index.js +130 -0
- package/dist/merge-index.js.map +1 -0
- package/dist/merge-plan-helpers.d.ts +11 -0
- package/dist/merge-plan-helpers.d.ts.map +1 -0
- package/dist/merge-plan-helpers.js +97 -0
- package/dist/merge-plan-helpers.js.map +1 -0
- package/dist/merge-plans-runtime.d.ts +8 -0
- package/dist/merge-plans-runtime.d.ts.map +1 -0
- package/dist/merge-plans-runtime.js +106 -0
- package/dist/merge-plans-runtime.js.map +1 -0
- package/dist/merge-review-types.d.ts +76 -0
- package/dist/merge-review-types.d.ts.map +1 -0
- package/dist/merge-review-types.js +2 -0
- package/dist/merge-review-types.js.map +1 -0
- package/dist/merge-review.d.ts +7 -0
- package/dist/merge-review.d.ts.map +1 -0
- package/dist/merge-review.js +142 -0
- package/dist/merge-review.js.map +1 -0
- package/dist/merge-types.d.ts +196 -0
- package/dist/merge-types.d.ts.map +1 -0
- package/dist/merge-types.js +2 -0
- package/dist/merge-types.js.map +1 -0
- package/dist/merge-wrappers.d.ts +5 -0
- package/dist/merge-wrappers.d.ts.map +1 -0
- package/dist/merge-wrappers.js +198 -0
- package/dist/merge-wrappers.js.map +1 -0
- package/dist/observability-types.d.ts +164 -0
- package/dist/observability-types.d.ts.map +1 -0
- package/dist/observability-types.js +2 -0
- package/dist/observability-types.js.map +1 -0
- package/dist/oracle-helpers.d.ts +6 -0
- package/dist/oracle-helpers.d.ts.map +1 -0
- package/dist/oracle-helpers.js +73 -0
- package/dist/oracle-helpers.js.map +1 -0
- package/dist/oracle-runtime.d.ts +5 -0
- package/dist/oracle-runtime.d.ts.map +1 -0
- package/dist/oracle-runtime.js +154 -0
- package/dist/oracle-runtime.js.map +1 -0
- package/dist/ownership-runtime.d.ts +6 -0
- package/dist/ownership-runtime.d.ts.map +1 -0
- package/dist/ownership-runtime.js +49 -0
- package/dist/ownership-runtime.js.map +1 -0
- package/dist/patch-stack-runtime.d.ts +4 -0
- package/dist/patch-stack-runtime.d.ts.map +1 -0
- package/dist/patch-stack-runtime.js +97 -0
- package/dist/patch-stack-runtime.js.map +1 -0
- package/dist/plan-helpers.d.ts +13 -0
- package/dist/plan-helpers.d.ts.map +1 -0
- package/dist/plan-helpers.js +236 -0
- package/dist/plan-helpers.js.map +1 -0
- package/dist/plan-selection.d.ts +7 -0
- package/dist/plan-selection.d.ts.map +1 -0
- package/dist/plan-selection.js +86 -0
- package/dist/plan-selection.js.map +1 -0
- package/dist/plan.d.ts +126 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +67 -0
- package/dist/plan.js.map +1 -0
- package/dist/progress.d.ts +42 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +31 -0
- package/dist/progress.js.map +1 -0
- package/dist/proof-runtime.d.ts +16 -0
- package/dist/proof-runtime.d.ts.map +1 -0
- package/dist/proof-runtime.js +143 -0
- package/dist/proof-runtime.js.map +1 -0
- package/dist/queue-overlays.d.ts +7 -0
- package/dist/queue-overlays.d.ts.map +1 -0
- package/dist/queue-overlays.js +184 -0
- package/dist/queue-overlays.js.map +1 -0
- package/dist/queue-types.d.ts +194 -0
- package/dist/queue-types.d.ts.map +1 -0
- package/dist/queue-types.js +2 -0
- package/dist/queue-types.js.map +1 -0
- package/dist/rebase-report.d.ts +3 -0
- package/dist/rebase-report.d.ts.map +1 -0
- package/dist/rebase-report.js +52 -0
- package/dist/rebase-report.js.map +1 -0
- package/dist/record-helpers.d.ts +15 -0
- package/dist/record-helpers.d.ts.map +1 -0
- package/dist/record-helpers.js +78 -0
- package/dist/record-helpers.js.map +1 -0
- package/dist/reference-oracle-runtime.d.ts +4 -0
- package/dist/reference-oracle-runtime.d.ts.map +1 -0
- package/dist/reference-oracle-runtime.js +89 -0
- package/dist/reference-oracle-runtime.js.map +1 -0
- package/dist/reference-types.d.ts +204 -0
- package/dist/reference-types.d.ts.map +1 -0
- package/dist/reference-types.js +2 -0
- package/dist/reference-types.js.map +1 -0
- package/dist/result-types.d.ts +75 -0
- package/dist/result-types.d.ts.map +1 -0
- package/dist/result-types.js +2 -0
- package/dist/result-types.js.map +1 -0
- package/dist/run-normalization.d.ts +9 -0
- package/dist/run-normalization.d.ts.map +1 -0
- package/dist/run-normalization.js +126 -0
- package/dist/run-normalization.js.map +1 -0
- package/dist/run-records.d.ts +8 -0
- package/dist/run-records.d.ts.map +1 -0
- package/dist/run-records.js +145 -0
- package/dist/run-records.js.map +1 -0
- package/dist/run-store-shards-runtime.d.ts +3 -0
- package/dist/run-store-shards-runtime.d.ts.map +1 -0
- package/dist/run-store-shards-runtime.js +54 -0
- package/dist/run-store-shards-runtime.js.map +1 -0
- package/dist/run-types.d.ts +112 -0
- package/dist/run-types.d.ts.map +1 -0
- package/dist/run-types.js +2 -0
- package/dist/run-types.js.map +1 -0
- package/dist/scheduler.d.ts +94 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +213 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/semantic-normalization.d.ts +3 -0
- package/dist/semantic-normalization.d.ts.map +1 -0
- package/dist/semantic-normalization.js +162 -0
- package/dist/semantic-normalization.js.map +1 -0
- package/dist/semantic-types.d.ts +229 -0
- package/dist/semantic-types.d.ts.map +1 -0
- package/dist/semantic-types.js +2 -0
- package/dist/semantic-types.js.map +1 -0
- package/dist/status-types.d.ts +28 -0
- package/dist/status-types.d.ts.map +1 -0
- package/dist/status-types.js +2 -0
- package/dist/status-types.js.map +1 -0
- package/dist/task-types.d.ts +165 -0
- package/dist/task-types.d.ts.map +1 -0
- package/dist/task-types.js +2 -0
- package/dist/task-types.js.map +1 -0
- package/dist/trace-helpers.d.ts +22 -0
- package/dist/trace-helpers.d.ts.map +1 -0
- package/dist/trace-helpers.js +181 -0
- package/dist/trace-helpers.js.map +1 -0
- package/dist/trace-runtime.d.ts +7 -0
- package/dist/trace-runtime.d.ts.map +1 -0
- package/dist/trace-runtime.js +196 -0
- package/dist/trace-runtime.js.map +1 -0
- package/dist/trace-types.d.ts +168 -0
- package/dist/trace-types.d.ts.map +1 -0
- package/dist/trace-types.js +2 -0
- package/dist/trace-types.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/usage-governor.d.ts +41 -0
- package/dist/usage-governor.d.ts.map +1 -0
- package/dist/usage-governor.js +43 -0
- package/dist/usage-governor.js.map +1 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ The published Frontier package family is generated from one shared package catal
|
|
|
45
45
|
- [`@shapeshift-labs/frontier-lang-rust`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-rust): Rust projection adapter for Frontier Lang semantic documents, including structs, aliases, and action stubs.
|
|
46
46
|
- [`@shapeshift-labs/frontier-lang-python`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-python): Python projection adapter for Frontier Lang semantic documents, including dataclasses, typed patch records, and action stubs.
|
|
47
47
|
- [`@shapeshift-labs/frontier-lang-c`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-c): C header projection adapter for Frontier Lang semantic documents, including structs and action prototypes.
|
|
48
|
-
- [`@shapeshift-labs/frontier-lang-compiler`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-compiler): Compiler facade for Frontier Lang source documents, including parse, check, hash, diagnostics, projection to TypeScript, JavaScript, Rust, Python, and C, and native source-import adapters for semantic merge evidence.
|
|
48
|
+
- [`@shapeshift-labs/frontier-lang-compiler`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-compiler): Compiler facade for Frontier Lang source documents, including parse, check, hash, diagnostics, universal AST envelopes, proof/paradigm semantic summaries, projection to TypeScript, JavaScript, Rust, Python, and C, and native source-import adapters for semantic merge evidence.
|
|
49
49
|
- [`@shapeshift-labs/frontier-lang-swift`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-swift): Swift source-language importer package for Frontier Lang semantic documents, including package-level metadata, SwiftSyntax adapter helpers, native import results, and semantic sidecar generation for SwiftSyntax/SwiftParser-shaped syntax trees.
|
|
50
50
|
- [`@shapeshift-labs/frontier-lang-kotlin`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-kotlin): Kotlin PSI source-language importer package for Frontier Lang semantic documents, including package-level metadata, Kotlin PSI adapter helpers, native import results, and semantic sidecar generation for Kotlin PSI/KtFile-shaped syntax trees.
|
|
51
51
|
- [`@shapeshift-labs/frontier-lang-java`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-java): Java source-language importer package for Frontier Lang semantic documents, including package-level metadata, Java AST adapter helpers, native import results, and semantic sidecar generation for javac/JDT/JavaParser-shaped ASTs.
|
|
@@ -53,7 +53,7 @@ The published Frontier package family is generated from one shared package catal
|
|
|
53
53
|
- [`@shapeshift-labs/frontier-lang-csharp`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-csharp): C# Roslyn source-language importer package for Frontier Lang semantic documents, including package-level metadata, Roslyn adapter helpers, native import results, and semantic sidecar generation for SyntaxTree/SyntaxNode-shaped ASTs.
|
|
54
54
|
- [`@shapeshift-labs/frontier-lang-clang`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-clang): Clang AST source-language importer package for Frontier Lang semantic documents, including package-level metadata, Clang AST JSON adapter helpers, native import results, and semantic sidecar generation for C/C++ translation units.
|
|
55
55
|
- [`@shapeshift-labs/frontier-lang-cli`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang-cli): Command line interface for parsing, checking, hashing, and emitting Frontier Lang projects.
|
|
56
|
-
- [`@shapeshift-labs/frontier-lang`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang): Umbrella package for Frontier Lang kernel, parser, checker, and projection adapters.
|
|
56
|
+
- [`@shapeshift-labs/frontier-lang`](https://www.npmjs.com/package/@shapeshift-labs/frontier-lang): Umbrella package for Frontier Lang kernel, parser, checker, compiler facade, universal AST helpers, and projection adapters.
|
|
57
57
|
- [`@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.
|
|
58
58
|
- [`@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.
|
|
59
59
|
- [`@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.
|
|
@@ -298,6 +298,7 @@ The scale APIs are runtime-neutral and serializable:
|
|
|
298
298
|
- `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,
|
|
299
299
|
- `createSwarmOracleCorpus` indexes deterministic reference artifacts such as traces, snapshots, classifications, expected outputs, or fixtures without assuming a project domain,
|
|
300
300
|
- `createSwarmReplayBundle`, `createSwarmParityOracle`, `createSwarmDivergenceReport`, `createSwarmObservabilityPoint`, `createSwarmWatchpointPlan`, and `createSwarmDebugHandoff` model the trace-to-debug workflow: replay finds the narrow window, watchpoints/debug handoff explain the state at that point,
|
|
301
|
+
- `createSwarmTraceShard`, `createSwarmTraceIndex`, and `querySwarmTraceIndex` turn worker trace findings into sortable evidence: row windows, source hypotheses, executable ownership regions, focused tests, reference evidence, and unresolved divergence signals,
|
|
301
302
|
- `createSwarmReferenceOraclePlan` and `createSwarmReferenceOracleResponse` describe reusable reference services for ports, migrations, parity checks, and cross-implementation comparisons,
|
|
302
303
|
- `createSwarmInstrumentationBudget`, `checkSwarmInstrumentationBudget`, and `createSwarmBottleneckReport` keep traces/logs useful without making instrumentation the bottleneck,
|
|
303
304
|
- `createSwarmEvidenceIndex` / `querySwarmEvidenceIndex` and `createSwarmBlackboard` / `querySwarmBlackboard` provide storage-neutral status surfaces for coordinator dashboards, accepted facts, known divergences, rejected theories, and active ownership,
|
|
@@ -305,6 +306,63 @@ The scale APIs are runtime-neutral and serializable:
|
|
|
305
306
|
- `createSwarmLanePlaybook` turns successful prior bundles into persistent lane-specific guidance with commands, hot paths, evidence patterns, and avoid-investigating notes,
|
|
306
307
|
- `decomposeSwarmFeature` creates an initial task queue for feature work across lanes.
|
|
307
308
|
|
|
309
|
+
## Trace Shards
|
|
310
|
+
|
|
311
|
+
Trace shards are the generic form of “the worker found the narrow window.” They are not emulator-specific: a row window can be CPU cycles, log rows, replay steps, API events, migration records, or UI interaction frames. The important part is that the shard connects evidence to source hypotheses and executable ownership regions.
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
import {
|
|
315
|
+
createSwarmCoordinatorDashboard,
|
|
316
|
+
createSwarmMergeBundle,
|
|
317
|
+
createSwarmTraceIndex,
|
|
318
|
+
createSwarmTraceShard,
|
|
319
|
+
querySwarmTraceIndex
|
|
320
|
+
} from '@shapeshift-labs/frontier-swarm';
|
|
321
|
+
|
|
322
|
+
const traceShard = createSwarmTraceShard({
|
|
323
|
+
jobId: 'runtime-worker-12',
|
|
324
|
+
lane: 'runtime',
|
|
325
|
+
subject: 'parser-port',
|
|
326
|
+
rowWindows: [{ start: 6240, end: 6250, firstDivergenceAt: 6243, deltaFields: ['result.value'] }],
|
|
327
|
+
hypotheses: [{
|
|
328
|
+
sourcePath: 'src/parser.ts',
|
|
329
|
+
symbol: 'parseExpression',
|
|
330
|
+
region: 'parser.expression',
|
|
331
|
+
confidence: 'high',
|
|
332
|
+
reason: 'reference trace diverges immediately after expression precedence handling'
|
|
333
|
+
}],
|
|
334
|
+
executableOwnershipRegions: [{
|
|
335
|
+
id: 'parser.expression',
|
|
336
|
+
sourcePath: 'src/parser.ts',
|
|
337
|
+
symbol: 'parseExpression',
|
|
338
|
+
affectedTests: ['npm run test:parser -- --case precedence'],
|
|
339
|
+
conflictingAssumptions: ['operators are parsed left-to-right']
|
|
340
|
+
}],
|
|
341
|
+
focusedTests: ['npm run test:parser -- --case precedence'],
|
|
342
|
+
referenceEvidence: [{ path: 'agent-runs/runtime-worker-12/reference-trace.jsonl', kind: 'trace' }]
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
const bundle = createSwarmMergeBundle({
|
|
346
|
+
result: {
|
|
347
|
+
jobId: 'runtime-worker-12',
|
|
348
|
+
status: 'verified',
|
|
349
|
+
changedPaths: ['src/parser.ts'],
|
|
350
|
+
changedRegions: ['parser.expression'],
|
|
351
|
+
verification: [{ status: 0 }]
|
|
352
|
+
},
|
|
353
|
+
patchPath: 'agent-runs/runtime-worker-12/changes.patch',
|
|
354
|
+
traceShards: [traceShard]
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
const traceIndex = createSwarmTraceIndex({ bundles: [bundle] });
|
|
358
|
+
const expressionFindings = querySwarmTraceIndex(traceIndex, { region: 'parser.expression', minConfidence: 0.9 });
|
|
359
|
+
|
|
360
|
+
const dashboard = createSwarmCoordinatorDashboard({ bundles: [bundle] });
|
|
361
|
+
const traceReadyJobs = dashboard.jobs.filter((job) => job.traceSummary?.shardCount);
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Merge scoring uses trace shards as review evidence, not automatic correctness. Focused tests, reference evidence, and executable regions raise confidence; unresolved divergences and conflicting assumptions lower the score until a coordinator or review worker resolves them.
|
|
365
|
+
|
|
308
366
|
## Hierarchical Compute
|
|
309
367
|
|
|
310
368
|
Higher swarm layers can choose compute for lower layers without binding the core package to Codex or any other runtime. Compute resolution is deterministic:
|
|
@@ -337,6 +395,7 @@ That lets a parent swarm route implementation jobs to a deep model while evidenc
|
|
|
337
395
|
- `createSwarmPatchStackPlan`
|
|
338
396
|
- `createSwarmContextPack`, `createSwarmOracleCorpus`, `createSwarmLanePlaybook`
|
|
339
397
|
- `createSwarmReplayBundle`, `createSwarmParityOracle`, `createSwarmDivergenceReport`, `createSwarmObservabilityPoint`
|
|
398
|
+
- `createSwarmTraceShard`, `createSwarmTraceIndex`, `querySwarmTraceIndex`
|
|
340
399
|
- `createSwarmWatchpointPlan`, `createSwarmDebugHandoff`
|
|
341
400
|
- `createSwarmReferenceOraclePlan`, `createSwarmReferenceOracleResponse`
|
|
342
401
|
- `createSwarmInstrumentationBudget`, `checkSwarmInstrumentationBudget`, `createSwarmBottleneckReport`
|
|
@@ -362,7 +421,7 @@ Run the package-local benchmark:
|
|
|
362
421
|
npm run bench
|
|
363
422
|
```
|
|
364
423
|
|
|
365
|
-
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, adaptive load planning, queue snapshots, queue overlays, merge bundles, merge indexes, merge admission, hotspot reports, context packs, oracle corpora, replay/debug/evidence helper creation, lane playbooks, patch stack plans, event routing, run checkpoints, JSONL, and proof hashing.
|
|
424
|
+
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, adaptive load planning, queue snapshots, queue overlays, merge bundles, merge indexes, merge admission, hotspot reports, context packs, oracle corpora, replay/debug/evidence helper creation, trace index/query creation, lane playbooks, patch stack plans, event routing, run checkpoints, JSONL, and proof hashing.
|
|
366
425
|
|
|
367
426
|
## Source Repository
|
|
368
427
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSwarmMergeBundle,
|
|
3
|
+
createSwarmTraceShard
|
|
4
|
+
} from '../dist/index.js';
|
|
5
|
+
|
|
6
|
+
export function makeBenchManifest() {
|
|
7
|
+
return {
|
|
8
|
+
compute: [
|
|
9
|
+
{ id: 'deep', kind: 'codex', model: 'gpt-5.5', reasoningEffort: 'xhigh' },
|
|
10
|
+
{ id: 'fast', kind: 'codex', model: 'gpt-5.4-mini', reasoningEffort: 'medium' }
|
|
11
|
+
],
|
|
12
|
+
layers: [
|
|
13
|
+
{ id: 'parent', childCompute: { implementation: 'deep', evidence: 'fast' } },
|
|
14
|
+
{ id: 'implementation', parentId: 'parent' },
|
|
15
|
+
{ id: 'evidence', parentId: 'parent' }
|
|
16
|
+
],
|
|
17
|
+
lanes: [
|
|
18
|
+
{ id: 'runtime', layer: 'implementation', allowedWrites: ['src/runtime/**'], evidencePrefix: 'evidence/runtime/' },
|
|
19
|
+
{ id: 'tests', layer: 'evidence', allowedWrites: ['test/**'], evidencePrefix: 'evidence/tests/' }
|
|
20
|
+
],
|
|
21
|
+
policy: { defaultCompute: 'fast' }
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function makeBenchTasks(count) {
|
|
26
|
+
const tasks = [];
|
|
27
|
+
for (let i = 0; i < count; i += 1) {
|
|
28
|
+
const lane = i % 3 === 0 ? 'tests' : 'runtime';
|
|
29
|
+
tasks.push({
|
|
30
|
+
id: 'task-' + i,
|
|
31
|
+
lane,
|
|
32
|
+
priority: i % 100,
|
|
33
|
+
targetRefs: [lane === 'tests' ? `test/file-${i}.mjs` : `src/runtime/file-${i}.ts`],
|
|
34
|
+
acceptance: ['task ' + i + ' passes']
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return tasks;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function makeBenchBundles(plan, count) {
|
|
41
|
+
const bundles = [];
|
|
42
|
+
for (let i = 0; i < Math.min(count, plan.jobs.length); i += 1) {
|
|
43
|
+
const job = plan.jobs[i];
|
|
44
|
+
bundles.push(createSwarmMergeBundle({
|
|
45
|
+
job,
|
|
46
|
+
result: {
|
|
47
|
+
jobId: job.id,
|
|
48
|
+
status: 'verified',
|
|
49
|
+
changedPaths: [job.task.targetRefs[0] ?? `src/runtime/file-${i}.ts`],
|
|
50
|
+
changedRegions: i % 2 === 0 ? [`region.${i}`] : [],
|
|
51
|
+
verification: [{ status: 0 }]
|
|
52
|
+
},
|
|
53
|
+
patchPath: `agent-runs/bench/${job.id}/changes.patch`
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
return bundles;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function makeBenchTraceBundles(plan, count, offset = 0) {
|
|
60
|
+
const bundles = [];
|
|
61
|
+
for (let i = 0; i < Math.min(count, plan.jobs.length); i += 1) {
|
|
62
|
+
const job = plan.jobs[(i + offset) % plan.jobs.length];
|
|
63
|
+
const region = `region.${i % 8}`;
|
|
64
|
+
const traceShard = createSwarmTraceShard({
|
|
65
|
+
jobId: job.id,
|
|
66
|
+
lane: job.lane,
|
|
67
|
+
subject: 'bench-trace',
|
|
68
|
+
rowWindows: [{ start: i * 10, end: i * 10 + 4, rowCount: 5, firstDivergenceAt: i % 5 === 0 ? i * 10 + 2 : undefined, deltaFields: ['state.value'] }],
|
|
69
|
+
hypotheses: [{ sourcePath: job.task.targetRefs[0], symbol: `benchSymbol${i}`, region, confidence: i % 5 === 0 ? 'high' : 'medium' }],
|
|
70
|
+
executableOwnershipRegions: [{
|
|
71
|
+
id: region,
|
|
72
|
+
sourcePath: job.task.targetRefs[0],
|
|
73
|
+
symbol: `benchSymbol${i}`,
|
|
74
|
+
selectors: [`${region}.*`],
|
|
75
|
+
affectedTests: ['node trace-gate.mjs'],
|
|
76
|
+
riskLevel: i % 5 === 0 ? 'medium' : 'low'
|
|
77
|
+
}],
|
|
78
|
+
focusedTests: ['node trace-gate.mjs'],
|
|
79
|
+
referenceEvidence: [{ path: `agent-runs/bench/${job.id}/reference-trace.jsonl`, kind: 'trace' }]
|
|
80
|
+
});
|
|
81
|
+
bundles.push(createSwarmMergeBundle({
|
|
82
|
+
job,
|
|
83
|
+
result: {
|
|
84
|
+
jobId: job.id,
|
|
85
|
+
status: 'verified',
|
|
86
|
+
changedPaths: [job.task.targetRefs[0] ?? `src/runtime/file-${i}.ts`],
|
|
87
|
+
changedRegions: [region],
|
|
88
|
+
verification: [{ status: 0 }]
|
|
89
|
+
},
|
|
90
|
+
patchPath: `agent-runs/bench/${job.id}/changes.patch`,
|
|
91
|
+
traceShards: [traceShard]
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
return bundles;
|
|
95
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkSwarmOwnership,
|
|
3
|
+
createSwarmAdaptiveLoadPlan,
|
|
4
|
+
createSwarmContextPack,
|
|
5
|
+
createSwarmHotspotReport,
|
|
6
|
+
createSwarmLanePlaybook,
|
|
7
|
+
createSwarmMergeAdmission,
|
|
8
|
+
createSwarmManifest,
|
|
9
|
+
createSwarmEventStream,
|
|
10
|
+
createSwarmLeases,
|
|
11
|
+
createSwarmMergeBundle,
|
|
12
|
+
createSwarmMergeIndex,
|
|
13
|
+
createSwarmOracleCorpus,
|
|
14
|
+
createSwarmPatchStackPlan,
|
|
15
|
+
createSwarmReplayBundle,
|
|
16
|
+
createSwarmParityOracle,
|
|
17
|
+
createSwarmDivergenceReport,
|
|
18
|
+
createSwarmWatchpointPlan,
|
|
19
|
+
createSwarmDebugHandoff,
|
|
20
|
+
createSwarmEvidenceIndex,
|
|
21
|
+
createSwarmBlackboard,
|
|
22
|
+
createSwarmBottleneckReport,
|
|
23
|
+
createSwarmFixtureCatalog,
|
|
24
|
+
createSwarmProgressModel,
|
|
25
|
+
createSwarmPlan,
|
|
26
|
+
createSwarmProof,
|
|
27
|
+
createSwarmQueueOverlay,
|
|
28
|
+
createSwarmQueueSnapshot,
|
|
29
|
+
createSwarmRun,
|
|
30
|
+
createSwarmRunCheckpoint,
|
|
31
|
+
createSwarmSchedule,
|
|
32
|
+
createSwarmTraceIndex,
|
|
33
|
+
decodeSwarmJsonl,
|
|
34
|
+
defineSwarmTasks,
|
|
35
|
+
encodeSwarmJsonl,
|
|
36
|
+
querySwarmTraceIndex,
|
|
37
|
+
routeSwarmEventToMailboxes,
|
|
38
|
+
resolveSwarmCompute,
|
|
39
|
+
validateSwarmManifest
|
|
40
|
+
} from '../dist/index.js';
|
|
41
|
+
import {
|
|
42
|
+
makeBenchBundles,
|
|
43
|
+
makeBenchManifest,
|
|
44
|
+
makeBenchTasks,
|
|
45
|
+
makeBenchTraceBundles
|
|
46
|
+
} from './package-bench-fixtures.mjs';
|
|
47
|
+
|
|
48
|
+
export function createPackageBenchRows({ taskCount, measure }) {
|
|
49
|
+
const manifest = createSwarmManifest(makeBenchManifest());
|
|
50
|
+
const tasks = defineSwarmTasks(makeBenchTasks(taskCount));
|
|
51
|
+
let plan = createSwarmPlan(manifest, tasks, { limit: 64 });
|
|
52
|
+
let run = createSwarmRun({ plan });
|
|
53
|
+
let jsonl = encodeSwarmJsonl([plan, run]);
|
|
54
|
+
let cursor = 0;
|
|
55
|
+
let schedule = createSwarmSchedule({ plan, maxReadyJobs: 128 });
|
|
56
|
+
let leases = createSwarmLeases({ schedule, workerId: 'bench-worker', now: 1000, leaseMs: 60000, count: 16 });
|
|
57
|
+
let eventStream = createSwarmEventStream({ runId: 'bench', root: 'agent-runs/bench/streams', lanes: manifest.lanes });
|
|
58
|
+
let bundles = makeBenchBundles(plan, 32);
|
|
59
|
+
let mergeIndex = createSwarmMergeIndex({ bundles });
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
measure('create-plan-' + taskCount, 8, () => {
|
|
63
|
+
plan = createSwarmPlan(manifest, tasks, { limit: 64, selectors: ['task'] });
|
|
64
|
+
return plan.jobs.length;
|
|
65
|
+
}),
|
|
66
|
+
measure('validate-manifest', 32, () => validateSwarmManifest(manifest).issues.length),
|
|
67
|
+
measure('resolve-compute-' + taskCount, 64, () => resolveSwarmCompute(manifest, tasks[cursor++ % tasks.length]).id.length),
|
|
68
|
+
measure('ownership-check-' + taskCount, 64, () => checkSwarmOwnership(plan.jobs[cursor++ % plan.jobs.length], ['src/runtime/file.ts']).violations.length),
|
|
69
|
+
measure('create-run-' + taskCount, 16, () => {
|
|
70
|
+
run = createSwarmRun({ plan });
|
|
71
|
+
return run.jobs.length;
|
|
72
|
+
}),
|
|
73
|
+
measure('jsonl-encode', 16, () => {
|
|
74
|
+
jsonl = encodeSwarmJsonl([plan, run]);
|
|
75
|
+
return jsonl.length;
|
|
76
|
+
}),
|
|
77
|
+
measure('jsonl-decode', 16, () => decodeSwarmJsonl(jsonl).length),
|
|
78
|
+
measure('proof', 16, () => createSwarmProof(plan).hash.length),
|
|
79
|
+
measure('schedule-lease-' + taskCount, 8, () => {
|
|
80
|
+
schedule = createSwarmSchedule({ plan, maxReadyJobs: 128, maxComputeConcurrency: { fast: 64, deep: 32 } });
|
|
81
|
+
leases = createSwarmLeases({ schedule, workerId: 'bench-worker', now: 1000 + cursor++, leaseMs: 60000, count: 16 });
|
|
82
|
+
return schedule.ready.length + leases.length;
|
|
83
|
+
}),
|
|
84
|
+
measure('adaptive-load-' + taskCount, 8, () => createSwarmAdaptiveLoadPlan({
|
|
85
|
+
plan,
|
|
86
|
+
schedule,
|
|
87
|
+
mode: 'balanced',
|
|
88
|
+
maxLimits: { maxReadyJobs: 128 },
|
|
89
|
+
currentLimits: { maxReadyJobs: 64 },
|
|
90
|
+
observations: [
|
|
91
|
+
{ kind: 'semantic-empty', jobId: plan.jobs[cursor % plan.jobs.length].id, lane: plan.jobs[cursor % plan.jobs.length].lane },
|
|
92
|
+
{ kind: 'log-noise', lane: 'runtime', value: 200000 }
|
|
93
|
+
],
|
|
94
|
+
generatedAt: 1500 + cursor++
|
|
95
|
+
}).summary.decisionCount),
|
|
96
|
+
measure('queue-snapshot-' + taskCount, 8, () => {
|
|
97
|
+
const snapshot = createSwarmQueueSnapshot({ plan, run, leases, generatedAt: 2000 + cursor++ });
|
|
98
|
+
return snapshot.summary.jobCount + snapshot.summary.leaseCount;
|
|
99
|
+
}),
|
|
100
|
+
measure('run-checkpoint-' + taskCount, 16, () => createSwarmRunCheckpoint({ run, sequence: cursor++ }).hash.length),
|
|
101
|
+
measure('merge-bundle-' + taskCount, 32, () => createSwarmMergeBundle({
|
|
102
|
+
job: plan.jobs[cursor % plan.jobs.length],
|
|
103
|
+
result: {
|
|
104
|
+
jobId: plan.jobs[cursor++ % plan.jobs.length].id,
|
|
105
|
+
status: 'completed',
|
|
106
|
+
changedPaths: ['src/runtime/file.ts'],
|
|
107
|
+
verification: [{ status: 0 }]
|
|
108
|
+
},
|
|
109
|
+
patchPath: 'agent-runs/bench/changes.patch'
|
|
110
|
+
}).id.length),
|
|
111
|
+
measure('queue-overlay-' + taskCount, 16, () => createSwarmQueueOverlay({ bundles, generatedAt: 3000 + cursor++ }).summary.entryCount),
|
|
112
|
+
measure('merge-index-' + taskCount, 8, () => {
|
|
113
|
+
bundles = makeBenchBundles(plan, 32);
|
|
114
|
+
mergeIndex = createSwarmMergeIndex({ bundles, generatedAt: 4000 + cursor++ });
|
|
115
|
+
return mergeIndex.summary.entryCount + mergeIndex.summary.conflictCount;
|
|
116
|
+
}),
|
|
117
|
+
measure('merge-admission-' + taskCount, 16, () => createSwarmMergeAdmission({ index: mergeIndex, maxReady: 8, maxChangedPaths: 16 }).summary.admittedCount),
|
|
118
|
+
measure('hotspot-report-' + taskCount, 16, () => createSwarmHotspotReport({ bundles, threshold: 3 }).summary.recommendationCount),
|
|
119
|
+
measure('context-pack-' + taskCount, 32, () => createSwarmContextPack({
|
|
120
|
+
job: plan.jobs[cursor % plan.jobs.length],
|
|
121
|
+
files: ['src/runtime/file.ts', 'test/runtime-smoke.mjs'],
|
|
122
|
+
apiMap: {
|
|
123
|
+
runtime: ['createRuntime', 'stepRuntime'],
|
|
124
|
+
tests: ['runtime smoke gate']
|
|
125
|
+
},
|
|
126
|
+
knownFailures: ['shared renderer gate is noisy on old snapshots'],
|
|
127
|
+
oracleCommands: [{ name: 'focused-gate', command: 'npm', args: ['test'], required: true }],
|
|
128
|
+
evidenceSchema: { type: 'object', required: ['ok', 'commands'] },
|
|
129
|
+
avoidInvestigating: ['unrelated route snapshots'],
|
|
130
|
+
playbookIds: ['runtime-playbook']
|
|
131
|
+
}).files.length),
|
|
132
|
+
measure('oracle-corpus-' + taskCount, 32, () => createSwarmOracleCorpus({
|
|
133
|
+
artifacts: [
|
|
134
|
+
{ id: 'trace-runtime', path: 'oracles/runtime-trace.jsonl', kind: 'trace', tags: ['runtime', 'reference'], hash: 'fnv1a32:trace' },
|
|
135
|
+
{ id: 'snapshot-routing', path: 'oracles/routing-snapshot.json', kind: 'snapshot', tags: ['routing', 'reference'] }
|
|
136
|
+
]
|
|
137
|
+
}).summary.artifactCount),
|
|
138
|
+
measure('replay-debug-evidence-' + taskCount, 16, () => {
|
|
139
|
+
const replay = createSwarmReplayBundle({
|
|
140
|
+
commands: ['node replay.mjs'],
|
|
141
|
+
artifacts: [{ path: 'agent-runs/bench/trace.jsonl', kind: 'trace' }],
|
|
142
|
+
expectedEvidence: ['trace.jsonl']
|
|
143
|
+
});
|
|
144
|
+
const parity = createSwarmParityOracle({
|
|
145
|
+
comparators: [{ status: 'failed', expected: 1, actual: 2, operationIndex: cursor++ }]
|
|
146
|
+
});
|
|
147
|
+
const divergence = createSwarmDivergenceReport({
|
|
148
|
+
replayBundleIds: [replay.id],
|
|
149
|
+
observabilityPoints: [{ operationIndex: cursor, path: '/value' }],
|
|
150
|
+
expected: 1,
|
|
151
|
+
actual: 2
|
|
152
|
+
});
|
|
153
|
+
const watch = createSwarmWatchpointPlan({ watchpoints: [{ path: '/value', operator: 'changes' }] });
|
|
154
|
+
const handoff = createSwarmDebugHandoff({
|
|
155
|
+
replayBundleIds: [replay.id],
|
|
156
|
+
divergenceReportIds: [divergence.id],
|
|
157
|
+
watchpointPlanIds: [watch.id],
|
|
158
|
+
comparisons: parity.comparators
|
|
159
|
+
});
|
|
160
|
+
const evidence = createSwarmEvidenceIndex({ entries: [{ topic: 'bench', path: 'agent-runs/bench/evidence.json' }] });
|
|
161
|
+
const blackboard = createSwarmBlackboard({ entries: [{ topic: 'bench', text: 'divergence found', sourceIds: [divergence.id] }] });
|
|
162
|
+
const bottleneck = createSwarmBottleneckReport({ sources: [{ text: 'merge review bottleneck', changedPaths: ['src/runtime.ts'] }] });
|
|
163
|
+
const fixtures = createSwarmFixtureCatalog({ fixtures: [{ id: 'logged-in', tags: ['auth'] }] });
|
|
164
|
+
const progress = createSwarmProgressModel({ items: [{ id: 'bench', status: 'accepted' }] });
|
|
165
|
+
return handoff.commands.length + evidence.summary.entryCount + blackboard.summary.entryCount + bottleneck.summary.kindCount + fixtures.summary.fixtureCount + progress.summary.acceptedCount;
|
|
166
|
+
}),
|
|
167
|
+
measure('trace-index-' + taskCount, 16, () => {
|
|
168
|
+
const traceBundles = makeBenchTraceBundles(plan, 24, cursor++);
|
|
169
|
+
const traceIndex = createSwarmTraceIndex({ bundles: traceBundles, generatedAt: 7000 + cursor++ });
|
|
170
|
+
const query = querySwarmTraceIndex(traceIndex, { region: 'region.2', textIncludes: 'benchSymbol' });
|
|
171
|
+
return traceIndex.summary.shardCount + traceIndex.summary.executableOwnershipRegionCount + query.summary.shardCount;
|
|
172
|
+
}),
|
|
173
|
+
measure('lane-playbook-' + taskCount, 16, () => createSwarmLanePlaybook({
|
|
174
|
+
lane: 'runtime',
|
|
175
|
+
successfulBundles: bundles,
|
|
176
|
+
notes: ['prefer narrow patches with focused evidence'],
|
|
177
|
+
commands: [{ name: 'runtime-smoke', command: 'npm', args: ['test'], required: true }],
|
|
178
|
+
avoidInvestigating: ['generated fixtures unless task owns them'],
|
|
179
|
+
evidencePatterns: ['evidence.json', 'commands.md']
|
|
180
|
+
}).successfulJobIds.length),
|
|
181
|
+
measure('patch-stack-plan-' + taskCount, 16, () => createSwarmPatchStackPlan({
|
|
182
|
+
index: mergeIndex,
|
|
183
|
+
maxStackSize: 8
|
|
184
|
+
}).summary.stackCount),
|
|
185
|
+
measure('event-route-' + taskCount, 64, () => {
|
|
186
|
+
eventStream = createSwarmEventStream({ runId: 'bench', root: 'agent-runs/bench/streams', lanes: manifest.lanes });
|
|
187
|
+
return routeSwarmEventToMailboxes(eventStream, { type: 'agent.evidence', jobId: plan.jobs[cursor++ % plan.jobs.length].id, lane: 'runtime' }).length;
|
|
188
|
+
})
|
|
189
|
+
];
|
|
190
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { performance } from 'node:perf_hooks';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
export function createPackageBenchPaths(metaUrl) {
|
|
7
|
+
const dirname = path.dirname(fileURLToPath(metaUrl));
|
|
8
|
+
const packageDir = path.resolve(dirname, '..');
|
|
9
|
+
return {
|
|
10
|
+
packageDir,
|
|
11
|
+
repoRoot: path.basename(path.dirname(packageDir)) === 'packages'
|
|
12
|
+
? path.resolve(packageDir, '..', '..')
|
|
13
|
+
: packageDir
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function createMeasure(rounds) {
|
|
18
|
+
return function measure(fixture, operationsPerRound, fn) {
|
|
19
|
+
const samples = [];
|
|
20
|
+
let checksum = 0;
|
|
21
|
+
for (let round = 0; round < rounds; round += 1) {
|
|
22
|
+
const start = performance.now();
|
|
23
|
+
for (let op = 0; op < operationsPerRound; op += 1) checksum += Number(fn()) || 0;
|
|
24
|
+
const elapsed = performance.now() - start;
|
|
25
|
+
samples.push((elapsed * 1000) / operationsPerRound);
|
|
26
|
+
}
|
|
27
|
+
samples.sort((a, b) => a - b);
|
|
28
|
+
return {
|
|
29
|
+
fixture,
|
|
30
|
+
operationsPerRound,
|
|
31
|
+
medianUs: percentile(samples, 0.5),
|
|
32
|
+
p95Us: percentile(samples, 0.95),
|
|
33
|
+
checksum
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function parseArgs(argv) {
|
|
39
|
+
const out = {};
|
|
40
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
41
|
+
if (argv[i] === '--out') out.out = argv[++i];
|
|
42
|
+
else if (argv[i] === '--tasks') out.tasks = argv[++i];
|
|
43
|
+
else if (argv[i] === '--rounds') out.rounds = argv[++i];
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function readPositiveInt(value, fallback) {
|
|
49
|
+
const parsed = Number(value);
|
|
50
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function resolveOutPath(repoRoot, out) {
|
|
54
|
+
return out ? path.resolve(repoRoot, out) : null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function readPackageVersion(packageDir) {
|
|
58
|
+
return JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')).version;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function writeBenchReport(report, outPath) {
|
|
62
|
+
if (!outPath) return;
|
|
63
|
+
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
|
64
|
+
fs.writeFileSync(outPath, JSON.stringify(report, null, 2) + '\n');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function printBenchReport(report, { outPath, repoRoot }) {
|
|
68
|
+
console.log(report.package + ' package benchmark');
|
|
69
|
+
console.log('Node ' + report.node + ' on ' + report.platform + ', tasks=' + report.taskCount + ', rounds=' + report.rounds);
|
|
70
|
+
console.log('These are Frontier-only package measurements, not competitor comparisons.');
|
|
71
|
+
console.log('');
|
|
72
|
+
console.log(padRight('Fixture', 30) + padLeft('Median', 12) + padLeft('p95', 12));
|
|
73
|
+
for (const row of report.rows) {
|
|
74
|
+
console.log(padRight(row.fixture, 30) + padLeft(formatUs(row.medianUs), 12) + padLeft(formatUs(row.p95Us), 12));
|
|
75
|
+
}
|
|
76
|
+
if (outPath) console.log('\nwrote ' + path.relative(repoRoot, outPath));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function formatUs(value) {
|
|
80
|
+
if (value >= 1000) return (value / 1000).toFixed(2) + 'ms';
|
|
81
|
+
return value.toFixed(2) + 'us';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function padRight(value, size) {
|
|
85
|
+
return String(value).padEnd(size);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function padLeft(value, size) {
|
|
89
|
+
return String(value).padStart(size);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function percentile(sorted, pct) {
|
|
93
|
+
return sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * pct))];
|
|
94
|
+
}
|