@agentplat/mesh 0.3.0-beta.2 → 0.3.0-beta.3

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 (92) hide show
  1. package/README.md +133 -4
  2. package/dist/adaptive-overlay-contracts.d.ts +149 -0
  3. package/dist/adaptive-overlay-contracts.d.ts.map +1 -0
  4. package/dist/adaptive-overlay-contracts.js +3 -0
  5. package/dist/adaptive-overlay-contracts.js.map +1 -0
  6. package/dist/adaptive-overlay-runtime.d.ts +67 -0
  7. package/dist/adaptive-overlay-runtime.d.ts.map +1 -0
  8. package/dist/adaptive-overlay-runtime.js +427 -0
  9. package/dist/adaptive-overlay-runtime.js.map +1 -0
  10. package/dist/adaptive-overlay-validation.d.ts +19 -0
  11. package/dist/adaptive-overlay-validation.d.ts.map +1 -0
  12. package/dist/adaptive-overlay-validation.js +326 -0
  13. package/dist/adaptive-overlay-validation.js.map +1 -0
  14. package/dist/adaptive-overlay.d.ts +4 -0
  15. package/dist/adaptive-overlay.d.ts.map +1 -0
  16. package/dist/adaptive-overlay.js +4 -0
  17. package/dist/adaptive-overlay.js.map +1 -0
  18. package/dist/authenticated-overlay-transport.d.ts +227 -0
  19. package/dist/authenticated-overlay-transport.d.ts.map +1 -0
  20. package/dist/authenticated-overlay-transport.js +702 -0
  21. package/dist/authenticated-overlay-transport.js.map +1 -0
  22. package/dist/authority-continuity-contracts.d.ts +249 -0
  23. package/dist/authority-continuity-contracts.d.ts.map +1 -0
  24. package/dist/authority-continuity-contracts.js +11 -0
  25. package/dist/authority-continuity-contracts.js.map +1 -0
  26. package/dist/authority-continuity.d.ts +43 -0
  27. package/dist/authority-continuity.d.ts.map +1 -0
  28. package/dist/authority-continuity.js +1338 -0
  29. package/dist/authority-continuity.js.map +1 -0
  30. package/dist/continuity.d.ts +3 -0
  31. package/dist/continuity.d.ts.map +1 -0
  32. package/dist/continuity.js +3 -0
  33. package/dist/continuity.js.map +1 -0
  34. package/dist/coordination-allocation-contracts.d.ts +6 -0
  35. package/dist/coordination-allocation-contracts.d.ts.map +1 -1
  36. package/dist/coordination-allocation-state.d.ts.map +1 -1
  37. package/dist/coordination-allocation-state.js +37 -7
  38. package/dist/coordination-allocation-state.js.map +1 -1
  39. package/dist/coordination-allocation.d.ts +1 -1
  40. package/dist/coordination-allocation.d.ts.map +1 -1
  41. package/dist/coordination-allocation.js +92 -11
  42. package/dist/coordination-allocation.js.map +1 -1
  43. package/dist/coordination-discovery-state.d.ts.map +1 -1
  44. package/dist/coordination-discovery-state.js +5 -3
  45. package/dist/coordination-discovery-state.js.map +1 -1
  46. package/dist/coordination-recovery.js +5 -1
  47. package/dist/coordination-recovery.js.map +1 -1
  48. package/dist/durability.d.ts +22 -0
  49. package/dist/durability.d.ts.map +1 -1
  50. package/dist/durability.js +22 -0
  51. package/dist/durability.js.map +1 -1
  52. package/dist/overlay-transport.d.ts +7 -0
  53. package/dist/overlay-transport.d.ts.map +1 -0
  54. package/dist/overlay-transport.js +7 -0
  55. package/dist/overlay-transport.js.map +1 -0
  56. package/dist/overlay.d.ts +9 -0
  57. package/dist/overlay.d.ts.map +1 -0
  58. package/dist/overlay.js +9 -0
  59. package/dist/overlay.js.map +1 -0
  60. package/dist/sparse-overlay-contracts.d.ts +91 -0
  61. package/dist/sparse-overlay-contracts.d.ts.map +1 -0
  62. package/dist/sparse-overlay-contracts.js +2 -0
  63. package/dist/sparse-overlay-contracts.js.map +1 -0
  64. package/dist/sparse-overlay-durability.d.ts +23 -0
  65. package/dist/sparse-overlay-durability.d.ts.map +1 -0
  66. package/dist/sparse-overlay-durability.js +97 -0
  67. package/dist/sparse-overlay-durability.js.map +1 -0
  68. package/dist/sparse-overlay-runtime-contracts.d.ts +158 -0
  69. package/dist/sparse-overlay-runtime-contracts.d.ts.map +1 -0
  70. package/dist/sparse-overlay-runtime-contracts.js +2 -0
  71. package/dist/sparse-overlay-runtime-contracts.js.map +1 -0
  72. package/dist/sparse-overlay-runtime.d.ts +48 -0
  73. package/dist/sparse-overlay-runtime.d.ts.map +1 -0
  74. package/dist/sparse-overlay-runtime.js +763 -0
  75. package/dist/sparse-overlay-runtime.js.map +1 -0
  76. package/dist/sparse-overlay-transport-contracts.d.ts +183 -0
  77. package/dist/sparse-overlay-transport-contracts.d.ts.map +1 -0
  78. package/dist/sparse-overlay-transport-contracts.js +2 -0
  79. package/dist/sparse-overlay-transport-contracts.js.map +1 -0
  80. package/dist/sparse-overlay-transport-durability.d.ts +19 -0
  81. package/dist/sparse-overlay-transport-durability.d.ts.map +1 -0
  82. package/dist/sparse-overlay-transport-durability.js +91 -0
  83. package/dist/sparse-overlay-transport-durability.js.map +1 -0
  84. package/dist/sparse-overlay-transport.d.ts +97 -0
  85. package/dist/sparse-overlay-transport.d.ts.map +1 -0
  86. package/dist/sparse-overlay-transport.js +888 -0
  87. package/dist/sparse-overlay-transport.js.map +1 -0
  88. package/dist/sparse-overlay.d.ts +74 -0
  89. package/dist/sparse-overlay.d.ts.map +1 -0
  90. package/dist/sparse-overlay.js +817 -0
  91. package/dist/sparse-overlay.js.map +1 -0
  92. package/package.json +20 -4
