bareloop 0.54.1 → 0.56.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.
- package/CHANGELOG.md +122 -0
- package/bareloop.context.md +67 -6
- package/package.json +3 -3
- package/src/authorflow.js +217 -238
- package/src/authoring.js +22 -6
- package/src/authorjob.js +138 -30
- package/src/authorreadout.js +15 -4
- package/src/authorrun.js +13 -4
- package/src/authorscout.js +9 -6
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/cardschedule.js +42 -0
- package/src/checkblock.js +772 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +294 -0
- package/src/checksuggest.js +28 -0
- package/src/checkwords.js +27 -0
- package/src/cli.js +1 -1
- package/src/config.js +24 -1
- package/src/declaredclose.js +30 -1
- package/src/destpoint.js +151 -0
- package/src/draftspend.js +85 -0
- package/src/facts.js +8 -1
- package/src/factwords.js +14 -1
- package/src/fitcheck.js +5 -3
- package/src/job.js +81 -1
- package/src/jobblock.js +9 -0
- package/src/labelscan.js +11 -0
- package/src/launcher.js +3 -2
- package/src/mcpchecks.js +52 -0
- package/src/mcppick.js +36 -0
- package/src/mcpsources.js +77 -0
- package/src/mcpuse.js +97 -0
- package/src/natural.js +23 -0
- package/src/pagemap.js +20 -5
- package/src/panel/authorroutes.js +105 -18
- package/src/panel/authorsession.js +293 -44
- package/src/panel/index.html +873 -41
- package/src/panel/jobgrid.js +117 -0
- package/src/panel/jobplan.js +103 -35
- package/src/panel/scheduler.js +80 -13
- package/src/panel/schedules.js +189 -28
- package/src/panel/schedulestart.js +44 -13
- package/src/panel/server.js +471 -39
- package/src/panel/settingsroutes.js +133 -3
- package/src/panel/status.js +19 -1
- package/src/panel/tickets.js +44 -0
- package/src/pickrecord.js +163 -0
- package/src/placerule.js +355 -0
- package/src/plan.js +31 -2
- package/src/planrun.js +71 -15
- package/src/prcheckout.js +259 -0
- package/src/promptregisters.js +11 -0
- package/src/questionbox.js +112 -0
- package/src/readshim.js +3 -2
- package/src/revises.js +56 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +265 -132
- package/src/run.js +19 -2
- package/src/runexport.js +2 -0
- package/src/runlist.js +3 -2
- package/src/schedulewords.js +46 -4
- package/src/source.js +81 -7
- package/src/stepmcp.js +86 -0
- package/src/ticket.js +113 -0
- package/src/ticketfilter.js +76 -0
- package/src/ticketlabels.js +79 -0
- package/src/ticketmcp.js +111 -0
- package/src/ticketnext.js +35 -0
- package/src/ticketrepo.js +98 -0
- package/src/ticketschedule.js +32 -0
- package/src/ticketshape.js +45 -0
- package/src/tools.js +9 -0
- package/src/trigger.js +14 -2
- package/src/triggerclock.js +7 -3
- package/src/triggerfiles.js +19 -11
- package/src/triggertickets.js +244 -0
- package/src/userrun.js +191 -10
- package/src/validate.js +3 -1
- package/src/worktree.js +43 -1
- package/types/authorflow.d.ts +86 -93
- package/types/authorjob.d.ts +35 -4
- package/types/authorreadout.d.ts +4 -3
- package/types/authorscout.d.ts +4 -2
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +37 -0
- package/types/cardschedule.d.ts +24 -0
- package/types/checkblock.d.ts +361 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +160 -0
- package/types/checksuggest.d.ts +30 -0
- package/types/checkwords.d.ts +14 -0
- package/types/config.d.ts +7 -0
- package/types/declaredclose.d.ts +4 -0
- package/types/destpoint.d.ts +89 -0
- package/types/draftspend.d.ts +37 -0
- package/types/factwords.d.ts +7 -0
- package/types/fitcheck.d.ts +7 -1
- package/types/job.d.ts +13 -0
- package/types/jobblock.d.ts +9 -0
- package/types/labelscan.d.ts +7 -0
- package/types/launcher.d.ts +2 -2
- package/types/mcpchecks.d.ts +8 -0
- package/types/mcppick.d.ts +33 -0
- package/types/mcpsources.d.ts +51 -0
- package/types/mcpuse.d.ts +15 -0
- package/types/natural.d.ts +2 -0
- package/types/pagemap.d.ts +6 -1
- package/types/panel/authorroutes.d.ts +11 -2
- package/types/panel/authorsession.d.ts +69 -3
- package/types/panel/jobgrid.d.ts +405 -0
- package/types/panel/jobplan.d.ts +55 -11
- package/types/panel/scheduler.d.ts +7 -2
- package/types/panel/schedules.d.ts +124 -4
- package/types/panel/schedulestart.d.ts +21 -3
- package/types/panel/server.d.ts +432 -10
- package/types/panel/settingsroutes.d.ts +4 -2
- package/types/panel/status.d.ts +16 -2
- package/types/panel/tickets.d.ts +61 -0
- package/types/pickrecord.d.ts +100 -0
- package/types/placerule.d.ts +194 -0
- package/types/plan.d.ts +1 -0
- package/types/prcheckout.d.ts +151 -0
- package/types/questionbox.d.ts +87 -0
- package/types/readshim.d.ts +4 -3
- package/types/revises.d.ts +23 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +100 -48
- package/types/run.d.ts +27 -1
- package/types/runlist.d.ts +6 -3
- package/types/schedulewords.d.ts +29 -2
- package/types/source.d.ts +40 -4
- package/types/stepmcp.d.ts +40 -0
- package/types/ticket.d.ts +114 -0
- package/types/ticketfilter.d.ts +34 -0
- package/types/ticketlabels.d.ts +44 -0
- package/types/ticketmcp.d.ts +84 -0
- package/types/ticketnext.d.ts +33 -0
- package/types/ticketrepo.d.ts +118 -0
- package/types/ticketschedule.d.ts +21 -0
- package/types/ticketshape.d.ts +37 -0
- package/types/tools.d.ts +1 -0
- package/types/trigger.d.ts +9 -1
- package/types/triggerclock.d.ts +6 -2
- package/types/triggerfiles.d.ts +13 -5
- package/types/triggertickets.d.ts +110 -0
- package/types/userrun.d.ts +50 -0
- package/types/validate.d.ts +1 -0
- package/types/worktree.d.ts +19 -0
package/types/rubricstep.d.ts
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
* @returns {string}
|
|
4
4
|
*/
|
|
5
5
|
export function stepFileContract(): string;
|
|
6
|
+
/**
|
|
7
|
+
* R10 (fwd am28, rewritten here): what a facts+text line's worker is told about the person's picks, one plain line per pick, the values and what counts, never a verdict and never any other
|
|
8
|
+
* check. Written by code from the signed pick parts; a list item is what bareguard's listItems counts (its own line starting with "1." or "- " and a space).
|
|
9
|
+
* @param {any[]} picked countable parts (`{check, value, names, ...}`) @returns {string[]}
|
|
10
|
+
*/
|
|
11
|
+
export function toldPicks(picked: any[]): string[];
|
|
6
12
|
/**
|
|
7
13
|
* What the worker is told about each line, from the close that will grade it (PART 1b item 7): a FACTS line gets its
|
|
8
14
|
* facts and its count; a TEXT line that follows a facts line is told its numbers come from that line's quotes. Written by code from
|
|
@@ -170,11 +176,16 @@ export function inputLabelsOf(inputs: unknown): string[] | null;
|
|
|
170
176
|
* naming both parts and both numbers;
|
|
171
177
|
* - a `cited` part names a label the person's inputs do not have.
|
|
172
178
|
* @param {any[]} stages the declaration's stages
|
|
173
|
-
* @param {{inputLabels?: string[]|null, red: (code: string, path: string, detail: string, extra?: object) => void}} o
|
|
174
|
-
* `inputLabels` absent = the label rule is not run (a caller with no inputs in hand)
|
|
179
|
+
* @param {{inputLabels?: string[]|null, picks?: {line: number, part: any}[]|null, red: (code: string, path: string, detail: string, extra?: object) => void}} o
|
|
180
|
+
* `inputLabels` absent = the label rule is not run (a caller with no inputs in hand);
|
|
181
|
+
* `picks` = the record of the person's picks (`declaration.picks`, `{line, part}` each): the only countable parts a fact line may carry
|
|
175
182
|
*/
|
|
176
|
-
export function checkRubricParts(stages: any[], { inputLabels, red }: {
|
|
183
|
+
export function checkRubricParts(stages: any[], { inputLabels, red, picks }: {
|
|
177
184
|
inputLabels?: string[] | null;
|
|
185
|
+
picks?: {
|
|
186
|
+
line: number;
|
|
187
|
+
part: any;
|
|
188
|
+
}[] | null;
|
|
178
189
|
red: (code: string, path: string, detail: string, extra?: object) => void;
|
|
179
190
|
}): void;
|
|
180
191
|
/** the ~ rules of one job line, one string each (`rules` when the line has the array, else the joined `rule` split on "; ") @param {any} l @returns {string[]} */
|
|
@@ -194,41 +205,69 @@ export function checkRubricRules(stages: any[], { jobLines, refused, red }: {
|
|
|
194
205
|
red: (code: string, path: string, detail: string, extra?: object) => void;
|
|
195
206
|
}): void;
|
|
196
207
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* - a time range the AI proposed while the person wrote ONE explicit positive time range ("between 07:00 and 23:00") on that line
|
|
201
|
-
* is replaced by exactly that range (smv710w8c3wdh: the plan said 5:00 AM). Only when it is unambiguous: one such range in the
|
|
202
|
-
* line's rules and one AI-proposed `between` time fact on the line; a rule with a negation ("not between ...") is never read as a range;
|
|
203
|
-
* - a `~` rule is a check or under Not checked, never both: a `refused` entry for a rule that a part of its own line carries is dropped.
|
|
204
|
-
* Pure; returns a new declaration, the input untouched. The model is told the same in the brief; this makes it true either way.
|
|
205
|
-
* @param {any} declaration @param {any[]|null|undefined} jobLines @returns {any}
|
|
208
|
+
* Does this rule text hold more than one amount (money) or more than one time range (time)? The ONE guard code's own limit read and an AI
|
|
209
|
+
* reading edit both use: "under $450 or over $900" is two limits, and one reading of it would be a wrong check.
|
|
210
|
+
* @param {string} shape @param {string} text @returns {boolean}
|
|
206
211
|
*/
|
|
207
|
-
export function
|
|
212
|
+
export function holdsManyBounds(shape: string, text: string): boolean;
|
|
208
213
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* @param {any} declaration @returns {any}
|
|
214
|
+
* The limit the person's own words give a fact of this shape: `{reading}` or `{why}` (a plain reason; the rule then stays Not checked).
|
|
215
|
+
* @param {string} shape money or time @param {string} text the `~` rule's words @param {any} [fact] the look fact (its currency and unit lists must fit)
|
|
216
|
+
* @returns {{reading: {op: 'lt'|'lte'|'gt'|'gte', value: number} | {op: 'between', lo: number|string, hi: number|string}} | {why: string}}
|
|
213
217
|
*/
|
|
214
|
-
export function
|
|
218
|
+
export function readLimit(shape: string, text: string, fact?: any): {
|
|
219
|
+
reading: {
|
|
220
|
+
op: "lt" | "lte" | "gt" | "gte";
|
|
221
|
+
value: number;
|
|
222
|
+
} | {
|
|
223
|
+
op: "between";
|
|
224
|
+
lo: number | string;
|
|
225
|
+
hi: number | string;
|
|
226
|
+
};
|
|
227
|
+
} | {
|
|
228
|
+
why: string;
|
|
229
|
+
};
|
|
215
230
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* narrower check is still said) -> one line in `closeDecl.notes`, shown as Not checked (the AI's own reading).
|
|
221
|
-
* Never a line-level `refused` entry without `rule` (that would silence every other rule red on the line). A rule the drafter already listed
|
|
222
|
-
* itself is never listed twice, and running this twice adds nothing. Pure; the input is untouched.
|
|
223
|
-
* @param {any} declaration @param {import('./pagerules.js').Dropped[]|null|undefined} dropped @param {any[]|null|undefined} jobLines @returns {any}
|
|
231
|
+
* A check-list row named in the person's plain words: `phrase "### Fixed"`. The words are the draft log's; with none, the text after the key's kind prefix (`L1.phrase.### fixed`).
|
|
232
|
+
* Never empty. Pure.
|
|
233
|
+
* @param {unknown} kind @param {string} key @param {string[]|null|undefined} words
|
|
234
|
+
* @returns {string}
|
|
224
235
|
*/
|
|
225
|
-
export function
|
|
236
|
+
export function listRowName(kind: unknown, key: string, words: string[] | null | undefined): string;
|
|
226
237
|
/**
|
|
227
238
|
* The ~ rules the drafter listed under Not checked (`refused` entries that name a `rule`), each as one line in the person's own
|
|
228
239
|
* words: `line N: "<the rule as written>" — <the drafter's reason>` (PART 1b, RF6 / RF16).
|
|
229
|
-
* @param {any} closeDecl @param {any[]|null|undefined} jobLines @returns {string[]}
|
|
240
|
+
* @param {any} closeDecl @param {any[]|null|undefined} jobLines @param {{key: string, words: string[]}[]|null} [ledger] the draft log's final list rows (`readDraftLedger`) @returns {string[]}
|
|
230
241
|
*/
|
|
231
|
-
export function ruleNotChecked(closeDecl: any, jobLines: any[] | null | undefined
|
|
242
|
+
export function ruleNotChecked(closeDecl: any, jobLines: any[] | null | undefined, ledger?: {
|
|
243
|
+
key: string;
|
|
244
|
+
words: string[];
|
|
245
|
+
}[] | null): string[];
|
|
246
|
+
/** the same lines as {@link ruleNotChecked}, each with who it belongs to (`by`: the row's kind, F-c) @param {any} closeDecl @param {any[]|null|undefined} jobLines @param {{key: string, words: string[]}[]|null} [ledger] @returns {{text: string, by?: 'you'|'agent'|'default'}[]} */
|
|
247
|
+
export function ruleNotCheckedItems(closeDecl: any, jobLines: any[] | null | undefined, ledger?: {
|
|
248
|
+
key: string;
|
|
249
|
+
words: string[];
|
|
250
|
+
}[] | null): {
|
|
251
|
+
text: string;
|
|
252
|
+
by?: "you" | "agent" | "default";
|
|
253
|
+
}[];
|
|
254
|
+
/**
|
|
255
|
+
* The refusals of a signed close, as ONE reader: when the close carries the one check list (`closeDecl.list`) its not-checked rows are the refusals (a `~` rule's row names the rule, a fact row its
|
|
256
|
+
* fact name); the old `closeDecl.refused` entries a list has no row for (a line-level refusal, a rule the list never saw) are kept, so nothing the older close said is lost. A close with no list
|
|
257
|
+
* reads `refused` alone. Pure.
|
|
258
|
+
* @param {any} closeDecl
|
|
259
|
+
* @returns {{line: number, rule?: number, kind?: string, key?: string, by?: 'you'|'agent'|'default', label?: string, reason: string, fromList: boolean}[]}
|
|
260
|
+
*/
|
|
261
|
+
export function refusedOf(closeDecl: any): {
|
|
262
|
+
line: number;
|
|
263
|
+
rule?: number;
|
|
264
|
+
kind?: string;
|
|
265
|
+
key?: string;
|
|
266
|
+
by?: "you" | "agent" | "default";
|
|
267
|
+
label?: string;
|
|
268
|
+
reason: string;
|
|
269
|
+
fromList: boolean;
|
|
270
|
+
}[];
|
|
232
271
|
/**
|
|
233
272
|
* The Not-checked lines code owns for the rubric-step stages of a close: a prose step's CONTENT is judged by the person at
|
|
234
273
|
* Accept, and the card says so (PART 1b, RF5). One line per prose step (a stage with no fact part).
|
|
@@ -249,13 +288,16 @@ export function partSentence(part: any): string;
|
|
|
249
288
|
/**
|
|
250
289
|
* The checks a signed close actually runs, per job line, in plain code-written sentences: one per countable part of every
|
|
251
290
|
* rubric-step stage. This is the ONE reader both the plan card and the sign-time invariant use.
|
|
291
|
+
* Each row says who added the check (`by`): `you` = one of the person's picks, as the signed close's own record (`closeDecl.picks`) names it; `agent` = the drafter's;
|
|
292
|
+
* `default` = code's own (the one list's `$` rows: the cited part written by `defaultCitedText`, and the numbers tie of a text step).
|
|
252
293
|
* @param {any} closeDecl
|
|
253
|
-
* @returns {{line: number, text: string,
|
|
294
|
+
* @returns {{line: number, text: string, by: 'agent'|'you'|'default', key?: string}[]}
|
|
254
295
|
*/
|
|
255
296
|
export function checksOfClose(closeDecl: any): {
|
|
256
297
|
line: number;
|
|
257
298
|
text: string;
|
|
258
|
-
|
|
299
|
+
by: "agent" | "you" | "default";
|
|
300
|
+
key?: string;
|
|
259
301
|
}[];
|
|
260
302
|
/**
|
|
261
303
|
* The names of the facts a signed close checks (every fact part of every rubric-step stage). Pure.
|
|
@@ -263,32 +305,40 @@ export function checksOfClose(closeDecl: any): {
|
|
|
263
305
|
*/
|
|
264
306
|
export function signedFactNames(closeDecl: any): string[];
|
|
265
307
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* @
|
|
271
|
-
* `jobLines` — the person's numbered lines, so a ~ rule the drafter listed as Not checked reads in the person's own words
|
|
272
|
-
* @returns {{checkItems: {text: string, fromLine: number[]}[], notChecked: string[], moved: {text: string, fromLine: number[]|null}[]}}
|
|
308
|
+
* The plan card after drafting, read from the signed close ALONE (one source, the same the Job tab reads): its checks are `checksOfClose`; its Not checked is the close's own notes, the prose
|
|
309
|
+
* steps' "you judge it at Accept" lines and the refusals (`ruleNotChecked`, which reads the list's not-checked rows when the close carries the list). Nothing the confirm turn said is merged
|
|
310
|
+
* in: a rubric confirm turn plans the goal only, so a check can never be shown and then silently dropped (run mv5bk400).
|
|
311
|
+
* @param {{closeDecl: any, jobLines?: any[]|null, ledger?: {key: string, words: string[]}[]|null}} o `jobLines` the person's numbered lines, so a ~ rule reads in the person's own words; `ledger` the draft log's final list rows, so a phrase row is named by its words
|
|
312
|
+
* @returns {{checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy: Record<string, 'you'|'agent'|'default'>}}
|
|
273
313
|
*/
|
|
274
|
-
export function
|
|
275
|
-
confirmed: {
|
|
276
|
-
text: string;
|
|
277
|
-
fromLine: number[] | null;
|
|
278
|
-
}[];
|
|
279
|
-
notChecked: string[];
|
|
314
|
+
export function cardOfClose({ closeDecl, jobLines, ledger }: {
|
|
280
315
|
closeDecl: any;
|
|
281
316
|
jobLines?: any[] | null;
|
|
317
|
+
ledger?: {
|
|
318
|
+
key: string;
|
|
319
|
+
words: string[];
|
|
320
|
+
}[] | null;
|
|
282
321
|
}): {
|
|
283
322
|
checkItems: {
|
|
284
323
|
text: string;
|
|
285
324
|
fromLine: number[];
|
|
325
|
+
by: "agent" | "you" | "default";
|
|
326
|
+
key?: string;
|
|
286
327
|
}[];
|
|
287
328
|
notChecked: string[];
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
329
|
+
notCheckedBy: Record<string, "you" | "agent" | "default">;
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* The sign-time check of a close that carries the one check list: every BUILT row (the mechanical floor aside) points at a part that is really in the close, and every real check part
|
|
333
|
+
* (countable or fact) has at least one built row pointing at it, so a check cannot be in the close with no row and a row cannot claim a check the close does not run. A close with no list is
|
|
334
|
+
* not examined here. Pure.
|
|
335
|
+
* @param {any} closeDecl @returns {{ok: true}|{ok: false, error: string}}
|
|
336
|
+
*/
|
|
337
|
+
export function listMatchesClose(closeDecl: any): {
|
|
338
|
+
ok: true;
|
|
339
|
+
} | {
|
|
340
|
+
ok: false;
|
|
341
|
+
error: string;
|
|
292
342
|
};
|
|
293
343
|
/**
|
|
294
344
|
* The sign-time invariant: the checks the person was shown (`shown`, from the plan card) are exactly the checks the signed
|
|
@@ -341,6 +391,8 @@ export const COUNT_CHECKS: Readonly<Record<string, readonly string[]>>;
|
|
|
341
391
|
export function sha256Of(b: string | Buffer): string;
|
|
342
392
|
export function boundInWords(b: unknown, said: string): boolean;
|
|
343
393
|
export function wordsSaidOn(jl: any): string;
|
|
394
|
+
export const NEGATING_RE: RegExp;
|
|
395
|
+
export function defaultCitedText(label: string): string;
|
|
344
396
|
export type ShapeRed = {
|
|
345
397
|
code: string;
|
|
346
398
|
path: string;
|
package/types/run.d.ts
CHANGED
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
* never a step knob and never agent-selectable; absent, a judged stage instrument-stops as
|
|
52
52
|
* a wiring gap rather than grading on whatever binding happened to be at hand. Its spend
|
|
53
53
|
* lands on this ledger as `judge-round` (see `ACCOUNTED_ROUND_TYPES`).
|
|
54
|
+
* @param {Record<string, string>|null} [opts.placeValues] PLACE RULES (src/placerule.js): the values this run's start read for the spec's place-rule facts, by key. Bound
|
|
55
|
+
* as those facts' phrases on the run's own in-memory copy AFTER the approval check and the `job-start` record, so the hash checked and the hash recorded stay the
|
|
56
|
+
* SIGNED one and the signed spec is never changed; the planner and the close read the copy. Absent = the signed words.
|
|
57
|
+
* @param {{workflowKey: string, rows: object[]}|null} [opts.placeRead] PLACE RULES: what the run start read (rows {key, kind, found, value, was, reason}); recorded once as a `place-rules` event right after `job-start`. Absent = the job has none (or this is a resume, whose first leg wrote it).
|
|
54
58
|
* @param {number} [opts.capRuns] shell-owned iteration cap for the plan flow's
|
|
55
59
|
* CLOSE-FIX loop (a plan STEP runs under the strike ladder instead)
|
|
56
60
|
* @param {number} [opts.strikeLimit] shell-owned strike ceiling for a plan step's ladder
|
|
@@ -145,6 +149,11 @@
|
|
|
145
149
|
* collision walk would mint a `-2` beside the work the resume exists to continue. The
|
|
146
150
|
* fold's precedent exactly: the chain's state is DECLARED, never re-derived. Forwarded
|
|
147
151
|
* verbatim to the plan flow; absent is the cold path.
|
|
152
|
+
* @param {string|null} [opts.ticketUnsure] R9 (9.4): the ticket filter's `unsure` reason when it let the ticket run unsure; rides onto `job-start` as `ticketFilter.unsure`
|
|
153
|
+
* @param {import('./ticketrepo.js').RepoTicketRecord|null} [opts.ticketRecord] MCP + tickets piece 1a: a CODE-REPO job's frozen ticket (metadata only: number, title,
|
|
154
|
+
* state, source, sha256, bytes, masked count, the frozen file's relative path, the MCP record - never the text). Report-only: it rides onto `job-start` as `ticket`,
|
|
155
|
+
* so the run's books name the exact bytes the worker could read. Absent = the job reads no ticket (or froze it in its prepared copy's `source.json`).
|
|
156
|
+
* @param {{number: number, ownerRepo: string, head: string, base: {ref: string|null, sha: string}|null, mergeBase: string|null}|null} [opts.prRecord] MCP + tickets piece 12: the PR a worktree job was checked out at (the head sha the seed is, the base and the merge-base for the readout). Report-only: rides onto `job-start` as `pr`.
|
|
148
157
|
* @param {boolean|'cap'|'diff'} [opts.readShim=false] THE READ SHIM (src/readshim.js) —
|
|
149
158
|
* WHICH ARM to run, threaded to the plan flow. The Phase 2 pre-registration's four:
|
|
150
159
|
* `false` A0 — off (the default)
|
|
@@ -214,7 +223,7 @@
|
|
|
214
223
|
* deliberately NOT in the resumable/checkpoint set (`src/reuse.js`) — an
|
|
215
224
|
* unknown in-flight state is not a known-safe resume point.
|
|
216
225
|
*/
|
|
217
|
-
export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit, capRuns, strikeLimit, shellCapUsd, closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, draftSpentUsd, draftSpendComplete, priorSpentUsd, priorSpendComplete, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, resumable, stopFile, learnHints }: {
|
|
226
|
+
export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit, capRuns, strikeLimit, shellCapUsd, closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, draftSpentUsd, draftSpendComplete, priorSpentUsd, priorSpendComplete, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, resumable, stopFile, learnHints, ticketRecord, ticketUnsure, prRecord, placeValues, placeRead }: {
|
|
218
227
|
approvals: unknown;
|
|
219
228
|
workdir: string;
|
|
220
229
|
provider: any;
|
|
@@ -236,6 +245,11 @@ export function runJob(rawSpec: object | string, { approvals, workdir, provider,
|
|
|
236
245
|
} | null | undefined;
|
|
237
246
|
judgeModel?: string | null | undefined;
|
|
238
247
|
judgeProvider?: any;
|
|
248
|
+
placeValues?: Record<string, string> | null | undefined;
|
|
249
|
+
placeRead?: {
|
|
250
|
+
workflowKey: string;
|
|
251
|
+
rows: object[];
|
|
252
|
+
} | null | undefined;
|
|
239
253
|
capRuns?: number | undefined;
|
|
240
254
|
strikeLimit?: number | undefined;
|
|
241
255
|
shellCapUsd?: number | undefined;
|
|
@@ -257,6 +271,18 @@ export function runJob(rawSpec: object | string, { approvals, workdir, provider,
|
|
|
257
271
|
grantUsed?: boolean;
|
|
258
272
|
} | null | undefined;
|
|
259
273
|
resumeBranch?: string | null | undefined;
|
|
274
|
+
ticketUnsure?: string | null | undefined;
|
|
275
|
+
ticketRecord?: import("./ticketrepo.js").RepoTicketRecord | null | undefined;
|
|
276
|
+
prRecord?: {
|
|
277
|
+
number: number;
|
|
278
|
+
ownerRepo: string;
|
|
279
|
+
head: string;
|
|
280
|
+
base: {
|
|
281
|
+
ref: string | null;
|
|
282
|
+
sha: string;
|
|
283
|
+
} | null;
|
|
284
|
+
mergeBase: string | null;
|
|
285
|
+
} | null | undefined;
|
|
260
286
|
readShim?: boolean | "diff" | "cap" | undefined;
|
|
261
287
|
scout?: boolean | undefined;
|
|
262
288
|
layerRoot?: boolean | undefined;
|
package/types/runlist.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export function runlistHome(override?: string): string;
|
|
|
13
13
|
*/
|
|
14
14
|
export function runlistPath(home?: string): string;
|
|
15
15
|
/**
|
|
16
|
-
* @typedef {{ at: string, runid: string, job: string, spine: string, patient: string|null, via: 'run-u'|'bundle'|'backfill', pid?: number, capUsd?: number, leg?: number }} RunRow
|
|
16
|
+
* @typedef {{ at: string, runid: string, job: string, spine: string, patient: string|null, via: 'run-u'|'bundle'|'backfill', pid?: number, capUsd?: number, leg?: number, ticket?: number }} RunRow
|
|
17
|
+
* `ticket` (a Tickets run, ITEM33-BUILD R6): the ticket number this run reads; older rows have none.
|
|
17
18
|
* `pid`/`capUsd` (optional; older and backfilled rows carry neither): the runner's process id and the
|
|
18
19
|
* leg's $ cap — what the monthly limit holds while that pid is a live bareloop runner (src/monthly.js).
|
|
19
20
|
* `leg` (P5-R; only on a row {@link readRunList} FOLDED from `leg-start` entries, i.e. a RESUMED run):
|
|
@@ -49,7 +50,7 @@ export function appendRun(row: RunRow, opts?: {
|
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
51
52
|
* @typedef {{ runid: string, type: 'settled'|'released', by: string, at: string, reason?: string, words?: string, spentUsd?: number, spendComplete?: boolean, leg?: number }} RunEvent
|
|
52
|
-
* `words` (2026-10-19): on a `settled` with `reason: 'refused before start'
|
|
53
|
+
* `words` (2026-10-19): on a `settled` with `reason: 'refused before start'` (or, R5, `reason: 'skipped'`: a ticket the job's filter did not let through), the plain words the panel shows for that run (it has no spine).
|
|
53
54
|
* `leg` (P5-R): which leg of the run the write-back is about; absent = leg 1 (every entry written before P5-R).
|
|
54
55
|
* A resumed run is ONE row, so `settled`/`released` are per leg: a later leg's `released` gives back THAT leg's
|
|
55
56
|
* claim and never removes the run.
|
|
@@ -251,6 +252,7 @@ export function runNumbers(rows: any[]): Map<string, number>;
|
|
|
251
252
|
export const DIED_MTIME_MS: number;
|
|
252
253
|
export const MAX_BACKFILL_DEPTH: 6;
|
|
253
254
|
/**
|
|
255
|
+
* `ticket` (a Tickets run, ITEM33-BUILD R6): the ticket number this run reads; older rows have none.
|
|
254
256
|
* `pid`/`capUsd` (optional; older and backfilled rows carry neither): the runner's process id and the
|
|
255
257
|
* leg's $ cap — what the monthly limit holds while that pid is a live bareloop runner (src/monthly.js).
|
|
256
258
|
* `leg` (P5-R; only on a row {@link readRunList} FOLDED from `leg-start` entries, i.e. a RESUMED run):
|
|
@@ -267,9 +269,10 @@ export type RunRow = {
|
|
|
267
269
|
pid?: number;
|
|
268
270
|
capUsd?: number;
|
|
269
271
|
leg?: number;
|
|
272
|
+
ticket?: number;
|
|
270
273
|
};
|
|
271
274
|
/**
|
|
272
|
-
* `words` (2026-10-19): on a `settled` with `reason: 'refused before start'
|
|
275
|
+
* `words` (2026-10-19): on a `settled` with `reason: 'refused before start'` (or, R5, `reason: 'skipped'`: a ticket the job's filter did not let through), the plain words the panel shows for that run (it has no spine).
|
|
273
276
|
* `leg` (P5-R): which leg of the run the write-back is about; absent = leg 1 (every entry written before P5-R).
|
|
274
277
|
* A resumed run is ONE row, so `settled`/`released` are per leg: a later leg's `released` gives back THAT leg's
|
|
275
278
|
* claim and never removes the run.
|
package/types/schedulewords.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R7 (piece 9): the New job card's Schedule row is served with its words from {@link SCHEDULE_WORDS}`.card`, never typed into the page: each token in `index.html` is replaced by
|
|
3
|
+
* the server when the page is sent (the way the port is), so a reword is ONE edit here. @returns {Record<string, string>} token -> escaped words
|
|
4
|
+
*/
|
|
5
|
+
export function scheduleCardFill(): Record<string, string>;
|
|
1
6
|
/**
|
|
2
7
|
* What starts the job, in words. `null` (by hand) has no sentence.
|
|
3
8
|
* @param {Trigger|null|undefined} t @param {string} [home]
|
|
@@ -20,7 +25,7 @@ export function nextInWords(ms: number, now: number): string;
|
|
|
20
25
|
* 3. a clock kind with a next slot; 4. a file kind that is armed; 5. not armed yet.
|
|
21
26
|
* A last outcome of `refused` goes in front of 3-5, so a trigger that cannot start is never silent.
|
|
22
27
|
* `red` is the typed flag for "the person must act": the page paints it and never guesses from the text.
|
|
23
|
-
* @param {{trigger: Trigger, armed: boolean, nextSlotMs: number|null, lastOutcome: any, waitingRunNo: number|null, now: number, retryInMs?: number|null, gaveUp?: any}} f
|
|
28
|
+
* @param {{trigger: Trigger, armed: boolean, nextSlotMs: number|null, lastOutcome: any, waitingRunNo: number|null, now: number, retryInMs?: number|null, gaveUp?: any, lookProblem?: {at: number, why: string}|null}} f
|
|
24
29
|
* `lastOutcome` = the newest outcome row of the CURRENT signing (`kind`, `at` in ms, `why`, `leftUsd`, `needUsd`, `atLeast`)
|
|
25
30
|
* @returns {{text: string, red: boolean}}
|
|
26
31
|
*/
|
|
@@ -33,6 +38,10 @@ export function scheduledNextFor(f: {
|
|
|
33
38
|
now: number;
|
|
34
39
|
retryInMs?: number | null;
|
|
35
40
|
gaveUp?: any;
|
|
41
|
+
lookProblem?: {
|
|
42
|
+
at: number;
|
|
43
|
+
why: string;
|
|
44
|
+
} | null;
|
|
36
45
|
}): {
|
|
37
46
|
text: string;
|
|
38
47
|
red: boolean;
|
|
@@ -71,7 +80,7 @@ export function skippedWords(row: any, short?: boolean): string;
|
|
|
71
80
|
/**
|
|
72
81
|
* Job tab, "Schedule": the job's schedule NOW and what it is bound to. The first part IS the Run tab's line ({@link scheduledWords}),
|
|
73
82
|
* first letter lowered, so the two can never disagree.
|
|
74
|
-
* @param {{trigger: Trigger|null, originNo: number|null, model: string|null, destination: string|null, home?: string}} f
|
|
83
|
+
* @param {{trigger: Trigger|null, originNo: number|null, model: string|null, destination: string|null, home?: string, waiting?: boolean}} f `waiting` (R7): signed with the job and still off
|
|
75
84
|
*/
|
|
76
85
|
export function jobScheduleWords(f: {
|
|
77
86
|
trigger: Trigger | null;
|
|
@@ -79,6 +88,7 @@ export function jobScheduleWords(f: {
|
|
|
79
88
|
model: string | null;
|
|
80
89
|
destination: string | null;
|
|
81
90
|
home?: string;
|
|
91
|
+
waiting?: boolean;
|
|
82
92
|
}): string;
|
|
83
93
|
/** RULED 2026-10-15: the SCHEDULE row's `next` while an install-needed refusal is waiting to be tried again. @param {number} ms */
|
|
84
94
|
export function retryNextWords(ms: number): string;
|
|
@@ -123,15 +133,32 @@ export const SCHEDULE_WORDS: Readonly<{
|
|
|
123
133
|
weekly: "Every <day> at HH:MM";
|
|
124
134
|
'file-updated': "When <file> is updated";
|
|
125
135
|
'new-file': "When a new file arrives in <folder>";
|
|
136
|
+
'new-ticket': "When a new ticket arrives in <input>";
|
|
126
137
|
}>;
|
|
127
138
|
gaveUpPill: "Check";
|
|
128
139
|
problemNext: "next: fix it in Cancel / modify schedule";
|
|
129
140
|
monthNext: "next: raise the limit in Settings, or it starts on the 1st";
|
|
130
141
|
acceptWaiting: "waiting for your Accept (the next run does not wait)";
|
|
142
|
+
waiting: "Schedule waiting for a green run";
|
|
131
143
|
scheduleGroup: "schedule";
|
|
132
144
|
notGreen: "This job has not had a good run yet. Run it by hand and get it right first; then you can set when it runs. A rubric job also needs your Accept once. Nothing was changed.";
|
|
145
|
+
card: Readonly<{
|
|
146
|
+
label: "Schedule";
|
|
147
|
+
options: Readonly<{
|
|
148
|
+
hand: "By hand";
|
|
149
|
+
'new-ticket': "When a new ticket arrives";
|
|
150
|
+
daily: "Every day at HH:MM";
|
|
151
|
+
}>;
|
|
152
|
+
hint: "off until the first green run, then turns on";
|
|
153
|
+
rubricHint: "off until the first green run is accepted, then turns on";
|
|
154
|
+
ticketHint: "the first run reads the newest ticket at the time it starts; older tickets never run";
|
|
155
|
+
}>;
|
|
133
156
|
stale: "What you were shown is not what is on the card now. Nothing was signed. Look again, then sign.";
|
|
134
157
|
}>;
|
|
158
|
+
export function lookProblemWords(p: {
|
|
159
|
+
at: number;
|
|
160
|
+
why: string;
|
|
161
|
+
}): string;
|
|
135
162
|
export function dateTimeWords(ms: number): string;
|
|
136
163
|
export function lowerFirst(s: string): string;
|
|
137
164
|
export type Trigger = import("./trigger.js").Trigger;
|
package/types/source.d.ts
CHANGED
|
@@ -40,6 +40,18 @@ export function nearestGitAncestor(startDir: string): {
|
|
|
40
40
|
* @returns {boolean}
|
|
41
41
|
*/
|
|
42
42
|
export function looksLikeRepoSource(source: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The files of a repo's COMMITTED tree (`git ls-tree -r HEAD`: what a job's worktree holds), or null when git cannot read it.
|
|
45
|
+
* @param {string} root the repo's (or worktree's) top folder @returns {string[]|null}
|
|
46
|
+
*/
|
|
47
|
+
export function repoTrackedFiles(root: string): string[] | null;
|
|
48
|
+
/**
|
|
49
|
+
* R7b (F287): the first piece of a repo Destination (comma or line separated) that the repo's COMMITTED tree does not have, or null when every piece exists.
|
|
50
|
+
* A piece is a folder (`src`, `src/`), a file, or a glob whose folder part exists (`src/**\/*.js`); `.` is the repo root. A tree that cannot be read is null:
|
|
51
|
+
* the copy step refuses that repo with its own words, this check never invents a refusal from a failure.
|
|
52
|
+
* @param {string} root the repo's top folder @param {string} destination @returns {string|null}
|
|
53
|
+
*/
|
|
54
|
+
export function destinationMissingInRepo(root: string, destination: string): string | null;
|
|
43
55
|
/**
|
|
44
56
|
* Build the frozen source tree — `<into>/tree/input/…` (the copy), `<into>/tree/output/`
|
|
45
57
|
* (empty, where the run writes), `<into>/source.json` (the manifest, OUTSIDE
|
|
@@ -315,14 +327,24 @@ export function nonRepoSourceMessage(kind: string): string;
|
|
|
315
327
|
* file. A known secret shape in its content is NOT a refusal (masked where recorded, as the P6 worktree door does).
|
|
316
328
|
* A folder value is checked for existence and tracking only (its files are the repo's own, which the worktree door
|
|
317
329
|
* already masks). Reads the tree; writes nothing.
|
|
330
|
+
* MCP + tickets piece 1a: with `opts.mcp` (the job's signed `{server, tools}`), a line 2+ whose value is a GitHub issues address is a TICKET line, not a repo path: it is proven at $0
|
|
331
|
+
* as "the MCP can read it" (`proveTicketLine`: server named in the person's config, not remote, `issue_read` signed). Only one such line; it is read and frozen at run start.
|
|
332
|
+
* Without `opts.mcp` the same line is the old refusal ("only files inside the repo for now").
|
|
318
333
|
* @param {{n: number, label: string, value: string}[]} inputs the parsed Inputs (`parseInputs`)
|
|
334
|
+
* @param {{mcp?: {server: string, tools: string[]}, configPath?: string}} [opts]
|
|
319
335
|
* @returns {Promise<{ok: true, repo: string, root: string|null}|{ok: false, error: string}>} `repo` = line 1's absolute path; `root` = the git root it sits in (null when line 1 alone was given and it is not in a git repo)
|
|
320
336
|
*/
|
|
321
337
|
export function proveInputFiles(inputs: {
|
|
322
338
|
n: number;
|
|
323
339
|
label: string;
|
|
324
340
|
value: string;
|
|
325
|
-
}[]
|
|
341
|
+
}[], opts?: {
|
|
342
|
+
mcp?: {
|
|
343
|
+
server: string;
|
|
344
|
+
tools: string[];
|
|
345
|
+
};
|
|
346
|
+
configPath?: string;
|
|
347
|
+
}): Promise<{
|
|
326
348
|
ok: true;
|
|
327
349
|
repo: string;
|
|
328
350
|
root: string | null;
|
|
@@ -410,10 +432,16 @@ export function looksLikeRubricInput(value: string): boolean;
|
|
|
410
432
|
* copy. It is written into the prepared tree, committed as the new seed (so the page is never read as a worker write), and
|
|
411
433
|
* `source.json` is rewritten (new sha256 per input, new seed, `draftSha256` keeps what the look saw). Nothing but the text of a
|
|
412
434
|
* recorded web address is ever refetched; a job with only file inputs returns at once and changes nothing.
|
|
413
|
-
*
|
|
414
|
-
*
|
|
435
|
+
*
|
|
436
|
+
* MCP + tickets (piece 1): with `ticket` (a job that reads tickets: `{number, mcp}`, the number per run from `--ticket`), the ONE input row whose address is a
|
|
437
|
+
* GitHub issues list is read through the person's MCP server instead of the page reader: the ticket's reply, MASKED with the one secret inventory before the sha
|
|
438
|
+
* (a secret in a ticket is masked, never refused; page rows keep their refusal), is the run's frozen input. The row keeps its signed `url` (the list address) and
|
|
439
|
+
* gains `mcp:{server,exposed,missing,calls}`, `ticket:{number,title,state,source}` and `masked:<count>`. Any refusal (server or tool missing, a device login,
|
|
440
|
+
* an empty reply, no list row or two) is the same plain `did not start` words at $0.
|
|
441
|
+
* @param {{into: string, fetchUrl?: (url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>, ticket?: {number: number, mcp: {server: string, tools: string[]}}}} o `into` - the prepared copy (source.json + tree/)
|
|
442
|
+
* @returns {Promise<{ok: true, refreshed: string[], seed: string|null, ticketText?: string}|{ok: false, error: string}>}
|
|
415
443
|
*/
|
|
416
|
-
export function refreezeUrlInputs({ into, fetchUrl }: {
|
|
444
|
+
export function refreezeUrlInputs({ into, fetchUrl, ticket }: {
|
|
417
445
|
into: string;
|
|
418
446
|
fetchUrl?: (url: string) => Promise<{
|
|
419
447
|
ok: true;
|
|
@@ -423,10 +451,18 @@ export function refreezeUrlInputs({ into, fetchUrl }: {
|
|
|
423
451
|
ok: false;
|
|
424
452
|
error: string;
|
|
425
453
|
}>;
|
|
454
|
+
ticket?: {
|
|
455
|
+
number: number;
|
|
456
|
+
mcp: {
|
|
457
|
+
server: string;
|
|
458
|
+
tools: string[];
|
|
459
|
+
};
|
|
460
|
+
};
|
|
426
461
|
}): Promise<{
|
|
427
462
|
ok: true;
|
|
428
463
|
refreshed: string[];
|
|
429
464
|
seed: string | null;
|
|
465
|
+
ticketText?: string;
|
|
430
466
|
} | {
|
|
431
467
|
ok: false;
|
|
432
468
|
error: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gate `tools.allowlist` for a step that grants MCP tools. bareguard's allowlist is EXCLUSIVE for every action (fwd F116 measured it denying fs too), and its
|
|
3
|
+
* identity for an action is `action.tool ?? action.type` — bareloop's `toolAction` sets no `tool`, so the identity is the action TYPE (`read`, `write`, `edit`,
|
|
4
|
+
* `ctx_stash`...), never the tool name (`shell_read`): a list of names denies the step's own reads (tested against the real Gate). A bridge tool has no
|
|
5
|
+
* translation, so its type IS its name (`github_issue_read`). So: the types of the step's granted verbs, taken from `toolAction` itself (no second spelling that
|
|
6
|
+
* could drift), plus the signed bridge names. Anything else, an unsigned bridge tool included, is denied by `tools.allowlist.exclusive`.
|
|
7
|
+
* @param {string[]} granted the step's verbs @param {string} server @param {string[]} mcpTools @param {string} workdir @returns {string[]}
|
|
8
|
+
*/
|
|
9
|
+
export function mcpAllowlist(granted: string[], server: string, mcpTools: string[], workdir: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Mask every secret shape in a tool reply with the ONE inventory (`redactSecrets`, src/validate.js), at capture. A reply enters the worker's transcript and a
|
|
12
|
+
* model copies what it reads (into a file, into its reply): measured with a planted `ghp_` token, the raw reply reaches the model and every file the model copies
|
|
13
|
+
* it into, while the audit, the carry memo and the spine never carried it. Masking here, before the model sees it, closes that path at its source (the same rule
|
|
14
|
+
* the ticket freeze follows: a secret in a ticket is MASKED, never refused). Walks strings, arrays and plain objects; anything else passes through.
|
|
15
|
+
* @param {any} v @returns {any}
|
|
16
|
+
*/
|
|
17
|
+
export function maskReply(v: any): any;
|
|
18
|
+
/**
|
|
19
|
+
* Start the bridge for one step. Throws an Error in plain words (the cause named, at $0, before any token) when the server is not configured, will not start, or
|
|
20
|
+
* lacks a tool the job signed; the bridge is closed before it throws.
|
|
21
|
+
* @param {{mcp: {server: string, tools: string[]}, mcpTools: string[], configPath?: string, home?: string, timeoutMs?: number}} o
|
|
22
|
+
* `configPath`/`home` are test seams (an explicit MCP config file; the config home); production passes neither.
|
|
23
|
+
* @returns {Promise<{server: string, mcpTools: string[], tools: any[], names: string[], close: () => Promise<void>}>}
|
|
24
|
+
*/
|
|
25
|
+
export function startStepMcp({ mcp, mcpTools, configPath: explicit, home, timeoutMs }: {
|
|
26
|
+
mcp: {
|
|
27
|
+
server: string;
|
|
28
|
+
tools: string[];
|
|
29
|
+
};
|
|
30
|
+
mcpTools: string[];
|
|
31
|
+
configPath?: string;
|
|
32
|
+
home?: string;
|
|
33
|
+
timeoutMs?: number;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
server: string;
|
|
36
|
+
mcpTools: string[];
|
|
37
|
+
tools: any[];
|
|
38
|
+
names: string[];
|
|
39
|
+
close: () => Promise<void>;
|
|
40
|
+
}>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mask a text and measure it: the masked text, its sha256 and byte length, and how many secret shapes it carried.
|
|
3
|
+
* @param {string} raw @returns {{text: string, sha256: string, bytes: number, masked: number}}
|
|
4
|
+
*/
|
|
5
|
+
export function maskTicketText(raw: string): {
|
|
6
|
+
text: string;
|
|
7
|
+
sha256: string;
|
|
8
|
+
bytes: number;
|
|
9
|
+
masked: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A ticket from the text of a PAGE (barebrowse act mode). Weaker than an MCP read, said plainly: the body may be missing (fwd F89: a page reader drops it),
|
|
13
|
+
* labels are null (not read from a page), and state is `closed` only when the text says `Closed`, else `unknown`.
|
|
14
|
+
* @param {string} rawText @param {string} url @returns {Ticket}
|
|
15
|
+
*/
|
|
16
|
+
export function ticketFromPage(rawText: string, url: string): Ticket;
|
|
17
|
+
/**
|
|
18
|
+
* A ticket from an MCP `issue_read` reply (a JSON document on GitHub's server; anything else keeps its text, with the first line as the title and the
|
|
19
|
+
* state and labels unknown).
|
|
20
|
+
* @param {string} rawText @param {string} url @param {number} number
|
|
21
|
+
* @param {Ticket['record']} record @returns {Ticket}
|
|
22
|
+
*/
|
|
23
|
+
export function ticketFromMcp(rawText: string, url: string, number: number, record: Ticket["record"]): Ticket;
|
|
24
|
+
/**
|
|
25
|
+
* The pull request a `pull_request_read` ticket froze, as the object the checkout reads (`head.sha`, `base.ref`, `base.sha`): the parsed, MASKED reply (the same bytes the
|
|
26
|
+
* sha256 covers - a sha is not a secret shape, so masking leaves it whole). Null when the text is not a JSON object.
|
|
27
|
+
* @param {Ticket} ticket @returns {Record<string, any>|null}
|
|
28
|
+
*/
|
|
29
|
+
export function prRecordOfTicket(ticket: Ticket): Record<string, any> | null;
|
|
30
|
+
/**
|
|
31
|
+
* Read one ticket, whatever its source. An MCP-backed row (`mcp` present) goes to the MCP reader; a page row to the page reader.
|
|
32
|
+
* @param {{mcp?: {server: string, tools: string[]}, listUrl?: string, number?: number, url?: string}} row
|
|
33
|
+
* @param {{configPath?: string, home?: string, timeoutMs?: number, fetchPage?: typeof fetchPageText}} [deps] test seams
|
|
34
|
+
* @returns {Promise<{ok: true, ticket: Ticket} | {ok: false, error: string}>}
|
|
35
|
+
*/
|
|
36
|
+
export function readTicket(row: {
|
|
37
|
+
mcp?: {
|
|
38
|
+
server: string;
|
|
39
|
+
tools: string[];
|
|
40
|
+
};
|
|
41
|
+
listUrl?: string;
|
|
42
|
+
number?: number;
|
|
43
|
+
url?: string;
|
|
44
|
+
}, deps?: {
|
|
45
|
+
configPath?: string;
|
|
46
|
+
home?: string;
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
fetchPage?: typeof fetchPageText;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
ok: true;
|
|
51
|
+
ticket: Ticket;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
error: string;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {object} Ticket
|
|
58
|
+
* @property {'mcp'|'page'} source
|
|
59
|
+
* @property {string} url the address of this ticket
|
|
60
|
+
* @property {number|null} number null = a page address that carries no ticket number (the grid row reads `#?`)
|
|
61
|
+
* @property {string} title
|
|
62
|
+
* @property {'open'|'closed'|'unknown'} state
|
|
63
|
+
* @property {string[]|null} labels null = not readable (a page); a priority filter finds none, and `unsure` never skips
|
|
64
|
+
* @property {string} text the MASKED text, as frozen
|
|
65
|
+
* @property {string} sha256 of the masked text's UTF-8 bytes
|
|
66
|
+
* @property {number} bytes
|
|
67
|
+
* @property {number} masked how many secret-shaped strings were masked (a count; never the values)
|
|
68
|
+
* @property {{server: string, exposed: string[], missing: Array<{server: string, tool: string}>, calls: Array<Record<string, any>>}|null} record the MCP read's own record (null for a page)
|
|
69
|
+
*/
|
|
70
|
+
/** said on the plan card, in code-owned words, when a ticket comes from a page */
|
|
71
|
+
export const PAGE_TICKET_LIMIT_WORDS: "A ticket read from a page may lack its body, and its labels and state may be missing.";
|
|
72
|
+
export type Ticket = {
|
|
73
|
+
source: "mcp" | "page";
|
|
74
|
+
/**
|
|
75
|
+
* the address of this ticket
|
|
76
|
+
*/
|
|
77
|
+
url: string;
|
|
78
|
+
/**
|
|
79
|
+
* null = a page address that carries no ticket number (the grid row reads `#?`)
|
|
80
|
+
*/
|
|
81
|
+
number: number | null;
|
|
82
|
+
title: string;
|
|
83
|
+
state: "open" | "closed" | "unknown";
|
|
84
|
+
/**
|
|
85
|
+
* null = not readable (a page); a priority filter finds none, and `unsure` never skips
|
|
86
|
+
*/
|
|
87
|
+
labels: string[] | null;
|
|
88
|
+
/**
|
|
89
|
+
* the MASKED text, as frozen
|
|
90
|
+
*/
|
|
91
|
+
text: string;
|
|
92
|
+
/**
|
|
93
|
+
* of the masked text's UTF-8 bytes
|
|
94
|
+
*/
|
|
95
|
+
sha256: string;
|
|
96
|
+
bytes: number;
|
|
97
|
+
/**
|
|
98
|
+
* how many secret-shaped strings were masked (a count; never the values)
|
|
99
|
+
*/
|
|
100
|
+
masked: number;
|
|
101
|
+
/**
|
|
102
|
+
* the MCP read's own record (null for a page)
|
|
103
|
+
*/
|
|
104
|
+
record: {
|
|
105
|
+
server: string;
|
|
106
|
+
exposed: string[];
|
|
107
|
+
missing: Array<{
|
|
108
|
+
server: string;
|
|
109
|
+
tool: string;
|
|
110
|
+
}>;
|
|
111
|
+
calls: Array<Record<string, any>>;
|
|
112
|
+
} | null;
|
|
113
|
+
};
|
|
114
|
+
import { fetchPageText } from './pagefetch.js';
|