@contractspec/lib.surface-runtime 0.5.5 → 0.5.7

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.
Files changed (59) hide show
  1. package/README.md +66 -152
  2. package/dist/adapters/dnd-kit-adapter.d.ts +0 -4
  3. package/dist/adapters/index.d.ts +2 -2
  4. package/dist/adapters/index.js +1 -1
  5. package/dist/browser/adapters/index.js +1 -1
  6. package/dist/browser/evals/golden-harness.js +1 -1
  7. package/dist/browser/i18n/catalogs/index.js +1 -1
  8. package/dist/browser/i18n/index.js +4 -4
  9. package/dist/browser/i18n/messages.js +1 -1
  10. package/dist/browser/index.js +3 -3
  11. package/dist/browser/react/BundleRenderer.js +3 -3
  12. package/dist/browser/react/index.js +4 -4
  13. package/dist/browser/runtime/index.js +42 -42
  14. package/dist/browser/runtime/resolve-bundle.js +2 -2
  15. package/dist/browser/spec/index.js +5 -5
  16. package/dist/browser/telemetry/index.js +3 -3
  17. package/dist/evals/golden-harness.d.ts +1 -2
  18. package/dist/evals/golden-harness.js +1 -1
  19. package/dist/i18n/catalogs/index.d.ts +1 -1
  20. package/dist/i18n/catalogs/index.js +1 -1
  21. package/dist/i18n/index.d.ts +4 -4
  22. package/dist/i18n/index.js +4 -4
  23. package/dist/i18n/messages.js +1 -1
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.js +3 -3
  26. package/dist/node/adapters/index.js +1 -1
  27. package/dist/node/evals/golden-harness.js +1 -1
  28. package/dist/node/i18n/catalogs/index.js +1 -1
  29. package/dist/node/i18n/index.js +4 -4
  30. package/dist/node/i18n/messages.js +1 -1
  31. package/dist/node/index.js +3 -3
  32. package/dist/node/react/BundleRenderer.js +3 -3
  33. package/dist/node/react/index.js +4 -4
  34. package/dist/node/runtime/index.js +42 -42
  35. package/dist/node/runtime/resolve-bundle.js +2 -2
  36. package/dist/node/spec/index.js +5 -5
  37. package/dist/node/telemetry/index.js +3 -3
  38. package/dist/react/BundleRenderer.js +3 -3
  39. package/dist/react/RegionRenderer.d.ts +1 -1
  40. package/dist/react/SlotRenderer.d.ts +1 -1
  41. package/dist/react/index.d.ts +3 -3
  42. package/dist/react/index.js +4 -4
  43. package/dist/runtime/apply-surface-patch.d.ts +1 -1
  44. package/dist/runtime/build-context.d.ts +1 -1
  45. package/dist/runtime/extension-registry.d.ts +2 -3
  46. package/dist/runtime/index.d.ts +13 -13
  47. package/dist/runtime/index.js +42 -42
  48. package/dist/runtime/overlay-alignment.d.ts +2 -2
  49. package/dist/runtime/planner-prompt.d.ts +1 -2
  50. package/dist/runtime/policy-eval.d.ts +2 -2
  51. package/dist/runtime/resolve-bundle.d.ts +1 -1
  52. package/dist/runtime/resolve-bundle.js +2 -2
  53. package/dist/runtime/rollback.d.ts +1 -1
  54. package/dist/spec/index.d.ts +3 -3
  55. package/dist/spec/index.js +5 -5
  56. package/dist/spec/validate-surface-patch.d.ts +1 -1
  57. package/dist/telemetry/index.d.ts +1 -1
  58. package/dist/telemetry/index.js +3 -3
  59. package/package.json +8 -8
@@ -2,8 +2,8 @@ import {
2
2
  createI18nFactory
3
3
  } from "@contractspec/lib.contracts-spec/translations";
4
4
  import { enMessages } from "./catalogs/en";
5
- import { frMessages } from "./catalogs/fr";
6
5
  import { esMessages } from "./catalogs/es";
