@amalgm/live 0.2.81-main.41713043931 → 0.2.81-main.41725828860

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 (126) hide show
  1. package/PURPOSE.md +13 -22
  2. package/README.md +9 -14
  3. package/dist/contracts/frames/tunnel.d.ts +4 -5
  4. package/dist/contracts/frames/tunnel.d.ts.map +1 -1
  5. package/dist/contracts/frames/tunnel.js +4 -5
  6. package/dist/contracts/frames/tunnel.js.map +1 -1
  7. package/dist/contracts/index.d.ts +4 -13
  8. package/dist/contracts/index.d.ts.map +1 -1
  9. package/dist/contracts/index.js +4 -13
  10. package/dist/contracts/index.js.map +1 -1
  11. package/dist/contracts/validate.d.ts +5 -5
  12. package/dist/contracts/validate.js +5 -5
  13. package/dist/index.d.ts +3 -4
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +3 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist-cjs/contracts/frames/tunnel.js +4 -5
  18. package/dist-cjs/contracts/frames/tunnel.js.map +1 -1
  19. package/dist-cjs/contracts/index.js +4 -13
  20. package/dist-cjs/contracts/index.js.map +1 -1
  21. package/dist-cjs/contracts/validate.js +5 -5
  22. package/dist-cjs/index.js +3 -4
  23. package/dist-cjs/index.js.map +1 -1
  24. package/package.json +4 -35
  25. package/dist/contracts/binding.d.ts +0 -50
  26. package/dist/contracts/binding.d.ts.map +0 -1
  27. package/dist/contracts/binding.js +0 -23
  28. package/dist/contracts/binding.js.map +0 -1
  29. package/dist/contracts/deployments.d.ts +0 -39
  30. package/dist/contracts/deployments.d.ts.map +0 -1
  31. package/dist/contracts/deployments.js +0 -75
  32. package/dist/contracts/deployments.js.map +0 -1
  33. package/dist/contracts/docs.d.ts +0 -64
  34. package/dist/contracts/docs.d.ts.map +0 -1
  35. package/dist/contracts/docs.js +0 -51
  36. package/dist/contracts/docs.js.map +0 -1
  37. package/dist/contracts/events.d.ts +0 -45
  38. package/dist/contracts/events.d.ts.map +0 -1
  39. package/dist/contracts/events.js +0 -38
  40. package/dist/contracts/events.js.map +0 -1
  41. package/dist/contracts/frames/gateway.d.ts +0 -83
  42. package/dist/contracts/frames/gateway.d.ts.map +0 -1
  43. package/dist/contracts/frames/gateway.js +0 -35
  44. package/dist/contracts/frames/gateway.js.map +0 -1
  45. package/dist/contracts/frames/stream.d.ts +0 -59
  46. package/dist/contracts/frames/stream.d.ts.map +0 -1
  47. package/dist/contracts/frames/stream.js +0 -17
  48. package/dist/contracts/frames/stream.js.map +0 -1
  49. package/dist/contracts/presence.d.ts +0 -46
  50. package/dist/contracts/presence.d.ts.map +0 -1
  51. package/dist/contracts/presence.js +0 -34
  52. package/dist/contracts/presence.js.map +0 -1
  53. package/dist/contracts/resources.d.ts +0 -52
  54. package/dist/contracts/resources.d.ts.map +0 -1
  55. package/dist/contracts/resources.js +0 -105
  56. package/dist/contracts/resources.js.map +0 -1
  57. package/dist/contracts/snapshot.d.ts +0 -24
  58. package/dist/contracts/snapshot.d.ts.map +0 -1
  59. package/dist/contracts/snapshot.js +0 -28
  60. package/dist/contracts/snapshot.js.map +0 -1
  61. package/dist/machines/arbitration.d.ts +0 -36
  62. package/dist/machines/arbitration.d.ts.map +0 -1
  63. package/dist/machines/arbitration.js +0 -37
  64. package/dist/machines/arbitration.js.map +0 -1
  65. package/dist/machines/backoff.d.ts +0 -36
  66. package/dist/machines/backoff.d.ts.map +0 -1
  67. package/dist/machines/backoff.js +0 -34
  68. package/dist/machines/backoff.js.map +0 -1
  69. package/dist/machines/bootstrap.d.ts +0 -65
  70. package/dist/machines/bootstrap.d.ts.map +0 -1
  71. package/dist/machines/bootstrap.js +0 -105
  72. package/dist/machines/bootstrap.js.map +0 -1
  73. package/dist/machines/chunks.d.ts +0 -51
  74. package/dist/machines/chunks.d.ts.map +0 -1
  75. package/dist/machines/chunks.js +0 -67
  76. package/dist/machines/chunks.js.map +0 -1
  77. package/dist/machines/index.d.ts +0 -12
  78. package/dist/machines/index.d.ts.map +0 -1
  79. package/dist/machines/index.js +0 -12
  80. package/dist/machines/index.js.map +0 -1
  81. package/dist/machines/presence.d.ts +0 -26
  82. package/dist/machines/presence.d.ts.map +0 -1
  83. package/dist/machines/presence.js +0 -49
  84. package/dist/machines/presence.js.map +0 -1
  85. package/dist/merge/index.d.ts +0 -9
  86. package/dist/merge/index.d.ts.map +0 -1
  87. package/dist/merge/index.js +0 -9
  88. package/dist/merge/index.js.map +0 -1
  89. package/dist/merge/merge3.d.ts +0 -39
  90. package/dist/merge/merge3.d.ts.map +0 -1
  91. package/dist/merge/merge3.js +0 -188
  92. package/dist/merge/merge3.js.map +0 -1
  93. package/dist-cjs/contracts/binding.js +0 -26
  94. package/dist-cjs/contracts/binding.js.map +0 -1
  95. package/dist-cjs/contracts/deployments.js +0 -81
  96. package/dist-cjs/contracts/deployments.js.map +0 -1
  97. package/dist-cjs/contracts/docs.js +0 -56
  98. package/dist-cjs/contracts/docs.js.map +0 -1
  99. package/dist-cjs/contracts/events.js +0 -44
  100. package/dist-cjs/contracts/events.js.map +0 -1
  101. package/dist-cjs/contracts/frames/gateway.js +0 -39
  102. package/dist-cjs/contracts/frames/gateway.js.map +0 -1
  103. package/dist-cjs/contracts/frames/stream.js +0 -20
  104. package/dist-cjs/contracts/frames/stream.js.map +0 -1
  105. package/dist-cjs/contracts/presence.js +0 -38
  106. package/dist-cjs/contracts/presence.js.map +0 -1
  107. package/dist-cjs/contracts/resources.js +0 -114
  108. package/dist-cjs/contracts/resources.js.map +0 -1
  109. package/dist-cjs/contracts/snapshot.js +0 -31
  110. package/dist-cjs/contracts/snapshot.js.map +0 -1
  111. package/dist-cjs/machines/arbitration.js +0 -41
  112. package/dist-cjs/machines/arbitration.js.map +0 -1
  113. package/dist-cjs/machines/backoff.js +0 -38
  114. package/dist-cjs/machines/backoff.js.map +0 -1
  115. package/dist-cjs/machines/bootstrap.js +0 -110
  116. package/dist-cjs/machines/bootstrap.js.map +0 -1
  117. package/dist-cjs/machines/chunks.js +0 -72
  118. package/dist-cjs/machines/chunks.js.map +0 -1
  119. package/dist-cjs/machines/index.js +0 -28
  120. package/dist-cjs/machines/index.js.map +0 -1
  121. package/dist-cjs/machines/presence.js +0 -53
  122. package/dist-cjs/machines/presence.js.map +0 -1
  123. package/dist-cjs/merge/index.js +0 -25
  124. package/dist-cjs/merge/index.js.map +0 -1
  125. package/dist-cjs/merge/merge3.js +0 -191
  126. package/dist-cjs/merge/merge3.js.map +0 -1
