@moltzap/client 2026.529.0 → 2026.717.0
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.
- package/dist/agent-client.d.ts +2 -65
- package/dist/agent-client.d.ts.map +1 -1
- package/dist/agent-client.js +1 -286
- package/dist/agent-client.js.map +1 -1
- package/dist/app-client.d.ts +3 -0
- package/dist/app-client.d.ts.map +1 -0
- package/dist/app-client.js +2 -0
- package/dist/app-client.js.map +1 -0
- package/dist/auth.d.ts +6 -15
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +12 -16
- package/dist/auth.js.map +1 -1
- package/dist/channel-base/format-cross-conv.d.ts +10 -15
- package/dist/channel-base/format-cross-conv.d.ts.map +1 -1
- package/dist/channel-base/format-cross-conv.js +10 -15
- package/dist/channel-base/format-cross-conv.js.map +1 -1
- package/dist/channel-base/format-group-block.d.ts +8 -10
- package/dist/channel-base/format-group-block.d.ts.map +1 -1
- package/dist/channel-base/format-group-block.js +8 -10
- package/dist/channel-base/format-group-block.js.map +1 -1
- package/dist/channel-base/index.d.ts +3 -62
- package/dist/channel-base/index.d.ts.map +1 -1
- package/dist/channel-base/index.js +2 -65
- package/dist/channel-base/index.js.map +1 -1
- package/dist/channel-base/lease-guard.d.ts +0 -2
- package/dist/channel-base/lease-guard.d.ts.map +1 -1
- package/dist/channel-base/lease-guard.js +0 -2
- package/dist/channel-base/lease-guard.js.map +1 -1
- package/dist/channel-base/lease-store.d.ts +2 -3
- package/dist/channel-base/lease-store.d.ts.map +1 -1
- package/dist/channel-base/lease-store.js +2 -3
- package/dist/channel-base/lease-store.js.map +1 -1
- package/dist/channel-base/lease.d.ts +25 -31
- package/dist/channel-base/lease.d.ts.map +1 -1
- package/dist/channel-base/lease.js +29 -45
- package/dist/channel-base/lease.js.map +1 -1
- package/dist/channel-core-enrichment.d.ts +1 -1
- package/dist/channel-core-enrichment.d.ts.map +1 -1
- package/dist/channel-core-test-support.d.ts +17 -11
- package/dist/channel-core-test-support.d.ts.map +1 -1
- package/dist/channel-core-test-support.js +5 -6
- package/dist/channel-core-test-support.js.map +1 -1
- package/dist/channel-core.d.ts +24 -29
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +18 -42
- package/dist/channel-core.js.map +1 -1
- package/dist/cli/commands/agents.d.ts +3 -6
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +14 -50
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/contacts.d.ts +5 -6
- package/dist/cli/commands/contacts.d.ts.map +1 -1
- package/dist/cli/commands/contacts.js +15 -43
- package/dist/cli/commands/contacts.js.map +1 -1
- package/dist/cli/commands/conversations.d.ts +8 -18
- package/dist/cli/commands/conversations.d.ts.map +1 -1
- package/dist/cli/commands/conversations.js +14 -65
- package/dist/cli/commands/conversations.js.map +1 -1
- package/dist/cli/commands/messages.d.ts +13 -35
- package/dist/cli/commands/messages.d.ts.map +1 -1
- package/dist/cli/commands/messages.js +21 -46
- package/dist/cli/commands/messages.js.map +1 -1
- package/dist/cli/commands/register.d.ts +10 -12
- package/dist/cli/commands/register.d.ts.map +1 -1
- package/dist/cli/commands/register.js +47 -133
- package/dist/cli/commands/register.js.map +1 -1
- package/dist/cli/commands/send.d.ts +23 -36
- package/dist/cli/commands/send.d.ts.map +1 -1
- package/dist/cli/commands/send.js +25 -72
- package/dist/cli/commands/send.js.map +1 -1
- package/dist/cli/commands/start.d.ts +10 -124
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +28 -510
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.d.ts +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +8 -9
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/test-transport.d.ts +12 -5
- package/dist/cli/commands/test-transport.d.ts.map +1 -1
- package/dist/cli/commands/test-transport.js +15 -15
- package/dist/cli/commands/test-transport.js.map +1 -1
- package/dist/cli/index.js +13 -40
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +4 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +9 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/socket-client.d.ts +7 -14
- package/dist/cli/socket-client.d.ts.map +1 -1
- package/dist/cli/socket-client.js +15 -38
- package/dist/cli/socket-client.js.map +1 -1
- package/dist/cli/transport.d.ts +53 -116
- package/dist/cli/transport.d.ts.map +1 -1
- package/dist/cli/transport.js +45 -295
- package/dist/cli/transport.js.map +1 -1
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +35 -0
- package/dist/config.js.map +1 -0
- package/dist/config.test-utils.d.ts +13 -0
- package/dist/config.test-utils.d.ts.map +1 -0
- package/dist/config.test-utils.js +46 -0
- package/dist/config.test-utils.js.map +1 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -12
- package/dist/index.js.map +1 -1
- package/dist/local-daemon-rpc.d.ts +259 -8
- package/dist/local-daemon-rpc.d.ts.map +1 -1
- package/dist/local-daemon-rpc.js +189 -12
- package/dist/local-daemon-rpc.js.map +1 -1
- package/dist/{runtime/local-history.d.ts → local-history.d.ts} +16 -21
- package/dist/local-history.d.ts.map +1 -0
- package/dist/{runtime/local-history.js → local-history.js} +16 -21
- package/dist/local-history.js.map +1 -0
- package/dist/local-paths.d.ts +0 -2
- package/dist/local-paths.d.ts.map +1 -1
- package/dist/local-paths.js +0 -4
- package/dist/local-paths.js.map +1 -1
- package/dist/local-socket-server.d.ts +22 -0
- package/dist/local-socket-server.d.ts.map +1 -0
- package/dist/{runtime/local-socket-server.js → local-socket-server.js} +4 -9
- package/dist/local-socket-server.js.map +1 -0
- package/dist/message-rendering.d.ts +3 -0
- package/dist/message-rendering.d.ts.map +1 -0
- package/dist/message-rendering.js +7 -0
- package/dist/message-rendering.js.map +1 -0
- package/dist/notification/__tests__/{snapshot-semantics.types-check.d.ts → subscribe-signatures.types-check.d.ts} +1 -1
- package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts.map +1 -0
- package/dist/notification/__tests__/subscribe-signatures.types-check.js +55 -0
- package/dist/notification/__tests__/subscribe-signatures.types-check.js.map +1 -0
- package/dist/notification/errors.d.ts +18 -6
- package/dist/notification/errors.d.ts.map +1 -1
- package/dist/notification/errors.js +13 -15
- package/dist/notification/errors.js.map +1 -1
- package/dist/notification/index.d.ts +5 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/index.js +5 -0
- package/dist/notification/index.js.map +1 -0
- package/dist/notification/stream.d.ts +33 -49
- package/dist/notification/stream.d.ts.map +1 -1
- package/dist/notification/stream.js +33 -76
- package/dist/notification/stream.js.map +1 -1
- package/dist/pagination.d.ts +20 -10
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +8 -9
- package/dist/pagination.js.map +1 -1
- package/dist/profile.d.ts +92 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +149 -0
- package/dist/profile.js.map +1 -0
- package/dist/refs.d.ts.map +1 -0
- package/dist/refs.js.map +1 -0
- package/dist/service-archive-purge.d.ts +2 -1
- package/dist/service-archive-purge.d.ts.map +1 -1
- package/dist/service-archive-purge.js.map +1 -1
- package/dist/{runtime/service-helpers.d.ts → service-helpers.d.ts} +5 -11
- package/dist/service-helpers.d.ts.map +1 -0
- package/dist/{runtime/service-helpers.js → service-helpers.js} +2 -9
- package/dist/service-helpers.js.map +1 -0
- package/dist/service-local-daemon.d.ts +22 -0
- package/dist/service-local-daemon.d.ts.map +1 -0
- package/dist/service-local-daemon.js +185 -0
- package/dist/service-local-daemon.js.map +1 -0
- package/dist/service.d.ts +65 -57
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +205 -156
- package/dist/service.js.map +1 -1
- package/dist/test-utils/channel-service-fixture.d.ts +3 -2
- package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
- package/dist/test-utils/channel-service-fixture.js.map +1 -1
- package/dist/test-utils/fake-service.d.ts +26 -18
- package/dist/test-utils/fake-service.d.ts.map +1 -1
- package/dist/test-utils/fake-service.js +28 -42
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/ids.d.ts +3 -1
- package/dist/test-utils/ids.d.ts.map +1 -1
- package/dist/test-utils/ids.js.map +1 -1
- package/dist/test-utils/index.d.ts +9 -2
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +8 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/standalone-provisioning.d.ts +17 -0
- package/dist/test-utils/standalone-provisioning.d.ts.map +1 -0
- package/dist/test-utils/standalone-provisioning.js +14 -0
- package/dist/test-utils/standalone-provisioning.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +39 -17
- package/dist/auth.test.d.ts +0 -2
- package/dist/auth.test.d.ts.map +0 -1
- package/dist/auth.test.js +0 -121
- package/dist/auth.test.js.map +0 -1
- package/dist/channel-core-context.test.d.ts +0 -2
- package/dist/channel-core-context.test.d.ts.map +0 -1
- package/dist/channel-core-context.test.js +0 -342
- package/dist/channel-core-context.test.js.map +0 -1
- package/dist/channel-core-dispatch.test.d.ts +0 -2
- package/dist/channel-core-dispatch.test.d.ts.map +0 -1
- package/dist/channel-core-dispatch.test.js +0 -557
- package/dist/channel-core-dispatch.test.js.map +0 -1
- package/dist/channel-core.test.d.ts +0 -2
- package/dist/channel-core.test.d.ts.map +0 -1
- package/dist/channel-core.test.js +0 -232
- package/dist/channel-core.test.js.map +0 -1
- package/dist/cli/__tests__/cli-multi-agent.int.test.d.ts +0 -2
- package/dist/cli/__tests__/cli-multi-agent.int.test.d.ts.map +0 -1
- package/dist/cli/__tests__/cli-multi-agent.int.test.js +0 -132
- package/dist/cli/__tests__/cli-multi-agent.int.test.js.map +0 -1
- package/dist/cli/commands/invite.d.ts +0 -7
- package/dist/cli/commands/invite.d.ts.map +0 -1
- package/dist/cli/commands/invite.js +0 -11
- package/dist/cli/commands/invite.js.map +0 -1
- package/dist/cli/commands/messages.test.d.ts +0 -2
- package/dist/cli/commands/messages.test.d.ts.map +0 -1
- package/dist/cli/commands/messages.test.js +0 -99
- package/dist/cli/commands/messages.test.js.map +0 -1
- package/dist/cli/commands/ping.d.ts +0 -7
- package/dist/cli/commands/ping.d.ts.map +0 -1
- package/dist/cli/commands/ping.js +0 -37
- package/dist/cli/commands/ping.js.map +0 -1
- package/dist/cli/commands/register.test.d.ts +0 -2
- package/dist/cli/commands/register.test.d.ts.map +0 -1
- package/dist/cli/commands/register.test.js +0 -91
- package/dist/cli/commands/register.test.js.map +0 -1
- package/dist/cli/commands/send.test.d.ts +0 -2
- package/dist/cli/commands/send.test.d.ts.map +0 -1
- package/dist/cli/commands/send.test.js +0 -59
- package/dist/cli/commands/send.test.js.map +0 -1
- package/dist/cli/commands/start.test.d.ts +0 -2
- package/dist/cli/commands/start.test.d.ts.map +0 -1
- package/dist/cli/commands/start.test.js +0 -624
- package/dist/cli/commands/start.test.js.map +0 -1
- package/dist/cli/commands/whoami.d.ts +0 -8
- package/dist/cli/commands/whoami.d.ts.map +0 -1
- package/dist/cli/commands/whoami.js +0 -28
- package/dist/cli/commands/whoami.js.map +0 -1
- package/dist/cli/config.d.ts +0 -66
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -148
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/config.test.d.ts +0 -2
- package/dist/cli/config.test.d.ts.map +0 -1
- package/dist/cli/config.test.js +0 -89
- package/dist/cli/config.test.js.map +0 -1
- package/dist/cli/http-client.d.ts +0 -17
- package/dist/cli/http-client.d.ts.map +0 -1
- package/dist/cli/http-client.js +0 -38
- package/dist/cli/http-client.js.map +0 -1
- package/dist/cli/profile.d.ts +0 -126
- package/dist/cli/profile.d.ts.map +0 -1
- package/dist/cli/profile.js +0 -231
- package/dist/cli/profile.js.map +0 -1
- package/dist/cli/profile.test.d.ts +0 -2
- package/dist/cli/profile.test.d.ts.map +0 -1
- package/dist/cli/profile.test.js +0 -369
- package/dist/cli/profile.test.js.map +0 -1
- package/dist/cli/transport.test.d.ts +0 -2
- package/dist/cli/transport.test.d.ts.map +0 -1
- package/dist/cli/transport.test.js +0 -312
- package/dist/cli/transport.test.js.map +0 -1
- package/dist/notification/__tests__/filter-equivalence.test.d.ts +0 -2
- package/dist/notification/__tests__/filter-equivalence.test.d.ts.map +0 -1
- package/dist/notification/__tests__/filter-equivalence.test.js +0 -123
- package/dist/notification/__tests__/filter-equivalence.test.js.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.test.d.ts +0 -2
- package/dist/notification/__tests__/snapshot-semantics.test.d.ts.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.test.js +0 -261
- package/dist/notification/__tests__/snapshot-semantics.test.js.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.types-check.d.ts.map +0 -1
- package/dist/notification/__tests__/snapshot-semantics.types-check.js +0 -62
- package/dist/notification/__tests__/snapshot-semantics.types-check.js.map +0 -1
- package/dist/pagination.test.d.ts +0 -2
- package/dist/pagination.test.d.ts.map +0 -1
- package/dist/pagination.test.js +0 -72
- package/dist/pagination.test.js.map +0 -1
- package/dist/runtime/close-info.d.ts +0 -84
- package/dist/runtime/close-info.d.ts.map +0 -1
- package/dist/runtime/close-info.js +0 -102
- package/dist/runtime/close-info.js.map +0 -1
- package/dist/runtime/close-info.test.d.ts +0 -2
- package/dist/runtime/close-info.test.d.ts.map +0 -1
- package/dist/runtime/close-info.test.js +0 -109
- package/dist/runtime/close-info.test.js.map +0 -1
- package/dist/runtime/errors.d.ts +0 -11
- package/dist/runtime/errors.d.ts.map +0 -1
- package/dist/runtime/errors.js +0 -41
- package/dist/runtime/errors.js.map +0 -1
- package/dist/runtime/errors.test.d.ts +0 -2
- package/dist/runtime/errors.test.d.ts.map +0 -1
- package/dist/runtime/errors.test.js +0 -79
- package/dist/runtime/errors.test.js.map +0 -1
- package/dist/runtime/frame.d.ts +0 -8
- package/dist/runtime/frame.d.ts.map +0 -1
- package/dist/runtime/frame.js +0 -12
- package/dist/runtime/frame.js.map +0 -1
- package/dist/runtime/frame.test.d.ts +0 -2
- package/dist/runtime/frame.test.d.ts.map +0 -1
- package/dist/runtime/frame.test.js +0 -59
- package/dist/runtime/frame.test.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -10
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js +0 -9
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/local-history.d.ts.map +0 -1
- package/dist/runtime/local-history.js.map +0 -1
- package/dist/runtime/local-service-commands.d.ts +0 -26
- package/dist/runtime/local-service-commands.d.ts.map +0 -1
- package/dist/runtime/local-service-commands.js +0 -29
- package/dist/runtime/local-service-commands.js.map +0 -1
- package/dist/runtime/local-socket-server.d.ts +0 -20
- package/dist/runtime/local-socket-server.d.ts.map +0 -1
- package/dist/runtime/local-socket-server.js.map +0 -1
- package/dist/runtime/refs.d.ts.map +0 -1
- package/dist/runtime/refs.js.map +0 -1
- package/dist/runtime/runtime.test.d.ts +0 -2
- package/dist/runtime/runtime.test.d.ts.map +0 -1
- package/dist/runtime/runtime.test.js +0 -37
- package/dist/runtime/runtime.test.js.map +0 -1
- package/dist/runtime/service-helpers.d.ts.map +0 -1
- package/dist/runtime/service-helpers.js.map +0 -1
- package/dist/runtime/service-teardown.d.ts +0 -5
- package/dist/runtime/service-teardown.d.ts.map +0 -1
- package/dist/runtime/service-teardown.js +0 -36
- package/dist/runtime/service-teardown.js.map +0 -1
- package/dist/runtime/service-teardown.test.d.ts +0 -2
- package/dist/runtime/service-teardown.test.d.ts.map +0 -1
- package/dist/runtime/service-teardown.test.js +0 -80
- package/dist/runtime/service-teardown.test.js.map +0 -1
- package/dist/runtime/subscribers.d.ts +0 -152
- package/dist/runtime/subscribers.d.ts.map +0 -1
- package/dist/runtime/subscribers.js +0 -222
- package/dist/runtime/subscribers.js.map +0 -1
- package/dist/service-socket-path.test.d.ts +0 -2
- package/dist/service-socket-path.test.d.ts.map +0 -1
- package/dist/service-socket-path.test.js +0 -87
- package/dist/service-socket-path.test.js.map +0 -1
- package/dist/service.test.d.ts +0 -2
- package/dist/service.test.d.ts.map +0 -1
- package/dist/service.test.js +0 -796
- package/dist/service.test.js.map +0 -1
- package/dist/test/index.d.ts +0 -47
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -39
- package/dist/test/index.js.map +0 -1
- package/dist/test-utils/conformance-adapter.d.ts +0 -40
- package/dist/test-utils/conformance-adapter.d.ts.map +0 -1
- package/dist/test-utils/conformance-adapter.js +0 -250
- package/dist/test-utils/conformance-adapter.js.map +0 -1
- package/dist/tm-client-test-support.d.ts +0 -184
- package/dist/tm-client-test-support.d.ts.map +0 -1
- package/dist/tm-client-test-support.js +0 -466
- package/dist/tm-client-test-support.js.map +0 -1
- package/dist/tm-client.d.ts +0 -269
- package/dist/tm-client.d.ts.map +0 -1
- package/dist/tm-client.js +0 -518
- package/dist/tm-client.js.map +0 -1
- package/dist/tm-client.test.d.ts +0 -2
- package/dist/tm-client.test.d.ts.map +0 -1
- package/dist/tm-client.test.js +0 -490
- package/dist/tm-client.test.js.map +0 -1
- /package/dist/{runtime/refs.d.ts → refs.d.ts} +0 -0
- /package/dist/{runtime/refs.js → refs.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-cross-conv.js","sourceRoot":"","sources":["../../src/channel-base/format-cross-conv.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"format-cross-conv.js","sourceRoot":"","sources":["../../src/channel-base/format-cross-conv.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAWvB,MAAM,sBAAsB,GAAG,gCAAgC,CAAC;AAChE,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAS7B,SAAS,gBAAgB,CACvB,OAAyB,EACzB,IAAqC;IAErC,OAAO;QACL,YAAY,EAAE,OAAO,CAAC,gBAAgB,IAAI,YAAY,OAAO,CAAC,UAAU,EAAE;QAC1E,MAAM,EAAE,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU;QACzE,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,QAAqC,EACrC,IAAqC;IAErC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,OAAO,GAAG,sBAAsB,iBAAiB,IAAI,CAAC,SAAS,CAC7D,KAAK,EACL,IAAI,EACJ,kBAAkB,CACnB,UAAU,CAAC;AACd,CAAC;AAED,SAAS,uBAAuB,CAC9B,QAAqC,EACrC,IAAqC;IAErC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC1D,MAAM,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvD,OAAO,oBAAoB,MAAM,mBAAmB,IAAI,WAAW,IAAI,KAAK,IAAI,YAAY,CAAC;IAC/F,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,YAAY,EAAE,GAAG,KAAK,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAqC,EACrC,IAE2E;IAE3E,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,aAAa;YAChB,OAAO,gBAAgB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACrE,KAAK,qBAAqB;YACxB,OAAO,uBAAuB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Channel-base group-block helpers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* and nanoclaw (gating the inline group-block render).
|
|
4
|
+
* `formatGroupBlock` renders the group block for nanoclaw. The shared
|
|
5
|
+
* type-narrowing predicate `getGroupFields` is consumed by openclaw
|
|
6
|
+
* (deriving `groupSubject` / `groupMembers` for the OpenClaw context) and
|
|
7
|
+
* nanoclaw (gating the group-block render).
|
|
9
8
|
*/
|
|
10
9
|
import type { EnrichedConversationMeta } from "../channel-core.js";
|
|
11
10
|
import type { CrossConvMarkup } from "./format-cross-conv.js";
|
|
@@ -25,13 +24,12 @@ export declare function getGroupFields(meta: EnrichedConversationMeta | undefine
|
|
|
25
24
|
* Returns the formatted group block.
|
|
26
25
|
*
|
|
27
26
|
* Markup variants:
|
|
28
|
-
* - `"xml-system-reminder"`:
|
|
29
|
-
*
|
|
27
|
+
* - `"xml-system-reminder"`: a `<system-reminder>` block with group
|
|
28
|
+
* name + participants (nanoclaw output).
|
|
30
29
|
* - `"json-header"`: empty string. Openclaw does not render a group block;
|
|
31
30
|
* it consumes `getGroupFields` directly to derive its OpenClaw-side
|
|
32
|
-
* `groupSubject` / `groupMembers` fields. The empty-string return
|
|
33
|
-
*
|
|
34
|
-
* fixtured output (see arch sub-issue #605 §3.5).
|
|
31
|
+
* `groupSubject` / `groupMembers` fields. The empty-string return makes
|
|
32
|
+
* "openclaw renders no group block" an explicit, fixtured output.
|
|
35
33
|
*
|
|
36
34
|
* Or pass a custom `formatter` callback.
|
|
37
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-group-block.d.ts","sourceRoot":"","sources":["../../src/channel-base/format-group-block.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"format-group-block.d.ts","sourceRoot":"","sources":["../../src/channel-base/format-group-block.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,MAAM,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,wBAAwB,GAAG,SAAS,GACzC,WAAW,GAAG,IAAI,CAGpB;AAgBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,IAAI,EACA;IAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GACpC;IAAE,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAA;CAAE,GACzC,MAAM,CAQR"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Channel-base group-block helpers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* and nanoclaw (gating the inline group-block render).
|
|
4
|
+
* `formatGroupBlock` renders the group block for nanoclaw. The shared
|
|
5
|
+
* type-narrowing predicate `getGroupFields` is consumed by openclaw
|
|
6
|
+
* (deriving `groupSubject` / `groupMembers` for the OpenClaw context) and
|
|
7
|
+
* nanoclaw (gating the group-block render).
|
|
9
8
|
*/
|
|
10
9
|
import { sanitizeForSystemReminder } from "../service.js";
|
|
11
10
|
const UNNAMED_GROUP_FALLBACK = "(unnamed)";
|
|
@@ -36,13 +35,12 @@ function formatXmlSystemReminder(fields) {
|
|
|
36
35
|
* Returns the formatted group block.
|
|
37
36
|
*
|
|
38
37
|
* Markup variants:
|
|
39
|
-
* - `"xml-system-reminder"`:
|
|
40
|
-
*
|
|
38
|
+
* - `"xml-system-reminder"`: a `<system-reminder>` block with group
|
|
39
|
+
* name + participants (nanoclaw output).
|
|
41
40
|
* - `"json-header"`: empty string. Openclaw does not render a group block;
|
|
42
41
|
* it consumes `getGroupFields` directly to derive its OpenClaw-side
|
|
43
|
-
* `groupSubject` / `groupMembers` fields. The empty-string return
|
|
44
|
-
*
|
|
45
|
-
* fixtured output (see arch sub-issue #605 §3.5).
|
|
42
|
+
* `groupSubject` / `groupMembers` fields. The empty-string return makes
|
|
43
|
+
* "openclaw renders no group block" an explicit, fixtured output.
|
|
46
44
|
*
|
|
47
45
|
* Or pass a custom `formatter` callback.
|
|
48
46
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-group-block.js","sourceRoot":"","sources":["../../src/channel-base/format-group-block.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"format-group-block.js","sourceRoot":"","sources":["../../src/channel-base/format-group-block.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAW1D,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAC3C,MAAM,wBAAwB,GAAG,eAAe,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,IAA0C;IAE1C,IAAI,IAAI,EAAE,IAAI,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;AAC9D,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAmB;IAClD,MAAM,QAAQ,GAAG,yBAAyB,CACxC,MAAM,CAAC,IAAI,IAAI,sBAAsB,CACtC,CAAC;IACF,MAAM,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IAC5E,OAAO;QACL,mBAAmB;QACnB,+BAA+B;QAC/B,eAAe,QAAQ,EAAE;QACzB,iBAAiB,MAAM,CAAC,YAAY,CAAC,MAAM,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,wBAAwB,EAAE;QAC1G,oBAAoB;KACrB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAmB,EACnB,IAE0C;IAE1C,IAAI,WAAW,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACvD,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,qBAAqB;YACxB,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACzC,KAAK,aAAa;YAChB,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,68 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file `@moltzap/client/channel-base` — shared scaffolding for channel
|
|
3
|
-
* adapters (`@moltzap/openclaw-channel`, `@moltzap/claude-code-channel`,
|
|
4
|
-
* `@moltzap/nanoclaw-channel`).
|
|
5
|
-
*
|
|
6
|
-
* The subpath canonicalizes three things across the three channels:
|
|
7
|
-
* (1) the `LeaseAlreadyConsumed` tagged error and its projection
|
|
8
|
-
* helpers, (2) the lease-lifecycle primitives (`LeaseStore` /
|
|
9
|
-
* `LeaseGuard`), and (3) the markup-parameterized cross-conv and
|
|
10
|
-
* group-block formatters. Direct `@moltzap/client` consumers
|
|
11
|
-
* (`server-core`, `runtimes`, `test-utils`) see no API surface
|
|
12
|
-
* change — the subpath is opt-in.
|
|
13
|
-
*
|
|
14
|
-
* Surfacing path differs per host contract:
|
|
15
|
-
*
|
|
16
|
-
* - **claude-code** — raises via `server.ts → toolErrorResult`.
|
|
17
|
-
* - **openclaw** — invokes the optional `onLeaseConsumed` side-channel callback (deliver's wire return type is `PromiseLike<boolean>` and cannot carry an Effect error).
|
|
18
|
-
* - **nanoclaw** — raises the typed error on the Effect channel.
|
|
19
|
-
*
|
|
20
|
-
* Common lease-projection path:
|
|
21
|
-
*
|
|
22
|
-
* ```mermaid
|
|
23
|
-
* sequenceDiagram
|
|
24
|
-
* participant Host
|
|
25
|
-
* participant Channel
|
|
26
|
-
* participant Core as MoltZapChannelCore
|
|
27
|
-
* participant Server.
|
|
28
|
-
*
|
|
29
|
-
* Host->>Channel: reply / sendMessage
|
|
30
|
-
* Channel->>Core: sendReply(conv, text, {dispatchLeaseId})
|
|
31
|
-
* Core->>Server: messages/send
|
|
32
|
-
* Server-->>Core: ForbiddenError data.reason LeaseInvalid
|
|
33
|
-
* Note over Channel,Core: catchLeaseInvalid reads Clock.currentTimeMillis<br>then projectLeaseInvalid stamps LeaseAlreadyConsumed
|
|
34
|
-
* Core-->>Channel: Effect.fail(LeaseAlreadyConsumed)
|
|
35
|
-
* alt claude-code
|
|
36
|
-
* Channel->>Host: toolErrorResult
|
|
37
|
-
* else openclaw
|
|
38
|
-
* Channel->>Host: onLeaseConsumed callback, deliver returns false
|
|
39
|
-
* else nanoclaw
|
|
40
|
-
* Channel->>Host: Effect raises LeaseAlreadyConsumed
|
|
41
|
-
* end
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* The `_tag === "LeaseAlreadyConsumed"` forward-compat arm of
|
|
45
|
-
* `projectLeaseInvalid` covers a future server that emits the
|
|
46
|
-
* canonical tag in `data` directly; no channel-side change required.
|
|
47
|
-
*
|
|
48
|
-
* Primitives live one-per-file:
|
|
49
|
-
*
|
|
50
|
-
* - `lease.ts` — `LeaseAlreadyConsumed`, `projectLeaseInvalid`, `catchLeaseInvalid` (Effect-pipe wrapper at every `core.sendReply(...)` boundary).
|
|
51
|
-
* - `lease-store.ts` — `LeaseStore<HostKey, T>`: per-key tracker with `remember` / `peek` / `consume` / `clear`. Nanoclaw stores `(jid, dispatchLeaseId)` and `peek`s deliberately on retries so the server returns CONSUMED rather than accepting a duplicate send.
|
|
52
|
-
* - `lease-guard.ts` — `LeaseGuard`: single-shot dup-reply detector scoped to one inbound message. `consume()` returns `true` exactly once.
|
|
53
|
-
* - `format-cross-conv.ts` — markup-parameterized formatter (`json-header` for openclaw, `xml-system-reminder` for nanoclaw). Owns empty-check and own-agent disambiguation; markup ownership lives in the variant table.
|
|
54
|
-
* - `format-group-block.ts` — `formatGroupBlock` + `getGroupFields` predicate. Openclaw consumes the narrowed fields directly; nanoclaw renders via the `xml-system-reminder` variant.
|
|
55
|
-
*
|
|
56
|
-
* No high-level `createChannelBase(opts)` helper: channels diverge
|
|
57
|
-
* on surfacing and markup. A facade would either hard-code one
|
|
58
|
-
* surfacing path or accept callbacks for each, ending up a thin
|
|
59
|
-
* wrapper over the primitives below.
|
|
60
|
-
*/
|
|
1
|
+
/** @file Shared channel-adapter primitives for `@moltzap/client/channel-base`. */
|
|
61
2
|
export { LeaseAlreadyConsumed, projectLeaseInvalid, catchLeaseInvalid, type LeaseInvalidProjectionError, } from "./lease.js";
|
|
62
3
|
export { LeaseStore } from "./lease-store.js";
|
|
63
4
|
export { LeaseGuard } from "./lease-guard.js";
|
|
64
5
|
export { formatCrossConv, type CrossConvFormatter, type CrossConvMarkup, } from "./format-cross-conv.js";
|
|
65
6
|
export { formatGroupBlock, getGroupFields, type GroupFields, type GroupFormatter, } from "./format-group-block.js";
|
|
66
|
-
export {
|
|
67
|
-
export { type
|
|
7
|
+
export { MoltZapChannelCore, type ChannelCoreOptions, type ChannelService, type ContextBlocks, type DispatchAdmissionDecision, type DispatchAdmissionRequest, type DispatchReleaseFrame, type EnrichedConversationMeta, type EnrichedInboundMessage, type EnrichedSender, type InboundHandler, type PendingDispatchMessage, } from "../channel-core.js";
|
|
8
|
+
export { sanitizeForSystemReminder, type CrossConversationEntry, type CrossConvMessage, } from "../service.js";
|
|
68
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/channel-base/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/channel-base/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,2BAA2B,GACjC,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,yBAAyB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC"}
|
|
@@ -1,72 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @file `@moltzap/client/channel-base` — shared scaffolding for channel
|
|
4
|
-
* adapters (`@moltzap/openclaw-channel`, `@moltzap/claude-code-channel`,
|
|
5
|
-
* `@moltzap/nanoclaw-channel`).
|
|
6
|
-
*
|
|
7
|
-
* The subpath canonicalizes three things across the three channels:
|
|
8
|
-
* (1) the `LeaseAlreadyConsumed` tagged error and its projection
|
|
9
|
-
* helpers, (2) the lease-lifecycle primitives (`LeaseStore` /
|
|
10
|
-
* `LeaseGuard`), and (3) the markup-parameterized cross-conv and
|
|
11
|
-
* group-block formatters. Direct `@moltzap/client` consumers
|
|
12
|
-
* (`server-core`, `runtimes`, `test-utils`) see no API surface
|
|
13
|
-
* change — the subpath is opt-in.
|
|
14
|
-
*
|
|
15
|
-
* Surfacing path differs per host contract:
|
|
16
|
-
*
|
|
17
|
-
* - **claude-code** — raises via `server.ts → toolErrorResult`.
|
|
18
|
-
* - **openclaw** — invokes the optional `onLeaseConsumed` side-channel callback (deliver's wire return type is `PromiseLike<boolean>` and cannot carry an Effect error).
|
|
19
|
-
* - **nanoclaw** — raises the typed error on the Effect channel.
|
|
20
|
-
*
|
|
21
|
-
* Common lease-projection path:
|
|
22
|
-
*
|
|
23
|
-
* ```mermaid
|
|
24
|
-
* sequenceDiagram
|
|
25
|
-
* participant Host
|
|
26
|
-
* participant Channel
|
|
27
|
-
* participant Core as MoltZapChannelCore
|
|
28
|
-
* participant Server.
|
|
29
|
-
*
|
|
30
|
-
* Host->>Channel: reply / sendMessage
|
|
31
|
-
* Channel->>Core: sendReply(conv, text, {dispatchLeaseId})
|
|
32
|
-
* Core->>Server: messages/send
|
|
33
|
-
* Server-->>Core: ForbiddenError data.reason LeaseInvalid
|
|
34
|
-
* Note over Channel,Core: catchLeaseInvalid reads Clock.currentTimeMillis<br>then projectLeaseInvalid stamps LeaseAlreadyConsumed
|
|
35
|
-
* Core-->>Channel: Effect.fail(LeaseAlreadyConsumed)
|
|
36
|
-
* alt claude-code
|
|
37
|
-
* Channel->>Host: toolErrorResult
|
|
38
|
-
* else openclaw
|
|
39
|
-
* Channel->>Host: onLeaseConsumed callback, deliver returns false
|
|
40
|
-
* else nanoclaw
|
|
41
|
-
* Channel->>Host: Effect raises LeaseAlreadyConsumed
|
|
42
|
-
* end
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* The `_tag === "LeaseAlreadyConsumed"` forward-compat arm of
|
|
46
|
-
* `projectLeaseInvalid` covers a future server that emits the
|
|
47
|
-
* canonical tag in `data` directly; no channel-side change required.
|
|
48
|
-
*
|
|
49
|
-
* Primitives live one-per-file:
|
|
50
|
-
*
|
|
51
|
-
* - `lease.ts` — `LeaseAlreadyConsumed`, `projectLeaseInvalid`, `catchLeaseInvalid` (Effect-pipe wrapper at every `core.sendReply(...)` boundary).
|
|
52
|
-
* - `lease-store.ts` — `LeaseStore<HostKey, T>`: per-key tracker with `remember` / `peek` / `consume` / `clear`. Nanoclaw stores `(jid, dispatchLeaseId)` and `peek`s deliberately on retries so the server returns CONSUMED rather than accepting a duplicate send.
|
|
53
|
-
* - `lease-guard.ts` — `LeaseGuard`: single-shot dup-reply detector scoped to one inbound message. `consume()` returns `true` exactly once.
|
|
54
|
-
* - `format-cross-conv.ts` — markup-parameterized formatter (`json-header` for openclaw, `xml-system-reminder` for nanoclaw). Owns empty-check and own-agent disambiguation; markup ownership lives in the variant table.
|
|
55
|
-
* - `format-group-block.ts` — `formatGroupBlock` + `getGroupFields` predicate. Openclaw consumes the narrowed fields directly; nanoclaw renders via the `xml-system-reminder` variant.
|
|
56
|
-
*
|
|
57
|
-
* No high-level `createChannelBase(opts)` helper: channels diverge
|
|
58
|
-
* on surfacing and markup. A facade would either hard-code one
|
|
59
|
-
* surfacing path or accept callbacks for each, ending up a thin
|
|
60
|
-
* wrapper over the primitives below.
|
|
61
|
-
*/
|
|
1
|
+
/** @file Shared channel-adapter primitives for `@moltzap/client/channel-base`. */
|
|
62
2
|
export { LeaseAlreadyConsumed, projectLeaseInvalid, catchLeaseInvalid, } from "./lease.js";
|
|
63
3
|
export { LeaseStore } from "./lease-store.js";
|
|
64
4
|
export { LeaseGuard } from "./lease-guard.js";
|
|
65
5
|
export { formatCrossConv, } from "./format-cross-conv.js";
|
|
66
6
|
export { formatGroupBlock, getGroupFields, } from "./format-group-block.js";
|
|
67
|
-
|
|
68
|
-
// `@moltzap/client` barrel already; channel-base callers shouldn't need to
|
|
69
|
-
// import from two paths to use the formatters).
|
|
7
|
+
export { MoltZapChannelCore, } from "../channel-core.js";
|
|
70
8
|
export { sanitizeForSystemReminder, } from "../service.js";
|
|
71
|
-
export {} from "../channel-core.js";
|
|
72
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/channel-base/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/channel-base/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,eAAe,GAGhB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,gBAAgB,EAChB,cAAc,GAGf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,kBAAkB,GAYnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,yBAAyB,GAG1B,MAAM,eAAe,CAAC"}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* Channel-base `LeaseGuard` — per-dispatch single-shot client-side dup-reply
|
|
3
3
|
* detection.
|
|
4
4
|
*
|
|
5
|
-
* Replaces openclaw's `consumedLeaseAt: number | null` closure in
|
|
6
|
-
* `packages/openclaw-channel/src/openclaw-entry.ts → createLeaseConsumingDeliver`.
|
|
7
5
|
* One `LeaseGuard` instance per inbound message (created inside the deliver
|
|
8
6
|
* wrapper); `consume()` returns true exactly once, false on every subsequent
|
|
9
7
|
* call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease-guard.d.ts","sourceRoot":"","sources":["../../src/channel-base/lease-guard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lease-guard.d.ts","sourceRoot":"","sources":["../../src/channel-base/lease-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAS,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,qBAAa,UAAU;;IAGrB;;;;OAIG;IACH,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC;IAS/C;;;;OAIG;IACH,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAInE;CACF"}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* Channel-base `LeaseGuard` — per-dispatch single-shot client-side dup-reply
|
|
3
3
|
* detection.
|
|
4
4
|
*
|
|
5
|
-
* Replaces openclaw's `consumedLeaseAt: number | null` closure in
|
|
6
|
-
* `packages/openclaw-channel/src/openclaw-entry.ts → createLeaseConsumingDeliver`.
|
|
7
5
|
* One `LeaseGuard` instance per inbound message (created inside the deliver
|
|
8
6
|
* wrapper); `consume()` returns true exactly once, false on every subsequent
|
|
9
7
|
* call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease-guard.js","sourceRoot":"","sources":["../../src/channel-base/lease-guard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lease-guard.js","sourceRoot":"","sources":["../../src/channel-base/lease-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,MAAM,OAAO,UAAU;IACrB,WAAW,GAAkB,IAAI,CAAC;IAElC;;;;OAIG;IACH,OAAO;QACL,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;YAC/B,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;gBAAE,OAAO,KAAK,CAAC;YAC5C,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;YAC1C,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,IAAI,UAAU;QACZ,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CACtB,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAC1E,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Nanoclaw uses a string-keyed, string-valued store (keyed by JID, payload
|
|
5
5
|
* is the dispatchLeaseId string). The deliberate "keep stale entry to trigger
|
|
6
|
-
* server CONSUMED rejection on retry" semantic
|
|
7
|
-
* (read-only) — see arch sub-issue #605 §3.3 and §6.3.
|
|
6
|
+
* server CONSUMED rejection on retry" semantic uses `peek` (read-only).
|
|
8
7
|
*
|
|
9
8
|
* The class wraps a private `Map`; Effect wrappers are for caller-side
|
|
10
9
|
* composition. Single-threaded by construction — one instance lives per
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
import { Effect, Option } from "effect";
|
|
14
13
|
export declare class LeaseStore<HostKey, T> {
|
|
15
14
|
#private;
|
|
16
|
-
/** Overwrite-on-newer-inbound. Last-write-wins
|
|
15
|
+
/** Overwrite-on-newer-inbound. Last-write-wins. */
|
|
17
16
|
remember(key: HostKey, payload: T): Effect.Effect<void, never, never>;
|
|
18
17
|
/**
|
|
19
18
|
* Read-only lookup. Does NOT delete. Nanoclaw uses this for the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease-store.d.ts","sourceRoot":"","sources":["../../src/channel-base/lease-store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lease-store.d.ts","sourceRoot":"","sources":["../../src/channel-base/lease-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,qBAAa,UAAU,CAAC,OAAO,EAAE,CAAC;;IAGhC,mDAAmD;IACnD,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC;IAMrE;;;OAGG;IACH,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC;IAOjE,2DAA2D;IAC3D,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC;IASpE,yDAAyD;IACzD,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC;IAUvD,mBAAmB;IACnB,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAE9C;CACF"}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Nanoclaw uses a string-keyed, string-valued store (keyed by JID, payload
|
|
5
5
|
* is the dispatchLeaseId string). The deliberate "keep stale entry to trigger
|
|
6
|
-
* server CONSUMED rejection on retry" semantic
|
|
7
|
-
* (read-only) — see arch sub-issue #605 §3.3 and §6.3.
|
|
6
|
+
* server CONSUMED rejection on retry" semantic uses `peek` (read-only).
|
|
8
7
|
*
|
|
9
8
|
* The class wraps a private `Map`; Effect wrappers are for caller-side
|
|
10
9
|
* composition. Single-threaded by construction — one instance lives per
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
import { Effect, Option } from "effect";
|
|
14
13
|
export class LeaseStore {
|
|
15
14
|
#entries = new Map();
|
|
16
|
-
/** Overwrite-on-newer-inbound. Last-write-wins
|
|
15
|
+
/** Overwrite-on-newer-inbound. Last-write-wins. */
|
|
17
16
|
remember(key, payload) {
|
|
18
17
|
return Effect.sync(() => {
|
|
19
18
|
this.#entries.set(key, payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease-store.js","sourceRoot":"","sources":["../../src/channel-base/lease-store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lease-store.js","sourceRoot":"","sources":["../../src/channel-base/lease-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,OAAO,UAAU;IACZ,QAAQ,GAAG,IAAI,GAAG,EAAc,CAAC;IAE1C,mDAAmD;IACnD,QAAQ,CAAC,GAAY,EAAE,OAAU;QAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,GAAY;QACf,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,2DAA2D;IAC3D,OAAO,CAAC,GAAY;QAClB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,QAAQ,KAAK,SAAS;gBAAE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;YACjD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yDAAyD;IACzD,KAAK,CAAC,GAAa;QACjB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB;IACnB,IAAI,IAAI;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -1,63 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Channel-base lease primitives.
|
|
3
3
|
*
|
|
4
|
-
* Public surface
|
|
4
|
+
* Public surface:
|
|
5
5
|
* - `LeaseAlreadyConsumed`: canonical tagged error class. One definition site
|
|
6
6
|
* across all three channels (claude-code, openclaw, nanoclaw).
|
|
7
|
-
* - `projectLeaseInvalid`: predicate that narrows a `
|
|
7
|
+
* - `projectLeaseInvalid`: predicate that narrows a `ForbiddenError` to
|
|
8
8
|
* `LeaseAlreadyConsumed` when the server's wire-error payload matches the
|
|
9
|
-
* single-use-lease shape.
|
|
10
|
-
* - `catchLeaseInvalid`: Effect-pipe convenience that runs the projection
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* single-use-lease shape (`data.reason === "LeaseInvalid"`).
|
|
10
|
+
* - `catchLeaseInvalid`: Effect-pipe convenience that runs the projection over
|
|
11
|
+
* a `ForbiddenError` with `Clock.currentTimeMillis` threaded into the
|
|
12
|
+
* projector as `consumedAt`.
|
|
13
13
|
*/
|
|
14
14
|
import { Effect } from "effect";
|
|
15
|
-
import {
|
|
15
|
+
import { ForbiddenError } from "@moltzap/protocol/rpc";
|
|
16
16
|
declare const LeaseAlreadyConsumed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
17
17
|
readonly _tag: "LeaseAlreadyConsumed";
|
|
18
18
|
} & Readonly<A>;
|
|
19
19
|
/**
|
|
20
|
-
* The dispatch lease
|
|
21
|
-
*
|
|
20
|
+
* The dispatch lease is already consumed (the server mapped a second
|
|
21
|
+
* `agent/message/send` on the same lease to `ForbiddenError(data.reason:
|
|
22
|
+
* "LeaseInvalid")`).
|
|
22
23
|
*
|
|
23
24
|
* Construction is **only** via `projectLeaseInvalid` (or `catchLeaseInvalid`).
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* See arch sub-issue #605 §3.1 for the shape rationale (cause field is the
|
|
28
|
-
* verbatim wire error; consumedAt is `Clock.currentTimeMillis` at projection
|
|
29
|
-
* time; message is derived from cause.message).
|
|
25
|
+
* `cause` is the verbatim wire error so hosts can inspect the payload without
|
|
26
|
+
* re-fetching; `consumedAt` is `Clock.currentTimeMillis` at projection time;
|
|
27
|
+
* `message` is derived from `cause.message`.
|
|
30
28
|
*/
|
|
31
29
|
export declare class LeaseAlreadyConsumed extends LeaseAlreadyConsumed_base<{
|
|
32
30
|
readonly leaseId: string;
|
|
33
31
|
readonly consumedAt: number;
|
|
34
|
-
readonly cause:
|
|
32
|
+
readonly cause: ForbiddenError;
|
|
35
33
|
readonly message: string;
|
|
36
34
|
}> {
|
|
37
35
|
}
|
|
38
36
|
/**
|
|
39
37
|
* Named alias for the error channel produced by `catchLeaseInvalid` over an
|
|
40
38
|
* effect with residual error `E`. Equivalent to
|
|
41
|
-
* `LeaseAlreadyConsumed |
|
|
42
|
-
*
|
|
39
|
+
* `LeaseAlreadyConsumed | ForbiddenError | E`, named so consumers can
|
|
40
|
+
* reference the union directly.
|
|
43
41
|
*/
|
|
44
|
-
export type LeaseInvalidProjectionError<E> = LeaseAlreadyConsumed |
|
|
42
|
+
export type LeaseInvalidProjectionError<E> = LeaseAlreadyConsumed | ForbiddenError | E;
|
|
45
43
|
/**
|
|
46
|
-
* Project an `
|
|
44
|
+
* Project an `ForbiddenError` to `LeaseAlreadyConsumed` if it matches the
|
|
47
45
|
* lease-invalid wire shape; otherwise return the original error unchanged.
|
|
48
46
|
*
|
|
49
|
-
* Predicate
|
|
50
|
-
* `err.data.reason === "LeaseInvalid"` OR
|
|
51
|
-
* `err.data._tag === "LeaseAlreadyConsumed"` (forward-compat for a future
|
|
52
|
-
* server that emits the canonical tag in data).
|
|
47
|
+
* Predicate: `err.data.reason === "LeaseInvalid"`.
|
|
53
48
|
*
|
|
54
49
|
* The wire code (-32001 / generic Forbidden) is intentionally NOT part of
|
|
55
50
|
* the predicate because the code is too generic to discriminate on alone.
|
|
56
51
|
*
|
|
57
52
|
* `ctx.leaseId` (optional) is the lease the caller just sent. Caller-supplied
|
|
58
53
|
* because the server's `ForbiddenError.data` shape does NOT carry leaseId.
|
|
59
|
-
* Falls back to `"(unknown)"` when omitted
|
|
60
|
-
* claude-code behavior).
|
|
54
|
+
* Falls back to `"(unknown)"` when omitted.
|
|
61
55
|
*
|
|
62
56
|
* `ctx.consumedAt` (required) is the epoch ms to stamp on the resulting
|
|
63
57
|
* `LeaseAlreadyConsumed.consumedAt`. Required because `LeaseAlreadyConsumed`
|
|
@@ -65,18 +59,18 @@ export type LeaseInvalidProjectionError<E> = LeaseAlreadyConsumed | RpcServerErr
|
|
|
65
59
|
* either pass `Date.now()` directly or use `catchLeaseInvalid` which reads
|
|
66
60
|
* `Clock.currentTimeMillis` inside the Effect.
|
|
67
61
|
*/
|
|
68
|
-
export declare function projectLeaseInvalid(err:
|
|
62
|
+
export declare function projectLeaseInvalid(err: ForbiddenError, ctx: {
|
|
69
63
|
readonly leaseId?: string;
|
|
70
64
|
readonly consumedAt: number;
|
|
71
|
-
}): LeaseAlreadyConsumed |
|
|
65
|
+
}): LeaseAlreadyConsumed | ForbiddenError;
|
|
72
66
|
/**
|
|
73
|
-
* Effect-pipe convenience: catches `
|
|
67
|
+
* Effect-pipe convenience: catches `ForbiddenError` and runs
|
|
74
68
|
* `projectLeaseInvalid` on each instance. Reads `Clock.currentTimeMillis`
|
|
75
69
|
* inside the catch and passes the result to `projectLeaseInvalid` as
|
|
76
70
|
* `consumedAt`. Matching errors are surfaced as the typed
|
|
77
71
|
* `LeaseAlreadyConsumed` on the failure channel; non-matching errors are
|
|
78
72
|
* re-raised unchanged so downstream `mapError`s see the original
|
|
79
|
-
* `
|
|
73
|
+
* `ForbiddenError`.
|
|
80
74
|
*
|
|
81
75
|
* Use at every channel's outbound `core.sendReply(...)` boundary:
|
|
82
76
|
*
|
|
@@ -89,6 +83,6 @@ export declare function projectLeaseInvalid(err: RpcServerError, ctx: {
|
|
|
89
83
|
*/
|
|
90
84
|
export declare function catchLeaseInvalid<A, E2, R>(ctx?: {
|
|
91
85
|
readonly leaseId?: string;
|
|
92
|
-
}): (eff: Effect.Effect<A,
|
|
86
|
+
}): (eff: Effect.Effect<A, ForbiddenError | E2, R>) => Effect.Effect<A, LeaseInvalidProjectionError<E2>, R>;
|
|
93
87
|
export {};
|
|
94
88
|
//# sourceMappingURL=lease.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease.d.ts","sourceRoot":"","sources":["../../src/channel-base/lease.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAe,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"lease.d.ts","sourceRoot":"","sources":["../../src/channel-base/lease.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAe,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;;;;AAEvD;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,SAAQ,0BAExC;IACA,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;CAAG;AAEL;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,CAAC,CAAC,IACrC,oBAAoB,GACpB,cAAc,GACd,CAAC,CAAC;AAUN;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC9D,oBAAoB,GAAG,cAAc,CAQvC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,CACF,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,GAAG,EAAE,EAAE,CAAC,CAAC,KAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,2BAA2B,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAmBxD"}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Channel-base lease primitives.
|
|
3
3
|
*
|
|
4
|
-
* Public surface
|
|
4
|
+
* Public surface:
|
|
5
5
|
* - `LeaseAlreadyConsumed`: canonical tagged error class. One definition site
|
|
6
6
|
* across all three channels (claude-code, openclaw, nanoclaw).
|
|
7
|
-
* - `projectLeaseInvalid`: predicate that narrows a `
|
|
7
|
+
* - `projectLeaseInvalid`: predicate that narrows a `ForbiddenError` to
|
|
8
8
|
* `LeaseAlreadyConsumed` when the server's wire-error payload matches the
|
|
9
|
-
* single-use-lease shape.
|
|
10
|
-
* - `catchLeaseInvalid`: Effect-pipe convenience that runs the projection
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* single-use-lease shape (`data.reason === "LeaseInvalid"`).
|
|
10
|
+
* - `catchLeaseInvalid`: Effect-pipe convenience that runs the projection over
|
|
11
|
+
* a `ForbiddenError` with `Clock.currentTimeMillis` threaded into the
|
|
12
|
+
* projector as `consumedAt`.
|
|
13
13
|
*/
|
|
14
14
|
import { Clock, Data, Effect } from "effect";
|
|
15
|
-
import {
|
|
15
|
+
import { ForbiddenError } from "@moltzap/protocol/rpc";
|
|
16
16
|
/**
|
|
17
|
-
* The dispatch lease
|
|
18
|
-
*
|
|
17
|
+
* The dispatch lease is already consumed (the server mapped a second
|
|
18
|
+
* `agent/message/send` on the same lease to `ForbiddenError(data.reason:
|
|
19
|
+
* "LeaseInvalid")`).
|
|
19
20
|
*
|
|
20
21
|
* Construction is **only** via `projectLeaseInvalid` (or `catchLeaseInvalid`).
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* See arch sub-issue #605 §3.1 for the shape rationale (cause field is the
|
|
25
|
-
* verbatim wire error; consumedAt is `Clock.currentTimeMillis` at projection
|
|
26
|
-
* time; message is derived from cause.message).
|
|
22
|
+
* `cause` is the verbatim wire error so hosts can inspect the payload without
|
|
23
|
+
* re-fetching; `consumedAt` is `Clock.currentTimeMillis` at projection time;
|
|
24
|
+
* `message` is derived from `cause.message`.
|
|
27
25
|
*/
|
|
28
26
|
export class LeaseAlreadyConsumed extends Data.TaggedError("LeaseAlreadyConsumed") {
|
|
29
27
|
}
|
|
@@ -32,28 +30,20 @@ function isLeaseInvalidData(data) {
|
|
|
32
30
|
if (typeof data !== "object" || data === null)
|
|
33
31
|
return false;
|
|
34
32
|
const reason = data.reason;
|
|
35
|
-
|
|
36
|
-
// Today's wire shape: `ForbiddenError.data.reason === "LeaseInvalid"`
|
|
37
|
-
// (arch sub-issue #605 §3.2). The `_tag` arm is forward-compat for a
|
|
38
|
-
// future server that emits the canonical tag in `data` directly.
|
|
39
|
-
return reason === "LeaseInvalid" || tag === "LeaseAlreadyConsumed";
|
|
33
|
+
return reason === "LeaseInvalid";
|
|
40
34
|
}
|
|
41
35
|
/**
|
|
42
|
-
* Project an `
|
|
36
|
+
* Project an `ForbiddenError` to `LeaseAlreadyConsumed` if it matches the
|
|
43
37
|
* lease-invalid wire shape; otherwise return the original error unchanged.
|
|
44
38
|
*
|
|
45
|
-
* Predicate
|
|
46
|
-
* `err.data.reason === "LeaseInvalid"` OR
|
|
47
|
-
* `err.data._tag === "LeaseAlreadyConsumed"` (forward-compat for a future
|
|
48
|
-
* server that emits the canonical tag in data).
|
|
39
|
+
* Predicate: `err.data.reason === "LeaseInvalid"`.
|
|
49
40
|
*
|
|
50
41
|
* The wire code (-32001 / generic Forbidden) is intentionally NOT part of
|
|
51
42
|
* the predicate because the code is too generic to discriminate on alone.
|
|
52
43
|
*
|
|
53
44
|
* `ctx.leaseId` (optional) is the lease the caller just sent. Caller-supplied
|
|
54
45
|
* because the server's `ForbiddenError.data` shape does NOT carry leaseId.
|
|
55
|
-
* Falls back to `"(unknown)"` when omitted
|
|
56
|
-
* claude-code behavior).
|
|
46
|
+
* Falls back to `"(unknown)"` when omitted.
|
|
57
47
|
*
|
|
58
48
|
* `ctx.consumedAt` (required) is the epoch ms to stamp on the resulting
|
|
59
49
|
* `LeaseAlreadyConsumed.consumedAt`. Required because `LeaseAlreadyConsumed`
|
|
@@ -72,13 +62,13 @@ export function projectLeaseInvalid(err, ctx) {
|
|
|
72
62
|
});
|
|
73
63
|
}
|
|
74
64
|
/**
|
|
75
|
-
* Effect-pipe convenience: catches `
|
|
65
|
+
* Effect-pipe convenience: catches `ForbiddenError` and runs
|
|
76
66
|
* `projectLeaseInvalid` on each instance. Reads `Clock.currentTimeMillis`
|
|
77
67
|
* inside the catch and passes the result to `projectLeaseInvalid` as
|
|
78
68
|
* `consumedAt`. Matching errors are surfaced as the typed
|
|
79
69
|
* `LeaseAlreadyConsumed` on the failure channel; non-matching errors are
|
|
80
70
|
* re-raised unchanged so downstream `mapError`s see the original
|
|
81
|
-
* `
|
|
71
|
+
* `ForbiddenError`.
|
|
82
72
|
*
|
|
83
73
|
* Use at every channel's outbound `core.sendReply(...)` boundary:
|
|
84
74
|
*
|
|
@@ -90,21 +80,15 @@ export function projectLeaseInvalid(err, ctx) {
|
|
|
90
80
|
* ```
|
|
91
81
|
*/
|
|
92
82
|
export function catchLeaseInvalid(ctx) {
|
|
93
|
-
// `Effect.
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})));
|
|
104
|
-
}
|
|
105
|
-
// Non-RpcServerError residual (E2). Re-raise unchanged so downstream
|
|
106
|
-
// `mapError`s see it without coupling to channel-base.
|
|
107
|
-
return Effect.fail(err);
|
|
108
|
-
});
|
|
83
|
+
// `Effect.catchIf` with an `instanceof` refinement handles only the
|
|
84
|
+
// `ForbiddenError` arm; the `E2` residual flows through untouched as
|
|
85
|
+
// `Exclude<ForbiddenError | E2, ForbiddenError>`, so there is no cast on the
|
|
86
|
+
// residual error channel. `catchTag("ForbiddenError", ...)` cannot be used:
|
|
87
|
+
// when `E2` is unconstrained, TS conservatively assumes it could carry
|
|
88
|
+
// `_tag: "ForbiddenError"`, which would widen the matched arm.
|
|
89
|
+
return Effect.catchIf((err) => err instanceof ForbiddenError, (err) => Effect.flatMap(Clock.currentTimeMillis, (consumedAt) => Effect.fail(projectLeaseInvalid(err, {
|
|
90
|
+
...(ctx?.leaseId !== undefined ? { leaseId: ctx.leaseId } : {}),
|
|
91
|
+
consumedAt,
|
|
92
|
+
}))));
|
|
109
93
|
}
|
|
110
94
|
//# sourceMappingURL=lease.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease.js","sourceRoot":"","sources":["../../src/channel-base/lease.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"lease.js","sourceRoot":"","sources":["../../src/channel-base/lease.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAqB,SAAQ,IAAI,CAAC,WAAW,CACxD,sBAAsB,CAMtB;CAAG;AAaL,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC,SAAS,kBAAkB,CAAC,IAAa;IACvC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC5D,MAAM,MAAM,GAAI,IAAsC,CAAC,MAAM,CAAC;IAC9D,OAAO,MAAM,KAAK,cAAc,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mBAAmB,CACjC,GAAmB,EACnB,GAA+D;IAE/D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC;IAC9C,OAAO,IAAI,oBAAoB,CAAC;QAC9B,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,iBAAiB;QACzC,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,iBAAiB,CAAW,GAE3C;IAGC,oEAAoE;IACpE,qEAAqE;IACrE,6EAA6E;IAC7E,4EAA4E;IAC5E,uEAAuE;IACvE,+DAA+D;IAC/D,OAAO,MAAM,CAAC,OAAO,CACnB,CAAC,GAAG,EAAyB,EAAE,CAAC,GAAG,YAAY,cAAc,EAC7D,CAAC,GAAG,EAAE,EAAE,CACN,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CACrD,MAAM,CAAC,IAAI,CACT,mBAAmB,CAAC,GAAG,EAAE;QACvB,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,UAAU;KACX,CAAC,CACH,CACF,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import type { Message } from "@moltzap/protocol";
|
|
2
|
+
import type { Message } from "@moltzap/protocol/message";
|
|
3
3
|
import type { TaskId } from "@moltzap/protocol/task";
|
|
4
4
|
import type { ChannelService, EnrichedInboundMessage } from "./channel-core.js";
|
|
5
5
|
export declare function enrichChannelMessage(service: ChannelService, taskId: TaskId, messageOrMessages: Message | ReadonlyArray<Message>): Effect.Effect<{
|