@danypops/jittor 0.16.1 → 0.16.2
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/package.json +3 -3
- package/src/service.ts +1 -1
- package/src/vehicle-registration.ts +5 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danypops/jittor",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "Just-in-Time Token Optimizing Router for Pi -- supervised daemon, router policy, and CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"service:install": "bun src/cli.ts service install"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@danypops/vehicle-core": "^0.
|
|
20
|
-
"@danypops/vehicle-server": "^0.
|
|
19
|
+
"@danypops/vehicle-core": "^0.12.1",
|
|
20
|
+
"@danypops/vehicle-server": "^0.17.0",
|
|
21
21
|
"@danypops/vehicle-client": "^0.5.1",
|
|
22
22
|
"google-auth-library": "^10.9.0"
|
|
23
23
|
},
|
package/src/service.ts
CHANGED
|
@@ -207,7 +207,7 @@ export class JittorService {
|
|
|
207
207
|
};
|
|
208
208
|
this.vehicleRegistry = new VehicleRegistry({
|
|
209
209
|
name: "jittor",
|
|
210
|
-
|
|
210
|
+
packageJsonUrl: new URL("../package.json", import.meta.url),
|
|
211
211
|
description: "Just-in-Time Token Optimizing Router for Pi -- metrics, benchmark evidence, model ranking, and router policy.",
|
|
212
212
|
});
|
|
213
213
|
// withJittorErrorParity() already converts every real handler error into a well-formed
|
|
@@ -23,34 +23,16 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import type { VehicleEffect, VehicleIdempotency } from "@danypops/vehicle-core";
|
|
26
|
-
import { bindVehicleOperation, defineVehicleOperation, passthroughVehicleSchema
|
|
26
|
+
import { bindVehicleOperation, defineErrorMapping, defineVehicleOperation, passthroughVehicleSchema } from "@danypops/vehicle-core";
|
|
27
27
|
import type { VehicleRegistry } from "@danypops/vehicle-server";
|
|
28
28
|
import type { OperationHandlerMap } from "./operations/types.ts";
|
|
29
29
|
import type { OperationName } from "./service.ts";
|
|
30
30
|
import { InvalidSessionSecretError } from "./session-identity-service.ts";
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* handler-thrown error that isn't already a VehicleError into
|
|
37
|
-
* category:"internal" (HTTP 500), losing both the specific status and the
|
|
38
|
-
* error's own message (a VehicleFailure never serializes an error's cause
|
|
39
|
-
* over the wire) -- the same regression class found and fixed in
|
|
40
|
-
* web-spider's own migration (see its vehicle-error-parity.ts).
|
|
41
|
-
*/
|
|
42
|
-
async function withJittorErrorParity<T>(run: () => T | Promise<T>): Promise<T> {
|
|
43
|
-
try {
|
|
44
|
-
return await run();
|
|
45
|
-
} catch (error) {
|
|
46
|
-
if (error instanceof VehicleError) throw error;
|
|
47
|
-
if (error instanceof InvalidSessionSecretError) {
|
|
48
|
-
throw new VehicleError("invalid-session-secret", error.message, { category: "authorization", cause: error });
|
|
49
|
-
}
|
|
50
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
-
throw new VehicleError("operation-rejected", message, { category: "validation", cause: error });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
32
|
+
/** Preserves the legacy route's 403 for invalid session credentials; every other rejection remains validation. */
|
|
33
|
+
const withJittorErrorParity = defineErrorMapping([
|
|
34
|
+
{ errorClass: InvalidSessionSecretError, category: "authorization", code: "invalid-session-secret" },
|
|
35
|
+
]);
|
|
54
36
|
|
|
55
37
|
const OWNER = "jittor";
|
|
56
38
|
const LIMITS = { defaultTimeoutMs: 10_000, maxTimeoutMs: 30_000, maxRequestBytes: 65_536, maxResponseBytes: 1_048_576 };
|