6
+ import { frMessages } from "./catalogs/fr";
7
7
  const factory = createI18nFactory({
8
8
  specKey: "surface-runtime.messages",
9
9
  catalogs: [enMessages, frMessages, esMessages]
@@ -1,4 +1,4 @@
1
- export * from "./spec";
2
- export * from "./runtime";
3
- export * from "./react";
4
1
  export * from "./adapters";
2
+ export * from "./react";
3
+ export * from "./runtime";
4
+ export * from "./spec";
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsxDEV as jsxDEV_7x81h0kn, Fragment as Fragment_8vg9x3sq } from "react/jsx-dev-runtime";
3
+ import { motionAdapterStub } from "../adapters/motion-stub";
3
4
  import { useBundlePlan } from "./BundleProvider";
5
+ import { OverlayConflictResolver } from "./OverlayConflictResolver";
6
+ import { PatchProposalCard } from "./PatchProposalCard";
4
7
  import { RegionRenderer } from "./RegionRenderer";
5
8
  import { SlotRenderer } from "./SlotRenderer";
6
- import { PatchProposalCard } from "./PatchProposalCard";
7
- import { OverlayConflictResolver } from "./OverlayConflictResolver";
8
- import { motionAdapterStub } from "../adapters/motion-stub";
9
9
  export function BundleRenderer({
10
10
  assistantSlotId,
11
11
  assistantSlotContent,
@@ -5,12 +5,12 @@ export {
5
5
  useIsEditing
6
6
  } from "./BundleProvider";
7
7
  export { BundleRenderer } from "./BundleRenderer";
8
- export {
9
- PatchProposalCard
10
- } from "./PatchProposalCard";
11
- export { WidgetPalette } from "./WidgetPalette";
12
8
  export {
13
9
  OverlayConflictResolver
14
10
  } from "./OverlayConflictResolver";
11
+ export {
12
+ PatchProposalCard
13
+ } from "./PatchProposalCard";
15
14
  export { RegionRenderer } from "./RegionRenderer";
16
15
  export { SlotRenderer } from "./SlotRenderer";
16
+ export { WidgetPalette } from "./WidgetPalette";
@@ -1,63 +1,63 @@
1
- export { buildContext } from "./build-context";
2
- export { resolvePreferenceProfile } from "./resolve-preferences";
3
- export { defaultPreferenceAdapter } from "./preference-adapter";
4
- export {
5
- resolveBundle
6
- } from "./resolve-bundle";
7
1
  export {
8
2
  applySurfacePatch
9
3
  } from "./apply-surface-patch";
10
4
  export {
11
- compilePlannerPrompt
12
- } from "./planner-prompt";
5
+ emitOverlayApplied,
6
+ emitOverlayFailed,
7
+ emitOverlaySaved,
8
+ emitPatchApproved,
9
+ emitPatchProposed,
10
+ emitPatchRejected,
11
+ emitPolicyDenied,
12
+ emitPolicyRedacted
13
+ } from "./audit-events";
14
+ export { buildContext } from "./build-context";
13
15
  export {
14
- proposePatchToolConfig,
15
- PROPOSE_PATCH_TOOL_SCHEMA,
16
- buildSurfacePatchProposal
17
- } from "./planner-tools";
16
+ createActionRegistry,
17
+ createBundleExtensionRegistry,
18
+ createCommandRegistry
19
+ } from "./extension-registry";
18
20
  export {
19
21
  createFieldRendererRegistry,
20
22
  createMutableFieldRendererRegistry,
21
23
  FALLBACK_FIELD_KIND
22
24
  } from "./field-renderer-registry";
23
25
  export {
24
- createWidgetRegistry
25
- } from "./widget-registry";
26
- export {
27
- createActionRegistry,
28
- createCommandRegistry,
29
- createBundleExtensionRegistry
30
- } from "./extension-registry";
31
- export {
32
- createInMemoryOverrideStore,
33
- createOverrideStoreWithApprovalGate,
34
- buildOverrideTargetKey
35
- } from "./override-store";
36
- export {
37
- toOverlayScopeContext,
38
- toOverlayTargetRef,
39
- toOverlayRenderableField,
26
+ applyEntityFieldOverlays,
40
27
  fromOverlayRenderableField,
41
- toOverlayRenderable,
42
28
  mergeOverlayResultIntoFields,
43
- applyEntityFieldOverlays
29
+ toOverlayRenderable,
30
+ toOverlayRenderableField,
31
+ toOverlayScopeContext,
32
+ toOverlayTargetRef
44
33
  } from "./overlay-alignment";
45
34
  export {
46
35
  signWorkspaceOverlay,
47
36
  verifyWorkspaceOverlay
48
37
  } from "./overlay-signer";
49
38
  export {
50
- emitPatchProposed,
51
- emitPatchApproved,
52
- emitPatchRejected,
53
- emitOverlaySaved,
54
- emitOverlayApplied,
55
- emitOverlayFailed,
56
- emitPolicyDenied,
57
- emitPolicyRedacted
58
- } from "./audit-events";
59
- export { rollbackSurfacePatches } from "./rollback";
39
+ buildOverrideTargetKey,
40
+ createInMemoryOverrideStore,
41
+ createOverrideStoreWithApprovalGate
42
+ } from "./override-store";
43
+ export {
44
+ compilePlannerPrompt
45
+ } from "./planner-prompt";
60
46
  export {
61
- evaluatePatchProposalPolicy,
62
- evaluateAndEmitPatchPolicy
47
+ buildSurfacePatchProposal,
48
+ PROPOSE_PATCH_TOOL_SCHEMA,
49
+ proposePatchToolConfig
50
+ } from "./planner-tools";
51
+ export {
52
+ evaluateAndEmitPatchPolicy,
53
+ evaluatePatchProposalPolicy
63
54
  } from "./policy-eval";
