@moltzap/client 2026.520.1 → 2026.523.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-client.d.ts +66 -0
- package/dist/agent-client.d.ts.map +1 -0
- package/dist/agent-client.js +287 -0
- package/dist/agent-client.js.map +1 -0
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +1 -1
- package/dist/channel-core-context.test.js +16 -8
- package/dist/channel-core-context.test.js.map +1 -1
- package/dist/channel-core-dispatch.test.js +17 -10
- package/dist/channel-core-dispatch.test.js.map +1 -1
- package/dist/channel-core-enrichment.d.ts +2 -1
- package/dist/channel-core-enrichment.d.ts.map +1 -1
- package/dist/channel-core-enrichment.js +4 -2
- package/dist/channel-core-enrichment.js.map +1 -1
- package/dist/channel-core-test-support.d.ts +5 -3
- package/dist/channel-core-test-support.d.ts.map +1 -1
- package/dist/channel-core-test-support.js +6 -4
- package/dist/channel-core-test-support.js.map +1 -1
- package/dist/channel-core.d.ts +18 -13
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +11 -10
- package/dist/channel-core.js.map +1 -1
- package/dist/cli/commands/conversations.d.ts +15 -63
- package/dist/cli/commands/conversations.d.ts.map +1 -1
- package/dist/cli/commands/conversations.js +26 -167
- package/dist/cli/commands/conversations.js.map +1 -1
- package/dist/cli/commands/messages.d.ts +5 -2
- package/dist/cli/commands/messages.d.ts.map +1 -1
- package/dist/cli/commands/messages.js +10 -5
- package/dist/cli/commands/messages.js.map +1 -1
- package/dist/cli/commands/messages.test.js +6 -1
- package/dist/cli/commands/messages.test.js.map +1 -1
- package/dist/cli/commands/send.d.ts +6 -37
- package/dist/cli/commands/send.d.ts.map +1 -1
- package/dist/cli/commands/send.js +35 -57
- package/dist/cli/commands/send.js.map +1 -1
- package/dist/cli/commands/send.test.js +14 -19
- package/dist/cli/commands/send.test.js.map +1 -1
- package/dist/cli/commands/start.d.ts +58 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +456 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/start.test.d.ts +2 -0
- package/dist/cli/commands/start.test.d.ts.map +1 -0
- package/dist/cli/commands/start.test.js +624 -0
- package/dist/cli/commands/start.test.js.map +1 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/socket-client.d.ts +0 -17
- package/dist/cli/socket-client.d.ts.map +1 -1
- package/dist/cli/socket-client.js +1 -39
- package/dist/cli/socket-client.js.map +1 -1
- package/dist/cli/transport.d.ts.map +1 -1
- package/dist/cli/transport.js +33 -6
- package/dist/cli/transport.js.map +1 -1
- package/dist/cli/transport.test.js +31 -12
- package/dist/cli/transport.test.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/notification/__tests__/snapshot-semantics.types-check.js +1 -1
- package/dist/notification/stream.d.ts +3 -3
- package/dist/notification/stream.js +3 -3
- package/dist/runtime/close-info.d.ts +2 -2
- package/dist/runtime/close-info.js +1 -1
- package/dist/runtime/frame.test.js +4 -2
- package/dist/runtime/frame.test.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/local-history.d.ts +1 -1
- package/dist/runtime/local-history.d.ts.map +1 -1
- package/dist/runtime/local-history.js +1 -1
- package/dist/runtime/local-history.js.map +1 -1
- package/dist/runtime/subscribers.d.ts +3 -3
- package/dist/runtime/subscribers.js +2 -2
- package/dist/service-archive-purge.d.ts +17 -0
- package/dist/service-archive-purge.d.ts.map +1 -0
- package/dist/service-archive-purge.js +32 -0
- package/dist/service-archive-purge.js.map +1 -0
- package/dist/service.d.ts +15 -19
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +79 -100
- package/dist/service.js.map +1 -1
- package/dist/service.test.js +50 -26
- package/dist/service.test.js.map +1 -1
- package/dist/test/index.d.ts +4 -4
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4 -4
- package/dist/test/index.js.map +1 -1
- package/dist/test-utils/channel-service-fixture.d.ts +2 -1
- package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
- package/dist/test-utils/channel-service-fixture.js +11 -6
- package/dist/test-utils/channel-service-fixture.js.map +1 -1
- package/dist/test-utils/conformance-adapter.d.ts +3 -3
- package/dist/test-utils/conformance-adapter.js +7 -7
- package/dist/test-utils/conformance-adapter.js.map +1 -1
- package/dist/test-utils/ids.d.ts +3 -1
- package/dist/test-utils/ids.d.ts.map +1 -1
- package/dist/test-utils/ids.js +3 -1
- package/dist/test-utils/ids.js.map +1 -1
- package/dist/test-utils/index.d.ts +1 -1
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/{ws-client-test-support.d.ts → tm-client-test-support.d.ts} +14 -13
- package/dist/tm-client-test-support.d.ts.map +1 -0
- package/dist/{ws-client-test-support.js → tm-client-test-support.js} +51 -18
- package/dist/tm-client-test-support.js.map +1 -0
- package/dist/{ws-client.d.ts → tm-client.d.ts} +14 -19
- package/dist/tm-client.d.ts.map +1 -0
- package/dist/{ws-client.js → tm-client.js} +10 -24
- package/dist/tm-client.js.map +1 -0
- package/dist/tm-client.test.d.ts +2 -0
- package/dist/tm-client.test.d.ts.map +1 -0
- package/dist/{ws-client.test.js → tm-client.test.js} +41 -29
- package/dist/tm-client.test.js.map +1 -0
- package/package.json +4 -3
- package/dist/cli/commands/conversations-v2.test.d.ts +0 -2
- package/dist/cli/commands/conversations-v2.test.d.ts.map +0 -1
- package/dist/cli/commands/conversations-v2.test.js +0 -107
- package/dist/cli/commands/conversations-v2.test.js.map +0 -1
- package/dist/ws-client-test-support.d.ts.map +0 -1
- package/dist/ws-client-test-support.js.map +0 -1
- package/dist/ws-client.d.ts.map +0 -1
- package/dist/ws-client.js.map +0 -1
- package/dist/ws-client.test.d.ts +0 -2
- package/dist/ws-client.test.d.ts.map +0 -1
- package/dist/ws-client.test.js.map +0 -1
|
@@ -0,0 +1,456 @@
|
|
|
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
|
+
* `TaskRequest({ 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 -> TaskRequest` / `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 `TaskRequest` /
|
|
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, TaskRequest, } 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 <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:<name>` or `agent:<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 (TaskRequest / 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
|
+
* `TaskRequest.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:<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 = (taskId, conversationId, text) => Effect.either(rpc(MessagesSend, {
|
|
210
|
+
taskId,
|
|
211
|
+
conversationId,
|
|
212
|
+
parts: [{ type: "text", text }],
|
|
213
|
+
})).pipe(Effect.flatMap(Either.match({
|
|
214
|
+
onLeft: (err) => Effect.sync(() => {
|
|
215
|
+
console.error(`Error sending message: ${err.message}`);
|
|
216
|
+
process.exit(EXIT_CODES.PARTIAL_SUCCESS);
|
|
217
|
+
}),
|
|
218
|
+
onRight: (ok) => printMessageSent(ok.message.id),
|
|
219
|
+
})));
|
|
220
|
+
const createTaskAtomic = (appId, invitedAgentIds, name) => Effect.gen(function* () {
|
|
221
|
+
// Defensive copies: TaskRequest's params type expects mutable arrays
|
|
222
|
+
// (TypeBox's Static<Array> resolves to T[], not readonly T[]); pass
|
|
223
|
+
// shallow clones so the caller's readonly contract isn't bypassed.
|
|
224
|
+
//
|
|
225
|
+
// Spec D2 (#599) amendment N7 (zero-participant carve-out):
|
|
226
|
+
// `InitialConversationSchema.participants` is `Type.Optional(Type.Array(AgentId,
|
|
227
|
+
// { minItems: 1 }))` — an EMPTY array fails server AJV. The
|
|
228
|
+
// caller-only path (help text + plan §R4 + `start.test.ts →
|
|
229
|
+
// zeroParticipants`) MUST omit `participants` entirely; the server
|
|
230
|
+
// adds the caller to `conversation_participants` implicitly. See
|
|
231
|
+
// `packages/protocol/src/task/tasks.ts → InitialConversationSchema`.
|
|
232
|
+
const initialConversation = invitedAgentIds.length === 0
|
|
233
|
+
? { name }
|
|
234
|
+
: { name, participants: [...invitedAgentIds] };
|
|
235
|
+
const result = yield* rpc(TaskRequest, {
|
|
236
|
+
appId,
|
|
237
|
+
invitedAgentIds: [...invitedAgentIds],
|
|
238
|
+
initialConversation,
|
|
239
|
+
});
|
|
240
|
+
if (result.conversation === null) {
|
|
241
|
+
// Dedup hit (per `tasks.handlers.ts → maybeTaskCreateDedup`): the
|
|
242
|
+
// server matched an existing task by `{caller} ∪ invitedAgentIds`
|
|
243
|
+
// and returned it with `conversation: null`. Handler resolves a
|
|
244
|
+
// reusable conversation via `findReusableConversation` instead of
|
|
245
|
+
// failing.
|
|
246
|
+
return { kind: "dedup", task: result.task };
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
kind: "created",
|
|
250
|
+
task: result.task,
|
|
251
|
+
conversation: result.conversation,
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
// ─── Dedup-hit conversation lookup (spec D2 amendment N6) ─────────────────
|
|
255
|
+
/**
|
|
256
|
+
* Page size + safety cap on `TaskConversationList` follow-up calls. The
|
|
257
|
+
* dedup-hit conversation should appear in the first page for any
|
|
258
|
+
* recently-touched task (server orders by activity desc, see
|
|
259
|
+
* `packages/server/src/task/services/conversation/list-pagination.ts →
|
|
260
|
+
* queryConversationListRows`). The cap protects against pathological
|
|
261
|
+
* cases where the caller has a very long list and the target task is
|
|
262
|
+
* older than the window can see — in which case we surface the closed-
|
|
263
|
+
* task diagnostic rather than spin indefinitely.
|
|
264
|
+
*/
|
|
265
|
+
const DEDUP_LOOKUP_PAGE_SIZE = 100;
|
|
266
|
+
const DEDUP_LOOKUP_MAX_PAGES = 10;
|
|
267
|
+
/**
|
|
268
|
+
* P2-A (spec D2 amendment N6) — locate a reusable conversation under a
|
|
269
|
+
* dedup-hit task. Tie-break rule: "first match in server iteration
|
|
270
|
+
* order" — server sorts by activity desc, so this is equivalent to
|
|
271
|
+
* most-recently-active. WHY a small page-count cap: a freshly-touched
|
|
272
|
+
* dedup-hit task lives near the top of the activity-sorted list; the
|
|
273
|
+
* 1000-row ceiling protects against pathological lists where the
|
|
274
|
+
* target is older than the lookup window can see (the closed-task
|
|
275
|
+
* diagnostic is the correct fallback per spec D2 amendment N6).
|
|
276
|
+
*/
|
|
277
|
+
/**
|
|
278
|
+
* Filter rule for the dedup-hit lookup: (a) the item's `taskId` must
|
|
279
|
+
* match the existing task we are reusing (the list is caller-scoped
|
|
280
|
+
* across ALL of the caller's tasks, not task-scoped); (b) the
|
|
281
|
+
* conversation must be non-archived (server includes archived rows
|
|
282
|
+
* unfiltered per `TaskConversationList`'s contract — clients filter
|
|
283
|
+
* `archivedAt !== undefined` locally; archived strings are absent
|
|
284
|
+
* on the wire when the row is active, never `null`, per
|
|
285
|
+
* `ConversationSchema.archivedAt: Type.Optional(DateTimeString)`).
|
|
286
|
+
*/
|
|
287
|
+
const pickReusableFromPage = (items, taskId) => {
|
|
288
|
+
const match = items.find((item) => item.taskId === taskId && item.conversation.archivedAt === undefined);
|
|
289
|
+
return match === undefined ? null : match.conversation;
|
|
290
|
+
};
|
|
291
|
+
const findReusableConversation = (taskId) => Effect.gen(function* () {
|
|
292
|
+
let cursor = undefined;
|
|
293
|
+
for (let page = 0; page < DEDUP_LOOKUP_MAX_PAGES; page++) {
|
|
294
|
+
const params = {
|
|
295
|
+
limit: DEDUP_LOOKUP_PAGE_SIZE,
|
|
296
|
+
};
|
|
297
|
+
if (cursor !== undefined)
|
|
298
|
+
params.cursor = cursor;
|
|
299
|
+
const result = yield* rpc(TaskConversationList, params);
|
|
300
|
+
const hit = pickReusableFromPage(result.items, taskId);
|
|
301
|
+
if (hit !== null)
|
|
302
|
+
return hit;
|
|
303
|
+
if (result.nextCursor === undefined)
|
|
304
|
+
return null;
|
|
305
|
+
cursor = result.nextCursor;
|
|
306
|
+
}
|
|
307
|
+
return null;
|
|
308
|
+
});
|
|
309
|
+
/**
|
|
310
|
+
* Spec D2 amendment N6 — dedup-hit branch. `TaskConversationList`
|
|
311
|
+
* wire failures are captured inline via `Effect.either` (same pattern
|
|
312
|
+
* + same reason as `sendFirstMessage`'s partial-success handling)
|
|
313
|
+
* because `TaskRequest` already succeeded server-side; routing the
|
|
314
|
+
* list error through `runStartCommand`'s `catchAll` would print
|
|
315
|
+
* `Failed: <list-error>`, misleading the user into thinking the
|
|
316
|
+
* create failed.
|
|
317
|
+
*/
|
|
318
|
+
const onReuseFound = (task, reuse, message) => Effect.zipRight(printTaskReused(task, reuse), Option.match(message, {
|
|
319
|
+
onNone: () => Effect.void,
|
|
320
|
+
onSome: (m) => sendFirstMessage(task.id, reuse.id, m),
|
|
321
|
+
}));
|
|
322
|
+
const onReuseNull = (task) => Effect.zipRight(printTaskAlreadyClosed(task.id), Effect.sync(() => {
|
|
323
|
+
process.exit(EXIT_CODES.TASK_CREATE_FAILED);
|
|
324
|
+
}));
|
|
325
|
+
const handleDedupOutcome = (task, message) => Effect.either(findReusableConversation(task.id)).pipe(Effect.flatMap(Either.match({
|
|
326
|
+
onLeft: (err) => Effect.sync(() => {
|
|
327
|
+
console.error(`Task ${task.id} already exists but reusable-conversation lookup failed: ${err.message}`);
|
|
328
|
+
process.exit(EXIT_CODES.TASK_CREATE_FAILED);
|
|
329
|
+
}),
|
|
330
|
+
onRight: (reuse) => reuse === null
|
|
331
|
+
? onReuseNull(task)
|
|
332
|
+
: onReuseFound(task, reuse, message),
|
|
333
|
+
})));
|
|
334
|
+
// ─── Handler body ─────────────────────────────────────────────────────────
|
|
335
|
+
/**
|
|
336
|
+
* `moltzap start` handler. Four stages (see per-flow doc 09 §6):
|
|
337
|
+
*
|
|
338
|
+
* 1. Validate `args.appId` UUID v4 if set; else use `DEFAULT_APP_ID`.
|
|
339
|
+
* Failure -> `InvalidAppIdError` -> exit 64 via `runStartCommand`.
|
|
340
|
+
* 2. Resolve `args.participants` via `resolveAgentTokens` (single
|
|
341
|
+
* batched `AgentsLookupByName` RPC for name-shaped tokens;
|
|
342
|
+
* UUID-shaped tokens short-circuit). Any token failure ->
|
|
343
|
+
* `UnresolvedParticipantError` -> exit 64.
|
|
344
|
+
* 3. `rpc(TaskRequest, { appId, invitedAgentIds, initialConversation })`
|
|
345
|
+
* where `initialConversation` carries `participants` ONLY when
|
|
346
|
+
* `invitedAgentIds.length > 0` (P2-B). Two success outcomes:
|
|
347
|
+
* - `created`: server returned a fresh `conversation`. Print
|
|
348
|
+
* `Task started: <taskId> (conversation: <convId>)`.
|
|
349
|
+
* - `dedup`: server returned `conversation: null` because
|
|
350
|
+
* `{caller} ∪ invitedAgentIds` already owned a task on this
|
|
351
|
+
* appId (P2-A). Auto-fetch the most-recently-active non-
|
|
352
|
+
* archived conversation under the existing task via
|
|
353
|
+
* `findReusableConversation` and print
|
|
354
|
+
* `Task started: <taskId> (reusing existing conversation: <convId>)`.
|
|
355
|
+
* If no usable conversation exists (closed task, all archived,
|
|
356
|
+
* or out of dedup-lookup window), print
|
|
357
|
+
* `Task already exists but is closed: <taskId>` to stderr and
|
|
358
|
+
* exit 1.
|
|
359
|
+
* `TaskRequest` wire failure -> `TransportError` -> exit 1 via
|
|
360
|
+
* `runStartCommand`, no stdout.
|
|
361
|
+
* 4. If `args.message` is set AND a conversation was produced (either
|
|
362
|
+
* kind), call `rpc(MessagesSend, { conversationId, parts: [{ type:
|
|
363
|
+
* "text", text }] })` wrapped in `Effect.either`. Success -> print
|
|
364
|
+
* `Message sent: <msgId>`, exit 0. Failure -> print
|
|
365
|
+
* `Error sending message: <err>` to stderr, exit 2 via inline
|
|
366
|
+
* `process.exit` (preserves the already-printed stdout line;
|
|
367
|
+
* cannot route through `runStartCommand`).
|
|
368
|
+
*/
|
|
369
|
+
const startCommandHandler = (args) => Effect.gen(function* () {
|
|
370
|
+
const appId = yield* resolveAppId(args.appId);
|
|
371
|
+
const invitedAgentIds = yield* resolveAgentTokens(args.participants);
|
|
372
|
+
const outcome = yield* createTaskAtomic(appId, invitedAgentIds, args.name);
|
|
373
|
+
const messageOpt = Option.fromNullable(args.message);
|
|
374
|
+
if (outcome.kind === "dedup") {
|
|
375
|
+
yield* handleDedupOutcome(outcome.task, messageOpt);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
yield* printTaskCreated(outcome.task, outcome.conversation);
|
|
379
|
+
yield* Option.match(messageOpt, {
|
|
380
|
+
onNone: () => Effect.void,
|
|
381
|
+
onSome: (m) => sendFirstMessage(outcome.task.id, outcome.conversation.id, m),
|
|
382
|
+
});
|
|
383
|
+
}).pipe(Effect.withSpan("startCommandHandler"));
|
|
384
|
+
// ─── Exit-code dispatcher ─────────────────────────────────────────────────
|
|
385
|
+
/**
|
|
386
|
+
* Outer adapter that replaces the shared `transport.ts -> runHandler`
|
|
387
|
+
* (which collapses every error to exit 1) with a `_tag`-aware mapping
|
|
388
|
+
* per the spec D2 exit-code contract:
|
|
389
|
+
*
|
|
390
|
+
* `InvalidAppIdError` -> 64 + stderr `Invalid --app-id: not a UUID`
|
|
391
|
+
* `UnresolvedParticipantError` -> 64 + stderr `Cannot resolve "<token>": <reason>`
|
|
392
|
+
* `TooManyParticipantNamesError` -> 64 + stderr `Too many distinct agent names: <count> (max <max>)`
|
|
393
|
+
* any other `StartCommandError` -> 1 + stderr `Failed: <err.message>`
|
|
394
|
+
*
|
|
395
|
+
* The exit-2 partial-success branch runs inline inside
|
|
396
|
+
* `startCommandHandler` (after `Task started:` has been printed to
|
|
397
|
+
* stdout) and never reaches this adapter — re-throwing the post-
|
|
398
|
+
* `TaskRequest` error here would discard the already-printed stdout
|
|
399
|
+
* line.
|
|
400
|
+
*/
|
|
401
|
+
const runStartCommand = (effect) => effect.pipe(Effect.catchTag("InvalidAppIdError", () => Effect.sync(() => {
|
|
402
|
+
console.error("Invalid --app-id: not a UUID");
|
|
403
|
+
process.exit(EXIT_CODES.USAGE_ERROR);
|
|
404
|
+
})), Effect.catchTag("UnresolvedParticipantError", (err) => Effect.sync(() => {
|
|
405
|
+
console.error(`Cannot resolve "${err.token}": ${err.reason}`);
|
|
406
|
+
process.exit(EXIT_CODES.USAGE_ERROR);
|
|
407
|
+
})), Effect.catchTag("TooManyParticipantNamesError", (err) => Effect.sync(() => {
|
|
408
|
+
console.error(`Too many distinct agent names: ${err.count} (max ${err.max})`);
|
|
409
|
+
process.exit(EXIT_CODES.USAGE_ERROR);
|
|
410
|
+
})), Effect.catchAll((err) => Effect.sync(() => {
|
|
411
|
+
// `Data.TaggedError` populates `message` for every tagged-error
|
|
412
|
+
// subclass; `|| err._tag` is a belt-and-suspenders fallback for
|
|
413
|
+
// the (impossible-per-Data-contract) empty-message case.
|
|
414
|
+
const msg = err.message || err._tag;
|
|
415
|
+
console.error(`Failed: ${msg}`);
|
|
416
|
+
process.exit(EXIT_CODES.TASK_CREATE_FAILED);
|
|
417
|
+
})));
|
|
418
|
+
// ─── @effect/cli wiring ───────────────────────────────────────────────────
|
|
419
|
+
const nameArg = Args.text({ name: "name" }).pipe(Args.withDescription("Conversation name"));
|
|
420
|
+
const participantsArg = Args.text({ name: "participant" }).pipe(Args.withDescription("Participant token (e.g. agent:bob or agent:<uuid>). " +
|
|
421
|
+
"Zero or more allowed; D2 ACs cover 1 (DM-shape) and >=2 (group-shape)."), Args.repeated);
|
|
422
|
+
const messageOption = Options.text("message").pipe(Options.withDescription("First message body. If supplied, MessagesSend runs after the atomic " +
|
|
423
|
+
"TaskRequest (separate RPC, not server-atomic)."), Options.optional);
|
|
424
|
+
const appIdOption = Options.text("app-id").pipe(Options.withDescription("App UUID v4. Defaults to DEFAULT_APP_ID (D1 #635). Invalid syntax " +
|
|
425
|
+
"exits 64 with NO RPC calls (Goal 7)."), Options.optional);
|
|
426
|
+
/**
|
|
427
|
+
* Test seam: invoke the handler directly with parsed args, bypassing
|
|
428
|
+
* `@effect/cli`'s parser. Returns the same `Effect` the `Command.make`
|
|
429
|
+
* wrapper would produce, including the `runStartCommand` exit-code
|
|
430
|
+
* dispatcher. Tests `Effect.provideService(Transport, fake)` and assert
|
|
431
|
+
* `process.exit` was called with the expected code.
|
|
432
|
+
*/
|
|
433
|
+
export const runStartHandler = (args) => runStartCommand(startCommandHandler(args));
|
|
434
|
+
export const startCommand = Command.make("start", {
|
|
435
|
+
name: nameArg,
|
|
436
|
+
participants: participantsArg,
|
|
437
|
+
message: messageOption,
|
|
438
|
+
appId: appIdOption,
|
|
439
|
+
}, ({ name, participants, message, appId }) => runStartHandler({
|
|
440
|
+
name,
|
|
441
|
+
participants,
|
|
442
|
+
message: Option.getOrUndefined(message),
|
|
443
|
+
appId: Option.getOrUndefined(appId),
|
|
444
|
+
})).pipe(Command.withDescription("Start a task with named participants and (optionally) send the " +
|
|
445
|
+
"first message in one atomic step. Spec D2 #599 — composes Spec D1 " +
|
|
446
|
+
"TaskRequest + MessagesSend.\n" +
|
|
447
|
+
"\n" +
|
|
448
|
+
"Zero participants creates a caller-only task (rare; usually you " +
|
|
449
|
+
"will pass one or more `agent:<name>` tokens).\n" +
|
|
450
|
+
"\n" +
|
|
451
|
+
"Exit codes:\n" +
|
|
452
|
+
` ${EXIT_CODES.SUCCESS} success (TaskRequest + optional MessagesSend resolved)\n` +
|
|
453
|
+
` ${EXIT_CODES.TASK_CREATE_FAILED} TaskRequest failed (stdout empty)\n` +
|
|
454
|
+
` ${EXIT_CODES.PARTIAL_SUCCESS} TaskRequest OK, MessagesSend failed (no rollback)\n` +
|
|
455
|
+
` ${EXIT_CODES.USAGE_ERROR} usage error (bad --app-id UUID, unresolvable agent token, or >${MAX_NAME_LOOKUP_BATCH} distinct name-shaped tokens)`));
|
|
456
|
+
//# 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,WAAW,GAOZ,MAAM,mBAAmB,CAAC;AAE3B,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