@moltzap/client 2026.811.0 → 2026.902.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/LICENSE +202 -21
- package/NOTICE +19 -0
- package/README.md +50 -0
- package/bin/moltzapd +9 -0
- package/dist/client-runtime.d.ts +10 -0
- package/dist/client-runtime.d.ts.map +1 -0
- package/dist/client-runtime.js +218 -0
- package/dist/client-runtime.js.map +1 -0
- package/dist/contract.d.ts +338 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +213 -0
- package/dist/contract.js.map +1 -0
- package/dist/contract.types-check.d.ts +99 -0
- package/dist/contract.types-check.d.ts.map +1 -0
- package/dist/contract.types-check.js +7 -0
- package/dist/contract.types-check.js.map +1 -0
- package/dist/daemon/configuration.d.ts +46 -0
- package/dist/daemon/configuration.d.ts.map +1 -0
- package/dist/daemon/configuration.js +69 -0
- package/dist/daemon/configuration.js.map +1 -0
- package/dist/daemon/management.d.ts +23 -0
- package/dist/daemon/management.d.ts.map +1 -0
- package/dist/daemon/management.js +489 -0
- package/dist/daemon/management.js.map +1 -0
- package/dist/daemon/registration.d.ts +72 -0
- package/dist/daemon/registration.d.ts.map +1 -0
- package/dist/daemon/registration.js +109 -0
- package/dist/daemon/registration.js.map +1 -0
- package/dist/daemon/runtime/activation.d.ts +95 -0
- package/dist/daemon/runtime/activation.d.ts.map +1 -0
- package/dist/daemon/runtime/activation.js +99 -0
- package/dist/daemon/runtime/activation.js.map +1 -0
- package/dist/daemon/runtime/controller.d.ts +34 -0
- package/dist/daemon/runtime/controller.d.ts.map +1 -0
- package/dist/daemon/runtime/controller.js +106 -0
- package/dist/daemon/runtime/controller.js.map +1 -0
- package/dist/daemon/runtime/history-export.d.ts +23 -0
- package/dist/daemon/runtime/history-export.d.ts.map +1 -0
- package/dist/daemon/runtime/history-export.js +47 -0
- package/dist/daemon/runtime/history-export.js.map +1 -0
- package/dist/daemon/runtime/index.d.ts +24 -0
- package/dist/daemon/runtime/index.d.ts.map +1 -0
- package/dist/daemon/runtime/index.js +65 -0
- package/dist/daemon/runtime/index.js.map +1 -0
- package/dist/daemon/runtime/protocol.d.ts +63 -0
- package/dist/daemon/runtime/protocol.d.ts.map +1 -0
- package/dist/daemon/runtime/protocol.js +133 -0
- package/dist/daemon/runtime/protocol.js.map +1 -0
- package/dist/endpoint/addressing/index.d.ts +39 -0
- package/dist/endpoint/addressing/index.d.ts.map +1 -0
- package/dist/endpoint/addressing/index.js +114 -0
- package/dist/endpoint/addressing/index.js.map +1 -0
- package/dist/endpoint/engine-dissemination.d.ts +11 -0
- package/dist/endpoint/engine-dissemination.d.ts.map +1 -0
- package/dist/endpoint/engine-dissemination.js +71 -0
- package/dist/endpoint/engine-dissemination.js.map +1 -0
- package/dist/endpoint/engine-durability.d.ts +69 -0
- package/dist/endpoint/engine-durability.d.ts.map +1 -0
- package/dist/endpoint/engine-durability.js +210 -0
- package/dist/endpoint/engine-durability.js.map +1 -0
- package/dist/endpoint/engine-send.d.ts +50 -0
- package/dist/endpoint/engine-send.d.ts.map +1 -0
- package/dist/endpoint/engine-send.js +422 -0
- package/dist/endpoint/engine-send.js.map +1 -0
- package/dist/endpoint/engine-types.d.ts +132 -0
- package/dist/endpoint/engine-types.d.ts.map +1 -0
- package/dist/endpoint/engine-types.js +13 -0
- package/dist/endpoint/engine-types.js.map +1 -0
- package/dist/endpoint/engine.d.ts +14 -0
- package/dist/endpoint/engine.d.ts.map +1 -0
- package/dist/endpoint/engine.js +280 -0
- package/dist/endpoint/engine.js.map +1 -0
- package/dist/endpoint/protocol/evidence.d.ts +37 -0
- package/dist/endpoint/protocol/evidence.d.ts.map +1 -0
- package/dist/endpoint/protocol/evidence.js +80 -0
- package/dist/endpoint/protocol/evidence.js.map +1 -0
- package/dist/endpoint/protocol/index.d.ts +26 -0
- package/dist/endpoint/protocol/index.d.ts.map +1 -0
- package/dist/endpoint/protocol/index.js +543 -0
- package/dist/endpoint/protocol/index.js.map +1 -0
- package/dist/endpoint/recovery/barrier.d.ts +23 -0
- package/dist/endpoint/recovery/barrier.d.ts.map +1 -0
- package/dist/endpoint/recovery/barrier.js +47 -0
- package/dist/endpoint/recovery/barrier.js.map +1 -0
- package/dist/endpoint/recovery/index.d.ts +29 -0
- package/dist/endpoint/recovery/index.d.ts.map +1 -0
- package/dist/endpoint/recovery/index.js +489 -0
- package/dist/endpoint/recovery/index.js.map +1 -0
- package/dist/endpoint/recovery/reanchor/empty.d.ts +22 -0
- package/dist/endpoint/recovery/reanchor/empty.d.ts.map +1 -0
- package/dist/endpoint/recovery/reanchor/empty.js +163 -0
- package/dist/endpoint/recovery/reanchor/empty.js.map +1 -0
- package/dist/endpoint/recovery/reanchor/index.d.ts +30 -0
- package/dist/endpoint/recovery/reanchor/index.d.ts.map +1 -0
- package/dist/endpoint/recovery/reanchor/index.js +479 -0
- package/dist/endpoint/recovery/reanchor/index.js.map +1 -0
- package/dist/endpoint/recovery/state.d.ts +130 -0
- package/dist/endpoint/recovery/state.d.ts.map +1 -0
- package/dist/endpoint/recovery/state.js +296 -0
- package/dist/endpoint/recovery/state.js.map +1 -0
- package/dist/endpoint/recovery/store-evidence.d.ts +17 -0
- package/dist/endpoint/recovery/store-evidence.d.ts.map +1 -0
- package/dist/endpoint/recovery/store-evidence.js +79 -0
- package/dist/endpoint/recovery/store-evidence.js.map +1 -0
- package/dist/endpoint/recovery/store.d.ts +56 -0
- package/dist/endpoint/recovery/store.d.ts.map +1 -0
- package/dist/endpoint/recovery/store.js +499 -0
- package/dist/endpoint/recovery/store.js.map +1 -0
- package/dist/endpoint/representation-canonical.d.ts +17 -0
- package/dist/endpoint/representation-canonical.d.ts.map +1 -0
- package/dist/endpoint/representation-canonical.js +48 -0
- package/dist/endpoint/representation-canonical.js.map +1 -0
- package/dist/endpoint/representation-codec.d.ts +51 -0
- package/dist/endpoint/representation-codec.d.ts.map +1 -0
- package/dist/endpoint/representation-codec.js +159 -0
- package/dist/endpoint/representation-codec.js.map +1 -0
- package/dist/endpoint/representation-schemas.d.ts +1831 -0
- package/dist/endpoint/representation-schemas.d.ts.map +1 -0
- package/dist/endpoint/representation-schemas.js +195 -0
- package/dist/endpoint/representation-schemas.js.map +1 -0
- package/dist/endpoint/representation-verification.d.ts +79 -0
- package/dist/endpoint/representation-verification.d.ts.map +1 -0
- package/dist/endpoint/representation-verification.js +420 -0
- package/dist/endpoint/representation-verification.js.map +1 -0
- package/dist/endpoint/representation.d.ts +6 -0
- package/dist/endpoint/representation.d.ts.map +1 -0
- package/dist/endpoint/representation.js +8 -0
- package/dist/endpoint/representation.js.map +1 -0
- package/dist/endpoint/router-worker/index.d.ts +16 -0
- package/dist/endpoint/router-worker/index.d.ts.map +1 -0
- package/dist/endpoint/router-worker/index.js +547 -0
- package/dist/endpoint/router-worker/index.js.map +1 -0
- package/dist/endpoint/router-worker/types.d.ts +183 -0
- package/dist/endpoint/router-worker/types.d.ts.map +1 -0
- package/dist/endpoint/router-worker/types.js +31 -0
- package/dist/endpoint/router-worker/types.js.map +1 -0
- package/dist/endpoint/store/anchors.d.ts +83 -0
- package/dist/endpoint/store/anchors.d.ts.map +1 -0
- package/dist/endpoint/store/anchors.js +471 -0
- package/dist/endpoint/store/anchors.js.map +1 -0
- package/dist/endpoint/store/database/index.d.ts +6 -0
- package/dist/endpoint/store/database/index.d.ts.map +1 -0
- package/dist/endpoint/store/database/index.js +6 -0
- package/dist/endpoint/store/database/index.js.map +1 -0
- package/dist/endpoint/store/database/schema.d.ts +44 -0
- package/dist/endpoint/store/database/schema.d.ts.map +1 -0
- package/dist/endpoint/store/database/schema.js +345 -0
- package/dist/endpoint/store/database/schema.js.map +1 -0
- package/dist/endpoint/store/database/values.d.ts +119 -0
- package/dist/endpoint/store/database/values.d.ts.map +1 -0
- package/dist/endpoint/store/database/values.js +194 -0
- package/dist/endpoint/store/database/values.js.map +1 -0
- package/dist/endpoint/store/deliveries.d.ts +38 -0
- package/dist/endpoint/store/deliveries.d.ts.map +1 -0
- package/dist/endpoint/store/deliveries.js +124 -0
- package/dist/endpoint/store/deliveries.js.map +1 -0
- package/dist/endpoint/store/dissemination.d.ts +27 -0
- package/dist/endpoint/store/dissemination.d.ts.map +1 -0
- package/dist/endpoint/store/dissemination.js +139 -0
- package/dist/endpoint/store/dissemination.js.map +1 -0
- package/dist/endpoint/store/index.d.ts +15 -0
- package/dist/endpoint/store/index.d.ts.map +1 -0
- package/dist/endpoint/store/index.js +76 -0
- package/dist/endpoint/store/index.js.map +1 -0
- package/dist/endpoint/store/management.d.ts +42 -0
- package/dist/endpoint/store/management.d.ts.map +1 -0
- package/dist/endpoint/store/management.js +259 -0
- package/dist/endpoint/store/management.js.map +1 -0
- package/dist/endpoint/store/outbound.d.ts +62 -0
- package/dist/endpoint/store/outbound.d.ts.map +1 -0
- package/dist/endpoint/store/outbound.js +278 -0
- package/dist/endpoint/store/outbound.js.map +1 -0
- package/dist/endpoint/store/records.d.ts +56 -0
- package/dist/endpoint/store/records.d.ts.map +1 -0
- package/dist/endpoint/store/records.js +352 -0
- package/dist/endpoint/store/records.js.map +1 -0
- package/dist/endpoint/store/rows/index.d.ts +138 -0
- package/dist/endpoint/store/rows/index.d.ts.map +1 -0
- package/dist/endpoint/store/rows/index.js +307 -0
- package/dist/endpoint/store/rows/index.js.map +1 -0
- package/dist/endpoint/store/types.d.ts +223 -0
- package/dist/endpoint/store/types.d.ts.map +1 -0
- package/dist/endpoint/store/types.js +15 -0
- package/dist/endpoint/store/types.js.map +1 -0
- package/dist/endpoint/store.d.ts +10 -0
- package/dist/endpoint/store.d.ts.map +1 -0
- package/dist/endpoint/store.js +6 -0
- package/dist/endpoint/store.js.map +1 -0
- package/dist/harness-mcp-contract.d.ts +101 -0
- package/dist/harness-mcp-contract.d.ts.map +1 -0
- package/dist/harness-mcp-contract.js +61 -0
- package/dist/harness-mcp-contract.js.map +1 -0
- package/dist/harness-mcp-http.d.ts +19 -0
- package/dist/harness-mcp-http.d.ts.map +1 -0
- package/dist/{harness-mcp-server.js → harness-mcp-http.js} +43 -71
- package/dist/harness-mcp-http.js.map +1 -0
- package/dist/harness-mcp-subscription.d.ts +12 -7
- package/dist/harness-mcp-subscription.d.ts.map +1 -1
- package/dist/harness-mcp-subscription.js +113 -100
- package/dist/harness-mcp-subscription.js.map +1 -1
- package/dist/harness-mcp-wire.d.ts +26 -19
- package/dist/harness-mcp-wire.d.ts.map +1 -1
- package/dist/harness-mcp-wire.js +380 -67
- package/dist/harness-mcp-wire.js.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/management-runtime.d.ts +217 -0
- package/dist/management-runtime.d.ts.map +1 -0
- package/dist/management-runtime.js +127 -0
- package/dist/management-runtime.js.map +1 -0
- package/dist/server.d.ts +16 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +46 -0
- package/dist/server.js.map +1 -0
- package/dist/server.types-check.d.ts +23 -0
- package/dist/server.types-check.d.ts.map +1 -0
- package/dist/server.types-check.js +7 -0
- package/dist/server.types-check.js.map +1 -0
- package/package.json +45 -47
- package/dist/agent-client.d.ts +0 -5
- package/dist/agent-client.d.ts.map +0 -1
- package/dist/agent-client.js +0 -3
- package/dist/agent-client.js.map +0 -1
- package/dist/auth.d.ts +0 -37
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -79
- package/dist/auth.js.map +0 -1
- package/dist/bounded-map.d.ts +0 -32
- package/dist/bounded-map.d.ts.map +0 -1
- package/dist/bounded-map.js +0 -79
- package/dist/bounded-map.js.map +0 -1
- package/dist/channel-base/format-cross-conv.d.ts +0 -43
- package/dist/channel-base/format-cross-conv.d.ts.map +0 -1
- package/dist/channel-base/format-cross-conv.js +0 -65
- package/dist/channel-base/format-cross-conv.js.map +0 -1
- package/dist/channel-base/format-group-block.d.ts +0 -48
- package/dist/channel-base/format-group-block.d.ts.map +0 -1
- package/dist/channel-base/format-group-block.js +0 -62
- package/dist/channel-base/format-group-block.js.map +0 -1
- package/dist/channel-base/index.d.ts +0 -12
- package/dist/channel-base/index.d.ts.map +0 -1
- package/dist/channel-base/index.js +0 -13
- package/dist/channel-base/index.js.map +0 -1
- package/dist/channel-core-enrichment.d.ts +0 -14
- package/dist/channel-core-enrichment.d.ts.map +0 -1
- package/dist/channel-core-enrichment.js +0 -143
- package/dist/channel-core-enrichment.js.map +0 -1
- package/dist/channel-core-test-support.d.ts +0 -75
- package/dist/channel-core-test-support.d.ts.map +0 -1
- package/dist/channel-core-test-support.js +0 -74
- package/dist/channel-core-test-support.js.map +0 -1
- package/dist/channel-core.d.ts +0 -304
- package/dist/channel-core.d.ts.map +0 -1
- package/dist/channel-core.js +0 -363
- package/dist/channel-core.js.map +0 -1
- package/dist/cli/adapters.d.ts +0 -21
- package/dist/cli/adapters.d.ts.map +0 -1
- package/dist/cli/adapters.js +0 -111
- package/dist/cli/adapters.js.map +0 -1
- package/dist/cli/commands/agents.d.ts +0 -11
- package/dist/cli/commands/agents.d.ts.map +0 -1
- package/dist/cli/commands/agents.js +0 -27
- package/dist/cli/commands/agents.js.map +0 -1
- package/dist/cli/commands/conversations.d.ts +0 -18
- package/dist/cli/commands/conversations.d.ts.map +0 -1
- package/dist/cli/commands/conversations.js +0 -33
- package/dist/cli/commands/conversations.js.map +0 -1
- package/dist/cli/commands/messages.d.ts +0 -41
- package/dist/cli/commands/messages.d.ts.map +0 -1
- package/dist/cli/commands/messages.js +0 -39
- package/dist/cli/commands/messages.js.map +0 -1
- package/dist/cli/commands/register.d.ts +0 -46
- package/dist/cli/commands/register.d.ts.map +0 -1
- package/dist/cli/commands/register.js +0 -103
- package/dist/cli/commands/register.js.map +0 -1
- package/dist/cli/commands/send.d.ts +0 -53
- package/dist/cli/commands/send.d.ts.map +0 -1
- package/dist/cli/commands/send.js +0 -57
- package/dist/cli/commands/send.js.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -34
- package/dist/cli/commands/start.d.ts.map +0 -1
- package/dist/cli/commands/start.js +0 -59
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -7
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -16
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/test-transport.d.ts +0 -28
- package/dist/cli/commands/test-transport.d.ts.map +0 -1
- package/dist/cli/commands/test-transport.js +0 -40
- package/dist/cli/commands/test-transport.js.map +0 -1
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -105
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/output.d.ts +0 -14
- package/dist/cli/output.d.ts.map +0 -1
- package/dist/cli/output.js +0 -19
- package/dist/cli/output.js.map +0 -1
- package/dist/cli/socket-client.d.ts +0 -28
- package/dist/cli/socket-client.d.ts.map +0 -1
- package/dist/cli/socket-client.js +0 -63
- package/dist/cli/socket-client.js.map +0 -1
- package/dist/cli/transport.d.ts +0 -132
- package/dist/cli/transport.d.ts.map +0 -1
- package/dist/cli/transport.js +0 -127
- package/dist/cli/transport.js.map +0 -1
- package/dist/config.d.ts +0 -33
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -45
- package/dist/config.js.map +0 -1
- package/dist/config.test-utils.d.ts +0 -18
- package/dist/config.test-utils.d.ts.map +0 -1
- package/dist/config.test-utils.js +0 -53
- package/dist/config.test-utils.js.map +0 -1
- package/dist/harness/client-runtime.d.ts +0 -24
- package/dist/harness/client-runtime.d.ts.map +0 -1
- package/dist/harness/client-runtime.js +0 -107
- package/dist/harness/client-runtime.js.map +0 -1
- package/dist/harness/index.d.ts +0 -5
- package/dist/harness/index.d.ts.map +0 -1
- package/dist/harness/index.js +0 -5
- package/dist/harness/index.js.map +0 -1
- package/dist/harness/runtime.d.ts +0 -149
- package/dist/harness/runtime.d.ts.map +0 -1
- package/dist/harness/runtime.js +0 -68
- package/dist/harness/runtime.js.map +0 -1
- package/dist/harness-client.d.ts +0 -43
- package/dist/harness-client.d.ts.map +0 -1
- package/dist/harness-client.js +0 -21
- package/dist/harness-client.js.map +0 -1
- package/dist/harness-mcp-server.d.ts +0 -19
- package/dist/harness-mcp-server.d.ts.map +0 -1
- package/dist/harness-mcp-server.js.map +0 -1
- package/dist/local-daemon-rpc.d.ts +0 -1170
- package/dist/local-daemon-rpc.d.ts.map +0 -1
- package/dist/local-daemon-rpc.js +0 -178
- package/dist/local-daemon-rpc.js.map +0 -1
- package/dist/local-history.d.ts +0 -75
- package/dist/local-history.d.ts.map +0 -1
- package/dist/local-history.js +0 -82
- package/dist/local-history.js.map +0 -1
- package/dist/local-paths.d.ts +0 -22
- package/dist/local-paths.d.ts.map +0 -1
- package/dist/local-paths.js +0 -33
- package/dist/local-paths.js.map +0 -1
- package/dist/local-socket-server.d.ts +0 -33
- package/dist/local-socket-server.d.ts.map +0 -1
- package/dist/local-socket-server.js +0 -100
- package/dist/local-socket-server.js.map +0 -1
- package/dist/message-rendering.d.ts +0 -4
- package/dist/message-rendering.d.ts.map +0 -1
- package/dist/message-rendering.js +0 -8
- package/dist/message-rendering.js.map +0 -1
- package/dist/moltzapd.d.ts +0 -38
- package/dist/moltzapd.d.ts.map +0 -1
- package/dist/moltzapd.js +0 -78
- package/dist/moltzapd.js.map +0 -1
- package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts +0 -53
- package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts.map +0 -1
- package/dist/notification/__tests__/subscribe-signatures.types-check.js +0 -29
- package/dist/notification/__tests__/subscribe-signatures.types-check.js.map +0 -1
- package/dist/notification/errors.d.ts +0 -41
- package/dist/notification/errors.d.ts.map +0 -1
- package/dist/notification/errors.js +0 -24
- package/dist/notification/errors.js.map +0 -1
- package/dist/notification/index.d.ts +0 -6
- package/dist/notification/index.d.ts.map +0 -1
- package/dist/notification/index.js +0 -6
- package/dist/notification/index.js.map +0 -1
- package/dist/notification/stream.d.ts +0 -75
- package/dist/notification/stream.d.ts.map +0 -1
- package/dist/notification/stream.js +0 -30
- package/dist/notification/stream.js.map +0 -1
- package/dist/pagination.d.ts +0 -52
- package/dist/pagination.d.ts.map +0 -1
- package/dist/pagination.js +0 -51
- package/dist/pagination.js.map +0 -1
- package/dist/profile.d.ts +0 -104
- package/dist/profile.d.ts.map +0 -1
- package/dist/profile.js +0 -163
- package/dist/profile.js.map +0 -1
- package/dist/refs.d.ts +0 -18
- package/dist/refs.d.ts.map +0 -1
- package/dist/refs.js +0 -18
- package/dist/refs.js.map +0 -1
- package/dist/service-event-trace.d.ts +0 -15
- package/dist/service-event-trace.d.ts.map +0 -1
- package/dist/service-event-trace.js +0 -35
- package/dist/service-event-trace.js.map +0 -1
- package/dist/service-helpers.d.ts +0 -55
- package/dist/service-helpers.d.ts.map +0 -1
- package/dist/service-helpers.js +0 -108
- package/dist/service-helpers.js.map +0 -1
- package/dist/service-local-daemon.d.ts +0 -32
- package/dist/service-local-daemon.d.ts.map +0 -1
- package/dist/service-local-daemon.js +0 -153
- package/dist/service-local-daemon.js.map +0 -1
- package/dist/service.d.ts +0 -299
- package/dist/service.d.ts.map +0 -1
- package/dist/service.js +0 -789
- package/dist/service.js.map +0 -1
- package/dist/test-utils/channel-service-fixture.d.ts +0 -53
- package/dist/test-utils/channel-service-fixture.d.ts.map +0 -1
- package/dist/test-utils/channel-service-fixture.js +0 -178
- package/dist/test-utils/channel-service-fixture.js.map +0 -1
- package/dist/test-utils/fake-service.d.ts +0 -84
- package/dist/test-utils/fake-service.d.ts.map +0 -1
- package/dist/test-utils/fake-service.js +0 -108
- package/dist/test-utils/fake-service.js.map +0 -1
- package/dist/test-utils/harness.d.ts +0 -27
- package/dist/test-utils/harness.d.ts.map +0 -1
- package/dist/test-utils/harness.js +0 -33
- package/dist/test-utils/harness.js.map +0 -1
- package/dist/test-utils/ids.d.ts +0 -21
- package/dist/test-utils/ids.d.ts.map +0 -1
- package/dist/test-utils/ids.js +0 -68
- package/dist/test-utils/ids.js.map +0 -1
- package/dist/test-utils/index.d.ts +0 -54
- package/dist/test-utils/index.d.ts.map +0 -1
- package/dist/test-utils/index.js +0 -65
- package/dist/test-utils/index.js.map +0 -1
- package/dist/test-utils/standalone-provisioning.d.ts +0 -22
- package/dist/test-utils/standalone-provisioning.d.ts.map +0 -1
- package/dist/test-utils/standalone-provisioning.js +0 -17
- package/dist/test-utils/standalone-provisioning.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/cli/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/** @file MoltZap CLI entrypoint and global transport option wiring. */
|
|
3
|
-
import { Command, Options } from "@effect/cli";
|
|
4
|
-
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
5
|
-
import { Config, ConfigProvider, Effect, Layer, Logger, LogLevel, Option, } from "effect";
|
|
6
|
-
import packageJson from "../../package.json" with { type: "json" };
|
|
7
|
-
import { agentsCommand } from "./commands/agents.js";
|
|
8
|
-
import { conversationsCommand, historyCommand, } from "./commands/conversations.js";
|
|
9
|
-
import { messagesCommand } from "./commands/messages.js";
|
|
10
|
-
import { registerCommand } from "./commands/register.js";
|
|
11
|
-
import { sendCommand } from "./commands/send.js";
|
|
12
|
-
import { startCommand } from "./commands/start.js";
|
|
13
|
-
import { statusCommand } from "./commands/status.js";
|
|
14
|
-
import { makeTransportLayer, resolveTransportInputs, } from "./transport.js";
|
|
15
|
-
import { ProfileConfigReadError, ProfileInvalidNameError, ProfileNotFoundError, profileName as profileNameSchema, } from "../profile.js";
|
|
16
|
-
const { version } = packageJson;
|
|
17
|
-
const cliRuntimeEnv = Config.all({
|
|
18
|
-
logLevel: Config.string("MOLTZAP_LOG_LEVEL").pipe(Config.withDefault("info")),
|
|
19
|
-
});
|
|
20
|
-
const runtimeEnv = Effect.runSync(cliRuntimeEnv.pipe(Effect.withConfigProvider(ConfigProvider.fromEnv())));
|
|
21
|
-
const loggerLive = Logger.replace(Logger.defaultLogger, Logger.withConsoleError(Logger.stringLogger));
|
|
22
|
-
const minLogLevel = (() => {
|
|
23
|
-
const env = runtimeEnv.logLevel.toLowerCase();
|
|
24
|
-
switch (env) {
|
|
25
|
-
case "trace":
|
|
26
|
-
return LogLevel.Trace;
|
|
27
|
-
case "debug":
|
|
28
|
-
return LogLevel.Debug;
|
|
29
|
-
case "info":
|
|
30
|
-
return LogLevel.Info;
|
|
31
|
-
case "warn":
|
|
32
|
-
case "warning":
|
|
33
|
-
return LogLevel.Warning;
|
|
34
|
-
case "error":
|
|
35
|
-
return LogLevel.Error;
|
|
36
|
-
case "fatal":
|
|
37
|
-
return LogLevel.Fatal;
|
|
38
|
-
default:
|
|
39
|
-
return LogLevel.Info;
|
|
40
|
-
}
|
|
41
|
-
})();
|
|
42
|
-
const globalProfileOption = Options.text("profile").pipe(Options.withSchema(profileNameSchema), Options.withDescription("Load an existing named profile from ~/.moltzap/config.json for this invocation."), Options.optional);
|
|
43
|
-
function resolverInputFromConfig(config) {
|
|
44
|
-
const profileName = Option.getOrUndefined(config.profile);
|
|
45
|
-
if (profileName === undefined) {
|
|
46
|
-
return {};
|
|
47
|
-
}
|
|
48
|
-
return { profileName };
|
|
49
|
-
}
|
|
50
|
-
function transportResolutionMessage(err) {
|
|
51
|
-
if (err instanceof ProfileNotFoundError) {
|
|
52
|
-
return `profile not found: ${err.name}`;
|
|
53
|
-
}
|
|
54
|
-
if (err instanceof ProfileInvalidNameError) {
|
|
55
|
-
return `invalid profile name "${err.name}": ${err.reason}`;
|
|
56
|
-
}
|
|
57
|
-
if (err instanceof ProfileConfigReadError) {
|
|
58
|
-
const cause = err.cause instanceof Error ? err.cause.message : String(err.cause);
|
|
59
|
-
return `config read error at ${err.path}: ${cause}`;
|
|
60
|
-
}
|
|
61
|
-
return err instanceof Error ? err.message : String(err);
|
|
62
|
-
}
|
|
63
|
-
function resolveTransportOptionsOrExit(input) {
|
|
64
|
-
return resolveTransportInputs(input).pipe(Effect.catchAll((err) => Effect.logError(`moltzap: ${transportResolutionMessage(err)}`).pipe(Effect.zipRight(Effect.sync(() => process.exit(1))))));
|
|
65
|
-
}
|
|
66
|
-
const transportLayerFromConfig = (config) => Layer.unwrapEffect(resolveTransportOptionsOrExit(resolverInputFromConfig(config)).pipe(Effect.map(makeTransportLayer)));
|
|
67
|
-
/**
|
|
68
|
-
* Top-level `moltzap` command. Subcommands are `@effect/cli` `Command`s —
|
|
69
|
-
* each handler returns an Effect. The single `NodeRuntime.runMain` below is
|
|
70
|
-
* the ONLY bridge from the Effect graph to Node; no per-command runPromise.
|
|
71
|
-
*
|
|
72
|
-
* Parent options (`--profile`) are parsed by `@effect/cli` and
|
|
73
|
-
* provided to subcommand handlers via the `Transport` Layer (see
|
|
74
|
-
* `transport.ts`).
|
|
75
|
-
*/
|
|
76
|
-
const moltzapBase = Command.make("moltzap", {
|
|
77
|
-
profile: globalProfileOption,
|
|
78
|
-
}).pipe(Command.withDescription("MoltZap CLI — messaging for OpenClaw AI agents.\n" +
|
|
79
|
-
"\n" +
|
|
80
|
-
"Global flags (parsed by @effect/cli before the selected subcommand " +
|
|
81
|
-
"runs):\n" +
|
|
82
|
-
" --profile <name> Load the named profile from ~/.moltzap/config.json " +
|
|
83
|
-
"(written by `moltzap register --profile <name>`) and send commands " +
|
|
84
|
-
"through that agent's local daemon socket.\n" +
|
|
85
|
-
"\n" +
|
|
86
|
-
"Without --profile, commands use the local daemon transport. `register` " +
|
|
87
|
-
"is the one exception: it consumes `--profile` locally to write a new " +
|
|
88
|
-
"profile instead of routing through the transport.\n" +
|
|
89
|
-
"\n" +
|
|
90
|
-
"See packages/client/src/cli/README.md for an end-to-end multi-agent " +
|
|
91
|
-
"walkthrough."), Command.withSubcommands([
|
|
92
|
-
registerCommand,
|
|
93
|
-
sendCommand,
|
|
94
|
-
conversationsCommand,
|
|
95
|
-
historyCommand,
|
|
96
|
-
statusCommand,
|
|
97
|
-
agentsCommand,
|
|
98
|
-
messagesCommand,
|
|
99
|
-
startCommand,
|
|
100
|
-
]));
|
|
101
|
-
const moltzap = Command.provide(moltzapBase, (config) => transportLayerFromConfig(config));
|
|
102
|
-
const cli = Command.run(moltzap, { name: "moltzap", version });
|
|
103
|
-
// eslint-disable-next-line agent-code-guard/prefer-effect-platform -- @effect/cli Command.run requires the Node argv vector at this process entrypoint.
|
|
104
|
-
cli(process.argv).pipe(Effect.provide(Layer.mergeAll(NodeContext.layer, loggerLive)), Logger.withMinimumLogLevel(minLogLevel), NodeRuntime.runMain);
|
|
105
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,uEAAuE;AACvE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,MAAM,EACN,cAAc,EACd,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,GACP,MAAM,QAAQ,CAAC;AAChB,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,oBAAoB,EACpB,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GAEvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB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ACpB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,EAC7D,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,EACvC,WAAW,CAAC,OAAO,CACpB,CAAC"}
|
package/dist/cli/output.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
/**
|
|
3
|
-
* Provides the log json runtime value.
|
|
4
|
-
* @param value Value to process.
|
|
5
|
-
* @returns The log json result.
|
|
6
|
-
*/
|
|
7
|
-
export declare const logJson: (value: unknown) => Effect.Effect<void>;
|
|
8
|
-
/**
|
|
9
|
-
* Provides the log lines runtime value.
|
|
10
|
-
* @param lines Value supplied to the operation.
|
|
11
|
-
* @returns The log lines result.
|
|
12
|
-
*/
|
|
13
|
-
export declare const logLines: (lines: Iterable<string>) => Effect.Effect<void>;
|
|
14
|
-
//# sourceMappingURL=output.d.ts.map
|
package/dist/cli/output.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOhC;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC5B,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UAAW,QAAQ,CAAC,MAAM,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAIjE,CAAC"}
|
package/dist/cli/output.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
const JSON_INDENT_SPACES = 2;
|
|
3
|
-
const formatJson = (value) => JSON.stringify(value, null, JSON_INDENT_SPACES);
|
|
4
|
-
/**
|
|
5
|
-
* Provides the log json runtime value.
|
|
6
|
-
* @param value Value to process.
|
|
7
|
-
* @returns The log json result.
|
|
8
|
-
*/
|
|
9
|
-
export const logJson = (value) => Effect.log(formatJson(value));
|
|
10
|
-
/**
|
|
11
|
-
* Provides the log lines runtime value.
|
|
12
|
-
* @param lines Value supplied to the operation.
|
|
13
|
-
* @returns The log lines result.
|
|
14
|
-
*/
|
|
15
|
-
export const logLines = (lines) => Effect.forEach(lines, (line) => Effect.log(line), {
|
|
16
|
-
concurrency: 1,
|
|
17
|
-
discard: true,
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=output.js.map
|
package/dist/cli/output.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,UAAU,GAAG,CAAC,KAAc,EAAU,EAAE,CAC5C,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAuB,EAAE,CAC7D,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAEhC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAuB,EAAuB,EAAE,CACvE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;IAChD,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,IAAI;CACd,CAAC,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type RpcGroup } from "@effect/rpc";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { type LocalDaemonError, localDaemonCommands, LocalDaemonRpcs } from "../local-daemon-rpc.js";
|
|
4
|
-
import { type PayloadForTag, type SuccessForTag } from "@moltzap/protocol/rpc";
|
|
5
|
-
type DaemonRpcs = RpcGroup.Rpcs<typeof LocalDaemonRpcs>;
|
|
6
|
-
/** Represents daemon command values. */
|
|
7
|
-
export type DaemonCommand = DaemonRpcs["_tag"];
|
|
8
|
-
/** Re-exports the public API from `current module`. */
|
|
9
|
-
export { localDaemonCommands };
|
|
10
|
-
declare const SocketRequestError_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 & {
|
|
11
|
-
readonly _tag: "SocketRequestError";
|
|
12
|
-
} & Readonly<A>;
|
|
13
|
-
/** Reports socket request failures. */
|
|
14
|
-
export declare class SocketRequestError extends SocketRequestError_base<{
|
|
15
|
-
readonly method: string;
|
|
16
|
-
readonly message: string;
|
|
17
|
-
readonly cause?: unknown;
|
|
18
|
-
}> {
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Provides the request daemon command runtime value.
|
|
22
|
-
* @param command Value supplied to the operation.
|
|
23
|
-
* @param payload Value supplied to the operation.
|
|
24
|
-
* @param socketPath Value supplied to the operation.
|
|
25
|
-
* @returns The request daemon command result.
|
|
26
|
-
*/
|
|
27
|
-
export declare const requestDaemonCommand: <Tag extends DaemonCommand>(command: Tag, payload: PayloadForTag<DaemonRpcs, Tag>, socketPath?: string) => Effect.Effect<SuccessForTag<DaemonRpcs, Tag>, SocketRequestError | LocalDaemonError>;
|
|
28
|
-
//# sourceMappingURL=socket-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socket-client.d.ts","sourceRoot":"","sources":["../../src/cli/socket-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAQ,MAAM,EAAS,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAEL,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAE/B,KAAK,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,wCAAwC;AACxC,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAQ/C,uDAAuD;AACvD,OAAO,EAAE,mBAAmB,EAAE,CAAC;;;;AAE/B,uCAAuC;AACvC,qBAAa,kBAAmB,SAAQ,wBAAuC;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;CAAG;AAkEL;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,SAAS,aAAa,WACnD,GAAG,WACH,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,eAC1B,MAAM,KAClB,MAAM,CAAC,MAAM,CACd,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,EAC9B,kBAAkB,GAAG,gBAAgB,CA2BU,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as Socket from "@effect/platform/Socket";
|
|
2
|
-
import * as NodeSocket from "@effect/platform-node/NodeSocket";
|
|
3
|
-
import { RpcClient, RpcSerialization, } from "@effect/rpc";
|
|
4
|
-
import { Data, Effect, Layer } from "effect";
|
|
5
|
-
import { isLocalDaemonError, localDaemonCommands, LocalDaemonRpcs, } from "../local-daemon-rpc.js";
|
|
6
|
-
import { MoltZapService } from "../service.js";
|
|
7
|
-
import { dispatchCall, } from "@moltzap/protocol/rpc";
|
|
8
|
-
const SOCKET_REQUEST_TIMEOUT_MS = 10_000;
|
|
9
|
-
/** Re-exports the public API from `current module`. */
|
|
10
|
-
export { localDaemonCommands };
|
|
11
|
-
/** Reports socket request failures. */
|
|
12
|
-
export class SocketRequestError extends Data.TaggedError("SocketRequestError") {
|
|
13
|
-
}
|
|
14
|
-
const socketRequestError = (method, message, cause) => new SocketRequestError({ method, message, cause });
|
|
15
|
-
const errorCode = (cause) => typeof cause === "object" && cause !== null && "code" in cause
|
|
16
|
-
? cause.code
|
|
17
|
-
: undefined;
|
|
18
|
-
const socketErrorCause = (err) => "cause" in err ? err.cause : err;
|
|
19
|
-
const fromSocketError = (method, err) => {
|
|
20
|
-
const cause = socketErrorCause(err);
|
|
21
|
-
const code = errorCode(cause);
|
|
22
|
-
if (code === "ENOENT" || code === "ECONNREFUSED") {
|
|
23
|
-
return socketRequestError(method, "MoltZap service is not running. Start the OpenClaw channel plugin first.", cause);
|
|
24
|
-
}
|
|
25
|
-
if ("reason" in err && err.reason === "OpenTimeout") {
|
|
26
|
-
return socketRequestError(method, "Socket request timed out", err);
|
|
27
|
-
}
|
|
28
|
-
return socketRequestError(method, err.message, err);
|
|
29
|
-
};
|
|
30
|
-
const fromRpcClientError = (method, err) => socketRequestError(method, err instanceof Error ? err.message : String(err), err);
|
|
31
|
-
const fromDaemonCommandError = (method, err) => {
|
|
32
|
-
if (err instanceof SocketRequestError) {
|
|
33
|
-
return err;
|
|
34
|
-
}
|
|
35
|
-
if (isLocalDaemonError(err)) {
|
|
36
|
-
return err;
|
|
37
|
-
}
|
|
38
|
-
return fromRpcClientError(method, err);
|
|
39
|
-
};
|
|
40
|
-
const callDaemonClient = (client, command, payload) => dispatchCall(client, command, payload);
|
|
41
|
-
/**
|
|
42
|
-
* Provides the request daemon command runtime value.
|
|
43
|
-
* @param command Value supplied to the operation.
|
|
44
|
-
* @param payload Value supplied to the operation.
|
|
45
|
-
* @param socketPath Value supplied to the operation.
|
|
46
|
-
* @returns The request daemon command result.
|
|
47
|
-
*/
|
|
48
|
-
export const requestDaemonCommand = (command, payload, socketPath) => Effect.scoped(Effect.gen(function* () {
|
|
49
|
-
const sockPath = socketPath ?? MoltZapService.SOCKET_PATH;
|
|
50
|
-
const socket = yield* NodeSocket.makeNet({
|
|
51
|
-
path: sockPath,
|
|
52
|
-
openTimeout: `${SOCKET_REQUEST_TIMEOUT_MS} millis`,
|
|
53
|
-
}).pipe(Effect.mapError((err) => fromSocketError(command, err)));
|
|
54
|
-
const protocolLayer = RpcClient.layerProtocolSocket().pipe(Layer.provide(RpcSerialization.layerNdjson), Layer.provide(Layer.succeed(Socket.Socket, socket)));
|
|
55
|
-
return yield* Effect.gen(function* () {
|
|
56
|
-
const client = yield* RpcClient.make(LocalDaemonRpcs);
|
|
57
|
-
return yield* callDaemonClient(client, command, payload);
|
|
58
|
-
}).pipe(Effect.provide(protocolLayer), Effect.timeoutFail({
|
|
59
|
-
duration: `${SOCKET_REQUEST_TIMEOUT_MS} millis`,
|
|
60
|
-
onTimeout: () => socketRequestError(command, "Socket request timed out"),
|
|
61
|
-
}), Effect.mapError((err) => fromDaemonCommandError(command, err)));
|
|
62
|
-
})).pipe(Effect.withSpan("requestDaemonCommand"));
|
|
63
|
-
//# sourceMappingURL=socket-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socket-client.js","sourceRoot":"","sources":["../../src/cli/socket-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAClD,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EACL,SAAS,EAET,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAElB,mBAAmB,EACnB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,YAAY,GAIb,MAAM,uBAAuB,CAAC;AAU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E,CAAC,IAAI,CACxD,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAC3C,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CACpD,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAChC,MAAM,MAAM,GACV,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAC7B,MAAM,CAAC,WAAW,CAAC;QACjB,QAAQ,EAAE,GAAG,yBAAyB,SAAS;QAC/C,SAAS,EAAE,GAAG,EAAE,CACd,kBAAkB,CAAC,OAAO,EAAE,0BAA0B,CAAC;KAC1D,CAAC,EACF,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAC/D,CAAC;AACJ,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC"}
|
package/dist/cli/transport.d.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI transport layer — the single boundary between the command handlers and
|
|
3
|
-
* the local daemon socket.
|
|
4
|
-
*
|
|
5
|
-
* Command handlers pull `Transport` from Effect context; they do NOT open
|
|
6
|
-
* sockets or construct clients themselves. The kind of
|
|
7
|
-
* transport in effect is decided once at CLI boot by {@link makeTransportLayer}
|
|
8
|
-
* and is immutable for the lifetime of the process.
|
|
9
|
-
*
|
|
10
|
-
* Test seam: integration tests swap {@link makeTransportLayer} for a layer
|
|
11
|
-
* that provides a recording `Transport`; unit tests provide `Transport`
|
|
12
|
-
* directly via `Effect.provideService`.
|
|
13
|
-
*/
|
|
14
|
-
import { Context, Effect, Layer } from "effect";
|
|
15
|
-
import type { RpcGroup } from "@effect/rpc";
|
|
16
|
-
import type { LocalDaemonError, LocalDaemonRpcs } from "../local-daemon-rpc.js";
|
|
17
|
-
import { type ProfileError, type ProfileName } from "../profile.js";
|
|
18
|
-
import type { PayloadForTag, SuccessForTag } from "@moltzap/protocol/rpc";
|
|
19
|
-
/** The local daemon command group's member `Rpc`s. */
|
|
20
|
-
type DaemonRpcs = RpcGroup.Rpcs<typeof LocalDaemonRpcs>;
|
|
21
|
-
/** The local command tags the CLI may originate. */
|
|
22
|
-
type DaemonCommand = DaemonRpcs["_tag"];
|
|
23
|
-
/** Errors any Transport.rpc call may surface. Exhaustive. */
|
|
24
|
-
export type TransportError = ServiceUnreachableError | TransportTimeoutError | TransportRpcError | TransportDecodeError | LocalDaemonError;
|
|
25
|
-
declare const ServiceUnreachableError_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 & {
|
|
26
|
-
readonly _tag: "ServiceUnreachableError";
|
|
27
|
-
} & Readonly<A>;
|
|
28
|
-
/**
|
|
29
|
-
* The daemon socket path did not exist or refused connection. Only raised
|
|
30
|
-
* by the daemon path.
|
|
31
|
-
*/
|
|
32
|
-
declare class ServiceUnreachableError extends ServiceUnreachableError_base<{
|
|
33
|
-
readonly socketPath: string;
|
|
34
|
-
readonly cause: unknown;
|
|
35
|
-
}> {
|
|
36
|
-
}
|
|
37
|
-
declare const TransportTimeoutError_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 & {
|
|
38
|
-
readonly _tag: "TransportTimeoutError";
|
|
39
|
-
} & Readonly<A>;
|
|
40
|
-
/** RPC exceeded the per-call deadline without a response frame. */
|
|
41
|
-
declare class TransportTimeoutError extends TransportTimeoutError_base<{
|
|
42
|
-
readonly method: string;
|
|
43
|
-
readonly timeoutMs: number;
|
|
44
|
-
}> {
|
|
45
|
-
}
|
|
46
|
-
declare const TransportRpcError_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 & {
|
|
47
|
-
readonly _tag: "TransportRpcError";
|
|
48
|
-
} & Readonly<A>;
|
|
49
|
-
/**
|
|
50
|
-
* Server returned a typed wire `error` for a request. `tag` is the failing
|
|
51
|
-
* method's tagged-error discriminant (e.g. `"TaskRejected"`, `"Forbidden"`) —
|
|
52
|
-
* the `_tag` the engine decoded the error against, not a numeric code.
|
|
53
|
-
*/
|
|
54
|
-
export declare class TransportRpcError extends TransportRpcError_base<{
|
|
55
|
-
readonly method: string;
|
|
56
|
-
readonly tag: string;
|
|
57
|
-
readonly message: string;
|
|
58
|
-
readonly data?: unknown;
|
|
59
|
-
}> {
|
|
60
|
-
}
|
|
61
|
-
declare const TransportDecodeError_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 & {
|
|
62
|
-
readonly _tag: "TransportDecodeError";
|
|
63
|
-
} & Readonly<A>;
|
|
64
|
-
/** Response frame failed to parse or did not match the expected RPC result shape. */
|
|
65
|
-
declare class TransportDecodeError extends TransportDecodeError_base<{
|
|
66
|
-
readonly method: string;
|
|
67
|
-
readonly cause: unknown;
|
|
68
|
-
}> {
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Transport surface used by every CLI command. One typed per-command call keyed
|
|
72
|
-
* by local daemon command.
|
|
73
|
-
*/
|
|
74
|
-
export interface Transport {
|
|
75
|
-
readonly command: <Tag extends DaemonCommand>(tag: Tag, payload: PayloadForTag<DaemonRpcs, Tag>) => Effect.Effect<SuccessForTag<DaemonRpcs, Tag>, TransportError>;
|
|
76
|
-
}
|
|
77
|
-
/** Provides the transport runtime value. */
|
|
78
|
-
export declare const transportSchema: Context.Tag<Transport, Transport>;
|
|
79
|
-
/**
|
|
80
|
-
* Inputs shaping the transport for one CLI invocation. Assembled from
|
|
81
|
-
* parsed CLI options and profile config by the CLI entrypoint.
|
|
82
|
-
*/
|
|
83
|
-
export interface TransportOptions {
|
|
84
|
-
/** Selected daemon socket path for this invocation. */
|
|
85
|
-
readonly socketPath: string;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Build the Layer that provides {@link Transport} for the current invocation.
|
|
89
|
-
* @param options Options that control the operation.
|
|
90
|
-
* @returns The created transport layer.
|
|
91
|
-
*/
|
|
92
|
-
export declare const makeTransportLayer: (options: TransportOptions) => Layer.Layer<Transport>;
|
|
93
|
-
/**
|
|
94
|
-
* Convenience for command handlers: pull the Transport tag and call a daemon
|
|
95
|
-
* command.
|
|
96
|
-
* Every subcommand routes through this helper; command handlers do not
|
|
97
|
-
* import `socket-client` directly.
|
|
98
|
-
* @param tag Value supplied to the operation.
|
|
99
|
-
* @param payload Value supplied to the operation.
|
|
100
|
-
* @returns The command result.
|
|
101
|
-
*/
|
|
102
|
-
export declare const command: <Tag extends DaemonCommand>(tag: Tag, payload: PayloadForTag<DaemonRpcs, Tag>) => Effect.Effect<SuccessForTag<DaemonRpcs, Tag>, TransportError, Transport>;
|
|
103
|
-
/**
|
|
104
|
-
* Uniform error-to-exit adapter for subcommand handlers. Catches every error
|
|
105
|
-
* channel, prints `Failed: <msg>` to stderr, and exits non-zero. Uses the
|
|
106
|
-
* tagged-error `message` field if present, otherwise the `_tag`, otherwise
|
|
107
|
-
* a generic fallback. Shared across every subcommand wrapper so the
|
|
108
|
-
* exit-code contract has a single implementation.
|
|
109
|
-
*
|
|
110
|
-
* No forced `process.exit(0)` — that would truncate piped stdout on large
|
|
111
|
-
* payloads.
|
|
112
|
-
* @param effect Effect to execute.
|
|
113
|
-
* @returns The run handler result.
|
|
114
|
-
*/
|
|
115
|
-
export declare const runHandler: <E extends {
|
|
116
|
-
readonly message?: string;
|
|
117
|
-
readonly _tag?: string;
|
|
118
|
-
}, R>(effect: Effect.Effect<void, E, R>) => Effect.Effect<void, never, R>;
|
|
119
|
-
/**
|
|
120
|
-
* Lazy resolver invoked by the CLI entrypoint BEFORE constructing the
|
|
121
|
-
* transport layer. With `profileName` set, this resolves the named profile
|
|
122
|
-
* into the profile agent's daemon socket; otherwise it uses the default
|
|
123
|
-
* daemon socket.
|
|
124
|
-
* @param parsed Value supplied to the operation.
|
|
125
|
-
* @param parsed.profileName Value supplied to the operation.
|
|
126
|
-
* @returns The resolve transport inputs result.
|
|
127
|
-
*/
|
|
128
|
-
export declare const resolveTransportInputs: (parsed: {
|
|
129
|
-
readonly profileName?: ProfileName;
|
|
130
|
-
}) => Effect.Effect<TransportOptions, ProfileError>;
|
|
131
|
-
export {};
|
|
132
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/cli/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAQ,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE1E,sDAAsD;AACtD,KAAK,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,o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;AAIF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AA6CD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,YACpB,gBAAgB,KACxB,KAAK,CAAC,KAAK,CAAC,SAAS,CACiD,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAI,GAAG,SAAS,aAAa,OAC1C,GAAG,WACC,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,KACtC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,cAAc,EAAE,SAAS,CACT,CAAC;AAElE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAC/D,CAAC,UAEO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,KAChC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAW5B,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,WAAY;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC,KAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAaI,CAAC"}
|
package/dist/cli/transport.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI transport layer — the single boundary between the command handlers and
|
|
3
|
-
* the local daemon socket.
|
|
4
|
-
*
|
|
5
|
-
* Command handlers pull `Transport` from Effect context; they do NOT open
|
|
6
|
-
* sockets or construct clients themselves. The kind of
|
|
7
|
-
* transport in effect is decided once at CLI boot by {@link makeTransportLayer}
|
|
8
|
-
* and is immutable for the lifetime of the process.
|
|
9
|
-
*
|
|
10
|
-
* Test seam: integration tests swap {@link makeTransportLayer} for a layer
|
|
11
|
-
* that provides a recording `Transport`; unit tests provide `Transport`
|
|
12
|
-
* directly via `Effect.provideService`.
|
|
13
|
-
*/
|
|
14
|
-
import { Context, Data, Effect, Layer } from "effect";
|
|
15
|
-
import { MoltZapService } from "../service.js";
|
|
16
|
-
import { getMoltZapAgentServiceSocketPath } from "../local-paths.js";
|
|
17
|
-
import { requestDaemonCommand, SocketRequestError } from "./socket-client.js";
|
|
18
|
-
import { resolveProfileRecord, } from "../profile.js";
|
|
19
|
-
/**
|
|
20
|
-
* The daemon socket path did not exist or refused connection. Only raised
|
|
21
|
-
* by the daemon path.
|
|
22
|
-
*/
|
|
23
|
-
class ServiceUnreachableError extends Data.TaggedError("ServiceUnreachableError") {
|
|
24
|
-
}
|
|
25
|
-
/** RPC exceeded the per-call deadline without a response frame. */
|
|
26
|
-
class TransportTimeoutError extends Data.TaggedError("TransportTimeoutError") {
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Server returned a typed wire `error` for a request. `tag` is the failing
|
|
30
|
-
* method's tagged-error discriminant (e.g. `"TaskRejected"`, `"Forbidden"`) —
|
|
31
|
-
* the `_tag` the engine decoded the error against, not a numeric code.
|
|
32
|
-
*/
|
|
33
|
-
export class TransportRpcError extends Data.TaggedError("TransportRpcError") {
|
|
34
|
-
}
|
|
35
|
-
/** Response frame failed to parse or did not match the expected RPC result shape. */
|
|
36
|
-
class TransportDecodeError extends Data.TaggedError("TransportDecodeError") {
|
|
37
|
-
}
|
|
38
|
-
/** Provides the transport runtime value. */
|
|
39
|
-
export const transportSchema = Context.GenericTag("moltzap/cli/Transport");
|
|
40
|
-
const DAEMON_TIMEOUT_MS = 10_000;
|
|
41
|
-
// Map local socket faults to CLI transport tags. Errors decoded from the daemon
|
|
42
|
-
// RPC error channel are already typed tagged errors and pass through unchanged.
|
|
43
|
-
const tagDaemonError = (method, err, socketPath) => {
|
|
44
|
-
if (!(err instanceof SocketRequestError)) {
|
|
45
|
-
return err;
|
|
46
|
-
}
|
|
47
|
-
const msg = err.message;
|
|
48
|
-
if (msg.includes("not running") ||
|
|
49
|
-
msg.includes("ENOENT") ||
|
|
50
|
-
msg.includes("ECONNREFUSED")) {
|
|
51
|
-
return new ServiceUnreachableError({
|
|
52
|
-
socketPath,
|
|
53
|
-
cause: err,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (msg.includes("timed out") || msg.includes("aborted")) {
|
|
57
|
-
return new TransportTimeoutError({ method, timeoutMs: DAEMON_TIMEOUT_MS });
|
|
58
|
-
}
|
|
59
|
-
if (msg.startsWith("Malformed")) {
|
|
60
|
-
return new TransportDecodeError({ method, cause: err });
|
|
61
|
-
}
|
|
62
|
-
return new TransportRpcError({
|
|
63
|
-
method,
|
|
64
|
-
tag: err._tag,
|
|
65
|
-
message: msg,
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const makeDaemonTransport = (socketPath) => ({
|
|
69
|
-
command: (tag, payload) => requestDaemonCommand(tag, payload, socketPath).pipe(Effect.mapError((err) => tagDaemonError(tag, err, socketPath))),
|
|
70
|
-
});
|
|
71
|
-
/**
|
|
72
|
-
* Build the Layer that provides {@link Transport} for the current invocation.
|
|
73
|
-
* @param options Options that control the operation.
|
|
74
|
-
* @returns The created transport layer.
|
|
75
|
-
*/
|
|
76
|
-
export const makeTransportLayer = (options) => Layer.succeed(transportSchema, makeDaemonTransport(options.socketPath));
|
|
77
|
-
/**
|
|
78
|
-
* Convenience for command handlers: pull the Transport tag and call a daemon
|
|
79
|
-
* command.
|
|
80
|
-
* Every subcommand routes through this helper; command handlers do not
|
|
81
|
-
* import `socket-client` directly.
|
|
82
|
-
* @param tag Value supplied to the operation.
|
|
83
|
-
* @param payload Value supplied to the operation.
|
|
84
|
-
* @returns The command result.
|
|
85
|
-
*/
|
|
86
|
-
export const command = (tag, payload) => Effect.flatMap(transportSchema, (t) => t.command(tag, payload));
|
|
87
|
-
/**
|
|
88
|
-
* Uniform error-to-exit adapter for subcommand handlers. Catches every error
|
|
89
|
-
* channel, prints `Failed: <msg>` to stderr, and exits non-zero. Uses the
|
|
90
|
-
* tagged-error `message` field if present, otherwise the `_tag`, otherwise
|
|
91
|
-
* a generic fallback. Shared across every subcommand wrapper so the
|
|
92
|
-
* exit-code contract has a single implementation.
|
|
93
|
-
*
|
|
94
|
-
* No forced `process.exit(0)` — that would truncate piped stdout on large
|
|
95
|
-
* payloads.
|
|
96
|
-
* @param effect Effect to execute.
|
|
97
|
-
* @returns The run handler result.
|
|
98
|
-
*/
|
|
99
|
-
export const runHandler = (effect) => effect.pipe(Effect.catchAll((err) => {
|
|
100
|
-
const msg = err.message !== undefined && err.message !== ""
|
|
101
|
-
? err.message
|
|
102
|
-
: (err._tag ?? "unknown error");
|
|
103
|
-
return Effect.logError(`Failed: ${msg}`).pipe(Effect.zipRight(Effect.sync(() => process.exit(1))));
|
|
104
|
-
}));
|
|
105
|
-
/**
|
|
106
|
-
* Lazy resolver invoked by the CLI entrypoint BEFORE constructing the
|
|
107
|
-
* transport layer. With `profileName` set, this resolves the named profile
|
|
108
|
-
* into the profile agent's daemon socket; otherwise it uses the default
|
|
109
|
-
* daemon socket.
|
|
110
|
-
* @param parsed Value supplied to the operation.
|
|
111
|
-
* @param parsed.profileName Value supplied to the operation.
|
|
112
|
-
* @returns The resolve transport inputs result.
|
|
113
|
-
*/
|
|
114
|
-
export const resolveTransportInputs = (parsed) => Effect.gen(function* () {
|
|
115
|
-
// ─── Branch A: profile ─────────────────────────────────────────────────
|
|
116
|
-
if (parsed.profileName !== undefined) {
|
|
117
|
-
const record = yield* resolveProfileRecord(parsed.profileName);
|
|
118
|
-
return {
|
|
119
|
-
socketPath: getMoltZapAgentServiceSocketPath(record.agentId),
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
// ─── Branch B: daemon ──────────────────────────────────────────────────
|
|
123
|
-
return {
|
|
124
|
-
socketPath: MoltZapService.SOCKET_PATH,
|
|
125
|
-
};
|
|
126
|
-
}).pipe(Effect.withSpan("resolveTransportInputs"));
|
|
127
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/cli/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,OAAO,EACL,oBAAoB,GAGrB,MAAM,eAAe,CAAC;AAmBvB;;;GAGG;AACH,MAAM,uBAAwB,SAAQ,IAAI,CAAC,WAAW,CACpD,yBAAyB,CAIzB;CAAG;AAEL,mEAAmE;AACnE,MAAM,qBAAsB,SAAQ,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAG1E;CAAG;AAEL;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAKzE;CAAG;AAEL,qFAAqF;AACrF,MAAM,oBAAqB,SAAQ,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAGxE;CAAG;AAeL,4CAA4C;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,UAAU,CAC/C,uBAAuB,CACxB,CAAC;AAaF,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,gFAAgF;AAChF,gFAAgF;AAChF,MAAM,cAAc,GAAG,CACrB,MAAc,EACd,GAA0C,EAC1C,UAAkB,EACF,EAAE;IAClB,IAAI,CAAC,CAAC,GAAG,YAAY,kBAAkB,CAAC,EAAE,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC;I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C7D,CAAC;IACJ,CAAC;IACD,0EAA0E;IAC1E,OAAO;QACL,UAAU,EAAE,cAAc,CAAC,WAAW;KACvC,CAAC;AACJ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC"}
|
package/dist/config.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import type { AgentId, AgentKey } from "@moltzap/protocol/identity";
|
|
3
|
-
import { type ServerBaseUrl as ServerBaseUrlType } from "@moltzap/protocol/network";
|
|
4
|
-
import { type ProfileInvalidNameError, ProfileNotFoundError } from "./profile.js";
|
|
5
|
-
/** Describes moltzap service config. */
|
|
6
|
-
export interface MoltzapServiceConfig {
|
|
7
|
-
readonly serverUrl: ServerBaseUrlType;
|
|
8
|
-
readonly agentKey: AgentKey;
|
|
9
|
-
readonly agentId: AgentId;
|
|
10
|
-
}
|
|
11
|
-
/** Represents service config error conditions. */
|
|
12
|
-
export type ServiceConfigError = ConfigReadError | ProfileInvalidNameError | ProfileNotFoundError;
|
|
13
|
-
declare const ConfigReadError_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 & {
|
|
14
|
-
readonly _tag: "ConfigReadError";
|
|
15
|
-
} & Readonly<A>;
|
|
16
|
-
declare class ConfigReadError extends ConfigReadError_base<{
|
|
17
|
-
readonly cause: unknown;
|
|
18
|
-
readonly message: string;
|
|
19
|
-
readonly path: string;
|
|
20
|
-
}> {
|
|
21
|
-
}
|
|
22
|
-
/** Canonical path-free server address from the environment or default. */
|
|
23
|
-
export declare const getServerUrl: Effect.Effect<ServerBaseUrlType, ConfigReadError>;
|
|
24
|
-
/** HTTP control-plane origin derived from the same canonical address. */
|
|
25
|
-
export declare const getHttpUrl: Effect.Effect<string, ConfigReadError>;
|
|
26
|
-
/**
|
|
27
|
-
* Provides the load service config runtime value.
|
|
28
|
-
* @param profileName Value supplied to the operation.
|
|
29
|
-
* @returns The load service config result.
|
|
30
|
-
*/
|
|
31
|
-
export declare const loadServiceConfig: (profileName: string) => Effect.Effect<MoltzapServiceConfig, ServiceConfigError>;
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAIL,KAAK,aAAa,IAAI,iBAAiB,EACxC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAIL,KAAK,uBAAuB,EAC5B,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,wCAAwC;AACxC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAKD,kDAAkD;AAClD,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,uBAAuB,GACvB,oBAAoB,CAAC;;;;AAEzB,cAAM,eAAgB,SAAQ,qBAAoC;IAChE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;CAAG;AA6BL,0EAA0E;AAC1E,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAMxE,CAAC;AAEJ,yEAAyE;AACzE,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAClB,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,gBACf,MAAM,KAClB,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE,kBAAkB,CAgBV,CAAC"}
|
package/dist/config.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Config, ConfigProvider, Data, Effect, Option, Schema } from "effect";
|
|
2
|
-
import { httpBaseUrl, serverBaseUrl, serverBaseUrlSchema, } from "@moltzap/protocol/network";
|
|
3
|
-
import { loadLayeredConfig, parseProfileName, ProfileNotFoundError, } from "./profile.js";
|
|
4
|
-
const DEFAULT_SERVER_URL = serverBaseUrl("wss://api.moltzap.xyz");
|
|
5
|
-
const SERVER_URL_ENV = "MOLTZAP_SERVER_URL";
|
|
6
|
-
class ConfigReadError extends Data.TaggedError("ConfigReadError") {
|
|
7
|
-
}
|
|
8
|
-
function describeCause(cause) {
|
|
9
|
-
return cause instanceof Error ? cause.message : String(cause);
|
|
10
|
-
}
|
|
11
|
-
function configReadError(configPath, cause, detail) {
|
|
12
|
-
return new ConfigReadError({
|
|
13
|
-
cause,
|
|
14
|
-
message: `Failed to ${detail} ${configPath}: ${describeCause(cause)}`,
|
|
15
|
-
path: configPath,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
function configReadErrorFromProfile(error) {
|
|
19
|
-
return configReadError(error.path, error.cause, "read");
|
|
20
|
-
}
|
|
21
|
-
const configuredServerUrl = Config.option(Config.string(SERVER_URL_ENV)).pipe(Effect.withConfigProvider(ConfigProvider.fromEnv()), Effect.map((value) => Option.getOrElse(value, () => DEFAULT_SERVER_URL)));
|
|
22
|
-
/** Canonical path-free server address from the environment or default. */
|
|
23
|
-
export const getServerUrl = configuredServerUrl.pipe(Effect.flatMap(Schema.decodeUnknown(serverBaseUrlSchema)), Effect.mapError((cause) => configReadError(SERVER_URL_ENV, cause, "read and validate")));
|
|
24
|
-
/** HTTP control-plane origin derived from the same canonical address. */
|
|
25
|
-
export const getHttpUrl = getServerUrl.pipe(Effect.map(httpBaseUrl));
|
|
26
|
-
/**
|
|
27
|
-
* Provides the load service config runtime value.
|
|
28
|
-
* @param profileName Value supplied to the operation.
|
|
29
|
-
* @returns The load service config result.
|
|
30
|
-
*/
|
|
31
|
-
export const loadServiceConfig = (profileName) => Effect.gen(function* () {
|
|
32
|
-
const name = yield* parseProfileName(profileName);
|
|
33
|
-
const layered = yield* loadLayeredConfig.pipe(Effect.mapError(configReadErrorFromProfile));
|
|
34
|
-
const profile = layered.profiles.get(name);
|
|
35
|
-
if (profile === undefined) {
|
|
36
|
-
return yield* new ProfileNotFoundError({ name });
|
|
37
|
-
}
|
|
38
|
-
const serverUrl = yield* getServerUrl;
|
|
39
|
-
return {
|
|
40
|
-
serverUrl,
|
|
41
|
-
agentKey: profile.apiKey,
|
|
42
|
-
agentId: profile.agentId,
|
|
43
|
-
};
|
|
44
|
-
}).pipe(Effect.withSpan("loadServiceConfig"));
|
|
45
|
-
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9E,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,GAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAGhB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAStB,MAAM,kBAAkB,GAAG,aAAa,CAAC,uBAAuB,CAAC,CAAC;AAClE,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAQ5C,MAAM,eAAgB,SAAQ,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAI9D;CAAG;AAEL,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO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