wicked-crew 0.7.28 → 0.7.29

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 (96) hide show
  1. package/README.md +9 -1
  2. package/dist/api/chat-scope.d.ts +210 -0
  3. package/dist/api/chat-scope.d.ts.map +1 -0
  4. package/dist/api/chat-scope.js +724 -0
  5. package/dist/api/chat-scope.js.map +1 -0
  6. package/dist/api/diagnostics.d.ts +30 -2
  7. package/dist/api/diagnostics.d.ts.map +1 -1
  8. package/dist/api/diagnostics.js +73 -5
  9. package/dist/api/diagnostics.js.map +1 -1
  10. package/dist/api/governance-health.d.ts +163 -0
  11. package/dist/api/governance-health.d.ts.map +1 -0
  12. package/dist/api/governance-health.js +348 -0
  13. package/dist/api/governance-health.js.map +1 -0
  14. package/dist/api/open-path.d.ts.map +1 -1
  15. package/dist/api/open-path.js +2 -1
  16. package/dist/api/open-path.js.map +1 -1
  17. package/dist/api/post-hoc-deliver.d.ts +9 -5
  18. package/dist/api/post-hoc-deliver.d.ts.map +1 -1
  19. package/dist/api/post-hoc-deliver.js +21 -7
  20. package/dist/api/post-hoc-deliver.js.map +1 -1
  21. package/dist/api/routes.d.ts +48 -12
  22. package/dist/api/routes.d.ts.map +1 -1
  23. package/dist/api/routes.js +309 -48
  24. package/dist/api/routes.js.map +1 -1
  25. package/dist/api/seat-health.d.ts.map +1 -1
  26. package/dist/api/seat-health.js +25 -5
  27. package/dist/api/seat-health.js.map +1 -1
  28. package/dist/api/seat-signin.d.ts.map +1 -1
  29. package/dist/api/seat-signin.js +49 -23
  30. package/dist/api/seat-signin.js.map +1 -1
  31. package/dist/api/server.d.ts.map +1 -1
  32. package/dist/api/server.js +20 -0
  33. package/dist/api/server.js.map +1 -1
  34. package/dist/campaigns/routes.d.ts +4 -4
  35. package/dist/cli/governance.d.ts +131 -0
  36. package/dist/cli/governance.d.ts.map +1 -0
  37. package/dist/cli/governance.js +354 -0
  38. package/dist/cli/governance.js.map +1 -0
  39. package/dist/cli/index.js +69 -2
  40. package/dist/cli/index.js.map +1 -1
  41. package/dist/core/adapter.d.ts +89 -1
  42. package/dist/core/adapter.d.ts.map +1 -1
  43. package/dist/core/adapter.js +123 -7
  44. package/dist/core/adapter.js.map +1 -1
  45. package/dist/core/bridge-reaper.d.ts.map +1 -1
  46. package/dist/core/bridge-reaper.js +4 -1
  47. package/dist/core/bridge-reaper.js.map +1 -1
  48. package/dist/core/deliver-text.d.ts +184 -0
  49. package/dist/core/deliver-text.d.ts.map +1 -0
  50. package/dist/core/deliver-text.js +434 -0
  51. package/dist/core/deliver-text.js.map +1 -0
  52. package/dist/core/deliver-triage.d.ts +90 -0
  53. package/dist/core/deliver-triage.d.ts.map +1 -0
  54. package/dist/core/deliver-triage.js +106 -0
  55. package/dist/core/deliver-triage.js.map +1 -0
  56. package/dist/core/deliver.d.ts +103 -9
  57. package/dist/core/deliver.d.ts.map +1 -1
  58. package/dist/core/deliver.js +244 -46
  59. package/dist/core/deliver.js.map +1 -1
  60. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  61. package/dist/core/estate-mcp-client.js +7 -2
  62. package/dist/core/estate-mcp-client.js.map +1 -1
  63. package/dist/core/exec.d.ts.map +1 -1
  64. package/dist/core/exec.js +11 -1
  65. package/dist/core/exec.js.map +1 -1
  66. package/dist/core/governance-store.d.ts +197 -0
  67. package/dist/core/governance-store.d.ts.map +1 -0
  68. package/dist/core/governance-store.js +283 -0
  69. package/dist/core/governance-store.js.map +1 -0
  70. package/dist/core/repoPaths.d.ts +36 -5
  71. package/dist/core/repoPaths.d.ts.map +1 -1
  72. package/dist/core/repoPaths.js +46 -4
  73. package/dist/core/repoPaths.js.map +1 -1
  74. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  75. package/dist/interactive/bridge-pool.js +9 -4
  76. package/dist/interactive/bridge-pool.js.map +1 -1
  77. package/dist/projects/graph-paths.d.ts +4 -2
  78. package/dist/projects/graph-paths.d.ts.map +1 -1
  79. package/dist/projects/graph-paths.js +4 -2
  80. package/dist/projects/graph-paths.js.map +1 -1
  81. package/dist/projects/graph.d.ts +5 -4
  82. package/dist/projects/graph.d.ts.map +1 -1
  83. package/dist/projects/graph.js +22 -5
  84. package/dist/projects/graph.js.map +1 -1
  85. package/dist/projects/routes.d.ts.map +1 -1
  86. package/dist/projects/routes.js +18 -9
  87. package/dist/projects/routes.js.map +1 -1
  88. package/dist/skills/plugin-source.d.ts.map +1 -1
  89. package/dist/skills/plugin-source.js +3 -0
  90. package/dist/skills/plugin-source.js.map +1 -1
  91. package/dist/studio/assets/index-CeJTutxP.js +540 -0
  92. package/dist/studio/index.html +1 -1
  93. package/dist/studio/testid-inventory.json +212 -6
  94. package/endpoint-manifest.json +60 -12
  95. package/package.json +3 -3
  96. package/dist/studio/assets/index-CdmCMh2f.js +0 -539