package/PURPOSE.md CHANGED
@@ -10,8 +10,7 @@ JavaScript host consumes it without inheriting a filesystem watcher, a SQLite
10
10
  database, or a user-interface dependency.
11
11
 
12
12
  The public developer model is `live.bind(surface, channel)` and is specified
13
- in `docs/realtime-sdk.md`. The shipped wire behavior this package encodes is
14
- `docs/local-live-protocol.md`. The entity Record/Send/Receive discipline is
13
+ in `docs/realtime-sdk.md`. The entity Record/Send/Receive discipline is
15
14
  `docs/entity-record-queues.md`. This repository is where those documents
16
15
  become executable and testable. The deprecated Engine repository is read-only
17
16
  reference evidence; released Live surfaces run only from this package through
@@ -610,30 +609,25 @@ Primary and collateral placement use the same retained original physical
610
609
  association. A proved cancellation may repair O addresses, never sharing state,
611
610
  payload/version, verification time, or the resolved/verified history positions.
612
611
 
613
- ## Five surfaces, one behavior
612
+ ## One SDK, thin doors
614
613
 
615
- ```
616
- src/ the SDK — the behavior. Contracts + machines + adapter ports.
617
- surfaces/api REST router factory a host mounts (diagnose/validate routes).
618
- surfaces/cli `amalgm-live` — inspect frames, derive ids, simulate merges.
619
- surfaces/mcp MCP server exposing the same actions to agents.
620
- skills/live the skill: teaches an agent this protocol via the CLI/MCP.
621
- ```
622
-
623
- Every surface is a thin adapter over `src/`. A surface that implements
624
- behavior instead of delegating to the SDK is a bug (axiom 3).
614
+ `src/` is the whole package. Shell, the gateway, and the UI consume it as
615
+ `@amalgm/live` and supply every machine effect through injected ports. The
616
+ product commands `amalgm files register` and `amalgm files add` are Shell's
617
+ mappings onto this package's decisions. The doors kept here are pure mappings
618
+ beside the module they serve: the sharing argv and MCP doors in
619
+ `src/sharing/`, and the HTTP mappings `src/files/api.ts` and
620
+ `src/workspace/api.ts`. A door that implements behavior instead of delegating
621
+ to the SDK is a bug (axiom 3).
625
622
 
