@danypops/vehicle-core 0.19.1 → 0.19.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.
@@ -1,6 +1,6 @@
1
1
  import type { VehiclePrincipal } from "../operations/context.js";
2
2
  import type { VehicleEffect } from "../operations/effect.js";
3
- /** Set once at registry-configuration time (VehicleRegistry.configureApprovals()); never on a per-invoke basis. */
3
+ /** Secure default applied when a registry configures approvals and when an unconfigured registry diagnoses risky operations. */
4
4
  export declare const DEFAULT_APPROVAL_EFFECTS: readonly VehicleEffect[];
5
5
  /**
6
6
  * The name VehicleRegistry.configureApprovals() registers its built-in
@@ -24,8 +24,8 @@ function isVehiclePrincipal(value) {
24
24
  return true;
25
25
  return typeof candidate["claims"] === "object" && candidate["claims"] !== null && !Array.isArray(candidate["claims"]);
26
26
  }
27
- /** Set once at registry-configuration time (VehicleRegistry.configureApprovals()); never on a per-invoke basis. */
28
- export const DEFAULT_APPROVAL_EFFECTS = ["destructive", "open-world"];
27
+ /** Secure default applied when a registry configures approvals and when an unconfigured registry diagnoses risky operations. */
28
+ export const DEFAULT_APPROVAL_EFFECTS = ["destructive", "open-world", "external-write"];
29
29
  /**
30
30
  * The name VehicleRegistry.configureApprovals() registers its built-in
31
31
  * grant/deny operation under. Shared so vehicle-client-pi can recognize and
@@ -1,4 +1,5 @@
1
1
  import type { VehicleManifestEvent } from "../events/event.js";
2
+ import type { VehicleEffect } from "../operations/effect.js";
2
3
  import type { VehicleOperationDescriptor } from "../operations/operation.js";
3
4
  import type { VehicleProtocolSupport } from "../protocol/negotiation.js";
4
5
  export interface VehicleManifestIdentity {
@@ -25,8 +26,9 @@ export interface VehicleManifestOperation extends VehicleOperationDescriptor {
25
26
  * The registry's own, live, fully-resolved answer to "does invoking this operation right
26
27
  * now require approval" -- accounts for the registry's current approval policy being
27
28
  * enabled/disabled, this operation's own `requiresApproval` override when set, and the
28
- * effect-derived default otherwise. A real VehicleRegistry.manifest() always sets this
29
- * (false when the registry never called configureApprovals() at all) -- unlike
29
+ * effect-derived default otherwise. A real VehicleRegistry.manifest() always sets this;
30
+ * before configureApprovals(), risky operations report true and fail closed while the
31
+ * manifest's approvalPolicy diagnostic identifies the missing explicit decision. Unlike
30
32
  * `requiresApproval` (the static, author-declared override on the descriptor itself),
31
33
  * this always reflects the current instant, so a client re-fetching the manifest after a
32
34
  * live policy change (VehicleRegistry.updateApprovalPolicy) sees the new answer with no
@@ -40,13 +42,19 @@ export interface VehicleManifestOperation extends VehicleOperationDescriptor {
40
42
  */
41
43
  readonly approvalRequired?: boolean;
42
44
  }
45
+ /** Reports whether a registry made an explicit approval-policy decision and names risky operations that still need one. */
46
+ export interface VehicleManifestApprovalPolicy {
47
+ readonly status: "unconfigured" | "enabled" | "disabled";
48
+ readonly requireApprovalForEffects: readonly VehicleEffect[];
49
+ readonly unconfiguredRiskyOperations: readonly string[];
50
+ }
43
51
  /**
44
- * `events` is optional purely for backward compatibility with every
45
- * hand-authored VehicleManifest test fixture across the ecosystem that
46
- * predates this field -- a real VehicleRegistry.manifest() always
47
- * populates it (as [] when no events are declared), never omits it.
52
+ * `events` and `approvalPolicy` are optional for backward compatibility with
53
+ * hand-authored and older manifests. A current VehicleRegistry always emits
54
+ * both fields.
48
55
  */
