wicked-crew 0.7.11 → 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 (44) 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/post-hoc-deliver.d.ts +27 -0
  6. package/dist/api/post-hoc-deliver.d.ts.map +1 -1
  7. package/dist/api/post-hoc-deliver.js +54 -0
  8. package/dist/api/post-hoc-deliver.js.map +1 -1
  9. package/dist/api/routes.d.ts +5 -1
  10. package/dist/api/routes.d.ts.map +1 -1
  11. package/dist/api/routes.js +124 -12
  12. package/dist/api/routes.js.map +1 -1
  13. package/dist/api/seat-health.d.ts +11 -0
  14. package/dist/api/seat-health.d.ts.map +1 -1
  15. package/dist/api/seat-health.js +23 -0
  16. package/dist/api/seat-health.js.map +1 -1
  17. package/dist/api/server.d.ts.map +1 -1
  18. package/dist/api/server.js +5 -1
  19. package/dist/api/server.js.map +1 -1
  20. package/dist/api/testing.d.ts.map +1 -1
  21. package/dist/api/testing.js +11 -27
  22. package/dist/api/testing.js.map +1 -1
  23. package/dist/campaigns/rollup.d.ts.map +1 -1
  24. package/dist/campaigns/rollup.js +17 -3
  25. package/dist/campaigns/rollup.js.map +1 -1
  26. package/dist/cli/index.js +13 -2
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/core/adapter.d.ts +0 -12
  29. package/dist/core/adapter.d.ts.map +1 -1
  30. package/dist/core/adapter.js +0 -14
  31. package/dist/core/adapter.js.map +1 -1
  32. package/dist/core/daemon-signal-log.d.ts +44 -0
  33. package/dist/core/daemon-signal-log.d.ts.map +1 -0
  34. package/dist/core/daemon-signal-log.js +57 -0
  35. package/dist/core/daemon-signal-log.js.map +1 -0
  36. package/dist/core/deliver.d.ts +20 -3
  37. package/dist/core/deliver.d.ts.map +1 -1
  38. package/dist/core/deliver.js +82 -9
  39. package/dist/core/deliver.js.map +1 -1
  40. package/package.json +2 -2
  41. package/dist/campaigns/worktrees.d.ts +0 -39
  42. package/dist/campaigns/worktrees.d.ts.map +0 -1
  43. package/dist/campaigns/worktrees.js +0 -95
  44. package/dist/campaigns/worktrees.js.map +0 -1
