@onepointfour-packs/flaredeck-agent 0.2.37 → 0.2.39

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 (102) hide show
  1. package/dist/agent.d.ts +42 -3
  2. package/dist/agent.js +84 -6
  3. package/dist/agent.js.map +1 -1
  4. package/dist/automode.js +43 -3
  5. package/dist/automode.js.map +1 -1
  6. package/dist/boards.d.ts +72 -0
  7. package/dist/boards.js +136 -0
  8. package/dist/boards.js.map +1 -0
  9. package/dist/branches.d.ts +12 -1
  10. package/dist/branches.js +13 -3
  11. package/dist/branches.js.map +1 -1
  12. package/dist/browser.d.ts +59 -0
  13. package/dist/browser.js +260 -26
  14. package/dist/browser.js.map +1 -1
  15. package/dist/config.d.ts +22 -0
  16. package/dist/config.js +37 -2
  17. package/dist/config.js.map +1 -1
  18. package/dist/credentials.d.ts +217 -0
  19. package/dist/credentials.js +332 -0
  20. package/dist/credentials.js.map +1 -0
  21. package/dist/engine-antigravity.js +2 -0
  22. package/dist/engine-antigravity.js.map +1 -1
  23. package/dist/engine-claude.js +14 -2
  24. package/dist/engine-claude.js.map +1 -1
  25. package/dist/engine.d.ts +19 -0
  26. package/dist/engine.js.map +1 -1
  27. package/dist/environment.d.ts +15 -3
  28. package/dist/environment.js +79 -9
  29. package/dist/environment.js.map +1 -1
  30. package/dist/envtools.d.ts +58 -0
  31. package/dist/envtools.js +151 -0
  32. package/dist/envtools.js.map +1 -0
  33. package/dist/flaredeck-proxy.d.ts +11 -1
  34. package/dist/flaredeck-proxy.js +27 -1
  35. package/dist/flaredeck-proxy.js.map +1 -1
  36. package/dist/flaredeck.d.ts +24 -0
  37. package/dist/flaredeck.js +20 -0
  38. package/dist/flaredeck.js.map +1 -1
  39. package/dist/github.d.ts +2 -0
  40. package/dist/github.js +4 -0
  41. package/dist/github.js.map +1 -1
  42. package/dist/githubauth.d.ts +11 -1
  43. package/dist/githubauth.js +82 -16
  44. package/dist/githubauth.js.map +1 -1
  45. package/dist/hydrate.d.ts +76 -0
  46. package/dist/hydrate.js +77 -0
  47. package/dist/hydrate.js.map +1 -0
  48. package/dist/limits.d.ts +184 -0
  49. package/dist/limits.js +251 -0
  50. package/dist/limits.js.map +1 -0
  51. package/dist/main.js +177 -33
  52. package/dist/main.js.map +1 -1
  53. package/dist/picker.d.ts +10 -0
  54. package/dist/picker.js +150 -0
  55. package/dist/picker.js.map +1 -0
  56. package/dist/preflight.d.ts +43 -0
  57. package/dist/preflight.js +133 -19
  58. package/dist/preflight.js.map +1 -1
  59. package/dist/repopicker.js +8 -96
  60. package/dist/repopicker.js.map +1 -1
  61. package/dist/runs.d.ts +19 -4
  62. package/dist/runs.js +74 -9
  63. package/dist/runs.js.map +1 -1
  64. package/dist/serve.d.ts +6 -0
  65. package/dist/serve.js +1152 -138
  66. package/dist/serve.js.map +1 -1
  67. package/dist/session.d.ts +51 -0
  68. package/dist/session.js +145 -0
  69. package/dist/session.js.map +1 -0
  70. package/dist/settle.d.ts +18 -0
  71. package/dist/settle.js +39 -0
  72. package/dist/settle.js.map +1 -0
  73. package/dist/signin.d.ts +47 -0
  74. package/dist/signin.js +331 -0
  75. package/dist/signin.js.map +1 -0
  76. package/dist/stream.d.ts +8 -0
  77. package/dist/stream.js +44 -3
  78. package/dist/stream.js.map +1 -1
  79. package/dist/subscriptions.d.ts +115 -0
  80. package/dist/subscriptions.js +140 -0
  81. package/dist/subscriptions.js.map +1 -0
  82. package/dist/team.js +7 -1
  83. package/dist/team.js.map +1 -1
  84. package/dist/tmux.d.ts +1 -0
  85. package/dist/tmux.js +47 -0
  86. package/dist/tmux.js.map +1 -0
  87. package/dist/ui.d.ts +13 -0
  88. package/dist/ui.js +7 -2
  89. package/dist/ui.js.map +1 -1
  90. package/dist/usage.d.ts +105 -0
  91. package/dist/usage.js +348 -0
  92. package/dist/usage.js.map +1 -0
  93. package/dist/wall.d.ts +35 -0
  94. package/dist/wall.js +94 -0
  95. package/dist/wall.js.map +1 -0
  96. package/dist/workspace.d.ts +15 -1
  97. package/dist/workspace.js +25 -1
  98. package/dist/workspace.js.map +1 -1
  99. package/dist/worktree.d.ts +19 -0
  100. package/dist/worktree.js +179 -4
  101. package/dist/worktree.js.map +1 -1
  102. package/package.json +1 -1