626
623
  ## Layout
627
624
 
628
625
  ```
629
- src/contracts/ value types + validators: events, snapshots, resource ids,
630
- content manifests, frames (SSE /
631
- gateway socket / tunnel), doc-write merge outcomes,
632
- presence.
626
+ src/contracts/ value types + validators: non-throwing checks, content
627
+ manifests, the sealed-content envelope, and the
628
+ runtime-gateway tunnel frames.
633
629
  src/records/ entity record contracts, the event-driven Send/Receive rail,
634
630
  and the local-outbox, authority, and per-entity inbox laws.
635
- src/machines/ transport-neutral state machines: bootstrap barrier, presence
636
- TTL, slot arbitration, chunk reassembly, backoff.
637
631
  src/entities/ the entity model's rule surface: the six-field record,
638
632
  derived versions, lifecycle laws, move planning, the
639
633
  cloud codec and the one reducer — behind injected ports.
@@ -655,9 +649,6 @@ src/transfer/ type-aware immutable artifact upload/download operations;
655
649
  chunk storage, R2, files, and Git remain injected effects.
656
650
  tests/ unit tests per module, in the engine wall's style: each
657
651
  exam states a law; mutants convict.
658
- tests/parity/ golden-vector harness: the same inputs run against this
659
- package and the shipped runtime implementation must produce
660
- identical outputs.
661
652
  tests/records/ contract and invariant tests for the complete entity-record
662
653
  journey, written against the public SDK API only.
663
654
  tests/apply/simulation/
package/README.md CHANGED
@@ -11,14 +11,12 @@ SQLite, no UI dependency.
11
11
  const binding = live.bind(surface, channel)
12
12
  ```
13
13
 
14
- Start with [PURPOSE.md](PURPOSE.md) — purpose, axioms, and layout — and
15
- [ROADMAP.md](ROADMAP.md) for what moves here next. The
14
+ Start with [PURPOSE.md](PURPOSE.md) — purpose, axioms, and layout. The
16
15
  normative specifications live in [docs/](docs/):
17
16
 
18
17
  | document | owns |
19
18
  | --- | --- |
20
19
  | [realtime-sdk.md](docs/realtime-sdk.md) | the public `bind(surface, channel)` model |
21
- | [local-live-protocol.md](docs/local-live-protocol.md) | the shipped local wire protocol (v1/v2) |
22
20
  | [entity-record-queues.md](docs/entity-record-queues.md) | filesystem Record, local Outbox, per-UUID cloud order, and local Inbox |
23
21
  | [entity-apply.md](docs/entity-apply.md) | intent-first, type-sensitive Apply and exact Verify |
24
22
  | [files-browsing.md](docs/files-browsing.md) | one active-cloud namespace with per-computer local materialization |
@@ -27,24 +25,21 @@ normative specifications live in [docs/](docs/):
27
25
  | [user-ground-login.md](docs/user-ground-login.md) | first-login publication, later-device map placement, and Watch readiness |
28
26
  | [watching.md](docs/watching.md) | Watch purpose, axioms, lifecycle matrix, and cross-platform test layers |
29
27
 
30
- ## Surfaces
28
+ ## Shape
31
29
 
32
- | surface | entry | what it is |
33
- | --- | --- | --- |
34
- | SDK | `src/` → `@amalgm/live` | the behavior: contracts, machines, adapter ports |
35
- | API | `surfaces/api/` | REST router factory a host mounts |
36
- | CLI | `surfaces/cli/` | `amalgm-live` — inspect, derive, validate, simulate |
37
- | MCP | `surfaces/mcp/` | the same actions, exposed to agents |
38
- | Skill | `skills/live/` | teaches an agent this protocol via the CLI/MCP |
39
-
40
- Every surface delegates to `src/`. One behavior, five doors.
30
+ `src/` is the whole package, published as `@amalgm/live`. Shell, the gateway,
31
+ and the UI consume it and supply every machine effect through injected ports.
32
+ The product commands `amalgm files register` and `amalgm files add` are
33
+ Shell's thin mappings onto this package's decisions. The doors kept here are
34
+ pure mappings beside the module they serve: `src/sharing/cli.ts` and
35
+ `src/sharing/mcp.ts`, and the HTTP mappings `src/files/api.ts` and
36
+ `src/workspace/api.ts`.
41
37
 
42
38
  ## Develop
43
39
 
44
40
  ```bash
45
41
  npm install
46
42
  npm test # build + unit tests
47
- npm run test:parity # golden vectors vs read-only historical Engine evidence
48
43
  ```
49
44
 
50
45
  ## Managed candidate delivery
