@moltzap/client 2026.520.0 → 2026.520.2

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.
@@ -5,7 +5,7 @@
5
5
  * `@moltzap/nanoclaw-channel` to canonicalize the lease-lifecycle primitives,
6
6
  * the `LeaseAlreadyConsumed` tagged error, and the markup-parameterized
7
7
  * cross-conv + group-block formatters. Detail doc:
8
- * `packages/client/docs/architecture/08-channel-base.md`. Spec: #597.
8
+ * `packages/client/docs/architecture/channel-base.md`. Spec: #597.
9
9
  * Architect plan: #605.
10
10
  *
11
11
  * Note: this subpath is opt-in. Direct `@moltzap/client` consumers
@@ -5,7 +5,7 @@
5
5
  * `@moltzap/nanoclaw-channel` to canonicalize the lease-lifecycle primitives,
6
6
  * the `LeaseAlreadyConsumed` tagged error, and the markup-parameterized
7
7
  * cross-conv + group-block formatters. Detail doc:
8
- * `packages/client/docs/architecture/08-channel-base.md`. Spec: #597.
8
+ * `packages/client/docs/architecture/channel-base.md`. Spec: #597.
9
9
  * Architect plan: #605.
10
10
  *
11
11
  * Note: this subpath is opt-in. Direct `@moltzap/client` consumers