package/dist/picker.js ADDED
@@ -0,0 +1,150 @@
1
+ import { Box, Text, render, useApp, useInput } from 'ink';
2
+ import React, { useState } from 'react';
3
+ /**
4
+ * Tick some of a list.
5
+ *
6
+ * This started as the repository picker and is now shared, because the second thing an agent is
7
+ * scoped by — which boards it works — is the same question with different nouns. The lesson it
8
+ * carries is worth keeping in one place: this was once a numbered list you typed numbers at, and
9
+ * the numbers TOGGLED. Everything started ticked, so typing the four you wanted turned those four
10
+ * off. A prompt whose plainest reading is the opposite of what it does is not fixed by better
11
+ * wording; it is fixed by not asking people to hold the current state in their head. Move, press
12
+ * space, see the tick change.
13
+ */
14
+ const MAX_ROWS = 16;
15
+ function Picker({ title, subtitle, items, initial, onDone, }) {
16
+ const { exit } = useApp();
17
+ const [on, setOn] = useState(new Set(initial));
18
+ const [at, setAt] = useState(0);
19
+ const done = (picked) => { onDone(picked); exit(); };
20
+ useInput((input, key) => {
21
+ if (key.upArrow || input === 'k')
22
+ setAt((i) => (i - 1 + items.length) % items.length);
23
+ else if (key.downArrow || input === 'j')
24
+ setAt((i) => (i + 1) % items.length);
25
+ else if (input === ' ') {
26
+ const id = items[at]?.id;
27
+ if (id)
28
+ setOn((s) => { const n = new Set(s); if (n.has(id))
29
+ n.delete(id);
30
+ else
31
+ n.add(id); return n; });
32
+ }
33
+ else if (input === 'a')
34
+ setOn(new Set(items.map((r) => r.id)));
35
+ else if (input === 'n')
36
+ setOn(new Set());
37
+ else if (key.return)
38
+ done(items.filter((r) => on.has(r.id)).map((r) => r.id));
39
+ // Escape leaves the config alone rather than saving an empty choice — a cancelled prompt
40
+ // should change nothing, and "none of them" is a thing you say with n then enter.
41
+ else if (key.escape || input === 'q')
42
+ done(null);
43
+ });
44
+ // A window, so a long list does not scroll the question off the screen.
45
+ const half = Math.floor(MAX_ROWS / 2);
46
+ const first = Math.max(0, Math.min(at - half, items.length - MAX_ROWS));
47
+ const shown = items.slice(first, first + MAX_ROWS);
48
+ const width = Math.max(...items.map((r) => r.label.length));
49
+ return (React.createElement(Box, { flexDirection: "column" },
50
+ React.createElement(Text, null,
51
+ React.createElement(Text, { bold: true }, title),
52
+ React.createElement(Text, { dimColor: true },
53
+ " \u00B7 ",
54
+ subtitle)),
55
+ React.createElement(Box, { height: 1 }),
56
+ first > 0 ? React.createElement(Text, { dimColor: true },
57
+ " \u2191 ",
58
+ first,
59
+ " more") : null,
60
+ shown.map((r, i) => {
61
+ const here = first + i === at;
62
+ const ticked = on.has(r.id);
63
+ return (React.createElement(Text, { key: r.id, color: here ? 'cyan' : undefined },
64
+ here ? '❯ ' : ' ',
65
+ React.createElement(Text, { color: ticked ? 'green' : undefined }, ticked ? '◉' : '◯'),
66
+ ' ',
67
+ React.createElement(Text, { bold: ticked }, r.label.padEnd(width)),
68
+ r.note ? React.createElement(Text, { dimColor: true },
69
+ " ",
70
+ r.note) : null));
71
+ }),
72
+ first + MAX_ROWS < items.length ? React.createElement(Text, { dimColor: true },
73
+ " \u2193 ",
74
+ items.length - first - MAX_ROWS,
75
+ " more") : null,
76
+ React.createElement(Box, { height: 1 }),
77
+ React.createElement(Text, { dimColor: true },
78
+ "\u2191\u2193 move \u00B7 space tick \u00B7 a all \u00B7 n none \u00B7 enter accept (",
79
+ on.size,
80
+ " selected) \u00B7 esc cancel")));
81
+ }
82
+ /** Resolves to the ticked ids, or null when the person backed out without choosing. */
83
+ export function pickMany(title, subtitle, items, initial) {
84
+ return new Promise((resolve) => {
85
+ // Resolved from the callback AND from the unmount, whichever happens first, because this sits
86
+ // in the middle of login: a picker that renders but never returns is a login that hangs with
87
+ // no way forward. startApprovals settles the same two ways for the same reason.
88
+ let settled = false;
89
+ let answer = null;
90
+ let app = null;
91
+ /**
92
+ * Give the terminal back, and only once Ink has finished with it.
93
+ *
94
+ * Ink puts stdin in raw mode and pauses it, and its teardown runs on a later tick than
95
+ * `unmount()` returns — so restoring immediately is undone a moment afterwards. Whatever
96
+ * asks a question next then waits on a stdin that will never deliver, and a promise that
97
+ * can never settle is NOT an error: node runs out of work and exits, cleanly, status 0,
98
+ * with nothing printed. `login` did exactly that at the branch prompt, and node's own
99
+ * "Detected unsettled top-level await" was the only clue it ever gave.
100
+ *
101
+ * So: wait for waitUntilExit, THEN restore, THEN answer the caller.
102
+ */
103
+ const done = (picked) => {
104
+ if (settled)
105
+ return;
106
+ settled = true;
107
+ answer = picked;
108
+ try {
109
+ app?.unmount();
110
+ }
111
+ catch { /* already gone */ }
112
+ };
113
+ /**
114
+ * Take the terminal out of raw mode.
115
+ *
116
+ * Ink puts it there and does not reliably undo it, and readline cannot read a terminal left
117
+ * raw. That is all this needs to do: measured across the boundary, stdin ends up paused
118
+ * either way and a fresh readline resumes it perfectly well.
119
+ *
120
+ * NOT unref, and NOT resume. Both were tried against the login dying here and both were
121
+ * wrong: `refd` stayed true throughout, and `resume()` puts the stream into flowing mode
122
+ * where, with no consumer attached, every keystroke is read and thrown away. The real fault
123
+ * was a readline left attached across this render — see main.ts, closeReader().
124
+ */
125
+ const giveBackStdin = () => {
126
+ try {
127
+ // Raw mode off: Ink turns it on and readline cannot read a terminal left raw.
128
+ if (process.stdin.isTTY && process.stdin.setRawMode)
129
+ process.stdin.setRawMode(false);
130
+ // And REF it. Ink unrefs stdin so its own app can exit, and an unref'd stream does not
131
+ // hold the event loop open: the next question waits for input that would arrive fine
132
+ // while node decides it has nothing left to do and leaves — no error, status 0.
133
+ //
134
+ // This was removed once, on the evidence of a run where `refd` stayed true. It stayed
135
+ // true only because a stale readline was still attached and holding the ref — the very
136
+ // bug fixed alongside this. Fixing that one exposed this one. Measured, after both:
137
+ // with a stale reader: data=1 refd=true -> dies (the reader never resumes stdin)
138
+ // reader closed only: data=0 refd=false -> dies (nothing holds the loop open)
139
+ // both: data=0 refd=true -> answers
140
+ process.stdin.ref?.();
141
+ }
142
+ catch { /* not a terminal: nothing to give back */ }
143
+ };
144
+ app = render(React.createElement(Picker, { title: title, subtitle: subtitle, items: items, initial: initial, onDone: done }));
145
+ app.waitUntilExit()
146
+ .catch(() => { })
147
+ .then(() => { giveBackStdin(); resolve(answer); });
148
+ });
149
+ }
150
+ //# sourceMappingURL=picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"picker.js","sourceRoot":"","sources":["../src/picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,QAAQ,GAAG,EAAE,CAAC;AAWpB,SAAS,MAAM,CAAC,EACd,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,EACP,MAAM,GAOP;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAc,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEhC,MAAM,IAAI,GAAG,CAAC,MAAuB,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAEtE,QAAQ,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACtB,IAAI,GAAG,CAAC,OAAO,IAAI,KAAK,KAAK,GAAG;YAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,M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AI,CAAC;YACf,MAAM,GAAG,MAAM,CAAC;YAChB,IAAI,CAAC;gBAAC,GAAG,EAAE,OAAO,EAAE,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF;;;;;;;;;;;WAWG;QACH,MAAM,aAAa,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC;gBACH,8EAA8E;gBAC9E,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU;oBAAE,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBACrF,uFAAuF;gBACvF,qFAAqF;gBACrF,gFAAgF;gBAChF,EAAE;gBACF,sFAAsF;gBACtF,uFAAuF;gBACvF,oFAAoF;gBACpF,qFAAqF;gBACrF,kFAAkF;gBAClF,uDAAuD;gBACtD,OAAO,CAAC,KAAkD,CAAC,GAAG,EAAE,EAAE,CAAC;YACtE,CAAC;YAAC,MAAM,CAAC,CAAC,0CAA0C,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,GAAG,GAAG,MAAM,CACV,oBAAC,MAAM,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAI,CAC3F,CAAC;QACF,GAAG,CAAC,aAAa,EAAE;aAChB,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;aACf,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -60,6 +60,48 @@ export type CheckResult = {
60
60
  fixed: boolean;