@@ -11,6 +11,15 @@
11
11
  * to the current branch when that ref does not exist;
12
12
  * (b) the script REFUSES to push `main`/`master` (or an empty/detached branch name) — the
13
13
  * deliver phase only ever pushes run branches;
14
+ * (b2) with the engine's `WICKED_DELIVER_VERIFIED_BASE` pin set (wicked-core#431 / #433: the
15
+ * remote-tip commit the engine lifted the work onto and re-verified against), it REFUSES —
16
+ * before staging anything — when origin's default branch no longer resolves to that commit
17
+ * after its own fetch ({@link DELIVER_BASE_MOVED_MARKER}): a base that moved past the verified
18
+ * one is re-verified by the engine's retry, never rebased past by this script;
19
+ * (b3) the crew#426 preflight (lockfile re-sync + codegen) runs AFTER the engine's verification;
20
+ * when it changes the worktree, an engine-driven delivery REFUSES and names the files
21
+ * ({@link DELIVER_PREFLIGHT_CHANGED_MARKER}) — a post-hoc lift ({@link DELIVER_POSTHOC_ENV})
22
+ * keeps the regeneration and says so;
14
23
  * (c) it STAGES AND COMMITS the run's work, then rebases onto origin's default branch before
15
24
  * pushing. A conflict whose conflicted paths are ALL `CHANGELOG.md` is union-merged (both
16
25
  * sides' additive lines kept) and the rebase continues — the crew#418 collision magnet, made
@@ -19,8 +28,15 @@
19
28
  * pushed conflicted tree;
20
29
  * (d) `git push -u origin <branch>` — every rejected push carries the recovery marker. The run
21
30
  * work is already committed locally, so an operator can repair auth/transport and retry;
22
- * (e) `gh pr create --head <branch> --fill`, with gh's output and exit status captured
23
- * SEPARATELY so a gh failure fails the phase carrying gh's own message;
31
+ * (e) `gh pr create --head <branch> --title … --body-file …`, with gh's output and exit status
32
+ * captured SEPARATELY so a gh failure fails the phase carrying gh's own message. The title
33
+ * and body are COMPOSED FROM THE RUN (crew#524 / F-3R2-014, `core/deliver-text.ts`): the
34
+ * script asks the daemon that launched it (`GET /runs/:id/deliver-text`) for the text derived
35
+ * from the persisted run record — intent, `Fixes #N`, run link, phases + seats + gate
36
+ * outcomes, repo checks with exit codes, the evaluator verdict — and falls back to the same
37
+ * composer's launch-time text (embedded in the script) when the daemon cannot answer. The
38
+ * commit the phase makes for uncommitted work carries that same text (`git commit -F`), so
39
+ * ITS subject is the PR title; a run that committed incrementally keeps its own commits;
24
40
  * (f) the PR URL is the last line of the phase output.
25
41
  *
26
42
  * One deliberate change from the field version: NO gh account is baked into crew code (the
@@ -58,6 +74,7 @@
58
74
  * nothing re-derived what it claimed. It now declares `verified_evidence: true` — see
59
75
  * {@link deliverPrPhase}.
60
76
  */
77
+ import { composeEmbeddedDeliverText, factsFromWorkflow, framedDeliverText, runUrlFor, urlPathSegment, } from './deliver-text.js';
61
78
  /**
62
79
  * The content-address of wicked-core's built-in evidence floor (`builtin_floors::EVIDENCE_FLOOR_PIN`,
63
80
  * criterion "the run left a change in its worktree (done is re-derived from the diff, never
@@ -88,27 +105,84 @@ export const DELIVER_PHASE_ID = 'deliver';
88
105
  * terminal run failures exactly as before (the crew#400 refusal-vs-infra posture).
89
106
  */
90
107
  export const DELIVER_LIFT_CONFLICT_MARKER = 'deliver: LIFT-CONFLICT';
91
- /** How much of the run's intent rides in the commit subject before it is truncated. */
92
- const INTENT_SUBJECT_CAP = 72;
93
108
  /**
94
- * The run's intent, reduced to something safe to embed in a single-quoted shell assignment and
95
- * to use as a one-line commit subject.
96
- *
97
- * The intent is caller-supplied free text off `POST /runs`, and it is being spliced into a bash
98
- * script — so this is a containment boundary, not cosmetics. Control characters (newlines
99
- * included) and the single quote are REMOVED: with no `'` left, the value cannot escape the
100
- * single-quoted assignment the script wraps it in, and with no control characters it cannot add
101
- * a line. Everything else (unicode, `$`, backticks, backslashes) is inert inside single quotes
102
- * and is kept, so the subject still reads like the intent it came from.
109
+ * The env var the engine hands the deliver command with the remote-tip commit it VERIFIED the
110
+ * run's work against (wicked-core#431 / #433, `deliver_lift.rs` `VERIFIED_BASE_ENV`): set on a
111
+ * lift outcome of `unchanged` or `lifted`, absent when the lift was skipped (no remote, no default
112
+ * ref, a branch carrying its own commits) — and never set on a post-hoc `POST /runs/:id/deliver`,
113
+ * which has no engine verification to pin to (`api/post-hoc-deliver.ts` strips it).
114
+ */
115
+ export const DELIVER_VERIFIED_BASE_ENV = 'WICKED_DELIVER_VERIFIED_BASE';
116
+ /**
117
+ * The sentinel the deliver script prints when `origin/<default>` no longer resolves to
118
+ * {@link DELIVER_VERIFIED_BASE_ENV} after the script's own fetch: the remote advanced between the
119
+ * engine's re-verify and the push window, so the rebase below would carry the base PAST what was
120
+ * verified. The script refuses BEFORE staging anything. Deliberately NOT a
121
+ * {@link DELIVER_LIFT_CONFLICT_MARKER}: a moved base is not a recoverable strand — a post-hoc lift
122
+ * would push a tree nobody verified on the new base; the remedy is the engine's own retry (approve
123
+ * the deliver gate: it lifts onto the new tip and re-runs the repository's checks first).
124
+ */
125
+ export const DELIVER_BASE_MOVED_MARKER = 'deliver: BASE MOVED since verification';
126
+ /**
127
+ * The env var the daemon sets on a POST-HOC lift (`POST /runs/:id/deliver`, `api/post-hoc-deliver.ts`)
128
+ * and the engine never does. A post-hoc lift has no engine verification to protect, so the
129
+ * crew#426 preflight may regenerate tracked files and deliver them (disclosed); an engine-driven
130
+ * deliver Tool unit — the variable absent — refuses instead ({@link DELIVER_PREFLIGHT_CHANGED_MARKER}).
131
+ */
132
+ export const DELIVER_POSTHOC_ENV = 'WICKED_DELIVER_POSTHOC';
133
+ /**
134
+ * The sentinel the deliver script prints when the crew#426 preflight (`npm install` + the
135
+ * `manifest:endpoints` / `generate:api-tests` codegen) CHANGED the worktree AFTER the engine had
136
+ * verified it (wicked-core#433 review addendum): the tree that would ship is then not the tree the
137
+ * repository's checks certified, and the script refuses before staging anything, leaving the
138
+ * regenerated files in the worktree. Not a {@link DELIVER_LIFT_CONFLICT_MARKER}: the remedy is to
139
+ * approve the retry — the engine re-verifies the changed tree first, and the retry's preflight
140
+ * regenerates nothing more.
141
+ */
142
+ export const DELIVER_PREFLIGHT_CHANGED_MARKER = 'deliver: PREFLIGHT CHANGED the verified tree';
143
+ /**
144
+ * The BASE heredoc delimiter the script writes its fallback text through. A QUOTED heredoc expands
145
+ * nothing — `$`, backticks, quotes and backslashes in the intent are inert — so the only way the
146
+ * caller-supplied text could break out is a line equal to the delimiter. That line is never
147
+ * removed or altered (it may be the title itself — Copilot on #525): {@link heredocDelimiter}
148
+ * picks a delimiter no line of the text equals, so the text rides verbatim and the heredoc still
149
+ * ends exactly where the script says it ends.
150
+ */
151
+ export const DELIVER_TEXT_HEREDOC = 'WICKED_CREW_DELIVER_TEXT_EOF';
152
+ /**
153
+ * The framed PR/commit text as heredoc body lines. This is a containment boundary, not cosmetics:
154
+ * the intent is caller-supplied free text off `POST /runs` and it is being spliced into a bash
155
+ * script. CR and every control character other than tab and newline are removed (a bare CR could
156
+ * split a line in the CLI's eyes); nothing else is touched.
157
+ */
158
+ export function heredocLines(framed) {
159
+ return framed
160
+ .replace(/\r/g, '')
161
+ .replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, '')
162
+ .replace(/\n$/, '')
163
+ .split('\n');
164
+ }
165
+ /**
166
+ * A heredoc delimiter none of `lines` equals: the base, or the base with a numeric suffix
167
+ * (`…_EOF_1`, `…_EOF_2`, …) when the text happens to carry the base as a whole line. The framing
168
+ * (line 1 = title) is therefore never disturbed by containment.
169
+ */
170
+ export function heredocDelimiter(lines) {
171
+ let delimiter = DELIVER_TEXT_HEREDOC;
172
+ for (let n = 1; lines.includes(delimiter); n += 1)
173
+ delimiter = `${DELIVER_TEXT_HEREDOC}_${n}`;
174
+ return delimiter;
175
+ }
176
+ /**
177
+ * The daemon origin as a single-quoted shell literal, or `''` when it is not a plain http(s)
178
+ * origin. Same containment logic as the heredoc: nothing that is not `scheme://host[:port]` is
179
+ * ever spliced into the script, so a hostile value can only cost the callback, never a line.
103
180
  */
104
- function commitSubjectIntent(intent) {
105
- return (intent ?? '')
106
- .replace(/[\u0000-\u001f\u007f]+/g, ' ')
107
- .replace(/'/g, '')
108
- .replace(/\s+/g, ' ')
109
- .trim()
110
- .slice(0, INTENT_SUBJECT_CAP)
111
- .trim();
181
+ function apiOriginLiteral(origin) {
182
+ if (origin === null || origin === undefined)
183
+ return '';
184
+ const trimmed = origin.replace(/\/+$/, '');
185
+ return /^https?:\/\/[A-Za-z0-9.\-[\]:]+$/.test(trimmed) ? trimmed : '';
112
186
  }
113
187
  /**
114
188
  * The hardened deliver script, run as `bash -lc <script>` (login shell so the operator's PATH —
@@ -119,10 +193,34 @@ function commitSubjectIntent(intent) {
119
193
  * `StepStatus::Failed`. It is no longer the ONLY thing standing between a failed `gh` and a green
120
194
  * phase, though — the gh result is captured explicitly and success is re-derived from evidence.
121
195
  *
122
- * `intent` (the run's problem statement) rides in the commit subject; it is sanitised by
123
- * {@link commitSubjectIntent} before it is spliced in.
196
+ * `intent` (the run's problem statement) is what the PR title and the commit subject are composed
197
+ * from (`core/deliver-text.ts`); `opts` carries the rest of the launch-time facts and the daemon
198
+ * origin the script asks for the run-derived text (crew#524).
124
199
  */
125
- export function deliverPrScript(intent) {
200
+ export function deliverPrScript(intent, opts = {}) {
201
+ const runId = opts.runId ?? opts.facts?.runId ?? '';
202
+ const facts = opts.facts ??
203
+ factsFromWorkflow({
204
+ runId,
205
+ intent,
206
+ workflowId: null,
207
+ repoRef: null,
208
+ phases: [],
209
+ runUrl: null,
210
+ });
211
+ // The EMBEDDED fallback is bounded (`EMBEDDED_INTENT_CAP`): this script is one argv entry, and an
212
+ // unbounded intent could exceed the platform's single-argument limit and E2BIG the phase before
213
+ // it runs (Copilot on #525). The daemon-fetched text is never bounded this way. The issue
214
+ // references (`Fixes #N` / `Refs:`) are derived from the FULL intent before the cut, so a closing
215
+ // reference written past the cap still reaches the PR body (wave-3 isolation review).
216
+ const fallback = composeEmbeddedDeliverText(facts);
217
+ const api = apiOriginLiteral(opts.apiOrigin);
218
+ const fallbackLines = heredocLines(framedDeliverText(fallback));
219
+ const heredoc = heredocDelimiter(fallbackLines);
220
+ // The run id for the daemon URL: the LAUNCH id when the composer knows it, pre-encoded as one
221
+ // strict path segment (only `[A-Za-z0-9._~%-]` survive, so the single-quoted literal is safe);
222
+ // otherwise derived from the branch at run time and percent-encoded byte-wise by the script.
223
+ const runIdSegment = runId === '' ? '' : urlPathSegment(runId);
126
224
  return [
127
225
  'set -euo pipefail',
128
226
  // The engine concatenates the child's stdout and THEN its stderr, so anything git writes to
@@ -141,7 +239,12 @@ export function deliverPrScript(intent) {
141
239
  // Derive origin's default branch FIRST — the refusal below must cover a repo whose
142
240
  // default is trunk/develop/anything, not just main/master (Copilot on #303).
143
241
  'git fetch origin',
144
- 'D=$(git symbolic-ref -q --short refs/remotes/origin/HEAD || echo origin/main)',
242
+ // …the way the ENGINE derives it (wicked-core `deliver_lift.rs`, review F-527-003): origin/HEAD
243
+ // when it resolves to a commit — a DANGLING origin/HEAD (the remote's default branch renamed or
244
+ // deleted since the clone) is tolerated — else origin/main, else origin/master, else origin/main
245
+ // for the refusal texts. A repo whose base is origin/master must never read as a moved base.
246
+ 'D=$(git symbolic-ref -q --short refs/remotes/origin/HEAD || true)',
247
+ 'if [ -z "$D" ] || ! git rev-parse --verify -q "$D^{commit}" >/dev/null; then if git rev-parse --verify -q origin/main^{commit} >/dev/null; then D=origin/main; elif git rev-parse --verify -q origin/master^{commit} >/dev/null; then D=origin/master; else D=origin/main; fi; fi',
145
248
  'DEF="${D#origin/}"',
146
249
  // (b) Refuse the repo's own default branch (by derived name), the classic names, and an
147
250
  // empty name (detached HEAD), which would otherwise turn the push into a garbage ref.
@@ -151,6 +254,26 @@ export function deliverPrScript(intent) {
151
254
  // would put one branch's work on another and push a branch that never saw it. Refuse instead.
152
255
  'C=$(git branch --show-current)',
153
256
  '[ "$C" = "$B" ] || { echo "deliver: the worktree is on \'$C\' but the run branch is \'$B\' — refusing to commit one branch\'s work onto another; nothing was pushed"; exit 1; }',
257
+ // (a2) VERIFIED-BASE PIN (wicked-core#431 / #433). Before this script runs, the engine LIFTED the
258
+ // run's work onto the remote default branch's tip and re-ran the repository's checks when the
259
+ // lift changed the tree; it hands the tip it verified against as WICKED_DELIVER_VERIFIED_BASE
260
+ // (absent when its lift was skipped — no remote, no default ref, a branch carrying its own
261
+ // commits — and on a post-hoc `POST /runs/:id/deliver`, which has no engine verification to pin
262
+ // to). The engine's fetch and this script's fetch are two moments: a remote that advances in
263
+ // between would make the rebase below carry the base PAST what was verified — F-3R2-013's
264
+ // verified≠delivered gap, one window later. So when the pin is set and origin/<default> no
265
+ // longer resolves to it, REFUSE, here, before anything is staged or committed: the worktree
266
+ // stays exactly as the engine left it, so an approved retry re-lifts onto the new tip and
267
+ // re-verifies from scratch. Deliberately NO LIFT-CONFLICT marker (see
268
+ // DELIVER_BASE_MOVED_MARKER). An unresolvable default ref with the pin set refuses the same way
269
+ // (fail closed): the script cannot prove the base it is about to rebase onto. The MARKER TRAILS
270
+ // the line (review F-527-001): the engine keeps head-150 + tail-250 chars of the WHOLE output, and
271
+ // this line follows the fetch's chatter, so a marker at its head would be elided while a trailing
272
+ // one always lands in the tail — as the LIFT-CONFLICT push-failure line below already does.
273
+ 'if [ -n "${WICKED_DELIVER_VERIFIED_BASE:-}" ]; then',
274
+ ' T=$(git rev-parse --verify -q "$D^{commit}" || true)',
275
+ ` [ "$T" = "$WICKED_DELIVER_VERIFIED_BASE" ] || { echo "deliver: the engine verified this work against $WICKED_DELIVER_VERIFIED_BASE but $D is now \${T:-unresolvable} — refusing to rebase past the verified base; approve to retry the deliver phase (the engine lifts onto the new tip and re-runs the repository checks before pushing). Nothing was staged, committed or pushed; ${DELIVER_BASE_MOVED_MARKER} ($D now \${T:-unresolvable}, verified $WICKED_DELIVER_VERIFIED_BASE)"; exit 1; }`,
276
+ 'fi',
154
277
  // A failed PUSH happens after the product was committed. Keep its worktree from being reaped
155
278
  // by leaving this reserved, untracked recovery sentinel; it is removed HERE (before staging)
156
279
  // so a normal delivery never sees it, and a retry removes it before another attempt (crew#432).
@@ -163,8 +286,53 @@ export function deliverPrScript(intent) {
163
286
  // pushing nothing, if that config is missing). Staging is two passes (see below): tracked
164
287
  // changes always ride; untracked paths ride UNLESS a scratch/key-material classifier excludes
165
288
  // them — and every exclusion is reported loudly (crew#434).
166
- `I='${commitSubjectIntent(intent)}'`,
167
- 'if [ -n "$I" ]; then M="wicked-crew run $R: $I"; else M="wicked-crew run $R"; fi',
289
+ //
290
+ // (c1-text) THE PR TITLE + BODY AND THE COMMIT MESSAGE (crew#524 / F-3R2-014). `--fill` gave
291
+ // wicked-studio#249 a title cut mid-word and an EMPTY body. The text now comes from the run:
292
+ // the script asks the daemon that launched it for `GET /runs/<id>/deliver-text` — composed from
293
+ // the persisted run record (phases + seats + gate outcomes, repo checks with exit codes, the
294
+ // evaluator verdict, the run link) — and falls back to the launch-time composition embedded
295
+ // below (intent, `Fixes #N`, run id, phase list) when the daemon cannot answer: no origin
296
+ // known, no `curl`, an auth-required daemon (401), a daemon that went away. Either way the text
297
+ // is FRAMED the same (line 1 title, line 2 blank, then the body), it is the commit message
298
+ // verbatim (`git commit -F`: git takes the first paragraph as the subject), and the PR is
299
+ // opened with `--title` + `--body-file` from it. WHICH text was used is always said in the
300
+ // output — every branch below prints its reason (Copilot on #525): no origin known, no curl,
301
+ // the daemon did not answer, or the run record was fetched.
302
+ 'TD=$(mktemp -d)',
303
+ "trap 'rm -rf \"$TD\"' EXIT",
304
+ // One URL path segment, RFC 3986: unreserved bytes verbatim, everything else `%XX` (byte-wise
305
+ // under LC_ALL=C so multibyte characters encode per byte, as a URL requires). Used only when
306
+ // the composer did not bake the launch id in (Copilot on #525: `/`, `#`, `?` in an id must
307
+ // not change the request path).
308
+ "_urlenc() { local LC_ALL=C s=\"$1\" out=\"\" i c; for ((i=0; i<${#s}; i++)); do c=\"${s:i:1}\"; case \"$c\" in [A-Za-z0-9._~-]) out+=\"$c\";; *) out+=$(printf '%%%02X' \"'$c\");; esac; done; printf '%s' \"$out\"; }",
309
+ `RUNID='${runIdSegment}'`,
310
+ '[ -n "$RUNID" ] || RUNID=$(_urlenc "${B#wicked/}")',
311
+ // Is the fetched text FRAMED as promised — non-empty title line, blank line 2, a non-empty body?
312
+ // Anything else (a proxy page, a stale endpoint's JSON, a bare title) is not the run record
313
+ // and must not become the PR text (Copilot on #525).
314
+ "_framed() { [ -s \"$1\" ] && [ -n \"$(sed -n 1p \"$1\")\" ] && [ -z \"$(sed -n 2p \"$1\")\" ] && [ -n \"$(sed -n '3,$p' \"$1\" | tr -d '[:space:]' | head -c 1)\" ]; }",
315
+ `API='${api}'`,
316
+ 'if [ -z "$API" ]; then',
317
+ ' echo "deliver: no daemon origin was known when this run launched — using the launch-time PR text"',
318
+ 'elif ! command -v curl >/dev/null 2>&1; then',
319
+ ' echo "deliver: curl is not available in this shell — using the launch-time PR text"',
320
+ // `--noproxy "*"`: the daemon is loopback; an operator shell's http_proxy must not swallow it.
321
+ 'elif curl -fsS -m 20 --noproxy "*" -H "Accept: text/plain" "$API/api/v1/runs/$RUNID/deliver-text" -o "$TD/text" 2>/dev/null && _framed "$TD/text"; then',
322
+ ' echo "deliver: PR text composed from the run record ($API)"',
323
+ 'else',
324
+ ' rm -f "$TD/text"',
325
+ ' echo "deliver: the daemon at $API did not answer with the run record — using the launch-time PR text"',
326
+ 'fi',
327
+ 'if [ ! -s "$TD/text" ]; then',
328
+ // The delimiter is chosen so no line of the text equals it (heredocDelimiter) — the text,
329
+ // title line included, is never filtered.
330
+ ` cat > "$TD/text" <<'${heredoc}'`,
331
+ ...fallbackLines,
332
+ heredoc,
333
+ 'fi',
334
+ 'TITLE=$(sed -n 1p "$TD/text")',
335
+ "sed '1,2d' \"$TD/text\" > \"$TD/body\"",
168
336
  // (c0) DELIVER PREFLIGHT (crew#426) — a governed run that bumps an internal WORKSPACE package's
169
337
  // version (e.g. packages/crew-api-types) leaves its version-derived codegen AND the lockfile
170
338
  // stale. A per-run worktree is provisioned with `git worktree add` alone — no `node_modules` —
@@ -191,10 +359,37 @@ export function deliverPrScript(intent) {
191
359
  // for a workspace-internal bump (no new tarball to fetch), so a restricted network does not fail
192
360
  // delivery. A genuine failure of a step that DID apply stays LOUD (no LIFT-CONFLICT marker →
193
361
  // terminal run failure), preserving the phase's refusal posture — the preflight adds no new strand.
362
+ //
363
+ // (c0-guard) THE PREFLIGHT MUST NOT WEAKEN THE VERIFIED TREE (wicked-core#433 review addendum).
364
+ // The engine verified the worktree BEFORE this script runs; the re-sync above runs AFTER it. If
365
+ // the regeneration changes any file, the tree that would ship is no longer the tree the
366
+ // repository's checks certified. So the worktree CONTENT is snapshotted as a tree id before and
367
+ // after (through a scratch index — the real index is untouched) and compared. An engine-driven
368
+ // delivery (a Tool unit; WICKED_DELIVER_POSTHOC unset) REFUSES on a change and names the files.
369
+ // The regenerated files stay in the worktree, so the remedy is simply to approve the retry: the
370
+ // engine re-verifies the changed tree (tree ≠ recorded verified tree ⇒ the checks run) before
371
+ // this script runs again, and the retry's preflight regenerates nothing. The crew#426 repair
372
+ // thus costs one gate approval on an engine-driven run and ships verified. A post-hoc lift
373
+ // (WICKED_DELIVER_POSTHOC=1, `POST /runs/:id/deliver`) has no engine verification to protect and
374
+ // keeps the crew#426 behaviour — but SAYS which tracked files it regenerated, so the PR reviewer
375
+ // sees it. Deliberately NO LIFT-CONFLICT marker: a regenerated tree is not a recoverable strand.
376
+ // The scratch index is SEEDED from HEAD before `add -A` (review F-527-007), so a tracked path a
377
+ // `.gitignore` also matches is still in both snapshots and its regeneration is seen; a git failure
378
+ // is loud (no swallowed stderr — a partial snapshot on both sides would compare equal).
379
+ '_tree() { rm -f "$TD/preidx"; GIT_INDEX_FILE="$TD/preidx" git read-tree HEAD && GIT_INDEX_FILE="$TD/preidx" git add -A -- . && GIT_INDEX_FILE="$TD/preidx" git write-tree; }',
194
380
  'if [ -f package.json ] && [ -f package-lock.json ] && [ -f packages/crew/package.json ] && [ -f packages/crew-api-types/package.json ]; then',
381
+ ' T0=$(_tree) || { echo "deliver: could not snapshot the worktree before the preflight; nothing was staged, committed or pushed"; exit 1; }',
195
382
  ' npm install --prefer-offline --no-audit --no-fund',
196
383
  ' npm run manifest:endpoints -w packages/crew',
197
384
  ' npm run generate:api-tests -w packages/crew',
385
+ ' T1=$(_tree) || { echo "deliver: could not snapshot the worktree after the preflight; nothing was staged, committed or pushed"; exit 1; }',
386
+ ' if [ "$T0" != "$T1" ]; then',
387
+ ' CH=$(git diff-tree -r --name-only "$T0" "$T1" | tr "\\n" " ")',
388
+ // The marker TRAILS the line, followed by the file list, so both survive the engine's tail-250
389
+ // excerpt after the install/codegen chatter (review F-527-001).
390
+ ` if [ -z "\${WICKED_DELIVER_POSTHOC:-}" ]; then echo "deliver: the crew#426 lockfile/codegen re-sync CHANGED the worktree after the engine verified it — refusing to push a tree the engine did not verify. The regenerated files are left in the worktree (unstaged); approve to retry the deliver phase: the engine re-verifies the changed tree first and this script then delivers it (a second regeneration changes nothing). Nothing was staged, committed or pushed; ${DELIVER_PREFLIGHT_CHANGED_MARKER}: \${CH}"; exit 1; fi`,
391
+ ' echo "deliver: preflight regenerated tracked files on a post-hoc lift (no engine verification to protect): $CH"',
392
+ ' fi',
198
393
  'fi',
199
394
  // (c1a) TRACKED CHANGES ALWAYS RIDE. `git add -u` stages every modification/deletion to an
200
395
  // already-tracked path (the run's product for that class), including the crew#426 preflight's
@@ -237,7 +432,10 @@ export function deliverPrScript(intent) {
237
432
  'done < <(git ls-files --others --exclude-standard -z)',
238
433
  // Only commit when something is staged — a run that committed incrementally (core#280's
239
434
  // liveness contract) leaves a clean tree and must not gain an empty commit here.
240
- 'git diff --cached --quiet || git commit -q -m "$M"',
435
+ // `--cleanup=whitespace`, NOT git's default for `-F`: an operator/repo `commit.cleanup=strip`
436
+ // would otherwise treat every `## Intent` / `## Run` / `## Phases` heading as a `#` comment and
437
+ // strip it from the commit body (review W3-K1).
438
+ 'git diff --cached --quiet || git commit -q --cleanup=whitespace -F "$TD/text"',
241
439
  // (c2) NOTHING TO DELIVER — no staged work AND no commits of its own. Fail LOUDLY before the
242
440
  // remote is touched: an empty ref pushed under a run id is worse than a failed phase.
243
441
  'A=$(git rev-list --count "$D..$B")',
@@ -311,7 +509,8 @@ export function deliverPrScript(intent) {
311
509
  // (e) Open the PR with gh's OUTPUT and EXIT STATUS captured separately (crew#317). The old
312
510
  // `| tail -1` threw away everything gh said but one line and made the phase's verdict a
313
511
  // property of a shell option; a gh failure now fails the phase carrying gh's own message.
314
- 'if ! OUT=$(gh pr create --head "$B" --fill 2>&1); then echo "$OUT"; echo "deliver: gh pr create failed for $B — no PR was opened"; exit 1; fi',
512
+ // Title and body are the composed text (c1-text) — never `--fill` (crew#524).
513
+ 'if ! OUT=$(gh pr create --head "$B" --title "$TITLE" --body-file "$TD/body" 2>&1); then echo "$OUT"; echo "deliver: gh pr create failed for $B — no PR was opened"; exit 1; fi',
315
514
  'echo "$OUT"',
316
515
  // (f) DONE IS RE-DERIVED, NOT ASSERTED — twice, from two independent facts, before the phase
317
516
  // is allowed to report a delivery:
@@ -355,11 +554,11 @@ export function deliverPrScript(intent) {
355
554
  * deterministic and costs no LLM call. The PR-URL and branch-ahead assertions stay in the script
356
555
  * because no vaulted floor can see the remote.
357
556
  */
358
- export function deliverPrPhase(dependsOn = [], intent) {
557
+ export function deliverPrPhase(dependsOn = [], intent, opts = {}) {
359
558
  return {
360
559
  id: DELIVER_PHASE_ID,
361
560
  kind: 'build',
362
- executor: { type: 'tool', cmd: ['bash', '-lc', deliverPrScript(intent)] },
561
+ executor: { type: 'tool', cmd: ['bash', '-lc', deliverPrScript(intent, opts)] },
363
562
  gate_type: null,
364
563
  gate: 'auto',
365
564
  executes_code: false,
@@ -372,20 +571,7 @@ export function deliverPrPhase(dependsOn = [], intent) {
372
571
  validator_pin: EVIDENCE_FLOOR_PIN,
373
572
  };
374
573
  }
375
- /**
376
- * Compose a PER-RUN workflow def: `base`'s phases (untouched — the shared def is never mutated)
377
- * plus the deliver phase appended last, under a run-scoped id. The caller registers the result
378
- * with the engine for THIS run only; nothing is written to the overlay dir and the composed id
379
- * never enters the user-workflow registry, so the catalog (`GET /workflows`) stays clean.
380
- *
381
- * `intent` is the run's problem statement — it names WHAT was delivered in the commit subject
382
- * (`wicked-crew run <run-id>: <intent>`); omit it and the subject carries the run id alone.
383
- *
384
- * Throws when `base` already carries a `deliver` phase — appending a second phase with the same
385
- * id would be ambiguous at best; the caller launches such a def as-is instead (see
386
- * `CoreAdapter.launchRun`).
387
- */
388
- export function composeDeliverWorkflow(base, runId, intent) {
574
+ export function composeDeliverWorkflow(base, runId, intent, launch = {}) {
389
575
  if (base.phases.some((p) => p.id === DELIVER_PHASE_ID)) {
390
576
  throw new Error(`workflow '${base.id}' already has a '${DELIVER_PHASE_ID}' phase — launch it without deliver: "pr"`);
391
577
  }
@@ -396,11 +582,23 @@ export function composeDeliverWorkflow(base, runId, intent) {
396
582
  // registerWorkflow enforces id.length <= 128; a caller-supplied CLI session id can be long.
397
583
  // Truncate the run-id TAIL, keeping the base+marker prefix intact (Copilot on #303).
398
584
  const composedId = `${base.id}-deliver-${safeRunId}`.slice(0, 128);
585
+ const apiOrigin = launch.apiOrigin ?? null;
586
+ const facts = factsFromWorkflow({
587
+ runId,
588
+ intent,
589
+ workflowId: base.id,
590
+ repoRef: launch.repoRef ?? null,
591
+ phases: base.phases,
592
+ runUrl: runUrlFor(apiOrigin, runId),
593
+ });
399
594
  return {
400
595
  // No `is_system` on purpose: core's overlay/register schema rejects unknown fields, and the
401
596
  // composed def is engine-input, not catalog data.
402
597
  id: composedId,
403
- phases: [...base.phases, deliverPrPhase(last !== undefined ? [last.id] : [], intent)],
598
+ phases: [
599
+ ...base.phases,
600
+ deliverPrPhase(last !== undefined ? [last.id] : [], intent, { runId, facts, apiOrigin }),
601
+ ],
404
602
  };
405
603
  }
406
604
  //# sourceMappingURL=deliver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deliver.js","sourceRoot":"","sources":["../../src/core/deliver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAIH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAErD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AAErE,uFAAuF;AACvF,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,SAAS,mBAAmB,CAAC,MAA0B;IACrD,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;SAClB,OAAO,CAAC,yBAAyB,EAAE,GAAG,CAAC;SACvC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;SACjB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE;SACN,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC;SAC5B,IAAI,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,MAAe;IAC7C,OAAO;QACL,mBAAmB;QACnB,4FAA4F;QAC5F,8FAA8F;QAC9F,6FAA6F;QAC7F,sCAAsC;QACtC,W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@
1
- {"version":3,"file":"estate-mcp-client.d.ts","sourceRoot":"","sources":["../../src/core/estate-mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAM3E,sGAAsG;AACtG,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAMxD;;0EAE0E;AAC1E,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAgBpD;;sGAEsG;AACtG,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAK3C;AAED,4GAA4G;AAC5G,MAAM,WAAW,WAAW;IAC1B;uEACmE;IACnE,KAAK,CAAC,EAAE,MAAM,YAAY,CAAC;IAC3B,+GAA+G;IAC/G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;iEACiE;AACjE,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAGzE;AAED,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAMhF;AA6DD;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,EAAE,GAAE,WAAgB,GACnB,OAAO,CAAC,OAAO,CAAC,CA4GlB"}
1
+ {"version":3,"file":"estate-mcp-client.d.ts","sourceRoot":"","sources":["../../src/core/estate-mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQ3E,sGAAsG;AACtG,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAMxD;;0EAE0E;AAC1E,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAgBpD;;sGAEsG;AACtG,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAK3C;AAED,4GAA4G;AAC5G,MAAM,WAAW,WAAW;IAC1B;uEACmE;IACnE,KAAK,CAAC,EAAE,MAAM,YAAY,CAAC;IAC3B,+GAA+G;IAC/G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;iEACiE;AACjE,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAGzE;AAED,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAMhF;AAiED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,EAAE,GAAE,WAAgB,GACnB,OAAO,CAAC,OAAO,CAAC,CA4GlB"}
@@ -36,6 +36,7 @@ import { readFileSync } from 'node:fs';
36
36
  import { homedir } from 'node:os';
37
37
  import { join } from 'node:path';
38
38
  import { fileURLToPath } from 'node:url';
39
+ import { childEnvWithBootEstateDb } from './governance-store.js';
39
40
  /** The MCP protocol version crew declares in the handshake (the version the estate server speaks). */
40
41
  export const ESTATE_MCP_PROTOCOL_VERSION = '2024-11-05';
41
42
  /** JSON-RPC ids for the two request frames (the notification carries none). */
@@ -85,11 +86,15 @@ export function resolveMemoryDbPath(env = process.env) {
85
86
  const base = home !== undefined && home !== '' ? home : join(homedir(), '.wicked');
86
87
  return join(base, 'memory.db');
87
88
  }
88
- /** The default spawn: `wicked-estate-mcp` with no `--readonly` flag and WICKED_MEMORY_DB pinned. */
89
+ /** The default spawn: `wicked-estate-mcp` with no `--readonly` flag and WICKED_MEMORY_DB pinned.
90
+ * The server resolves its GRAPH store from `WICKED_ESTATE_DB`, which the daemon exports as its
91
+ * own governance store (crew#495) — the child gets the process's BOOT-TIME value back instead
92
+ * (`childEnvWithBootEstateDb`): the daemon's sidecar is the engine's business, and a newer estate
93
+ * binary must never migrate that file's schema past what the engine's vendored store opens. */
89
94
  function defaultSpawn(env) {
90
95
  return nodeSpawn(estateMcpExe(env), [], {
91
96
  stdio: ['pipe', 'pipe', 'pipe'],
92
- env: { ...env, WICKED_MEMORY_DB: resolveMemoryDbPath(env) },
97
+ env: { ...childEnvWithBootEstateDb(env), WICKED_MEMORY_DB: resolveMemoryDbPath(env) },
93
98
  windowsHide: true,
94
99
  });
95
100
  }
@@ -1 +1 @@
1
- {"version":3,"file":"estate-mcp-client.js","sourceRoot":"","sources":["../../src/core/estate-mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAqB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,sGAAsG;AACtG,MAAM,CAAC,MAAM,2BAA2B,GAAG,YAAY,CAAC;AAExD,+EAA+E;AAC/E,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;0EAE0E;AAC1E,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC;;gGAEgG;AAChG,MAAM,cAAc,GAAW,CAAC,GAAW,EAAE;IAC3C,IAAI,CAAC;QACH,MAAM,GAAG,G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EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;+FAC2F;IAC3F,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF;;kFAEkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEvD;AAED;;kEAEkE;AAClE,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,GAAE,QAAa,GAClB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B7C"}
package/dist/core/exec.js CHANGED
@@ -25,6 +25,7 @@
25
25
  // silent kill and an OOM.
26
26
  import { execFile } from 'node:child_process';
27
27
  import { promisify } from 'node:util';
28
+ import { childEnvWithBootEstateDb } from './governance-store.js';
28
29
  const execFileAsync = promisify(execFile);
29
30
  /** 64 MiB. Chosen to clear the largest `blast-radius` output observed in the corpus by a wide
30
31
  * margin while still bounding the daemon's heap. Raise it deliberately, not reflexively — if a
@@ -86,7 +87,16 @@ export async function execCapped(file, args, opts = {}) {
86
87
  // overridable by ACCIDENT, only on purpose.
87
88
  const maxBuffer = resolveMaxBuffer(opts);
88
89
  try {
89
- return await execFileAsync(file, args, { ...opts, maxBuffer });
90
+ // Every crew child gets the process env with the engine-only store variables restored to their
91
+ // BOOT values (`childEnvWithBootEstateDb`): the daemon exports its governance store as
92
+ // WICKED_ESTATE_DB for the in-process engine, and that is nobody else's business — not git's,
93
+ // uv's, the estate CLI's or a version probe's. An explicit `opts.env` is scrubbed the same way,
94
+ // so a caller that spreads `process.env` is covered too.
95
+ return await execFileAsync(file, args, {
96
+ ...opts,
97
+ maxBuffer,
98
+ env: childEnvWithBootEstateDb(opts.env ?? process.env),
99
+ });
90
100
  }
91
101
  catch (err) {
92
102
  if (isMaxBufferError(err))
@@ -1 +1 @@
1
- {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/core/exec.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,eAAe;AACf,EAAE;AACF,oGAAoG;AACpG,iGAAiG;AACjG,gGAAgG;AAChG,2FAA2F;AAC3F,EAAE;AACF,kGAAkG;AAClG,kGAAkG;AAClG,qCAAqC;AACrC,EAAE;AACF,wDAAwD;AACxD,EAAE;AACF,gGAAgG;AAChG,8FAA8F;AAC9F,mGAAmG;AACnG,0EAA0E;AAC1E,EAAE;AACF,0BAA0B;AAC1B,EAAE;AACF,8FAA8F;AAC9F,6FAA6F;AAC7F,0BAA0B;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C;;sFAEsF;AACtF,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD;kFACkF;AAClF,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,CAAC,IAAI,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC;IACpE,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACpD,OAAO,GAAG,CAAC,QAAQ,CAAC;AACtB,CAAC;AAED;;;;oDAIoD;AACpD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAEhC;IACA;IAFX,YACW,IAAY,EACZ,UAAkB;QAE3B,KAAK,CACH,GAAG,IAAI,uBAAuB,UAAU,CAAC,UAAU,CAAC,wCAAwC;YAC1F,0C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