package/README.md CHANGED
@@ -3,6 +3,37 @@
3
3
  Provider-neutral state, input and effect contracts for independently executing
4
4
  AgentPlat peers.
5
5
 
6
+ The additive `@agentplat/mesh/overlay` subpath supplies the sparse collective
7
+ scale V2 runtime. It derives `O(log N)` active and reserve peer views on demand,
8
+ refreshes a local view from caller-certified exclusions, and propagates
9
+ digest-only update references with bounded fanout, hop, deduplication and
10
+ outbound-interaction budgets. Closed profiles cover 500, 5,000 and 100,000
11
+ peers while preserving every existing Mesh wire and coordination contract.
12
+ The overlay plans authenticated deliveries but performs no transport, grants
13
+ no authority and never carries raw payloads.
14
+
15
+ The `@agentplat/mesh/overlay-transport` subpath additionally includes an
16
+ optional authenticated next-hop boundary. `MeshAuthenticatedSparseOverlayNextHopTransportV1`
17
+ wraps the durable sparse transport's existing `nextHop` port; its companion
18
+ endpoint validates signed, content-free request and response envelopes before
19
+ the durable overlay processes them. Every envelope binds the overlay, sender
20
+ and recipient peer identities, membership epoch, signing-key ID, sequence,
21
+ logical time, operation and payload digest. The boundary receives membership
22
+ and public-key truth through caller-provided ports, so it neither creates a
23
+ global PKI nor carries private keys in state or evidence.
24
+
25
+ The durable state port performs one atomic compare-and-set for both replay
26
+ state and its monotonic anti-rollback anchor. Production adapters must keep
27
+ that anchor independently protected and never expose a partially committed
28
+ state/anchor pair. It retains only outbound sequence allocation and per-peer
29
+ epoch cursors,
30
+ rejecting replay, implausibly future sequences, wrong epochs, invalid
31
+ signatures, revoked keys and keys outside their explicit rotation window.
32
+ `WebCryptoMeshAuthenticatedOverlaySignerV1` and the in-memory state/network
33
+ adapters are local reference implementations; production deployments supply
34
+ their own key custody, membership authority, atomic durable state/anchor and
35
+ network ports.
36
+
6
37
  The package is additive to the existing Runtime, Sessions and Rooms surfaces.
