bareloop 0.54.0 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/bareloop.context.md +73 -12
  3. package/package.json +3 -3
  4. package/src/authorflow.js +148 -46
  5. package/src/authoring.js +21 -4
  6. package/src/authorjob.js +82 -3
  7. package/src/authorreadout.js +20 -3
  8. package/src/authorrun.js +1 -1
  9. package/src/authorscout.js +9 -6
  10. package/src/bridges.js +4 -3
  11. package/src/cardschedule.js +42 -0
  12. package/src/carrystore.js +1 -1
  13. package/src/checkpick.js +576 -0
  14. package/src/checksuggest.js +28 -0
  15. package/src/checkwords.js +25 -0
  16. package/src/cli.js +1 -1
  17. package/src/config.js +24 -1
  18. package/src/declaredclose.js +1 -1
  19. package/src/destpoint.js +149 -0
  20. package/src/draftspend.js +39 -0
  21. package/src/factwords.js +14 -1
  22. package/src/job.js +81 -1
  23. package/src/jobblock.js +9 -0
  24. package/src/labelscan.js +11 -0
  25. package/src/launcher.js +10 -6
  26. package/src/learn.js +6 -4
  27. package/src/mcpchecks.js +52 -0
  28. package/src/mcppick.js +36 -0
  29. package/src/mcpsources.js +77 -0
  30. package/src/mcpuse.js +97 -0
  31. package/src/natural.js +23 -0
  32. package/src/pagemap.js +5 -2
  33. package/src/panel/authorroutes.js +90 -15
  34. package/src/panel/authorsession.js +183 -21
  35. package/src/panel/index.html +686 -26
  36. package/src/panel/jobgrid.js +117 -0
  37. package/src/panel/jobplan.js +31 -15
  38. package/src/panel/scheduler.js +80 -13
  39. package/src/panel/schedules.js +189 -28
  40. package/src/panel/schedulestart.js +44 -13
  41. package/src/panel/server.js +438 -33
  42. package/src/panel/settingsroutes.js +133 -3
  43. package/src/panel/status.js +22 -2
  44. package/src/panel/tickets.js +44 -0
  45. package/src/pickrecord.js +145 -0
  46. package/src/plan.js +31 -2
  47. package/src/planrun.js +71 -15
  48. package/src/prcheckout.js +259 -0
  49. package/src/readshim.js +3 -2
  50. package/src/replay.js +6 -0
  51. package/src/reuse.js +3 -3
  52. package/src/revises.js +56 -0
  53. package/src/rubricstep.js +62 -16
  54. package/src/run.js +10 -1
  55. package/src/runexport.js +2 -0
  56. package/src/runlist.js +3 -2
  57. package/src/schedulewords.js +46 -4
  58. package/src/source.js +81 -7
  59. package/src/stepmcp.js +86 -0
  60. package/src/ticket.js +113 -0
  61. package/src/ticketfilter.js +76 -0
  62. package/src/ticketlabels.js +79 -0
  63. package/src/ticketmcp.js +111 -0
  64. package/src/ticketnext.js +35 -0
  65. package/src/ticketrepo.js +98 -0
  66. package/src/ticketschedule.js +32 -0
  67. package/src/ticketshape.js +45 -0
  68. package/src/tools.js +9 -0
  69. package/src/trigger.js +14 -2
  70. package/src/triggerclock.js +7 -3
  71. package/src/triggerfiles.js +19 -11
  72. package/src/triggertickets.js +244 -0
  73. package/src/u-readout.js +2 -2
  74. package/src/userrun.js +146 -10
  75. package/src/validate.js +3 -1
  76. package/src/worktree.js +43 -1
  77. package/types/authorflow.d.ts +128 -28
  78. package/types/authorjob.d.ts +16 -3
  79. package/types/authorreadout.d.ts +9 -2
  80. package/types/authorscout.d.ts +4 -2
  81. package/types/bridges.d.ts +4 -3
  82. package/types/cardschedule.d.ts +24 -0
  83. package/types/checkpick.d.ts +297 -0
  84. package/types/checksuggest.d.ts +30 -0
  85. package/types/checkwords.d.ts +14 -0
  86. package/types/config.d.ts +7 -0
  87. package/types/destpoint.d.ts +87 -0
  88. package/types/draftspend.d.ts +16 -0
  89. package/types/factwords.d.ts +7 -0
  90. package/types/job.d.ts +13 -0
  91. package/types/jobblock.d.ts +9 -0
  92. package/types/labelscan.d.ts +7 -0
  93. package/types/launcher.d.ts +7 -2
  94. package/types/mcpchecks.d.ts +8 -0
  95. package/types/mcppick.d.ts +33 -0
  96. package/types/mcpsources.d.ts +51 -0
  97. package/types/mcpuse.d.ts +15 -0
  98. package/types/natural.d.ts +2 -0
  99. package/types/pagemap.d.ts +2 -1
  100. package/types/panel/authorroutes.d.ts +11 -2
  101. package/types/panel/authorsession.d.ts +58 -3
  102. package/types/panel/jobgrid.d.ts +405 -0
  103. package/types/panel/jobplan.d.ts +10 -4
  104. package/types/panel/scheduler.d.ts +7 -2
  105. package/types/panel/schedules.d.ts +124 -4
  106. package/types/panel/schedulestart.d.ts +21 -3
  107. package/types/panel/server.d.ts +427 -6
  108. package/types/panel/settingsroutes.d.ts +4 -2
  109. package/types/panel/status.d.ts +16 -2
  110. package/types/panel/tickets.d.ts +61 -0
  111. package/types/pickrecord.d.ts +88 -0
  112. package/types/plan.d.ts +1 -0
  113. package/types/prcheckout.d.ts +151 -0
  114. package/types/readshim.d.ts +4 -3
  115. package/types/replay.d.ts +3 -0
  116. package/types/reuse.d.ts +2 -2
  117. package/types/revises.d.ts +23 -0
  118. package/types/rubricstep.d.ts +14 -5
  119. package/types/run.d.ts +18 -1
  120. package/types/runlist.d.ts +6 -3
  121. package/types/schedulewords.d.ts +29 -2
  122. package/types/source.d.ts +40 -4
  123. package/types/stepmcp.d.ts +40 -0
  124. package/types/ticket.d.ts +114 -0
  125. package/types/ticketfilter.d.ts +34 -0
  126. package/types/ticketlabels.d.ts +44 -0
  127. package/types/ticketmcp.d.ts +84 -0
  128. package/types/ticketnext.d.ts +33 -0
  129. package/types/ticketrepo.d.ts +118 -0
  130. package/types/ticketschedule.d.ts +21 -0
  131. package/types/ticketshape.d.ts +37 -0
  132. package/types/tools.d.ts +1 -0
  133. package/types/trigger.d.ts +9 -1
  134. package/types/triggerclock.d.ts +6 -2
  135. package/types/triggerfiles.d.ts +13 -5
  136. package/types/triggertickets.d.ts +110 -0
  137. package/types/userrun.d.ts +50 -0
  138. package/types/validate.d.ts +1 -0
  139. package/types/worktree.d.ts +19 -0
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The added paths in config.json; none when the file is missing, and a plain-words `problem` when it cannot be read (never papered over).
3
+ * @param {string} [home] the config home (tests); undefined = `~/.config/bareloop`
4
+ * @returns {{ paths: string[], problem: string|null }}
5
+ */
6
+ export function addedMcpPaths(home?: string): {
7
+ paths: string[];
8
+ problem: string | null;
9
+ };
10
+ /**
11
+ * Every place, in order, with the servers found in it.
12
+ * `status`: 'found' (a readable file), 'missing' (no file) or 'not-json' (a file that is not JSON; bare-agent skips it silently).
13
+ * A server: `{name, remote, shadowedBy}`; `shadowedBy` is the shown path of the earlier place that has the same name (the earlier one wins), or null.
14
+ * @param {{ home?: string, mcpHome?: string }} [o] `home` the config home (tests); `mcpHome` the person's home folder the four places live under
15
+ * (tests inject a fixture one so discovery never reads the real `~`; undefined = `os.homedir()`)
16
+ * @returns {{ places: Array<{ path: string, file: string, added: boolean, status: 'found'|'missing'|'not-json', servers: Array<{name: string, remote: boolean, shadowedBy: string|null}> }>, problem: string|null }}
17
+ */
18
+ export function mcpSources(o?: {
19
+ home?: string;
20
+ mcpHome?: string;
21
+ }): {
22
+ places: Array<{
23
+ path: string;
24
+ file: string;
25
+ added: boolean;
26
+ status: "found" | "missing" | "not-json";
27
+ servers: Array<{
28
+ name: string;
29
+ remote: boolean;
30
+ shadowedBy: string | null;
31
+ }>;
32
+ }>;
33
+ problem: string | null;
34
+ };
35
+ /**
36
+ * The file that holds the WINNING `server` (the first place in the list that has the name), whether it is remote, or null when no place has it.
37
+ * Every place bareloop starts an MCP from takes its config file from here.
38
+ * @param {string} server @param {{ home?: string, mcpHome?: string }} [o]
39
+ * @returns {{ file: string, remote: boolean } | null}
40
+ */
41
+ export function mcpConfigFor(server: string, o?: {
42
+ home?: string;
43
+ mcpHome?: string;
44
+ }): {
45
+ file: string;
46
+ remote: boolean;
47
+ } | null;
48
+ export { mcpPathProblem } from "./config.js";
49
+ export function DEFAULT_MCP_PLACES(home?: string): string[];
50
+ export function showMcpPath(p: string, home?: string): string;
51
+ export function expandMcpPath(p: string, home?: string): string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @param {Array<{ spine?: string, runid?: string }>} rows the run list's rows (`readRunList().rows`)
3
+ * @param {string[]} servers the server names to count for; a step tool row belongs to the LONGEST name that prefixes it with `_`
4
+ * @returns {Map<string, { calls: number, runs: number, last: string|null, denied: number, tools: Map<string, number> }>}
5
+ */
6
+ export function countMcpUse(rows: Array<{
7
+ spine?: string;
8
+ runid?: string;
9
+ }>, servers: string[]): Map<string, {
10
+ calls: number;
11
+ runs: number;
12
+ last: string | null;
13
+ denied: number;
14
+ tools: Map<string, number>;
15
+ }>;
@@ -0,0 +1,2 @@
1
+ /** @param {unknown} x @param {unknown} y @returns {number} negative, 0 or positive, like a sort callback */
2
+ export function compareNatural(x: unknown, y: unknown): number;
@@ -101,6 +101,7 @@ export function readingOfQuestion(q: unknown): string | null;
101
101
  * bound they wrote themselves is theirs and nothing is asked. `agree` writes the reading as a `~` rule in plain words (the answer text is
102
102
  * `reading`), so the drafter is told it and the fact signs plain.