@@ -1,13 +1,12 @@
1
1
  /**
2
- * Tunnel frames — runtime ⇄ gateway, protocol v2
3
- * (local-live-protocol.md §5).
2
+ * Tunnel frames — runtime ⇄ gateway, protocol v2.
4
3
  *
5
4
  * One outbound WebSocket per runtime. v2 is negotiated per connection: the
6
5
  * runtime's hello carries `protocol_version: 2`; no `hello_ack` means the
7
6
  * peer is v1 and only v1 frames may be sent. Slot arbitration is
8
- * hello-driven and identity-based — the decision function itself lives in
9
- * `machines/arbitration.ts`; this file owns the wire shapes and constants
10
- * both sides must agree on.
7
+ * hello-driven and identity-based — the host decides which runtime holds the
8
+ * slot; this file owns the wire shapes and constants both sides must agree
9
+ * on.
11
10
  */
12
11
  import { type Checked } from '../validate.js';
13
12
  export declare const PROTOCOL_VERSION = 2;
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel.d.ts","sourceRoot":"","sources":["../../../src/contracts/frames/tunnel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,OAAO,EAA+C,MAAM,gBAAgB,CAAC;AAE3F,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,qCAAqC;AACrC,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAExC,0HAA0H;AAC1H,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAE/D,eAAO,MAAM,WAAW;IACtB,iFAAiF;;IAEjF,qFAAqF;;;CAG7E,CAAC;AAEX,eAAO,MAAM,YAAY;IACvB,6FAA6F;;IAE7F,sEAAsE;;IAEtE,+HAA+H;;CAEvH,CAAC;AAEX,eAAO,MAAM,QAAQ;IACnB,qDAAqD;;IAErD,6CAA6C;;CAErC,CAAC;AAEX,0GAA0G;AAC1G,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,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AAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACjK;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAC5G,gFAAgF;GAC9E;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAKnF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAS/D;AAED,8IAA8I;AAC9I,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,CAAC,WAAW,CAAC,KAAG,OAIhC,CAAC"}
@@ -1,13 +1,12 @@
1
1
  /**
2
- * Tunnel frames — runtime ⇄ gateway, protocol v2
3
- * (local-live-protocol.md §5).
2
+ * Tunnel frames — runtime ⇄ gateway, protocol v2.
4
3
  *
5
4
  * One outbound WebSocket per runtime. v2 is negotiated per connection: the
6
5
  * runtime's hello carries `protocol_version: 2`; no `hello_ack` means the
7
6
  * peer is v1 and only v1 frames may be sent. Slot arbitration is
8
- * hello-driven and identity-based — the decision function itself lives in
9
- * `machines/arbitration.ts`; this file owns the wire shapes and constants
10
- * both sides must agree on.
7
+ * hello-driven and identity-based — the host decides which runtime holds the
8
+ * slot; this file owns the wire shapes and constants both sides must agree
9
+ * on.
11
10
  */
12
11
  import { pass, failShape, isRecord, isNonEmptyString } from '../validate.js';
13
12
  export const PROTOCOL_VERSION = 2;
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel.js","sourceRoot":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+HAA+H;IAC/H,YAAY,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;CACtB,CAAC;AAEX,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,qDAAqD;IACrD,cAAc,EAAE,GAAG,GAAG,IAAI;IAC1B,6CAA6C;IAC7C,aAAa,EAAE,GAAG,GAAG,IAAI;CACjB,CAAC;AA4BX,MAAM,aAAa,GACjB,oJAAoJ,CAAC;AAEvJ,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC/C,OAAO,SAAS,CAAC,aAAa,EAAE,YAAY,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;IAC7G,CAAC;IACD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,OAAO,SAAS,CAAC,aAAa,EAAE,qBAAqB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;IACtH,CAAC;IACD,mFAAmF;IACnF,OAAO,IAAI,CAAC,KAA+B,CAAC,CAAC;AAC/C,CAAC;AAED,8IAA8I;AAC9I,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA2B,EAAW,EAAE,CACxE,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;IACrC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IACxC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;IACjC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC"}
@@ -1,20 +1,11 @@
1
1
  /**
2
- * The contracts layer: every wire shape, identity rule, and vocabulary the
3
- * protocol documents define — as types, guards, and validators. Nothing in
4
- * here performs I/O or holds state; the state machines live in
5
- * `../machines`, and the ports a host injects live in `../adapters`.
2
+ * The contracts layer: the wire shapes and validators a host still speaks —
3
+ * non-throwing validation, immutable chunked content, the sealed-content
4
+ * protection envelope, and the runtime-gateway tunnel. Nothing in here
5
+ * performs I/O or holds state.
6
6
  */
7
7
  export * from './validate.js';
8
- export * from './resources.js';
9
- export * from './events.js';
10
- export * from './snapshot.js';
11
- export * from './binding.js';
12
- export * from './deployments.js';
13
- export * from './presence.js';
14
- export * from './docs.js';
15
8
  export * from './content.js';
16
9
  export * from './protection.js';
17
- export * from './frames/stream.js';
18
- export * from './frames/gateway.js';
19
10
  export * from './frames/tunnel.js';
