@moltzap/client 2026.806.0 → 2026.812.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/channel-base/index.d.ts +4 -4
- package/dist/channel-base/index.d.ts.map +1 -1
- package/dist/channel-base/index.js +6 -3
- package/dist/channel-base/index.js.map +1 -1
- package/dist/channel-core-enrichment.d.ts +24 -0
- package/dist/channel-core-enrichment.d.ts.map +1 -1
- package/dist/channel-core-enrichment.js +94 -20
- package/dist/channel-core-enrichment.js.map +1 -1
- package/dist/channel-core.d.ts +3 -1
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +2 -0
- package/dist/channel-core.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -1
- package/dist/config.js.map +1 -1
- package/dist/config.test-utils.d.ts +6 -0
- package/dist/config.test-utils.d.ts.map +1 -1
- package/dist/config.test-utils.js +5 -1
- package/dist/config.test-utils.js.map +1 -1
- package/dist/harness/client-runtime.d.ts +12 -5
- package/dist/harness/client-runtime.d.ts.map +1 -1
- package/dist/harness/client-runtime.js +16 -2
- package/dist/harness/client-runtime.js.map +1 -1
- package/dist/harness/index.d.ts +2 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +2 -2
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/runtime.d.ts +152 -0
- package/dist/harness/runtime.d.ts.map +1 -1
- package/dist/harness/runtime.js +99 -2
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness-client.d.ts +17 -13
- package/dist/harness-client.d.ts.map +1 -1
- package/dist/harness-client.js +59 -4
- package/dist/harness-client.js.map +1 -1
- package/dist/harness-context-projection.d.ts +35 -0
- package/dist/harness-context-projection.d.ts.map +1 -0
- package/dist/harness-context-projection.js +123 -0
- package/dist/harness-context-projection.js.map +1 -0
- package/dist/harness-mcp-server.d.ts +1 -2
- package/dist/harness-mcp-server.d.ts.map +1 -1
- package/dist/harness-mcp-server.js +11 -17
- package/dist/harness-mcp-server.js.map +1 -1
- package/dist/harness-mcp-wire.d.ts +47 -15
- package/dist/harness-mcp-wire.d.ts.map +1 -1
- package/dist/harness-mcp-wire.js +93 -37
- package/dist/harness-mcp-wire.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/local-paths.d.ts +0 -11
- package/dist/local-paths.d.ts.map +1 -1
- package/dist/local-paths.js +0 -12
- package/dist/local-paths.js.map +1 -1
- package/dist/moltzapd-catalog.d.ts +35 -0
- package/dist/moltzapd-catalog.d.ts.map +1 -0
- package/dist/moltzapd-catalog.js +117 -0
- package/dist/moltzapd-catalog.js.map +1 -0
- package/dist/moltzapd-child-ipc.d.ts +26 -0
- package/dist/moltzapd-child-ipc.d.ts.map +1 -0
- package/dist/moltzapd-child-ipc.js +31 -0
- package/dist/moltzapd-child-ipc.js.map +1 -0
- package/dist/moltzapd-child.d.ts +55 -0
- package/dist/moltzapd-child.d.ts.map +1 -0
- package/dist/moltzapd-child.js +225 -0
- package/dist/moltzapd-child.js.map +1 -0
- package/dist/moltzapd-main.d.ts +3 -0
- package/dist/moltzapd-main.d.ts.map +1 -0
- package/dist/moltzapd-main.js +18 -0
- package/dist/moltzapd-main.js.map +1 -0
- package/dist/moltzapd-registration.d.ts +40 -0
- package/dist/moltzapd-registration.d.ts.map +1 -0
- package/dist/moltzapd-registration.js +59 -0
- package/dist/moltzapd-registration.js.map +1 -0
- package/dist/moltzapd.d.ts +56 -9
- package/dist/moltzapd.d.ts.map +1 -1
- package/dist/moltzapd.js +108 -36
- package/dist/moltzapd.js.map +1 -1
- package/dist/notification/trace.d.ts +10 -0
- package/dist/notification/trace.d.ts.map +1 -0
- package/dist/notification/trace.js +34 -0
- package/dist/notification/trace.js.map +1 -0
- package/dist/presentation/index.d.ts +3 -0
- package/dist/presentation/index.d.ts.map +1 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/index.js.map +1 -0
- package/dist/presentation/state.d.ts +77 -0
- package/dist/presentation/state.d.ts.map +1 -0
- package/dist/presentation/state.js +211 -0
- package/dist/presentation/state.js.map +1 -0
- package/dist/profile.d.ts +30 -28
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +28 -20
- package/dist/profile.js.map +1 -1
- package/dist/service.d.ts +8 -79
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +29 -333
- package/dist/service.js.map +1 -1
- package/dist/test-utils/fake-service.d.ts +3 -5
- package/dist/test-utils/fake-service.d.ts.map +1 -1
- package/dist/test-utils/fake-service.js +12 -12
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +2 -0
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/process/reserve-port.d.ts +20 -0
- package/dist/test-utils/process/reserve-port.d.ts.map +1 -0
- package/dist/test-utils/process/reserve-port.js +41 -0
- package/dist/test-utils/process/reserve-port.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -6
- 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/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-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/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-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
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Command } from "@effect/cli";
|
|
2
|
-
import { type SendTarget as SendTargetValue } from "../../local-daemon-rpc.js";
|
|
3
|
-
import { type Transport } from "../transport.js";
|
|
4
|
-
interface SendCommandParsed {
|
|
5
|
-
readonly target: SendTargetValue;
|
|
6
|
-
readonly message: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* `moltzap send conv:<convId> <message>` — socket-call into the local
|
|
10
|
-
* MoltZapService to enqueue an outbound `agent/message/send` against an
|
|
11
|
-
* existing conversation. The conversation is the whole address.
|
|
12
|
-
*
|
|
13
|
-
* Identity selection is driven by the parent `@effect/cli` options
|
|
14
|
-
* wired in `cli/index.ts`:
|
|
15
|
-
*
|
|
16
|
-
* --profile <name> Load the named profile from
|
|
17
|
-
* ~/.moltzap/config.json and send through that
|
|
18
|
-
* agent's local daemon socket.
|
|
19
|
-
*
|
|
20
|
-
* If no profile is provided, the command uses the default local daemon socket.
|
|
21
|
-
*
|
|
22
|
-
* Examples:
|
|
23
|
-
* moltzap send conv:$CID "hello" # default identity
|
|
24
|
-
* moltzap --profile alice send conv:$CID "hello" # send as alice.
|
|
25
|
-
*
|
|
26
|
-
* Default path delegates to the local channel daemon via a
|
|
27
|
-
* Unix-socket RPC; it does NOT mint its own `MoltZapAgentClient`.
|
|
28
|
-
*
|
|
29
|
-
* ```mermaid
|
|
30
|
-
* sequenceDiagram
|
|
31
|
-
* participant shell
|
|
32
|
-
* participant cli as effect-cli
|
|
33
|
-
* participant send as sendCommand
|
|
34
|
-
* participant sock as socket-client
|
|
35
|
-
* participant daemon
|
|
36
|
-
*
|
|
37
|
-
* shell->>cli: moltzap send conv:convId msg
|
|
38
|
-
* cli->>send: handler({target, message})
|
|
39
|
-
* send->>sock: command(cli/send, {target, message})
|
|
40
|
-
* Note over sock: NodeSocket.makeNet(~/.moltzap/service.sock, 10s) — ENOENT/ECONNREFUSED → SocketRequestError "not running"
|
|
41
|
-
* sock->>daemon: NDJSON RPC — cli/send
|
|
42
|
-
* Note over daemon: LocalDaemonRpcs handler → MessagesSend → agent-client → server
|
|
43
|
-
* daemon-->>sock: {messageId}
|
|
44
|
-
* sock-->>send: {messageId}
|
|
45
|
-
* send-->>shell: stdout — Message sent (id)
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* `--profile` selects the per-agent daemon socket; credentials remain owned
|
|
49
|
-
* by the running MoltZapService.
|
|
50
|
-
*/
|
|
51
|
-
export declare const sendCommand: Command.Command<"send", Transport, never, SendCommandParsed>;
|
|
52
|
-
export {};
|
|
53
|
-
//# sourceMappingURL=send.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAGL,KAAK,UAAU,IAAI,eAAe,EACnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAItE,UAAU,iBAAiB;IACzB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,OAAO,CACvC,MAAM,EACN,SAAS,EACT,KAAK,EACL,iBAAiB,CAsBlB,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Args, Command } from "@effect/cli";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { localDaemonCommands, sendTarget, } from "../../local-daemon-rpc.js";
|
|
4
|
-
import { command, runHandler } from "../transport.js";
|
|
5
|
-
const targetArg = Args.text({ name: "target" }).pipe(Args.withSchema(sendTarget), Args.withDescription("Target conversation as conv:<convId>"));
|
|
6
|
-
const messageArg = Args.text({ name: "message" }).pipe(Args.withDescription("Message text"));
|
|
7
|
-
/**
|
|
8
|
-
* `moltzap send conv:<convId> <message>` — socket-call into the local
|
|
9
|
-
* MoltZapService to enqueue an outbound `agent/message/send` against an
|
|
10
|
-
* existing conversation. The conversation is the whole address.
|
|
11
|
-
*
|
|
12
|
-
* Identity selection is driven by the parent `@effect/cli` options
|
|
13
|
-
* wired in `cli/index.ts`:
|
|
14
|
-
*
|
|
15
|
-
* --profile <name> Load the named profile from
|
|
16
|
-
* ~/.moltzap/config.json and send through that
|
|
17
|
-
* agent's local daemon socket.
|
|
18
|
-
*
|
|
19
|
-
* If no profile is provided, the command uses the default local daemon socket.
|
|
20
|
-
*
|
|
21
|
-
* Examples:
|
|
22
|
-
* moltzap send conv:$CID "hello" # default identity
|
|
23
|
-
* moltzap --profile alice send conv:$CID "hello" # send as alice.
|
|
24
|
-
*
|
|
25
|
-
* Default path delegates to the local channel daemon via a
|
|
26
|
-
* Unix-socket RPC; it does NOT mint its own `MoltZapAgentClient`.
|
|
27
|
-
*
|
|
28
|
-
* ```mermaid
|
|
29
|
-
* sequenceDiagram
|
|
30
|
-
* participant shell
|
|
31
|
-
* participant cli as effect-cli
|
|
32
|
-
* participant send as sendCommand
|
|
33
|
-
* participant sock as socket-client
|
|
34
|
-
* participant daemon
|
|
35
|
-
*
|
|
36
|
-
* shell->>cli: moltzap send conv:convId msg
|
|
37
|
-
* cli->>send: handler({target, message})
|
|
38
|
-
* send->>sock: command(cli/send, {target, message})
|
|
39
|
-
* Note over sock: NodeSocket.makeNet(~/.moltzap/service.sock, 10s) — ENOENT/ECONNREFUSED → SocketRequestError "not running"
|
|
40
|
-
* sock->>daemon: NDJSON RPC — cli/send
|
|
41
|
-
* Note over daemon: LocalDaemonRpcs handler → MessagesSend → agent-client → server
|
|
42
|
-
* daemon-->>sock: {messageId}
|
|
43
|
-
* sock-->>send: {messageId}
|
|
44
|
-
* send-->>shell: stdout — Message sent (id)
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* `--profile` selects the per-agent daemon socket; credentials remain owned
|
|
48
|
-
* by the running MoltZapService.
|
|
49
|
-
*/
|
|
50
|
-
export const sendCommand = Command.make("send", { target: targetArg, message: messageArg }, ({ target, message }) => {
|
|
51
|
-
return runHandler(command(localDaemonCommands.send, {
|
|
52
|
-
target,
|
|
53
|
-
message,
|
|
54
|
-
}).pipe(Effect.flatMap((result) => Effect.log(`Message sent (id: ${result.messageId})`)), Effect.asVoid));
|
|
55
|
-
}).pipe(Command.withDescription("Send a message to conv:<conversationId>. " +
|
|
56
|
-
"Identity follows the global --profile flag."));
|
|
57
|
-
//# sourceMappingURL=send.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/cli/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,UAAU,GAEX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAkB,MAAM,iBAAiB,CAAC;AAStE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,CAClD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAC3B,IAAI,CAAC,eAAe,CAAC,sCAAsC,CAAC,CAC7D,CAAC;AAEF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CACpD,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,MAAM,WAAW,GAKpB,OAAO,CAAC,IAAI,CACd,MAAM,EACN,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,EAC1C,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;IACtB,OAAO,UAAU,CACf,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE;QAChC,MAAM;QACN,OAAO;KACR,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CACxB,MAAM,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,SAAS,GAAG,CAAC,CACrD,EACD,MAAM,CAAC,MAAM,CACd,CACF,CAAC;AACJ,CAAC,CACF,CAAC,IAAI,CACJ,OAAO,CAAC,eAAe,CACrB,2CAA2C;IACzC,6CAA6C,CAChD,CACF,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Command } from "@effect/cli";
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
3
|
-
import { type StartParticipant as StartParticipantType } from "../../local-daemon-rpc.js";
|
|
4
|
-
import { type Transport } from "../transport.js";
|
|
5
|
-
/** Describes start command args. */
|
|
6
|
-
export interface StartCommandArgs {
|
|
7
|
-
readonly name: string;
|
|
8
|
-
readonly participants: readonly StartParticipantType[];
|
|
9
|
-
readonly message?: string;
|
|
10
|
-
}
|
|
11
|
-
interface StartCommandParsed {
|
|
12
|
-
readonly name: string;
|
|
13
|
-
readonly participants: StartParticipantType[];
|
|
14
|
-
readonly options: Schema.Schema.Type<typeof startOptionsSchema>;
|
|
15
|
-
}
|
|
16
|
-
declare const startOptionsSchema: Schema.SchemaClass<{
|
|
17
|
-
readonly message?: string | undefined;
|
|
18
|
-
}, {
|
|
19
|
-
readonly message?: string | undefined;
|
|
20
|
-
}, never>;
|
|
21
|
-
/** Provides the start options runtime value. */
|
|
22
|
-
export declare const startOptions: import("@effect/cli/Options").Options<{
|
|
23
|
-
readonly message?: string | undefined;
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Provides the run start handler runtime value.
|
|
27
|
-
* @param args Value supplied to the operation.
|
|
28
|
-
* @returns The run start handler result.
|
|
29
|
-
*/
|
|
30
|
-
export declare const runStartHandler: (args: StartCommandArgs) => Effect.Effect<void, never, Transport>;
|
|
31
|
-
/** Provides the start command runtime value. */
|
|
32
|
-
export declare const startCommand: Command.Command<"start", Transport, never, StartCommandParsed>;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=start.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAML,KAAK,gBAAgB,IAAI,oBAAoB,EAE9C,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAW,KAAK,SAAS,EAAuB,MAAM,iBAAiB,CAAC;AAW/E,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,oBAAoB,EAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;CACjE;AAsED,QAAA,MAAM,kBAAkB;;;;SAEvB,CAAC;AACF,gDAAgD;AAChD,eAAO,MAAM,YAAY;;EAEvB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe,SACpB,gBAAgB,KACrB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CACK,CAAC;AAE7C,gDAAgD;AAChD,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,OAAO,CACxC,OAAO,EACP,SAAS,EACT,KAAK,EACL,kBAAkB,CAwBnB,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Args, Command } from "@effect/cli";
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
3
|
-
import { localDaemonCommands, startCommandRpc, startParticipant, } from "../../local-daemon-rpc.js";
|
|
4
|
-
import { command } from "../transport.js";
|
|
5
|
-
import { optionsFromSchema } from "../adapters.js";
|
|
6
|
-
const EXIT_CODES = {
|
|
7
|
-
SUCCESS: 0,
|
|
8
|
-
CREATE_FAILED: 1,
|
|
9
|
-
PARTIAL_SUCCESS: 2,
|
|
10
|
-
USAGE_ERROR: 64,
|
|
11
|
-
};
|
|
12
|
-
const startMessage = (outcome) => `Conversation started: ${outcome.conversationId}`;
|
|
13
|
-
const logStartResult = (result) => Effect.zipRight(Effect.log(startMessage(result)), result.sentMessageId === undefined
|
|
14
|
-
? Effect.void
|
|
15
|
-
: Effect.log(`Message sent: ${result.sentMessageId}`));
|
|
16
|
-
const startCommandHandler = (args) => command(localDaemonCommands.start, {
|
|
17
|
-
name: args.name,
|
|
18
|
-
participants: args.participants,
|
|
19
|
-
...(args.message === undefined ? {} : { message: args.message }),
|
|
20
|
-
}).pipe(Effect.flatMap(logStartResult), Effect.withSpan("startCommandHandler"));
|
|
21
|
-
const runStartCommand = (effect) => effect.pipe(Effect.catchTags({
|
|
22
|
-
StartUsageError: (err) => Effect.logError(err.message).pipe(Effect.zipRight(Effect.sync(() => process.exit(EXIT_CODES.USAGE_ERROR)))),
|
|
23
|
-
StartPartialFailure: (err) => Effect.zipRight(Effect.log(startMessage(err)), Effect.logError(`Error sending message: ${err.message}`).pipe(Effect.zipRight(Effect.sync(() => process.exit(EXIT_CODES.PARTIAL_SUCCESS))))),
|
|
24
|
-
}), Effect.catchAll((err) => {
|
|
25
|
-
const msg = err.message !== undefined && err.message !== ""
|
|
26
|
-
? err.message
|
|
27
|
-
: err._tag;
|
|
28
|
-
return Effect.logError(`Failed: ${msg}`).pipe(Effect.zipRight(Effect.sync(() => process.exit(EXIT_CODES.CREATE_FAILED))));
|
|
29
|
-
}));
|
|
30
|
-
const nameArg = Args.text({ name: "name" }).pipe(Args.withDescription("Conversation name"));
|
|
31
|
-
const participantsArg = Args.text({ name: "participant" }).pipe(Args.withSchema(startParticipant), Args.withDescription("Participant token (for example agent:bob)."), Args.repeated);
|
|
32
|
-
const startOptionsSchema = startCommandRpc.payloadSchema.pipe(Schema.omit("name", "participants"));
|
|
33
|
-
/** Provides the start options runtime value. */
|
|
34
|
-
export const startOptions = optionsFromSchema(startOptionsSchema, {
|
|
35
|
-
message: { description: "First message body" },
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* Provides the run start handler runtime value.
|
|
39
|
-
* @param args Value supplied to the operation.
|
|
40
|
-
* @returns The run start handler result.
|
|
41
|
-
*/
|
|
42
|
-
export const runStartHandler = (args) => runStartCommand(startCommandHandler(args));
|
|
43
|
-
/** Provides the start command runtime value. */
|
|
44
|
-
export const startCommand = Command.make("start", {
|
|
45
|
-
name: nameArg,
|
|
46
|
-
participants: participantsArg,
|
|
47
|
-
options: startOptions,
|
|
48
|
-
}, ({ name, participants, options }) => runStartHandler({
|
|
49
|
-
name,
|
|
50
|
-
participants,
|
|
51
|
-
message: options.message,
|
|
52
|
-
})).pipe(Command.withDescription("Start a conversation with named participants and optionally send the first message.\n" +
|
|
53
|
-
"\n" +
|
|
54
|
-
"Exit codes:\n" +
|
|
55
|
-
` ${EXIT_CODES.SUCCESS} success\n` +
|
|
56
|
-
` ${EXIT_CODES.CREATE_FAILED} conversation creation failed\n` +
|
|
57
|
-
` ${EXIT_CODES.PARTIAL_SUCCESS} conversation started, first message failed\n` +
|
|
58
|
-
` ${EXIT_CODES.USAGE_ERROR} usage error`));
|
|
59
|
-
//# sourceMappingURL=start.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/cli/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,GAKjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAuC,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,eAAe,EAAE,CAAC;IAClB,WAAW,EAAE,EAAE;CACP,CAAC;AAiBX,MAAM,YAAY,GAAG,CAAC,OAErB,EAAU,EAAE,CAAC,yBAAyB,OAAO,CAAC,cAAc,EAAE,CAAC;AAEhE,MAAM,cAAc,GAAG,CAAC,MAA0B,EAAuB,EAAE,CACzE,MAAM,CAAC,QAAQ,CACb,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAChC,MAAM,CAAC,aAAa,KAAK,SAAS;IAChC,CAAC,CAAC,MAA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Ae,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AAE7C,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAKrB,OAAO,CAAC,IAAI,CACd,OAAO,EACP;IACE,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,eAAe;IAC7B,OAAO,EAAE,YAAY;CACtB,EACD,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,CAClC,eAAe,CAAC;IACd,IAAI;IACJ,YAAY;IACZ,OAAO,EAAE,OAAO,CAAC,OAAO;CACzB,CAAC,CACL,CAAC,IAAI,CACJ,OAAO,CAAC,eAAe,CACrB,uFAAuF;IACrF,IAAI;IACJ,eAAe;IACf,KAAK,UAAU,CAAC,OAAO,cAAc;IACrC,KAAK,UAAU,CAAC,aAAa,mCAAmC;IAChE,KAAK,UAAU,CAAC,eAAe,iDAAiD;IAChF,KAAK,UAAU,CAAC,WAAW,eAAe,CAC7C,CACF,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Command } from "@effect/cli";
|
|
2
|
-
/**
|
|
3
|
-
* `moltzap status` — calls the local service's `status` RPC and prints
|
|
4
|
-
* agent id, live connection state, and conversation count.
|
|
5
|
-
*/
|
|
6
|
-
export declare const statusCommand: Command.Command<"status", import("../transport.js").Transport, never, {}>;
|
|
7
|
-
//# sourceMappingURL=status.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAQtC;;;GAGG;AACH,eAAO,MAAM,aAAa,2EAiBzB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Command } from "@effect/cli";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { localDaemonCommands } from "../../local-daemon-rpc.js";
|
|
4
|
-
import { command, runHandler } from "../transport.js";
|
|
5
|
-
import { logLines } from "../output.js";
|
|
6
|
-
// safer-arch-ignore no-trivial-sink-file: this command is a private one-command-per-file leaf consistent with the CLI commands folder convention.
|
|
7
|
-
/**
|
|
8
|
-
* `moltzap status` — calls the local service's `status` RPC and prints
|
|
9
|
-
* agent id, live connection state, and conversation count.
|
|
10
|
-
*/
|
|
11
|
-
export const statusCommand = Command.make("status", {}, () => runHandler(command(localDaemonCommands.status, {}).pipe(Effect.flatMap((result) => logLines([
|
|
12
|
-
`Agent ID: ${result.agentId ?? "none"}`,
|
|
13
|
-
`Connected: ${result.connected}`,
|
|
14
|
-
`Conversations: ${result.conversations}`,
|
|
15
|
-
])), Effect.asVoid))).pipe(Command.withDescription("Show agent connection status and conversation summary"));
|
|
16
|
-
//# sourceMappingURL=status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,kJAAkJ;AAElJ;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,CAC3D,UAAU,CACR,OAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAC1C,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CACxB,QAAQ,CAAC;IACP,mBAAmB,MAAM,CAAC,OAAO,IAAI,MAAM,EAAE;IAC7C,mBAAmB,MAAM,CAAC,SAAS,EAAE;IACrC,mBAAmB,MAAM,CAAC,aAAa,EAAE;CAC1C,CAAC,CACH,EACD,MAAM,CAAC,MAAM,CACd,CACF,CACF,CAAC,IAAI,CACJ,OAAO,CAAC,eAAe,CACrB,uDAAuD,CACxD,CACF,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { RpcGroup } from "@effect/rpc";
|
|
2
|
-
import { type Transport as TransportSurface, type TransportError } from "../transport.js";
|
|
3
|
-
import type { LocalDaemonRpcs } from "../../local-daemon-rpc.js";
|
|
4
|
-
import type { PayloadForTag, SuccessForTag } from "@moltzap/protocol/rpc";
|
|
5
|
-
type DaemonRpcs = RpcGroup.Rpcs<typeof LocalDaemonRpcs>;
|
|
6
|
-
type DaemonCommand = DaemonRpcs["_tag"];
|
|
7
|
-
/** Describes test transport call. */
|
|
8
|
-
export interface TestTransportCall<Tag extends DaemonCommand = DaemonCommand> {
|
|
9
|
-
readonly method: Tag;
|
|
10
|
-
readonly params: PayloadForTag<DaemonRpcs, Tag>;
|
|
11
|
-
}
|
|
12
|
-
/** Represents test transport responder values. */
|
|
13
|
-
export type TestTransportResponder<Tag extends DaemonCommand> = (call: TestTransportCall<Tag>) => SuccessForTag<DaemonRpcs, Tag> | TransportError | Error;
|
|
14
|
-
/** Represents test transport responders values. */
|
|
15
|
-
export type TestTransportResponders = {
|
|
16
|
-
readonly [Tag in DaemonCommand]?: TestTransportResponder<Tag>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Provides the make fake transport runtime value.
|
|
20
|
-
* @param responders Value supplied to the operation.
|
|
21
|
-
* @returns The created fake transport.
|
|
22
|
-
*/
|
|
23
|
-
export declare const makeFakeTransport: (responders: TestTransportResponders) => {
|
|
24
|
-
readonly calls: TestTransportCall[];
|
|
25
|
-
readonly transport: TransportSurface;
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=test-transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1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} from "effect";
|
|
2
|
-
import { TransportRpcError, } from "../transport.js";
|
|
3
|
-
const isTransportError = (value) => typeof value === "object" &&
|
|
4
|
-
value !== null &&
|
|
5
|
-
"_tag" in value &&
|
|
6
|
-
"message" in value;
|
|
7
|
-
const isError = (value) => value instanceof Error;
|
|
8
|
-
const errorMessage = (error) => error.message;
|
|
9
|
-
/**
|
|
10
|
-
* Provides the make fake transport runtime value.
|
|
11
|
-
* @param responders Value supplied to the operation.
|
|
12
|
-
* @returns The created fake transport.
|
|
13
|
-
*/
|
|
14
|
-
export const makeFakeTransport = (responders) => {
|
|
15
|
-
const calls = [];
|
|
16
|
-
const transport = {
|
|
17
|
-
command: (tag, payload) => {
|
|
18
|
-
const call = { method: tag, params: payload };
|
|
19
|
-
calls.push(call);
|
|
20
|
-
const respond = responders[tag];
|
|
21
|
-
if (respond === undefined) {
|
|
22
|
-
return Effect.dieMessage(`No test transport responder for ${tag}`);
|
|
23
|
-
}
|
|
24
|
-
const out = respond(call);
|
|
25
|
-
if (isTransportError(out)) {
|
|
26
|
-
return Effect.fail(out);
|
|
27
|
-
}
|
|
28
|
-
if (isError(out)) {
|
|
29
|
-
return Effect.fail(new TransportRpcError({
|
|
30
|
-
method: tag,
|
|
31
|
-
tag: "Unauthorized",
|
|
32
|
-
message: errorMessage(out),
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
return Effect.succeed(out);
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
return { calls, transport };
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=test-transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-transport.js","sourceRoot":"","sources":["../../../src/cli/commands/test-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EACL,iBAAiB,GAGlB,MAAM,iBAAiB,CAAC;AAuBzB,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAA2B,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AAC,CAAC;QAC7B,CAAC;KACF,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC,CAAC"}
|
package/dist/cli/index.d.ts
DELETED
package/dist/cli/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
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,EACtB,uBA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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/B,MAAM,y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