wicked-crew 0.7.10 → 0.7.12

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 (61) hide show
  1. package/dist/api/delivery-index.d.ts +21 -0
  2. package/dist/api/delivery-index.d.ts.map +1 -1
  3. package/dist/api/delivery-index.js +35 -0
  4. package/dist/api/delivery-index.js.map +1 -1
  5. package/dist/api/group-index.d.ts +59 -0
  6. package/dist/api/group-index.d.ts.map +1 -0
  7. package/dist/api/group-index.js +100 -0
  8. package/dist/api/group-index.js.map +1 -0
  9. package/dist/api/post-hoc-deliver.d.ts +27 -0
  10. package/dist/api/post-hoc-deliver.d.ts.map +1 -1
  11. package/dist/api/post-hoc-deliver.js +54 -0
  12. package/dist/api/post-hoc-deliver.js.map +1 -1
  13. package/dist/api/retry-index.d.ts +6 -0
  14. package/dist/api/retry-index.d.ts.map +1 -1
  15. package/dist/api/retry-index.js +13 -6
  16. package/dist/api/retry-index.js.map +1 -1
  17. package/dist/api/routes.d.ts +55 -2
  18. package/dist/api/routes.d.ts.map +1 -1
  19. package/dist/api/routes.js +188 -17
  20. package/dist/api/routes.js.map +1 -1
  21. package/dist/api/seat-health.d.ts +11 -0
  22. package/dist/api/seat-health.d.ts.map +1 -1
  23. package/dist/api/seat-health.js +23 -0
  24. package/dist/api/seat-health.js.map +1 -1
  25. package/dist/api/server.d.ts.map +1 -1
  26. package/dist/api/server.js +19 -5
  27. package/dist/api/server.js.map +1 -1
  28. package/dist/api/testing.d.ts.map +1 -1
  29. package/dist/api/testing.js +11 -27
  30. package/dist/api/testing.js.map +1 -1
  31. package/dist/campaigns/rollup.d.ts +39 -0
  32. package/dist/campaigns/rollup.d.ts.map +1 -0
  33. package/dist/campaigns/rollup.js +84 -0
  34. package/dist/campaigns/rollup.js.map +1 -0
  35. package/dist/campaigns/routes.d.ts +10 -3
  36. package/dist/campaigns/routes.d.ts.map +1 -1
  37. package/dist/campaigns/routes.js +27 -5
  38. package/dist/campaigns/routes.js.map +1 -1
  39. package/dist/cli/index.js +13 -2
  40. package/dist/cli/index.js.map +1 -1
  41. package/dist/core/adapter.d.ts +0 -12
  42. package/dist/core/adapter.d.ts.map +1 -1
  43. package/dist/core/adapter.js +0 -14
  44. package/dist/core/adapter.js.map +1 -1
  45. package/dist/core/daemon-signal-log.d.ts +44 -0
  46. package/dist/core/daemon-signal-log.d.ts.map +1 -0
  47. package/dist/core/daemon-signal-log.js +57 -0
  48. package/dist/core/daemon-signal-log.js.map +1 -0
  49. package/dist/core/deliver.d.ts +20 -3
  50. package/dist/core/deliver.d.ts.map +1 -1
  51. package/dist/core/deliver.js +82 -9
  52. package/dist/core/deliver.js.map +1 -1
  53. package/dist/studio/assets/{index-gtE6scX0.js → index-DuU8RZg9.js} +95 -95
  54. package/dist/studio/index.html +1 -1
  55. package/dist/studio/testid-inventory.json +47 -17
  56. package/endpoint-manifest.json +4 -3
  57. package/package.json +3 -3
  58. package/dist/campaigns/worktrees.d.ts +0 -39
  59. package/dist/campaigns/worktrees.d.ts.map +0 -1
  60. package/dist/campaigns/worktrees.js +0 -95
  61. package/dist/campaigns/worktrees.js.map +0 -1
