audit-tools 0.28.8 → 0.28.9
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/audit-code-wrapper-install-hosts.mjs +133 -27
- package/dist/audit/cli/confirmIntentStep.d.ts +1 -0
- package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
- package/dist/audit/cli/confirmIntentStep.js +14 -10
- package/dist/audit/cli/confirmIntentStep.js.map +1 -1
- package/dist/audit/cli/dispatch/quotaPool.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/quotaPool.js +4 -3
- package/dist/audit/cli/dispatch/quotaPool.js.map +1 -1
- package/dist/audit/cli/dispatch.d.ts +15 -1
- package/dist/audit/cli/dispatch.d.ts.map +1 -1
- package/dist/audit/cli/dispatch.js +54 -19
- package/dist/audit/cli/dispatch.js.map +1 -1
- package/dist/audit/cli/hybridDispatch.d.ts +46 -0
- package/dist/audit/cli/hybridDispatch.d.ts.map +1 -0
- package/dist/audit/cli/hybridDispatch.js +77 -0
- package/dist/audit/cli/hybridDispatch.js.map +1 -0
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +111 -2
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/reviewRun.d.ts +8 -0
- package/dist/audit/cli/reviewRun.d.ts.map +1 -1
- package/dist/audit/cli/reviewRun.js +1 -1
- package/dist/audit/cli/reviewRun.js.map +1 -1
- package/dist/audit/cli/rollingAuditDispatch.d.ts +57 -4
- package/dist/audit/cli/rollingAuditDispatch.d.ts.map +1 -1
- package/dist/audit/cli/rollingAuditDispatch.js +137 -10
- package/dist/audit/cli/rollingAuditDispatch.js.map +1 -1
- package/dist/audit/cli/scoreAuditCommand.d.ts +16 -0
- package/dist/audit/cli/scoreAuditCommand.d.ts.map +1 -0
- package/dist/audit/cli/scoreAuditCommand.js +82 -0
- package/dist/audit/cli/scoreAuditCommand.js.map +1 -0
- package/dist/audit/cli.d.ts.map +1 -1
- package/dist/audit/cli.js +5 -1
- package/dist/audit/cli.js.map +1 -1
- package/dist/audit/orchestrator/designReviewProjection.d.ts +9 -1
- package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewProjection.js +19 -1
- package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.d.ts +2 -0
- package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.js +11 -1
- package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
- package/dist/audit/orchestrator/executorRunners.js +1 -1
- package/dist/audit/orchestrator/executorRunners.js.map +1 -1
- package/dist/audit/orchestrator/intakeExecutors.d.ts +9 -1
- package/dist/audit/orchestrator/intakeExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/intakeExecutors.js +16 -3
- package/dist/audit/orchestrator/intakeExecutors.js.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.js +3 -0
- package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
- package/dist/audit/orchestrator/intentInterpreter.d.ts +21 -7
- package/dist/audit/orchestrator/intentInterpreter.d.ts.map +1 -1
- package/dist/audit/orchestrator/intentInterpreter.js +30 -11
- package/dist/audit/orchestrator/intentInterpreter.js.map +1 -1
- package/dist/audit/orchestrator/intentScopeDisposition.d.ts +49 -0
- package/dist/audit/orchestrator/intentScopeDisposition.d.ts.map +1 -0
- package/dist/audit/orchestrator/intentScopeDisposition.js +57 -0
- package/dist/audit/orchestrator/intentScopeDisposition.js.map +1 -0
- package/dist/audit/orchestrator/rollingDispatch.d.ts +9 -0
- package/dist/audit/orchestrator/rollingDispatch.d.ts.map +1 -1
- package/dist/audit/orchestrator/rollingDispatch.js +10 -0
- package/dist/audit/orchestrator/rollingDispatch.js.map +1 -1
- package/dist/audit/orchestrator/scope.d.ts +1 -0
- package/dist/audit/orchestrator/scope.d.ts.map +1 -1
- package/dist/audit/orchestrator/scope.js +2 -7
- package/dist/audit/orchestrator/scope.js.map +1 -1
- package/dist/audit/quota/index.d.ts +5 -0
- package/dist/audit/quota/index.d.ts.map +1 -1
- package/dist/audit/reporting/scoreAudit.d.ts +161 -0
- package/dist/audit/reporting/scoreAudit.d.ts.map +1 -0
- package/dist/audit/reporting/scoreAudit.js +224 -0
- package/dist/audit/reporting/scoreAudit.js.map +1 -0
- package/dist/audit/types/activeDispatch.d.ts +29 -1
- package/dist/audit/types/activeDispatch.d.ts.map +1 -1
- package/dist/audit/types/activeDispatch.js.map +1 -1
- package/dist/audit/types/analyzerCapability.d.ts +6 -6
- package/dist/remediate/contractPipeline/changeClassification.d.ts +146 -0
- package/dist/remediate/contractPipeline/changeClassification.d.ts.map +1 -0
- package/dist/remediate/contractPipeline/changeClassification.js +398 -0
- package/dist/remediate/contractPipeline/changeClassification.js.map +1 -0
- package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/derive.js +9 -0
- package/dist/remediate/contractPipeline/derive.js.map +1 -1
- package/dist/remediate/intent/intentOrdering.d.ts +51 -0
- package/dist/remediate/intent/intentOrdering.d.ts.map +1 -0
- package/dist/remediate/intent/intentOrdering.js +150 -0
- package/dist/remediate/intent/intentOrdering.js.map +1 -0
- package/dist/remediate/phases/plan.d.ts.map +1 -1
- package/dist/remediate/phases/plan.js +14 -1
- package/dist/remediate/phases/plan.js.map +1 -1
- package/dist/remediate/providers/index.d.ts +32 -0
- package/dist/remediate/providers/index.d.ts.map +1 -1
- package/dist/remediate/providers/index.js +28 -1
- package/dist/remediate/providers/index.js.map +1 -1
- package/dist/remediate/steps/contractPipeline.d.ts +15 -1
- package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.js +282 -14
- package/dist/remediate/steps/contractPipeline.js.map +1 -1
- package/dist/remediate/steps/dispatch.d.ts +56 -1
- package/dist/remediate/steps/dispatch.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch.js +120 -29
- package/dist/remediate/steps/dispatch.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts +53 -2
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +253 -81
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/remediate/steps/providerNodeDispatch.d.ts +8 -1
- package/dist/remediate/steps/providerNodeDispatch.d.ts.map +1 -1
- package/dist/remediate/steps/providerNodeDispatch.js +7 -2
- package/dist/remediate/steps/providerNodeDispatch.js.map +1 -1
- package/dist/remediate/steps/rollingSession.d.ts +55 -1
- package/dist/remediate/steps/rollingSession.d.ts.map +1 -1
- package/dist/remediate/steps/rollingSession.js +128 -19
- package/dist/remediate/steps/rollingSession.js.map +1 -1
- package/dist/remediate/validation/contractPipelineGates.d.ts +23 -8
- package/dist/remediate/validation/contractPipelineGates.d.ts.map +1 -1
- package/dist/remediate/validation/contractPipelineGates.js +43 -38
- package/dist/remediate/validation/contractPipelineGates.js.map +1 -1
- package/dist/shared/dispatch/coordinator.d.ts +170 -0
- package/dist/shared/dispatch/coordinator.d.ts.map +1 -0
- package/dist/shared/dispatch/coordinator.js +177 -0
- package/dist/shared/dispatch/coordinator.js.map +1 -0
- package/dist/shared/dispatch/hybridDispatch.d.ts +74 -0
- package/dist/shared/dispatch/hybridDispatch.d.ts.map +1 -0
- package/dist/shared/dispatch/hybridDispatch.js +54 -0
- package/dist/shared/dispatch/hybridDispatch.js.map +1 -0
- package/dist/shared/dispatch/settledPools.d.ts +21 -0
- package/dist/shared/dispatch/settledPools.d.ts.map +1 -0
- package/dist/shared/dispatch/settledPools.js +34 -0
- package/dist/shared/dispatch/settledPools.js.map +1 -0
- package/dist/shared/index.d.ts +15 -5
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +14 -2
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/intent/clauseInterpreter.d.ts +19 -0
- package/dist/shared/intent/clauseInterpreter.d.ts.map +1 -1
- package/dist/shared/intent/clauseInterpreter.js +19 -0
- package/dist/shared/intent/clauseInterpreter.js.map +1 -1
- package/dist/shared/providers/sharedProviderConfirmation.d.ts +134 -0
- package/dist/shared/providers/sharedProviderConfirmation.d.ts.map +1 -0
- package/dist/shared/providers/sharedProviderConfirmation.js +244 -0
- package/dist/shared/providers/sharedProviderConfirmation.js.map +1 -0
- package/dist/shared/quota/apiPool.d.ts +67 -0
- package/dist/shared/quota/apiPool.d.ts.map +1 -0
- package/dist/shared/quota/apiPool.js +139 -0
- package/dist/shared/quota/apiPool.js.map +1 -0
- package/dist/shared/quota/capacity.d.ts +29 -1
- package/dist/shared/quota/capacity.d.ts.map +1 -1
- package/dist/shared/quota/capacity.js +5 -0
- package/dist/shared/quota/capacity.js.map +1 -1
- package/dist/shared/quota/claimRegistry.d.ts +64 -0
- package/dist/shared/quota/claimRegistry.d.ts.map +1 -0
- package/dist/shared/quota/claimRegistry.js +157 -0
- package/dist/shared/quota/claimRegistry.js.map +1 -0
- package/dist/shared/quota/compositeQuotaSource.d.ts +10 -1
- package/dist/shared/quota/compositeQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/compositeQuotaSource.js +34 -6
- package/dist/shared/quota/compositeQuotaSource.js.map +1 -1
- package/dist/shared/quota/httpQuotaSource.d.ts +9 -1
- package/dist/shared/quota/httpQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/httpQuotaSource.js +33 -8
- package/dist/shared/quota/httpQuotaSource.js.map +1 -1
- package/dist/shared/quota/learnedQuotaSource.d.ts +7 -1
- package/dist/shared/quota/learnedQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/learnedQuotaSource.js +18 -7
- package/dist/shared/quota/learnedQuotaSource.js.map +1 -1
- package/dist/shared/quota/quotaSource.d.ts +41 -0
- package/dist/shared/quota/quotaSource.d.ts.map +1 -1
- package/dist/shared/quota/quotaSource.js +19 -0
- package/dist/shared/quota/quotaSource.js.map +1 -1
- package/dist/shared/types/contractPipeline/obligations.d.ts +42 -0
- package/dist/shared/types/contractPipeline/obligations.d.ts.map +1 -1
- package/dist/shared/types/contractPipeline.d.ts +1 -1
- package/dist/shared/types/contractPipeline.d.ts.map +1 -1
- package/dist/shared/types/contractPipeline.js.map +1 -1
- package/dist/shared/types/intentCheckpoint.d.ts +14 -0
- package/dist/shared/types/intentCheckpoint.d.ts.map +1 -1
- package/dist/shared/types/intentCheckpoint.js +10 -0
- package/dist/shared/types/intentCheckpoint.js.map +1 -1
- package/dist/shared/types/sessionConfig.d.ts +60 -0
- package/dist/shared/types/sessionConfig.d.ts.map +1 -1
- package/dist/shared/types/sessionConfig.js +13 -0
- package/dist/shared/types/sessionConfig.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid spill coordinator (A-8).
|
|
3
|
+
*
|
|
4
|
+
* The ONE assignment layer that BOTH dispatch drivers — the audit in-process
|
|
5
|
+
* provider engine (`driveRollingAuditDispatch`) and the remediate host-subagent
|
|
6
|
+
* loop (`advanceHostRolling`) — drive identically, so the spill topology can no
|
|
7
|
+
* longer drift between them. It sits ABOVE the shared capacity fold
|
|
8
|
+
* (`computeDispatchCapacity` / `scheduleWave`, S4) and the per-node accept
|
|
9
|
+
* lifecycle (`acceptNodeWorktree`); it owns the cross-driver invariants those
|
|
10
|
+
* lower layers cannot enforce on their own:
|
|
11
|
+
*
|
|
12
|
+
* - **Claim-before-assign (CE-001).** Every node is claimed through A-10's
|
|
13
|
+
* file-backed {@link ClaimRegistry} BEFORE it is returned in any assignment,
|
|
14
|
+
* so two loops driving the same goal can never both pick the same node —
|
|
15
|
+
* exactly-one-claimant across both drivers. A node another driver already
|
|
16
|
+
* holds a live claim on is silently skipped (it is that driver's to run); the
|
|
17
|
+
* coordinator only ever hands back nodes it actually owns.
|
|
18
|
+
*
|
|
19
|
+
* - **Co-owned SettledExclusionSet (CE-001 spill/exclusion handshake).** A pool
|
|
20
|
+
* that was spilled onto and then exhausted is recorded *settled* in the SAME
|
|
21
|
+
* exclusion set dc4 persists on the active-dispatch artifact (read in via
|
|
22
|
+
* `readSettled`, written back via `onSettle`). A settled pool is therefore
|
|
23
|
+
* excluded from every future split AND is never re-offered as net-new on
|
|
24
|
+
* re-discovery (INV-S03) — the spill side and the pause side share one set,
|
|
25
|
+
* not two that can disagree.
|
|
26
|
+
*
|
|
27
|
+
* - **Proactive capacity split across ALL pools.** The frontier is split across
|
|
28
|
+
* every non-settled pool by capacity up front (not one chosen pool throttled
|
|
29
|
+
* reactively), folding inv2's RAW per-pool signals
|
|
30
|
+
* (`quotaSourceSnapshot` / `quotaStateEntry` / `quotaSignalDegraded`) to slot
|
|
31
|
+
* counts ONLY through the single shared `computeDispatchCapacity` fold — never
|
|
32
|
+
* pre-folded here and never re-folded. The global host-concurrency budget is
|
|
33
|
+
* honoured because it lives inside that same fold.
|
|
34
|
+
*
|
|
35
|
+
* - **The single pause authorization.** {@link HybridSpillCoordinator.terminalStatus}
|
|
36
|
+
* emits the `all_pools_exhausted` terminal — and that terminal is the ONLY
|
|
37
|
+
* signal authorizing dc4 to pause the run. While any confirmed pool is still
|
|
38
|
+
* unsettled the coordinator reports `dispatchable`, so a driver never pauses
|
|
39
|
+
* on a transient single-pool exhaustion that the split could route around.
|
|
40
|
+
*
|
|
41
|
+
* The module is pure logic over injected collaborators (the registry, the
|
|
42
|
+
* read/write hooks for the shared set, an optional clock) — zero direct disk or
|
|
43
|
+
* provider coupling, so it runs identically on win32 / darwin / linux and under
|
|
44
|
+
* either driver.
|
|
45
|
+
*/
|
|
46
|
+
import type { CapacityPool, PartialCompletionTerminal } from "../quota/capacity.js";
|
|
47
|
+
import type { SessionConfig } from "../types/sessionConfig.js";
|
|
48
|
+
import type { SettledExclusionSet } from "../rolling/pausedState.js";
|
|
49
|
+
import type { ClaimRegistry } from "../quota/claimRegistry.js";
|
|
50
|
+
/**
|
|
51
|
+
* A dispatchable frontier node, packet-payload-agnostic. The coordinator needs
|
|
52
|
+
* only the stable id (for the claim) and the projected input-token cost (for the
|
|
53
|
+
* capacity split); the payload is the driver's own concern.
|
|
54
|
+
*/
|
|
55
|
+
export interface FrontierNode {
|
|
56
|
+
/** Stable, unique id for this node within the run (the claim key). */
|
|
57
|
+
id: string;
|
|
58
|
+
/** Projected input-token cost — fed to the S4 fold, never re-derived here. */
|
|
59
|
+
estimatedTokens: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One node claimed for one pool. Returned ONLY after the claim succeeded, so the
|
|
63
|
+
* caller may dispatch immediately. The `ownerToken` is carried so the caller
|
|
64
|
+
* (and {@link HybridSpillCoordinator.release}) can release or heartbeat the claim
|
|
65
|
+
* through the same registry without re-reading it.
|
|
66
|
+
*/
|
|
67
|
+
export interface NodeAssignment {
|
|
68
|
+
nodeId: string;
|
|
69
|
+
poolId: string;
|
|
70
|
+
providerName: CapacityPool["providerName"];
|
|
71
|
+
hostModel: string | null;
|
|
72
|
+
/** Claim token minted by the registry; required to release the claim. */
|
|
73
|
+
ownerToken: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The coordinator's terminal verdict after a planning pass.
|
|
77
|
+
*
|
|
78
|
+
* - `dispatchable`: at least one confirmed pool is still unsettled — keep going,
|
|
79
|
+
* never pause.
|
|
80
|
+
* - `all_pools_exhausted`: every confirmed pool is settled; this is the ONLY
|
|
81
|
+
* signal that authorizes dc4 to engage the resumable pause. The stranded ids
|
|
82
|
+
* ride along as a {@link PartialCompletionTerminal} so the caller can route
|
|
83
|
+
* them through its consumer-specific handler.
|
|
84
|
+
*/
|
|
85
|
+
export type CoordinatorTerminalStatus = {
|
|
86
|
+
kind: "dispatchable";
|
|
87
|
+
} | {
|
|
88
|
+
kind: "all_pools_exhausted";
|
|
89
|
+
terminal: PartialCompletionTerminal;
|
|
90
|
+
};
|
|
91
|
+
/** Construction inputs for {@link HybridSpillCoordinator}. */
|
|
92
|
+
export interface HybridSpillCoordinatorOptions {
|
|
93
|
+
/** Confirmed provider pools for this run, in preference order. */
|
|
94
|
+
pools: CapacityPool[];
|
|
95
|
+
sessionConfig: SessionConfig;
|
|
96
|
+
/**
|
|
97
|
+
* A-10 file-backed claim registry. The SAME registry path is supplied by both
|
|
98
|
+
* drivers so a claim taken by one is visible to the other (exactly-one-claimant).
|
|
99
|
+
*/
|
|
100
|
+
claimRegistry: ClaimRegistry;
|
|
101
|
+
/**
|
|
102
|
+
* Read the CURRENT shared settled-exclusion set (the pool ids dc4 persisted on
|
|
103
|
+
* the active-dispatch artifact). Read on every pass so a pool another loop
|
|
104
|
+
* settled is honoured immediately — the set is co-owned, not snapshotted once.
|
|
105
|
+
*/
|
|
106
|
+
readSettled: () => SettledExclusionSet;
|
|
107
|
+
/**
|
|
108
|
+
* Persist a newly-settled pool id back into the shared set. Invoked by
|
|
109
|
+
* {@link HybridSpillCoordinator.settlePool} so the spill side and dc4's pause
|
|
110
|
+
* side write through ONE set. Optional for in-memory / test use.
|
|
111
|
+
*/
|
|
112
|
+
onSettle?: (poolId: string) => void | Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
export declare class HybridSpillCoordinator {
|
|
115
|
+
private readonly pools;
|
|
116
|
+
private readonly sessionConfig;
|
|
117
|
+
private readonly claimRegistry;
|
|
118
|
+
private readonly readSettled;
|
|
119
|
+
private readonly onSettle?;
|
|
120
|
+
constructor(opts: HybridSpillCoordinatorOptions);
|
|
121
|
+
/** The pools NOT in the current shared settled set, in preference order. */
|
|
122
|
+
private activePools;
|
|
123
|
+
/**
|
|
124
|
+
* Plan one dispatch pass: proactively split `nodes` across every non-settled
|
|
125
|
+
* pool by capacity, then CLAIM each planned node before returning it.
|
|
126
|
+
*
|
|
127
|
+
* Steps:
|
|
128
|
+
* 1. Drop settled pools (co-owned set) — a spilled-then-exhausted pool is never
|
|
129
|
+
* offered capacity again.
|
|
130
|
+
* 2. Size every surviving pool through the single shared `computeDispatchCapacity`
|
|
131
|
+
* fold (S4): inv2's raw per-pool signals become slot counts THERE, the global
|
|
132
|
+
* host budget is enforced THERE, and the largest nodes land on the pools with
|
|
133
|
+
* the most headroom. No pre-fold or re-fold happens in this module.
|
|
134
|
+
* 3. Walk the per-pool slot allocations largest-node-first and, for each
|
|
135
|
+
* (node, pool) pairing, take a registry claim BEFORE emitting the assignment.
|
|
136
|
+
* A node already held by another loop (live claim) is skipped — exactly-one
|
|
137
|
+
* claimant across both drivers (CE-001). Only owned nodes are returned.
|
|
138
|
+
*
|
|
139
|
+
* Returns the assignments the caller now exclusively owns. An empty result with
|
|
140
|
+
* no active pools means the caller should consult {@link terminalStatus}.
|
|
141
|
+
*/
|
|
142
|
+
planAssignments(nodes: FrontierNode[]): Promise<NodeAssignment[]>;
|
|
143
|
+
/**
|
|
144
|
+
* Record a pool as spilled-then-exhausted in the co-owned SettledExclusionSet.
|
|
145
|
+
*
|
|
146
|
+
* This is the spill side of the CE-001 handshake: once a pool that load was
|
|
147
|
+
* spilled onto can no longer take work, it is written back through `onSettle`
|
|
148
|
+
* into the SAME set dc4 reads when it pauses — so the pool is excluded from
|
|
149
|
+
* every future split here AND is never re-offered as net-new on re-discovery
|
|
150
|
+
* (INV-S03). Idempotent: settling an already-settled pool is a no-op.
|
|
151
|
+
*/
|
|
152
|
+
settlePool(poolId: string): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Release a node's claim once its `acceptNodeWorktree` lifecycle has finished
|
|
155
|
+
* (success OR failure) — the convergence point both drivers share. Token-checked
|
|
156
|
+
* by the registry, so only the owner can release. A `rate_limited` node that the
|
|
157
|
+
* driver intends to re-queue should NOT be released here (it is still owned work);
|
|
158
|
+
* release only on a terminal accept outcome.
|
|
159
|
+
*/
|
|
160
|
+
release(assignment: NodeAssignment): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* The single pause-authorization check. Returns `all_pools_exhausted` — carrying
|
|
163
|
+
* a `PartialCompletionTerminal` over `strandedIds` — ONLY when every confirmed
|
|
164
|
+
* pool is settled; otherwise `dispatchable`. dc4 may engage its resumable pause
|
|
165
|
+
* if and only if this returns the terminal; a transient single-pool exhaustion
|
|
166
|
+
* (other pools still unsettled) keeps the run dispatchable.
|
|
167
|
+
*/
|
|
168
|
+
terminalStatus(strandedIds: string[]): CoordinatorTerminalStatus;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../src/shared/dispatch/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,8EAA8E;IAC9E,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC3C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GACjC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,yBAAyB,CAAA;CAAE,CAAC;AAEzE,8DAA8D;AAC9D,MAAM,WAAW,6BAA6B;IAC5C,kEAAkE;IAClE,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,aAAa,EAAE,aAAa,CAAC;IAC7B;;;;OAIG;IACH,WAAW,EAAE,MAAM,mBAAmB,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAMD,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAA2C;gBAEzD,IAAI,EAAE,6BAA6B;IAQ/C,4EAA4E;IAC5E,OAAO,CAAC,WAAW;IAKnB;;;;;;;;;;;;;;;;;;OAkBG;IACG,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAkDvE;;;;;;;;OAQG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/C;;;;;;OAMG;IACG,OAAO,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD;;;;;;OAMG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,yBAAyB;CASjE"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid spill coordinator (A-8).
|
|
3
|
+
*
|
|
4
|
+
* The ONE assignment layer that BOTH dispatch drivers — the audit in-process
|
|
5
|
+
* provider engine (`driveRollingAuditDispatch`) and the remediate host-subagent
|
|
6
|
+
* loop (`advanceHostRolling`) — drive identically, so the spill topology can no
|
|
7
|
+
* longer drift between them. It sits ABOVE the shared capacity fold
|
|
8
|
+
* (`computeDispatchCapacity` / `scheduleWave`, S4) and the per-node accept
|
|
9
|
+
* lifecycle (`acceptNodeWorktree`); it owns the cross-driver invariants those
|
|
10
|
+
* lower layers cannot enforce on their own:
|
|
11
|
+
*
|
|
12
|
+
* - **Claim-before-assign (CE-001).** Every node is claimed through A-10's
|
|
13
|
+
* file-backed {@link ClaimRegistry} BEFORE it is returned in any assignment,
|
|
14
|
+
* so two loops driving the same goal can never both pick the same node —
|
|
15
|
+
* exactly-one-claimant across both drivers. A node another driver already
|
|
16
|
+
* holds a live claim on is silently skipped (it is that driver's to run); the
|
|
17
|
+
* coordinator only ever hands back nodes it actually owns.
|
|
18
|
+
*
|
|
19
|
+
* - **Co-owned SettledExclusionSet (CE-001 spill/exclusion handshake).** A pool
|
|
20
|
+
* that was spilled onto and then exhausted is recorded *settled* in the SAME
|
|
21
|
+
* exclusion set dc4 persists on the active-dispatch artifact (read in via
|
|
22
|
+
* `readSettled`, written back via `onSettle`). A settled pool is therefore
|
|
23
|
+
* excluded from every future split AND is never re-offered as net-new on
|
|
24
|
+
* re-discovery (INV-S03) — the spill side and the pause side share one set,
|
|
25
|
+
* not two that can disagree.
|
|
26
|
+
*
|
|
27
|
+
* - **Proactive capacity split across ALL pools.** The frontier is split across
|
|
28
|
+
* every non-settled pool by capacity up front (not one chosen pool throttled
|
|
29
|
+
* reactively), folding inv2's RAW per-pool signals
|
|
30
|
+
* (`quotaSourceSnapshot` / `quotaStateEntry` / `quotaSignalDegraded`) to slot
|
|
31
|
+
* counts ONLY through the single shared `computeDispatchCapacity` fold — never
|
|
32
|
+
* pre-folded here and never re-folded. The global host-concurrency budget is
|
|
33
|
+
* honoured because it lives inside that same fold.
|
|
34
|
+
*
|
|
35
|
+
* - **The single pause authorization.** {@link HybridSpillCoordinator.terminalStatus}
|
|
36
|
+
* emits the `all_pools_exhausted` terminal — and that terminal is the ONLY
|
|
37
|
+
* signal authorizing dc4 to pause the run. While any confirmed pool is still
|
|
38
|
+
* unsettled the coordinator reports `dispatchable`, so a driver never pauses
|
|
39
|
+
* on a transient single-pool exhaustion that the split could route around.
|
|
40
|
+
*
|
|
41
|
+
* The module is pure logic over injected collaborators (the registry, the
|
|
42
|
+
* read/write hooks for the shared set, an optional clock) — zero direct disk or
|
|
43
|
+
* provider coupling, so it runs identically on win32 / darwin / linux and under
|
|
44
|
+
* either driver.
|
|
45
|
+
*/
|
|
46
|
+
import { computeDispatchCapacity, buildEmptyPoolTerminal } from "../quota/capacity.js";
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// HybridSpillCoordinator
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
export class HybridSpillCoordinator {
|
|
51
|
+
pools;
|
|
52
|
+
sessionConfig;
|
|
53
|
+
claimRegistry;
|
|
54
|
+
readSettled;
|
|
55
|
+
onSettle;
|
|
56
|
+
constructor(opts) {
|
|
57
|
+
this.pools = opts.pools;
|
|
58
|
+
this.sessionConfig = opts.sessionConfig;
|
|
59
|
+
this.claimRegistry = opts.claimRegistry;
|
|
60
|
+
this.readSettled = opts.readSettled;
|
|
61
|
+
this.onSettle = opts.onSettle;
|
|
62
|
+
}
|
|
63
|
+
/** The pools NOT in the current shared settled set, in preference order. */
|
|
64
|
+
activePools() {
|
|
65
|
+
const settled = this.readSettled();
|
|
66
|
+
return this.pools.filter((p) => !settled.has(p.id));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Plan one dispatch pass: proactively split `nodes` across every non-settled
|
|
70
|
+
* pool by capacity, then CLAIM each planned node before returning it.
|
|
71
|
+
*
|
|
72
|
+
* Steps:
|
|
73
|
+
* 1. Drop settled pools (co-owned set) — a spilled-then-exhausted pool is never
|
|
74
|
+
* offered capacity again.
|
|
75
|
+
* 2. Size every surviving pool through the single shared `computeDispatchCapacity`
|
|
76
|
+
* fold (S4): inv2's raw per-pool signals become slot counts THERE, the global
|
|
77
|
+
* host budget is enforced THERE, and the largest nodes land on the pools with
|
|
78
|
+
* the most headroom. No pre-fold or re-fold happens in this module.
|
|
79
|
+
* 3. Walk the per-pool slot allocations largest-node-first and, for each
|
|
80
|
+
* (node, pool) pairing, take a registry claim BEFORE emitting the assignment.
|
|
81
|
+
* A node already held by another loop (live claim) is skipped — exactly-one
|
|
82
|
+
* claimant across both drivers (CE-001). Only owned nodes are returned.
|
|
83
|
+
*
|
|
84
|
+
* Returns the assignments the caller now exclusively owns. An empty result with
|
|
85
|
+
* no active pools means the caller should consult {@link terminalStatus}.
|
|
86
|
+
*/
|
|
87
|
+
async planAssignments(nodes) {
|
|
88
|
+
const active = this.activePools();
|
|
89
|
+
if (active.length === 0 || nodes.length === 0)
|
|
90
|
+
return [];
|
|
91
|
+
// Largest-node-first so the capacity split and the claim walk agree with
|
|
92
|
+
// computeDispatchCapacity's own descending layout (biggest work → most headroom).
|
|
93
|
+
const ordered = [...nodes].sort((a, b) => b.estimatedTokens - a.estimatedTokens);
|
|
94
|
+
// S4: the ONE fold. Raw per-pool quota signals → slot counts, global host
|
|
95
|
+
// budget applied, all inside computeDispatchCapacity. We pass the ordered node
|
|
96
|
+
// token costs as the pending layout and read back the per-pool slot counts.
|
|
97
|
+
const capacity = computeDispatchCapacity({
|
|
98
|
+
pools: active,
|
|
99
|
+
sessionConfig: this.sessionConfig,
|
|
100
|
+
pendingItemTokens: ordered.map((n) => n.estimatedTokens),
|
|
101
|
+
});
|
|
102
|
+
const poolById = new Map(active.map((p) => [p.id, p]));
|
|
103
|
+
const assignments = [];
|
|
104
|
+
let cursor = 0;
|
|
105
|
+
for (const alloc of capacity.pools) {
|
|
106
|
+
const pool = poolById.get(alloc.pool_id);
|
|
107
|
+
// Defensive: the fold echoes the input pools, but never assign to a pool
|
|
108
|
+
// that is not in the active (non-settled) set.
|
|
109
|
+
if (!pool)
|
|
110
|
+
continue;
|
|
111
|
+
let placed = 0;
|
|
112
|
+
while (placed < alloc.slots && cursor < ordered.length) {
|
|
113
|
+
const node = ordered[cursor];
|
|
114
|
+
cursor += 1;
|
|
115
|
+
// Claim BEFORE returning the node in any assignment (CE-001). A node
|
|
116
|
+
// another driver already holds is skipped — it is theirs to run — and the
|
|
117
|
+
// slot is freed for the next node so capacity is not wasted on a contested id.
|
|
118
|
+
const claim = await this.claimRegistry.claim(node.id, pool.id);
|
|
119
|
+
if (!claim.acquired)
|
|
120
|
+
continue;
|
|
121
|
+
assignments.push({
|
|
122
|
+
nodeId: node.id,
|
|
123
|
+
poolId: pool.id,
|
|
124
|
+
providerName: pool.providerName,
|
|
125
|
+
hostModel: pool.hostModel,
|
|
126
|
+
ownerToken: claim.ownerToken,
|
|
127
|
+
});
|
|
128
|
+
placed += 1;
|
|
129
|
+
}
|
|
130
|
+
if (cursor >= ordered.length)
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return assignments;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Record a pool as spilled-then-exhausted in the co-owned SettledExclusionSet.
|
|
137
|
+
*
|
|
138
|
+
* This is the spill side of the CE-001 handshake: once a pool that load was
|
|
139
|
+
* spilled onto can no longer take work, it is written back through `onSettle`
|
|
140
|
+
* into the SAME set dc4 reads when it pauses — so the pool is excluded from
|
|
141
|
+
* every future split here AND is never re-offered as net-new on re-discovery
|
|
142
|
+
* (INV-S03). Idempotent: settling an already-settled pool is a no-op.
|
|
143
|
+
*/
|
|
144
|
+
async settlePool(poolId) {
|
|
145
|
+
if (this.readSettled().has(poolId))
|
|
146
|
+
return;
|
|
147
|
+
await this.onSettle?.(poolId);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Release a node's claim once its `acceptNodeWorktree` lifecycle has finished
|
|
151
|
+
* (success OR failure) — the convergence point both drivers share. Token-checked
|
|
152
|
+
* by the registry, so only the owner can release. A `rate_limited` node that the
|
|
153
|
+
* driver intends to re-queue should NOT be released here (it is still owned work);
|
|
154
|
+
* release only on a terminal accept outcome.
|
|
155
|
+
*/
|
|
156
|
+
async release(assignment) {
|
|
157
|
+
await this.claimRegistry.release(assignment.nodeId, assignment.ownerToken);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The single pause-authorization check. Returns `all_pools_exhausted` — carrying
|
|
161
|
+
* a `PartialCompletionTerminal` over `strandedIds` — ONLY when every confirmed
|
|
162
|
+
* pool is settled; otherwise `dispatchable`. dc4 may engage its resumable pause
|
|
163
|
+
* if and only if this returns the terminal; a transient single-pool exhaustion
|
|
164
|
+
* (other pools still unsettled) keeps the run dispatchable.
|
|
165
|
+
*/
|
|
166
|
+
terminalStatus(strandedIds) {
|
|
167
|
+
const settled = this.readSettled();
|
|
168
|
+
const allExhausted = this.pools.length > 0 && this.pools.every((p) => settled.has(p.id));
|
|
169
|
+
if (!allExhausted)
|
|
170
|
+
return { kind: "dispatchable" };
|
|
171
|
+
return {
|
|
172
|
+
kind: "all_pools_exhausted",
|
|
173
|
+
terminal: buildEmptyPoolTerminal(strandedIds),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../../src/shared/dispatch/coordinator.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A-8 hybrid dispatch split (FINDING-020 capstone) — the ONE split layer BOTH
|
|
3
|
+
* orchestrators drive.
|
|
4
|
+
*
|
|
5
|
+
* Given an eligible frontier and the confirmed CapacityPools, it drives the shared
|
|
6
|
+
* {@link HybridSpillCoordinator} to split the frontier across the pools by capacity —
|
|
7
|
+
* claiming each node to exactly one pool BEFORE it is returned (CE-001, single
|
|
8
|
+
* claimant) — then partitions the claimed assignments into the work each driver
|
|
9
|
+
* executes:
|
|
10
|
+
*
|
|
11
|
+
* - `inProcess` — nodes on a backend pool the orchestrator launches itself this cycle
|
|
12
|
+
* (NIM / codex / opencode / subprocess), and
|
|
13
|
+
* - `host` — nodes on the conversation host's pool, handed to the host driver.
|
|
14
|
+
*
|
|
15
|
+
* The host-vs-backend classification is the only tool-specific input — audit's
|
|
16
|
+
* in-process provider set is narrower than remediate's — so it is injected as
|
|
17
|
+
* {@link HybridDispatchInput.isInProcess} rather than baked in here. Everything else
|
|
18
|
+
* (the coordinator, the claim, the capacity split, the settled-exclusion handshake) is
|
|
19
|
+
* identical across both drivers, so the spill topology cannot drift between the two
|
|
20
|
+
* tools. Pure logic over injected collaborators — no dispatch, no disk beyond the
|
|
21
|
+
* registry claim — so it runs identically on win32 / darwin / linux.
|
|
22
|
+
*/
|
|
23
|
+
import { HybridSpillCoordinator, type FrontierNode, type NodeAssignment } from "./coordinator.js";
|
|
24
|
+
import type { CapacityPool } from "../quota/capacity.js";
|
|
25
|
+
import type { ClaimRegistry } from "../quota/claimRegistry.js";
|
|
26
|
+
import type { SessionConfig } from "../types/sessionConfig.js";
|
|
27
|
+
import type { SettledExclusionSet } from "../rolling/pausedState.js";
|
|
28
|
+
/** The proactive split of one frontier into the two driver classes + the coordinator. */
|
|
29
|
+
export interface HybridDispatchPartition {
|
|
30
|
+
/** Nodes the orchestrator runs in-process this cycle (backend pools). */
|
|
31
|
+
inProcess: NodeAssignment[];
|
|
32
|
+
/** Nodes handed to the conversation host's driver (its own pool). */
|
|
33
|
+
host: NodeAssignment[];
|
|
34
|
+
/**
|
|
35
|
+
* The live coordinator, so the caller can `release` claims on terminal accept,
|
|
36
|
+
* `settlePool` an exhausted pool, and consult `terminalStatus` for the sole
|
|
37
|
+
* pause authorization once the cycle's work is reconciled.
|
|
38
|
+
*/
|
|
39
|
+
coordinator: HybridSpillCoordinator;
|
|
40
|
+
}
|
|
41
|
+
export interface HybridDispatchInput {
|
|
42
|
+
frontier: FrontierNode[];
|
|
43
|
+
pools: CapacityPool[];
|
|
44
|
+
sessionConfig: SessionConfig;
|
|
45
|
+
claimRegistry: ClaimRegistry;
|
|
46
|
+
/** Current shared settled-exclusion set (pools that spilled-then-exhausted). */
|
|
47
|
+
readSettled: () => SettledExclusionSet;
|
|
48
|
+
/** Persist a newly-settled pool id into the shared set. */
|
|
49
|
+
onSettle?: (poolId: string) => void | Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Classify a pool as one the orchestrator launches IN-PROCESS this cycle (vs. the
|
|
52
|
+
* conversation host / IDE pool). Tool-specific: audit's in-process set excludes
|
|
53
|
+
* `local-subprocess` / `subprocess-template`; remediate's includes them.
|
|
54
|
+
*/
|
|
55
|
+
isInProcess: (pool: {
|
|
56
|
+
providerName: string;
|
|
57
|
+
}) => boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Split one eligible frontier across the confirmed pools via the shared coordinator,
|
|
61
|
+
* claiming each node to exactly one pool, and partition the claimed assignments by the
|
|
62
|
+
* caller's in-process classification.
|
|
63
|
+
*
|
|
64
|
+
* Behaviour falls out of the pool set with no special-casing:
|
|
65
|
+
* - host-only pools → every node lands in `host`; `inProcess` empty.
|
|
66
|
+
* - backend-only pools → every node lands in `inProcess`; `host` empty.
|
|
67
|
+
* - mixed (`[host, backend]`) → both partitions are non-empty whenever both pools have
|
|
68
|
+
* headroom (the proactive-spill criterion).
|
|
69
|
+
*
|
|
70
|
+
* Nodes beyond the current total capacity are left unclaimed and re-offered next cycle,
|
|
71
|
+
* which is what makes the distribution continuous.
|
|
72
|
+
*/
|
|
73
|
+
export declare function planHybridDispatch(input: HybridDispatchInput): Promise<HybridDispatchPartition>;
|
|
74
|
+
//# sourceMappingURL=hybridDispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hybridDispatch.d.ts","sourceRoot":"","sources":["../../../src/shared/dispatch/hybridDispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,yFAAyF;AACzF,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,qEAAqE;IACrE,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB;;;;OAIG;IACH,WAAW,EAAE,sBAAsB,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,gFAAgF;IAChF,WAAW,EAAE,MAAM,mBAAmB,CAAC;IACvC,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;CAC1D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAerG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A-8 hybrid dispatch split (FINDING-020 capstone) — the ONE split layer BOTH
|
|
3
|
+
* orchestrators drive.
|
|
4
|
+
*
|
|
5
|
+
* Given an eligible frontier and the confirmed CapacityPools, it drives the shared
|
|
6
|
+
* {@link HybridSpillCoordinator} to split the frontier across the pools by capacity —
|
|
7
|
+
* claiming each node to exactly one pool BEFORE it is returned (CE-001, single
|
|
8
|
+
* claimant) — then partitions the claimed assignments into the work each driver
|
|
9
|
+
* executes:
|
|
10
|
+
*
|
|
11
|
+
* - `inProcess` — nodes on a backend pool the orchestrator launches itself this cycle
|
|
12
|
+
* (NIM / codex / opencode / subprocess), and
|
|
13
|
+
* - `host` — nodes on the conversation host's pool, handed to the host driver.
|
|
14
|
+
*
|
|
15
|
+
* The host-vs-backend classification is the only tool-specific input — audit's
|
|
16
|
+
* in-process provider set is narrower than remediate's — so it is injected as
|
|
17
|
+
* {@link HybridDispatchInput.isInProcess} rather than baked in here. Everything else
|
|
18
|
+
* (the coordinator, the claim, the capacity split, the settled-exclusion handshake) is
|
|
19
|
+
* identical across both drivers, so the spill topology cannot drift between the two
|
|
20
|
+
* tools. Pure logic over injected collaborators — no dispatch, no disk beyond the
|
|
21
|
+
* registry claim — so it runs identically on win32 / darwin / linux.
|
|
22
|
+
*/
|
|
23
|
+
import { HybridSpillCoordinator } from "./coordinator.js";
|
|
24
|
+
/**
|
|
25
|
+
* Split one eligible frontier across the confirmed pools via the shared coordinator,
|
|
26
|
+
* claiming each node to exactly one pool, and partition the claimed assignments by the
|
|
27
|
+
* caller's in-process classification.
|
|
28
|
+
*
|
|
29
|
+
* Behaviour falls out of the pool set with no special-casing:
|
|
30
|
+
* - host-only pools → every node lands in `host`; `inProcess` empty.
|
|
31
|
+
* - backend-only pools → every node lands in `inProcess`; `host` empty.
|
|
32
|
+
* - mixed (`[host, backend]`) → both partitions are non-empty whenever both pools have
|
|
33
|
+
* headroom (the proactive-spill criterion).
|
|
34
|
+
*
|
|
35
|
+
* Nodes beyond the current total capacity are left unclaimed and re-offered next cycle,
|
|
36
|
+
* which is what makes the distribution continuous.
|
|
37
|
+
*/
|
|
38
|
+
export async function planHybridDispatch(input) {
|
|
39
|
+
const coordinator = new HybridSpillCoordinator({
|
|
40
|
+
pools: input.pools,
|
|
41
|
+
sessionConfig: input.sessionConfig,
|
|
42
|
+
claimRegistry: input.claimRegistry,
|
|
43
|
+
readSettled: input.readSettled,
|
|
44
|
+
onSettle: input.onSettle,
|
|
45
|
+
});
|
|
46
|
+
const assignments = await coordinator.planAssignments(input.frontier);
|
|
47
|
+
const inProcess = [];
|
|
48
|
+
const host = [];
|
|
49
|
+
for (const a of assignments) {
|
|
50
|
+
(input.isInProcess(a) ? inProcess : host).push(a);
|
|
51
|
+
}
|
|
52
|
+
return { inProcess, host, coordinator };
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=hybridDispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hybridDispatch.js","sourceRoot":"","sources":["../../../src/shared/dispatch/hybridDispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,sBAAsB,EAA0C,MAAM,kBAAkB,CAAC;AAqClG;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAA0B;IACjE,MAAM,WAAW,GAAG,IAAI,sBAAsB,CAAC;QAC7C,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtE,MAAM,SAAS,GAAqB,EAAE,CAAC;IACvC,MAAM,IAAI,GAAqB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cross-cycle settled-pool store for A-8 hybrid dispatch (DC-4).
|
|
3
|
+
*
|
|
4
|
+
* A pool that was spilled onto and then EXHAUSTED is recorded here so the
|
|
5
|
+
* {@link HybridSpillCoordinator} excludes it from every future split (its
|
|
6
|
+
* `readSettled` reads this set) — the stranded work then falls back to the other
|
|
7
|
+
* pool class (the conversation host) instead of re-looping on a dead backend each
|
|
8
|
+
* cycle. The set only grows within a run (a spilled-then-exhausted pool is never
|
|
9
|
+
* re-offered as net-new, INV-S03); a fresh run starts empty (the file is per-run /
|
|
10
|
+
* per-artifacts-dir, cleared with the run's artifacts).
|
|
11
|
+
*
|
|
12
|
+
* Single-sourced so audit and remediate persist exhaustion identically — the same
|
|
13
|
+
* primitive both drivers' cutovers read on every cycle and write on backend
|
|
14
|
+
* exhaustion. Every mutation runs inside `withFileLock` so two loops driving the
|
|
15
|
+
* same run can't lose a settle to a read-modify-write race (mirrors the claim
|
|
16
|
+
* registry's cross-process safety).
|
|
17
|
+
*/
|
|
18
|
+
export declare function readSettledPools(path: string): Promise<Set<string>>;
|
|
19
|
+
/** Record a pool id as settled (idempotent), lock-guarded. */
|
|
20
|
+
export declare function addSettledPool(path: string, poolId: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=settledPools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settledPools.d.ts","sourceRoot":"","sources":["../../../src/shared/dispatch/settledPools.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAGzE;AAED,8DAA8D;AAC9D,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { withFileLock } from "../quota/fileLock.js";
|
|
2
|
+
import { readOptionalJsonFile, writeJsonFile } from "../io/json.js";
|
|
3
|
+
/**
|
|
4
|
+
* The cross-cycle settled-pool store for A-8 hybrid dispatch (DC-4).
|
|
5
|
+
*
|
|
6
|
+
* A pool that was spilled onto and then EXHAUSTED is recorded here so the
|
|
7
|
+
* {@link HybridSpillCoordinator} excludes it from every future split (its
|
|
8
|
+
* `readSettled` reads this set) — the stranded work then falls back to the other
|
|
9
|
+
* pool class (the conversation host) instead of re-looping on a dead backend each
|
|
10
|
+
* cycle. The set only grows within a run (a spilled-then-exhausted pool is never
|
|
11
|
+
* re-offered as net-new, INV-S03); a fresh run starts empty (the file is per-run /
|
|
12
|
+
* per-artifacts-dir, cleared with the run's artifacts).
|
|
13
|
+
*
|
|
14
|
+
* Single-sourced so audit and remediate persist exhaustion identically — the same
|
|
15
|
+
* primitive both drivers' cutovers read on every cycle and write on backend
|
|
16
|
+
* exhaustion. Every mutation runs inside `withFileLock` so two loops driving the
|
|
17
|
+
* same run can't lose a settle to a read-modify-write race (mirrors the claim
|
|
18
|
+
* registry's cross-process safety).
|
|
19
|
+
*/
|
|
20
|
+
export async function readSettledPools(path) {
|
|
21
|
+
const raw = await readOptionalJsonFile(path);
|
|
22
|
+
return new Set(Array.isArray(raw) ? raw.filter((id) => typeof id === "string") : []);
|
|
23
|
+
}
|
|
24
|
+
/** Record a pool id as settled (idempotent), lock-guarded. */
|
|
25
|
+
export async function addSettledPool(path, poolId) {
|
|
26
|
+
await withFileLock(`${path}.lock`, async () => {
|
|
27
|
+
const set = await readSettledPools(path);
|
|
28
|
+
if (set.has(poolId))
|
|
29
|
+
return;
|
|
30
|
+
set.add(poolId);
|
|
31
|
+
await writeJsonFile(path, [...set].sort());
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=settledPools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settledPools.js","sourceRoot":"","sources":["../../../src/shared/dispatch/settledPools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY;IACjD,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAW,IAAI,CAAC,CAAC;IACvD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACvF,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY,EAAE,MAAc;IAC/D,MAAM,YAAY,CAAC,GAAG,IAAI,OAAO,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO;QAC5B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChB,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { IntentCheckpointSchema } from "./types/intentCheckpoint.js";
|
|
|
20
20
|
export type { InterpretedIntent } from "./intent/freeFormIntentInterpreter.js";
|
|
21
21
|
export { interpretFreeFormIntent } from "./intent/freeFormIntentInterpreter.js";
|
|
22
22
|
export type { IntentClauseKind, IntentClause, ClauseInterpretResult, } from "./intent/clauseInterpreter.js";
|
|
23
|
-
export { decomposeIntent, assessClauseEncodability, interpretIntent, } from "./intent/clauseInterpreter.js";
|
|
23
|
+
export { decomposeIntent, assessClauseEncodability, interpretIntent, clauseIdentity, } from "./intent/clauseInterpreter.js";
|
|
24
24
|
export type { RemediationOutcomeStatus, RemediationOutcome, RemediationOutcomesReport, } from "./types/remediationOutcome.js";
|
|
25
25
|
export { RemediationOutcomeStatusSchema, RemediationOutcomeSchema, RemediationOutcomesReportSchema, } from "./types/remediationOutcome.js";
|
|
26
26
|
export type { Lens } from "./types/lens.js";
|
|
@@ -29,7 +29,7 @@ export type { RepoConventions } from "./tooling/repoConventions.js";
|
|
|
29
29
|
export { detectRepoConventions, formatRepoConventions, } from "./tooling/repoConventions.js";
|
|
30
30
|
export type { StepStatus, DispatchModelTier, DispatchModelHint, } from "./types/stepContract.js";
|
|
31
31
|
export { StepStatusSchema, DispatchModelTierSchema, } from "./types/stepContract.js";
|
|
32
|
-
export type { ProviderName, ResolvedProviderName, SessionUiMode, SubprocessTemplateConfig, ClaudeCodeConfig, CodexConfig, OpenCodeConfig, OpenAiCompatibleConfig, VSCodeTaskConfig, AntigravityConfig, BlockQuotaConfig, QuotaModelLimits, QuotaConfig, ObservabilityConfig, SynthesisConfig, GraphConfig, DispatchRoutingTiers, DispatchConfig, DesignReviewConfig, AnalyzerSetting, SessionConfig, } from "./types/sessionConfig.js";
|
|
32
|
+
export type { ProviderName, ResolvedProviderName, SessionUiMode, SubprocessTemplateConfig, ClaudeCodeConfig, CodexConfig, OpenCodeConfig, OpenAiCompatibleConfig, DispatchableSource, DispatchableSourceProvider, VSCodeTaskConfig, AntigravityConfig, BlockQuotaConfig, QuotaModelLimits, QuotaConfig, ObservabilityConfig, SynthesisConfig, GraphConfig, DispatchRoutingTiers, DispatchConfig, DesignReviewConfig, AnalyzerSetting, SessionConfig, } from "./types/sessionConfig.js";
|
|
33
33
|
export { PROVIDER_NAMES, SESSION_UI_MODES, PROVIDER_SECTION_KEYS, ANALYZER_SETTINGS, AnalyzerSettingSchema, } from "./types/sessionConfig.js";
|
|
34
34
|
export { AUDITOR_REPORT_MARKER } from "./contracts.js";
|
|
35
35
|
export { OPENCODE_MANAGED_BROAD_VALUE, withoutOpenCodeWildcard, mergeOpenCodeAgentPermissionRule, mergeOpenCodeGlobalPermissionRule, migrateOpenCodeGlobalExternalDirectory, } from "./opencodePermissions.js";
|
|
@@ -90,8 +90,8 @@ export type { CapabilityTier, DiscoveredProvider, ConfirmedProviderPool, } from
|
|
|
90
90
|
export { discoverProviders, queryProviderQuota, buildProviderConfirmationDisplay, applyProviderConfirmationSelections, } from "./providers/providerConfirmation.js";
|
|
91
91
|
export type { LimitSource, LimitConfidence, HostConcurrencyLimitSource, HostConcurrencyLimit, ResolvedLimits, ConcurrencyBucket, QuotaStateEntry, QuotaState, WaveBindingCap, WaveSchedule, BackoffState, ObservedWaveOutcome, } from "./quota/types.js";
|
|
92
92
|
export { LimitSourceSchema, LimitConfidenceSchema, HostConcurrencyLimitSourceSchema, HostConcurrencyLimitSchema, ResolvedLimitsSchema, WaveBindingCapSchema, BackoffStateSchema, } from "./quota/types.js";
|
|
93
|
-
export type { QuotaSource, QuotaUsageSnapshot } from "./quota/quotaSource.js";
|
|
94
|
-
export { QuotaUsageSnapshotSchema } from "./quota/quotaSource.js";
|
|
93
|
+
export type { QuotaSource, QuotaUsageSnapshot, QuotaProbeResult, QuotaProbeStatus, } from "./quota/quotaSource.js";
|
|
94
|
+
export { QuotaUsageSnapshotSchema, probeQuotaSource } from "./quota/quotaSource.js";
|
|
95
95
|
export { resolveLimits, classifyProvider, resolveHostModel, agentHostFallbackConcurrency, DEFAULT_AGENT_HOST_CONCURRENCY, } from "./quota/limits.js";
|
|
96
96
|
export type { ProviderType, LimitResolutionResult, ResolveLimitsOptions, ResolveHostModelOptions, } from "./quota/limits.js";
|
|
97
97
|
export { setQuotaStateDir, getQuotaStatePath, readQuotaState, writeQuotaState, computeMaxSafeConcurrency, recordWaveOutcome, clearBucketFailureEvidence, decayWeight, applyDecayToEntry, computeBackoffCooldownMs, computeBackoffFailureWeight, computeRampUpConcurrency, BASE_COOLDOWN_MS, MAX_COOLDOWN_MS, MAX_BUCKET_LEVEL, } from "./quota/state.js";
|
|
@@ -100,6 +100,8 @@ export { collectClaudeCodeJsonLines } from "./quota/claudeCodeJsonLines.js";
|
|
|
100
100
|
export { detectHostActiveSubagentLimit, resolveHostActiveSubagentLimit, CODEX_DESKTOP_ACTIVE_SUBAGENT_LIMIT, } from "./quota/hostLimits.js";
|
|
101
101
|
export type { RateLimitDetectionResult } from "./quota/errorParsing.js";
|
|
102
102
|
export { acquireLock, releaseLock, withFileLock, FileLockTimeoutError, STALE_LOCK_MS, } from "./quota/fileLock.js";
|
|
103
|
+
export type { ClaimRecord, ClaimResult } from "./quota/claimRegistry.js";
|
|
104
|
+
export { ClaimRegistry } from "./quota/claimRegistry.js";
|
|
103
105
|
export { runSlidingWindow } from "./quota/slidingWindow.js";
|
|
104
106
|
export type { SlidingWindowResult } from "./quota/slidingWindow.js";
|
|
105
107
|
export { scheduleWave, buildProviderModelKey, parseHostModelRoster, DEFAULT_SAFETY_MARGIN, DEFAULT_EMPIRICAL_HALF_LIFE_HOURS, DEFAULT_FIRST_CONTACT_CONCURRENCY, QUOTA_REMAINING_PCT_CRITICAL, QUOTA_REMAINING_PCT_LOW, } from "./quota/scheduler.js";
|
|
@@ -108,11 +110,12 @@ export { HostModelRosterEntrySchema } from "./quota/scheduler.js";
|
|
|
108
110
|
export { computeDispatchCapacity, summarizeDispatchCapacityPools, detectLivelock, buildEmptyPoolTerminal, } from "./quota/capacity.js";
|
|
109
111
|
export type { CapacityPool, PoolDispatchAllocation, DispatchCapacityPoolSummary, DispatchCapacity, ComputeDispatchCapacityInput, PartialCompletionReason, PartialCompletionTerminal, } from "./quota/capacity.js";
|
|
110
112
|
export { DispatchCapacityPoolSummarySchema } from "./quota/capacity.js";
|
|
113
|
+
export { buildSourcePools, buildSourcePool, sourceProviderConfig, dispatchableSourceId, collectDispatchableSources, withSourceConfig, sourceByPoolId, } from "./quota/apiPool.js";
|
|
111
114
|
export type { CacheablePromptParts } from "./prompts.js";
|
|
112
115
|
export { buildCacheablePrompt, DO_NOT_TOKEN_WRAP_NOTE, DISPATCH_PROMPT_HANDOFF_NOTE, } from "./prompts.js";
|
|
113
116
|
export type { HostAssetKind, RenderHostAssetOptions } from "./hostAssets.js";
|
|
114
117
|
export { renderHostAsset } from "./hostAssets.js";
|
|
115
|
-
export type { GoalSpec, ContextBundle, ContextBundleEntry, DesignSpec, DesignSpecInvariant, ConceptualDesignCritique, DesignCritiqueItem, ObligationLedger, ObligationEntry, ContractAssessmentReport, ContractAssessmentFinding, Counterexample, CounterexampleReport, CounterexampleClassification, JudgedCounterexample, JudgeRepairTarget, JudgeRepairDirective, JudgeReport, ImplementationDAG, ImplementationDAGNode, ImplementationDAGEdge, VerificationReport, VerificationTraceEntry, FindingVerificationTrace, TestSpec, TestValidatorPlan, } from "./types/contractPipeline.js";
|
|
118
|
+
export type { GoalSpec, ContextBundle, ContextBundleEntry, DesignSpec, DesignSpecInvariant, ConceptualDesignCritique, DesignCritiqueItem, ObligationLedger, ObligationEntry, ObligationChangeClassification, ContractAssessmentReport, ContractAssessmentFinding, Counterexample, CounterexampleReport, CounterexampleClassification, JudgedCounterexample, JudgeRepairTarget, JudgeRepairDirective, JudgeReport, ImplementationDAG, ImplementationDAGNode, ImplementationDAGEdge, VerificationReport, VerificationTraceEntry, FindingVerificationTrace, TestSpec, TestValidatorPlan, } from "./types/contractPipeline.js";
|
|
116
119
|
export { CONTRACT_PIPELINE_GOAL_SPEC_VERSION, CONTRACT_PIPELINE_CONTEXT_BUNDLE_VERSION, CONTRACT_PIPELINE_DESIGN_SPEC_VERSION, CONTRACT_PIPELINE_CONCEPTUAL_DESIGN_CRITIQUE_VERSION, CONTRACT_PIPELINE_OBLIGATION_LEDGER_VERSION, CONTRACT_PIPELINE_CONTRACT_ASSESSMENT_REPORT_VERSION, CONTRACT_PIPELINE_COUNTEREXAMPLE_VERSION, CONTRACT_PIPELINE_JUDGE_REPORT_VERSION, CONTRACT_PIPELINE_IMPLEMENTATION_DAG_VERSION, CONTRACT_PIPELINE_VERIFICATION_REPORT_VERSION, CONTRACT_PIPELINE_TEST_VALIDATOR_PLAN_VERSION, } from "./types/contractPipeline.js";
|
|
117
120
|
export type { BuildObligationLedgerOptions } from "./types/obligationLedger.js";
|
|
118
121
|
export { detectObligationCycle, buildObligationLedger, } from "./types/obligationLedger.js";
|
|
@@ -143,10 +146,17 @@ export { LIVELOCK_PAUSE_LIMIT, filterNewProviders, checkLivelockGuard, advancePa
|
|
|
143
146
|
export { DISPATCH_TIER_RANK, DISPATCH_TIER_ORDER, DISPATCH_TIER_RANK_FALLBACK, tierRank, compareTier, mostCapableTier, } from "./dispatch/tierRank.js";
|
|
144
147
|
export type { RollingDispatchPacket, RollingDispatchResult, ProviderSlot, InFlightEntry, RollingDispatchState, RollingDispatchConfig, RollingDispatchOptions, RollingDispatcher, } from "./dispatch/rollingDispatch.js";
|
|
145
148
|
export { InFlightTokenTracker, scorePacketComplexity, selectProvider, createRollingDispatcher, } from "./dispatch/rollingDispatch.js";
|
|
149
|
+
export type { FrontierNode, NodeAssignment, CoordinatorTerminalStatus, HybridSpillCoordinatorOptions, } from "./dispatch/coordinator.js";
|
|
150
|
+
export { HybridSpillCoordinator } from "./dispatch/coordinator.js";
|
|
151
|
+
export { planHybridDispatch } from "./dispatch/hybridDispatch.js";
|
|
152
|
+
export type { HybridDispatchPartition, HybridDispatchInput } from "./dispatch/hybridDispatch.js";
|
|
153
|
+
export { readSettledPools, addSettledPool } from "./dispatch/settledPools.js";
|
|
146
154
|
export type { RollingDispatchEnginePacket, RollingDispatchEngineResult, RollingDispatchEngineContract, } from "./types/rollingDispatch.js";
|
|
147
155
|
export { ROLLING_DISPATCH_ENGINE_VERSION } from "./types/rollingDispatch.js";
|
|
148
156
|
export type { ConfirmedPoolEntry, ProviderConfirmationResult, } from "./types/providerConfirmation.js";
|
|
149
157
|
export { PROVIDER_CONFIRMATION_RESULT_VERSION } from "./types/providerConfirmation.js";
|
|
158
|
+
export type { SharedProviderConfirmation, SharedProviderConfirmationRead } from "./providers/sharedProviderConfirmation.js";
|
|
159
|
+
export { SHARED_PROVIDER_CONFIRMATION_VERSION, SHARED_PROVIDER_CONFIRMATION_FILENAME, sharedProviderConfirmationPath, currentProviderRoster, buildSharedProviderConfirmation, writeSharedProviderConfirmation, readSharedProviderConfirmation } from "./providers/sharedProviderConfirmation.js";
|
|
150
160
|
export type { EncodedClause, FreeFormIntentInterpretation, } from "./types/intentInterpretation.js";
|
|
151
161
|
export { FREE_FORM_INTENT_INTERPRETATION_VERSION } from "./types/intentInterpretation.js";
|
|
152
162
|
export type { ObligationState, Obligation, ObligationDef, ObligationOutcome, ObligationEngine, AdvanceResult, } from "./engine/obligationEngine.js";
|