49
56
  export interface VehicleManifest extends VehicleManifestIdentity {
50
57
  readonly operations: readonly VehicleManifestOperation[];
51
58
  readonly events?: readonly VehicleManifestEvent[];
59
+ readonly approvalPolicy?: VehicleManifestApprovalPolicy;
52
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/vehicle-core",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Vehicle's runtime-neutral wire contract: operation descriptors, schema codecs, failure shapes. Zero runtime dependencies, zero Bun-specific code -- the one thing every Vehicle client and server package depends on.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,8 +27,8 @@ function isVehiclePrincipal(value: unknown): value is VehiclePrincipal {
27
27
  return typeof candidate["claims"] === "object" && candidate["claims"] !== null && !Array.isArray(candidate["claims"]);
28
28
  }
29
29
 
30
- /** Set once at registry-configuration time (VehicleRegistry.configureApprovals()); never on a per-invoke basis. */
31
- export const DEFAULT_APPROVAL_EFFECTS: readonly VehicleEffect[] = ["destructive", "open-world"];
30
+ /** Secure default applied when a registry configures approvals and when an unconfigured registry diagnoses risky operations. */
31
+ export const DEFAULT_APPROVAL_EFFECTS: readonly VehicleEffect[] = ["destructive", "open-world", "external-write"];
32
32
 
33
33
  /**
34
34
  * The name VehicleRegistry.configureApprovals() registers its built-in
@@ -1,4 +1,5 @@
1
1
  import type { VehicleManifestEvent } from "../events/event.js";
2
+ import type { VehicleEffect } from "../operations/effect.js";
2
3
  import type { VehicleOperationDescriptor } from "../operations/operation.js";
3
4
  import type { VehicleProtocolSupport } from "../protocol/negotiation.js";
4
5
 
@@ -27,8 +28,9 @@ export interface VehicleManifestOperation extends VehicleOperationDescriptor {
27
28
  * The registry's own, live, fully-resolved answer to "does invoking this operation right
28
29
  * now require approval" -- accounts for the registry's current approval policy being
29
30
  * enabled/disabled, this operation's own `requiresApproval` override when set, and the
30
- * effect-derived default otherwise. A real VehicleRegistry.manifest() always sets this
31
- * (false when the registry never called configureApprovals() at all) -- unlike
31
+ * effect-derived default otherwise. A real VehicleRegistry.manifest() always sets this;
32
+ * before configureApprovals(), risky operations report true and fail closed while the
33
+ * manifest's approvalPolicy diagnostic identifies the missing explicit decision. Unlike
32
34
  * `requiresApproval` (the static, author-declared override on the descriptor itself),
33
35
  * this always reflects the current instant, so a client re-fetching the manifest after a
34
36
  * live policy change (VehicleRegistry.updateApprovalPolicy) sees the new answer with no
@@ -43,13 +45,20 @@ export interface VehicleManifestOperation extends VehicleOperationDescriptor {
43
45
  readonly approvalRequired?: boolean;
44
46
  }
45
47
 
48
+ /** Reports whether a registry made an explicit approval-policy decision and names risky operations that still need one. */
49
+ export interface VehicleManifestApprovalPolicy {
50
+ readonly status: "unconfigured" | "enabled" | "disabled";
51
+ readonly requireApprovalForEffects: readonly VehicleEffect[];
52
+ readonly unconfiguredRiskyOperations: readonly string[];
53
+ }
54
+
46
55
  /**
47
- * `events` is optional purely for backward compatibility with every
48
- * hand-authored VehicleManifest test fixture across the ecosystem that
49
- * predates this field -- a real VehicleRegistry.manifest() always
50
- * populates it (as [] when no events are declared), never omits it.
56
+ * `events` and `approvalPolicy` are optional for backward compatibility with
57
+ * hand-authored and older manifests. A current VehicleRegistry always emits
58
+ * both fields.
51
59
  */
52
60
  export interface VehicleManifest extends VehicleManifestIdentity {
53
61
  readonly operations: readonly VehicleManifestOperation[];
54
62
  readonly events?: readonly VehicleManifestEvent[];
63
+ readonly approvalPolicy?: VehicleManifestApprovalPolicy;
55
64
  }