@cello-protocol/daemon 0.0.161 → 0.0.163

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 (65) hide show
  1. package/dist/daemon.js +15 -5
  2. package/dist/daemon.js.map +1 -1
  3. package/dist/document-ack-inbound.d.ts +8 -1
  4. package/dist/document-ack-inbound.d.ts.map +1 -1
  5. package/dist/document-ack-inbound.js +31 -8
  6. package/dist/document-ack-inbound.js.map +1 -1
  7. package/dist/document-amendment-store.d.ts +72 -0
  8. package/dist/document-amendment-store.d.ts.map +1 -0
  9. package/dist/document-amendment-store.js +151 -0
  10. package/dist/document-amendment-store.js.map +1 -0
  11. package/dist/document-control-notifier.d.ts +29 -0
  12. package/dist/document-control-notifier.d.ts.map +1 -1
  13. package/dist/document-control-notifier.js +62 -6
  14. package/dist/document-control-notifier.js.map +1 -1
  15. package/dist/document-delivery-transport.d.ts +2 -1
  16. package/dist/document-delivery-transport.d.ts.map +1 -1
  17. package/dist/document-delivery-transport.js +1 -1
  18. package/dist/document-delivery-transport.js.map +1 -1
  19. package/dist/document-delivery.d.ts +6 -1
  20. package/dist/document-delivery.d.ts.map +1 -1
  21. package/dist/document-delivery.js +167 -201
  22. package/dist/document-delivery.js.map +1 -1
  23. package/dist/document-frame-router.d.ts +15 -1
  24. package/dist/document-frame-router.d.ts.map +1 -1
  25. package/dist/document-frame-router.js +22 -1
  26. package/dist/document-frame-router.js.map +1 -1
  27. package/dist/document-gate.js +1 -1
  28. package/dist/document-gate.js.map +1 -1
  29. package/dist/document-handlers.d.ts.map +1 -1
  30. package/dist/document-handlers.js +649 -5
  31. package/dist/document-handlers.js.map +1 -1
  32. package/dist/document-handshake.d.ts +13 -0
  33. package/dist/document-handshake.d.ts.map +1 -1
  34. package/dist/document-handshake.js +24 -0
  35. package/dist/document-handshake.js.map +1 -1
  36. package/dist/document-inbound.d.ts +12 -0
  37. package/dist/document-inbound.d.ts.map +1 -1
  38. package/dist/document-inbound.js +141 -10
  39. package/dist/document-inbound.js.map +1 -1
  40. package/dist/document-join-store.d.ts +80 -0
  41. package/dist/document-join-store.d.ts.map +1 -0
  42. package/dist/document-join-store.js +197 -0
  43. package/dist/document-join-store.js.map +1 -0
  44. package/dist/document-layer.d.ts +52 -2
  45. package/dist/document-layer.d.ts.map +1 -1
  46. package/dist/document-layer.js +457 -12
  47. package/dist/document-layer.js.map +1 -1
  48. package/dist/document-lifecycle.d.ts +32 -1
  49. package/dist/document-lifecycle.d.ts.map +1 -1
  50. package/dist/document-lifecycle.js +88 -20
  51. package/dist/document-lifecycle.js.map +1 -1
  52. package/dist/document-publish.d.ts +7 -0
  53. package/dist/document-publish.d.ts.map +1 -1
  54. package/dist/document-publish.js +20 -4
  55. package/dist/document-publish.js.map +1 -1
  56. package/dist/document-rejection.js +1 -1
  57. package/dist/document-rejection.js.map +1 -1
  58. package/dist/document-store.d.ts +97 -4
  59. package/dist/document-store.d.ts.map +1 -1
  60. package/dist/document-store.js +335 -21
  61. package/dist/document-store.js.map +1 -1
  62. package/dist/vocabulary.d.ts.map +1 -1
  63. package/dist/vocabulary.js +2 -0
  64. package/dist/vocabulary.js.map +1 -1
  65. package/package.json +5 -5
package/dist/daemon.js CHANGED
@@ -2512,7 +2512,7 @@ async function startDaemonHoldingLock(config, singletonLock) {
2512
2512
  // this as a completed endorsement would promise three steps that have not happened.
2513
2513
  guidance: res.storedWarning
2514
2514
  ? `Submitted for '${sel.name}'. ${res.storedWarning}`
2515
- : `Submitted for '${sel.name}'. The portal will scan and mint it, then the subject must ACCEPT it before it is visible to anyone a signal they have not accepted is inert. Nothing here is final until they decide.`,
2515
+ : `Submitted for '${sel.name}'. The portal will scan and mint it, and it stays invisible to everyone unless the subject ACCEPTS it they are free to refuse, and a signal they have not accepted is inert. Nothing here is final until they decide.`,
2516
2516
  };