103
103
  * - CAN'T CHECK: no kept fact carries it (PRD v1.106 Part 5 Q3 T2). `drop it` leaves it Not checked.
104
+ * A COUNT rule (`isCountable`: words, list items or lines, sections) is none of these: it is asked once, as a pick (R10, fwd am24); the look's facts about it stay.
104
105
  * One ask per rule text on a line; readings first, then can't-check asks, each in line order. The caller applies the machine's cap and the answer gate.
105
106
  * @param {{facts?: {line: number, forRule?: number, name?: string, shape?: string, unit?: string[], currency?: string[], reading?: import('./pagerules.js').Reading}[]}|null|undefined} look
106
107
  * @param {{n: number, text?: string, rule?: string, rules?: string[]}[]|null|undefined} jobLines
@@ -148,7 +149,7 @@ export type LookAsk = {
148
149
  rule: number;
149
150
  source: "look";
150
151
  question: string;
151
- ask: "reading" | "cant-check";
152
+ ask: "reading" | "cant-check" | "check" | "no-check";
152
153
  ruleText: string;
153
154
  reading?: string;
154
155
  };
@@ -53,8 +53,9 @@ export function settleFetchingStep(state: any): void;
53
53
  * deliberately has none of).
54
54
  * @param {{ port: number, token: string, env?: Record<string,string|undefined>,
55
55
  * sessionsRoot?: string, spawnFn?: typeof realSpawn, bareloopBin?: string,
56
- * jobsDir?: string, fetchImpl?: typeof fetch, home?: string,
56
+ * jobsDir?: string, fetchImpl?: typeof fetch, home?: string, mcpHome?: string, newestUnrunTicket?: typeof newestUnrunTicket,
57
57
  * schedules?: ReturnType<typeof import('./schedules.js').createScheduleDoor>,
58
+ * isSkippedTicket?: (job: string, number: number) => boolean, skippedRunOf?: (job: string, number: number) => string|null,
58
59
  * sessionDeps?: Record<string, any>,
59
60
  * runJobNames?: () => string[],
60
61
  * startFrom?: {get: (runid: string, o?: {model?: string}) => any, getImport: (id: string, o?: {model?: string}) => any, listJobs?: (o?: {model?: string}) => any[]} }} opts