20
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -1,20 +1,11 @@
1
1
  /**
2
- * The contracts layer: every wire shape, identity rule, and vocabulary the
3
- * protocol documents define — as types, guards, and validators. Nothing in
4
- * here performs I/O or holds state; the state machines live in
5
- * `../machines`, and the ports a host injects live in `../adapters`.
2
+ * The contracts layer: the wire shapes and validators a host still speaks —
3
+ * non-throwing validation, immutable chunked content, the sealed-content
4
+ * protection envelope, and the runtime-gateway tunnel. Nothing in here
5
+ * performs I/O or holds state.
6
6
  */
7
7
  export * from './validate.js';
8
- export * from './resources.js';
9
- export * from './events.js';
10
- export * from './snapshot.js';
11
- export * from './binding.js';
12
- export * from './deployments.js';
13
- export * from './presence.js';
14
- export * from './docs.js';
15
8
  export * from './content.js';
16
9
  export * from './protection.js';
17
- export * from './frames/stream.js';
18
- export * from './frames/gateway.js';
19
10
  export * from './frames/tunnel.js';
20
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -2,11 +2,11 @@
2
2
  * Shared validation vocabulary for every contract in this package.
3
3
  *
4
4
  * Validators never throw on bad wire data — a peer being wrong is an
5
- * expected condition, not an exception (local-live-protocol.md: unknown
6
- * frames mean "the other end is older"). They return a `Checked<T>` so
7
- * callers must look at the outcome, and every failure message is
8
- * example-first: it states what a correct value looks like before saying
9
- * what was wrong (see PURPOSE.md axiom on error shape).
5
+ * expected condition, not an exception (an unknown frame means the other
6
+ * end is older). They return a `Checked<T>` so callers must look at the
7
+ * outcome, and every failure message is example-first: it states what a
8
+ * correct value looks like before saying what was wrong (see PURPOSE.md
9
+ * axiom on error shape).
10
10
  */