55
+ export { defaultPreferenceAdapter } from "./preference-adapter";
56
+ export {
57
+ resolveBundle
58
+ } from "./resolve-bundle";
59
+ export { resolvePreferenceProfile } from "./resolve-preferences";
60
+ export { rollbackSurfacePatches } from "./rollback";
61
+ export {
62
+ createWidgetRegistry
63
+ } from "./widget-registry";
@@ -1,9 +1,9 @@
1
- import { traceAsync } from "@contractspec/lib.observability/tracing";
2
1
  import { Logger } from "@contractspec/lib.observability";
2
+ import { traceAsync } from "@contractspec/lib.observability/tracing";
3
3
  import { resolutionDurationMs, surfaceFallbackCounter } from "../telemetry";
4
- import { resolvePreferenceProfile } from "./resolve-preferences";
5
4
  import { applySurfacePatch } from "./apply-surface-patch";
6
5
  import { buildOverrideTargetKey } from "./override-store";
6
+ import { resolvePreferenceProfile } from "./resolve-preferences";
7
7
  const logger = new Logger("@contractspec/lib.surface-runtime");
8
8
  function getOpTarget(op) {
9
9
  switch (op.op) {
@@ -1,11 +1,11 @@
1
- export * from "./types";
2
1
  export { defineModuleBundle } from "./define-module-bundle";
2
+ export * from "./types";
3
3
  export {
4
- validateLayoutSlots,
5
- validateBundleNodeKinds
4
+ validateBundleNodeKinds,
5
+ validateLayoutSlots
6
6
  } from "./validate-bundle";
7
7
  export {
8
+ validatePatchProposal,
8
9
  validateSurfacePatch,
9
- validateSurfacePatchOp,
10
- validatePatchProposal
10
+ validateSurfacePatchOp
11
11
  } from "./validate-surface-patch";
@@ -1,8 +1,8 @@
1
1
  export {
2
- resolutionDurationMs,
2
+ missingRendererCounter,
3
3
  patchAcceptanceCounter,
4
4
  patchRejectionCounter,
5
5
  policyDenialCounter,
6
- surfaceFallbackCounter,
7
- missingRendererCounter
6
+ resolutionDurationMs,
7
+ surfaceFallbackCounter
8
8
  } from "./surface-metrics";
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsxDEV as jsxDEV_7x81h0kn, Fragment as Fragment_8vg9x3sq } from "react/jsx-dev-runtime";
3
+ import { motionAdapterStub } from "../adapters/motion-stub";
3
4
  import { useBundlePlan } from "./BundleProvider";
5
+ import { OverlayConflictResolver } from "./OverlayConflictResolver";
6
+ import { PatchProposalCard } from "./PatchProposalCard";
4
7
  import { RegionRenderer } from "./RegionRenderer";
5
8
  import { SlotRenderer } from "./SlotRenderer";
6
- import { PatchProposalCard } from "./PatchProposalCard";
7
- import { OverlayConflictResolver } from "./OverlayConflictResolver";
8
- import { motionAdapterStub } from "../adapters/motion-stub";
9
9
  export function BundleRenderer({
10
10
  assistantSlotId,
11
11
  assistantSlotContent,
@@ -3,8 +3,8 @@
3
3
  * Delegates panel-group to adapter; handles stack, tabs, slot, floating.
4
4
  */
5
5
  import React from 'react';
6
- import type { RegionNode } from '../spec/types';
7
6
  import type { RenderContext } from '../adapters/interfaces';
7
+ import type { RegionNode } from '../spec/types';
8
8
  export interface RegionRendererProps {
9
9
  region: RegionNode;
10
10
  ctx: RenderContext;
@@ -2,8 +2,8 @@
2
2
  * Renders content for a slot. Maps plan.nodes to slot by sourceBinding/slot assignment.
3
3
  * Phase 2: Renders nodes that belong to this slot; placeholder when empty.
4
4
  */
5
- import type { SurfaceNode } from '../spec/types';
6
5
  import type { RenderContext } from '../adapters/interfaces';
6
+ import type { SurfaceNode } from '../spec/types';
7
7
  export interface SlotRendererProps {
8
8
  slotId: string;
9
9
  ctx: RenderContext;
@@ -1,7 +1,7 @@
1
- export { BundleProvider, useBundlePlan, useBundlePreferences, useIsEditing, type BundleProviderProps, } from './BundleProvider';
1
+ export { BundleProvider, type BundleProviderProps, useBundlePlan, useBundlePreferences, useIsEditing, } from './BundleProvider';
2
2
  export { BundleRenderer, type BundleRendererProps } from './BundleRenderer';
3
- export { PatchProposalCard, type PatchProposalCardProps, } from './PatchProposalCard';
4
- export { WidgetPalette, type WidgetPaletteProps } from './WidgetPalette';
5
3
  export { OverlayConflictResolver, type OverlayConflictResolverProps, } from './OverlayConflictResolver';
4
+ export { PatchProposalCard, type PatchProposalCardProps, } from './PatchProposalCard';
6
5
  export { RegionRenderer, type RegionRendererProps } from './RegionRenderer';
7
6
  export { SlotRenderer, type SlotRendererProps } from './SlotRenderer';
7
+ export { WidgetPalette, type WidgetPaletteProps } from './WidgetPalette';
@@ -5,12 +5,12 @@ export {
5
5
  useIsEditing
6
6
  } from "./BundleProvider";
7
7
  export { BundleRenderer } from "./BundleRenderer";
8
- export {
9
- PatchProposalCard
10
- } from "./PatchProposalCard";
11
- export { WidgetPalette } from "./WidgetPalette";
12
8
  export {
13
9
  OverlayConflictResolver
14
10
  } from "./OverlayConflictResolver";
11
+ export {
12
+ PatchProposalCard
13
+ } from "./PatchProposalCard";
15
14
  export { RegionRenderer } from "./RegionRenderer";
16
15
  export { SlotRenderer } from "./SlotRenderer";
16
+ export { WidgetPalette } from "./WidgetPalette";
@@ -1,5 +1,5 @@
1
- import type { ResolvedSurfacePlan } from './resolve-bundle';
2
1
  import type { SurfacePatchOp } from '../spec/types';
2
+ import type { ResolvedSurfacePlan } from './resolve-bundle';
3
3
  export interface ApplySurfacePatchResult {
4
4
  plan: ResolvedSurfacePlan;
5
5
  inverseOps: SurfacePatchOp[];
@@ -1,4 +1,4 @@
1
- import type { BundleContext, BuildContextParams } from '../spec/types';
1
+ import type { BuildContextParams, BundleContext } from '../spec/types';
2
2
  /**
3
3
  * Builds a full BundleContext from minimal request params.
4
4
  * Missing fields use sensible defaults for resolution.
@@ -4,10 +4,9 @@
4
4
  *
5
5
  * BundleExtensionRegistry: registerWidget, registerFieldRenderer, registerAction, registerCommand.
6
6
  */
7
- import type { ActionSpec, CommandSpec } from '../spec/types';
8
- import type { WidgetRegistryEntry } from './widget-registry';
9
- import type { FieldRendererSpec } from '../spec/types';
7
+ import type { ActionSpec, CommandSpec, FieldRendererSpec } from '../spec/types';
10
8
  import type { MutableFieldRendererRegistry } from './field-renderer-registry';
9
+ import type { WidgetRegistryEntry } from './widget-registry';
11
10
  export interface BundleExtensionRegistry {
12
11
  registerWidget(entry: WidgetRegistryEntry): void;
13
12
  registerFieldRenderer(kind: string, entry: FieldRendererSpec): void;
@@ -1,16 +1,16 @@
1
+ export { type ApplySurfacePatchResult, applySurfacePatch, } from './apply-surface-patch';
2
+ export { emitOverlayApplied, emitOverlayFailed, emitOverlaySaved, emitPatchApproved, emitPatchProposed, emitPatchRejected, emitPolicyDenied, emitPolicyRedacted, } from './audit-events';
1
3
  export { buildContext } from './build-context';
2
- export { resolvePreferenceProfile } from './resolve-preferences';
3
- export { defaultPreferenceAdapter } from './preference-adapter';
4
- export { resolveBundle, type PolicyHooks, type ResolveBundleOptions, type OverlayMergeOptions, type OverlayConflict, type ResolvedSurfacePlan, } from './resolve-bundle';
5
- export { applySurfacePatch, type ApplySurfacePatchResult, } from './apply-surface-patch';
6
- export { compilePlannerPrompt, type PlannerPromptInput, } from './planner-prompt';
7
- export { proposePatchToolConfig, PROPOSE_PATCH_TOOL_SCHEMA, buildSurfacePatchProposal, type PlannerToolConfig, } from './planner-tools';
4
+ export { type ActionRegistry, type BundleExtensionRegistry, type CommandRegistry, createActionRegistry, createBundleExtensionRegistry, createCommandRegistry, } from './extension-registry';
8
5
  export { createFieldRendererRegistry, createMutableFieldRendererRegistry, FALLBACK_FIELD_KIND, type FieldRendererRegistry, type MutableFieldRendererRegistry, } from './field-renderer-registry';
6
+ export { applyEntityFieldOverlays, fromOverlayRenderableField, mergeOverlayResultIntoFields, type SurfaceOverlayTargetRef, toOverlayRenderable, toOverlayRenderableField, toOverlayScopeContext, toOverlayTargetRef, } from './overlay-alignment';
7
+ export { type OverlaySigningKey, signWorkspaceOverlay, verifyWorkspaceOverlay, } from './overlay-signer';
8
+ export { type ApprovalGateOptions, type BundleOverrideStore, buildOverrideTargetKey, createInMemoryOverrideStore, createOverrideStoreWithApprovalGate, type StoredOverride, } from './override-store';
9
+ export { compilePlannerPrompt, type PlannerPromptInput, } from './planner-prompt';
10
+ export { buildSurfacePatchProposal, type PlannerToolConfig, PROPOSE_PATCH_TOOL_SCHEMA, proposePatchToolConfig, } from './planner-tools';
11
+ export { evaluateAndEmitPatchPolicy, evaluatePatchProposalPolicy, } from './policy-eval';
12
+ export { defaultPreferenceAdapter } from './preference-adapter';
13
+ export { type OverlayConflict, type OverlayMergeOptions, type PolicyHooks, type ResolveBundleOptions, type ResolvedSurfacePlan, resolveBundle, } from './resolve-bundle';
14
+ export { resolvePreferenceProfile } from './resolve-preferences';
15
+ export { type RollbackResult, rollbackSurfacePatches } from './rollback';
9
16
  export { createWidgetRegistry, type WidgetRegistry, type WidgetRegistryEntry, type WidgetTrust, } from './widget-registry';
10
- export { createActionRegistry, createCommandRegistry, createBundleExtensionRegistry, type ActionRegistry, type CommandRegistry, type BundleExtensionRegistry, } from './extension-registry';
11
- export { createInMemoryOverrideStore, createOverrideStoreWithApprovalGate, buildOverrideTargetKey, type BundleOverrideStore, type StoredOverride, type ApprovalGateOptions, } from './override-store';
12
- export { toOverlayScopeContext, toOverlayTargetRef, toOverlayRenderableField, fromOverlayRenderableField, toOverlayRenderable, mergeOverlayResultIntoFields, applyEntityFieldOverlays, type SurfaceOverlayTargetRef, } from './overlay-alignment';
13
- export { signWorkspaceOverlay, verifyWorkspaceOverlay, type OverlaySigningKey, } from './overlay-signer';
14
- export { emitPatchProposed, emitPatchApproved, emitPatchRejected, emitOverlaySaved, emitOverlayApplied, emitOverlayFailed, emitPolicyDenied, emitPolicyRedacted, } from './audit-events';
15
- export { rollbackSurfacePatches, type RollbackResult } from './rollback';
16
- export { evaluatePatchProposalPolicy, evaluateAndEmitPatchPolicy, } from './policy-eval';
@@ -1,63 +1,63 @@
1
- export { buildContext } from "./build-context";
2
- export { resolvePreferenceProfile } from "./resolve-preferences";
3
- export { defaultPreferenceAdapter } from "./preference-adapter";
4
- export {
5
- resolveBundle
6
- } from "./resolve-bundle";
7
1
  export {
8
2
  applySurfacePatch
9
3
  } from "./apply-surface-patch";
10
4
  export {
11
- compilePlannerPrompt
12
- } from "./planner-prompt";
5
+ emitOverlayApplied,
6
+ emitOverlayFailed,
7
+ emitOverlaySaved,
8
+ emitPatchApproved,
9
+ emitPatchProposed,
10
+ emitPatchRejected,
11
+ emitPolicyDenied,
12
+ emitPolicyRedacted
13
+ } from "./audit-events";
14
+ export { buildContext } from "./build-context";
13
15
  export {
14
- proposePatchToolConfig,
15
- PROPOSE_PATCH_TOOL_SCHEMA,
16
- buildSurfacePatchProposal
17
- } from "./planner-tools";
16
+ createActionRegistry,
17
+ createBundleExtensionRegistry,
18
+ createCommandRegistry
19
+ } from "./extension-registry";
18
20
  export {
19
21
  createFieldRendererRegistry,
20
22
  createMutableFieldRendererRegistry,
21
23
  FALLBACK_FIELD_KIND
22
24
  } from "./field-renderer-registry";
23
25
  export {
24
- createWidgetRegistry
25
- } from "./widget-registry";
26
- export {
27
- createActionRegistry,
28
- createCommandRegistry,
29
- createBundleExtensionRegistry
30
- } from "./extension-registry";
31
- export {
32
- createInMemoryOverrideStore,
33
- createOverrideStoreWithApprovalGate,
34
- buildOverrideTargetKey
35
- } from "./override-store";
36
- export {
37
- toOverlayScopeContext,
38
- toOverlayTargetRef,
39
- toOverlayRenderableField,
26
+ applyEntityFieldOverlays,
40
27
  fromOverlayRenderableField,
41
- toOverlayRenderable,
42
28
  mergeOverlayResultIntoFields,
43
- applyEntityFieldOverlays
29
+ toOverlayRenderable,
30
+ toOverlayRenderableField,
31
+ toOverlayScopeContext,
32
+ toOverlayTargetRef
44
33
  } from "./overlay-alignment";
45
34
  export {
46
35
  signWorkspaceOverlay,
47
36
  verifyWorkspaceOverlay
48
37
  } from "./overlay-signer";
49
38
  export {
50
- emitPatchProposed,
51
- emitPatchApproved,
52
- emitPatchRejected,
53
- emitOverlaySaved,
54
- emitOverlayApplied,
55
- emitOverlayFailed,
56
- emitPolicyDenied,
57
- emitPolicyRedacted
58
- } from "./audit-events";
59
- export { rollbackSurfacePatches } from "./rollback";
39
+ buildOverrideTargetKey,
40
+ createInMemoryOverrideStore,
41
+ createOverrideStoreWithApprovalGate
42
+ } from "./override-store";
43
+ export {
44
+ compilePlannerPrompt
45
+ } from "./planner-prompt";
60
46
  export {
61
- evaluatePatchProposalPolicy,
62
- evaluateAndEmitPatchPolicy
47
+ buildSurfacePatchProposal,
48
+ PROPOSE_PATCH_TOOL_SCHEMA,
49
+ proposePatchToolConfig
50
+ } from "./planner-tools";
51
+ export {
52
+ evaluateAndEmitPatchPolicy,
53
+ evaluatePatchProposalPolicy
63
54
  } from "./policy-eval";
55
+ export { defaultPreferenceAdapter } from "./preference-adapter";
56
+ export {
57
+ resolveBundle
58
+ } from "./resolve-bundle";
59
+ export { resolvePreferenceProfile } from "./resolve-preferences";
60
+ export { rollbackSurfacePatches } from "./rollback";
61
+ export {
62
+ createWidgetRegistry
63
+ } from "./widget-registry";
@@ -6,9 +6,9 @@
6
6
  * OverlayRenderableField: key, label, visible, required, helpText, defaultValue, order.
7
7
  * OverlayScopeContext: tenantId, role, userId, device, tags.
8
8
  */
9
- import type { OverlayTargetRef, OverlayScopeContext, OverlayAppliesTo, SignedOverlaySpec } from '@contractspec/lib.overlay-engine/spec';
9
+ import type { OverlayAppliesTo, OverlayScopeContext, OverlayTargetRef, SignedOverlaySpec } from '@contractspec/lib.overlay-engine/spec';
10
10
  import type { OverlayRenderableField } from '@contractspec/lib.overlay-engine/types';
11
- import type { BundleContext, ResolvedField, BundleScope } from '../spec/types';
11
+ import type { BundleContext, BundleScope, ResolvedField } from '../spec/types';
12
12
  /** Surface-specific target ref extensions for overlay matching. */
13
13
  export interface SurfaceOverlayTargetRef extends OverlayTargetRef {
14
14
  /** Bundle key (e.g. "workspace.pm"). */
@@ -3,8 +3,7 @@
3
3
  * Compiles bundle metadata, allowed ops, slots, and node kinds into a system prompt.
4
4
  * Aligns with 07_ai_native_chat_and_generative_ui.md.
5
5
  */
6
- import type { BundleMeta, BundleNodeKind, PreferenceDimensions, SurfacePatchOp } from '../spec/types';
7
- import type { ActionSpec } from '../spec/types';
6
+ import type { ActionSpec, BundleMeta, BundleNodeKind, PreferenceDimensions, SurfacePatchOp } from '../spec/types';
8
7
  export interface PlannerPromptInput {
9
8
  /** Bundle metadata. */
10
9
  bundleMeta: BundleMeta;
@@ -2,8 +2,8 @@
2
2
  * Policy evaluation helpers for patch proposals.
3
3
  * Gate patch application with PDP; emit policy.denied when blocked.
4
4
  */
5
- import type { BundleContext, SurfacePatchOp, BundleAuditEmitter } from '../spec/types';
6
- import type { PolicyHooks, PatchPolicyEffect } from './resolve-bundle';
5
+ import type { BundleAuditEmitter, BundleContext, SurfacePatchOp } from '../spec/types';
6
+ import type { PatchPolicyEffect, PolicyHooks } from './resolve-bundle';
7
7
  /**
8
8
  * Evaluates a patch proposal with policy hooks.
9
9
  * Returns allow | deny | require-approval.
@@ -1,4 +1,4 @@
1
- import type { ActionSpec, AppliedOverlayMeta, BundleContext, BundleScope, CommandSpec, ModuleBundleSpec, RegionNode, ResolvedAdaptation, SurfaceNode, SurfacePatchProposal, UiPolicyDecision, BundleAuditEmitter } from '../spec/types';
1
+ import type { ActionSpec, AppliedOverlayMeta, BundleAuditEmitter, BundleContext, BundleScope, CommandSpec, ModuleBundleSpec, RegionNode, ResolvedAdaptation, SurfaceNode, SurfacePatchProposal, UiPolicyDecision } from '../spec/types';
2
2
  import type { BundleOverrideStore } from './override-store';
3
3
  export interface OverlayConflict {
4
4
  targetKey: string;
@@ -1,9 +1,9 @@
1
- import { traceAsync } from "@contractspec/lib.observability/tracing";
2
1
  import { Logger } from "@contractspec/lib.observability";
2
+ import { traceAsync } from "@contractspec/lib.observability/tracing";
3
3
  import { resolutionDurationMs, surfaceFallbackCounter } from "../telemetry";
4
- import { resolvePreferenceProfile } from "./resolve-preferences";
5
4
  import { applySurfacePatch } from "./apply-surface-patch";
6
5
  import { buildOverrideTargetKey } from "./override-store";
6
+ import { resolvePreferenceProfile } from "./resolve-preferences";
7
7
  const logger = new Logger("@contractspec/lib.surface-runtime");
8
8
  function getOpTarget(op) {
9
9
  switch (op.op) {
@@ -2,8 +2,8 @@
2
2
  * Rollback API for surface patches.
3
3
  * Reverts last N approved patches by applying their inverse ops.
4
4
  */
5
- import type { ResolvedSurfacePlan } from './resolve-bundle';
6
5
  import type { OverlayApprovalMeta } from '../spec/types';
6
+ import type { ResolvedSurfacePlan } from './resolve-bundle';
7
7
  export interface RollbackResult {
8
8
  plan: ResolvedSurfacePlan;
9
9
  revertedCount: number;
@@ -1,5 +1,5 @@
1
- export * from './types';
2
1
  export { defineModuleBundle } from './define-module-bundle';
2
+ export * from './types';
3
+ export { type ValidateNodeKindsResult, validateBundleNodeKinds, validateLayoutSlots, } from './validate-bundle';
4
+ export { type PatchProposalConstraints, validatePatchProposal, validateSurfacePatch, validateSurfacePatchOp, } from './validate-surface-patch';
3
5
  export type { VerificationSnapshotInput, VerificationSnapshotSummary, } from './verification-snapshot-types';
4
- export { validateLayoutSlots, validateBundleNodeKinds, type ValidateNodeKindsResult, } from './validate-bundle';
5
- export { validateSurfacePatch, validateSurfacePatchOp, validatePatchProposal, type PatchProposalConstraints, } from './validate-surface-patch';
@@ -1,11 +1,11 @@
1
- export * from "./types";
2
1
  export { defineModuleBundle } from "./define-module-bundle";
2
+ export * from "./types";
3
3
  export {
4
- validateLayoutSlots,
5
- validateBundleNodeKinds
4
+ validateBundleNodeKinds,
5
+ validateLayoutSlots
6
6
  } from "./validate-bundle";
7
7
  export {
8
+ validatePatchProposal,
8
9
  validateSurfacePatch,
9
- validateSurfacePatchOp,
10
- validatePatchProposal
10
+ validateSurfacePatchOp
11
11
  } from "./validate-surface-patch";
@@ -1,4 +1,4 @@
1
- import type { SurfacePatchOp, BundleNodeKind } from './types';
1
+ import type { BundleNodeKind, SurfacePatchOp } from './types';
2
2
  /**
3
3
  * Validates a single patch op schema. Throws on invalid shape.
4
4
  * Reversibility: per spec Rule 4, each op has an inverse:
@@ -2,4 +2,4 @@
2
2
  * Surface runtime telemetry: tracing, metrics, structured logging.
3
3
  * No PII in logs or metric attributes.
4
4
  */
5
- export { resolutionDurationMs, patchAcceptanceCounter, patchRejectionCounter, policyDenialCounter, surfaceFallbackCounter, missingRendererCounter, } from './surface-metrics';
5
+ export { missingRendererCounter, patchAcceptanceCounter, patchRejectionCounter, policyDenialCounter, resolutionDurationMs, surfaceFallbackCounter, } from './surface-metrics';
@@ -1,8 +1,8 @@
1
1
  export {
2
- resolutionDurationMs,
2
+ missingRendererCounter,
3
3
  patchAcceptanceCounter,
4
4
  patchRejectionCounter,
5
5
  policyDenialCounter,
6
- surfaceFallbackCounter,
7
- missingRendererCounter
6
+ resolutionDurationMs,
7
+ surfaceFallbackCounter
8
8
  } from "./surface-metrics";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/lib.surface-runtime",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "AI-native surface specs and web runtime for adaptive ContractSpec surfaces",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -26,8 +26,8 @@
26
26
  "dev": "contractspec-bun-build dev",
27
27
  "clean": "rimraf dist .turbo",
28
28
  "lint": "bun lint:fix",
29
- "lint:fix": "eslint src --fix",
30
- "lint:check": "eslint src",
29
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
30
+ "lint:check": "biome check .",
31
31
  "lint:adapters": "node scripts/lint-adapters.mjs",
32
32
  "test": "bun test --pass-with-no-tests",
33
33
  "test:evals": "bun test src/evals/",
@@ -35,9 +35,9 @@
35
35
  "typecheck": "tsc --noEmit"
36
36
  },
37
37
  "dependencies": {
38
- "@contractspec/lib.contracts-spec": "3.7.5",
39
- "@contractspec/lib.overlay-engine": "3.7.5",
40
- "@contractspec/lib.observability": "3.7.5",
38
+ "@contractspec/lib.contracts-spec": "4.0.0",
39
+ "@contractspec/lib.overlay-engine": "3.7.7",
40
+ "@contractspec/lib.observability": "3.7.7",
41
41
  "zod": "^4.3.5"
42
42
  },
43
43
  "peerDependencies": {
@@ -57,10 +57,10 @@
57
57
  }
58
58
  },
59
59
  "devDependencies": {
60
- "@contractspec/tool.typescript": "3.7.5",
60
+ "@contractspec/tool.typescript": "3.7.6",
61
61
  "@dnd-kit/core": "^6.3.1",
62
62
  "typescript": "^5.9.3",
63
- "@contractspec/tool.bun": "3.7.5"
63
+ "@contractspec/tool.bun": "3.7.6"
64
64
  },
65
65
  "exports": {
66
66
  ".": {