@@ -1,39 +0,0 @@
1
- /**
2
- * Pre-provisioned campaign-node worktrees — the daemon-side workaround for an ENGINE defect
3
- * (found while landing crew#390): the engine names every run's worktree branch
4
- * `wicked/{run_id}` VERBATIM (`wicked-core src/repo.rs create_worktree`), and a campaign node's
5
- * run id is `{campaign}:{node}:a{attempt}` — a string git REFUSES as a branch name (':' is
6
- * illegal in a ref). Every repo-scoped campaign node therefore fails at dispatch with
7
- * "git worktree add failed: … is not a valid branch name" before a single unit runs, on every
8
- * released engine.
9
- *
10
- * The workaround rides the same function's DOCUMENTED contract: `create_worktree` is
11
- * "idempotent for a genuine resume: a live worktree already at the path is reused". So the
12
- * daemon creates each node's worktree FIRST — at the engine's own layout
13
- * (`<repo_root>/wicked-worktrees/<run_id>`, the crew#276 non-dotted root every engine this
14
- * daemon can install uses: `wicked-core-ts` floor ^0.7.6) — on a branch-SAFE name
15
- * (`wicked/<run_id with ':' → '-'>`), and the engine's dispatch finds and reuses it instead of
16
- * minting the illegal branch. When the engine later sanitizes its branch names natively, these
17
- * pre-created worktrees keep reading as the same legitimate resume state.
18
- *
19
- * Fail-closed and atomic-ish: provisioning happens BEFORE the campaign launches, so a git
20
- * failure aborts the whole request with nothing scheduled; the returned rollback lets the
21
- * caller reclaim the worktrees when the launch itself is then refused. NOTE: the run-id path
22
- * carries ':' — legal on macOS/Linux, ILLEGAL on Windows filesystems — so callers must keep a
23
- * non-campaign fallback on win32 (the recon route does).
24
- */
25
- /** One node's provisioning target: the engine-derived run id and its repo's root checkout. */
26
- export interface WorktreeTarget {
27
- runId: string;
28
- repoRoot: string;
29
- }
30
- /** The branch-safe spelling of a campaign-node run id (':' is illegal in a git ref). */
31
- export declare function branchSafe(runId: string): string;
32
- /**
33
- * Create one live worktree per target at the engine's layout, on a branch-safe branch.
34
- * Throws (after removing whatever it already created) when any `git worktree add` refuses —
35
- * the caller aborts the launch with nothing scheduled. Returns a best-effort rollback for the
36
- * caller's own abort paths (e.g. the engine then refusing the campaign def).
37
- */
38
- export declare function provisionCampaignWorktrees(targets: WorktreeTarget[]): Promise<() => Promise<void>>;
39
- //# sourceMappingURL=worktrees.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktrees.d.ts","sourceRoot":"","sources":["../../src/campaigns/worktrees.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,8FAA8F;AAC9F,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAsBD;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,cAAc,EAAE,GACxB,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAoC9B"}
@@ -1,95 +0,0 @@
1
- /**
2
- * Pre-provisioned campaign-node worktrees — the daemon-side workaround for an ENGINE defect
3
- * (found while landing crew#390): the engine names every run's worktree branch
4
- * `wicked/{run_id}` VERBATIM (`wicked-core src/repo.rs create_worktree`), and a campaign node's
5
- * run id is `{campaign}:{node}:a{attempt}` — a string git REFUSES as a branch name (':' is
6
- * illegal in a ref). Every repo-scoped campaign node therefore fails at dispatch with
7
- * "git worktree add failed: … is not a valid branch name" before a single unit runs, on every
8
- * released engine.
9
- *
10
- * The workaround rides the same function's DOCUMENTED contract: `create_worktree` is
11
- * "idempotent for a genuine resume: a live worktree already at the path is reused". So the
12
- * daemon creates each node's worktree FIRST — at the engine's own layout
13
- * (`<repo_root>/wicked-worktrees/<run_id>`, the crew#276 non-dotted root every engine this
14
- * daemon can install uses: `wicked-core-ts` floor ^0.7.6) — on a branch-SAFE name
15
- * (`wicked/<run_id with ':' → '-'>`), and the engine's dispatch finds and reuses it instead of
16
- * minting the illegal branch. When the engine later sanitizes its branch names natively, these
17
- * pre-created worktrees keep reading as the same legitimate resume state.
18
- *
19
- * Fail-closed and atomic-ish: provisioning happens BEFORE the campaign launches, so a git
20
- * failure aborts the whole request with nothing scheduled; the returned rollback lets the
21
- * caller reclaim the worktrees when the launch itself is then refused. NOTE: the run-id path
22
- * carries ':' — legal on macOS/Linux, ILLEGAL on Windows filesystems — so callers must keep a
23
- * non-campaign fallback on win32 (the recon route does).
24
- */
25
- import { join } from 'node:path';
26
- import { mkdir, readFile, writeFile } from 'node:fs/promises';
27
- import { execCapped } from '../core/exec.js';
28
- /** The branch-safe spelling of a campaign-node run id (':' is illegal in a git ref). */
29
- export function branchSafe(runId) {
30
- return runId.replaceAll(':', '-');
31
- }
32
- async function git(repoRoot, args) {
33
- await execCapped('git', ['-C', repoRoot, ...args], { windowsHide: true });
34
- }
35
- /** Mirror of the engine's `ensure_worktrees_excluded` (repo-local `.git/info/exclude`) — the
36
- * engine only writes it on the mint path, which the reuse contract skips. Best-effort. */
37
- async function ensureExcluded(repoRoot) {
38
- const ENTRY = 'wicked-worktrees/';
39
- const exclude = join(repoRoot, '.git', 'info', 'exclude');
40
- try {
41
- const existing = await readFile(exclude, 'utf8').catch(() => '');
42
- if (existing.split('\n').some((l) => l.trim() === ENTRY))
43
- return;
44
- const body = existing === '' || existing.endsWith('\n') ? existing : `${existing}\n`;
45
- await mkdir(join(repoRoot, '.git', 'info'), { recursive: true });
46
- await writeFile(exclude, `${body}${ENTRY}\n`, 'utf8');
47
- }
48
- catch {
49
- /* cosmetic — a dirty `git status` in the parent checkout, never a failed run */
50
- }
51
- }
52
- /**
53
- * Create one live worktree per target at the engine's layout, on a branch-safe branch.
54
- * Throws (after removing whatever it already created) when any `git worktree add` refuses —
55
- * the caller aborts the launch with nothing scheduled. Returns a best-effort rollback for the
56
- * caller's own abort paths (e.g. the engine then refusing the campaign def).
57
- */
58
- export async function provisionCampaignWorktrees(targets) {
59
- const created = [];
60
- const rollback = async () => {
61
- for (const t of created) {
62
- const wt = join(t.repoRoot, 'wicked-worktrees', t.runId);
63
- // Forced remove is correct here: the run never started, so there is no work to preserve.
64
- await execCapped('git', ['-C', t.repoRoot, 'worktree', 'remove', '--force', wt], {
65
- windowsHide: true,
66
- }).catch(() => { });
67
- await execCapped('git', ['-C', t.repoRoot, 'branch', '-D', `wicked/${branchSafe(t.runId)}`], {
68
- windowsHide: true,
69
- }).catch(() => { });
70
- }
71
- };
72
- for (const t of targets) {
73
- const wt = join(t.repoRoot, 'wicked-worktrees', t.runId);
74
- const branch = `wicked/${branchSafe(t.runId)}`;
75
- try {
76
- await mkdir(join(t.repoRoot, 'wicked-worktrees'), { recursive: true });
77
- try {
78
- await git(t.repoRoot, ['worktree', 'add', wt, '-b', branch]);
79
- }
80
- catch {
81
- // The engine's own retry idiom: a stale branch from a prior attempt blocks `-b` — reuse it.
82
- await git(t.repoRoot, ['worktree', 'add', wt, branch]);
83
- }
84
- await ensureExcluded(t.repoRoot);
85
- created.push(t);
86
- }
87
- catch (err) {
88
- await rollback();
89
- throw new Error(`pre-provisioning the campaign worktree for run '${t.runId}' failed in ` +
90
- `'${t.repoRoot}': ${err instanceof Error ? err.message : String(err)}`);
91
- }
92
- }
93
- return rollback;
94
- }
95
- //# sourceMappingURL=worktrees.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktrees.js","sourceRoot":"","sources":["../../src/campaigns/worktrees.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ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