7
38
  Its peer kernel is defined as a synchronous state transition:
8
39
 
@@ -201,7 +232,11 @@ offer envelopes is a trusted driver boundary; this reducer does not verify a
201
232
  signature itself.
202
233
 
203
234
  The owner-side award increment extends that projection with one prepared,
204
- signed direct `work.award` envelope for the current deterministic bid. Awarding
235
+ signed direct `work.award` envelope for the current deterministic bid.
236
+ Selection may supply a bounded, explicit `excludedBidderPeerIds` set to both it
237
+ and the local award command, allowing immutable owner policy (for example,
238
+ witness/assignee separation) to choose the next eligible bid deterministically.
239
+ Awarding
205
240
  atomically closes the bid window, replaces its timer with a generation-fenced
206
241
  acceptance timer and keeps the reservation reserved. Already-verified direct
207
242
  `work.accept` and `work.decline` responses are accepted only from the awarded
@@ -297,8 +332,52 @@ instance authority, replay accounting and the allocation transition. A signed
297
332
  execution record rejected by the domain still consumes normal replay security
298
333
  accounting; diagnostics remain local. The same boundary accepts authenticated
299
334
  `lease.renew`, `lease.takeover_proposal`, `lease.vote` and `lease.certificate`
300
- records only after replay and admission checks. This alpha does not implement
301
- durable execution storage, owner transfer or external-action authority.
335
+ records only after replay and admission checks. The state machine does not
336
+ choose a storage engine or grant external-action authority; applications bind
337
+ it to a durable repository and a separately governed action gateway.
338
+
339
+ The durable outbox supports an optional `dependsOnEffectId` causal fence. A
340
+ dependency may name an earlier effect in the same atomic transition or a
341
+ retained effect from an earlier transition in the same durable peer scope.
342
+ Forward references within one transition are rejected. Durable adapters claim
343
+ the dependent effect only after its predecessor is settled as delivered, so
344
+ checkpoint-before-result and multi-transition witness ordering survive retries
345
+ and process loss.
346
+
347
+ ## Certified authority continuity
348
+
349
+ Import `@agentplat/mesh/continuity` when an application cannot depend forever
350
+ on the initially provisioned Objective issuer or Work Item owner. It maintains
351
+ one independently durable, generation-fenced authority head for either an
352
+ `objective_issuer` or `work_owner` scope.
353
+
354
+ A coordinated transfer requires evidence signed by the exact current holder
355
+ and separate signed acceptance by the eligible successor. Recovery without the
356
+ holder requires a successor-signed proposal, the configured delay, distinct
357
+ verified endorsements from the fixed witness set, its threshold certificate
358
+ and successor acceptance. The threshold must be a strict majority and the
359
+ current holder or proposed successor cannot be one of its own witnesses. A
360
+ proposal, endorsement or certificate alone never
361
+ activates authority. Recovery cannot replace its witness policy; only a
362
+ current-holder transfer may install the successor policy it signs.
363
+
364
+ The runtime binds its verifier, successor-eligibility implementation, proof
365
+ limit and retained-evidence limit into every snapshot. State changes use a
366
+ caller-supplied compare-and-swap store. Each accepted transition increments the
367
+ generation, derives a new fencing token from the certificate, retains the full
368
+ evidence chain and makes the prior holder fail `checkCurrent()`. Malformed,
369
+ stale, concurrent, expired, under-threshold or unverifiable transitions fail
370
+ closed.
371
+
372
+ This subpath is transport-neutral and does not reinterpret an older allocation
373
+ envelope. Gateways compose its current head before admitting issuer/owner
374
+ commands and bind the resulting generation, head digest and fencing token into
375
+ new Work Contracts, action permits and downstream effects. The included
376
+ in-memory store is a reference adapter; durable deployments implement the same
377
+ CAS port.
378
+ Snapshots revalidate their closed shape, canonical digests and complete
379
+ transition chain on load; the durable store must integrity-protect them because
380
+ historical signature providers are not contacted again during restoration.
302
381
 