@@ -124,6 +124,27 @@ export declare function prUrlFrom(text: string): string | null;
124
124
  * overlay-carried deliver phases (crew#321).
125
125
  */
126
126
  export declare function deliverUnitOf(view: SessionView): WorkUnit | null;
127
+ /**
128
+ * Is this a `failed` run whose ONLY failure was the deliver phase's LIFT collision (crew#418)?
129
+ *
130
+ * The deliver phase is the LAST phase, so a rejected deliver unit whose `denial_reason` carries
131
+ * the deliver script's {@link DELIVER_LIFT_CONFLICT_MARKER} — with EVERY non-deliver unit still
132
+ * `done` — means the run's WORK is complete and committed on its `wicked/<id>` branch: only the
133
+ * lift into origin collided (a rebase conflict the changelog union merge could not clear, or a
134
+ * non-fast-forward push). The engine reports the run `failed` because a Tool phase exited
135
+ * non-zero; crew reinterprets THIS shape on the wire as `completed` + `delivery: 'stranded'`
136
+ * (recoverable via `POST /runs/:id/deliver`) — the same wire-derivation posture as `delivery`
137
+ * itself, leaving the engine's durable `failed` record untouched. The deliver unit stays
138
+ * `rejected` with its marker-bearing `denial_reason`, so WHY it stranded is still on the wire.
139
+ *
140
+ * FALSE — the run stays `failed` — for every genuine failure, because each misses a condition:
141
+ * - a rejected NON-deliver unit (a build/test/work phase failed) — `some(rejected)` guard;
142
+ * - a deliver rejection WITHOUT the marker: a spawn/infra fault (the crew#400 posture), a
143
+ * `gh` failure, nothing-to-deliver, or a wrong-worktree-branch refusal — the marker is the
144
+ * deliver script's own authority on WHY it refused, so crew never guesses from git's output;
145
+ * - a repo-less run (nothing to strand), or any non-`failed` status.
146
+ */
147
+ export declare function isDeliverConflictStranded(view: SessionView): boolean;
127
148
  export declare class DeliveryIndex {
128
149
  private readonly runToUrl;
129
150
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-index.d.ts","sourceRoot":"","sources":["../../src/api/delivery-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5E,kGAAkG;AAClG,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IACxD,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC,EAC9D,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GACxC,aAAa,CAYf;AAED;6FAC6F;AAC7F,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF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;;;OAQG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB1E,8EAA8E;IAC9E,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAIrC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG1C"}
@@ -21,6 +21,7 @@
21
21
  * the per-run output endpoint.
22
22
  */
23
23
  import { execCapped } from '../core/exec.js';
24
+ import { DELIVER_LIFT_CONFLICT_MARKER } from '../core/deliver.js';
24
25
  /**
25
26
  * The tri-state delivery derivation (crew#393) — HONEST by construction, computed at DTO
26
27
  * assembly from three facts and nothing else:
@@ -217,6 +218,40 @@ export function deliverUnitOf(view) {
217
218
  return byId;
218
219
  return view.units.find((u) => (u.tool_cmd ?? []).join(' ').includes('gh pr create')) ?? null;
219
220
  }
221
+ /**
222
+ * Is this a `failed` run whose ONLY failure was the deliver phase's LIFT collision (crew#418)?
223
+ *
224
+ * The deliver phase is the LAST phase, so a rejected deliver unit whose `denial_reason` carries
225
+ * the deliver script's {@link DELIVER_LIFT_CONFLICT_MARKER} — with EVERY non-deliver unit still
226
+ * `done` — means the run's WORK is complete and committed on its `wicked/<id>` branch: only the
227
+ * lift into origin collided (a rebase conflict the changelog union merge could not clear, or a
228
+ * non-fast-forward push). The engine reports the run `failed` because a Tool phase exited
229
+ * non-zero; crew reinterprets THIS shape on the wire as `completed` + `delivery: 'stranded'`
230
+ * (recoverable via `POST /runs/:id/deliver`) — the same wire-derivation posture as `delivery`
231
+ * itself, leaving the engine's durable `failed` record untouched. The deliver unit stays
232
+ * `rejected` with its marker-bearing `denial_reason`, so WHY it stranded is still on the wire.
233
+ *
234
+ * FALSE — the run stays `failed` — for every genuine failure, because each misses a condition:
235
+ * - a rejected NON-deliver unit (a build/test/work phase failed) — `some(rejected)` guard;
236
+ * - a deliver rejection WITHOUT the marker: a spawn/infra fault (the crew#400 posture), a
237
+ * `gh` failure, nothing-to-deliver, or a wrong-worktree-branch refusal — the marker is the
238
+ * deliver script's own authority on WHY it refused, so crew never guesses from git's output;
239
+ * - a repo-less run (nothing to strand), or any non-`failed` status.
240
+ */
241
+ export function isDeliverConflictStranded(view) {
242
+ if (view.session.status !== 'failed')
243
+ return false;
244
+ if (view.session.repo_ref == null)
245
+ return false;
246
+ const deliver = deliverUnitOf(view);
247
+ if (deliver === null || deliver.status !== 'rejected')
248
+ return false;
249
+ // A rejected unit that is NOT the deliver phase = a genuine work/build/test failure, not a
250
+ // clean run whose only casualty was the lift.
251
+ if (view.units.some((u) => u.id !== deliver.id && u.status === 'rejected'))
252
+ return false;
253
+ return (deliver.denial_reason ?? '').includes(DELIVER_LIFT_CONFLICT_MARKER);
254
+ }
220
255
  export class DeliveryIndex {
221
256
  runToUrl = new Map();
222
257
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-index.js","sourceRoot":"","sources":["../../src/api/delivery-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAC7B,OAA8D,EAC9D,GAAuB,EACvB,cAAyC;IAEzC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;IACzE,IACE,OAAO,CAAC,MAAM,KAAK,WAAW;QAC9B,OAAO,CAAC,QAAQ,IAAI,IAAI;QACxB,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;QACnC,OAAO,CAAC,OAAO,KAAK,EAAE;QACtB,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,EAC/B,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,UAAU,EA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to a grouping surface at launch:
5
+ * `campaignId` attaches the run to an EXISTING engine campaign (validated loudly — an unknown id
6
+ * fails the launch), `groupLabel` puts it in a label group created on first use. Either way the
7
+ * attach is daemon-side PROVENANCE only: the engine's run record carries no such field (the run
8
+ * executes byte-identically to an ungrouped launch, and the campaign scheduler never learns of
9
+ * it), so — exactly like retry lineage (CREW-UX-3) and the actor trail (task #88) — the durable
10
+ * record is the `run.launched` audit entry (`detail.campaignId` / `detail.groupLabel`), and this
11
+ * map is the read-side latency layer that lets `GET /runs` echo `campaign_id`/`group_label` and
12
+ * `GET /campaigns` serve `attached_runs` + the `groups` rows without a trail scan per request.
13
+ *
14
+ * Mirrors `RetryIndex`'s posture: hydrated once at server start (best-effort — a missing or
15
+ * unreadable trail leaves prior runs ungrouped, the pre-0.19 behavior, not an error) and updated
16
+ * at the same post-commit point that writes the audit entry, so the map can only lag by a failed
17
+ * hydrate, never diverge silently.
18
+ *
19
+ * SCAN BUDGET: this index consumes the SAME `run.launched` entries `RetryIndex` already scans,
20
+ * so it exposes {@link GroupIndex.hydrateFromLaunchEntries} and `createServer` feeds both
21
+ * indexes from ONE `readAll({ action: 'run.launched' })` — boot stays at three full-file trail
22
+ * scans, not four (the delivery-index consolidation note, crew#321).
23
+ */
24
+ import type { AuditLog } from './audit.js';
25
+ import type { AuditEntry } from '../core/types.js';
26
+ /** One launch's group attach: exactly one of the two forms (the launch route enforces it). */
27
+ export type GroupAttach = {
28
+ campaignId: string;
29
+ } | {
30
+ label: string;
31
+ };
32
+ export declare class GroupIndex {
33
+ private readonly runToAttach;
34
+ /** campaignId → attached run ids, launch order. */
35
+ private readonly campaignRuns;
36
+ /** label → member run ids, launch order. */
37
+ private readonly labelRuns;
38
+ /**
39
+ * Consume pre-read `run.launched` entries (NEWEST FIRST, `AuditLog.readAll`'s order —
40
+ * exhaustive, per BRIEF-UX-002 C5). The first entry seen per run wins, like the sibling
41
+ * indexes; member lists come out in LAUNCH order because insertion happens on a reversed
42
+ * walk. Idempotent per boot (called once).
43
+ */
44
+ hydrateFromLaunchEntries(entries: AuditEntry[]): void;
45
+ /** Standalone hydrate (tests / direct use) — production shares the scan via `createServer`. */
46
+ hydrate(audit: AuditLog, log?: (msg: string) => void): Promise<void>;
47
+ /** Record one launch's attach (post-commit, beside the audit write). */
48
+ set(runId: string, attach: GroupAttach): void;
49
+ /** This run's attach, or `undefined` (the DTO spells that as ABSENT fields). */
50
+ attachOf(runId: string): GroupAttach | undefined;
51
+ /** Run ids attached to this campaign, launch order (`[]` when none). */
52
+ attachedTo(campaignId: string): string[];
53
+ /** Every label group: `{ label, runIds }` in first-use order, members in launch order. */
54
+ labelGroups(): Array<{
55
+ label: string;
56
+ runIds: string[];
57
+ }>;
58
+ }
59
+ //# sourceMappingURL=group-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-index.d.ts","sourceRoot":"","sources":["../../src/api/group-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,8FAA8F;AAC9F,MAAM,MAAM,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkC;IAC9D,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+B;IAC5D,4CAA4C;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;IAEzD;;;;;OAKG;IACH,wBAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI;IAoBrD,+FAA+F;IACzF,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1E,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAc7C,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIhD,wEAAwE;IACxE,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAIxC,0FAA0F;IAC1F,WAAW,IAAI,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAM1D"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The run→ad-hoc-group index (wicked-studio#27; api-types 0.19.0).
3
+ *
4
+ * Ad-hoc sibling runs launched via `POST /runs` can be filed onto a grouping surface at launch:
5
+ * `campaignId` attaches the run to an EXISTING engine campaign (validated loudly — an unknown id
6
+ * fails the launch), `groupLabel` puts it in a label group created on first use. Either way the
7
+ * attach is daemon-side PROVENANCE only: the engine's run record carries no such field (the run
8
+ * executes byte-identically to an ungrouped launch, and the campaign scheduler never learns of
9
+ * it), so — exactly like retry lineage (CREW-UX-3) and the actor trail (task #88) — the durable
10
+ * record is the `run.launched` audit entry (`detail.campaignId` / `detail.groupLabel`), and this
11
+ * map is the read-side latency layer that lets `GET /runs` echo `campaign_id`/`group_label` and
12
+ * `GET /campaigns` serve `attached_runs` + the `groups` rows without a trail scan per request.
13
+ *
14
+ * Mirrors `RetryIndex`'s posture: hydrated once at server start (best-effort — a missing or
15
+ * unreadable trail leaves prior runs ungrouped, the pre-0.19 behavior, not an error) and updated
16
+ * at the same post-commit point that writes the audit entry, so the map can only lag by a failed
17
+ * hydrate, never diverge silently.
18
+ *
19
+ * SCAN BUDGET: this index consumes the SAME `run.launched` entries `RetryIndex` already scans,
20
+ * so it exposes {@link GroupIndex.hydrateFromLaunchEntries} and `createServer` feeds both
21
+ * indexes from ONE `readAll({ action: 'run.launched' })` — boot stays at three full-file trail
22
+ * scans, not four (the delivery-index consolidation note, crew#321).
23
+ */
24
+ export class GroupIndex {
25
+ runToAttach = new Map();
26
+ /** campaignId → attached run ids, launch order. */
27
+ campaignRuns = new Map();
28
+ /** label → member run ids, launch order. */
29
+ labelRuns = new Map();
30
+ /**
31
+ * Consume pre-read `run.launched` entries (NEWEST FIRST, `AuditLog.readAll`'s order —
32
+ * exhaustive, per BRIEF-UX-002 C5). The first entry seen per run wins, like the sibling
33
+ * indexes; member lists come out in LAUNCH order because insertion happens on a reversed
34
+ * walk. Idempotent per boot (called once).
35
+ */
36
+ hydrateFromLaunchEntries(entries) {
37
+ const seen = new Set();
38
+ const oldestFirst = [];
39
+ for (const entry of entries) {
40
+ if (typeof entry.runId !== 'string')
41
+ continue;
42
+ if (seen.has(entry.runId))
43
+ continue;
44
+ seen.add(entry.runId);
45
+ const campaignId = entry.detail?.['campaignId'];
46
+ const label = entry.detail?.['groupLabel'];
47
+ if (typeof campaignId === 'string' && campaignId !== '') {
48
+ oldestFirst.push({ runId: entry.runId, attach: { campaignId } });
49
+ }
50
+ else if (typeof label === 'string' && label !== '') {
51
+ oldestFirst.push({ runId: entry.runId, attach: { label } });
52
+ }
53
+ }
54
+ // The trail reads newest-first; one reverse restores launch order (unshift-in-loop is O(n²)).
55
+ oldestFirst.reverse();
56
+ for (const { runId, attach } of oldestFirst)
57
+ this.set(runId, attach);
58
+ }
59
+ /** Standalone hydrate (tests / direct use) — production shares the scan via `createServer`. */
60
+ async hydrate(audit, log) {
61
+ try {
62
+ this.hydrateFromLaunchEntries(await audit.readAll({ action: 'run.launched' }));
63
+ }
64
+ catch (err) {
65
+ log?.(`[runs] group-index hydrate failed (prior runs read as ungrouped until restart): ${err instanceof Error ? err.message : String(err)}`);
66
+ }
67
+ }
68
+ /** Record one launch's attach (post-commit, beside the audit write). */
69
+ set(runId, attach) {
70
+ if (this.runToAttach.has(runId))
71
+ return; // launch-time fact — first write wins
72
+ this.runToAttach.set(runId, attach);
73
+ if ('campaignId' in attach) {
74
+ const list = this.campaignRuns.get(attach.campaignId) ?? [];
75
+ list.push(runId);
76
+ this.campaignRuns.set(attach.campaignId, list);
77
+ }
78
+ else {
79
+ const list = this.labelRuns.get(attach.label) ?? [];
80
+ list.push(runId);
81
+ this.labelRuns.set(attach.label, list);
82
+ }
83
+ }
84
+ /** This run's attach, or `undefined` (the DTO spells that as ABSENT fields). */
85
+ attachOf(runId) {
86
+ return this.runToAttach.get(runId);
87
+ }
88
+ /** Run ids attached to this campaign, launch order (`[]` when none). */
89
+ attachedTo(campaignId) {
90
+ return [...(this.campaignRuns.get(campaignId) ?? [])];
91
+ }
92
+ /** Every label group: `{ label, runIds }` in first-use order, members in launch order. */
93
+ labelGroups() {
94
+ return [...this.labelRuns.entries()].map(([label, runIds]) => ({
95
+ label,
96
+ runIds: [...runIds],
97
+ }));
98
+ }
99
+ }
100
+ //# sourceMappingURL=group-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-index.js","sourceRoot":"","sources":["../../src/api/group-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,MAAM,OAAO,UAAU;IACJ,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC9D,mDAAmD;IAClC,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC5D,4CAA4C;IAC3B,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;IAEzD;;;;;OAKG;IACH,wBAAwB,CAAC,OAAqB;QAC5C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,WAAW,GAAkD,EAAE,CAAC;QACtE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;gBAAE,SAAS;YAC9C,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC;gBAAE,SAAS;YACpC,IAAI,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,CAAC;SACpB,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
@@ -28,6 +28,33 @@ export interface DeliverScriptResult {
28
28
  /** The exec seam the deliver route runs the script through — injectable so route tests can
29
29
  * point HOME/PATH at a fixture (a stub `gh`, a temp home) without touching the daemon env. */
30
30
  export type DeliverExec = (workdir: string, intent?: string) => Promise<DeliverScriptResult>;
31
+ /** A worktree stood back up from a run's `wicked/<id>` branch, plus its teardown (crew#418). */
32
+ export interface ReprovisionedWorktree {
33
+ /** The path to deliver in — a throwaway checkout of `wicked/<runId>`. */
34
+ workdir: string;
35
+ /** Remove the throwaway worktree; the `wicked/<runId>` branch (the record) survives. */
36
+ cleanup: () => Promise<void>;
37
+ }
38
+ /** The reprovision seam (crew#418) — injectable so route tests never shell out to git. Resolves
39
+ * to a throwaway worktree checked out on the run's branch, or `null` when the branch is gone. */
40
+ export type WorktreeReprovisioner = (repoRoot: string, runId: string) => Promise<ReprovisionedWorktree | null>;
41
+ /**
42
+ * Stand a run's committed work back up from its `wicked/<runId>` branch (crew#418).
43
+ *
44
+ * The engine REAPS a failed-deliver run's worktree once the deliver phase has committed the work
45
+ * (a clean tree; `git worktree remove` succeeds even with the branch ahead) — the work then lives
46
+ * ONLY on the `wicked/<runId>` branch, which the reap never deletes ("the checkout is scaffolding,
47
+ * the branch is the record"). A post-hoc lift therefore has no worktree to run in; this checks the
48
+ * branch out at a THROWAWAY path so the hardened deliver script can commit-nothing / rebase / push
49
+ * it. The path's basename is deliberately NOT the run id, so the script's branch derivation falls
50
+ * back to `git branch --show-current` — which the checkout puts on `wicked/<runId>` — instead of
51
+ * `wicked/<basename>`. Never touches the engine's recorded worktree path, so it cannot race the
52
+ * engine's own worktree bookkeeping.
53
+ *
54
+ * Resolves `null` when the branch does not exist (nothing to reprovision) — the caller then
55
+ * answers the same "nothing to deliver" refusal as a truly empty run.
56
+ */
57
+ export declare const gitReprovisionWorktree: WorktreeReprovisioner;
31
58
  /**
32
59
  * The production {@link DeliverExec}: `bash -lc <script>` in the run's worktree — the exact
33
60
  * invocation core's `run_tool_cmd` uses for the deliver phase (login shell, so the operator's
@@ -1 +1 @@
1
- {"version":3,"file":"post-hoc-deliver.d.ts","sourceRoot":"","sources":["../../src/api/post-hoc-deliver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,wFAAwF;AACxF,MAAM,WAAW,mBAAmB;IAClC,6FAA6F;IAC7F,MAAM,EAAE,MAAM,CAAC;IACf,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAC;IACf;+FAC2F;IAC3F,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;+FAC+F;AAC/F,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAQ7F;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CA+B9B"}
1
+ {"version":3,"file":"post-hoc-deliver.d.ts","sourceRoot":"","sources":["../../src/api/post-hoc-deliver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,wFAAwF;AACxF,MAAM,WAAW,mBAAmB;IAClC,6FAA6F;IAC7F,MAAM,EAAE,MAAM,CAAC;IACf,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAC;IACf;+FAC2F;IAC3F,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;+FAC+F;AAC/F,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE7F,gGAAgG;AAChG,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;kGACkG;AAClG,MAAM,MAAM,qBAAqB,GAAG,CAClC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,EAAE,qBAmCpC,CAAC;AAQF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CA+B9B"}
@@ -16,7 +16,61 @@
16
16
  * crew-side via `prUrlFrom`, the same grep the script itself ends with).
17
17
  */
18
18
  import { execFile } from 'node:child_process';
19
+ import { mkdtemp, rm } from 'node:fs/promises';
20
+ import { tmpdir } from 'node:os';
21
+ import { join } from 'node:path';
19
22
  import { deliverPrScript } from '../core/deliver.js';
23
+ /**
24
+ * Stand a run's committed work back up from its `wicked/<runId>` branch (crew#418).
25
+ *
26
+ * The engine REAPS a failed-deliver run's worktree once the deliver phase has committed the work
27
+ * (a clean tree; `git worktree remove` succeeds even with the branch ahead) — the work then lives
28
+ * ONLY on the `wicked/<runId>` branch, which the reap never deletes ("the checkout is scaffolding,
29
+ * the branch is the record"). A post-hoc lift therefore has no worktree to run in; this checks the
30
+ * branch out at a THROWAWAY path so the hardened deliver script can commit-nothing / rebase / push
31
+ * it. The path's basename is deliberately NOT the run id, so the script's branch derivation falls
32
+ * back to `git branch --show-current` — which the checkout puts on `wicked/<runId>` — instead of
33
+ * `wicked/<basename>`. Never touches the engine's recorded worktree path, so it cannot race the
34
+ * engine's own worktree bookkeeping.
35
+ *
36
+ * Resolves `null` when the branch does not exist (nothing to reprovision) — the caller then
37
+ * answers the same "nothing to deliver" refusal as a truly empty run.
38
+ */
39
+ export const gitReprovisionWorktree = async (repoRoot, runId) => {
40
+ const branch = `wicked/${runId}`;
41
+ const run = (args) => new Promise((resolve, reject) => {
42
+ execFile('git', ['-C', repoRoot, ...args], { windowsHide: true }, (err) => err === null ? resolve() : reject(err));
43
+ });
44
+ const dir = await mkdtemp(join(tmpdir(), `wicked-deliver-${runId.replace(/[^\w.-]/g, '_')}-`));
45
+ // Is the run's branch even there? Absent ⇒ the work is genuinely GONE → null (the route answers
46
+ // 409 "nothing to deliver"). This is the ONLY reason to report null: an OPERATIONAL git failure
47
+ // below (permissions, corruption, a busy repo) must surface as an error, not be misreported as
48
+ // "gone" — so it is left to throw and the route answers 500.
49
+ try {
50
+ await run(['rev-parse', '--verify', '--quiet', `refs/heads/${branch}`]);
51
+ }
52
+ catch {
53
+ await rm(dir, { recursive: true, force: true }).catch(() => undefined);
54
+ return null;
55
+ }
56
+ try {
57
+ // Drop any dangling admin entry the reap left, THEN check the branch out at the empty temp dir
58
+ // (`git worktree add` accepts an existing empty directory).
59
+ await run(['worktree', 'prune']);
60
+ await run(['worktree', 'add', dir, branch]);
61
+ }
62
+ catch (err) {
63
+ await rm(dir, { recursive: true, force: true }).catch(() => undefined);
64
+ throw err; // operational failure standing the worktree up — NOT "gone"
65
+ }
66
+ return {
67
+ workdir: dir,
68
+ cleanup: async () => {
69
+ await run(['worktree', 'remove', '--force', dir]).catch(() => undefined);
70
+ await rm(dir, { recursive: true, force: true }).catch(() => undefined);
71
+ },
72
+ };
73
+ };
20
74
  /** Everything the script prints stays bounded — 8 MiB is far past any real transcript. */
21
75
  const OUTPUT_CAP_BYTES = 8 * 1024 * 1024;
22
76
  /** A post-hoc lift talks to a real remote; 5 minutes is generous, hanging forever is not. */
@@ -1 +1 @@
1
- {"version":3,"file":"post-hoc-deliver.js","sourceRoot":"","sources":["../../src/api/post-hoc-deliver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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AAK,IAAI;aAC1D,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -13,8 +13,14 @@
13
13
  * the audit entry, so the map can only lag by a failed hydrate, never diverge silently.
14
14
  */
15
15
  import type { AuditLog } from './audit.js';
16
+ import type { AuditEntry } from '../core/types.js';
16
17
  export declare class RetryIndex {
17
18
  private readonly runToRetryOf;
19
+ /**
20
+ * Consume pre-read `run.launched` entries — the seam that lets `createServer` feed this index
21
+ * and `GroupIndex` from ONE trail scan (the delivery-index consolidation note, crew#321).
22
+ */
23
+ hydrateFromLaunchEntries(entries: AuditEntry[]): void;
18
24
  /**
19
25
  * Load lineage from EVERY `run.launched` entry in the trail — exhaustively, not capped
20
26
  * (BRIEF-UX-002 C5: a lineage fact 2,678 launches deep must survive a restart; the newest-1000
@@ -1 +1 @@
1
- {"version":3,"file":"retry-index.d.ts","sourceRoot":"","sources":["../../src/api/retry-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAE1D;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB1E,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIzC,4FAA4F;IAC5F,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG9C"}
1
+ {"version":3,"file":"retry-index.d.ts","sourceRoot":"","sources":["../../src/api/retry-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAE1D;;;OAGG;IACH,wBAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI;IASrD;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1E,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIzC,4FAA4F;IAC5F,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG9C"}
@@ -14,6 +14,18 @@
14
14
  */
15
15
  export class RetryIndex {
16
16
  runToRetryOf = new Map();
17
+ /**
18
+ * Consume pre-read `run.launched` entries — the seam that lets `createServer` feed this index
19
+ * and `GroupIndex` from ONE trail scan (the delivery-index consolidation note, crew#321).
20
+ */
21
+ hydrateFromLaunchEntries(entries) {
22
+ for (const entry of entries) {
23
+ const retryOf = entry.detail?.['retryOf'];
24
+ if (typeof entry.runId === 'string' && typeof retryOf === 'string') {
25
+ this.runToRetryOf.set(entry.runId, retryOf);
26
+ }
27
+ }
28
+ }
17
29
  /**
18
30
  * Load lineage from EVERY `run.launched` entry in the trail — exhaustively, not capped
19
31
  * (BRIEF-UX-002 C5: a lineage fact 2,678 launches deep must survive a restart; the newest-1000
@@ -23,12 +35,7 @@ export class RetryIndex {
23
35
  */
24
36
  async hydrate(audit, log) {
25
37
  try {
26
- for (const entry of await audit.readAll({ action: 'run.launched' })) {
27
- const retryOf = entry.detail?.['retryOf'];
28
- if (typeof entry.runId === 'string' && typeof retryOf === 'string') {
29
- this.runToRetryOf.set(entry.runId, retryOf);
30
- }
31
- }
38
+ this.hydrateFromLaunchEntries(await audit.readAll({ action: 'run.launched' }));
32
39
  }
33
40
  catch (err) {
34
41
  log?.(`[runs] retry-index hydrate failed (prior runs read as not-a-retry until restart): ${err instanceof Error ? err.message : String(err)}`);
@@ -1 +1 @@
1
- {"version":3,"file":"retry-index.js","sourceRoot":"","sources":["../../src/api/retry-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,OAAO,UAAU;IACJ,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1D;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,KAAe,EAAE,GAA2B;QACxD,IAAI,CAAC;YACH,KAAK,MAAM,KAAK,IAAI,MAAM,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC;gBACpE,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC1C,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;oBACnE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,EAAE,CACH,qFACE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,OAAe;QAChC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,4FAA4F;IAC5F,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF"}
1
+ {"version":3,"file":"retry-index.js","sourceRoot":"","sources":["../../src/api/retry-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,MAAM,OAAO,UAAU;IACJ,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1D;;;OAGG;IACH,wBAAwB,CAAC,OAAqB;QAC5C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;YAC1C,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACnE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,KAAe,EAAE,GAA2B;QACxD,IAAI,CAAC;YACH,IAAI,CAAC,wBAAwB,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QACjF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,EAAE,CACH,qFACE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,OAAe;QAChC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,4FAA4F;IAC5F,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -11,9 +11,10 @@ import type { DocLedgerSweep } from '../interactive/doc-ledger-sweep.js';
11
11
  import { AuditLog } from './audit.js';
12
12
  import { type ErrorRing } from './diagnostics.js';
13
13
  import { RetryIndex } from './retry-index.js';
14
+ import { GroupIndex } from './group-index.js';
14
15
  import { GuidanceIndex } from './guidance-index.js';
15
16
  import { DeliveryIndex } from './delivery-index.js';
16
- import { type DeliverExec } from './post-hoc-deliver.js';
17
+ import { type DeliverExec, type WorktreeReprovisioner } from './post-hoc-deliver.js';
17
18
  import { type AuthMode } from './auth.js';
18
19
  export { API_PREFIX } from './api-prefix.js';
19
20
  /**
@@ -29,7 +30,7 @@ export { API_PREFIX } from './api-prefix.js';
29
30
  * schema does not accept — so `.strict()` is what turns that trip into a 400 instead of an
30
31
  * unworkflowed run reported as `201`.
31
32
  */
32
- export declare const LaunchSchema: z.ZodEffects<z.ZodObject<{
33
+ export declare const LaunchSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
33
34
  problem: z.ZodString;
34
35
  sessionId: z.ZodOptional<z.ZodString>;
35
36
  clisJson: z.ZodOptional<z.ZodString>;
@@ -52,10 +53,22 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodObject<{
52
53
  * (the route checks the store and 400s with a named error otherwise); persisted via the
53
54
  * `run.launched` audit entry + retry index and echoed as `AgentSession.retry_of`. */
54
55
  retryOf: z.ZodOptional<z.ZodString>;
56
+ /** wicked-studio#27 (api-types 0.19.0) — attach this AD-HOC run to an EXISTING campaign's
57
+ * surface. Validated against the campaign store before anything launches (unknown ⇒ 404,
58
+ * engine without campaign bindings ⇒ 501 — never a silently dropped attach); persisted via
59
+ * the `run.launched` audit entry + group index, echoed as `AgentSession.campaign_id`, and
60
+ * served under `Campaign.attached_runs`. Provenance only: the run is NOT a DAG node. */
61
+ campaignId: z.ZodOptional<z.ZodString>;
62
+ /** wicked-studio#27 (api-types 0.19.0) — ad-hoc label group, created on first use: runs
63
+ * sharing a label form one `RunGroup` on `GET /campaigns`. Persisted/echoed like
64
+ * `campaignId` (as `AgentSession.group_label`). */
65
+ groupLabel: z.ZodOptional<z.ZodString>;
55
66
  }, "strict", z.ZodTypeAny, {
56
67
  problem: string;
57
68
  deliver?: "pr" | "none" | undefined;
58
69
  projectId?: string | undefined;
70
+ campaignId?: string | undefined;
71
+ groupLabel?: string | undefined;
59
72
  workflow?: string | undefined;
60
73
  repoRef?: string | undefined;
61
74
  clisJson?: string | undefined;
@@ -67,6 +80,8 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodObject<{
67
80
  problem: string;
68
81
  deliver?: "pr" | "none" | undefined;
69
82
  projectId?: string | undefined;
83
+ campaignId?: string | undefined;
84
+ groupLabel?: string | undefined;
70
85
  workflow?: string | undefined;
71
86
  repoRef?: string | undefined;
72
87
  clisJson?: string | undefined;
@@ -78,6 +93,8 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodObject<{
78
93
  problem: string;
79
94
  deliver?: "pr" | "none" | undefined;
80
95
  projectId?: string | undefined;
96
+ campaignId?: string | undefined;
97
+ groupLabel?: string | undefined;
81
98
  workflow?: string | undefined;
82
99
  repoRef?: string | undefined;
83
100
  clisJson?: string | undefined;
@@ -89,6 +106,34 @@ export declare const LaunchSchema: z.ZodEffects<z.ZodObject<{
89
106
  problem: string;
90
107
  deliver?: "pr" | "none" | undefined;
91
108
  projectId?: string | undefined;
109
+ campaignId?: string | undefined;
110
+ groupLabel?: string | undefined;
111
+ workflow?: string | undefined;
112
+ repoRef?: string | undefined;
113
+ clisJson?: string | undefined;
114
+ sessionId?: string | undefined;
115
+ retryOf?: string | undefined;
116
+ entityMode?: "shared" | "isolated" | undefined;
117
+ humanConfirm?: string | undefined;
118
+ }>, {
119
+ problem: string;
120
+ deliver?: "pr" | "none" | undefined;
121
+ projectId?: string | undefined;
122
+ campaignId?: string | undefined;
123
+ groupLabel?: string | undefined;
124
+ workflow?: string | undefined;
125
+ repoRef?: string | undefined;
126
+ clisJson?: string | undefined;
127
+ sessionId?: string | undefined;
128
+ retryOf?: string | undefined;
129
+ entityMode?: "shared" | "isolated" | undefined;
130
+ humanConfirm?: string | undefined;
131
+ }, {
132
+ problem: string;
133
+ deliver?: "pr" | "none" | undefined;
134
+ projectId?: string | undefined;
135
+ campaignId?: string | undefined;
136
+ groupLabel?: string | undefined;
92
137
  workflow?: string | undefined;
93
138
  repoRef?: string | undefined;
94
139
  clisJson?: string | undefined;
@@ -162,6 +207,10 @@ export interface RuntimeDeps {
162
207
  /** Run→retry-lineage index (CREW-UX-3) — `createServer` hydrates one from the audit trail so
163
208
  * a restarted daemon still echoes `retry_of`; a directly-driven route set gets a fresh one. */
164
209
  retryIndex?: RetryIndex;
210
+ /** Run→ad-hoc-group index (wicked-studio#27) — `createServer` hydrates one from the audit
211
+ * trail (the SAME `run.launched` scan as `retryIndex`) so attaches survive a restart; a
212
+ * directly-driven route set gets a fresh one. */
213
+ groupIndex?: GroupIndex;
165
214
  /** Run→operator-guidance index (CREW-UX-7) — `createServer` hydrates one from the audit trail
166
215
  * so a restarted daemon still echoes `guidance`; a directly-driven route set gets a fresh one. */
167
216
  guidanceIndex?: GuidanceIndex;
@@ -186,6 +235,10 @@ export interface RuntimeDeps {
186
235
  * deliver script in a run's worktree. Injectable so route tests aim the spawn's HOME/PATH at
187
236
  * a fixture (stub `gh`, local bare origin); defaults to the real `bash -lc` spawn. */
188
237
  deliverExec?: DeliverExec;
238
+ /** Stand a lift-conflict-stranded run's worktree back up from its `wicked/<id>` branch when the
239
+ * engine has reaped it (crew#418) — the post-hoc deliver path uses it before the exec above.
240
+ * Injectable so route tests never shell out to git; defaults to {@link gitReprovisionWorktree}. */
241
+ reprovisionWorktree?: WorktreeReprovisioner;
189
242
  openWithOs?: (target: string) => Promise<void>;
190
243
  /** Seat sign-in presence probe (seat sign-in) — injectable so route tests never read the
191
244
  * developer's real dotfiles. Defaults to the file/env heuristic in seat-signin.ts. */
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/api/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,SAAS,CAAC;AAC7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