@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
|
@@ -4,8 +4,7 @@ import { Option } from "effect";
|
|
|
4
4
|
* `moltzap register <name> <invite-code> [-d description] [--profile <name>] [--no-persist]`
|
|
5
5
|
*
|
|
6
6
|
* POST /api/v1/auth/register, then (by default) persist the result into
|
|
7
|
-
*
|
|
8
|
-
* channel picks it up on its next file-watcher cycle.
|
|
7
|
+
* `~/.moltzap/config.json`.
|
|
9
8
|
*
|
|
10
9
|
* ```mermaid
|
|
11
10
|
* sequenceDiagram
|
|
@@ -17,32 +16,31 @@ import { Option } from "effect";
|
|
|
17
16
|
* participant fs
|
|
18
17
|
*
|
|
19
18
|
* shell->>cli: moltzap register <name> <code>
|
|
20
|
-
* Note over cli: parse args +
|
|
19
|
+
* Note over cli: parse args + shared profile-name schema
|
|
21
20
|
* cli->>reg: handler({name, inviteCode, ...})
|
|
22
21
|
* reg->>http: registerAgent(name, inviteCode, desc)
|
|
23
22
|
* http->>server: POST /api/v1/auth/register
|
|
24
|
-
* server-->>http: 200 {agentId, apiKey
|
|
23
|
+
* server-->>http: 200 {agentId, apiKey}
|
|
25
24
|
* http-->>reg: RegisterResponse
|
|
26
25
|
* alt --no-persist
|
|
27
26
|
* reg-->>shell: stdout — print response
|
|
28
27
|
* else default
|
|
29
|
-
* reg->>fs: persistRegistration
|
|
28
|
+
* reg->>fs: persistRegistration; writeProfile
|
|
30
29
|
* reg-->>shell: stdout — Agent registered
|
|
31
30
|
* end
|
|
32
31
|
* ```
|
|
33
32
|
*
|
|
34
33
|
* Options:
|
|
35
|
-
* --profile <name> write under `profiles.<name
|
|
36
|
-
*
|
|
37
|
-
* --no-persist print
|
|
38
|
-
* `~/.moltzap/config.json
|
|
39
|
-
* `~/.openclaw/openclaw.json`.
|
|
34
|
+
* --profile <name> write under `profiles.<name>`; omitted uses
|
|
35
|
+
* the agent name as the profile name.
|
|
36
|
+
* --no-persist print non-secret registration details only; no writes to
|
|
37
|
+
* `~/.moltzap/config.json`.
|
|
40
38
|
*/
|
|
41
39
|
export declare const registerCommand: Command.Command<"register", never, never, {
|
|
42
|
-
readonly name: string
|
|
40
|
+
readonly name: string & import("effect/Brand").Brand<"ProfileName">;
|
|
43
41
|
readonly inviteCode: string;
|
|
44
42
|
readonly description: Option.Option<string>;
|
|
45
|
-
readonly profile: Option.Option<string
|
|
43
|
+
readonly profile: Option.Option<string & import("effect/Brand").Brand<"ProfileName">>;
|
|
46
44
|
readonly noPersist: boolean;
|
|
47
45
|
}>;
|
|
48
46
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAW,MAAM,aAAa,CAAC;AACrD,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AA8FxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,eAAe;;;;;;EAmD3B,CAAC"}
|
|
@@ -1,130 +1,45 @@
|
|
|
1
|
-
/* eslint-disable jsdoc/text-escaping -- mermaid sequenceDiagram blocks need literal `<br>` (HTML5) for renderer compatibility; the escape would render as literal text. */
|
|
2
1
|
import { Args, Command, Options } from "@effect/cli";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { emitNoPersist, parseProfileName, writeProfile, } from "../profile.js";
|
|
10
|
-
const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/;
|
|
11
|
-
const JSON_INDENT_SPACES = 2;
|
|
12
|
-
function parseOpenClawConfig(contents) {
|
|
13
|
-
return Effect.try({
|
|
14
|
-
try: () => JSON.parse(contents),
|
|
15
|
-
catch: (err) => err,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
function readExistingOpenClawConfig(fileSystem, configPath) {
|
|
19
|
-
return fileSystem.exists(configPath).pipe(Effect.flatMap((exists) => {
|
|
20
|
-
if (!exists)
|
|
21
|
-
return Effect.succeed({});
|
|
22
|
-
return fileSystem
|
|
23
|
-
.readFileString(configPath, "utf-8")
|
|
24
|
-
.pipe(Effect.flatMap(parseOpenClawConfig));
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Write channel config directly to the OpenClaw JSON file.
|
|
29
|
-
* Avoids `openclaw config set` which triggers both a file-watcher restart
|
|
30
|
-
* AND an internal notification — causing a double-SIGUSR1 race that leaves
|
|
31
|
-
* the gateway stuck in draining mode. Direct file write triggers only the
|
|
32
|
-
* file watcher → one clean restart.
|
|
33
|
-
*
|
|
34
|
-
* Per architect design rev 4 finding 2, this side effect is gated by the
|
|
35
|
-
* caller: `--no-persist` skips this call entirely (Invariant §4.4).
|
|
36
|
-
*/
|
|
37
|
-
const writeOpenClawChannelConfig = (account) => Effect.gen(function* () {
|
|
38
|
-
const fileSystem = yield* FileSystem.FileSystem;
|
|
39
|
-
const configDir = getOpenClawConfigDir();
|
|
40
|
-
const configPath = getOpenClawConfigPath();
|
|
41
|
-
let config = {};
|
|
42
|
-
const existingConfig = yield* readExistingOpenClawConfig(fileSystem, configPath).pipe(Effect.either);
|
|
43
|
-
yield* Either.match(existingConfig, {
|
|
44
|
-
onLeft: (err) => Effect.logWarning(`moltzap: existing openclaw.json unreadable, starting fresh: ${err instanceof Error ? err.message : String(err)}`),
|
|
45
|
-
onRight: (value) => Effect.sync(() => {
|
|
46
|
-
config = value;
|
|
47
|
-
}),
|
|
48
|
-
});
|
|
49
|
-
const channels = config.channels ?? {};
|
|
50
|
-
channels.moltzap = {
|
|
51
|
-
accounts: [{ id: "default", ...account }],
|
|
52
|
-
};
|
|
53
|
-
config.channels = channels;
|
|
54
|
-
yield* fileSystem.makeDirectory(configDir, { recursive: true });
|
|
55
|
-
yield* fileSystem.writeFileString(configPath, JSON.stringify(config, null, JSON_INDENT_SPACES) + "\n");
|
|
56
|
-
}).pipe(Effect.provide(NodeFileSystem.layer), Effect.either, Effect.flatMap(Either.match({
|
|
57
|
-
onLeft: (err) => Effect.fail(err instanceof Error ? err : new Error(String(err))),
|
|
58
|
-
onRight: (value) => Effect.succeed(value),
|
|
59
|
-
})));
|
|
60
|
-
const nameArg = Args.text({ name: "name" }).pipe(Args.withDescription("Agent name (lowercase alphanumeric, 3-32 chars)"));
|
|
2
|
+
import { Effect, Option } from "effect";
|
|
3
|
+
import { getHttpUrl, getServerUrl } from "../../config.js";
|
|
4
|
+
import { registerAgent } from "../../auth.js";
|
|
5
|
+
import { emitNoPersist, ProfileName, writeProfile, } from "../../profile.js";
|
|
6
|
+
import { logLines } from "../output.js";
|
|
7
|
+
const nameArg = Args.text({ name: "name" }).pipe(Args.withSchema(ProfileName), Args.withDescription("Agent name (lowercase alphanumeric, 3-32 chars)"));
|
|
61
8
|
const inviteCodeArg = Args.text({ name: "invite-code" }).pipe(Args.withDescription("Invite code from your invite URL"));
|
|
62
9
|
const descriptionOption = Options.text("description").pipe(Options.withAlias("d"), Options.withDescription("Agent description"), Options.optional);
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"`profiles.<name>` in ~/.moltzap/config.json. Omit to overwrite the " +
|
|
71
|
-
"legacy top-level record (the default profile). Other subcommands " +
|
|
10
|
+
// `register` consumes `--profile` locally because it writes a NEW profile.
|
|
11
|
+
// Parent-level `moltzap --profile <name>` means "load an existing profile"
|
|
12
|
+
// for transport selection, and would reject the new profile before this
|
|
13
|
+
// command could create it.
|
|
14
|
+
const profileOption = Options.text("profile").pipe(Options.withSchema(ProfileName), Options.withDescription("Named profile to register under. Writes the new apiKey to " +
|
|
15
|
+
"`profiles.<name>` in ~/.moltzap/config.json. Omit to use the " +
|
|
16
|
+
"agent name as the profile name. Other subcommands " +
|
|
72
17
|
"select an existing profile via the global `--profile` flag (see " +
|
|
73
18
|
"`moltzap --help`)."), Options.optional);
|
|
74
|
-
const noPersistFlag = Options.boolean("no-persist").pipe(Options.withDescription("Do not write the registered key to ~/.moltzap/config.json
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
"`--as $KEY`) without mutating either config tree."));
|
|
78
|
-
function invalidAgentName(name) {
|
|
79
|
-
return Effect.sync(() => {
|
|
80
|
-
console.error(`Invalid agent name "${name}". Must be 3-32 chars, lowercase alphanumeric and hyphens, cannot start or end with a hyphen.`);
|
|
81
|
-
process.exit(1);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function profileRecordFrom(name, result, serverUrl) {
|
|
19
|
+
const noPersistFlag = Options.boolean("no-persist").pipe(Options.withDescription("Do not write the registered key to ~/.moltzap/config.json. Prints the " +
|
|
20
|
+
"agent id without mutating client config."));
|
|
21
|
+
function profileRecordFrom(name, result) {
|
|
85
22
|
return {
|
|
23
|
+
agentId: result.agentId,
|
|
86
24
|
apiKey: result.apiKey,
|
|
87
25
|
agentName: name,
|
|
88
|
-
serverUrl,
|
|
89
|
-
registeredAt: new Date().toISOString(),
|
|
90
26
|
};
|
|
91
27
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
console.log("\nShare the claim URL with the agent's owner to verify ownership.");
|
|
28
|
+
function printRegistration(headline, result, serverUrl) {
|
|
29
|
+
return logLines([
|
|
30
|
+
headline,
|
|
31
|
+
` Agent ID: ${result.agentId}`,
|
|
32
|
+
` Server URL: ${serverUrl}`,
|
|
33
|
+
]);
|
|
99
34
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
console.log(` Agent ID: ${result.agentId}`);
|
|
103
|
-
console.log(` API Key: ${result.apiKey}`);
|
|
104
|
-
console.log(` Server URL: ${serverUrl}`);
|
|
105
|
-
console.log(` Claim URL: ${result.claimUrl}`);
|
|
106
|
-
console.log("\nShare the claim URL with the agent's owner to verify ownership.");
|
|
107
|
-
}
|
|
108
|
-
function persistRegistration({ profile, record, result, serverUrl, name, }) {
|
|
109
|
-
if (Option.isSome(profile)) {
|
|
110
|
-
return parseProfileName(profile.value).pipe(Effect.flatMap((profileName) => writeProfile(profileName, record)));
|
|
111
|
-
}
|
|
112
|
-
return updateConfig(() => ({
|
|
113
|
-
serverUrl,
|
|
114
|
-
apiKey: result.apiKey,
|
|
115
|
-
agentName: name,
|
|
116
|
-
})).pipe(Effect.zipRight(writeOpenClawChannelConfig({
|
|
117
|
-
apiKey: result.apiKey,
|
|
118
|
-
serverUrl,
|
|
119
|
-
agentName: name,
|
|
120
|
-
})));
|
|
35
|
+
function persistRegistration({ profile, record, name, }) {
|
|
36
|
+
return writeProfile(Option.getOrElse(profile, () => name), record);
|
|
121
37
|
}
|
|
122
38
|
/**
|
|
123
39
|
* `moltzap register <name> <invite-code> [-d description] [--profile <name>] [--no-persist]`
|
|
124
40
|
*
|
|
125
41
|
* POST /api/v1/auth/register, then (by default) persist the result into
|
|
126
|
-
*
|
|
127
|
-
* channel picks it up on its next file-watcher cycle.
|
|
42
|
+
* `~/.moltzap/config.json`.
|
|
128
43
|
*
|
|
129
44
|
* ```mermaid
|
|
130
45
|
* sequenceDiagram
|
|
@@ -136,26 +51,25 @@ function persistRegistration({ profile, record, result, serverUrl, name, }) {
|
|
|
136
51
|
* participant fs
|
|
137
52
|
*
|
|
138
53
|
* shell->>cli: moltzap register <name> <code>
|
|
139
|
-
* Note over cli: parse args +
|
|
54
|
+
* Note over cli: parse args + shared profile-name schema
|
|
140
55
|
* cli->>reg: handler({name, inviteCode, ...})
|
|
141
56
|
* reg->>http: registerAgent(name, inviteCode, desc)
|
|
142
57
|
* http->>server: POST /api/v1/auth/register
|
|
143
|
-
* server-->>http: 200 {agentId, apiKey
|
|
58
|
+
* server-->>http: 200 {agentId, apiKey}
|
|
144
59
|
* http-->>reg: RegisterResponse
|
|
145
60
|
* alt --no-persist
|
|
146
61
|
* reg-->>shell: stdout — print response
|
|
147
62
|
* else default
|
|
148
|
-
* reg->>fs: persistRegistration
|
|
63
|
+
* reg->>fs: persistRegistration; writeProfile
|
|
149
64
|
* reg-->>shell: stdout — Agent registered
|
|
150
65
|
* end
|
|
151
66
|
* ```
|
|
152
67
|
*
|
|
153
68
|
* Options:
|
|
154
|
-
* --profile <name> write under `profiles.<name
|
|
155
|
-
*
|
|
156
|
-
* --no-persist print
|
|
157
|
-
* `~/.moltzap/config.json
|
|
158
|
-
* `~/.openclaw/openclaw.json`.
|
|
69
|
+
* --profile <name> write under `profiles.<name>`; omitted uses
|
|
70
|
+
* the agent name as the profile name.
|
|
71
|
+
* --no-persist print non-secret registration details only; no writes to
|
|
72
|
+
* `~/.moltzap/config.json`.
|
|
159
73
|
*/
|
|
160
74
|
export const registerCommand = Command.make("register", {
|
|
161
75
|
name: nameArg,
|
|
@@ -164,26 +78,26 @@ export const registerCommand = Command.make("register", {
|
|
|
164
78
|
profile: profileOption,
|
|
165
79
|
noPersist: noPersistFlag,
|
|
166
80
|
}, ({ name, inviteCode, description, profile, noPersist }) => {
|
|
167
|
-
if (!NAME_PATTERN.test(name)) {
|
|
168
|
-
return invalidAgentName(name);
|
|
169
|
-
}
|
|
170
81
|
const desc = Option.isSome(description) ? description.value : undefined;
|
|
171
82
|
return Effect.gen(function* () {
|
|
172
|
-
const
|
|
83
|
+
const httpUrl = yield* getHttpUrl;
|
|
84
|
+
const result = yield* registerAgent(httpUrl, name, {
|
|
85
|
+
inviteCode,
|
|
86
|
+
...(desc === undefined ? {} : { description: desc }),
|
|
87
|
+
});
|
|
173
88
|
const serverUrl = yield* getServerUrl;
|
|
174
|
-
const record = profileRecordFrom(name, result
|
|
89
|
+
const record = profileRecordFrom(name, result);
|
|
175
90
|
if (noPersist) {
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
|
|
91
|
+
// No writes to ~/.moltzap/.
|
|
92
|
+
yield* emitNoPersist(record);
|
|
93
|
+
yield* printRegistration(`Agent "${name}" registered (not persisted).`, result, serverUrl);
|
|
179
94
|
return;
|
|
180
95
|
}
|
|
181
|
-
yield* persistRegistration({ profile, record,
|
|
182
|
-
|
|
183
|
-
}).pipe(Effect.withSpan("registerCommand"), Effect.catchAll((err) =>
|
|
96
|
+
yield* persistRegistration({ profile, record, name });
|
|
97
|
+
yield* printRegistration(`Agent "${name}" registered and profile saved.`, result, serverUrl);
|
|
98
|
+
}).pipe(Effect.withSpan("registerCommand"), Effect.catchAll((err) => {
|
|
184
99
|
const msg = err instanceof Error ? err.message : String(err);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
})));
|
|
100
|
+
return Effect.logError(`Registration failed: ${msg}`).pipe(Effect.zipRight(Effect.sync(() => process.exit(1))));
|
|
101
|
+
}));
|
|
188
102
|
}).pipe(Command.withDescription("Register a new agent on MoltZap (requires invite code)"));
|
|
189
103
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/cli/commands/register.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/cli/commands/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,WAAW,EACX,YAAY,GAGb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAC9C,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAC5B,IAAI,CAAC,eAAe,CAAC,iDAAiD,CAAC,CACxE,CAAC;AAEF,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,IAAI,CAC3D,IAAI,CAAC,eAAe,CAAC,kCAAkC,CAAC,CACzD,CAAC;AAEF,MAAM,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CACxD,OAAO,CAAC,SAAS,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AAI,CACL,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAClC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE;QACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC,QAAQ,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC,IAAI,CACxD,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CACpD,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CACF,CAAC,IAAI,CACJ,OAAO,CAAC,eAAe,CACrB,wDAAwD,CACzD,CACF,CAAC"}
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
import { Command } from "@effect/cli";
|
|
2
2
|
import { Option } from "effect";
|
|
3
|
-
import {
|
|
3
|
+
import { type SendTarget as SendTargetValue } from "../../local-daemon-rpc.js";
|
|
4
|
+
import type { Transport } from "../transport.js";
|
|
5
|
+
import { MessageId } from "@moltzap/protocol/conversation";
|
|
6
|
+
type SendCommandParsed = {
|
|
7
|
+
readonly target: SendTargetValue;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly replyTo: Option.Option<MessageId>;
|
|
10
|
+
};
|
|
4
11
|
/**
|
|
5
12
|
* `moltzap send task:<taskId>:<convId> <message> [--reply-to <id>]` —
|
|
6
13
|
* socket-call into the local MoltZapService to enqueue an outbound
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
14
|
+
* `agent/message/send` against an existing (taskId, conversationId) pair.
|
|
15
|
+
* `taskId` is REQUIRED on the wire, so the CLI target always carries both
|
|
16
|
+
* ids.
|
|
10
17
|
*
|
|
11
18
|
* Identity selection is driven by the parent `@effect/cli` options
|
|
12
19
|
* wired in `cli/index.ts`:
|
|
13
20
|
*
|
|
14
|
-
* --as <apiKey> Send as the agent owning the given API key.
|
|
15
|
-
* Bypasses the local daemon socket; dials the
|
|
16
|
-
* server directly. Useful in multi-agent
|
|
17
|
-
* workflows where the same host registers more
|
|
18
|
-
* than one agent.
|
|
19
21
|
* --profile <name> Load the named profile from
|
|
20
|
-
* ~/.moltzap/config.json and send
|
|
21
|
-
*
|
|
22
|
-
* profile and passing it as --as.
|
|
22
|
+
* ~/.moltzap/config.json and send through that
|
|
23
|
+
* agent's local daemon socket.
|
|
23
24
|
*
|
|
24
|
-
* If
|
|
25
|
-
* (top-level apiKey in ~/.moltzap/config.json) — the identity set by
|
|
26
|
-
* the most recent `moltzap register` that did not use `--profile` or
|
|
27
|
-
* `--no-persist`.
|
|
25
|
+
* If no profile is provided, the command uses the default local daemon socket.
|
|
28
26
|
*
|
|
29
27
|
* Examples:
|
|
30
28
|
* moltzap send task:$TID:$CID "hello" # default identity
|
|
31
29
|
* moltzap --profile alice send task:$TID:$CID "hello" # send as alice
|
|
32
|
-
* moltzap --as $BOB_API_KEY send task:$TID:$CID "ack" # send as bob
|
|
33
30
|
*
|
|
34
31
|
* Default path delegates to the local channel daemon via a
|
|
35
32
|
* Unix-socket RPC; it does NOT mint its own `MoltZapAgentClient`.
|
|
@@ -44,28 +41,18 @@ import { ConversationId, TaskId } from "@moltzap/protocol/task";
|
|
|
44
41
|
*
|
|
45
42
|
* shell->>cli: moltzap send task:taskId:convId msg
|
|
46
43
|
* cli->>send: handler({target, message, replyTo})
|
|
47
|
-
* send->>sock:
|
|
44
|
+
* send->>sock: command(cli/send, {target, message, replyToId?})
|
|
48
45
|
* Note over sock: NodeSocket.makeNet(~/.moltzap/service.sock, 10s) — ENOENT/ECONNREFUSED → SocketRequestError "not running"
|
|
49
|
-
* sock->>daemon: NDJSON RPC —
|
|
50
|
-
* Note over daemon:
|
|
51
|
-
* daemon-->>sock: {
|
|
52
|
-
*
|
|
53
|
-
* sock-->>send: {message: {id}}
|
|
46
|
+
* sock->>daemon: NDJSON RPC — cli/send
|
|
47
|
+
* Note over daemon: LocalDaemonRpcs handler → MessagesSend → agent-client → server
|
|
48
|
+
* daemon-->>sock: {messageId}
|
|
49
|
+
* sock-->>send: {messageId}
|
|
54
50
|
* send-->>shell: stdout — Message sent (id)
|
|
55
51
|
* ```
|
|
56
52
|
*
|
|
57
|
-
* `--
|
|
58
|
-
*
|
|
59
|
-
* `conversations {get,archive,unarchive}`) honor those flags today;
|
|
60
|
-
* `moltzap send` itself is still on the daemon socket pending the v2
|
|
61
|
-
* transport rewire.
|
|
53
|
+
* `--profile` selects the per-agent daemon socket; credentials remain owned
|
|
54
|
+
* by the running MoltZapService.
|
|
62
55
|
*/
|
|
63
|
-
export declare const sendCommand: Command.Command<"send",
|
|
64
|
-
|
|
65
|
-
taskId: TaskId;
|
|
66
|
-
conversationId: ConversationId;
|
|
67
|
-
};
|
|
68
|
-
readonly message: string;
|
|
69
|
-
readonly replyTo: Option.Option<string & import("effect/Brand").Brand<"MessageId">>;
|
|
70
|
-
}>;
|
|
56
|
+
export declare const sendCommand: Command.Command<"send", Transport, never, SendCommandParsed>;
|
|
57
|
+
export {};
|
|
71
58
|
//# sourceMappingURL=send.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAW,MAAM,aAAa,CAAC;AACrD,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAGL,KAAK,UAAU,IAAI,eAAe,EACnC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,KAAK,iBAAiB,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;CAC5C,CAAC;AAiBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,OAAO,CACvC,MAAM,EACN,SAAS,EACT,KAAK,EACL,iBAAiB,CA0BlB,CAAC"}
|
|
@@ -1,66 +1,30 @@
|
|
|
1
|
-
import { Args, Command,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const TASK_CONVERSATION_TARGET_PREFIX = "task:";
|
|
8
|
-
class SendTargetMalformedError extends Data.TaggedError("SendTargetMalformedError") {
|
|
9
|
-
get message() {
|
|
10
|
-
return `invalid target ${this.target}: ${this.reason}`;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const targetArg = Args.text({ name: "target" }).pipe(Args.withDescription("Target task+conversation as task:<taskId>:<convId>"), Args.mapTryCatch((raw) => {
|
|
14
|
-
if (!raw.startsWith(TASK_CONVERSATION_TARGET_PREFIX)) {
|
|
15
|
-
throw new SendTargetMalformedError({
|
|
16
|
-
target: raw,
|
|
17
|
-
reason: `missing '${TASK_CONVERSATION_TARGET_PREFIX}' prefix`,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
const rest = raw.slice(TASK_CONVERSATION_TARGET_PREFIX.length);
|
|
21
|
-
const [tid, cid] = rest.split(":");
|
|
22
|
-
if (!tid || !cid) {
|
|
23
|
-
throw new SendTargetMalformedError({
|
|
24
|
-
target: raw,
|
|
25
|
-
reason: "expected task:<taskId>:<conversationId>",
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
taskId: Value.Decode(TaskId, tid),
|
|
30
|
-
conversationId: Value.Decode(ConversationId, cid),
|
|
31
|
-
};
|
|
32
|
-
}, (err) => HelpDoc.p(`invalid target: ${String(err)}`)));
|
|
1
|
+
import { Args, Command, Options } from "@effect/cli";
|
|
2
|
+
import { Effect, Option } from "effect";
|
|
3
|
+
import { LocalDaemonCommands, SendTarget, } from "../../local-daemon-rpc.js";
|
|
4
|
+
import { command, runHandler } from "../transport.js";
|
|
5
|
+
import { MessageId } from "@moltzap/protocol/conversation";
|
|
6
|
+
const targetArg = Args.text({ name: "target" }).pipe(Args.withSchema(SendTarget), Args.withDescription("Target task+conversation as task:<taskId>:<convId>"));
|
|
33
7
|
const messageArg = Args.text({ name: "message" }).pipe(Args.withDescription("Message text"));
|
|
34
|
-
const replyToOption = Options.text("reply-to").pipe(Options.withDescription("Reply to a specific message"), Options.
|
|
8
|
+
const replyToOption = Options.text("reply-to").pipe(Options.withSchema(MessageId), Options.withDescription("Reply to a specific message"), Options.optional);
|
|
35
9
|
/**
|
|
36
10
|
* `moltzap send task:<taskId>:<convId> <message> [--reply-to <id>]` —
|
|
37
11
|
* socket-call into the local MoltZapService to enqueue an outbound
|
|
38
|
-
* `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
12
|
+
* `agent/message/send` against an existing (taskId, conversationId) pair.
|
|
13
|
+
* `taskId` is REQUIRED on the wire, so the CLI target always carries both
|
|
14
|
+
* ids.
|
|
41
15
|
*
|
|
42
16
|
* Identity selection is driven by the parent `@effect/cli` options
|
|
43
17
|
* wired in `cli/index.ts`:
|
|
44
18
|
*
|
|
45
|
-
* --as <apiKey> Send as the agent owning the given API key.
|
|
46
|
-
* Bypasses the local daemon socket; dials the
|
|
47
|
-
* server directly. Useful in multi-agent
|
|
48
|
-
* workflows where the same host registers more
|
|
49
|
-
* than one agent.
|
|
50
19
|
* --profile <name> Load the named profile from
|
|
51
|
-
* ~/.moltzap/config.json and send
|
|
52
|
-
*
|
|
53
|
-
* profile and passing it as --as.
|
|
20
|
+
* ~/.moltzap/config.json and send through that
|
|
21
|
+
* agent's local daemon socket.
|
|
54
22
|
*
|
|
55
|
-
* If
|
|
56
|
-
* (top-level apiKey in ~/.moltzap/config.json) — the identity set by
|
|
57
|
-
* the most recent `moltzap register` that did not use `--profile` or
|
|
58
|
-
* `--no-persist`.
|
|
23
|
+
* If no profile is provided, the command uses the default local daemon socket.
|
|
59
24
|
*
|
|
60
25
|
* Examples:
|
|
61
26
|
* moltzap send task:$TID:$CID "hello" # default identity
|
|
62
27
|
* moltzap --profile alice send task:$TID:$CID "hello" # send as alice
|
|
63
|
-
* moltzap --as $BOB_API_KEY send task:$TID:$CID "ack" # send as bob
|
|
64
28
|
*
|
|
65
29
|
* Default path delegates to the local channel daemon via a
|
|
66
30
|
* Unix-socket RPC; it does NOT mint its own `MoltZapAgentClient`.
|
|
@@ -75,38 +39,27 @@ const replyToOption = Options.text("reply-to").pipe(Options.withDescription("Rep
|
|
|
75
39
|
*
|
|
76
40
|
* shell->>cli: moltzap send task:taskId:convId msg
|
|
77
41
|
* cli->>send: handler({target, message, replyTo})
|
|
78
|
-
* send->>sock:
|
|
42
|
+
* send->>sock: command(cli/send, {target, message, replyToId?})
|
|
79
43
|
* Note over sock: NodeSocket.makeNet(~/.moltzap/service.sock, 10s) — ENOENT/ECONNREFUSED → SocketRequestError "not running"
|
|
80
|
-
* sock->>daemon: NDJSON RPC —
|
|
81
|
-
* Note over daemon:
|
|
82
|
-
* daemon-->>sock: {
|
|
83
|
-
*
|
|
84
|
-
* sock-->>send: {message: {id}}
|
|
44
|
+
* sock->>daemon: NDJSON RPC — cli/send
|
|
45
|
+
* Note over daemon: LocalDaemonRpcs handler → MessagesSend → agent-client → server
|
|
46
|
+
* daemon-->>sock: {messageId}
|
|
47
|
+
* sock-->>send: {messageId}
|
|
85
48
|
* send-->>shell: stdout — Message sent (id)
|
|
86
49
|
* ```
|
|
87
50
|
*
|
|
88
|
-
* `--
|
|
89
|
-
*
|
|
90
|
-
* `conversations {get,archive,unarchive}`) honor those flags today;
|
|
91
|
-
* `moltzap send` itself is still on the daemon socket pending the v2
|
|
92
|
-
* transport rewire.
|
|
51
|
+
* `--profile` selects the per-agent daemon socket; credentials remain owned
|
|
52
|
+
* by the running MoltZapService.
|
|
93
53
|
*/
|
|
94
54
|
export const sendCommand = Command.make("send", { target: targetArg, message: messageArg, replyTo: replyToOption }, ({ target, message, replyTo }) => {
|
|
95
55
|
const reply = Option.isSome(replyTo)
|
|
96
56
|
? { replyToId: replyTo.value }
|
|
97
57
|
: {};
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
parts: [{ type: "text", text: message }],
|
|
58
|
+
return runHandler(command(LocalDaemonCommands.Send, {
|
|
59
|
+
target,
|
|
60
|
+
message,
|
|
102
61
|
...reply,
|
|
103
|
-
}).pipe(Effect.
|
|
104
|
-
const r = result;
|
|
105
|
-
console.log(`Message sent (id: ${r.message.id})`);
|
|
106
|
-
})), Effect.asVoid, Effect.catchAll((err) => Effect.sync(() => {
|
|
107
|
-
console.error(`Failed: ${err.message}`);
|
|
108
|
-
process.exit(1);
|
|
109
|
-
})));
|
|
62
|
+
}).pipe(Effect.flatMap((result) => Effect.log(`Message sent (id: ${result.messageId})`)), Effect.asVoid));
|
|
110
63
|
}).pipe(Command.withDescription("Send a message to task:<taskId>:<conversationId>. " +
|
|
111
|
-
"Identity follows the global --
|
|
64
|
+
"Identity follows the global --profile flag."));
|
|
112
65
|
//# sourceMappingURL=send.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/cli/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/cli/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EA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