@oh-hai/cli 0.3.1 → 0.4.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +17 -10
  3. package/dist/commands/ask.js +8 -4
  4. package/dist/commands/ask.js.map +1 -1
  5. package/dist/commands/bridge.js +1 -1
  6. package/dist/commands/bridge.js.map +1 -1
  7. package/dist/commands/messaging/build.d.ts +5 -4
  8. package/dist/commands/messaging/build.js +52 -47
  9. package/dist/commands/messaging/build.js.map +1 -1
  10. package/dist/commands/messaging/capability.d.ts +39 -1
  11. package/dist/commands/messaging/capability.js.map +1 -1
  12. package/dist/commands/messaging/http.d.ts +29 -9
  13. package/dist/commands/messaging/http.js +159 -191
  14. package/dist/commands/messaging/http.js.map +1 -1
  15. package/dist/commands/messaging/inbox-entries.d.ts +13 -6
  16. package/dist/commands/messaging/inbox-entries.js +99 -119
  17. package/dist/commands/messaging/inbox-entries.js.map +1 -1
  18. package/dist/commands/messaging/inbox-stream.d.ts +2 -1
  19. package/dist/commands/messaging/inbox-stream.js.map +1 -1
  20. package/dist/commands/messaging/session-drain.d.ts +11 -1
  21. package/dist/commands/messaging/session-drain.js +28 -10
  22. package/dist/commands/messaging/session-drain.js.map +1 -1
  23. package/dist/commands/messaging/validate.d.ts +37 -9
  24. package/dist/commands/messaging/validate.js +49 -19
  25. package/dist/commands/messaging/validate.js.map +1 -1
  26. package/dist/commands/messaging/wire.d.ts +22 -307
  27. package/dist/commands/messaging/wire.js +10 -13
  28. package/dist/commands/messaging/wire.js.map +1 -1
  29. package/dist/commands/notify.js +5 -4
  30. package/dist/commands/notify.js.map +1 -1
  31. package/dist/commands/registry.js +6 -4
  32. package/dist/commands/registry.js.map +1 -1
  33. package/dist/commands/self-test.js +27 -22
  34. package/dist/commands/self-test.js.map +1 -1
  35. package/dist/commands/task.js +8 -4
  36. package/dist/commands/task.js.map +1 -1
  37. package/dist/version.d.ts +16 -2
  38. package/dist/version.js +17 -2
  39. package/dist/version.js.map +1 -1
  40. package/package.json +2 -2
@@ -1,6 +1,13 @@
1
+ import { type HubTouchpoint } from "@oh-hai/ma2h-core/errors";
1
2
  import { CliError } from "../../envelope.js";
2
3
  import type { CommandContext } from "../context.js";
3
- import type { GetMessageBody, InboundDelivery, InboxAckResult, SubmitAck } from "./wire.js";
4
+ import type { GetMessageBody, InboundDelivery, SubmitAck } from "./wire.js";
5
+ /** POST /v1/inbox/ack — the ids of the directives consumed by this call (spec §14; the server's
6
+ * `ackDirectives` returns the id array, not a count). A TRANSPORT wrapper shape of this Hub's
7
+ * ack route, which is why it lives beside the parser that reads it rather than in the wire shim. */
8
+ export interface InboxAckResult {
9
+ acked: string[];
10
+ }
4
11
  /** The per-request bound for a single Hub call: `config.timeoutMs` (from `--timeout` /
5
12
  * `MA2H_TIMEOUT_MS`, §6), defaulted and clamped to the timer ceiling so an oversized/negative value
6
13
  * can't overflow `AbortSignal.timeout` and fail the request spuriously. */
@@ -15,12 +22,26 @@ export declare function submitEnvelope(ctx: CommandContext, token: string, envel
15
22
  addressedTo?: string;
16
23
  }): Promise<SubmitAck>;
17
24
  /** GET one message (the submitter-bound pull, agent bearer). Embeds the terminal Response.
18
- * A `2xx` returns the parsed body; every other status maps to a §7 exit code. */
25
+ * A `2xx` returns the parsed body; every other status maps to a §7 exit code.
26
+ *
27
+ * The poll checks are the layer's `validatePollStatus`: the id echo-match, the status drawn from
28
+ * the polled type's own table (human-inbox notify: `delivered`; ADDRESSED notify: the §14.2
29
+ * delivery track; ask/task: their §7 resolution track), and terminal-requires-Response. The
30
+ * layer's `PollExpectation` wants the SUBMIT-side context, which a by-id read does not have — so
31
+ * this adapter derives it from the body itself (`type` from `body.type`, `addressed` from
32
+ * `body.to !== undefined`): body-derived SELF-CONSISTENCY, deliberately weaker than submit-side
33
+ * knowledge. The await layers keep their own wrong-kind fail-fast on `body.type` (product §4.4
34
+ * behavior — a copied notify id must say "not an ask", not "malformed body"). */
19
35
  export declare function pollMessage(ctx: CommandContext, token: string, id: string, timeoutMs: number): Promise<GetMessageBody>;