61
61
  };
62
62
  export declare function loadChecks(repo: string): Check[];
63
+ /**
64
+ * Install the project's dependencies if they are missing.
65
+ *
66
+ * A fresh worktree has tracked files and nothing else, so the first thing an agent needs is the
67
+ * one thing it cannot have: node_modules. One asked a person — "can you run npm install on CASE's
68
+ * and TARS's machines?" — which is a card stopped for hours on something mechanical that any
69
+ * machine can do for itself.
70
+ *
71
+ * It is the harness's job for the same reason the worktree is: it is the same every time, it has
72
+ * one right answer, and asking a model (or a person) to do it is asking for variety nobody wants.
73
+ */
74
+ export type ManagerChoice = {
75
+ manager: PackageManager;
76
+ /** The evidence it was chosen on, for the step line and for the failure detail. */
77
+ why: string;
78
+ /** Set only when the evidence did NOT settle it, and naming the one line that would. */
79
+ unsettled?: string;
80
+ };
81
+ type PackageManager = 'npm' | 'yarn' | 'pnpm';
82
+ /**
83
+ * Work out which package manager this project uses, from evidence, in order of authority.
84
+ *
85
+ * Running the wrong one does not degrade, it fails: `npm` on a yarn project meets ERESOLVE on
86
+ * every card, the environment never starts, and the agent correctly reports it cannot work. So
87
+ * this does not pick a favourite and hope. It reads the signals a repository actually carries:
88
+ *
89
+ * 1. `packageManager` in package.json. The people who own the repo wrote it down; nothing
90
+ * found lying on disk outranks that.
91
+ * 2. One lockfile. One lockfile is an answer.
92
+ * 3. Several lockfiles, but only one of them committed. A tracked lockfile is the project's;
93
+ * an untracked one is somebody's afternoon.
94
+ * 4. Several COMMITTED lockfiles — and that is not a hypothetical. FlareDeck carries a
95
+ * package-lock.json and a yarn.lock from the same commit, both fully in step with
96
+ * package.json, both 2025-10-28. Nothing on disk can separate them, and the honest thing
97
+ * is to say so rather than quietly pick one and let the failure look like the card's
98
+ * fault: `unsettled` carries the sentence, and the fix is one line in package.json.
99
+ *
100
+ * Then, whatever was chosen, it has to exist on this machine — a repo declaring pnpm on a box
101
+ * without pnpm is a fact worth saying rather than an `pnpm: command not found` six lines deep
102
+ * in an install log.
103
+ */
104
+ export declare function choosePackageManager(repo: string): Promise<ManagerChoice>;
63
105
  export declare function preflight(repo: string, onStep: (text: string) => void): Promise<CheckResult[]>;
