wicked-crew-api-types 0.18.0 → 0.19.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 (2) hide show
  1. package/index.d.ts +118 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -231,6 +231,25 @@ export interface AgentSession {
231
231
  * idempotent against the existing branch) and `'none'` after it is cleaned up.
232
232
  */
233
233
  deliverUrl?: string;
234
+ /**
235
+ * The campaign this AD-HOC run was attached to at launch (`LaunchRunBody.campaignId`;
236
+ * wicked-studio#27, api-types 0.19.0) — daemon-joined at DTO assembly on `GET /runs` and
237
+ * `GET /runs/:id` from the launch record (audit trail), so it survives a daemon restart.
238
+ * ABSENT — never `null` — when the run was not attached (absence is the one spelling).
239
+ *
240
+ * NOT set on a campaign's own DAG-node runs: those are correlated through
241
+ * {@link Campaign.node_run_id} (their run ids are `{campaign}:{node}:a{attempt}`), and a
242
+ * caller-chosen `sessionId` may legally contain `:`, so id-shape parsing is unsound — read
243
+ * membership from the campaign, not from this field or the id.
244
+ */
245
+ campaign_id?: string;
246
+ /**
247
+ * The ad-hoc group label this run was launched under (`LaunchRunBody.groupLabel`;
248
+ * wicked-studio#27, api-types 0.19.0) — daemon-joined like {@link AgentSession.campaign_id}.
249
+ * ABSENT when the run is ungrouped. Runs sharing a label form one `RunGroup` on
250
+ * `GET /campaigns`.
251
+ */
252
+ group_label?: string;
234
253
  }
235
254
 
236
255
  /** An ordered unit of work within a run (`WorkUnit`). */
@@ -1518,6 +1537,28 @@ export interface LaunchRunBody {
1518
1537
  * Omit when the launch is not a retry.
1519
1538
  */
1520
1539
  retryOf?: string;
1540
+ /**
1541
+ * Ad-hoc campaign attach (wicked-studio#27; api-types 0.19.0): file this run onto an EXISTING
1542
+ * campaign's surface. Validated at launch, loudly: an unknown campaign id fails the launch
1543
+ * with a 404 naming it (nothing is launched); a deployment whose engine addon lacks the
1544
+ * campaign bindings answers 501 ("upgrade the engine", never "fix your request").
1545
+ *
1546
+ * The attach is daemon-side provenance ONLY (recorded in the `run.launched` audit entry,
1547
+ * restart-durable, echoed as `AgentSession.campaign_id`): the run executes byte-identically
1548
+ * to an unattached launch — it does NOT become a DAG node, is never scheduled, gated, or
1549
+ * cancelled by the campaign, and the campaign's own lifecycle ignores it. It appears on the
1550
+ * campaigns surface as a `Campaign.attached_runs` entry. Mutually exclusive with
1551
+ * `groupLabel` (both ⇒ 400). Omit both for pre-0.19 behavior, byte for byte.
1552
+ */
1553
+ campaignId?: string;
1554
+ /**
1555
+ * Ad-hoc label grouping, created on first use (wicked-studio#27; api-types 0.19.0): runs
1556
+ * launched with the same label form one group — no pre-registration, no scheduler, no DAG,
1557
+ * no shared gates; pure provenance for "these sibling launches are one effort". 1–200
1558
+ * chars. Served as a `RunGroup` row beside the campaigns on `GET /campaigns` and echoed as
1559
+ * `AgentSession.group_label`. Mutually exclusive with `campaignId` (both ⇒ 400).
1560
+ */
1561
+ groupLabel?: string;
1521
1562
  }
1522
1563
 
1523
1564
  /**
@@ -2408,7 +2449,17 @@ export interface Campaign {
2408
2449
  /** The full definition, embedded so a resume needs no second store. */
2409
2450
  def: CampaignDef;
2410
2451
  node_status: Record<string, CampaignNodeStatus>;
2411
- /** node_id -> live Run id, always `{campaign}:{node}:a{attempt}` (attempt-keyed, idempotent). */
2452
+ /**
2453
+ * node_id -> live Run id, always `{campaign}:{node}:a{attempt}` (attempt-keyed, idempotent).
2454
+ *
2455
+ * These values ARE the engine session ids: a node's run is an ordinary governed run, so it is
2456
+ * served by `GET /runs` / `GET /runs/:id` under exactly this id, and every session-scoped
2457
+ * CoreEvent frame on `/ws` carries it as `session` (the `campaignNodeStarted` /
2458
+ * `campaignNodeAwaitingHuman` frames additionally spell it as `runId`). Live narration for a
2459
+ * campaign card is therefore a pure client-side correlation:
2460
+ * `frame.session === campaign.node_run_id[node]` — no extra wire, no per-node fetch
2461
+ * (wicked-studio#27).
2462
+ */
2412
2463
  node_run_id: Record<string, string>;