303
382
  `@agentplat/mesh/loopback` provides the explicit in-memory signed transport used
304
383
  by the local vertical slice. `createMeshLoopbackTransport` owns composite
@@ -308,6 +387,56 @@ transports. Outbound sequence allocators are included in restart snapshots,
308
387
  duplicate batches repeat the exact signed envelope, and cooperative close
309
388
  drains already accepted work.
310
389
 
311
- Importing either entrypoint performs no network, clock, storage or key
390
+ Importing any entrypoint performs no network, clock, storage or key
312
391
  operations. Clocks, message-ID sources, signers, keys and verification policy
313
392
  are supplied explicitly when a peer is registered.
393
+
394
+ ## Governed adaptive sparse overlay
395
+
396
+ Import `@agentplat/mesh/adaptive-overlay` to refresh one peer's bounded sparse
397
+ view from authenticated, content-free evidence. The locally installed policy
398
+ binds eligible observers, independence groups, evidence lifetime and exclusion
399
+ limits. A remote proposal or certificate cannot replace that policy.
400
+
401
+ Only a current certificate whose signal/peer/group tuples cover the exact
402
+ proposal may exclude a neighbor. The replacement view is regenerated locally
403
+ from the existing topology seed; no global graph is accepted or retained.
404
+ Revision-and-digest CAS, future/stale checks and an external monotonic head
405
+ reject races, rollback and deleted-snapshot reinitialization.
406
+
407
+ Application replay is keyed by the certified certificate digest. If a caller
408
+ crashes after the adaptive CAS but before persisting its own receipt, retrying
409
+ with the original expected revision returns the retained application as a
410
+ duplicate before rejecting that now-stale revision. It does not authorize a
411
+ different certificate or bypass the original certification boundary.
412
+
413
+ ## Collective capability closure
414
+
415
+ Operational Sparse Peer Plane V1 is the communication substrate for the
416
+ collective capability closure. It supplies bounded local peer views and
417
+ authenticated, digest-bound dissemination inputs to planning, context,
418
+ allocation and recovery adapters. It does not expose a global membership
419
+ oracle, global topology graph, central scheduler or execution authority.
420
+
421
+ Production drivers must provide authenticated ingress, replay protection,
422
+ durable CAS/high-water persistence, bounded queues and current identity/key
423
+ resolution. A local peer view is a routing and eligibility input only; team
424
+ assignment, Work Contracts and effects remain separate fenced boundaries. See
425
+ [ADR 0042](../../docs/adr/0042-collective-capability-closure.md) and the
426
+ [architecture and threat model](../../docs/security/collective-capability-closure-v1.md).
427
+
428
+ ### Durable sparse-overlay transport
429
+
430
+ `@agentplat/mesh/overlay-transport` supplies the portable next-hop data plane
431
+ for the Sparse Peer Plane. Each runtime owns only one peer's bounded inbox,
432
+ outbox, application updates, causal history and neighbor cursors. Delivery and
433
+ update identities are idempotent; bounded queues apply backpressure; retry
434
+ state survives restart through a CAS store.
435
+
436
+ `MeshSparseDirectNextHopTransportV1` connects only explicitly supplied local
437
+ neighbors and never creates a process-global peer directory. A partition keeps
438
+ the durable outbox intact. On rejoin, the peer requests bounded deltas from
439
+ current active/reserve neighbors, detects a truncated history gap, and fetches
440
+ the exact causal predecessor before handing a recovered delivery to the peer
441
+ plane. Deployments can persist the state with
442
+ `MeshDurableSparseTransportStoreV1` using a dedicated durable repository scope.
@@ -0,0 +1,149 @@
1
+ /** Provider-neutral, content-free governance contracts for local sparse-overlay adaptation. */
2
+ export declare const MESH_ADAPTIVE_OVERLAY_SCHEMA_VERSION_V1: 1;
3
+ export type MeshAdaptiveOverlayDigestV1 = `sha256:${string}`;
4
+ export type MeshAdaptiveOverlayDecisionV1 = "observed" | "certified" | "applied" | "duplicate" | "stale" | "conflict" | "rejected";
5
+ /** Current topology bindings that every signal and certificate must carry. */
6
+ export interface MeshAdaptiveOverlayBindingV1 {
7
+ readonly schemaVersion: 1;
8
+ readonly overlayId: string;
9
+ readonly localPeerIndex: number;
10
+ readonly membershipDigest: MeshAdaptiveOverlayDigestV1;
11
+ readonly profileDigest: MeshAdaptiveOverlayDigestV1;
12
+ readonly viewDigest: MeshAdaptiveOverlayDigestV1;
13
+ readonly revision: number;
14
+ readonly bindingDigest: MeshAdaptiveOverlayDigestV1;
15
+ }
16
+ /** An authenticated observation. Its subject is deliberately a digest, never payload content. */
17
+ export interface MeshAdaptiveOverlaySignalV1 {
18
+ readonly schemaVersion: 1;
19
+ readonly signalId: string;
20
+ readonly binding: MeshAdaptiveOverlayBindingV1;
21
+ readonly observerPeerId: string;
22
+ readonly observerGroupId: string;
23
+ /** Exact peer whose local reachability is being evaluated. */
24
+ readonly subjectPeerIndex: number;
25
+ readonly subjectDigest: MeshAdaptiveOverlayDigestV1;
26
+ readonly kind: "unreachable" | "degraded" | "policy_violation";
27
+ readonly observedAtLogicalMs: number;
28
+ readonly expiresAtLogicalMs: number;
29
+ readonly authentication: {
30
+ readonly algorithm: string;
31
+ readonly value: string;
32
+ };
33
+ readonly signalDigest: MeshAdaptiveOverlayDigestV1;
34
+ }
35
+ export interface MeshAdaptiveOverlayObserverV1 {
36
+ readonly peerId: string;
37
+ readonly groupId: string;
38
+ }
39
+ /** The threshold counts independent observer groups, not raw reports. */
40
+ export interface MeshAdaptiveOverlayPolicyV1 {
41
+ readonly schemaVersion: 1;
42
+ readonly policyId: string;
43
+ readonly policyRevision: number;
44
+ readonly observers: readonly MeshAdaptiveOverlayObserverV1[];
45
+ readonly independentGroupThreshold: number;
46
+ readonly maximumSignalLifetimeMs: number;
47
+ readonly maximumExcludedNeighbors: number;
48
+ readonly validUntilLogicalMs: number;
49
+ readonly policyDigest: MeshAdaptiveOverlayDigestV1;
50
+ }
51
+ /** A proposal is a request for a local deterministic view refresh, not authority to mutate topology. */
52
+ export interface MeshAdaptiveOverlayProposalV1 {
53
+ readonly schemaVersion: 1;
54
+ readonly proposalId: string;
55
+ readonly binding: MeshAdaptiveOverlayBindingV1;
56
+ readonly policy: MeshAdaptiveOverlayPolicyV1;
57
+ readonly excludedNeighborIndexes: readonly number[];
58
+ readonly signalDigests: readonly MeshAdaptiveOverlayDigestV1[];
59
+ readonly proposedAtLogicalMs: number;
60
+ readonly expiresAtLogicalMs: number;
61
+ readonly proposalDigest: MeshAdaptiveOverlayDigestV1;
62
+ }
63
+ export interface MeshAdaptiveOverlayCertificateV1 {
64
+ readonly schemaVersion: 1;
65
+ readonly certificateId: string;
66
+ readonly proposalId: string;
67
+ readonly proposalDigest: MeshAdaptiveOverlayDigestV1;
68
+ readonly binding: MeshAdaptiveOverlayBindingV1;
69
+ readonly policy: MeshAdaptiveOverlayPolicyV1;
70
+ readonly policyDigest: MeshAdaptiveOverlayDigestV1;
71
+ /** Same-index tuples: signal digest, authenticating peer, independence group. */
72
+ readonly signalDigests: readonly MeshAdaptiveOverlayDigestV1[];
73
+ readonly observerPeerIds: readonly string[];
74
+ readonly observerGroupIds: readonly string[];
75
+ readonly issuedAtLogicalMs: number;
76
+ readonly expiresAtLogicalMs: number;
77
+ readonly certificateDigest: MeshAdaptiveOverlayDigestV1;
78
+ }
79
+ export interface MeshAdaptiveOverlayAppliedViewV1 {
80
+ readonly schemaVersion: 1;
81
+ readonly certificateDigest: MeshAdaptiveOverlayDigestV1;
82
+ readonly binding: MeshAdaptiveOverlayBindingV1;
83
+ readonly resultingViewDigest: MeshAdaptiveOverlayDigestV1;
84
+ readonly resultingRevision: number;
85
+ readonly appliedAtLogicalMs: number;
86
+ readonly applicationDigest: MeshAdaptiveOverlayDigestV1;
87
+ }
88
+ export interface MeshAdaptiveOverlayStateV1 {
89
+ readonly schemaVersion: 1;
90
+ readonly revision: number;
91
+ readonly policyDigest: MeshAdaptiveOverlayDigestV1;
92
+ readonly currentBinding: MeshAdaptiveOverlayBindingV1;
93
+ readonly applied: MeshAdaptiveOverlayAppliedViewV1 | null;
94
+ readonly signals: readonly MeshAdaptiveOverlaySignalV1[];
95
+ readonly proposals: readonly MeshAdaptiveOverlayProposalV1[];
96
+ readonly certificates: readonly MeshAdaptiveOverlayCertificateV1[];
97
+ readonly conflicts: readonly MeshAdaptiveOverlayDigestV1[];
98
+ readonly lastLogicalTimeMs: number;
99
+ readonly stateDigest: MeshAdaptiveOverlayDigestV1;
100
+ }
101
+ export interface MeshAdaptiveOverlayStoreV1 {
102
+ load(overlayId: string): Promise<MeshAdaptiveOverlayStateV1 | undefined>;
103
+ compareAndSwap(input: {
104
+ readonly overlayId: string;
105
+ readonly expectedRevision: number | null;
106
+ readonly expectedStateDigest: MeshAdaptiveOverlayDigestV1 | null;
107
+ readonly next: MeshAdaptiveOverlayStateV1;
108
+ }): Promise<boolean>;
109
+ }
110
+ export interface MeshAdaptiveOverlaySignalVerifierV1 {
111
+ readonly verifierId: string;
112
+ verify(signal: MeshAdaptiveOverlaySignalV1): boolean | Promise<boolean>;
113
+ }
114
+ /** Authenticates a remotely issued certificate and its exact proposal. */
115
+ export interface MeshAdaptiveOverlayCertificateVerifierV1 {
116
+ readonly verifierId: string;
117
+ verify(input: {
118
+ readonly certificate: MeshAdaptiveOverlayCertificateV1;
119
+ readonly proposal: MeshAdaptiveOverlayProposalV1;
120
+ }): boolean | Promise<boolean>;
121
+ }
122
+ /** Rollback-resistant head kept outside the replaceable state snapshot. */
123
+ export interface MeshAdaptiveOverlayMonotonicAnchorV1 {
124
+ readAnchor(overlayId: string): Promise<{
125
+ readonly revision: number;
126
+ readonly bindingRevision: number;
127
+ readonly lastLogicalTimeMs: number;
128
+ readonly stateDigest: MeshAdaptiveOverlayDigestV1;
129
+ } | undefined>;
130
+ }
131
+ export interface MeshAdaptiveOverlayRuntimeOptionsV1 {
132
+ /** Locally installed authority; remote proposals cannot replace it. */
133
+ readonly policy: MeshAdaptiveOverlayPolicyV1;
134
+ readonly store: MeshAdaptiveOverlayStoreV1;
135
+ readonly verifier: MeshAdaptiveOverlaySignalVerifierV1;
136
+ readonly certificateVerifier: MeshAdaptiveOverlayCertificateVerifierV1;
137
+ readonly monotonicAnchor?: MeshAdaptiveOverlayMonotonicAnchorV1;
138
+ readonly maximumSignals?: number;
139
+ readonly maximumProposals?: number;
140
+ readonly maximumCertificates?: number;
141
+ }
142
+ export interface MeshAdaptiveOverlayResultV1 {
143
+ readonly decision: MeshAdaptiveOverlayDecisionV1;
144
+ readonly reasonCode: string;
145
+ readonly state: MeshAdaptiveOverlayStateV1;
146
+ readonly certificate?: MeshAdaptiveOverlayCertificateV1;
147
+ readonly applied?: MeshAdaptiveOverlayAppliedViewV1;
148
+ }
149
+ //# sourceMappingURL=adaptive-overlay-contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":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AG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChC;AAED,2EAA2E;AAC3E,MAAM,WAAW,oCAAoC;IACnD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAClC;QACE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;QACnC,QAAQ,CAAC,WAAW,EAAE,2BAA2B,CAAC;KACnD,GACD,SAAS,CACZ,CAAC;CACH;AAED,MAAM,WAAW,mCAAmC;IAClD,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,mCAAmC,CAAC;IACvD,QAAQ,CAAC,mBAAmB,EAAE,wCAAwC,CAAC;IACvE,QAAQ,CAAC,eAAe,CAAC,EAAE,oCAAoC,CAAC;IAChE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,6BAA6B,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,gCAAgC,CAAC;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,gCAAgC,CAAC;CACrD"}
@@ -0,0 +1,3 @@
1
+ /** Provider-neutral, content-free governance contracts for local sparse-overlay adaptation. */
2
+ export const MESH_ADAPTIVE_OVERLAY_SCHEMA_VERSION_V1 = 1;
3
+ //# sourceMappingURL=adaptive-overlay-contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-overlay-contracts.js","sourceRoot":"","sources":["../src/adaptive-overlay-contracts.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAU,CAAC"}
@@ -0,0 +1,67 @@
1
+ import type { MeshAdaptiveOverlayBindingV1, MeshAdaptiveOverlayCertificateV1, MeshAdaptiveOverlayProposalV1, MeshAdaptiveOverlayResultV1, MeshAdaptiveOverlayRuntimeOptionsV1, MeshAdaptiveOverlaySignalV1, MeshAdaptiveOverlayStateV1, MeshAdaptiveOverlayStoreV1, MeshAdaptiveOverlayMonotonicAnchorV1 } from "./adaptive-overlay-contracts.js";
2
+ import type { MeshSparseOverlayProfileV2, MeshSparsePeerViewV2 } from "./sparse-overlay-contracts.js";
3
+ /** CAS-backed governance for independently witnessed local sparse-view refreshes. */
4
+ export declare class MeshAdaptiveOverlayRuntimeV1 {
5
+ private readonly options;
6
+ private readonly maximumSignals;
7
+ private readonly maximumProposals;
8
+ private readonly maximumCertificates;
9
+ private readonly anchor;
10
+ private readonly policy;
11
+ constructor(options: MeshAdaptiveOverlayRuntimeOptionsV1);
12
+ initialize(input: {
13
+ readonly binding: MeshAdaptiveOverlayBindingV1;
14
+ readonly logicalTimeMs: number;
15
+ }): Promise<MeshAdaptiveOverlayStateV1>;
16
+ /** Authentication makes a signal admissible; only a certificate can authorize an adaptation. */
17
+ observe(input: {
18
+ readonly signal: MeshAdaptiveOverlaySignalV1;
19
+ readonly expectedRevision: number;
20
+ readonly logicalTimeMs: number;
21
+ }): Promise<MeshAdaptiveOverlayResultV1>;
22
+ certify(input: {
23
+ readonly proposal: MeshAdaptiveOverlayProposalV1;
24
+ readonly expectedRevision: number;
25
+ readonly logicalTimeMs: number;
26
+ }): Promise<MeshAdaptiveOverlayResultV1>;
27
+ /** Applies a current certificate or returns the exact retained application on replay. */
28
+ apply(input: {
29
+ readonly certificate: MeshAdaptiveOverlayCertificateV1;
30
+ readonly profile: MeshSparseOverlayProfileV2;
31
+ readonly view: MeshSparsePeerViewV2;
32
+ readonly expectedRevision: number;
33
+ readonly logicalTimeMs: number;
34
+ }): Promise<MeshAdaptiveOverlayResultV1>;
35
+ /** Reconciliation accepts an equal certificate idempotently, detects equivocation, and never regresses a view. */
36
+ reconcile(input: {
37
+ readonly certificate: MeshAdaptiveOverlayCertificateV1;
38
+ readonly proposal: MeshAdaptiveOverlayProposalV1;
39
+ readonly expectedRevision: number;
40
+ readonly logicalTimeMs: number;
41
+ }): Promise<MeshAdaptiveOverlayResultV1>;
42
+ private loadState;
43
+ private requireState;
44
+ private assertCurrentState;
45
+ private cas;
46
+ private conflict;
47
+ }
48
+ /** Minimal local store for composition tests; production adapters must persist compare-and-swap atomically. */
49
+ export declare class InMemoryMeshAdaptiveOverlayStoreV1 implements MeshAdaptiveOverlayStoreV1, MeshAdaptiveOverlayMonotonicAnchorV1 {
50
+ private readonly values;
51
+ private readonly anchors;
52
+ load(overlayId: string): Promise<MeshAdaptiveOverlayStateV1 | undefined>;
53
+ readAnchor(overlayId: string): Promise<{
54
+ readonly revision: number;
55
+ readonly bindingRevision: number;
56
+ readonly lastLogicalTimeMs: number;
57
+ readonly stateDigest: MeshAdaptiveOverlayStateV1["stateDigest"];
58
+ } | undefined>;
59
+ compareAndSwap(input: {
60
+ readonly overlayId: string;
61
+ readonly expectedRevision: number | null;
62
+ readonly expectedStateDigest: MeshAdaptiveOverlayStateV1["stateDigest"] | null;
63
+ readonly next: MeshAdaptiveOverlayStateV1;
64
+ }): Promise<boolean>;
65
+ }
66
+ export declare function meshAdaptiveOverlayProfileForBindingV1(binding: MeshAdaptiveOverlayBindingV1): MeshSparseOverlayProfileV2;
67
+ //# sourceMappingURL=adaptive-overlay-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-overlay-runtime.d.ts","sourceRoot":"","sources":["../src/adaptive-overlay-runtime.ts"],"names":[],"mappings":"AAYA,OAAO,K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