2517
2517
  });
2518
2518
  /**
@@ -3407,6 +3407,10 @@ async function startDaemonHoldingLock(config, singletonLock) {
3407
3407
  owners: () => loadedAgents
3408
3408
  .filter((a) => a.pubkey)
3409
3409
  .map((a) => ({ agentName: a.name, ownerAgentId: a.pubkey.toLowerCase() })),
3410
+ // DOD-MP-CONTROL-N-1 — the ONE implementation, on the layer, shared with every test fixture.
3411
+ // A closure here instead would be untested by construction and hand-copied into fixtures
3412
+ // that cannot disagree with it, which is exactly how the original defect survived.
3413
+ holders: (ownerAgentId, documentId) => documentLayer.controlHolders(ownerAgentId, documentId),
3410
3414
  sign: async (agentName, tbs) => {
3411
3415
  const provider = keyProviders.get(agentName);
3412
3416
  if (!provider)
@@ -3559,7 +3563,7 @@ async function startDaemonHoldingLock(config, singletonLock) {
3559
3563
  // The owner KEY, not the agent name — every document row is scoped by our own pubkey hex
3560
3564
  // (M14-D5), and the store query behind this reads that column. Passing the name here
3561
3565
  // returns no rows and the wait times out on every delivery.
3562
- awaitAck: async (envelopeHash, timeoutMs) => {
3566
+ awaitAck: async (envelopeHash, expectedAckerAgentId, timeoutMs) => {
3563
3567
  const ownerKey = documentOwnerKeyFor(agentName);
3564
3568
  if (ownerKey === null) {
3565
3569
  // NOT "the peer stayed silent". `false` means the grace expired with no answer, and the
@@ -3571,7 +3575,7 @@ async function startDaemonHoldingLock(config, singletonLock) {
3571
3575
  logger.error("document.delivery.ack_wait_unwired", { agentName, envelopeHash });
3572
3576
  return null;
3573
3577
  }
3574
- return documentLayer.awaitAck(ownerKey, envelopeHash, timeoutMs);
3578
+ return documentLayer.awaitAck(ownerKey, envelopeHash, expectedAckerAgentId, timeoutMs);
3575
3579
  },
3576
3580
  drainHeld: async (sessionId, correlationId) => {
3577
3581
  // ONLY WHEN THERE IS A GAP. `sealReadiness` already answers exactly this question, and
@@ -3615,6 +3619,7 @@ async function startDaemonHoldingLock(config, singletonLock) {
3615
3619
  // to go: without the inbound path a peer's answer is unroutable, and without the delivery worker a
3616
3620
  // published update never leaves.
3617
3621
  const documentPublish = new DocumentPublish({
3622
+ holdersFor: (ownerAgentId, documentId) => documentLayer.holdersFor(ownerAgentId, documentId),
3618
3623
  store: documentLayer.store,
3619
3624
  engine: documentLayer.engine,
3620
3625
  logger,
@@ -3702,8 +3707,13 @@ async function startDaemonHoldingLock(config, singletonLock) {
3702
3707
  if (ownerAgentId === null)
3703
3708
  continue;
3704
3709
  agentsSwept++;
3705
- const peerFor = (documentId) => documentLayer.store.getDocument(ownerAgentId, documentId)?.peerAgentId ?? null;
3706
- const result = await documentDeliveryFor(agentName).tick(ownerAgentId, peerFor, Date.now(), {
3710
+ // FANOUT-1: targets are the DERIVED holders minus ourselves — never per-sender
3711
+ // config, never the genesis peer column (§7-1's silent-divergence hazard).
3712
+ const holdersFor = (documentId) => {
3713
+ const holders = documentLayer.holdersFor(ownerAgentId, documentId);
3714
+ return holders === null ? null : holders.filter((h) => h !== ownerAgentId);
3715
+ };
3716
+ const result = await documentDeliveryFor(agentName).tick(ownerAgentId, holdersFor, Date.now(), {
3707
3717
  senderAgentId: ownerAgentId,
3708
3718
  });
3709
3719
  attempted += result.attempted;