@moltzap/client 2026.511.1 → 2026.518.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/auth.d.ts +12 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +67 -29
- package/dist/auth.js.map +1 -1
- package/dist/auth.test.js +113 -76
- package/dist/auth.test.js.map +1 -1
- package/dist/channel-core-context.test.d.ts +2 -0
- package/dist/channel-core-context.test.d.ts.map +1 -0
- package/dist/channel-core-context.test.js +334 -0
- package/dist/channel-core-context.test.js.map +1 -0
- package/dist/channel-core-dispatch.test.d.ts +2 -0
- package/dist/channel-core-dispatch.test.d.ts.map +1 -0
- package/dist/channel-core-dispatch.test.js +550 -0
- package/dist/channel-core-dispatch.test.js.map +1 -0
- package/dist/channel-core-enrichment.d.ts +8 -0
- package/dist/channel-core-enrichment.d.ts.map +1 -0
- package/dist/channel-core-enrichment.js +134 -0
- package/dist/channel-core-enrichment.js.map +1 -0
- package/dist/channel-core-errors.d.ts +20 -0
- package/dist/channel-core-errors.d.ts.map +1 -0
- package/dist/channel-core-errors.js +12 -0
- package/dist/channel-core-errors.js.map +1 -0
- package/dist/channel-core-test-support.d.ts +48 -0
- package/dist/channel-core-test-support.d.ts.map +1 -0
- package/dist/channel-core-test-support.js +111 -0
- package/dist/channel-core-test-support.js.map +1 -0
- package/dist/channel-core.d.ts +30 -7
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +214 -237
- package/dist/channel-core.js.map +1 -1
- package/dist/channel-core.test.js +216 -1082
- package/dist/channel-core.test.js.map +1 -1
- package/dist/cli/__tests__/cli-multi-agent.int.test.js +129 -23
- package/dist/cli/__tests__/cli-multi-agent.int.test.js.map +1 -1
- package/dist/cli/commands/conversations-v2.test.js +64 -54
- package/dist/cli/commands/conversations-v2.test.js.map +1 -1
- package/dist/cli/commands/conversations.d.ts +5 -5
- package/dist/cli/commands/conversations.d.ts.map +1 -1
- package/dist/cli/commands/conversations.js +43 -36
- package/dist/cli/commands/conversations.js.map +1 -1
- package/dist/cli/commands/messages.d.ts +4 -4
- package/dist/cli/commands/messages.d.ts.map +1 -1
- package/dist/cli/commands/messages.js +4 -4
- package/dist/cli/commands/messages.js.map +1 -1
- package/dist/cli/commands/messages.test.js +61 -49
- package/dist/cli/commands/messages.test.js.map +1 -1
- package/dist/cli/commands/ping.d.ts +0 -9
- package/dist/cli/commands/ping.d.ts.map +1 -1
- package/dist/cli/commands/ping.js +1 -1
- package/dist/cli/commands/ping.js.map +1 -1
- package/dist/cli/commands/presence.d.ts +1 -1
- package/dist/cli/commands/presence.js +1 -1
- package/dist/cli/commands/register.d.ts +2 -2
- package/dist/cli/commands/register.d.ts.map +1 -1
- package/dist/cli/commands/register.js +98 -77
- package/dist/cli/commands/register.js.map +1 -1
- package/dist/cli/commands/register.test.js +63 -39
- package/dist/cli/commands/register.test.js.map +1 -1
- package/dist/cli/commands/send.d.ts +6 -6
- package/dist/cli/commands/send.js +6 -6
- package/dist/cli/commands/send.test.js +32 -28
- package/dist/cli/commands/send.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +3 -4
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/config.d.ts +0 -2
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +86 -76
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/config.test.js +80 -42
- package/dist/cli/config.test.js.map +1 -1
- package/dist/cli/index.d.ts +1 -16
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +50 -113
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/process-argv.d.ts +2 -0
- package/dist/cli/process-argv.d.ts.map +1 -0
- package/dist/cli/process-argv.js +2 -0
- package/dist/cli/process-argv.js.map +1 -0
- package/dist/cli/profile.d.ts +3 -10
- package/dist/cli/profile.d.ts.map +1 -1
- package/dist/cli/profile.js +105 -104
- package/dist/cli/profile.js.map +1 -1
- package/dist/cli/profile.test.js +338 -232
- package/dist/cli/profile.test.js.map +1 -1
- package/dist/cli/runtime.d.ts +5 -17
- package/dist/cli/runtime.d.ts.map +1 -1
- package/dist/cli/runtime.js +6 -59
- package/dist/cli/runtime.js.map +1 -1
- package/dist/cli/socket-client.d.ts +10 -15
- package/dist/cli/socket-client.d.ts.map +1 -1
- package/dist/cli/socket-client.js +74 -89
- package/dist/cli/socket-client.js.map +1 -1
- package/dist/cli/transport.d.ts +9 -5
- package/dist/cli/transport.d.ts.map +1 -1
- package/dist/cli/transport.js +45 -42
- package/dist/cli/transport.js.map +1 -1
- package/dist/cli/transport.test.js +227 -133
- package/dist/cli/transport.test.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/local-daemon-rpc.d.ts +13 -0
- package/dist/local-daemon-rpc.d.ts.map +1 -0
- package/dist/local-daemon-rpc.js +17 -0
- package/dist/local-daemon-rpc.js.map +1 -0
- package/dist/local-paths.d.ts +7 -0
- package/dist/local-paths.d.ts.map +1 -0
- package/dist/local-paths.js +20 -0
- package/dist/local-paths.js.map +1 -0
- package/dist/runtime/close-info.d.ts +3 -12
- package/dist/runtime/close-info.d.ts.map +1 -1
- package/dist/runtime/close-info.js +28 -39
- package/dist/runtime/close-info.js.map +1 -1
- package/dist/runtime/close-info.test.js +77 -70
- package/dist/runtime/close-info.test.js.map +1 -1
- package/dist/runtime/errors.test.js +42 -28
- package/dist/runtime/errors.test.js.map +1 -1
- package/dist/runtime/frame.d.ts +4 -31
- package/dist/runtime/frame.d.ts.map +1 -1
- package/dist/runtime/frame.js +7 -116
- package/dist/runtime/frame.js.map +1 -1
- package/dist/runtime/frame.test.js +41 -54
- package/dist/runtime/frame.test.js.map +1 -1
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +7 -11
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/local-history.d.ts +67 -0
- package/dist/runtime/local-history.d.ts.map +1 -0
- package/dist/runtime/local-history.js +77 -0
- package/dist/runtime/local-history.js.map +1 -0
- package/dist/runtime/local-service-commands.d.ts +19 -0
- package/dist/runtime/local-service-commands.d.ts.map +1 -1
- package/dist/runtime/local-service-commands.js +23 -0
- package/dist/runtime/local-service-commands.js.map +1 -1
- package/dist/runtime/local-socket-server.d.ts +20 -0
- package/dist/runtime/local-socket-server.d.ts.map +1 -0
- package/dist/runtime/local-socket-server.js +94 -0
- package/dist/runtime/local-socket-server.js.map +1 -0
- package/dist/runtime/refs.d.ts +1 -1
- package/dist/runtime/refs.js +1 -1
- package/dist/runtime/runtime.test.js +29 -21
- package/dist/runtime/runtime.test.js.map +1 -1
- package/dist/runtime/service-helpers.d.ts +32 -0
- package/dist/runtime/service-helpers.d.ts.map +1 -0
- package/dist/runtime/service-helpers.js +85 -0
- package/dist/runtime/service-helpers.js.map +1 -0
- package/dist/runtime/subscribers.d.ts +13 -17
- package/dist/runtime/subscribers.d.ts.map +1 -1
- package/dist/runtime/subscribers.js +37 -32
- package/dist/runtime/subscribers.js.map +1 -1
- package/dist/runtime/subscribers.test.js +139 -131
- package/dist/runtime/subscribers.test.js.map +1 -1
- package/dist/service-socket-path.test.d.ts +2 -0
- package/dist/service-socket-path.test.d.ts.map +1 -0
- package/dist/service-socket-path.test.js +87 -0
- package/dist/service-socket-path.test.js.map +1 -0
- package/dist/service.d.ts +23 -20
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +192 -340
- package/dist/service.js.map +1 -1
- package/dist/service.test.js +652 -653
- package/dist/service.test.js.map +1 -1
- package/dist/test/index.d.ts +30 -14
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +25 -21
- package/dist/test/index.js.map +1 -1
- package/dist/test-utils/channel-service-fixture.d.ts +1 -0
- package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
- package/dist/test-utils/channel-service-fixture.js +139 -98
- package/dist/test-utils/channel-service-fixture.js.map +1 -1
- package/dist/test-utils/conformance-adapter.d.ts.map +1 -1
- package/dist/test-utils/conformance-adapter.js +145 -124
- package/dist/test-utils/conformance-adapter.js.map +1 -1
- package/dist/test-utils/fake-service.d.ts.map +1 -1
- package/dist/test-utils/fake-service.js +3 -3
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/index.d.ts +25 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +25 -8
- package/dist/test-utils/index.js.map +1 -1
- package/dist/ws-client-test-support.d.ts +180 -0
- package/dist/ws-client-test-support.d.ts.map +1 -0
- package/dist/ws-client-test-support.js +399 -0
- package/dist/ws-client-test-support.js.map +1 -0
- package/dist/ws-client.d.ts +59 -32
- package/dist/ws-client.d.ts.map +1 -1
- package/dist/ws-client.js +272 -321
- package/dist/ws-client.js.map +1 -1
- package/dist/ws-client.test.js +388 -800
- package/dist/ws-client.test.js.map +1 -1
- package/package.json +14 -10
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as os from "node:os";
|
|
3
|
-
import * as path from "node:path";
|
|
4
1
|
import { Args, Command, Options } from "@effect/cli";
|
|
5
|
-
import {
|
|
2
|
+
import { FileSystem } from "@effect/platform";
|
|
3
|
+
import { NodeFileSystem } from "@effect/platform-node";
|
|
4
|
+
import { Effect, Either, Option } from "effect";
|
|
5
|
+
import { getOpenClawConfigDir, getOpenClawConfigPath, } from "../../local-paths.js";
|
|
6
6
|
import { getServerUrl, updateConfig } from "../config.js";
|
|
7
7
|
import { registerAgent } from "../http-client.js";
|
|
8
8
|
import { emitNoPersist, parseProfileName, writeProfile, } from "../profile.js";
|
|
9
9
|
const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/;
|
|
10
10
|
const JSON_INDENT_SPACES = 2;
|
|
11
|
+
function parseOpenClawConfig(contents) {
|
|
12
|
+
return Effect.try({
|
|
13
|
+
try: () => JSON.parse(contents),
|
|
14
|
+
catch: (err) => err,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function readExistingOpenClawConfig(fileSystem, configPath) {
|
|
18
|
+
return fileSystem.exists(configPath).pipe(Effect.flatMap((exists) => {
|
|
19
|
+
if (!exists)
|
|
20
|
+
return Effect.succeed({});
|
|
21
|
+
return fileSystem
|
|
22
|
+
.readFileString(configPath, "utf-8")
|
|
23
|
+
.pipe(Effect.flatMap(parseOpenClawConfig));
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
11
26
|
/**
|
|
12
27
|
* Write channel config directly to the OpenClaw JSON file.
|
|
13
28
|
* Avoids `openclaw config set` which triggers both a file-watcher restart
|
|
@@ -18,42 +33,38 @@ const JSON_INDENT_SPACES = 2;
|
|
|
18
33
|
* Per architect design rev 4 finding 2, this side effect is gated by the
|
|
19
34
|
* caller: `--no-persist` skips this call entirely (Invariant §4.4).
|
|
20
35
|
*/
|
|
21
|
-
const writeOpenClawChannelConfig = (account) => Effect.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
36
|
+
const writeOpenClawChannelConfig = (account) => Effect.gen(function* () {
|
|
37
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
38
|
+
const configDir = getOpenClawConfigDir();
|
|
39
|
+
const configPath = getOpenClawConfigPath();
|
|
40
|
+
let config = {};
|
|
41
|
+
const existingConfig = yield* readExistingOpenClawConfig(fileSystem, configPath).pipe(Effect.either);
|
|
42
|
+
yield* Either.match(existingConfig, {
|
|
43
|
+
onLeft: (err) => Effect.logWarning(`moltzap: existing openclaw.json unreadable, starting fresh: ${err instanceof Error ? err.message : String(err)}`),
|
|
44
|
+
onRight: (value) => Effect.sync(() => {
|
|
45
|
+
config = value;
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
const channels = config.channels ?? {};
|
|
49
|
+
channels.moltzap = {
|
|
50
|
+
accounts: [{ id: "default", ...account }],
|
|
51
|
+
};
|
|
52
|
+
config.channels = channels;
|
|
53
|
+
yield* fileSystem.makeDirectory(configDir, { recursive: true });
|
|
54
|
+
yield* fileSystem.writeFileString(configPath, JSON.stringify(config, null, JSON_INDENT_SPACES) + "\n");
|
|
55
|
+
}).pipe(Effect.provide(NodeFileSystem.layer), Effect.either, Effect.flatMap(Either.match({
|
|
56
|
+
onLeft: (err) => Effect.fail(err instanceof Error ? err : new Error(String(err))),
|
|
57
|
+
onRight: (value) => Effect.succeed(value),
|
|
58
|
+
})));
|
|
45
59
|
const nameArg = Args.text({ name: "name" }).pipe(Args.withDescription("Agent name (lowercase alphanumeric, 3-32 chars)"));
|
|
46
60
|
const inviteCodeArg = Args.text({ name: "invite-code" }).pipe(Args.withDescription("Invite code from your invite URL"));
|
|
47
61
|
const descriptionOption = Options.text("description").pipe(Options.withAlias("d"), Options.withDescription("Agent description"), Options.optional);
|
|
48
62
|
// Spec sbd#177 rev 3 §5.2 barrel edits: --profile and --no-persist.
|
|
49
63
|
//
|
|
50
|
-
// NOTE on `--profile` routing: `register`
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
// transport resolver would reject it as missing. `extractGlobalFlags`
|
|
55
|
-
// detects this case by inspecting argv for the `register` leaf and leaves
|
|
56
|
-
// `--profile` in argv; `@effect/cli` binds it here.
|
|
64
|
+
// NOTE on `--profile` routing: `register` consumes `--profile` locally because
|
|
65
|
+
// it writes a NEW profile. Parent-level `moltzap --profile <name>` still means
|
|
66
|
+
// "load an existing profile" for transport selection, and would reject the new
|
|
67
|
+
// profile before this command could create it.
|
|
57
68
|
const profileOption = Options.text("profile").pipe(Options.withDescription("Named profile to register under. Writes the new apiKey to " +
|
|
58
69
|
"`profiles.<name>` in ~/.moltzap/config.json. Omit to overwrite the " +
|
|
59
70
|
"legacy top-level record (the default profile). Other subcommands " +
|
|
@@ -63,15 +74,59 @@ const noPersistFlag = Options.boolean("no-persist").pipe(Options.withDescription
|
|
|
63
74
|
"~/.openclaw/openclaw.json. Prints the apiKey and claim URL to stdout " +
|
|
64
75
|
"so the caller can capture them (e.g. into an env var for use with " +
|
|
65
76
|
"`--as $KEY`) without mutating either config tree."));
|
|
77
|
+
function invalidAgentName(name) {
|
|
78
|
+
return Effect.sync(() => {
|
|
79
|
+
console.error(`Invalid agent name "${name}". Must be 3-32 chars, lowercase alphanumeric and hyphens, cannot start or end with a hyphen.`);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function profileRecordFrom(name, result, serverUrl) {
|
|
84
|
+
return {
|
|
85
|
+
apiKey: result.apiKey,
|
|
86
|
+
agentName: name,
|
|
87
|
+
serverUrl,
|
|
88
|
+
registeredAt: new Date().toISOString(),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function printNoPersistRegistration(name, result, emitted) {
|
|
92
|
+
console.log(`Agent "${name}" registered (not persisted).`);
|
|
93
|
+
console.log(` Agent ID: ${result.agentId}`);
|
|
94
|
+
console.log(` API Key: ${emitted.record.apiKey}`);
|
|
95
|
+
console.log(` Server URL: ${emitted.record.serverUrl}`);
|
|
96
|
+
console.log(` Claim URL: ${result.claimUrl}`);
|
|
97
|
+
console.log("\nShare the claim URL with the agent's owner to verify ownership.");
|
|
98
|
+
}
|
|
99
|
+
function printPersistedRegistration(name, result, serverUrl) {
|
|
100
|
+
console.log(`Agent "${name}" registered and channel configured.`);
|
|
101
|
+
console.log(` Agent ID: ${result.agentId}`);
|
|
102
|
+
console.log(` API Key: ${result.apiKey}`);
|
|
103
|
+
console.log(` Server URL: ${serverUrl}`);
|
|
104
|
+
console.log(` Claim URL: ${result.claimUrl}`);
|
|
105
|
+
console.log("\nShare the claim URL with the agent's owner to verify ownership.");
|
|
106
|
+
}
|
|
107
|
+
function persistRegistration({ profile, record, result, serverUrl, name, }) {
|
|
108
|
+
if (Option.isSome(profile)) {
|
|
109
|
+
return parseProfileName(profile.value).pipe(Effect.flatMap((profileName) => writeProfile(profileName, record)));
|
|
110
|
+
}
|
|
111
|
+
return updateConfig(() => ({
|
|
112
|
+
serverUrl,
|
|
113
|
+
apiKey: result.apiKey,
|
|
114
|
+
agentName: name,
|
|
115
|
+
})).pipe(Effect.zipRight(writeOpenClawChannelConfig({
|
|
116
|
+
apiKey: result.apiKey,
|
|
117
|
+
serverUrl,
|
|
118
|
+
agentName: name,
|
|
119
|
+
})));
|
|
120
|
+
}
|
|
66
121
|
/**
|
|
67
|
-
* `moltzap register
|
|
122
|
+
* `moltzap register <name> <invite-code> [-d description] [--profile <name>] [--no-persist]`
|
|
68
123
|
*
|
|
69
124
|
* POST /api/v1/auth/register, then (by default) persist the result into
|
|
70
125
|
* both `~/.moltzap/config.json` and the OpenClaw channel config so the
|
|
71
126
|
* channel picks it up on its next file-watcher cycle.
|
|
72
127
|
*
|
|
73
128
|
* Spec §5.2 extensions:
|
|
74
|
-
* --profile
|
|
129
|
+
* --profile <name> write under `profiles.<name>` instead of legacy top-level
|
|
75
130
|
* --no-persist print result to stdout only; NO writes to either tree
|
|
76
131
|
*
|
|
77
132
|
* `--no-persist` gates BOTH the `~/.moltzap/config.json` write AND the
|
|
@@ -86,56 +141,22 @@ export const registerCommand = Command.make("register", {
|
|
|
86
141
|
noPersist: noPersistFlag,
|
|
87
142
|
}, ({ name, inviteCode, description, profile, noPersist }) => {
|
|
88
143
|
if (!NAME_PATTERN.test(name)) {
|
|
89
|
-
return
|
|
90
|
-
console.error(`Invalid agent name "${name}". Must be 3-32 chars, lowercase alphanumeric and hyphens, cannot start or end with a hyphen.`);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
});
|
|
144
|
+
return invalidAgentName(name);
|
|
93
145
|
}
|
|
94
146
|
const desc = Option.isSome(description) ? description.value : undefined;
|
|
95
147
|
return Effect.gen(function* () {
|
|
96
148
|
const result = yield* registerAgent(name, inviteCode, desc);
|
|
97
149
|
const serverUrl = yield* getServerUrl;
|
|
98
|
-
const record =
|
|
99
|
-
apiKey: result.apiKey,
|
|
100
|
-
agentName: name,
|
|
101
|
-
serverUrl,
|
|
102
|
-
registeredAt: new Date().toISOString(),
|
|
103
|
-
};
|
|
150
|
+
const record = profileRecordFrom(name, result, serverUrl);
|
|
104
151
|
if (noPersist) {
|
|
105
152
|
// Invariant §4.4: no writes to ~/.moltzap/ or ~/.openclaw/.
|
|
106
153
|
const emitted = yield* emitNoPersist(record);
|
|
107
|
-
|
|
108
|
-
console.log(` Agent ID: ${result.agentId}`);
|
|
109
|
-
console.log(` API Key: ${emitted.record.apiKey}`);
|
|
110
|
-
console.log(` Server URL: ${emitted.record.serverUrl}`);
|
|
111
|
-
console.log(` Claim URL: ${result.claimUrl}`);
|
|
112
|
-
console.log(`\nShare the claim URL with the agent's owner to verify ownership.`);
|
|
154
|
+
printNoPersistRegistration(name, result, emitted);
|
|
113
155
|
return;
|
|
114
156
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
// Legacy top-level persistence path (unchanged).
|
|
121
|
-
yield* updateConfig(() => ({
|
|
122
|
-
serverUrl,
|
|
123
|
-
apiKey: result.apiKey,
|
|
124
|
-
agentName: name,
|
|
125
|
-
}));
|
|
126
|
-
yield* writeOpenClawChannelConfig({
|
|
127
|
-
apiKey: result.apiKey,
|
|
128
|
-
serverUrl,
|
|
129
|
-
agentName: name,
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
console.log(`Agent "${name}" registered and channel configured.`);
|
|
133
|
-
console.log(` Agent ID: ${result.agentId}`);
|
|
134
|
-
console.log(` API Key: ${result.apiKey}`);
|
|
135
|
-
console.log(` Server URL: ${serverUrl}`);
|
|
136
|
-
console.log(` Claim URL: ${result.claimUrl}`);
|
|
137
|
-
console.log(`\nShare the claim URL with the agent's owner to verify ownership.`);
|
|
138
|
-
}).pipe(Effect.catchAll((err) => Effect.sync(() => {
|
|
157
|
+
yield* persistRegistration({ profile, record, result, serverUrl, name });
|
|
158
|
+
printPersistedRegistration(name, result, serverUrl);
|
|
159
|
+
}).pipe(Effect.withSpan("registerCommand"), Effect.catchAll((err) => Effect.sync(() => {
|
|
139
160
|
const msg = err instanceof Error ? err.message : String(err);
|
|
140
161
|
console.error(`Registration failed: ${msg}`);
|
|
141
162
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/cli/commands/register.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,GAEb,MAAM,eAAe,CAAC;AAEvB,MAAM,YAAY,GAAG,mCAAmC,CAAC;AACzD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAiB7B,SAAS,mBAAmB,CAC1B,QAAgB;IAEhB,OAAO,MAAM,CAAC,GAAG,CAAC;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M,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAE1D,IAAI,SAAS,EAAE,CAAC;YACd,4DAA4D;YAC5D,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC7C,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAClD,OAAO;QACT,CAAC;QAED,KAAK,CAAC,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAClC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CACtB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACf,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,KAAK,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CACH,CACF,CAAC;AACJ,CAAC,CACF,CAAC,IAAI,CACJ,OAAO,CAAC,eAAe,CACrB,wDAAwD,CACzD,CACF,CAAC"}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { Effect, Option } from "effect";
|
|
2
|
-
import {
|
|
1
|
+
import { Data, Effect, Option } from "effect";
|
|
2
|
+
import { it as effectIt } from "@effect/vitest";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, vi } from "vitest";
|
|
3
4
|
import { registerCommand } from "./register.js";
|
|
5
|
+
const it = effectIt.effect;
|
|
6
|
+
const AGENT_NAME = "my-agent";
|
|
7
|
+
const INVITE_CODE = "inv_abc123";
|
|
8
|
+
const BAD_INVITE_CODE = "inv_bad";
|
|
9
|
+
const DESCRIPTION = "A test agent";
|
|
10
|
+
const AGENT_ID = "agent-123";
|
|
11
|
+
const API_KEY = "moltzap_agent_testkey";
|
|
12
|
+
const CLAIM_URL = "https://moltzap.xyz/claim/tok_abc";
|
|
13
|
+
class RegisterTestFailure extends Data.TaggedError("RegisterTestFailure") {
|
|
14
|
+
}
|
|
4
15
|
const mockRegisterAgent = vi.fn();
|
|
5
16
|
vi.mock("../http-client.js", () => ({
|
|
6
|
-
registerAgent: (name, inviteCode, description) =>
|
|
17
|
+
registerAgent: (name, inviteCode, description) => {
|
|
18
|
+
const resolvedDescription = description;
|
|
19
|
+
return mockRegisterAgent(name, inviteCode, resolvedDescription);
|
|
20
|
+
},
|
|
7
21
|
}));
|
|
8
22
|
vi.mock("../config.js", () => ({
|
|
9
23
|
updateConfig: vi.fn(() => Effect.void),
|
|
@@ -18,50 +32,60 @@ vi.mock("node:fs", () => ({
|
|
|
18
32
|
writeFileSync: vi.fn(),
|
|
19
33
|
mkdirSync: vi.fn(),
|
|
20
34
|
}));
|
|
35
|
+
function registerHandlerInput(description) {
|
|
36
|
+
return {
|
|
37
|
+
name: AGENT_NAME,
|
|
38
|
+
inviteCode: INVITE_CODE,
|
|
39
|
+
description,
|
|
40
|
+
profile: Option.none(),
|
|
41
|
+
noPersist: false,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function successfulRegistration() {
|
|
45
|
+
return Effect.succeed({
|
|
46
|
+
agentId: AGENT_ID,
|
|
47
|
+
apiKey: API_KEY,
|
|
48
|
+
claimUrl: CLAIM_URL,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function failedRegistration() {
|
|
52
|
+
return Effect.fail(new RegisterTestFailure({ message: "Invalid invite code" }));
|
|
53
|
+
}
|
|
54
|
+
function passThroughWithoutDescription() {
|
|
55
|
+
return Effect.gen(function* () {
|
|
56
|
+
yield* registerCommand.handler(registerHandlerInput(Option.none()));
|
|
57
|
+
expect(mockRegisterAgent).toHaveBeenCalledWith(AGENT_NAME, INVITE_CODE, undefined);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function forwardsDescription() {
|
|
61
|
+
return Effect.gen(function* () {
|
|
62
|
+
yield* registerCommand.handler(registerHandlerInput(Option.some(DESCRIPTION)));
|
|
63
|
+
expect(mockRegisterAgent).toHaveBeenCalledWith(AGENT_NAME, INVITE_CODE, DESCRIPTION);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function exitsOnRegistrationFailure() {
|
|
67
|
+
return Effect.gen(function* () {
|
|
68
|
+
mockRegisterAgent.mockImplementationOnce(failedRegistration);
|
|
69
|
+
yield* registerCommand.handler({
|
|
70
|
+
...registerHandlerInput(Option.none()),
|
|
71
|
+
inviteCode: BAD_INVITE_CODE,
|
|
72
|
+
description: Option.none(),
|
|
73
|
+
});
|
|
74
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
21
77
|
describe("register command handler", () => {
|
|
22
78
|
const originalExit = process.exit;
|
|
23
79
|
beforeEach(() => {
|
|
24
80
|
vi.clearAllMocks();
|
|
25
81
|
process.exit = vi.fn();
|
|
26
|
-
mockRegisterAgent.mockImplementation(
|
|
27
|
-
agentId: "agent-123",
|
|
28
|
-
apiKey: "moltzap_agent_testkey",
|
|
29
|
-
claimUrl: "https://moltzap.xyz/claim/tok_abc",
|
|
30
|
-
}));
|
|
82
|
+
mockRegisterAgent.mockImplementation(successfulRegistration);
|
|
31
83
|
});
|
|
32
84
|
afterEach(() => {
|
|
33
85
|
process.exit = originalExit;
|
|
34
86
|
});
|
|
35
|
-
it("passes name, inviteCode, and description through",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
inviteCode: "inv_abc123",
|
|
39
|
-
description: Option.none(),
|
|
40
|
-
profile: Option.none(),
|
|
41
|
-
noPersist: false,
|
|
42
|
-
}));
|
|
43
|
-
expect(mockRegisterAgent).toHaveBeenCalledWith("my-agent", "inv_abc123", undefined);
|
|
44
|
-
});
|
|
45
|
-
it("forwards description option when provided", async () => {
|
|
46
|
-
await Effect.runPromise(registerCommand.handler({
|
|
47
|
-
name: "my-agent",
|
|
48
|
-
inviteCode: "inv_abc123",
|
|
49
|
-
description: Option.some("A test agent"),
|
|
50
|
-
profile: Option.none(),
|
|
51
|
-
noPersist: false,
|
|
52
|
-
}));
|
|
53
|
-
expect(mockRegisterAgent).toHaveBeenCalledWith("my-agent", "inv_abc123", "A test agent");
|
|
54
|
-
});
|
|
55
|
-
it("exits with error on registration failure", async () => {
|
|
56
|
-
mockRegisterAgent.mockImplementationOnce(() => Effect.fail(new Error("Invalid invite code")));
|
|
57
|
-
await Effect.runPromise(registerCommand.handler({
|
|
58
|
-
name: "my-agent",
|
|
59
|
-
inviteCode: "inv_bad",
|
|
60
|
-
description: Option.none(),
|
|
61
|
-
profile: Option.none(),
|
|
62
|
-
noPersist: false,
|
|
63
|
-
}));
|
|
64
|
-
expect(process.exit).toHaveBeenCalledWith(1);
|
|
65
|
-
});
|
|
87
|
+
it("passes name, inviteCode, and description through", passThroughWithoutDescription);
|
|
88
|
+
it("forwards description option when provided", forwardsDescription);
|
|
89
|
+
it("exits with error on registration failure", exitsOnRegistrationFailure);
|
|
66
90
|
});
|
|
67
91
|
//# sourceMappingURL=register.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.test.js","sourceRoot":"","sources":["../../../src/cli/commands/register.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"register.test.js","sourceRoot":"","sources":["../../../src/cli/commands/register.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;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@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Command } from "@effect/cli";
|
|
2
2
|
import { Option } from "effect";
|
|
3
3
|
/**
|
|
4
|
-
* `moltzap send
|
|
4
|
+
* `moltzap send <target> <message> [--reply-to <id>]` — socket-call into
|
|
5
5
|
* the local MoltZapService to enqueue an outbound message. `conv:` prefix
|
|
6
6
|
* addresses a conversation id directly; otherwise `target` is passed as a
|
|
7
|
-
* string the service resolves (typically `agent
|
|
7
|
+
* string the service resolves (typically `agent:<name>` for direct messages
|
|
8
8
|
* or a bare contact name the service resolves against the caller's roster).
|
|
9
9
|
*
|
|
10
|
-
* Identity selection is driven by the
|
|
11
|
-
* `cli/index.ts
|
|
10
|
+
* Identity selection is driven by the parent `@effect/cli` options wired in
|
|
11
|
+
* `cli/index.ts`:
|
|
12
12
|
*
|
|
13
|
-
* --as
|
|
13
|
+
* --as <apiKey> Send as the agent owning the given API key.
|
|
14
14
|
* Bypasses the local daemon socket; dials the server
|
|
15
15
|
* directly. Useful in multi-agent workflows where
|
|
16
16
|
* the same host registers more than one agent.
|
|
17
|
-
* --profile
|
|
17
|
+
* --profile <name> Load the named profile from ~/.moltzap/config.json
|
|
18
18
|
* and send as that agent. Short for looking up the
|
|
19
19
|
* apiKey out of the profile and passing it as --as.
|
|
20
20
|
*
|
|
@@ -7,20 +7,20 @@ const targetArg = Args.text({ name: "target" }).pipe(Args.withDescription("Targe
|
|
|
7
7
|
const messageArg = Args.text({ name: "message" }).pipe(Args.withDescription("Message text"));
|
|
8
8
|
const replyToOption = Options.text("reply-to").pipe(Options.withDescription("Reply to a specific message"), Options.optional);
|
|
9
9
|
/**
|
|
10
|
-
* `moltzap send
|
|
10
|
+
* `moltzap send <target> <message> [--reply-to <id>]` — socket-call into
|
|
11
11
|
* the local MoltZapService to enqueue an outbound message. `conv:` prefix
|
|
12
12
|
* addresses a conversation id directly; otherwise `target` is passed as a
|
|
13
|
-
* string the service resolves (typically `agent
|
|
13
|
+
* string the service resolves (typically `agent:<name>` for direct messages
|
|
14
14
|
* or a bare contact name the service resolves against the caller's roster).
|
|
15
15
|
*
|
|
16
|
-
* Identity selection is driven by the
|
|
17
|
-
* `cli/index.ts
|
|
16
|
+
* Identity selection is driven by the parent `@effect/cli` options wired in
|
|
17
|
+
* `cli/index.ts`:
|
|
18
18
|
*
|
|
19
|
-
* --as
|
|
19
|
+
* --as <apiKey> Send as the agent owning the given API key.
|
|
20
20
|
* Bypasses the local daemon socket; dials the server
|
|
21
21
|
* directly. Useful in multi-agent workflows where
|
|
22
22
|
* the same host registers more than one agent.
|
|
23
|
-
* --profile
|
|
23
|
+
* --profile <name> Load the named profile from ~/.moltzap/config.json
|
|
24
24
|
* and send as that agent. Short for looking up the
|
|
25
25
|
* apiKey out of the profile and passing it as --as.
|
|
26
26
|
*
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { Effect, Option } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import { it as effectIt } from "@effect/vitest";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, vi } from "vitest";
|
|
3
4
|
import { sendCommand } from "./send.js";
|
|
4
5
|
import { MessagesSend } from "@moltzap/protocol";
|
|
6
|
+
const it = effectIt.effect;
|
|
7
|
+
const CONV_UUID = "00000000-0000-4000-8000-00000000abc1";
|
|
8
|
+
const REPLY_MSG = "00000000-0000-4000-8000-0000000000a1";
|
|
9
|
+
const HELLO_WORLD = "Hello world";
|
|
10
|
+
const HI_ALICE = "Hi Alice";
|
|
11
|
+
const REPLY_TEXT = "Reply text";
|
|
5
12
|
const mockRequest = vi.fn(() => Effect.succeed({ message: { id: "msg-123" } }));
|
|
6
|
-
vi.mock("../socket-client.js",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
+
vi.mock("../socket-client.js", () => ({
|
|
14
|
+
request: (...args) => mockRequest(...args),
|
|
15
|
+
}));
|
|
16
|
+
function runSendCommand(input) {
|
|
17
|
+
return sendCommand.handler(input);
|
|
18
|
+
}
|
|
13
19
|
describe("send command handler", () => {
|
|
14
20
|
const originalExit = process.exit;
|
|
15
21
|
beforeEach(() => {
|
|
@@ -20,41 +26,39 @@ describe("send command handler", () => {
|
|
|
20
26
|
afterEach(() => {
|
|
21
27
|
process.exit = originalExit;
|
|
22
28
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
await Effect.runPromise(sendCommand.handler({
|
|
29
|
+
it("sends to conversation by conv: prefix", () => Effect.gen(function* () {
|
|
30
|
+
yield* runSendCommand({
|
|
26
31
|
target: `conv:${CONV_UUID}`,
|
|
27
|
-
message:
|
|
32
|
+
message: HELLO_WORLD,
|
|
28
33
|
replyTo: Option.none(),
|
|
29
|
-
})
|
|
34
|
+
});
|
|
30
35
|
expect(mockRequest).toHaveBeenCalledWith(MessagesSend, {
|
|
31
36
|
conversationId: CONV_UUID,
|
|
32
|
-
parts: [{ type: "text", text:
|
|
37
|
+
parts: [{ type: "text", text: HELLO_WORLD }],
|
|
33
38
|
});
|
|
34
|
-
});
|
|
35
|
-
it("sends to agent target without conv: prefix",
|
|
36
|
-
|
|
39
|
+
}));
|
|
40
|
+
it("sends to agent target without conv: prefix", () => Effect.gen(function* () {
|
|
41
|
+
yield* runSendCommand({
|
|
37
42
|
target: "agent:alice",
|
|
38
|
-
message:
|
|
43
|
+
message: HI_ALICE,
|
|
39
44
|
replyTo: Option.none(),
|
|
40
|
-
})
|
|
45
|
+
});
|
|
41
46
|
expect(mockRequest).toHaveBeenCalledWith(MessagesSend, {
|
|
42
47
|
to: "agent:alice",
|
|
43
|
-
parts: [{ type: "text", text:
|
|
48
|
+
parts: [{ type: "text", text: HI_ALICE }],
|
|
44
49
|
});
|
|
45
|
-
});
|
|
46
|
-
it("includes replyToId when --reply-to is provided",
|
|
47
|
-
|
|
48
|
-
await Effect.runPromise(sendCommand.handler({
|
|
50
|
+
}));
|
|
51
|
+
it("includes replyToId when --reply-to is provided", () => Effect.gen(function* () {
|
|
52
|
+
yield* runSendCommand({
|
|
49
53
|
target: `conv:${CONV_UUID}`,
|
|
50
|
-
message:
|
|
54
|
+
message: REPLY_TEXT,
|
|
51
55
|
replyTo: Option.some(REPLY_MSG),
|
|
52
|
-
})
|
|
56
|
+
});
|
|
53
57
|
expect(mockRequest).toHaveBeenCalledWith(MessagesSend, {
|
|
54
58
|
conversationId: CONV_UUID,
|
|
55
|
-
parts: [{ type: "text", text:
|
|
59
|
+
parts: [{ type: "text", text: REPLY_TEXT }],
|
|
56
60
|
replyToId: REPLY_MSG,
|
|
57
61
|
});
|
|
58
|
-
});
|
|
62
|
+
}));
|
|
59
63
|
});
|
|
60
64
|
//# sourceMappingURL=send.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.test.js","sourceRoot":"","sources":["../../../src/cli/commands/send.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"send.test.js","sourceRoot":"","sources":["../../../src/cli/commands/send.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;AAC3B,MAAM,SAAS,GAAG,sCAAsC,CAAC;AACzD,MAAM,SAAS,GAAG,sCAAsC,CAAC;AACzD,MAAM,WA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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC;;;GAGG;AACH,eAAO,MAAM,aAAa,6CAqBzB,CAAC"}
|
|
@@ -6,10 +6,9 @@ import { LocalServiceCommands, requestLocalService } from "../socket-client.js";
|
|
|
6
6
|
* agent id, live connection state, and conversation count.
|
|
7
7
|
*/
|
|
8
8
|
export const statusCommand = Command.make("status", {}, () => requestLocalService(LocalServiceCommands.Status).pipe(Effect.tap((result) => Effect.sync(() => {
|
|
9
|
-
|
|
10
|
-
console.log(`
|
|
11
|
-
console.log(`
|
|
12
|
-
console.log(`Conversations: ${r.conversations}`);
|
|
9
|
+
console.log(`Agent ID: ${result.agentId ?? "none"}`);
|
|
10
|
+
console.log(`Connected: ${result.connected}`);
|
|
11
|
+
console.log(`Conversations: ${result.conversations}`);
|
|
13
12
|
})), Effect.asVoid, Effect.catchAll((err) => Effect.sync(() => {
|
|
14
13
|
console.error(`Failed: ${err.message}`);
|
|
15
14
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
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,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;
|
|
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,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,CAC3D,mBAAmB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,CACnD,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACpB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;IACf,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC,CACH,EACD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CACtB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;IACf,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CACH,CACF,CACF,CAAC,IAAI,CACJ,OAAO,CAAC,eAAe,CACrB,uDAAuD,CACxD,CACF,CAAC"}
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -52,8 +52,6 @@ export declare function getConfigPath(): string;
|
|
|
52
52
|
* failures so callers see them instead of getting silent defaults.
|
|
53
53
|
*/
|
|
54
54
|
export declare const loadConfig: Effect.Effect<MoltZapConfig, ConfigReadError | ConfigInvalidError>;
|
|
55
|
-
/** Write a new config blob to disk. Used by `moltzap register` post-registration. */
|
|
56
|
-
export declare const writeConfig: (config: MoltZapConfig) => Effect.Effect<void, ConfigWriteError>;
|
|
57
55
|
/** Load-modify-write helper. */
|
|
58
56
|
export declare const updateConfig: (updater: (config: MoltZapConfig) => MoltZapConfig) => Effect.Effect<void, ConfigInvalidError | ConfigReadError | ConfigWriteError>;
|
|
59
57
|
/** WebSocket server URL (env-overridable). */
|