64
106
  /**
65
107
  * What the agent is told about the state of its environment.
@@ -69,3 +111,4 @@ export declare function preflight(repo: string, onStep: (text: string) => void):
69
111
  * than no answer, because someone believes it.
70
112
  */
71
113
  export declare function preflightBrief(results: CheckResult[]): string;
114
+ export {};
package/dist/preflight.js CHANGED
@@ -69,40 +69,154 @@ function run(command, cwd, timeoutMs = TIMEOUT_MS) {
69
69
  child.on('error', (e) => { clearTimeout(timer); resolve({ code: 1, out: String(e) }); });
70
70
  });
71
71
  }
72
+ const LOCKFILES = {
73
+ npm: 'package-lock.json',
74
+ yarn: 'yarn.lock',
75
+ pnpm: 'pnpm-lock.yaml',
76
+ };
77
+ const MANAGERS = Object.keys(LOCKFILES);
72
78
  /**
73
- * Install the project's dependencies if they are missing.
79
+ * Work out which package manager this project uses, from evidence, in order of authority.
74
80
  *
75
- * A fresh worktree has tracked files and nothing else, so the first thing an agent needs is the
76
- * one thing it cannot have: node_modules. One asked a person — "can you run npm install on CASE's
77
- * and TARS's machines?" — which is a card stopped for hours on something mechanical that any
78
- * machine can do for itself.
81
+ * Running the wrong one does not degrade, it fails: `npm` on a yarn project meets ERESOLVE on
82
+ * every card, the environment never starts, and the agent correctly reports it cannot work. So
83
+ * this does not pick a favourite and hope. It reads the signals a repository actually carries:
79
84
  *
80
- * It is the harness's job for the same reason the worktree is: it is the same every time, it has
81
- * one right answer, and asking a model (or a person) to do it is asking for variety nobody wants.
85
+ * 1. `packageManager` in package.json. The people who own the repo wrote it down; nothing
86
+ * found lying on disk outranks that.
87
+ * 2. One lockfile. One lockfile is an answer.
88
+ * 3. Several lockfiles, but only one of them committed. A tracked lockfile is the project's;
89
+ * an untracked one is somebody's afternoon.
90
+ * 4. Several COMMITTED lockfiles — and that is not a hypothetical. FlareDeck carries a
91
+ * package-lock.json and a yarn.lock from the same commit, both fully in step with
92
+ * package.json, both 2025-10-28. Nothing on disk can separate them, and the honest thing
93
+ * is to say so rather than quietly pick one and let the failure look like the card's
94
+ * fault: `unsettled` carries the sentence, and the fix is one line in package.json.
95
+ *
96
+ * Then, whatever was chosen, it has to exist on this machine — a repo declaring pnpm on a box
97
+ * without pnpm is a fact worth saying rather than an `pnpm: command not found` six lines deep
98
+ * in an install log.
82
99
  */
