@danypops/pi-packed 0.20.1 → 0.20.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/pi-packed",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "Pi package lifecycle, validation, daemon, tools, profiles, and TUI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,8 +31,8 @@
31
31
  "@danypops/packed": "^0.6.0",
32
32
  "@danypops/pi-extension-harness": "^0.2.0",
33
33
  "@danypops/vehicle-client": "^0.5.1",
34
- "@danypops/vehicle-core": "^0.10.0",
35
- "@danypops/vehicle-server": "^0.15.0",
34
+ "@danypops/vehicle-core": "^0.12.3",
35
+ "@danypops/vehicle-server": "^0.17.1",
36
36
  "jiti": "2.6.1",
37
37
  "malevich-tui-components": "^0.20.4",
38
38
  "publint": "0.3.22",
@@ -251,7 +251,11 @@ export function createApp(deps: Deps): { fetch: (req: Request) => Promise<Respon
251
251
  // Additive, real Vehicle protocol surface for this daemon's full operation set -- served
252
252
  // at /vehicle/* alongside (not replacing) /api/v1/ops below. Every operation delegates to
253
253
  // the exact same executeOperation() this route's own /api/v1/ops handler calls.
254
- const vehicleRegistry = new VehicleRegistry({ name: "packed", version: VERSION, description: "Pi package lifecycle daemon" });
254
+ const vehicleRegistry = new VehicleRegistry({
255
+ name: "packed",
256
+ packageJsonUrl: new URL("../../../package.json", import.meta.url),
257
+ description: "Pi package lifecycle daemon",
258
+ });
255
259
  registerPackedVehicleOperations(vehicleRegistry, executeOperation);
256
260
  const vehicleApp = createVehicleHttpApp({ registry: vehicleRegistry, token: deps.token });
257
261
 
@@ -37,7 +37,7 @@
37
37
  */
38
38
 
39
39
  import type { VehicleEffect, VehicleIdempotency } from "@danypops/vehicle-core";
40
- import { bindVehicleOperation, defineVehicleOperation, passthroughVehicleSchema, VehicleError } from "@danypops/vehicle-core";
40
+ import { bindVehicleOperation, defineErrorMapping, defineVehicleOperation, passthroughVehicleSchema } from "@danypops/vehicle-core";
41
41
  import type { VehicleRegistry } from "@danypops/vehicle-server";
42
42
  import { OPERATION_NAMES, type OperationInputs, type OperationName, type OperationOutputs } from "./service.ts";
43
43
 
@@ -50,28 +50,12 @@ function hasStatus(error: unknown): error is StatusCarryingError {
50
50
  return error instanceof Error && typeof (error as { status?: unknown }).status === "number";
51
51
  }
52
52
 
53
- async function withPackedErrorParity<T>(run: () => T | Promise<T>): Promise<T> {
54
- try {
55
- return await run();
56
- } catch (error) {
57
- if (error instanceof VehicleError) throw error;
58
- if (hasStatus(error)) {
59
- const category =
60
- error.status === 403
61
- ? "authorization"
62
- : error.status === 404
63
- ? "not_found"
64
- : error.status === 400
65
- ? "validation"
66
- : error.status >= 500
67
- ? "unavailable"
68
- : "validation";
69
- throw new VehicleError("operation-rejected", error.message, { category, cause: error });
70
- }
71
- const message = error instanceof Error ? error.message : String(error);
72
- throw new VehicleError("operation-rejected", message, { category: "validation", cause: error });
73
- }
74
- }
53
+ const withPackedErrorParity = defineErrorMapping([
54
+ { matches: (error) => hasStatus(error) && error.status === 403, category: "authorization" },
55
+ { matches: (error) => hasStatus(error) && error.status === 404, category: "not_found" },
56
+ { matches: (error) => hasStatus(error) && error.status === 400, category: "validation" },
57
+ { matches: (error) => hasStatus(error) && error.status >= 500, category: "unavailable" },
58
+ ]);
75
59
 
76
60
  const OWNER = "packed";
77
61
  const LIMITS = { defaultTimeoutMs: 30_000, maxTimeoutMs: 120_000, maxRequestBytes: 65_536, maxResponseBytes: 4_194_304 };