2413
2464
  /** node_id -> 0-based attempt counter (a `human_gate_on_failure` Retry bumps it). */
2414
2465
  node_attempt: Record<string, number>;
@@ -2418,6 +2469,72 @@ export interface Campaign {
2418
2469
  pending_failure_gates: string[];
2419
2470
  /** Whether a fail-fast (or Abort) tripped — finalization lands on `failed`. */
2420
2471
  fail_fast_tripped: boolean;
2472
+ /**
2473
+ * Per-node delivery (wicked-studio#27; api-types 0.19.0) — DAEMON-JOINED at DTO assembly on
2474
+ * `GET /campaigns` and `GET /campaigns/:id`, never engine-persisted: the exact same
2475
+ * `delivery`/`deliverUrl` derivation every run already carries on the runs wire
2476
+ * (`AgentSession.delivery`, crew#393/#311), keyed by node_id like {@link Campaign.node_status}.
2477
+ * A node appears here once its current-attempt run (`node_run_id[node]`) exists on the store —
2478
+ * a still-pending node has no entry. With `node_run_id` + `node_status`, this is everything a
2479
+ * "N of M delivered" rollup needs from ONE campaigns fetch — no per-node run fetch, and no
2480
+ * dependence on the runs list's archived-run filtering. ABSENT only from a pre-0.19 daemon.
2481
+ */
2482
+ node_delivery?: Record<string, CampaignNodeDelivery>;
2483
+ /**
2484
+ * Ad-hoc runs attached to this campaign at launch (`LaunchRunBody.campaignId`;
2485
+ * wicked-studio#27, api-types 0.19.0) — DAEMON-JOINED like {@link Campaign.node_delivery},
2486
+ * launch order. These are NOT DAG nodes: the campaign's scheduler and lifecycle ignore them;
2487
+ * each entry is an independent governed run that an operator filed onto this campaign's
2488
+ * surface. Absent from a pre-0.19 daemon; `[]` when none. Narration correlation is the same
2489
+ * as for nodes: each `runId` is the engine session id on `/ws` frames (`frame.session`).
2490
+ */
2491
+ attached_runs?: AttachedRunView[];
2492
+ }
2493
+
2494
+ /**
2495
+ * One member's delivery snapshot on the campaigns surface (wicked-studio#27; api-types 0.19.0)
2496
+ * — the same tri-state + URL contract as `AgentSession.delivery`/`deliverUrl` (crew#393/#311),
2497
+ * derived by the same code at DTO assembly. `deliverUrl` present exactly when
2498
+ * `delivery === 'delivered'`.
2499
+ */
2500
+ export interface CampaignNodeDelivery {
2501
+ delivery: 'delivered' | 'stranded' | 'vacuous' | 'none';
2502
+ deliverUrl?: string;
2503
+ }
2504
+
2505
+ /**
2506
+ * An ad-hoc run on the campaigns surface (wicked-studio#27; api-types 0.19.0) — a member of
2507
+ * `Campaign.attached_runs` or `RunGroup.runs`. `runId` is the engine session id: the run is
2508
+ * served in full by `GET /runs/:id`, and live `/ws` CoreEvent frames for it carry it as
2509
+ * `session`. `status`/`delivery`/`deliverUrl` are snapshots of the same fields the run wire
2510
+ * serves, so a rollup needs no second fetch.
2511
+ */
2512
+ export interface AttachedRunView {
2513
+ runId: string;
2514
+ status: SessionStatus;
2515
+ delivery: 'delivered' | 'stranded' | 'vacuous' | 'none';
2516
+ deliverUrl?: string;
2517
+ }
2518
+
2519
+ /**
2520
+ * An ad-hoc label group (wicked-studio#27; api-types 0.19.0): the runs launched with the same
2521
+ * `LaunchRunBody.groupLabel`, in launch order. NOT an engine campaign — no DAG, no scheduler,
2522
+ * no status of its own (derive a rollup from the members); it exists the moment the first run
2523
+ * is launched under the label. Served beside the campaigns in `CampaignsListResponse.groups`.
2524
+ */
2525
+ export interface RunGroup {
2526
+ label: string;
2527
+ runs: AttachedRunView[];
2528
+ }
2529
+
2530
+ /**
2531
+ * `GET /campaigns` 200 body (api-types 0.19.0 — `groups` is ADDITIVE: a pre-0.19 daemon sends
2532
+ * only `campaigns`). One fetch answers the whole grouping surface: engine campaigns (each
2533
+ * carrying its own per-node rollup fields) plus the ad-hoc label groups.
2534
+ */
2535
+ export interface CampaignsListResponse {
2536
+ campaigns: Campaign[];
2537
+ groups: RunGroup[];
2421
2538
  }
2422
2539
 
2423
2540
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-crew-api-types",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "The wire contract of the wicked-crew daemon's /api/v1 REST surface and /ws CoreEvent frames \u2014 types only, zero runtime",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",