@@ -69,7 +70,11 @@ export function createAuthorRoutes(opts: {
69
70
  jobsDir?: string;
70
71
  fetchImpl?: typeof fetch;
71
72
  home?: string;
73
+ mcpHome?: string;
74
+ newestUnrunTicket?: typeof newestUnrunTicket;
72
75
  schedules?: ReturnType<typeof import("./schedules.js").createScheduleDoor>;
76
+ isSkippedTicket?: (job: string, number: number) => boolean;
77
+ skippedRunOf?: (job: string, number: number) => string | null;
73
78
  sessionDeps?: Record<string, any>;
74
79
  runJobNames?: () => string[];
75
80
  startFrom?: {
@@ -115,7 +120,8 @@ export function createAuthorRoutes(opts: {
115
120
  * it to sign"), and this is where it is checked, not trusted.
116
121
  * @param {ReturnType<typeof createSession>} session
117
122
  * @param {string} claimedHash
118
- * @param {{env: any, spawnFn: typeof realSpawn, bareloopBin: string, sessionsRoot?: string, home?: string, reviewDoor?: boolean, onSpawnError?: (e: Error) => void, onExit?: (code: number|null) => void}} o
123
+ * @param {{env: any, spawnFn: typeof realSpawn, bareloopBin: string, sessionsRoot?: string, home?: string, reviewDoor?: boolean, onSpawnError?: (e: Error) => void, onExit?: (code: number|null) => void, anyway?: boolean, schedules?: ReturnType<typeof import('./schedules.js').createScheduleDoor>}} o
124
+ * `schedules` (R7, piece 9): the schedule door. A session whose card picked a Schedule has it signed WITH the job here, written OFF, before the run is spawned; a refusal spawns nothing.
119
125
  * @returns {{ok: boolean, error?: string, job?: string}}
120
126
  */
121
127
  export function signRun(session: ReturnType<typeof createSession>, claimedHash: string, o: {
@@ -127,6 +133,8 @@ export function signRun(session: ReturnType<typeof createSession>, claimedHash:
127
133
  reviewDoor?: boolean;
128
134
  onSpawnError?: (e: Error) => void;
129
135
  onExit?: (code: number | null) => void;
136
+ anyway?: boolean;
137
+ schedules?: ReturnType<typeof import("./schedules.js").createScheduleDoor>;
130
138
  }): {
131
139
  ok: boolean;
132
140
  error?: string;
@@ -140,5 +148,6 @@ export const OLD_JOB_RERUN_WORDS: "This run was made by an older bareloop. Its s
140
148
  export const OLD_JOB_PAUSE_WORDS: "This run was made by an older bareloop. Its saved job doesn't pass today's checks, so it can't be paused from here. Use Reuse workflow on a newer run, or start a new job.";
141
149
  export { panelMoney2 };
142
150
  import { spawn as realSpawn } from 'node:child_process';
151
+ import { newestUnrunTicket } from '../ticketnext.js';
143
152
  import { createSession } from './authorsession.js';
144
153
  import { panelMoney2 } from '../panelmoney.js';
@@ -14,7 +14,7 @@ export function advanceSteps(steps: StepLine[], id: string, detail?: string, lab
14
14
  * The confirm turn's plan as a chat message (P7): a STRUCTURED `{role:'bot', kind:'plan', plan}` the page draws with the
15
15
  * same renderer the Job tab uses — each numbered job line, its `~` rule, its drafted checks folded; the AI's own "not
16
16
  * checked"; the always-on guards. `questions` (what the plan still asks) ride inside the plan. One owner of the shape.
17
- * @param {{goal?: string, checks?: string[], checkItems?: {text: string, fromLine: number[]|null}[], notChecked?: string[], questions?: string[], protections?: string[], signedFacts?: string[]}} p the confirm turn's plan
17
+ * @param {{goal?: string, checks?: string[], checkItems?: {text: string, fromLine: number[]|null}[], notChecked?: string[], questions?: string[], protections?: string[], signedFacts?: string[], ticketFilter?: any, picked?: {line: number, text: string}[]}} p the confirm turn's plan
18
18
  * @param {{n: number, text: string, rule: string}[]|null} jobLines
19
19
  * @returns {{role: 'bot', kind: 'plan', text: string, plan: ReturnType<typeof planFromConfirm> & {goal: string, questions: string[]}}}
20
20
  */
@@ -29,6 +29,11 @@ export function planMessage(p: {
29
29
  questions?: string[];
30
30
  protections?: string[];
31
31
  signedFacts?: string[];
32
+ ticketFilter?: any;
33
+ picked?: {
34
+ line: number;
35
+ text: string;
36
+ }[];
32
37
  }, jobLines: {
33
38
  n: number;
34
39
  text: string;
@@ -80,6 +85,42 @@ export function cardSource(card: any): string;
80
85
  * @returns {Record<string, any>}
81
86
  */
82
87
  export function cardFields(card: any): Record<string, any>;
88
+ /**
89
+ * The card's flow type and MCP, normalised: a card with no `flowType` (or `plain`) is plain with no MCP; any other pick keeps its server name.
90
+ * @param {any} card @returns {{flowType: 'plain'|'mcp'|'tickets', mcp: string}}
91
+ */
92
+ export function flowOfCard(card: any): {
93
+ flowType: "plain" | "mcp" | "tickets";
94
+ mcp: string;
95
+ };
96
+ /**
97
+ * ITEM33-BUILD piece 8: what the card's Flow type and MCP become, decided at $0 before any session (nothing is started, no server runs). A plain card is `{flowType:'plain', pick:null}`.
98
+ * An MCP or Tickets card needs a server named in Settings > MCP and that server's newest successful `check tools` (`mcpPickFor`: ALL its tools, set by code); an unknown flow type, no pick, a
99
+ * never-checked MCP and a Tickets card with no ticket-list Inputs line are refused in plain words.
100
+ * @param {any} card @param {{ home?: string, mcpHome?: string }} [o]
101
+ * @returns {{ok: true, flowType: 'plain'|'mcp'|'tickets', pick: {server: string, tools: string[]}|null} | {ok: false, error: string}}
102
+ */
103
+ export function resolveFlowCard(card: any, o?: {
104
+ home?: string;
105
+ mcpHome?: string;
106
+ }): {
107
+ ok: true;
108
+ flowType: "plain" | "mcp" | "tickets";
109
+ pick: {
110
+ server: string;
111
+ tools: string[];
112
+ } | null;
113
+ } | {
114
+ ok: false;
115
+ error: string;
116
+ };
117
+ /**
118
+ * The by-hand ticket of a Tickets MCP run (ITEM33-BUILD piece 8): the number typed on the card, the same number `--ticket` takes, or BLANK = the newest ticket this job has not run
119
+ * (R6: `run-u` finds it with the schedule's own look, src/ticketnext.js, and a list that cannot be looked at says so and asks for a number). Any other job takes none.
120
+ * @param {any} card @param {'plain'|'mcp'|'tickets'} flowType the FINAL flow type of the job (the card's, or the reused spec's)
121
+ * @returns {string|null} the refusal in plain words, or null when the card is fine
122
+ */
123
+ export function ticketBoxProblem(card: any, flowType: "plain" | "mcp" | "tickets"): string | null;
83
124
  /**
84
125
  * Did any JOB box on `card` change from what the origin run prefilled (`origin`)? Whitespace is not compared (a one-line input drops
85
126
  * a text's newlines); an absent thinking tick reads as off.
@@ -165,8 +206,8 @@ export function validateJobCard(card: any, opts?: {
165
206
  * `signPrepare()` are the only ways in.
166
207
  * @param {any} card the validated job card (see {@link validateJobCard})
167
208
  * @param {{env?: Record<string,string|undefined>, sessionsRoot?: string, home?: string, timeoutMs?: number,
168
- * scout?: any, generate?: Function, confirmGenerate?: Function, authorFn?: Function,
169
- * prepareSigningFn?: Function, npmCiFn?: Function, lookFn?: Function|null, fitFn?: Function|null, fetchUrl?: (url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>, draftThinking?: "on"|"off", reuse?: {spec: any, workflowKey: string}}} [deps] `scout`..`prepareSigningFn` are
209
+ * scout?: any, generate?: Function, pickGenerate?: Function|null, carryFrom?: string, carryKind?: string, confirmGenerate?: Function, authorFn?: Function,
210
+ * prepareSigningFn?: Function, npmCiFn?: Function, lookFn?: Function|null, fitFn?: Function|null, destFn?: Function|null, fetchUrl?: (url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>, draftThinking?: "on"|"off", reuse?: {spec: any, workflowKey: string}, schedule?: import('../trigger.js').Trigger|null, flow?: {flowType: 'plain'|'mcp'|'tickets', pick: {server: string, tools: string[]}|null}}} [deps] `scout`..`prepareSigningFn` are
170
211
  * TEST SEAMS ONLY — see the note just above where each is read, below. `reuse` (Reuse workflow) is NOT a seam: the
171
212
  * caller (`/api/author/start`) sets it only when the server's own same-job rule held.
172
213
  * @returns {any} the session object
@@ -178,12 +219,16 @@ export function createSession(card: any, deps?: {
178
219
  timeoutMs?: number;
179
220
  scout?: any;
180
221
  generate?: Function;
222
+ pickGenerate?: Function | null;
223
+ carryFrom?: string;
224
+ carryKind?: string;
181
225
  confirmGenerate?: Function;
182
226
  authorFn?: Function;
183
227
  prepareSigningFn?: Function;
184
228
  npmCiFn?: Function;
185
229
  lookFn?: Function | null;
186
230
  fitFn?: Function | null;
231
+ destFn?: Function | null;
187
232
  fetchUrl?: (url: string) => Promise<{
188
233
  ok: true;
189
234
  text: string;
@@ -197,6 +242,14 @@ export function createSession(card: any, deps?: {
197
242
  spec: any;
198
243
  workflowKey: string;
199
244
  };
245
+ schedule?: import("../trigger.js").Trigger | null;
246
+ flow?: {
247
+ flowType: "plain" | "mcp" | "tickets";
248
+ pick: {
249
+ server: string;
250
+ tools: string[];
251
+ } | null;
252
+ };
200
253
  }): any;
201
254
  /**
202
255
  * THE PROGRESS LIST's one table (hamr 2026-10-04, "one place showing all"): every pipeline step the left Chat panel
@@ -230,6 +283,8 @@ export const CARD_FIELDS: readonly string[];
230
283
  export const JOB_BOXES: readonly string[];
231
284
  /** the refusal for a plain-files rubric job whose Destination is not an absolute folder (ends with the words the session start shows) */
232
285
  export const FILES_DESTINATION_WORDS: "Destination must be the full path of a folder, like /home/me/out \u2014 the finished files are delivered there. Nothing spent.";
286
+ /** the fixed example of a Destination refusal (code-owned; it never guesses a folder from the job's words) */
287
+ export const DESTINATION_HINT: "Type the folder that holds the files the job should change, like src/.";
233
288
  export type StepLine = {
234
289
  id: string;
235
290
  label: string;
@@ -0,0 +1,405 @@
1
+ /**
2
+ * ONE decider of a run's bucket: its status key through {@link GROUP_OF}; a run waiting at its review door (the run list's own `needs: 'Accept'`) needs the person, whatever its status.
3
+ * Anything the table does not know reads as Stopped.
4
+ * @param {string|null|undefined} statusKey @param {'Accept'|'Resume'|null|undefined} needs @returns {'wait'|'stop'|'done'|'skip'}
5
+ */
6
+ export function bucketOf(statusKey: string | null | undefined, needs: "Accept" | "Resume" | null | undefined): "wait" | "stop" | "done" | "skip";
7
+ /**
8
+ * A money figure in the panel's one spelling: `at least $0.08` when only a floor is known, `unknown` when nothing is (never `$0.00` for unknown).
9
+ * @param {number|null} usd @param {boolean} complete
10
+ */
11
+ export function moneyWords(usd: number | null, complete: boolean): string;
12
+ /**
13
+ * The stats line's money: the sum of the rows' money; a floor when any row's figure is a floor or unknown; `usd: null` = nothing is known.
14
+ * @param {Array<{usd: number|null, complete: boolean}>} moneys
15
+ */
16
+ export function sumMoney(moneys: Array<{
17
+ usd: number | null;
18
+ complete: boolean;
19
+ }>): {
20
+ usd: number | null;
21
+ complete: boolean;
22
+ };
23
+ /**
24
+ * One run's money: the run list's own figure (complete unless it says the figure is a floor), else the live/died floor, else unknown.
25
+ * @param {{spentUsd?: unknown, spendComplete?: unknown, spendFloorUsd?: unknown}} e
26
+ */
27
+ export function entryMoney(e: {
28
+ spentUsd?: unknown;
29
+ spendComplete?: unknown;
30
+ spendFloorUsd?: unknown;
31
+ }): {
32
+ usd: number;
33
+ complete: boolean;
34
+ } | {
35
+ usd: null;
36
+ complete: boolean;
37
+ };
38
+ /**
39
+ * The grid of one ticket job: every run a row in its bucket, newest first inside each bucket, and the stats line's numbers.
40
+ * @param {{entries: Array<{runId: string, runNo?: number|null, at: number|null, statusKey: string, sign: string, word: string, needs: 'Accept'|'Resume'|null, unsure?: boolean, number: number|null, title: string|null, url: string|null,
41
+ * steps: {done: number, total: number}|null, checks: {passed: number, total: number}|null, spentUsd: number|null, spendComplete: boolean, spendFloorUsd: number|null, wall: string|null, reason: string|null}>,
42
+ * scheduleLine?: string|null}} a
43
+ */
44
+ export function buildJobGrid({ entries, scheduleLine }: {
45
+ entries: Array<{
46
+ runId: string;
47
+ runNo?: number | null;
48
+ at: number | null;
49
+ statusKey: string;
50
+ sign: string;
51
+ word: string;
52
+ needs: "Accept" | "Resume" | null;
53
+ unsure?: boolean;
54
+ number: number | null;
55
+ title: string | null;
56
+ url: string | null;
57
+ steps: {
58
+ done: number;
59
+ total: number;
60
+ } | null;
61
+ checks: {
62
+ passed: number;
63
+ total: number;
64
+ } | null;
65
+ spentUsd: number | null;
66
+ spendComplete: boolean;
67
+ spendFloorUsd: number | null;
68
+ wall: string | null;
69
+ reason: string | null;
70
+ }>;
71
+ scheduleLine?: string | null;
72
+ }): {
73
+ groups: ({
74
+ rows: ({
75
+ anyway: boolean;
76
+ name: string;
77
+ ref: string;
78
+ bucket: "done" | "stop" | "skip" | "wait";
79
+ status: {
80
+ key: string;
81
+ sign: string;
82
+ word: string;
83
+ };
84
+ needs: "Accept" | "Resume" | null;
85
+ at: number | null;
86
+ steps: {
87
+ mark: "g" | "r" | "q" | "n";
88
+ text: string;
89
+ };
90
+ checks: {
91
+ mark: "g" | "r" | "q" | "n";
92
+ text: string;
93
+ };
94
+ cost: {
95
+ mark: string;
96
+ text: string;
97
+ };
98
+ time: {
99
+ mark: string;
100
+ text: string;
101
+ };
102
+ reason: string | null;
103
+ unsure: boolean;
104
+ unsureSay: string;
105
+ runId: string;
106
+ runNo: number | null;
107
+ number: number | null;
108
+ title: string | null;
109
+ url: string | null;
110
+ } | {
111
+ anyway: boolean;
112
+ name: string;
113
+ ref: string;
114
+ bucket: "done" | "stop" | "skip" | "wait";
115
+ status: {
116
+ key: string;
117
+ sign: string;
118
+ word: string;
119
+ };
120
+ needs: "Accept" | "Resume" | null;
121
+ at: number | null;
122
+ steps: {
123
+ mark: "g" | "r" | "q" | "n";
124
+ text: string;
125
+ };
126
+ checks: {
127
+ mark: "g" | "r" | "q" | "n";
128
+ text: string;
129
+ };
130
+ cost: {
131
+ mark: string;
132
+ text: string;
133
+ };
134
+ time: {
135
+ mark: string;
136
+ text: string;
137
+ };
138
+ reason: string | null;
139
+ unsure: boolean;
140
+ runId: string;
141
+ runNo: number | null;
142
+ number: number | null;
143
+ title: string | null;
144
+ url: string | null;
145
+ })[];
146
+ key: "wait";
147
+ label: "Needs you";
148
+ open: true;
149
+ } | {
150
+ rows: ({
151
+ anyway: boolean;
152
+ name: string;
153
+ ref: string;
154
+ bucket: "done" | "stop" | "skip" | "wait";
155
+ status: {
156
+ key: string;
157
+ sign: string;
158
+ word: string;
159
+ };
160
+ needs: "Accept" | "Resume" | null;
161
+ at: number | null;
162
+ steps: {
163
+ mark: "g" | "r" | "q" | "n";
164
+ text: string;
165
+ };
166
+ checks: {
167
+ mark: "g" | "r" | "q" | "n";
168
+ text: string;
169
+ };
170
+ cost: {
171
+ mark: string;
172
+ text: string;
173
+ };
174
+ time: {
175
+ mark: string;
176
+ text: string;
177
+ };
178
+ reason: string | null;
179
+ unsure: boolean;
180
+ unsureSay: string;
181
+ runId: string;
182
+ runNo: number | null;
183
+ number: number | null;
184
+ title: string | null;
185
+ url: string | null;
186
+ } | {
187
+ anyway: boolean;
188
+ name: string;
189
+ ref: string;
190
+ bucket: "done" | "stop" | "skip" | "wait";
191
+ status: {
192
+ key: string;
193
+ sign: string;
194
+ word: string;
195
+ };
196
+ needs: "Accept" | "Resume" | null;
197
+ at: number | null;
198
+ steps: {
199
+ mark: "g" | "r" | "q" | "n";
200
+ text: string;
201
+ };
202
+ checks: {
203
+ mark: "g" | "r" | "q" | "n";
204
+ text: string;
205
+ };
206
+ cost: {
207
+ mark: string;
208
+ text: string;
209
+ };
210
+ time: {
211
+ mark: string;
212
+ text: string;
213
+ };
214
+ reason: string | null;
215
+ unsure: boolean;
216
+ runId: string;
217
+ runNo: number | null;
218
+ number: number | null;
219
+ title: string | null;
220
+ url: string | null;
221
+ })[];
222
+ key: "stop";
223
+ label: "Stopped";
224
+ open: true;
225
+ } | {
226
+ rows: ({
227
+ anyway: boolean;
228
+ name: string;
229
+ ref: string;
230
+ bucket: "done" | "stop" | "skip" | "wait";
231
+ status: {
232
+ key: string;
233
+ sign: string;
234
+ word: string;
235
+ };
236
+ needs: "Accept" | "Resume" | null;
237
+ at: number | null;
238
+ steps: {
239
+ mark: "g" | "r" | "q" | "n";
240
+ text: string;
241
+ };
242
+ checks: {
243
+ mark: "g" | "r" | "q" | "n";
244
+ text: string;
245
+ };
246
+ cost: {
247
+ mark: string;
248
+ text: string;
249
+ };
250
+ time: {
251
+ mark: string;
252
+ text: string;
253
+ };
254
+ reason: string | null;
255
+ unsure: boolean;
256
+ unsureSay: string;
257
+ runId: string;
258
+ runNo: number | null;
259
+ number: number | null;
260
+ title: string | null;
261
+ url: string | null;
262
+ } | {
263
+ anyway: boolean;
264
+ name: string;
265
+ ref: string;
266
+ bucket: "done" | "stop" | "skip" | "wait";
267
+ status: {
268
+ key: string;
269
+ sign: string;
270
+ word: string;
271
+ };
272
+ needs: "Accept" | "Resume" | null;
273
+ at: number | null;
274
+ steps: {
275
+ mark: "g" | "r" | "q" | "n";
276
+ text: string;
277
+ };
278
+ checks: {
279
+ mark: "g" | "r" | "q" | "n";
280
+ text: string;
281
+ };
282
+ cost: {
283
+ mark: string;
284
+ text: string;
285
+ };
286
+ time: {
287
+ mark: string;
288
+ text: string;
289
+ };
290
+ reason: string | null;
291
+ unsure: boolean;
292
+ runId: string;
293
+ runNo: number | null;
294
+ number: number | null;
295
+ title: string | null;
296
+ url: string | null;
297
+ })[];
298
+ key: "done";
299
+ label: "Passed";
300
+ open: false;
301
+ } | {
302
+ rows: ({
303
+ anyway: boolean;
304
+ name: string;
305
+ ref: string;
306
+ bucket: "done" | "stop" | "skip" | "wait";
307
+ status: {
308
+ key: string;
309
+ sign: string;
310
+ word: string;
311
+ };
312
+ needs: "Accept" | "Resume" | null;
313
+ at: number | null;
314
+ steps: {
315
+ mark: "g" | "r" | "q" | "n";
316
+ text: string;
317
+ };
318
+ checks: {
319
+ mark: "g" | "r" | "q" | "n";
320
+ text: string;
321
+ };
322
+ cost: {
323
+ mark: string;
324
+ text: string;
325
+ };
326
+ time: {
327
+ mark: string;
328
+ text: string;
329
+ };
330
+ reason: string | null;
331
+ unsure: boolean;
332
+ unsureSay: string;
333
+ runId: string;
334
+ runNo: number | null;
335
+ number: number | null;
336
+ title: string | null;
337
+ url: string | null;
338
+ } | {
339
+ anyway: boolean;
340
+ name: string;
341
+ ref: string;
342
+ bucket: "done" | "stop" | "skip" | "wait";
343
+ status: {
344
+ key: string;
345
+ sign: string;
346
+ word: string;
347
+ };
348
+ needs: "Accept" | "Resume" | null;
349
+ at: number | null;
350
+ steps: {
351
+ mark: "g" | "r" | "q" | "n";
352
+ text: string;
353
+ };
354
+ checks: {
355
+ mark: "g" | "r" | "q" | "n";
356
+ text: string;
357
+ };
358
+ cost: {
359
+ mark: string;
360
+ text: string;
361
+ };
362
+ time: {
363
+ mark: string;
364
+ text: string;
365
+ };
366
+ reason: string | null;
367
+ unsure: boolean;
368
+ runId: string;
369
+ runNo: number | null;
370
+ number: number | null;
371
+ title: string | null;
372
+ url: string | null;
373
+ })[];
374
+ key: "skip";
375
+ label: "Skipped";
376
+ open: false;
377
+ })[];
378
+ scheduleLine: string | null;
379
+ stats: {
380
+ counts: {
381
+ [k: string]: number;
382
+ };
383
+ spent: string;
384
+ spentUsd: number | null;
385
+ spentComplete: boolean;
386
+ };
387
+ };
388
+ /** the buckets, in the mockup's order */
389
+ export const GRID_BUCKETS: readonly (Readonly<{
390
+ key: "wait";
391
+ label: "Needs you";
392
+ open: true;
393
+ }> | Readonly<{
394
+ key: "stop";
395
+ label: "Stopped";
396
+ open: true;
397
+ }> | Readonly<{
398
+ key: "done";
399
+ label: "Passed";
400
+ open: false;
401
+ }> | Readonly<{
402
+ key: "skip";
403
+ label: "Skipped";
404
+ open: false;
405
+ }>)[];