100
+ export async function choosePackageManager(repo) {
101
+ const choice = await decideManager(repo);
102
+ if (await canRun(choice.manager, repo))
103
+ return choice;
104
+ for (const alt of MANAGERS) {
105
+ if (alt === choice.manager)
106
+ continue;
107
+ if (!(await canRun(alt, repo)))
108
+ continue;
109
+ return {
110
+ ...choice,
111
+ manager: alt,
112
+ why: `${choice.why}, but ${choice.manager} is not installed on this machine, so ${alt} instead`,
113
+ unsettled: `this project wants ${choice.manager}, which is not installed here — I used ${alt}. Installing ${choice.manager} on this machine is the real fix.`,
114
+ };
115
+ }
116
+ return choice; // Nothing at all is installed; the install itself will say so plainly enough.
117
+ }
118
+ async function decideManager(repo) {
119
+ const has = (f) => existsSync(join(repo, f));
120
+ let declared = '';
121
+ try {
122
+ const pkg = JSON.parse(readFileSync(join(repo, 'package.json'), 'utf8'));
123
+ declared = (pkg.packageManager ?? '').split('@')[0]?.trim() ?? '';
124
+ }
125
+ catch { /* an unreadable package.json fails the install with a better message than this */ }
126
+ if (MANAGERS.includes(declared)) {
127
+ return { manager: declared, why: `package.json declares packageManager: ${declared}` };
128
+ }
129
+ const present = MANAGERS.filter((m) => has(LOCKFILES[m]));
130
+ if (present.length === 0)
131
+ return { manager: 'npm', why: "no lockfile here, so npm as Node's default" };
132
+ if (present.length === 1)
133
+ return { manager: present[0], why: `${LOCKFILES[present[0]]} is the only lockfile` };
134
+ const tracked = [];
135
+ for (const m of present) {
136
+ const { code } = await run(`git ls-files --error-unmatch -- ${LOCKFILES[m]}`, repo, 15_000);
137
+ if (code === 0)
138
+ tracked.push(m);
139
+ }
140
+ if (tracked.length === 1) {
141
+ const others = present.filter((m) => m !== tracked[0]).map((m) => LOCKFILES[m]).join(', ');
142
+ return { manager: tracked[0], why: `${LOCKFILES[tracked[0]]} is committed; ${others} is not` };
143
+ }
144
+ const candidates = tracked.length ? tracked : present;
145
+ const manager = candidates.includes('npm') ? 'npm' : candidates[0];
146
+ const names = candidates.map((m) => LOCKFILES[m]).join(' and ');
147
+ const options = candidates.map((m) => `${m}@<version>`).join(' or ');
148
+ return {
149
+ manager,
150
+ why: `${names} are both committed, and nothing here distinguishes them`,
151
+ unsettled: `this project has ${candidates.length} committed lockfiles (${names}) and no "packageManager" in package.json, ` +
152
+ `so nothing in the repository says which to install with — I fell back to ${manager}. ` +
153
+ // Deliberately NOT suggesting the fallback: it was a tiebreak, not a reading of what the
154
+ // project wants, and printing it as the fix would turn a coin toss into the repo's answer.
155
+ `Only the project can settle this: add "packageManager": "${options}" to package.json.`,
156
+ };
157
+ }
158
+ /** Installed and runnable, which is not the same as on PATH — corepack shims can be both. */
159
+ async function canRun(manager, repo) {
160
+ const { code } = await run(`${manager} --version`, repo, 30_000);
161
+ return code === 0;
162
+ }
83
163
  async function installDeps(repo, onStep) {
84
164
  if (!existsSync(join(repo, 'package.json')))
85
165
  return null;
86
166
  if (existsSync(join(repo, 'node_modules')))
87
167
  return null;
88
- // `ci` is exact and fast but needs a lockfile that matches; `install` is the fallback.
89
- const lock = existsSync(join(repo, 'package-lock.json'));
90
- // --include=dev deliberately: the harness sets NODE_ENV=production for its own rendering, and
91
- // anything inherited that leaves out devDependencies leaves the agent with no typecheck.
92
- const cmd = lock ? 'npm ci --include=dev' : 'npm install --include=dev';
93
- onStep('installing dependencies (fresh worktree)');
94
- let { code, out } = await run(cmd, repo, INSTALL_TIMEOUT_MS);
95
- if (code !== 0 && lock) {
96
- // A lockfile out of step with package.json fails `ci` and nothing else. Worth one retry.
97
- onStep('npm ci did not fit the lockfile — trying npm install');
98
- ({ code, out } = await run('npm install --include=dev', repo, INSTALL_TIMEOUT_MS));
168
+ /**
169
+ * The lockfile says which package manager this project uses, and running the wrong one does
170
+ * not degrade — it fails. This ran `npm` on everything, so a yarn project (Kepler's App) met
171
+ * ERESOLVE on every card, the environment never started, and the agent correctly reported that
172
+ * it could not do the work. One repo-shaped assumption, every card in that repo lost.
173
+ *
174
+ * --include=dev and its equivalents, deliberately: the harness sets NODE_ENV=production for
175
+ * its own rendering, and anything inherited that leaves out devDependencies leaves the agent
176
+ * with no typecheck.
177
+ */
178
+ const has = (f) => existsSync(join(repo, f));
179
+ const chosen = await choosePackageManager(repo);
180
+ const manager = chosen.manager;
181
+ // Which one, and on what evidence — so a wrong install is a readable sentence, not a mystery.
182
+ if (chosen.unsettled)
183
+ onStep(chosen.unsettled);
184
+ const [first, fallback] = manager === 'yarn' ? ['yarn install --frozen-lockfile', 'yarn install']
185
+ : manager === 'pnpm' ? ['pnpm install --frozen-lockfile', 'pnpm install']
186
+ : has('package-lock.json') ? ['npm ci --include=dev', 'npm install --include=dev']
187
+ : ['npm install --include=dev', ''];
188
+ onStep(`installing dependencies (fresh worktree, ${manager} — ${chosen.why})`);
189
+ let { code, out } = await run(first, repo, INSTALL_TIMEOUT_MS);
190
+ if (code !== 0 && fallback) {
191
+ // A lockfile out of step with package.json fails the strict form and nothing else.
192
+ onStep(`${first.split(' ').slice(0, 2).join(' ')} did not fit the lockfile — trying ${fallback}`);
193
+ ({ code, out } = await run(fallback, repo, INSTALL_TIMEOUT_MS));
194
+ }
195
+ /**
196
+ * A peer-dependency conflict is the project's, not this card's.
197
+ *
198
+ * npm 7 and later REFUSE to install when peers disagree, where npm 6 warned and carried on.
199
+ * A real project can sit in that state for months — FlareDeck does, @angular/fire against a
200
+ * newer Angular — and the application builds and runs perfectly well regardless. Without this
201
+ * the harness stops at ERESOLVE, the agent correctly reports it cannot work, and EVERY card
202
+ * in that repository stalls on a disagreement nobody is going to resolve today.
203
+ *
204
+ * Last, never first: it is the flag that makes npm install something it would otherwise call
205
+ * unsafe, so it is what you reach for once the honest attempts have failed, and the step says
206
+ * so out loud rather than papering over it.
207
+ */
208
+ if (code !== 0 && manager === 'npm' && /ERESOLVE|peer dep/i.test(out)) {
209
+ onStep('peer dependencies disagree in this project — retrying with --legacy-peer-deps');
210
+ ({ code, out } = await run('npm install --include=dev --legacy-peer-deps', repo, INSTALL_TIMEOUT_MS));
99
211
  }
100
212
  onStep(code === 0 ? 'dependencies installed' : 'dependencies could NOT be installed');
101
213
  return {
102
214
  name: 'dependencies',
103
215
  ok: code === 0,
104
216
  fixed: code === 0,
105
- detail: code === 0 ? '' : out.trim().split('\n').slice(-6).join('\n').slice(0, 600),
217
+ // The manager and why it was chosen, first: an install that failed under the wrong one
218
+ // looks exactly like an install that failed, and whoever reads this needs to tell them apart.
219
+ detail: code === 0 ? '' : [`${manager}: ${chosen.why}`, out.trim().split('\n').slice(-6).join('\n')].join('\n').slice(0, 700),
106
220
  };
107
221
  }
108
222
  export async function preflight(repo, onStep) {
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.js","sourceRoot":"","sources":["../src/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AA0C7B;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACpD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC;QAC7D,OAAO,OAAO,CAAC,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAA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G,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAE7C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC,MAAM;YACjB,CAAC,CAAC,sCAAsC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,uCAAuC;YAClH,CAAC,CAAC,yEAAyE,CAAC;IAChF,CAAC;IAED,OAAO,CACL,wEAAwE;QACxE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,MAAM,IAAI,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC7E,+FAA+F;QAC/F,gGAAgG;QAChG,4BAA4B,CAC7B,CAAC;AACJ,CAAC"}
@@ -1,84 +1,10 @@
1
- import { Box, Text, render, useApp, useInput } from 'ink';
2
- import React, { useState } from 'react';
1
+ import { pickMany } from './picker.js';
3
2
  /**
4
3
  * Tick the repositories an agent may work in.
5
4
  *
6
- * This was a numbered list you typed numbers at, and the numbers TOGGLED. Everything started
7
- * ticked, so typing the four you wanted turned those four off — the list said "to toggle" and it
8
- * still read as "to choose". A prompt whose plainest reading is the opposite of what it does is
9
- * not a prompt worth keeping, and the fix is not better wording: it is to stop asking people to
10
- * hold the current state in their head. Move, press space, see the tick change.
5
+ * The interaction itself now lives in `picker.tsx`, shared with the board picker — the same
6
+ * question with different nouns, and the note it carries about toggling is worth reading once.
11
7
  */
12
- const MAX_ROWS = 16;
13
- function Picker({ root, repos, initial, onDone, }) {
14
- const { exit } = useApp();
15
- const [on, setOn] = useState(new Set(initial));
16
- const [at, setAt] = useState(0);
17
- const done = (picked) => { onDone(picked); exit(); };
18
- useInput((input, key) => {
19
- if (key.upArrow || input === 'k')
20
- setAt((i) => (i - 1 + repos.length) % repos.length);
21
- else if (key.downArrow || input === 'j')
22
- setAt((i) => (i + 1) % repos.length);
23
- else if (input === ' ') {
24
- const name = repos[at]?.name;
25
- if (name)
26
- setOn((s) => { const n = new Set(s); if (n.has(name))
27
- n.delete(name);
28
- else
29
- n.add(name); return n; });
30
- }
31
- else if (input === 'a')
32
- setOn(new Set(repos.map((r) => r.name)));
33
- else if (input === 'n')
34
- setOn(new Set());
35
- else if (key.return)
36
- done(repos.filter((r) => on.has(r.name)).map((r) => r.name));
37
- // Escape leaves the config alone rather than saving an empty choice — a cancelled prompt
38
- // should change nothing, and "none of them" is a thing you say with n then enter.
39
- else if (key.escape || input === 'q')
40
- done(null);
41
- });
42
- // A window, so a folder of forty repos does not scroll the question off the screen.
43
- const half = Math.floor(MAX_ROWS / 2);
44
- const first = Math.max(0, Math.min(at - half, repos.length - MAX_ROWS));
45
- const shown = repos.slice(first, first + MAX_ROWS);
46
- const width = Math.max(...repos.map((r) => r.name.length));
47
- return (React.createElement(Box, { flexDirection: "column" },
48
- React.createElement(Text, null,
49
- React.createElement(Text, { bold: true }, "Which of these may this agent work in?"),
50
- React.createElement(Text, { dimColor: true },
51
- " \u00B7 ",
52
- repos.length,
53
- " found in ",
54
- root)),
55
- React.createElement(Box, { height: 1 }),
56
- first > 0 ? React.createElement(Text, { dimColor: true },
57
- " \u2191 ",
58
- first,
59
- " more") : null,
60
- shown.map((r, i) => {
61
- const here = first + i === at;
62
- const ticked = on.has(r.name);
63
- return (React.createElement(Text, { key: r.path, color: here ? 'cyan' : undefined },
64
- here ? '❯ ' : ' ',
65
- React.createElement(Text, { color: ticked ? 'green' : undefined }, ticked ? '◉' : '◯'),
66
- ' ',
67
- React.createElement(Text, { bold: ticked }, r.name.padEnd(width)),
68
- React.createElement(Text, { dimColor: true },
69
- " ",
70
- r.origin ? shortRemote(r.origin) : 'no remote — nothing it pushes can be received')));
71
- }),
72
- first + MAX_ROWS < repos.length ? React.createElement(Text, { dimColor: true },
73
- " \u2193 ",
74
- repos.length - first - MAX_ROWS,
75
- " more") : null,
76
- React.createElement(Box, { height: 1 }),
77
- React.createElement(Text, { dimColor: true },
78
- "\u2191\u2193 move \u00B7 space tick \u00B7 a all \u00B7 n none \u00B7 enter accept (",
79
- on.size,
80
- " selected) \u00B7 esc cancel")));
81
- }
82
8
  const shortRemote = (url) => url.trim().toLowerCase()
83
9
  .replace(/^git@([^:]+):/, '$1/')
84
10
  .replace(/^[a-z]+:\/\//, '')
@@ -88,24 +14,10 @@ const shortRemote = (url) => url.trim().toLowerCase()
88
14
  .join('/');
89
15
  /** Resolves to the ticked names, or null when the person backed out without choosing. */
90
16
  export function pickRepos(root, repos, initial) {
91
- return new Promise((resolve) => {
92
- // Resolved from the callback AND from the unmount, whichever happens first, because this sits
93
- // in the middle of login: a picker that renders but never returns is a login that hangs with
94
- // no way forward. startApprovals settles the same two ways for the same reason.
95
- let settled = false;
96
- let app = null;
97
- const finish = (picked) => {
98
- if (settled)
99
- return;
100
- settled = true;
101
- try {
102
- app?.unmount();
103
- }
104
- catch { /* already gone */ }
105
- resolve(picked);
106
- };
107
- app = render(React.createElement(Picker, { root: root, repos: repos, initial: initial, onDone: finish }));
108
- void app.waitUntilExit().then(() => finish(null));
109
- });
17
+ return pickMany('Which of these may this agent work in?', `${repos.length} found in ${root}`, repos.map((r) => ({
18
+ id: r.name,
19
+ label: r.name,
20
+ note: r.origin ? shortRemote(r.origin) : 'no remote — nothing it pushes can be received',
21
+ })), initial);
110
22
  }
111
23
  //# sourceMappingURL=repopicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repopicker.js","sourceRoot":"","sources":["../src/repopicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,E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;KACzF,CAAC,CAAC,EACH,OAAO,CACR,CAAC;AACJ,CAAC"}
package/dist/runs.d.ts CHANGED
@@ -72,17 +72,32 @@ export declare function previewFor(script: string): string | null;
72
72
  */
73
73
  export declare function resumeApprovedRuns(targets: Record<string, RunTarget>, deck: Flaredeck, cwd: string, log: (text: string) => void): Promise<number>;
74
74
  /** What the harness does on the agent's behalf once a person has to be involved. */
75
+ export type Choice = {
76
+ label: string;
77
+ detail?: string;
78
+ };
75
79
  export type HumanHooks = {
76
80
  /** Flag the card and tell whoever the board names. Returns who was told, when it says. */
77
- flag: (reason: string, kind: string) => Promise<string | null>;
78
- /** The card has been answered, so it is no longer waiting on anybody. */
79
- unflag: () => Promise<void>;
81
+ flag: (reason: string, kind: string, ask?: {
82
+ question: string;
83
+ options: Choice[];
84
+ }) => Promise<string | null>;
85
+ /** Put a local file on the card. The harness does the upload, so no shell command is judged. */
86
+ attach?: (card: Current, path: string, comment?: string) => Promise<string>;
87
+ /** The card has been answered, so it is no longer waiting on anybody. Clear the flag on THIS card — by the time an answer arrives the agent may be on another. */
88
+ unflag: (card: Current) => Promise<void>;
80
89
  };
81
90
  export declare function runTools(configured: Record<string, RunTarget>, current: () => Current | null, deck: Flaredeck | null, log: (text: string) => void, human: HumanHooks,
82
91
  /** This agent's lead, when it has one: a script goes there first, and a person is asked only if the lead endorses it. */
83
92
  lead?: () => string | null,
84
93
  /** The pane, told when a request is posted and when it is answered. */
85
- onAsk?: (e: AskEvent) => void): {
94
+ onAsk?: (e: AskEvent) => void,
95
+ /**
96
+ * Bring a parked card back with the outcome of its request. When given, a script request does
97
+ * NOT hold the turn: the card is parked, the agent moves on to its next card, and this card
98
+ * returns to the front of the queue once a person answers. Without it, the old wait.
99
+ */
100
+ resume?: (card: Current, text: string) => void): {
86
101
  server: unknown;
87
102
  toolNames: string[];
88
103
  };