20
36
  /** GET the agent's mailbox — the human→agent drain (spec §13, agent bearer). A `2xx` returns the
21
37
  * signed deliveries; every other status maps to a §7 exit code. `max`, when set, caps the batch via
22
38
  * `?max=`. The drain also touches `agent_seen` server-side, so an authenticated poll is itself the
23
- * presence heartbeat (§15) — nothing extra to send. */
39
+ * presence heartbeat (§15) — nothing extra to send.
40
+ *
41
+ * The `{ directives: [...] }` wrapper is this Hub's v0.4 transport shape, parsed here; the
42
+ * unwrapped array goes to the layer's whole-batch shape guard (`validateDrainBatch` — one
43
+ * malformed row refuses the ENTIRE batch, because consuming the well-formed rows of a garbled
44
+ * body would ack mail out of a response the Hub demonstrably mangled). */
24
45
  export declare function drainInbox(ctx: CommandContext, token: string, max?: number): Promise<{
25
46
  directives: InboundDelivery[];
26
47
  }>;
@@ -41,9 +62,8 @@ export declare function listMessages(ctx: CommandContext, token: string, opts: {
41
62
  /** POST a single batched consume-ack for the drained ids — the §14 directive receipt (agent bearer).
42
63
  * A `2xx` returns the consumed count; every other status maps to a §7 exit code. */
43
64
  export declare function ackInbox(ctx: CommandContext, token: string, ids: string[]): Promise<InboxAckResult>;
44
- /** Map a Hub error response to a CliError. The exit code comes from the HTTP status; the stable
45
- * `error.code` string (§8) prefers the Hub's own `error.code` when it maps to the SAME exit tier
46
- * so a documented code like `version_not_supported` survives instead of being flattened to
47
- * `bad_request` (both exit 9), without letting a Hub-supplied code change the exit semantics. The
48
- * server message is stripped of terminal control chars (the top-level catch prints it). */
49
- export declare function statusToCliError(status: number, message: string | undefined, hubCode?: string, hint?: string): CliError;
65
+ /** Map a Hub error response to a CliError. The exit code comes from the HTTP status (the §7 exit
66
+ * tiers are CLI product policy); the `error.code` string surfaced in the §8 envelope is read via
67
+ * the vendored §8.5 vocabulary see `cliErrorCode`. The server message is stripped of terminal
68
+ * control chars (the top-level catch prints it). */
69
+ export declare function statusToCliError(status: number, message: string | undefined, hubCode?: string, hint?: string, touchpoint?: HubTouchpoint): CliError;
@@ -1,13 +1,16 @@
1
1
  // Shared Hub HTTP for the messaging commands (notify / ask / task) — submit an envelope and
2
2
  // poll a message, over the INJECTABLE `ctx.runtime.fetchImpl` so command tests stay hermetic
3
- // (never a live Hub). The one thing worth centralizing is the HTTP-status → §7 exit-code
4
- // mapping, so every messaging command surfaces the same codes/messages (cli spec §7/§8).
3
+ // (never a live Hub).
5
4
  //
6
- // The tiny defensive body readers + terminal sanitizer mirror the private copies in
7
- // `commands/login.ts`; they are duplicated (not imported) so this stays a self-contained layer
8
- // with FULL status coverage (409 conflict / 422 validation_error), which the device-code flow
9
- // in login.ts never needs. A future shared CLI-core package could unify them (distinct from
10
- // `@oh-hai/ma2h-core`, the protocol crypto/lifecycle/validation core, not these HTTP readers).
5
+ // Since #726 this module is a thin ADAPTER over the vendored client layer: the §8.1 submit-ack
6
+ // validation (with its addressed-misroute detector), the per-type poll-status tables, the
7
+ // drain-batch shape guard, and the §8.5 error reading all come from `@oh-hai/ma2h-core/wire`
8
+ // never re-derived here. What stays CLI-owned is transport (fetch, timeouts, redaction), the
9
+ // Hub's product wrapper shapes (`{ directives }` / `{ messages }` / `{ acked }` bodies, parsed as
10
+ // transport before the unwrapped data reaches the layer), and the §7 exit-code tiers each layer
11
+ // verdict maps to (docs/specs/cli.md §7/§8 — the published machine contract, unchanged).
12
+ import { effectiveCode, validateDrainBatch, validatePollStatus, validateSubmitAck, } from "@oh-hai/ma2h-core/wire";
13
+ import { baseCodeForStatus, isHubErrorStatus, isKnownHubErrorCode, } from "@oh-hai/ma2h-core/errors";
11
14
  import { CliError } from "../../envelope.js";
12
15
  import { exitCodeForError, isErrorCode } from "../../exit-codes.js";
13
16
  import { throwTransportError } from "../http.js";
@@ -31,6 +34,16 @@ export function redactToken(message, token) {
31
34
  return message;
32
35
  return message.split(token).join("[redacted]");
33
36
  }
37
+ /** The submitted envelope's verb — the client-side context the layer's ack validation needs (its
38
+ * `SubmitContext.type`; the submit-ack schema's status enum is the union of every track, so only
39
+ * the sender can pin the ack to the owning track). Every product caller submits a built or
40
+ * replay-validated envelope, so a missing/unknown type is a caller bug surfaced as usage. */
41
+ function submitTypeOf(envelope) {
42
+ const type = envelope !== null && typeof envelope === "object" ? envelope.type : undefined;
43
+ if (type === "notify" || type === "ask" || type === "task")
44
+ return type;
45
+ throw new CliError("usage", "submitEnvelope requires an MA2H envelope declaring type notify | ask | task.");
46
+ }
34
47
  /** POST an envelope to the Hub's ingest endpoint (agent bearer). `202` → the SubmitAck; every
35
48
  * other status maps to the right §7 exit code (via the Hub's error envelope when present). */
36
49
  export async function submitEnvelope(ctx, token, envelope, opts = {}) {
@@ -42,6 +55,8 @@ export async function submitEnvelope(ctx, token, envelope, opts = {}) {
42
55
  // cannot miss it — a per-caller gate already got forgotten once.
43
56
  if (opts.addressedTo !== undefined)
44
57
  await assertHubSpeaksAddressing(ctx, opts.addressedTo);
58
+ const addressed = opts.addressedTo !== undefined;
59
+ const type = submitTypeOf(envelope);
45
60
  const url = `${ctx.config.baseUrl}/v1/messages`;
46
61
  const init = {
47
62
  method: "POST",
@@ -61,90 +76,53 @@ export async function submitEnvelope(ctx, token, envelope, opts = {}) {
61
76
  // On an ADDRESSED submit, append the one sentence that turns each documented §8.5 refusal into
62
77
  // a next step. Done here — where the HTTP status and the Hub's own `error.code` are still in
63
78
  // hand — rather than by re-inspecting a flattened CliError message at the call site.
64
- const hint = opts.addressedTo !== undefined ? addressedHint(res.status, code, opts.addressedTo) : undefined;
65
- throw statusToCliError(res.status, redactToken(message, token), code, hint);
79
+ const hint = addressed ? addressedHint(res.status, code, opts.addressedTo) : undefined;
80
+ throw statusToCliError(res.status, redactToken(message, token), code, hint, addressed ? "addressed-send" : "own-session-submit");
66
81
  }
67
82
  const body = await readJson(res);
68
- // A conformant Hub returns `{ id, status, poll_url, review_url? }` for every message type.
69
- // Validate the fields the submit paths consume `id` + `status` (printSubmitAck echoes status,
70
- // which would throw on `undefined`) + `poll_url` (the ack contract + ask `--json`'s promised
71
- // resume URL), and a present `review_url` must be a string too (else printSubmitAck /--json break)
72
- // rather than casting a malformed 202 body through and crashing / emitting an incomplete payload
73
- // AFTER the message was accepted.
74
- if (typeof body.id !== "string" || body.id === "" ||
75
- typeof body.status !== "string" || body.status === "" ||
76
- typeof body.poll_url !== "string" || body.poll_url === "" ||
77
- (body.review_url !== undefined && typeof body.review_url !== "string")) {
78
- throw new CliError("server", "the Hub accepted the message but returned an incomplete or malformed ack.");
79
- }
80
- // Redact the bearer from every ack field before returning — a hostile/buggy Hub could echo the
81
- // Authorization value into id/status/poll_url/review_url, which the submit handlers print to
82
- // stdout / the --json envelope (§5.4). Build a clean ack (drops any extra Hub fields too).
83
- const destination = destinationOf(body, token, opts.addressedTo !== undefined);
84
- // §8.1 MUST: every ADDRESSED ack carries the destination snapshot, and its absence is not a
85
- // cosmetic gap — it is positive proof that the Hub did not route the address. A pre-0.5 Hub cannot
86
- // emit this object at all, so a 202 without it means `to` was ignored and the message was filed in
87
- // the HUMAN inbox. Printing a warning while still returning a successful ack (the earlier shape)
88
- // left every caller exiting 0 and `--json` saying `ok: true` for a message that reached the wrong
89
- // recipient — a silent misroute is exactly what this snapshot exists to make impossible. The id is
90
- // included because the submit WAS accepted: the caller needs it to find (and cancel) the message.
91
- if (opts.addressedTo !== undefined && destination === undefined) {
92
- throw new CliError("server", `the Hub accepted this message (id ${redactToken(String(body.id), token)}) but returned no destination snapshot, ` +
93
- `which means it did not route "${opts.addressedTo}" — the message was filed in the HUMAN inbox instead. ` +
94
- "This Hub predates v0.5 addressing (§8.1).");
95
- }
96
- const ack = {
97
- id: redactToken(body.id, token),
98
- status: redactToken(body.status, token),
99
- poll_url: redactToken(body.poll_url, token),
100
- ...(typeof body.review_url === "string" ? { review_url: redactToken(body.review_url, token) } : {}),
101
- ...(destination !== undefined ? { destination } : {}),
102
- };
103
- return ack;
104
- }
105
- /** Read the v0.5 §8.1 `destination` snapshot off an ack, defensively. Absent / wrong-shaped ⇒
106
- * undefined, which the submit handlers render as "no destination snapshot" — a meaningful signal in
107
- * itself on an ADDRESSED submit, because a pre-0.5 Hub cannot emit this object at all, so its
108
- * absence is the sender's proof that `to` was IGNORED and the message filed in a human inbox.
109
- * An unrecognized `state` is passed through verbatim (sanitized at render) rather than coerced to
110
- * `unknown`: inventing a reachability claim is exactly the dishonesty §8.1 exists to prevent. */
111
- function destinationOf(body, token, addressed) {
112
- const raw = body.destination;
113
- if (raw === null || typeof raw !== "object" || Array.isArray(raw))
114
- return undefined;
115
- const { state, last_seen: lastSeen } = raw;
116
- if (typeof state !== "string" || state === "")
117
- return undefined;
118
- if (addressed) {
119
- // The v0.5 submit-ack schema (and conformance vector sv-034) fixes BOTH the enum and the
120
- // relationship: `state` is online|offline|unknown, and `unknown` — the "no visibility" answer —
121
- // MUST carry no `last_seen`, because a timestamp IS visibility. Passing an out-of-enum state
122
- // through "verbatim" was the wrong kind of honesty: rendering `reachable` or an `unknown` with a
123
- // last-seen invents a reachability claim the protocol cannot express, which is exactly the false
124
- // belief this snapshot exists to prevent. A violation is a malformed ack, not a usable reading.
125
- if (state !== "online" && state !== "offline" && state !== "unknown") {
126
- throw new CliError("server", `the Hub returned an unknown destination reachability state ${JSON.stringify(sanitizeForTerminal(state))}.`);
127
- }
128
- // The schema pins the relationship in BOTH directions, and each direction is load-bearing:
129
- // `unknown` must carry no `last_seen` (a timestamp IS visibility, so one here contradicts the
130
- // claim), and `online`/`offline` MUST carry one (a known state with no timestamp is an
131
- // unanchored assertion — "online" as of when?). Half-validating leaves the second case rendering
132
- // a reachability reading the sender cannot date, which is the same unfalsifiable claim the
133
- // snapshot exists to replace.
134
- if (state === "unknown" && lastSeen !== undefined) {
135
- throw new CliError("server", "the Hub returned an `unknown` destination reachability carrying a last_seen, which the v0.5 ack schema forbids.");
136
- }
137
- if (state !== "unknown" && !isIsoTimestamp(lastSeen)) {
138
- throw new CliError("server", `the Hub reported the destination as ${state} without the last_seen timestamp the v0.5 ack schema requires to anchor it.`);
83
+ // The §8.1 ack validation is the LAYER's: field narrowing, delegation to the published
84
+ // submit-ack schema (which owns the snapshot's enum + last_seen pairing this module used to
85
+ // hand-check), the owning-track status vocabulary, and the misroute detector in both directions.
86
+ const verdict = validateSubmitAck(body, { addressed, type });
87
+ if (!verdict.valid) {
88
+ if (verdict.misroute) {
89
+ // §8.1 MUST: every ADDRESSED ack carries a valid destination snapshot, and its absence is
90
+ // positive proof that the Hub did not route the address — a pre-0.5 Hub cannot emit this
91
+ // object at all, so the message was filed in the HUMAN inbox. The submit WAS accepted, so
92
+ // the id is carried: the caller needs it to find (and cancel) the message.
93
+ throw new CliError("server", `the Hub accepted this message (id ${redactToken(verdict.acceptedId, token)}) but returned no usable destination snapshot, ` +
94
+ `which means it did not route "${opts.addressedTo}" — the message was filed in the HUMAN inbox instead. ` +
95
+ "This Hub predates v0.5 addressing (§8.1).");
139
96
  }
97
+ // The 202 DID accept the message even though the ack is unusable — carry the id whenever the
98
+ // body offers one, so a caller can find (or cancel) the accepted message instead of blindly
99
+ // retrying and duplicating a notify (asks/tasks are idempotency-keyed; notifies are not).
100
+ const acceptedId = typeof body.id === "string" ? ` (accepted id ${redactToken(body.id, token)})` : "";
101
+ throw new CliError("server", `the Hub accepted the message${acceptedId} but returned an incomplete or malformed ack (${sanitizeForTerminal(redactToken(verdict.errors.join("; "), token) ?? "")}).`);
140
102
  }
103
+ // Redact the bearer from every ack field before returning — a hostile/buggy Hub could echo the
104
+ // Authorization value into any of them, which the submit handlers print to stdout / the --json
105
+ // envelope (§5.4). Rebuilt field-by-field from the layer's typed ack.
106
+ const ack = verdict.ack;
141
107
  return {
142
- state: redactToken(state, token),
143
- ...(typeof lastSeen === "string" ? { last_seen: redactToken(lastSeen, token) } : {}),
108
+ id: redactToken(ack.id, token),
109
+ status: redactToken(ack.status, token),
110
+ poll_url: redactToken(ack.poll_url, token),
111
+ ...(ack.review_url !== undefined ? { review_url: redactToken(ack.review_url, token) } : {}),
112
+ ...(ack.destination !== undefined
113
+ ? {
114
+ destination: {
115
+ state: redactToken(ack.destination.state, token),
116
+ ...(ack.destination.last_seen !== undefined ? { last_seen: redactToken(ack.destination.last_seen, token) } : {}),
117
+ },
118
+ }
119
+ : {}),
144
120
  };
145
121
  }
146
122
  /** The actionable second sentence for a refused ADDRESSED submit (spec §8.5). Keyed on the HTTP
147
- * status plus the Hub's `error.code`, both of which are documented and stable:
123
+ * status plus the Hub's `error.code` READ per §8.5 through the vendored `effectiveCode` (a
124
+ * recognized code reads as itself; an unrecognized 422 falls back to `invalid_field`, the class's
125
+ * base code at the addressed-send touchpoint):
148
126
  * - `403` — the leg is ACCOUNT-OPT-IN and defaults off (§8.0). Nothing the sender can fix in argv.
149
127
  * - `422 unknown_destination` — no such agent (or a session that is not the addressee's) in THIS
150
128
  * account. Deliberately indistinguishable from "exists but not yours", so the guidance can only
@@ -160,16 +138,26 @@ function addressedHint(status, code, to) {
160
138
  const principal = to.split("#")[0] ?? to;
161
139
  return `that session is terminal — re-address the principal (\`--to ${principal}\`) or pick a live session from \`oh-hai fleet ls\`.`;
162
140
  }
163
- if (status === 422 && code === "unknown_destination") {
141
+ const reading = effectiveCode({ code, status }, "addressed-send");
142
+ if (status === 422 && reading === "unknown_destination") {
164
143
  return "no live agent (or session) in this account answers to that address — check it with `oh-hai fleet ls`.";
165
144
  }
166
- if (status === 422 && code === "invalid_field") {
145
+ if (status === 422 && reading === "invalid_field") {
167
146
  return "this Hub does not speak v0.5 addressing, so `--to` cannot be routed here.";
168
147
  }
169
148
  return undefined;
170
149
  }
171
150
  /** GET one message (the submitter-bound pull, agent bearer). Embeds the terminal Response.
172
- * A `2xx` returns the parsed body; every other status maps to a §7 exit code. */
151
+ * A `2xx` returns the parsed body; every other status maps to a §7 exit code.
152
+ *
153
+ * The poll checks are the layer's `validatePollStatus`: the id echo-match, the status drawn from
154
+ * the polled type's own table (human-inbox notify: `delivered`; ADDRESSED notify: the §14.2
155
+ * delivery track; ask/task: their §7 resolution track), and terminal-requires-Response. The
156
+ * layer's `PollExpectation` wants the SUBMIT-side context, which a by-id read does not have — so
157
+ * this adapter derives it from the body itself (`type` from `body.type`, `addressed` from
158
+ * `body.to !== undefined`): body-derived SELF-CONSISTENCY, deliberately weaker than submit-side
159
+ * knowledge. The await layers keep their own wrong-kind fail-fast on `body.type` (product §4.4
160
+ * behavior — a copied notify id must say "not an ask", not "malformed body"). */
173
161
  export async function pollMessage(ctx, token, id, timeoutMs) {
174
162
  const url = `${ctx.config.baseUrl}/v1/messages/${encodeURIComponent(id)}`;
175
163
  const init = {
@@ -189,28 +177,25 @@ export async function pollMessage(ctx, token, id, timeoutMs) {
189
177
  throw statusToCliError(res.status, redactToken(message, token), code);
190
178
  }
191
179
  const body = await readJson(res);
192
- // Validate the body shape before the await loop keys terminality on it: the `id` must be present
193
- // AND match the requested id (a proxy returning a different message would otherwise report the
194
- // wrong outcome under the requested id), and a `status` valid globally but IMPOSSIBLE for the
195
- // message's `type` (e.g. an ask-only `cancelled` on a task) would be reported as a real outcome.
196
- // A malformed / mismatched poll body is a server error, not a completed await.
197
- if (typeof body.id !== "string" || body.id !== id || !isValidTypeStatus(body.type, body.status)) {
180
+ const type = body.type;
181
+ if (type !== "notify" && type !== "ask" && type !== "task") {
198
182
  throw new CliError("server", "the Hub returned a malformed or mismatched message (bad/other id, or a status invalid for its type).");
199
183
  }
200
- // A body that reached a §7 RESOLUTION must embed its Response (the pull contract) — else `await`
201
- // would exit "successfully" with no resolution value/actor. Keyed on the resolution set rather
202
- // than "not open and not delivered": the v0.5 §14.2 delivery-track states carry no §7 Response by
203
- // design (they describe DELIVERY, not a human's answer), so the old negative form would have
204
- // rejected a legitimate `queued` / `acknowledged` / `bounced` poll body as malformed.
205
- if (isResolved(body.type, body.status) && (typeof body.response !== "object" || body.response === null)) {
206
- throw new CliError("server", "the Hub returned a resolved message with no embedded Response.");
184
+ const verdict = validatePollStatus(body, { id, type, addressed: body.to !== undefined });
185
+ if (!verdict.valid) {
186
+ throw new CliError("server", `the Hub returned a malformed or mismatched message (bad/other id, a status invalid for its type, or a terminal body with no embedded Response): ${sanitizeForTerminal(redactToken(verdict.errors.join("; "), token) ?? "")}`);
207
187
  }
208
188
  return body;
209
189
  }
210
190
  /** GET the agent's mailbox — the human→agent drain (spec §13, agent bearer). A `2xx` returns the
211
191
  * signed deliveries; every other status maps to a §7 exit code. `max`, when set, caps the batch via
212
192
  * `?max=`. The drain also touches `agent_seen` server-side, so an authenticated poll is itself the
213
- * presence heartbeat (§15) — nothing extra to send. */
193
+ * presence heartbeat (§15) — nothing extra to send.
194
+ *
195
+ * The `{ directives: [...] }` wrapper is this Hub's v0.4 transport shape, parsed here; the
196
+ * unwrapped array goes to the layer's whole-batch shape guard (`validateDrainBatch` — one
197
+ * malformed row refuses the ENTIRE batch, because consuming the well-formed rows of a garbled
198
+ * body would ack mail out of a response the Hub demonstrably mangled). */
214
199
  export async function drainInbox(ctx, token, max) {
215
200
  const query = max !== undefined ? `?max=${max}` : "";
216
201
  const url = `${ctx.config.baseUrl}/v1/inbox${query}`;
@@ -231,16 +216,15 @@ export async function drainInbox(ctx, token, max) {
231
216
  throw statusToCliError(res.status, redactToken(message, token), code);
232
217
  }
233
218
  const body = await readJson(res);
234
- // Validate the drain shape before the loop trusts it: `directives` MUST be an array, and every
235
- // element MUST carry an object `directive` with a string `id` (the dedup + ack key) and a string
236
- // `signature` (forwarded to the runtime). A malformed body is a server error, not an empty drain —
237
- // silently treating garbage as "no directives" would strand real mail. Mirrors submitEnvelope's
238
- // defensive 202 validation.
239
- const directives = body.directives;
240
- if (!Array.isArray(directives) || !directives.every(isInboundDelivery)) {
219
+ const batch = validateDrainBatch(body.directives);
220
+ // Product guard on top of the layer's wrapper check: this v0.4 drain may only carry `directive`
221
+ // rows, and the human emit path dereferences id/from/title (+ a string priority), so a directive
222
+ // missing them must be rejected at drain as a `server` error never handed to the loop to crash
223
+ // mid-stream. A malformed body is a Hub/proxy contract violation, not an empty drain.
224
+ if (!batch.valid || !batch.entries.every(isInboundDelivery)) {
241
225
  throw new CliError("server", "the Hub returned a malformed inbox drain (expected { directives: [{ directive: { id }, signature }] }).");
242
226
  }
243
- return { directives: directives };
227
+ return { directives: batch.entries };
244
228
  }
245
229
  /** GET the agent's OWN submitted messages — the submitter-bound self-list (spec §9.1, agent bearer,
246
230
  * the #400 primitive paginated by #527). The Hub scopes the result to (accountId, agentId) and
@@ -342,18 +326,14 @@ export async function ackInbox(ctx, token, ids) {
342
326
  }
343
327
  return { acked: acked };
344
328
  }
345
- /** Structural guard for one drained delivery: an object `directive` carrying string `id` / `from` /
346
- * `title` (and, when present, a string `priority`), plus a string `signature`. `id` is the dedup +
347
- * ack key; `from`/`title`/`priority` are dereferenced on the human emit path (`sanitizeForTerminal`
348
- * would throw on a non-string), so a directive whose value for any of them isn't a string must be
349
- * rejected here as a `server` error at drain — never handed to the loop to crash mid-stream. */
329
+ /** Product guard for one v0.4 drained delivery: an object `directive` carrying string `id` / `from` /
330
+ * `title` (and, when present, a string `priority`). The batch WRAPPER (signature present, exactly
331
+ * one entry kind, object payload) is already the layer's verdict (`validateDrainBatch`); this
332
+ * checks only the fields the CLI's own human emit path dereferences (`sanitizeForTerminal` would
333
+ * throw on a non-string). */
350
334
  function isInboundDelivery(value) {
351
- if (value === null || typeof value !== "object")
352
- return false;
353
- const { directive, signature } = value;
354
- if (typeof signature !== "string")
355
- return false;
356
- if (directive === null || typeof directive !== "object")
335
+ const { directive } = value;
336
+ if (directive === null || directive === undefined || typeof directive !== "object")
357
337
  return false;
358
338
  const d = directive;
359
339
  if (typeof d.id !== "string" || typeof d.from !== "string" || typeof d.title !== "string")
@@ -381,85 +361,73 @@ function toIndexRow(row) {
381
361
  }
382
362
  return rest;
383
363
  }
384
- /** Valid lifecycle statuses per message type (spec §7). A status valid for one type but not the
385
- * message's actual type is a malformed body. `delivered` is terminal-on-acceptance for `notify`
386
- * ONLY ask/task go from `open` straight to a resolution, so a `{type:"ask", status:"delivered"}`
387
- * must be rejected (else the await loop would treat it as non-terminal and hang to timeout). */
388
- /** The v0.5 §14.2 DELIVERY-track states belong to the NOTIFY set only.
389
- *
390
- * An addressed notify's lifecycle IS the delivery track, so `status` legitimately reads
391
- * `queued`/`acknowledged`/`bounced`/`expired` there (spec §5.1). An addressed ASK/TASK keeps the §7
392
- * resolution machinery at `status` — an undeliverable track terminal auto-resolves it to
393
- * `cancelled`/`dismissed` — and surfaces the outbound track under `mailbox` instead
394
- * (v0.5 get-message.schema.json). Admitting the delivery states into the ask/task sets would let a
395
- * malformed `{type:"ask", status:"bounced"}` through, and `ask await` would then report it as a
396
- * successful terminal resolution carrying no Response — the exact "status valid globally but
397
- * impossible for this type" failure this table exists to catch. */
398
- const STATUSES_BY_TYPE = {
399
- notify: new Set(["open", "delivered", "queued", "acknowledged", "bounced", "expired"]),
400
- ask: new Set(["open", "answered", "declined", "cancelled", "expired"]),
401
- task: new Set(["open", "completed", "dismissed", "expired"]),
402
- };
403
- function isValidTypeStatus(type, status) {
404
- if (typeof type !== "string" || typeof status !== "string")
405
- return false;
406
- const allowed = STATUSES_BY_TYPE[type];
407
- return allowed !== undefined && allowed.has(status);
408
- }
409
- /** A `format: date-time` string, checked as far as is useful here: a parseable ISO timestamp. Used
410
- * for the reachability anchor, where an unparseable value is as unusable as an absent one. */
411
- function isIsoTimestamp(value) {
412
- return typeof value === "string" && value.trim() !== "" && !Number.isNaN(Date.parse(value));
413
- }
414
- /** The §7 RESOLUTION states per type — the ones whose body MUST embed a terminal Response. A notify
415
- * has no resolution track at all (its `expired` belongs to the §14.2 delivery track and carries no
416
- * human answer), which is why this is per-type rather than one flat set: `expired` means two
417
- * different things depending on which track owns the message. */
418
- const RESOLUTIONS_BY_TYPE = {
419
- ask: new Set(["answered", "declined", "cancelled", "expired"]),
420
- task: new Set(["completed", "dismissed", "expired"]),
421
- };
422
- function isResolved(type, status) {
423
- if (typeof type !== "string" || typeof status !== "string")
424
- return false;
425
- return RESOLUTIONS_BY_TYPE[type]?.has(status) === true;
426
- }
427
- /** Map a Hub error response to a CliError. The exit code comes from the HTTP status; the stable
428
- * `error.code` string (§8) prefers the Hub's own `error.code` when it maps to the SAME exit tier
429
- * — so a documented code like `version_not_supported` survives instead of being flattened to
430
- * `bad_request` (both exit 9), without letting a Hub-supplied code change the exit semantics. The
431
- * server message is stripped of terminal control chars (the top-level catch prints it). */
432
- export function statusToCliError(status, message, hubCode, hint) {
433
- const base_ = message !== undefined ? sanitizeForTerminal(message) : `Hub returned ${status}.`;
364
+ /** Map a Hub error response to a CliError. The exit code comes from the HTTP status (the §7 exit
365
+ * tiers are CLI product policy); the `error.code` string surfaced in the §8 envelope is read via
366
+ * the vendored §8.5 vocabulary see `cliErrorCode`. The server message is stripped of terminal
367
+ * control chars (the top-level catch prints it). */
368
+ export function statusToCliError(status, message, hubCode, hint, touchpoint = "presentation") {
369
+ const base = message !== undefined ? sanitizeForTerminal(message) : `Hub returned ${status}.`;
434
370
  // The hint is CLI-authored (never Hub-supplied), so it needs no sanitizing — but it is appended
435
371
  // AFTER the Hub's own message so the verbatim server text stays the headline.
436
- const detail = hint !== undefined ? `${base_} — ${hint}` : base_;
372
+ const detail = hint !== undefined ? `${base} — ${hint}` : base;
373
+ return new CliError(cliErrorCode(status, hubCode, touchpoint), detail);
374
+ }
375
+ /** The stable `error.code` the CLI envelope carries for a Hub refusal (§7/§8), adapted per KTD5:
376
+ * the EXIT TIER always comes from the HTTP status (product contract — a Hub-supplied code must
377
+ * never change the exit semantics), while the code STRING is read through the layered §8.5 rules:
378
+ * 1. a documented CLI §8 code in the same tier survives verbatim (e.g. `version_not_supported`);
379
+ * 2. a code in the Hub's §8.5 vocabulary but not the CLI's table (e.g. `rate_limited`) propagates
380
+ * via the status tier, never surfaced verbatim;
381
+ * 3. a genuinely unrecognized code takes §8.5's unknown-code fallback — the vendored
382
+ * `effectiveCode` — surfaced only when that reading is itself a documented same-tier CLI code. */
383
+ function cliErrorCode(status, hubCode, touchpoint) {
437
384
  const base = statusToErrorCode(status);
438
- // Preserve the Hub's code ONLY when it is a documented §8 code AND maps to the same exit tier —
439
- // an unrecognized code (e.g. `rate_limited` on a 429) must not leak into the CLI envelope, and a
440
- // recognized code from a different tier must not change the exit semantics.
441
- if (hubCode !== undefined && isErrorCode(hubCode) && exitCodeForError(hubCode) === exitCodeForError(base)) {
442
- return new CliError(hubCode, detail);
443
- }
444
- return new CliError(base, detail);
385
+ if (hubCode === undefined)
386
+ return base;
387
+ if (isErrorCode(hubCode))
388
+ return exitCodeForError(hubCode) === exitCodeForError(base) ? hubCode : base;
389
+ if (isKnownHubErrorCode(hubCode))
390
+ return base;
391
+ const reading = effectiveCode({ code: hubCode, status }, touchpoint);
392
+ if (reading !== undefined && isErrorCode(reading) && exitCodeForError(reading) === exitCodeForError(base))
393
+ return reading;
394
+ return base;
445
395
  }
446
- /** The stable `error.code` implied by an HTTP status (§7/§8). */
396
+ /** The CLI exit tier for each base code in the protocol's closed vocabulary. The §8.5
397
+ * status-class MEMBERSHIP lives in the layer (`isHubErrorStatus`/`baseCodeForStatus`); this table
398
+ * is only the CLI's tier NAMING over those classes. Two deliberate merges: 410's codes join 404's
399
+ * `not_found` tier (distinguishing them at the EXIT-code level would buy a caller nothing — both
400
+ * mean "re-address"; the Hub's own message carries the distinction), and `rate_limited` stays in
401
+ * the generic `error` tier (CLI product policy: no dedicated rate-limit exit). An annotated full
402
+ * Record, so a widened upstream vocabulary is a compile error here, not a silent hole. */
403
+ const TIER_FOR_BASE = {
404
+ validation_error: "bad_request",
405
+ version_not_supported: "bad_request",
406
+ unauthenticated: "auth",
407
+ agent_id_mismatch: "auth",
408
+ not_authorized: "auth",
409
+ not_found: "not_found",
410
+ idempotency_conflict: "conflict",
411
+ already_terminal: "conflict",
412
+ not_acknowledgeable: "conflict",
413
+ gone: "not_found",
414
+ destination_gone: "not_found",
415
+ session_closed_by_operator: "not_found",
416
+ invalid_field: "validation_error",
417
+ unknown_destination: "validation_error",
418
+ rate_limited: "error",
419
+ };
420
+ /** The §7 exit tier implied by an HTTP status — CLI product policy (docs/specs/cli.md §7). Within
421
+ * §8.5's status classes the class membership and base reading are the layer's (`presentation` is
422
+ * the touchpoint a status-only mapping can assume); outside them (413, 5xx) the tier stays local. */
447
423
  function statusToErrorCode(status) {
448
- if (status === 401 || status === 403)
449
- return "auth";
450
- // 410 Gone joins 404: the named resource is no longer usable (a terminal destination session,
451
- // §8.5 `destination_gone`). Distinguishing it from 404 at the EXIT-code level would buy a caller
452
- // nothing — both mean "re-address"; the Hub's own message carries the distinction.
453
- if (status === 404 || status === 410)
454
- return "not_found";
455
- if (status === 409)
456
- return "conflict";
424
+ if (isHubErrorStatus(status)) {
425
+ const base = baseCodeForStatus(status, "presentation");
426
+ if (base !== undefined)
427
+ return TIER_FOR_BASE[base];
428
+ }
457
429
  if (status === 413)
458
430
  return "payload_too_large";
459
- if (status === 422)
460
- return "validation_error";
461
- if (status === 400)
462
- return "bad_request";
463
431
  if (status >= 500)
464
432
  return "server";
465
433
  return "error";
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/commands/messaging/http.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,6FAA6F;AAC7F,yFAAyF;AACzF,yFAAyF;AACzF,EAAE;AACF,oFAAoF;AACpF,+FAA+F;AAC/F,8FAA8F;AAC9F,4FAA4F;AAC5F,+FAA+F;AAE/F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAkB,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGhE;2FAC2F;AAC3F,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;4E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