@@ -0,0 +1,58 @@
1
+ /**
2
+ * `moltzap start <name> <participant>... [--message <text>] [--app-id <uuid>]`
3
+ *
4
+ * Spec D2 (#599) — single-command CLI composition over Spec D1's atomic
5
+ * `TaskCreate({ appId, invitedAgentIds, initialConversation })` plus an
6
+ * optional `MessagesSend`. Today's two-step workflow
7
+ * (`conversations create` -> `send conv:<id> <text>`) collapses into
8
+ * one subcommand for the common case.
9
+ *
10
+ * See also:
11
+ * - `packages/protocol/src/task/tasks.ts -> TaskCreate` / `DEFAULT_APP_ID` /
12
+ * `AppId` — D1 (#598) wire surface this command composes.
13
+ * - `packages/client/docs/architecture/moltzap-start-cli.md` for the
14
+ * command flow diagram, exit-code contract, and test alignment.
15
+ * - `packages/client/src/cli/commands/conversations.ts -> createConversation`
16
+ * for the legacy two-step DM/Group create path D2 replaces. Untouched
17
+ * in D2; D3 (#600) deletes it.
18
+ * - `packages/client/src/cli/socket-client.ts -> resolveParticipant` —
19
+ * NOT reused by D2 because that helper goes via the daemon
20
+ * socket (`socket-client.ts -> request`), bypassing the CLI
21
+ * `Transport` service that `start.ts` uses for `TaskCreate` /
22
+ * `MessagesSend`. Mixing the two would make `--as`-mode name lookups
23
+ * hit the daemon (potentially absent) and would not be testable
24
+ * via `makeFakeTransport`. D2 introduces a local `resolveAgentTokens`
25
+ * helper that goes through `transport.ts -> rpc` instead
26
+ * (see per-flow doc §6 + §"Why we don't reuse `resolveParticipant`").
27
+ */
28
+ import { Command } from "@effect/cli";
29
+ import { Effect, Option } from "effect";
30
+ import { type Transport } from "../transport.js";
31
+ /**
32
+ * Parsed CLI arguments for the `start` command. `@effect/cli`'s
33
+ * `Args.repeated` admits zero participants — caller-only tasks are
34
+ * permitted at the wire (Spec D1 per-flow doc 12) but not exercised by
35
+ * spec D2 ACs (which cover `length === 1` DM and `length >= 2` group
36
+ * shapes). Handler MUST NOT reject empty `participants`.
37
+ */
38
+ export interface StartCommandArgs {
39
+ readonly name: string;
40
+ readonly participants: readonly string[];
41
+ readonly message: string | undefined;
42
+ readonly appId: string | undefined;
43
+ }
44
+ /**
45
+ * Test seam: invoke the handler directly with parsed args, bypassing
46
+ * `@effect/cli`'s parser. Returns the same `Effect` the `Command.make`
47
+ * wrapper would produce, including the `runStartCommand` exit-code
48
+ * dispatcher. Tests `Effect.provideService(Transport, fake)` and assert
49
+ * `process.exit` was called with the expected code.
50
+ */
51
+ export declare const runStartHandler: (args: StartCommandArgs) => Effect.Effect<void, never, Transport>;
52
+ export declare const startCommand: Command.Command<"start", Transport, never, {
53
+ readonly name: string;
54
+ readonly participants: string[];
55
+ readonly message: Option.Option<string>;
56
+ readonly appId: Option.Option<string>;
57
+ }>;
58
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAQ,OAAO,EAAW,MAAM,aAAa,CAAC;AACrD,OAAO,EAAQ,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAetD,OAAO,EAAO,KAAK,SAAS,EAAuB,MAAM,iBAAiB,CAAC;AA0E3E;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AA0iBD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,gBAAgB,KACrB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CACK,CAAC;AAE7C,eAAO,MAAM,YAAY;;;;;EA8BxB,CAAC"}
@@ -0,0 +1,455 @@
1
+ /**
2
+ * `moltzap start &lt;name> &lt;participant>... [--message &lt;text>] [--app-id &lt;uuid>]`
3
+ *
4
+ * Spec D2 (#599) — single-command CLI composition over Spec D1's atomic
5
+ * `TaskCreate({ appId, invitedAgentIds, initialConversation })` plus an
6
+ * optional `MessagesSend`. Today's two-step workflow
7
+ * (`conversations create` -> `send conv:&lt;id> &lt;text>`) collapses into
8
+ * one subcommand for the common case.
9
+ *
10
+ * See also:
11
+ * - `packages/protocol/src/task/tasks.ts -> TaskCreate` / `DEFAULT_APP_ID` /
12
+ * `AppId` — D1 (#598) wire surface this command composes.
13
+ * - `packages/client/docs/architecture/moltzap-start-cli.md` for the
14
+ * command flow diagram, exit-code contract, and test alignment.
15
+ * - `packages/client/src/cli/commands/conversations.ts -> createConversation`
16
+ * for the legacy two-step DM/Group create path D2 replaces. Untouched
17
+ * in D2; D3 (#600) deletes it.
18
+ * - `packages/client/src/cli/socket-client.ts -> resolveParticipant` —
19
+ * NOT reused by D2 because that helper goes via the daemon
20
+ * socket (`socket-client.ts -> request`), bypassing the CLI
21
+ * `Transport` service that `start.ts` uses for `TaskCreate` /
22
+ * `MessagesSend`. Mixing the two would make `--as`-mode name lookups
23
+ * hit the daemon (potentially absent) and would not be testable
24
+ * via `makeFakeTransport`. D2 introduces a local `resolveAgentTokens`
25
+ * helper that goes through `transport.ts -> rpc` instead
26
+ * (see per-flow doc §6 + §"Why we don't reuse `resolveParticipant`").
27
+ */
28
+ import { Args, Command, Options } from "@effect/cli";
29
+ import { Data, Effect, Either, Option } from "effect";
30
+ import { AgentsLookupByName, DEFAULT_APP_ID, MessagesSend, TaskConversationList, TaskCreate, } from "@moltzap/protocol";
31
+ import { rpc } from "../transport.js";
32
+ // ─── Exit-code contract (spec D2 Goal 5 + Goal 7) ─────────────────────────
33
+ /**
34
+ * Exit-code table for the `moltzap start` command. Values are documented
35
+ * in `Command.withDescription` help text below; the handler branches on
36
+ * these via `runStartCommand` and inline `process.exit` in the
37
+ * partial-success path.
38
+ */
39
+ const EXIT_CODES = {
40
+ SUCCESS: 0,
41
+ TASK_CREATE_FAILED: 1,
42
+ PARTIAL_SUCCESS: 2,
43
+ USAGE_ERROR: 64,
44
+ };
45
+ // ─── Tagged errors (CLI-local) ────────────────────────────────────────────
46
+ /**
47
+ * `--app-id &lt;value>` failed syntactic UUID v4 validation before any RPC.
48
+ * Maps to `EXIT_CODES.USAGE_ERROR`; stderr prints
49
+ * `Invalid --app-id: not a UUID`. Local to this module — tests assert
50
+ * by exit code + stderr text rather than `expect().toBeInstanceOf(...)`,
51
+ * so the class stays unexported per the architect plan.
52
+ */
53
+ class InvalidAppIdError extends Data.TaggedError("InvalidAppIdError") {
54
+ }
55
+ /**
56
+ * An `agent:&lt;name>` or `agent:&lt;uuid>` participant token could not be
57
+ * resolved (name not in the agent roster, or token mis-shaped). Maps
58
+ * to `EXIT_CODES.USAGE_ERROR`; stderr names the unresolved token.
59
+ *
60
+ * Resolver calls `AgentsLookupByName` (a server RPC) for name-shaped
61
+ * tokens. That RPC is read-only and does not mutate server state, so
62
+ * the partial-failure invariant is unaffected. The spec D2 AC clause
63
+ * "NO RPC calls" reads as "NO mutating (TaskCreate / MessagesSend)
64
+ * calls" in this plan; see per-flow doc §8 + plan §R5.
65
+ */
66
+ class UnresolvedParticipantError extends Data.TaggedError("UnresolvedParticipantError") {
67
+ }
68
+ /**
69
+ * Too many DISTINCT name-shaped tokens to batch into one
70
+ * `AgentsLookupByName` RPC (schema caps `names` at `maxItems: 100`).
71
+ * Maps to `EXIT_CODES.USAGE_ERROR`; stderr names the offending count.
72
+ *
73
+ * Distinct from `UnresolvedParticipantError` — fires BEFORE any RPC, on
74
+ * a count check. Without this carve-out, 101+ unique names would
75
+ * trigger an opaque AJV decode failure mapped to exit 1 ("Failed:
76
+ * params decode error"); this surfaces it as a usage error instead.
77
+ */
78
+ class TooManyParticipantNamesError extends Data.TaggedError("TooManyParticipantNamesError") {
79
+ }
80
+ /**
81
+ * Cap pinned to `AgentsLookupByName.params.names: Type.Array(...,
82
+ * { maxItems: 100 })`. Drift here vs. the schema causes a confusing
83
+ * exit-1 AJV rejection instead of the exit-64 usage error.
84
+ */
85
+ const MAX_NAME_LOOKUP_BATCH = 100;
86
+ // ─── UUID validation ──────────────────────────────────────────────────────
87
+ /**
88
+ * RFC 4122 UUID v4 regex per plan Invariant 7. The `4` in the third
89
+ * group pins the version; the `[89ab]` in the fourth group pins the
90
+ * variant. Pre-existing `socket-client.ts -> UUID_RE` accepts any UUID
91
+ * version, which would let v3/v5/v7 tokens through; spec D2 Goal 7
92
+ * requires v4-specific rejection at exit 64.
93
+ */
94
+ const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
95
+ const validateAppId = (value) => UUID_V4_RE.test(value)
96
+ ? Effect.succeed(value)
97
+ : Effect.fail(new InvalidAppIdError({ value }));
98
+ // ─── Participant token resolver ───────────────────────────────────────────
99
+ const AGENT_TOKEN_PREFIX = "agent:";
100
+ const classifyToken = (token) => {
101
+ const failShape = Effect.fail(new UnresolvedParticipantError({ token, reason: "shape" }));
102
+ if (!token.startsWith(AGENT_TOKEN_PREFIX))
103
+ return failShape;
104
+ const rest = token.slice(AGENT_TOKEN_PREFIX.length);
105
+ if (rest.length === 0)
106
+ return failShape;
107
+ if (UUID_V4_RE.test(rest)) {
108
+ return Effect.succeed({ kind: "uuid", id: rest });
109
+ }
110
+ return Effect.succeed({ kind: "name", token, name: rest });
111
+ };
112
+ /**
113
+ * Resolve all participant tokens to bare `AgentId`s matching
114
+ * `TaskCreate.params.invitedAgentIds: Array(AgentId)` directly (no
115
+ * `.map(p => p.id)` step needed).
116
+ *
117
+ * Failure modes (first in input order wins):
118
+ * - Token does not start with `agent:` (or is `agent:` with empty
119
+ * name) -> `UnresolvedParticipantError({ reason: "shape" })`.
120
+ * - Token is `agent:&lt;name>` and the batched lookup returns no agent
121
+ * matching `name` -> `UnresolvedParticipantError({ reason:
122
+ * "not-found" })`.
123
+ *
124
+ * WHY one batched RPC instead of one-per-token: `AgentsLookupByName`
125
+ * accepts `names: Array(..., { minItems: 1, maxItems: 100 })`. Coalesce
126
+ * unique name-shaped tokens into a single RPC; UUID-shaped tokens skip
127
+ * the wire entirely. Resolution map keys on agent name so duplicate
128
+ * tokens (`agent:bob agent:bob`) resolve to the same id without
129
+ * re-asking the server.
130
+ *
131
+ * Architect plan §R1 explains why this is a local helper rather than
132
+ * reusing `socket-client.ts -> resolveParticipant` (transport mismatch,
133
+ * testability, wire-shape match).
134
+ */
135
+ const uniqueNamesOf = (classified) => Array.from(new Set(classified.flatMap((c) => (c.kind === "name" ? [c.name] : []))));
136
+ /**
137
+ * Look up `names` in one batched RPC (no-op when empty) and return a
138
+ * name→AgentId map keyed by FIRST agent per name. The server's response
139
+ * is a flat agents array; mapping by name preserves the pre-P3-2
140
+ * tie-break ("first agent wins"). Caps at `MAX_NAME_LOOKUP_BATCH`
141
+ * BEFORE the RPC to keep the >100 case as a usage error rather than a
142
+ * decode failure.
143
+ */
144
+ const lookupAgentIdsByName = (names) => Effect.gen(function* () {
145
+ const byName = new Map();
146
+ if (names.length === 0)
147
+ return byName;
148
+ if (names.length > MAX_NAME_LOOKUP_BATCH) {
149
+ return yield* Effect.fail(new TooManyParticipantNamesError({
150
+ count: names.length,
151
+ max: MAX_NAME_LOOKUP_BATCH,
152
+ }));
153
+ }
154
+ // Defensive copy: AgentsLookupByName.params.names resolves to
155
+ // mutable `string[]` (TypeBox's `Static<Array>`); pass a shallow
156
+ // clone so the caller's readonly contract isn't bypassed.
157
+ const result = yield* rpc(AgentsLookupByName, { names: [...names] });
158
+ for (const agent of result.agents) {
159
+ if (!byName.has(agent.name))
160
+ byName.set(agent.name, agent.id);
161
+ }
162
+ return byName;
163
+ });
164
+ const resolveAgentTokens = (tokens) => Effect.gen(function* () {
165
+ const classified = yield* Effect.all(tokens.map(classifyToken));
166
+ const agentIdByName = yield* lookupAgentIdsByName(uniqueNamesOf(classified));
167
+ // Single for-loop avoids a second `Effect.all` over pure post-batch
168
+ // resolution (N extra Effect cells); fail-fast on first miss preserves
169
+ // input-order error semantics.
170
+ const resolved = [];
171
+ for (const entry of classified) {
172
+ if (entry.kind === "uuid") {
173
+ resolved.push(entry.id);
174
+ continue;
175
+ }
176
+ const id = agentIdByName.get(entry.name);
177
+ if (id === undefined) {
178
+ return yield* Effect.fail(new UnresolvedParticipantError({
179
+ token: entry.token,
180
+ reason: "not-found",
181
+ }));
182
+ }
183
+ resolved.push(id);
184
+ }
185
+ return resolved;
186
+ });
187
+ // ─── Handler stages ───────────────────────────────────────────────────────
188
+ const resolveAppId = (raw) => raw === undefined ? Effect.succeed(DEFAULT_APP_ID) : validateAppId(raw);
189
+ const printTaskCreated = (task, conversation) => Effect.sync(() => {
190
+ console.log(`Task started: ${task.id} (conversation: ${conversation.id})`);
191
+ });
192
+ const printTaskReused = (task, conversation) => Effect.sync(() => {
193
+ console.log(`Task started: ${task.id} (reusing existing conversation: ${conversation.id})`);
194
+ });
195
+ const printTaskAlreadyClosed = (taskId) => Effect.sync(() => {
196
+ // WHY this single message covers two distinct conditions:
197
+ // (a) the existing task has no non-archived conversation, OR
198
+ // (b) the dedup-lookup window (1000 rows) did not surface one.
199
+ // (b) is rare per the activity-desc server ordering; if a heavy
200
+ // user trips it on an active task, the spec D2 amendment N6
201
+ // diagnostic is intentionally conservative ("closed") rather than
202
+ // claiming false freshness. The follow-up `moltzap conversations
203
+ // list` invocation surfaces the real state.
204
+ console.error(`Task already exists but is closed: ${taskId}`);
205
+ });
206
+ const printMessageSent = (messageId) => Effect.sync(() => {
207
+ console.log(`Message sent: ${messageId}`);
208
+ });
209
+ const sendFirstMessage = (conversationId, text) => Effect.either(rpc(MessagesSend, {
210
+ conversationId,
211
+ parts: [{ type: "text", text }],
212
+ })).pipe(Effect.flatMap(Either.match({
213
+ onLeft: (err) => Effect.sync(() => {
214
+ console.error(`Error sending message: ${err.message}`);
215
+ process.exit(EXIT_CODES.PARTIAL_SUCCESS);
216
+ }),
217
+ onRight: (ok) => printMessageSent(ok.message.id),
218
+ })));
219
+ const createTaskAtomic = (appId, invitedAgentIds, name) => Effect.gen(function* () {
220
+ // Defensive copies: TaskCreate's params type expects mutable arrays
221
+ // (TypeBox's Static<Array> resolves to T[], not readonly T[]); pass
222
+ // shallow clones so the caller's readonly contract isn't bypassed.
223
+ //
224
+ // Spec D2 (#599) amendment N7 (zero-participant carve-out):
225
+ // `InitialConversationSchema.participants` is `Type.Optional(Type.Array(AgentId,
226
+ // { minItems: 1 }))` — an EMPTY array fails server AJV. The
227
+ // caller-only path (help text + plan §R4 + `start.test.ts →
228
+ // zeroParticipants`) MUST omit `participants` entirely; the server
229
+ // adds the caller to `conversation_participants` implicitly. See
230
+ // `packages/protocol/src/task/tasks.ts → InitialConversationSchema`.
231
+ const initialConversation = invitedAgentIds.length === 0
232
+ ? { name }
233
+ : { name, participants: [...invitedAgentIds] };
234
+ const result = yield* rpc(TaskCreate, {
235
+ appId,
236
+ invitedAgentIds: [...invitedAgentIds],
237
+ initialConversation,
238
+ });
239
+ if (result.conversation === null) {
240
+ // Dedup hit (per `tasks.handlers.ts → maybeTaskCreateDedup`): the
241
+ // server matched an existing task by `{caller} ∪ invitedAgentIds`
242
+ // and returned it with `conversation: null`. Handler resolves a
243
+ // reusable conversation via `findReusableConversation` instead of
244
+ // failing.
245
+ return { kind: "dedup", task: result.task };
246
+ }
247
+ return {
248
+ kind: "created",
249
+ task: result.task,
250
+ conversation: result.conversation,
251
+ };
252
+ });
253
+ // ─── Dedup-hit conversation lookup (spec D2 amendment N6) ─────────────────
254
+ /**
255
+ * Page size + safety cap on `TaskConversationList` follow-up calls. The
256
+ * dedup-hit conversation should appear in the first page for any
257
+ * recently-touched task (server orders by activity desc, see
258
+ * `packages/server/src/task/services/conversation/list-pagination.ts →
259
+ * queryConversationListRows`). The cap protects against pathological
260
+ * cases where the caller has a very long list and the target task is
261
+ * older than the window can see — in which case we surface the closed-
262
+ * task diagnostic rather than spin indefinitely.
263
+ */
264
+ const DEDUP_LOOKUP_PAGE_SIZE = 100;
265
+ const DEDUP_LOOKUP_MAX_PAGES = 10;
266
+ /**
267
+ * P2-A (spec D2 amendment N6) — locate a reusable conversation under a
268
+ * dedup-hit task. Tie-break rule: "first match in server iteration
269
+ * order" — server sorts by activity desc, so this is equivalent to
270
+ * most-recently-active. WHY a small page-count cap: a freshly-touched
271
+ * dedup-hit task lives near the top of the activity-sorted list; the
272
+ * 1000-row ceiling protects against pathological lists where the
273
+ * target is older than the lookup window can see (the closed-task
274
+ * diagnostic is the correct fallback per spec D2 amendment N6).
275
+ */
276
+ /**
277
+ * Filter rule for the dedup-hit lookup: (a) the item's `taskId` must
278
+ * match the existing task we are reusing (the list is caller-scoped
279
+ * across ALL of the caller's tasks, not task-scoped); (b) the
280
+ * conversation must be non-archived (server includes archived rows
281
+ * unfiltered per `TaskConversationList`'s contract — clients filter
282
+ * `archivedAt !== undefined` locally; archived strings are absent
283
+ * on the wire when the row is active, never `null`, per
284
+ * `ConversationSchema.archivedAt: Type.Optional(DateTimeString)`).
285
+ */
286
+ const pickReusableFromPage = (items, taskId) => {
287
+ const match = items.find((item) => item.taskId === taskId && item.conversation.archivedAt === undefined);
288
+ return match === undefined ? null : match.conversation;
289
+ };
290
+ const findReusableConversation = (taskId) => Effect.gen(function* () {
291
+ let cursor = undefined;
292
+ for (let page = 0; page < DEDUP_LOOKUP_MAX_PAGES; page++) {
293
+ const params = {
294
+ limit: DEDUP_LOOKUP_PAGE_SIZE,
295
+ };
296
+ if (cursor !== undefined)
297
+ params.cursor = cursor;
298
+ const result = yield* rpc(TaskConversationList, params);
299
+ const hit = pickReusableFromPage(result.items, taskId);
300
+ if (hit !== null)
301
+ return hit;
302
+ if (result.nextCursor === undefined)
303
+ return null;
304
+ cursor = result.nextCursor;
305
+ }
306
+ return null;
307
+ });
308
+ /**
309
+ * Spec D2 amendment N6 — dedup-hit branch. `TaskConversationList`
310
+ * wire failures are captured inline via `Effect.either` (same pattern
311
+ * + same reason as `sendFirstMessage`'s partial-success handling)
312
+ * because `TaskCreate` already succeeded server-side; routing the
313
+ * list error through `runStartCommand`'s `catchAll` would print
314
+ * `Failed: &lt;list-error>`, misleading the user into thinking the
315
+ * create failed.
316
+ */
317
+ const onReuseFound = (task, reuse, message) => Effect.zipRight(printTaskReused(task, reuse), Option.match(message, {
318
+ onNone: () => Effect.void,
319
+ onSome: (m) => sendFirstMessage(reuse.id, m),
320
+ }));
321
+ const onReuseNull = (task) => Effect.zipRight(printTaskAlreadyClosed(task.id), Effect.sync(() => {
322
+ process.exit(EXIT_CODES.TASK_CREATE_FAILED);
323
+ }));
324
+ const handleDedupOutcome = (task, message) => Effect.either(findReusableConversation(task.id)).pipe(Effect.flatMap(Either.match({
325
+ onLeft: (err) => Effect.sync(() => {
326
+ console.error(`Task ${task.id} already exists but reusable-conversation lookup failed: ${err.message}`);
327
+ process.exit(EXIT_CODES.TASK_CREATE_FAILED);
328
+ }),
329
+ onRight: (reuse) => reuse === null
330
+ ? onReuseNull(task)
331
+ : onReuseFound(task, reuse, message),
332
+ })));
333
+ // ─── Handler body ─────────────────────────────────────────────────────────
334
+ /**
335
+ * `moltzap start` handler. Four stages (see per-flow doc 09 §6):
336
+ *
337
+ * 1. Validate `args.appId` UUID v4 if set; else use `DEFAULT_APP_ID`.
338
+ * Failure -> `InvalidAppIdError` -> exit 64 via `runStartCommand`.
339
+ * 2. Resolve `args.participants` via `resolveAgentTokens` (single
340
+ * batched `AgentsLookupByName` RPC for name-shaped tokens;
341
+ * UUID-shaped tokens short-circuit). Any token failure ->
342
+ * `UnresolvedParticipantError` -> exit 64.
343
+ * 3. `rpc(TaskCreate, { appId, invitedAgentIds, initialConversation })`
344
+ * where `initialConversation` carries `participants` ONLY when
345
+ * `invitedAgentIds.length > 0` (P2-B). Two success outcomes:
346
+ * - `created`: server returned a fresh `conversation`. Print
347
+ * `Task started: &lt;taskId> (conversation: &lt;convId>)`.
348
+ * - `dedup`: server returned `conversation: null` because
349
+ * `{caller} ∪ invitedAgentIds` already owned a task on this
350
+ * appId (P2-A). Auto-fetch the most-recently-active non-
351
+ * archived conversation under the existing task via
352
+ * `findReusableConversation` and print
353
+ * `Task started: &lt;taskId> (reusing existing conversation: &lt;convId>)`.
354
+ * If no usable conversation exists (closed task, all archived,
355
+ * or out of dedup-lookup window), print
356
+ * `Task already exists but is closed: &lt;taskId>` to stderr and
357
+ * exit 1.
358
+ * `TaskCreate` wire failure -> `TransportError` -> exit 1 via
359
+ * `runStartCommand`, no stdout.
360
+ * 4. If `args.message` is set AND a conversation was produced (either
361
+ * kind), call `rpc(MessagesSend, { conversationId, parts: [{ type:
362
+ * "text", text }] })` wrapped in `Effect.either`. Success -> print
363
+ * `Message sent: &lt;msgId>`, exit 0. Failure -> print
364
+ * `Error sending message: &lt;err>` to stderr, exit 2 via inline
365
+ * `process.exit` (preserves the already-printed stdout line;
366
+ * cannot route through `runStartCommand`).
367
+ */
368
+ const startCommandHandler = (args) => Effect.gen(function* () {
369
+ const appId = yield* resolveAppId(args.appId);
370
+ const invitedAgentIds = yield* resolveAgentTokens(args.participants);
371
+ const outcome = yield* createTaskAtomic(appId, invitedAgentIds, args.name);
372
+ const messageOpt = Option.fromNullable(args.message);
373
+ if (outcome.kind === "dedup") {
374
+ yield* handleDedupOutcome(outcome.task, messageOpt);
375
+ return;
376
+ }
377
+ yield* printTaskCreated(outcome.task, outcome.conversation);
378
+ yield* Option.match(messageOpt, {
379
+ onNone: () => Effect.void,
380
+ onSome: (m) => sendFirstMessage(outcome.conversation.id, m),
381
+ });
382
+ }).pipe(Effect.withSpan("startCommandHandler"));
383
+ // ─── Exit-code dispatcher ─────────────────────────────────────────────────
384
+ /**
385
+ * Outer adapter that replaces the shared `transport.ts -> runHandler`
386
+ * (which collapses every error to exit 1) with a `_tag`-aware mapping
387
+ * per the spec D2 exit-code contract:
388
+ *
389
+ * `InvalidAppIdError` -> 64 + stderr `Invalid --app-id: not a UUID`
390
+ * `UnresolvedParticipantError` -> 64 + stderr `Cannot resolve "&lt;token>": &lt;reason>`
391
+ * `TooManyParticipantNamesError` -> 64 + stderr `Too many distinct agent names: &lt;count> (max &lt;max>)`
392
+ * any other `StartCommandError` -> 1 + stderr `Failed: &lt;err.message>`
393
+ *
394
+ * The exit-2 partial-success branch runs inline inside
395
+ * `startCommandHandler` (after `Task started:` has been printed to
396
+ * stdout) and never reaches this adapter — re-throwing the post-
397
+ * `TaskCreate` error here would discard the already-printed stdout
398
+ * line.
399
+ */
400
+ const runStartCommand = (effect) => effect.pipe(Effect.catchTag("InvalidAppIdError", () => Effect.sync(() => {
401
+ console.error("Invalid --app-id: not a UUID");
402
+ process.exit(EXIT_CODES.USAGE_ERROR);
403
+ })), Effect.catchTag("UnresolvedParticipantError", (err) => Effect.sync(() => {
404
+ console.error(`Cannot resolve "${err.token}": ${err.reason}`);
405
+ process.exit(EXIT_CODES.USAGE_ERROR);
406
+ })), Effect.catchTag("TooManyParticipantNamesError", (err) => Effect.sync(() => {
407
+ console.error(`Too many distinct agent names: ${err.count} (max ${err.max})`);
408
+ process.exit(EXIT_CODES.USAGE_ERROR);
409
+ })), Effect.catchAll((err) => Effect.sync(() => {
410
+ // `Data.TaggedError` populates `message` for every tagged-error
411
+ // subclass; `|| err._tag` is a belt-and-suspenders fallback for
412
+ // the (impossible-per-Data-contract) empty-message case.
413
+ const msg = err.message || err._tag;
414
+ console.error(`Failed: ${msg}`);
415
+ process.exit(EXIT_CODES.TASK_CREATE_FAILED);
416
+ })));
417
+ // ─── @effect/cli wiring ───────────────────────────────────────────────────
418
+ const nameArg = Args.text({ name: "name" }).pipe(Args.withDescription("Conversation name"));
419
+ const participantsArg = Args.text({ name: "participant" }).pipe(Args.withDescription("Participant token (e.g. agent:bob or agent:<uuid>). " +
420
+ "Zero or more allowed; D2 ACs cover 1 (DM-shape) and >=2 (group-shape)."), Args.repeated);
421
+ const messageOption = Options.text("message").pipe(Options.withDescription("First message body. If supplied, MessagesSend runs after the atomic " +
422
+ "TaskCreate (separate RPC, not server-atomic)."), Options.optional);
423
+ const appIdOption = Options.text("app-id").pipe(Options.withDescription("App UUID v4. Defaults to DEFAULT_APP_ID (D1 #635). Invalid syntax " +
424
+ "exits 64 with NO RPC calls (Goal 7)."), Options.optional);
425
+ /**
426
+ * Test seam: invoke the handler directly with parsed args, bypassing
427
+ * `@effect/cli`'s parser. Returns the same `Effect` the `Command.make`
428
+ * wrapper would produce, including the `runStartCommand` exit-code
429
+ * dispatcher. Tests `Effect.provideService(Transport, fake)` and assert
430
+ * `process.exit` was called with the expected code.
431
+ */
432
+ export const runStartHandler = (args) => runStartCommand(startCommandHandler(args));
433
+ export const startCommand = Command.make("start", {
434
+ name: nameArg,
435
+ participants: participantsArg,
436
+ message: messageOption,
437
+ appId: appIdOption,
438
+ }, ({ name, participants, message, appId }) => runStartHandler({
439
+ name,
440
+ participants,
441
+ message: Option.getOrUndefined(message),
442
+ appId: Option.getOrUndefined(appId),
443
+ })).pipe(Command.withDescription("Start a task with named participants and (optionally) send the " +
444
+ "first message in one atomic step. Spec D2 #599 — composes Spec D1 " +
445
+ "TaskCreate + MessagesSend.\n" +
446
+ "\n" +
447
+ "Zero participants creates a caller-only task (rare; usually you " +
448
+ "will pass one or more `agent:<name>` tokens).\n" +
449
+ "\n" +
450
+ "Exit codes:\n" +
451
+ ` ${EXIT_CODES.SUCCESS} success (TaskCreate + optional MessagesSend resolved)\n` +
452
+ ` ${EXIT_CODES.TASK_CREATE_FAILED} TaskCreate failed (stdout empty)\n` +
453
+ ` ${EXIT_CODES.PARTIAL_SUCCESS} TaskCreate OK, MessagesSend failed (no rollback)\n` +
454
+ ` ${EXIT_CODES.USAGE_ERROR} usage error (bad --app-id UUID, unresolvable agent token, or >${MAX_NAME_LOOKUP_BATCH} distinct name-shaped tokens)`));
455
+ //# sourceMappingURL=start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/cli/commands/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,UAAU,GAOX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAuC,MAAM,iBAAiB,CAAC;AAE3E,6EAA6E;AAE7E;;;;;GAKG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,CAAC;IACV,kBAAkB,EAAE,CAAC;IACrB,eAAe,EAAE,CAAC;IAClB,WAAW,EAAE,EAAE;C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AO,EAAE,aAAa;IACtB,KAAK,EAAE,WAAW;CACnB,EACD,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CACzC,eAAe,CAAC;IACd,IAAI;IACJ,YAAY;IACZ,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;CACpC,CAAC,CACL,CAAC,IAAI,CACJ,OAAO,CAAC,eAAe,CACrB,iEAAiE;IAC/D,oEAAoE;IACpE,8BAA8B;IAC9B,IAAI;IACJ,kEAAkE;IAClE,iDAAiD;IACjD,IAAI;IACJ,eAAe;IACf,KAAK,UAAU,CAAC,OAAO,4DAA4D;IACnF,KAAK,UAAU,CAAC,kBAAkB,uCAAuC;IACzE,KAAK,UAAU,CAAC,eAAe,uDAAuD;IACtF,KAAK,UAAU,CAAC,WAAW,mEAAmE,qBAAqB,+BAA+B,CACrJ,CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=start.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/start.test.ts"],"names":[],"mappings":""}