@velum-labs/routekit-daemon 1.1.0 → 1.1.1
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_CLASSIFIER_MODEL } from "@velum-labs/routekit-config";
|
|
2
|
-
import { AnyPublishedRoutingActivation, assertPublishedRoutingActivation, assertPublishedRoutingActivationV3
|
|
2
|
+
import { AnyPublishedRoutingActivation, assertPublishedRoutingActivation, assertPublishedRoutingActivationV3 } from "@velum-labs/routekit-eval-contracts";
|
|
3
3
|
import { makeRoutingActivationStore, RoutingActivationConflictError, RoutingDeploymentConflictError } from "@velum-labs/routekit-eval-store/effect";
|
|
4
4
|
import { ControlError } from "@velum-labs/routekit-runtime/control";
|
|
5
5
|
import { Effect, Schema } from "effect";
|
|
@@ -20,24 +20,6 @@ function identity(revision) {
|
|
|
20
20
|
evidenceDigest: revision.activation.evidenceDigest
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function decodeLegacyActivation(value) {
|
|
24
|
-
return Schema.decodeUnknownEffect(PublishedRoutingActivation)(value).pipe(Effect.flatMap((activation) => Effect.try({
|
|
25
|
-
try: () => {
|
|
26
|
-
assertPublishedRoutingActivation(activation);
|
|
27
|
-
const { version: _version, generatedAt: _generatedAt, ...publication } = activation;
|
|
28
|
-
return publication;
|
|
29
|
-
},
|
|
30
|
-
catch: (cause) => new ControlError({
|
|
31
|
-
code: "bad_request",
|
|
32
|
-
message: `routing activation is invalid: ${detailOf(cause)}`
|
|
33
|
-
})
|
|
34
|
-
})), Effect.mapError((cause) => cause instanceof ControlError
|
|
35
|
-
? cause
|
|
36
|
-
: new ControlError({
|
|
37
|
-
code: "bad_request",
|
|
38
|
-
message: `routing activation is invalid: ${detailOf(cause)}`
|
|
39
|
-
})));
|
|
40
|
-
}
|
|
41
23
|
function decodeAnyActivation(value) {
|
|
42
24
|
return Schema.decodeUnknownEffect(AnyPublishedRoutingActivation)(value).pipe(Effect.flatMap((activation) => Effect.try({
|
|
43
25
|
try: () => {
|
|
@@ -121,15 +103,10 @@ export class EvalRoutingApplicationService {
|
|
|
121
103
|
previousAuthoritative: identity(deployment.previousAuthoritative)
|
|
122
104
|
};
|
|
123
105
|
}),
|
|
124
|
-
"evalRouting.activate": (params) => Effect.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const activation = yield* makeRoutingActivationStore(evalRoutingSnapshotDirectory(env.home))
|
|
129
|
-
.publishIfCurrent(publication, params.expectedEvidenceDigest ?? undefined)
|
|
130
|
-
.pipe(Effect.mapError(mapStoreError("activate routing policy")));
|
|
131
|
-
return { activated: true, activation };
|
|
132
|
-
}),
|
|
106
|
+
"evalRouting.activate": (params) => Effect.fail(new ControlError({
|
|
107
|
+
code: "bad_request",
|
|
108
|
+
message: "Classification V2 activation is rollback-only; install a qualified Classification V3 activation or restore the retained V2 revision with evalRouting.rollbackAuthoritative"
|
|
109
|
+
})),
|
|
133
110
|
"evalRouting.installAuthoritative": (params) => Effect.gen(function* () {
|
|
134
111
|
const env = yield* DaemonEnv;
|
|
135
112
|
const activation = yield* decodeAnyActivation(params.activation);
|
|
@@ -12,47 +12,7 @@ import { ActiveGateway } from "../services/active-gateway/service.js";
|
|
|
12
12
|
import { DaemonEnv } from "../daemon-env-context.js";
|
|
13
13
|
import { DaemonState } from "../daemon-state-context.js";
|
|
14
14
|
import { EvalRoutingApplicationService } from "../eval-routing-service.js";
|
|
15
|
-
|
|
16
|
-
const dimensions = [
|
|
17
|
-
"gateway-protocol",
|
|
18
|
-
"eval-routing",
|
|
19
|
-
"account-pooling",
|
|
20
|
-
"typescript-maintenance",
|
|
21
|
-
"release-operations"
|
|
22
|
-
].map((id) => ({
|
|
23
|
-
id,
|
|
24
|
-
description: `Requests about ${id}`,
|
|
25
|
-
includes: [`Tasks specifically involving ${id}`],
|
|
26
|
-
excludes: [`Tasks unrelated to ${id}`]
|
|
27
|
-
}));
|
|
28
|
-
return {
|
|
29
|
-
version: 2,
|
|
30
|
-
generatedAt: "2026-08-18T00:00:00.000Z",
|
|
31
|
-
basisDigest: "basis-1",
|
|
32
|
-
evidenceDigest,
|
|
33
|
-
classifierModel: "openai/classifier",
|
|
34
|
-
objective: { kind: "highest-quality" },
|
|
35
|
-
maximumUnknownWeight: 0.2,
|
|
36
|
-
dimensions,
|
|
37
|
-
candidateModels: ["openai/model-a"],
|
|
38
|
-
evidence: dimensions.map((dimension) => ({
|
|
39
|
-
model: "openai/model-a",
|
|
40
|
-
dimensionId: dimension.id,
|
|
41
|
-
suiteDigest: `suite-${dimension.id}`,
|
|
42
|
-
evidenceDigest: `cell-${dimension.id}`,
|
|
43
|
-
quality: {
|
|
44
|
-
passRate: 0.9,
|
|
45
|
-
lowerConfidenceBound: 0.8,
|
|
46
|
-
sampleCount: 20
|
|
47
|
-
},
|
|
48
|
-
failureRate: 0.1,
|
|
49
|
-
averageJudgeScore: 0.85,
|
|
50
|
-
p95DurationMs: 1_000,
|
|
51
|
-
unpricedCalls: 20
|
|
52
|
-
}))
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
test("routing activation handlers expose status and enforce compare-and-swap", async () => {
|
|
15
|
+
test("legacy V2 publication is rejected because V2 is rollback-only", async () => {
|
|
56
16
|
const home = mkdtempSync(join(tmpdir(), "routekit-routing-activation-"));
|
|
57
17
|
const daemonEnv = Layer.succeed(DaemonEnv, DaemonEnv.of({
|
|
58
18
|
home,
|
|
@@ -94,30 +54,28 @@ test("routing activation handlers expose status and enforce compare-and-swap", a
|
|
|
94
54
|
authoritative: null,
|
|
95
55
|
previousAuthoritative: null
|
|
96
56
|
});
|
|
97
|
-
const first = await run(handlers["evalRouting.activate"]({
|
|
98
|
-
expectedEvidenceDigest: null,
|
|
99
|
-
activation: activation("evidence-first")
|
|
100
|
-
}, undefined));
|
|
101
|
-
assert.equal(first.activated, true);
|
|
102
|
-
assert.equal(first.activation.evidenceDigest, "evidence-first");
|
|
103
57
|
await assert.rejects(run(handlers["evalRouting.activate"]({
|
|
104
58
|
expectedEvidenceDigest: null,
|
|
105
|
-
activation: activation("evidence-stale")
|
|
106
|
-
}, undefined)), (error) => error instanceof ControlError && error.code === "conflict");
|
|
107
|
-
await assert.rejects(run(handlers["evalRouting.activate"]({
|
|
108
|
-
expectedEvidenceDigest: "evidence-first",
|
|
109
59
|
activation: {
|
|
110
|
-
|
|
111
|
-
|
|
60
|
+
version: 2,
|
|
61
|
+
generatedAt: "2026-08-18T00:00:00.000Z",
|
|
62
|
+
basisDigest: "legacy-basis",
|
|
63
|
+
evidenceDigest: "legacy-evidence",
|
|
64
|
+
classifierModel: "openai/classifier",
|
|
65
|
+
objective: { kind: "highest-quality" },
|
|
66
|
+
maximumUnknownWeight: 0.2,
|
|
67
|
+
dimensions: [],
|
|
68
|
+
candidateModels: [],
|
|
69
|
+
evidence: []
|
|
112
70
|
}
|
|
113
|
-
}, undefined)), (error) => error instanceof ControlError &&
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
71
|
+
}, undefined)), (error) => error instanceof ControlError &&
|
|
72
|
+
error.code === "bad_request" &&
|
|
73
|
+
/V2 activation is rollback-only/u.test(error.message));
|
|
74
|
+
assert.deepEqual(await run(handlers["evalRouting.status"]({}, undefined)), {
|
|
75
|
+
stateRevision: 0,
|
|
76
|
+
authoritative: null,
|
|
77
|
+
previousAuthoritative: null
|
|
78
|
+
});
|
|
121
79
|
}
|
|
122
80
|
finally {
|
|
123
81
|
rmSync(home, { recursive: true, force: true });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velum-labs/routekit-daemon",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "Singleton RouteKit control daemon and stable model gateway.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"effect": "4.0.0-rc.108",
|
|
45
45
|
"posthog-node": "5.46.1",
|
|
46
46
|
"yaml": "2.9.0",
|
|
47
|
-
"@velum-labs/routekit-accounts": "1.1.
|
|
48
|
-
"@velum-labs/routekit-config": "1.1.
|
|
49
|
-
"@velum-labs/routekit-control": "1.1.
|
|
50
|
-
"@velum-labs/routekit-eval-contracts": "1.1.
|
|
51
|
-
"@velum-labs/routekit-eval-store": "1.1.
|
|
52
|
-
"@velum-labs/routekit-gateway": "1.1.
|
|
53
|
-
"@velum-labs/routekit-registry": "1.1.
|
|
54
|
-
"@velum-labs/routekit-runtime": "1.1.
|
|
55
|
-
"@velum-labs/routekit-telemetry-core": "1.1.
|
|
47
|
+
"@velum-labs/routekit-accounts": "1.1.1",
|
|
48
|
+
"@velum-labs/routekit-config": "1.1.1",
|
|
49
|
+
"@velum-labs/routekit-control": "1.1.1",
|
|
50
|
+
"@velum-labs/routekit-eval-contracts": "1.1.1",
|
|
51
|
+
"@velum-labs/routekit-eval-store": "1.1.1",
|
|
52
|
+
"@velum-labs/routekit-gateway": "1.1.1",
|
|
53
|
+
"@velum-labs/routekit-registry": "1.1.1",
|
|
54
|
+
"@velum-labs/routekit-runtime": "1.1.1",
|
|
55
|
+
"@velum-labs/routekit-telemetry-core": "1.1.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsc -b",
|