11
11
  export type Checked<T> = {
12
12
  readonly ok: true;
@@ -2,11 +2,11 @@
2
2
  * Shared validation vocabulary for every contract in this package.
3
3
  *
4
4
  * Validators never throw on bad wire data — a peer being wrong is an
5
- * expected condition, not an exception (local-live-protocol.md: unknown
6
- * frames mean "the other end is older"). They return a `Checked<T>` so
7
- * callers must look at the outcome, and every failure message is
8
- * example-first: it states what a correct value looks like before saying
9
- * what was wrong (see PURPOSE.md axiom on error shape).
5
+ * expected condition, not an exception (an unknown frame means the other
6
+ * end is older). They return a `Checked<T>` so callers must look at the
7
+ * outcome, and every failure message is example-first: it states what a
8
+ * correct value looks like before saying what was wrong (see PURPOSE.md
9
+ * axiom on error shape).
10
10
  */
11
11
  export const pass = (value) => ({ ok: true, value });
12
12
  export const fail = (error) => ({ ok: false, error });
package/dist/index.d.ts CHANGED
@@ -3,16 +3,16 @@
3
3
  *
4
4
  * Portable layers, one rule each:
5
5
  *
6
- * - `contracts/` every wire shape and identity rule, as types + validators
7
- * - `machines/` the protocol's behavior, as pure state machines
6
+ * - `contracts/` the wire shapes a host still speaks, as types + validators
7
+ * - `entities/` identity, version, lifecycle, and codec laws
8
8
  * - `records/` the entity Record, local Outbox, authority, and Inbox laws
9
+ * - `apply/` the Apply/Verify rail
9
10
  * - `steps.ts` long whole-graph passes written as steps a host can pace
10
11
  *
11
12
  * Start at PURPOSE.md for the axioms; docs/ holds the normative specs.
12
13
  */
13
14
  export * from './steps.js';
14
15
  export * from './contracts/index.js';
15
- export * from './machines/index.js';
16
16
  export * from './entities/index.js';
17
17
  export * from './watching/index.js';
18
18
  export * from './detection/index.js';
@@ -21,7 +21,6 @@ export * from './apply/index.js';
21
21
  export * from './registration/index.js';
22
22
  export * from './files/index.js';
23
23
  export * from './transfer/index.js';
24
- export * from './merge/index.js';
25
24
  export * from './workspace/index.js';
26
25
  export * from './sharing/index.js';
27
26
  export * from './history/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -3,16 +3,16 @@
3
3
  *
4
4
  * Portable layers, one rule each:
5
5
  *
6
- * - `contracts/` every wire shape and identity rule, as types + validators
7
- * - `machines/` the protocol's behavior, as pure state machines
6
+ * - `contracts/` the wire shapes a host still speaks, as types + validators
7
+ * - `entities/` identity, version, lifecycle, and codec laws
8
8
  * - `records/` the entity Record, local Outbox, authority, and Inbox laws
9
+ * - `apply/` the Apply/Verify rail
9
10
  * - `steps.ts` long whole-graph passes written as steps a host can pace
10
11
  *
11
12
  * Start at PURPOSE.md for the axioms; docs/ holds the normative specs.
12
13
  */
13
14
  export * from './steps.js';
14
15
  export * from './contracts/index.js';
15
- export * from './machines/index.js';
16
16
  export * from './entities/index.js';
17
17
  export * from './watching/index.js';
18
18
  export * from './detection/index.js';
@@ -21,7 +21,6 @@ export * from './apply/index.js';
21
21
  export * from './registration/index.js';
22
22
  export * from './files/index.js';
23
23
  export * from './transfer/index.js';
24
- export * from './merge/index.js';
25
24
  export * from './workspace/index.js';
26
25
  export * from './sharing/index.js';
27
26
  export * from './history/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  /**
3
- * Tunnel frames — runtime ⇄ gateway, protocol v2
4
- * (local-live-protocol.md §5).
3
+ * Tunnel frames — runtime ⇄ gateway, protocol v2.
5
4
  *
6
5
  * One outbound WebSocket per runtime. v2 is negotiated per connection: the
7
6
  * runtime's hello carries `protocol_version: 2`; no `hello_ack` means the
8
7
  * peer is v1 and only v1 frames may be sent. Slot arbitration is
9
- * hello-driven and identity-based — the decision function itself lives in
10
- * `machines/arbitration.ts`; this file owns the wire shapes and constants
11
- * both sides must agree on.
8
+ * hello-driven and identity-based — the host decides which runtime holds the
9
+ * slot; this file owns the wire shapes and constants both sides must agree
10
+ * on.
12
11
  */
13
12
  Object.defineProperty(exports, "__esModule", { value: true });
14
13
  exports.hasUsableIdentity = exports.CHUNKING = exports.BACKPRESSURE = exports.CLOSE_CODES = exports.CAPABILITY_SHARED_MUTATION = exports.HELLO_INTERVAL_MS = exports.PROTOCOL_VERSION = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel.js","sourceRoot":"","sources":["../../../src/contracts/frames/tunnel.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAgEH,gCASC;AAvED,gDAA2F;AAE9E,QAAA,gBAAgB,GA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K,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC/C,OAAO,IAAA,uBAAS,EAAC,aAAa,EAAE,YAAY,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;IAC7G,CAAC;IACD,IAAI,CAAC,IAAA,8BAAgB,EAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAA,uBAAS,EAAC,aAAa,EAAE,qBAAqB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;IACtH,CAAC;IACD,mFAAmF;IACnF,OAAO,IAAA,kBAAI,EAAC,KAA+B,CAAC,CAAC;AAC/C,CAAC;AAED,8IAA8I;AACvI,MAAM,iBAAiB,GAAG,CAAC,KAA2B,EAAW,EAAE,CACxE,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;IACrC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IACxC,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;IACjC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAJpB,QAAA,iBAAiB,qBAIG"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * The contracts layer: every wire shape, identity rule, and vocabulary the
4
- * protocol documents define — as types, guards, and validators. Nothing in
5
- * here performs I/O or holds state; the state machines live in
6
- * `../machines`, and the ports a host injects live in `../adapters`.
3
+ * The contracts layer: the wire shapes and validators a host still speaks —
4
+ * non-throwing validation, immutable chunked content, the sealed-content
5
+ * protection envelope, and the runtime-gateway tunnel. Nothing in here
6
+ * performs I/O or holds state.
7
7
  */
8
8
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
9
  if (k2 === undefined) k2 = k;
@@ -21,16 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  __exportStar(require("./validate.js"), exports);
24
- __exportStar(require("./resources.js"), exports);
25
- __exportStar(require("./events.js"), exports);
26
- __exportStar(require("./snapshot.js"), exports);
27
- __exportStar(require("./binding.js"), exports);
28
- __exportStar(require("./deployments.js"), exports);
29
- __exportStar(require("./presence.js"), exports);
30
- __exportStar(require("./docs.js"), exports);
31
24
  __exportStar(require("./content.js"), exports);
32
25
  __exportStar(require("./protection.js"), exports);
33
- __exportStar(require("./frames/stream.js"), exports);
34
- __exportStar(require("./frames/gateway.js"), exports);
35
26
  __exportStar(require("./frames/tunnel.js"), exports);
36
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,iDAA+B;AAC/B,8CAA4B;AAC5B,gDAA8B;AAC9B,+CAA6B;AAC7B,mDAAiC;AACjC,gDAA8B;AAC9B,4CAA0B;AAC1B,+CAA6B;AAC7B,kDAAgC;AAChC,qDAAmC;AACnC,sDAAoC;AACpC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,+CAA6B;AAC7B,kDAAgC;AAChC,qDAAmC"}
@@ -3,11 +3,11 @@
3
3
  * Shared validation vocabulary for every contract in this package.
4
4
  *
5
5
  * Validators never throw on bad wire data — a peer being wrong is an
6
- * expected condition, not an exception (local-live-protocol.md: unknown
7
- * frames mean "the other end is older"). They return a `Checked<T>` so
8
- * callers must look at the outcome, and every failure message is
9
- * example-first: it states what a correct value looks like before saying
10
- * what was wrong (see PURPOSE.md axiom on error shape).
6
+ * expected condition, not an exception (an unknown frame means the other
7
+ * end is older). They return a `Checked<T>` so callers must look at the
8
+ * outcome, and every failure message is example-first: it states what a
9
+ * correct value looks like before saying what was wrong (see PURPOSE.md
10
+ * axiom on error shape).
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.isSeq = exports.isNonEmptyString = exports.isRecord = exports.failShape = exports.fail = exports.pass = void 0;
package/dist-cjs/index.js CHANGED
@@ -4,9 +4,10 @@
4
4
  *
5
5
  * Portable layers, one rule each:
6
6
  *
7
- * - `contracts/` every wire shape and identity rule, as types + validators
8
- * - `machines/` the protocol's behavior, as pure state machines
7
+ * - `contracts/` the wire shapes a host still speaks, as types + validators
8
+ * - `entities/` identity, version, lifecycle, and codec laws
9
9
  * - `records/` the entity Record, local Outbox, authority, and Inbox laws
10
+ * - `apply/` the Apply/Verify rail
10
11
  * - `steps.ts` long whole-graph passes written as steps a host can pace
11
12
  *
12
13
  * Start at PURPOSE.md for the axioms; docs/ holds the normative specs.
@@ -28,7 +29,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
29
  Object.defineProperty(exports, "__esModule", { value: true });
29
30
  __exportStar(require("./steps.js"), exports);
30
31
  __exportStar(require("./contracts/index.js"), exports);
31
- __exportStar(require("./machines/index.js"), exports);
32
32
  __exportStar(require("./entities/index.js"), exports);
33
33
  __exportStar(require("./watching/index.js"), exports);
34
34
  __exportStar(require("./detection/index.js"), exports);
@@ -37,7 +37,6 @@ __exportStar(require("./apply/index.js"), exports);
37
37
  __exportStar(require("./registration/index.js"), exports);
38
38
  __exportStar(require("./files/index.js"), exports);
39
39
  __exportStar(require("./transfer/index.js"), exports);
40
- __exportStar(require("./merge/index.js"), exports);
41
40
  __exportStar(require("./workspace/index.js"), exports);
42
41
  __exportStar(require("./sharing/index.js"), exports);
43
42
  __exportStar(require("./history/index.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,uDAAqC;AACrC,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AACjC,0DAAwC;AACxC,mDAAiC;AACjC,sDAAoC;AACpC,mDAAiC;AACjC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,iDAA+B;AAC/B,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,uDAAqC;AACrC,sDAAoC;AACpC,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AACjC,0DAAwC;AACxC,mDAAiC;AACjC,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,iDAA+B;AAC/B,mDAAiC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/live",
3
- "version": "0.2.81-main.41713043931",
3
+ "version": "0.2.81-main.41725828860",
4
4
  "description": "Portable realtime SDK for Amalgm — wire contracts, mutation discipline, and delivery state machines behind host-injected adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist-cjs/index.js",
@@ -20,18 +20,6 @@
20
20
  "require": "./dist-cjs/index.js",
21
21
  "default": "./dist/index.js"
22
22
  },
23
- "./contracts": {
24
- "types": "./dist/contracts/index.d.ts",
25
- "import": "./dist/contracts/index.js",
26
- "require": "./dist-cjs/contracts/index.js",
27
- "default": "./dist/contracts/index.js"
28
- },
29
- "./machines": {
30
- "types": "./dist/machines/index.d.ts",
31
- "import": "./dist/machines/index.js",
32
- "require": "./dist-cjs/machines/index.js",
33
- "default": "./dist/machines/index.js"
34
- },
35
23
  "./history": {
36
24
  "types": "./dist/history/index.d.ts",
37
25
  "import": "./dist/history/index.js",
@@ -56,12 +44,6 @@
56
44
  "require": "./dist-cjs/registration/index.js",
57
45
  "default": "./dist/registration/index.js"
58
46
  },
59
- "./watching": {
60
- "types": "./dist/watching/index.d.ts",
61
- "import": "./dist/watching/index.js",
62
- "require": "./dist-cjs/watching/index.js",
63
- "default": "./dist/watching/index.js"
64
- },
65
47
  "./detection": {
66
48
  "types": "./dist/detection/index.d.ts",
67
49
  "import": "./dist/detection/index.js",
@@ -74,24 +56,12 @@
74
56
  "require": "./dist-cjs/records/index.js",
75
57
  "default": "./dist/records/index.js"
76
58
  },
77
- "./apply": {
78
- "types": "./dist/apply/index.d.ts",
79
- "import": "./dist/apply/index.js",
80
- "require": "./dist-cjs/apply/index.js",
81
- "default": "./dist/apply/index.js"
82
- },
83
59
  "./files": {
84
60
  "types": "./dist/files/index.d.ts",
85
61
  "import": "./dist/files/index.js",
86
62
  "require": "./dist-cjs/files/index.js",
87
63
  "default": "./dist/files/index.js"
88
64
  },
89
- "./transfer": {
90
- "types": "./dist/transfer/index.d.ts",
91
- "import": "./dist/transfer/index.js",
92
- "require": "./dist-cjs/transfer/index.js",
93
- "default": "./dist/transfer/index.js"
94
- },
95
65
  "./drive": {
96
66
  "types": "./dist/drive/index.d.ts",
97
67
  "import": "./dist/drive/index.js",
@@ -113,7 +83,6 @@
113
83
  "certification:release": "node certification/src/release.mjs prepare --profile certification",
114
84
  "certification:preflight": "node certification/src/release.mjs preflight",
115
85
  "test": "npm run build && node --test \"tests/**/*.test.js\"",
116
- "test:parity": "npm run build && node --test \"tests/parity/**/*.test.js\"",
117
86
  "resolve": "node scripts/release/resolve.mjs",
118
87
  "release:admit": "node scripts/release/package.mjs admit",
119
88
  "release:prepare": "node scripts/release/package.mjs prepare",
@@ -143,11 +112,11 @@
143
112
  "dependencies": {
144
113
  "@amalgm/core": "0.5.1-main.41264319540"
145
114
  },
146
- "gitHead": "6c177b271304b3793a9b9fa98f41c53c8cd8d20c",
115
+ "gitHead": "0ef8378b46c57381cb579c83e91600edd5688f7d",
147
116
  "amalgmSource": {
148
117
  "repository": "amalgm-inc/amalgm-live",
149
118
  "branch": "main",
150
- "commit": "6c177b271304b3793a9b9fa98f41c53c8cd8d20c",
151
- "occurrence": "41713043931"
119
+ "commit": "0ef8378b46c57381cb579c83e91600edd5688f7d",
120
+ "occurrence": "41725828860"
152
121
  }
153
122
  }
@@ -1,50 +0,0 @@
1
- /**
2
- * The binding — `live.bind(surface, channel)` (realtime-sdk.md).
3
- *
4
- * The surface knows what the user is looking at and what counts as one
5
- * edit. The channel identifies the shared thing and its delivery class.
6
- * The binding moves changes both ways and exposes honest lifecycle state:
7
- * a socket being open is never `live` (axiom 7).
8
- */
9
- /** Delivery classes (realtime-sdk.md §6). Media setup shares the binding; media packets never ride the durable log. */
10
- export type DeliveryClass = 'durable' | 'ephemeral' | 'media';
11
- /** A channel is a stable reference, not a socket. Authority and permissions come from the authenticated resource record — never from client fields. */
12
- export interface LiveChannelRef {
13
- readonly id: string;
14
- /** Must match the surface contract, e.g. "text-yjs@1". */
15
- readonly contract: string;
16
- readonly delivery: DeliveryClass;
17
- }
18
- /**
19
- * Connection lifecycle vocabulary (realtime-sdk.md §7). `live` means the
20
- * snapshot is applied AND ordered delivery is confirmed; `degraded` means
21
- * delivery works through a slower fallback (e.g. gateway poll).
22
- */
23
- export declare const BINDING_STATES: readonly ["connecting", "hydrating", "live", "degraded", "reconnecting", "blocked", "revoked"];
24
- export type BindingState = (typeof BINDING_STATES)[number];
25
- export interface ApplyContext {
26
- /** True while a snapshot install is in progress; surfaces must not echo. */
27
- readonly hydrating: boolean;
28
- }
29
- export interface SnapshotContext {
30
- /** Why the snapshot is being installed: first hydration or gap recovery. */
31
- readonly reason: 'hydration' | 'recovery';
32
- }
33
- /**
34
- * A surface is an adapter over a real interactive UI — not a React
35
- * component type, not a transport client (realtime-sdk.md §1). It defines
36
- * the edit boundary, emits exactly one operation per edit, applies remote
37
- * operations in place, and never echoes a remotely applied operation back
38
- * as a new local edit.
39
- */
40
- export interface LiveSurface<Snapshot, Operation, Presence = never> {
41
- readonly contract: string;
42
- observeEdits(emit: (operation: Operation) => void): () => void;
43
- /** Durable surfaces may finish local materialization asynchronously. */
44
- applyRemote(operation: Operation, context: ApplyContext): void | Promise<void>;
45
- /** Initial hydration or recovery only — never the normal response to a remote edit. */
46
- applySnapshot(snapshot: Snapshot, context: SnapshotContext): void | Promise<void>;
47
- observePresence?(emit: (presence: Presence | null) => void): () => void;
48
- applyPresence?(participantId: string, presence: Presence | null): void;
49
- }
50
- //# sourceMappingURL=binding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../src/contracts/binding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uHAAuH;AACvH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE9D,uJAAuJ;AACvJ,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,gGAQjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;CAC3C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,YAAY,CAAC,IAAI,EAAE,CAAC,SAAS,EA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