@danypops/jittor 0.16.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/jittor",
3
- "version": "0.16.0",
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.11.0",
20
- "@danypops/vehicle-server": "^0.16.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,9 +207,12 @@ export class JittorService {
207
207
  };
208
208
  this.vehicleRegistry = new VehicleRegistry({
209
209
  name: "jittor",
210
- version: "1.0.0",
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
+ // withJittorErrorParity() already converts every real handler error into a well-formed
214
+ // VehicleError, so this only affects a genuine registration/binding bug.
215
+ this.vehicleRegistry.setExposeHandlerFailureDetails(true);
213
216
  registerJittorVehicleOperations(this.vehicleRegistry, this.operations);
214
217
  }
215
218
 
@@ -23,34 +23,16 @@
23
23
  */
24
24
 
25
25
  import type { VehicleEffect, VehicleIdempotency } from "@danypops/vehicle-core";
26
- import { bindVehicleOperation, defineVehicleOperation, passthroughVehicleSchema, VehicleError } from "@danypops/vehicle-core";
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
- * Preserves /api/v1/ops's own error-to-status behavior (see createApp() in
34
- * service.ts): InvalidSessionSecretError -> 403, everything else a handler
35
- * throws -> 400. Without this, VehicleRegistry's own invoke() wraps any
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 };