@shapeshift-labs/frontier-swarm 0.5.28 → 0.5.30
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 +2 -0
- package/dist/index.d.ts +146 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +397 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -429,6 +429,8 @@ const route = createSwarmModelRoute({
|
|
|
429
429
|
|
|
430
430
|
`createSwarmModelRoutingFeedback` and `createSwarmModelRoutingPolicy` cover the serializable feedback/policy layer above the model router. Matching feedback is converted into model outcome history, cost/duration signals are folded into candidate scoring, prefer/avoid/override signals can select or suppress candidates, and each routed job gets compact `metadata.modelRoute` evidence with fallback, selected, recommended compute ids, policy match counts, cost-signal counts, and route reasons.
|
|
431
431
|
|
|
432
|
+
`createSwarmRoutingController` turns runtime telemetry records into the next routing policy and, when a plan carries its manifest snapshot, a rerouted plan for pending jobs. It converts per-job model telemetry into routing feedback, emits prefer/avoid/observe signals from success, verification, human-action, cost, and duration signals, and preserves protected/running/completed jobs. `rerouteSwarmPlan` exposes the plan-only step for runners that already have a policy and just need to update unstarted work during a refill.
|
|
433
|
+
|
|
432
434
|
`createSwarmOptimizationSummary` gives runners a generic evidence record for routing decisions, panel/fusion decisions, tournament observations, RSI-style routing feedback, model diversity, and whether any feedback was consumed. Telemetry can be omitted entirely when unavailable or emitted with real zero counts when the run observed nothing.
|
|
433
435
|
|
|
434
436
|
The returned record includes scored candidates, estimated cost and latency, price/outcome telemetry fallbacks, panel confidence lift, residual risk, and a human-readable explanation for `single-cheap`, `single-deep`, `panel`, or `tournament` recommendations.
|
package/dist/index.d.ts
CHANGED
|
@@ -817,6 +817,7 @@ export interface FrontierSwarmPlan {
|
|
|
817
817
|
id: string;
|
|
818
818
|
runId: string;
|
|
819
819
|
manifestId: string;
|
|
820
|
+
manifest?: FrontierSwarmManifest;
|
|
820
821
|
createdAt: number;
|
|
821
822
|
filters: FrontierSwarmPlanFilter;
|
|
822
823
|
limits: FrontierSwarmScheduleLimits;
|
|
@@ -4678,8 +4679,153 @@ export interface FrontierSwarmModelRoutingPolicy {
|
|
|
4678
4679
|
};
|
|
4679
4680
|
metadata?: JsonObject;
|
|
4680
4681
|
}
|
|
4682
|
+
export interface FrontierSwarmModelTelemetryRecordInput {
|
|
4683
|
+
id?: string;
|
|
4684
|
+
generatedAt?: number;
|
|
4685
|
+
runId?: string;
|
|
4686
|
+
planId?: string;
|
|
4687
|
+
jobId?: string;
|
|
4688
|
+
taskId?: string;
|
|
4689
|
+
lane?: string;
|
|
4690
|
+
layer?: string;
|
|
4691
|
+
workKind?: string;
|
|
4692
|
+
taskKind?: string;
|
|
4693
|
+
computeId?: string;
|
|
4694
|
+
compute?: string;
|
|
4695
|
+
computeKind?: string;
|
|
4696
|
+
model?: string;
|
|
4697
|
+
modelTier?: string;
|
|
4698
|
+
reasoningEffort?: string;
|
|
4699
|
+
serviceTier?: string;
|
|
4700
|
+
status?: string;
|
|
4701
|
+
mergeReadiness?: FrontierSwarmMergeReadiness | string;
|
|
4702
|
+
mergeDisposition?: FrontierSwarmMergeDisposition | string;
|
|
4703
|
+
durationMs?: number;
|
|
4704
|
+
estimatedCostUsd?: number;
|
|
4705
|
+
estimatedInputCostUsd?: number;
|
|
4706
|
+
estimatedOutputCostUsd?: number;
|
|
4707
|
+
billableInputTokens?: number;
|
|
4708
|
+
outputTokens?: number;
|
|
4709
|
+
priceKnown?: boolean;
|
|
4710
|
+
costEstimateInputOnly?: boolean;
|
|
4711
|
+
costEstimateMissingOutputTokens?: boolean;
|
|
4712
|
+
verificationTotal?: number;
|
|
4713
|
+
verificationPassed?: number;
|
|
4714
|
+
verificationFailed?: number;
|
|
4715
|
+
verificationRequiredFailed?: number;
|
|
4716
|
+
ownershipViolationCount?: number;
|
|
4717
|
+
changedPathCount?: number;
|
|
4718
|
+
evidencePathCount?: number;
|
|
4719
|
+
humanActionCount?: number;
|
|
4720
|
+
openHumanActionCount?: number;
|
|
4721
|
+
semanticImportPresent?: boolean;
|
|
4722
|
+
metadata?: unknown;
|
|
4723
|
+
[key: string]: unknown;
|
|
4724
|
+
}
|
|
4725
|
+
export interface FrontierSwarmModelTelemetrySummaryInput {
|
|
4726
|
+
recordCount?: number;
|
|
4727
|
+
jobCount?: number;
|
|
4728
|
+
statusCounts?: Record<string, number>;
|
|
4729
|
+
computeCounts?: Record<string, number>;
|
|
4730
|
+
modelCounts?: Record<string, number>;
|
|
4731
|
+
taskKindCounts?: Record<string, number>;
|
|
4732
|
+
workKindCounts?: Record<string, number>;
|
|
4733
|
+
totalDurationMs?: number;
|
|
4734
|
+
estimatedCostUsd?: number;
|
|
4735
|
+
estimatedInputCostUsd?: number;
|
|
4736
|
+
estimatedOutputCostUsd?: number;
|
|
4737
|
+
billableInputTokens?: number;
|
|
4738
|
+
outputTokens?: number;
|
|
4739
|
+
priceKnownRecordCount?: number;
|
|
4740
|
+
unknownPriceRecordCount?: number;
|
|
4741
|
+
verificationTotal?: number;
|
|
4742
|
+
verificationPassed?: number;
|
|
4743
|
+
verificationFailed?: number;
|
|
4744
|
+
verificationRequiredFailed?: number;
|
|
4745
|
+
humanActionCount?: number;
|
|
4746
|
+
openHumanActionCount?: number;
|
|
4747
|
+
metadata?: unknown;
|
|
4748
|
+
[key: string]: unknown;
|
|
4749
|
+
}
|
|
4750
|
+
export interface FrontierSwarmRoutingControllerDecision {
|
|
4751
|
+
id: string;
|
|
4752
|
+
action: 'prefer' | 'avoid' | 'observe' | 'reroute' | string;
|
|
4753
|
+
computeId?: string;
|
|
4754
|
+
model?: string;
|
|
4755
|
+
lane?: string;
|
|
4756
|
+
workKind?: string;
|
|
4757
|
+
taskKind?: string;
|
|
4758
|
+
jobId?: string;
|
|
4759
|
+
taskId?: string;
|
|
4760
|
+
score?: number;
|
|
4761
|
+
confidence: FrontierSwarmConfidence;
|
|
4762
|
+
reason: string;
|
|
4763
|
+
metadata?: JsonObject;
|
|
4764
|
+
}
|
|
4765
|
+
export interface FrontierSwarmRoutingControllerInput {
|
|
4766
|
+
id?: string;
|
|
4767
|
+
plan?: FrontierSwarmPlan;
|
|
4768
|
+
records?: readonly FrontierSwarmModelTelemetryRecordInput[];
|
|
4769
|
+
telemetry?: {
|
|
4770
|
+
records?: readonly FrontierSwarmModelTelemetryRecordInput[];
|
|
4771
|
+
summary?: FrontierSwarmModelTelemetrySummaryInput;
|
|
4772
|
+
};
|
|
4773
|
+
summary?: FrontierSwarmModelTelemetrySummaryInput;
|
|
4774
|
+
basePolicy?: FrontierSwarmModelRoutingPolicyInput | FrontierSwarmModelRoutingPolicy | unknown;
|
|
4775
|
+
defaultMode?: FrontierSwarmModelRoutingMode;
|
|
4776
|
+
routingMode?: FrontierSwarmModelRoutingMode;
|
|
4777
|
+
protectedJobIds?: readonly string[];
|
|
4778
|
+
runningJobIds?: readonly string[];
|
|
4779
|
+
completedJobIds?: readonly string[];
|
|
4780
|
+
minSamples?: number;
|
|
4781
|
+
preferSuccessRate?: number;
|
|
4782
|
+
avoidSuccessRate?: number;
|
|
4783
|
+
highCostUsd?: number;
|
|
4784
|
+
generatedAt?: number;
|
|
4785
|
+
metadata?: unknown;
|
|
4786
|
+
}
|
|
4787
|
+
export interface FrontierSwarmRoutingControllerSummary {
|
|
4788
|
+
telemetryRecordCount: number;
|
|
4789
|
+
telemetryJobCount: number;
|
|
4790
|
+
feedbackCount: number;
|
|
4791
|
+
signalCount: number;
|
|
4792
|
+
preferCount: number;
|
|
4793
|
+
avoidCount: number;
|
|
4794
|
+
observeCount: number;
|
|
4795
|
+
decisionCount: number;
|
|
4796
|
+
reroutedJobCount: number;
|
|
4797
|
+
changedComputeCount: number;
|
|
4798
|
+
protectedJobCount: number;
|
|
4799
|
+
missingPlanManifest: boolean;
|
|
4800
|
+
summaryRecordCount?: number;
|
|
4801
|
+
summaryEstimatedCostUsd?: number;
|
|
4802
|
+
}
|
|
4803
|
+
export interface FrontierSwarmRoutingController {
|
|
4804
|
+
kind: 'frontier.swarm.routing-controller';
|
|
4805
|
+
version: 1;
|
|
4806
|
+
id: string;
|
|
4807
|
+
generatedAt: number;
|
|
4808
|
+
routingMode: FrontierSwarmModelRoutingMode;
|
|
4809
|
+
policy: FrontierSwarmModelRoutingPolicy;
|
|
4810
|
+
decisions: FrontierSwarmRoutingControllerDecision[];
|
|
4811
|
+
routedPlan?: FrontierSwarmPlan;
|
|
4812
|
+
summary: FrontierSwarmRoutingControllerSummary;
|
|
4813
|
+
metadata?: JsonObject;
|
|
4814
|
+
}
|
|
4815
|
+
export interface FrontierSwarmReroutePlanInput {
|
|
4816
|
+
plan: FrontierSwarmPlan;
|
|
4817
|
+
routingPolicy: FrontierSwarmModelRoutingPolicyInput | FrontierSwarmModelRoutingPolicy | unknown;
|
|
4818
|
+
routingMode?: FrontierSwarmModelRoutingMode;
|
|
4819
|
+
protectedJobIds?: readonly string[];
|
|
4820
|
+
runningJobIds?: readonly string[];
|
|
4821
|
+
completedJobIds?: readonly string[];
|
|
4822
|
+
generatedAt?: number;
|
|
4823
|
+
metadata?: unknown;
|
|
4824
|
+
}
|
|
4681
4825
|
export declare function createSwarmModelRoutingFeedback(input?: FrontierSwarmModelRoutingFeedbackInput): FrontierSwarmModelRoutingFeedback;
|
|
4682
4826
|
export declare function createSwarmModelRoutingPolicy(input?: FrontierSwarmModelRoutingPolicyInput): FrontierSwarmModelRoutingPolicy;
|
|
4827
|
+
export declare function createSwarmRoutingController(input?: FrontierSwarmRoutingControllerInput): FrontierSwarmRoutingController;
|
|
4828
|
+
export declare function rerouteSwarmPlan(input: FrontierSwarmReroutePlanInput): FrontierSwarmPlan;
|
|
4683
4829
|
export declare function createSwarmModelRoutingFeedbackFromBoard(input?: {
|
|
4684
4830
|
board?: unknown;
|
|
4685
4831
|
generatedAt?: number;
|