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.
- package/CHANGELOG.md +83 -0
- package/bareloop.context.md +73 -12
- package/package.json +3 -3
- package/src/authorflow.js +148 -46
- package/src/authoring.js +21 -4
- package/src/authorjob.js +82 -3
- package/src/authorreadout.js +20 -3
- package/src/authorrun.js +1 -1
- package/src/authorscout.js +9 -6
- package/src/bridges.js +4 -3
- package/src/cardschedule.js +42 -0
- package/src/carrystore.js +1 -1
- package/src/checkpick.js +576 -0
- package/src/checksuggest.js +28 -0
- package/src/checkwords.js +25 -0
- package/src/cli.js +1 -1
- package/src/config.js +24 -1
- package/src/declaredclose.js +1 -1
- package/src/destpoint.js +149 -0
- package/src/draftspend.js +39 -0
- package/src/factwords.js +14 -1
- package/src/job.js +81 -1
- package/src/jobblock.js +9 -0
- package/src/labelscan.js +11 -0
- package/src/launcher.js +10 -6
- package/src/learn.js +6 -4
- 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 +5 -2
- package/src/panel/authorroutes.js +90 -15
- package/src/panel/authorsession.js +183 -21
- package/src/panel/index.html +686 -26
- package/src/panel/jobgrid.js +117 -0
- package/src/panel/jobplan.js +31 -15
- 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 +438 -33
- package/src/panel/settingsroutes.js +133 -3
- package/src/panel/status.js +22 -2
- package/src/panel/tickets.js +44 -0
- package/src/pickrecord.js +145 -0
- package/src/plan.js +31 -2
- package/src/planrun.js +71 -15
- package/src/prcheckout.js +259 -0
- package/src/readshim.js +3 -2
- package/src/replay.js +6 -0
- package/src/reuse.js +3 -3
- package/src/revises.js +56 -0
- package/src/rubricstep.js +62 -16
- package/src/run.js +10 -1
- 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/u-readout.js +2 -2
- package/src/userrun.js +146 -10
- package/src/validate.js +3 -1
- package/src/worktree.js +43 -1
- package/types/authorflow.d.ts +128 -28
- package/types/authorjob.d.ts +16 -3
- package/types/authorreadout.d.ts +9 -2
- package/types/authorscout.d.ts +4 -2
- package/types/bridges.d.ts +4 -3
- package/types/cardschedule.d.ts +24 -0
- package/types/checkpick.d.ts +297 -0
- package/types/checksuggest.d.ts +30 -0
- package/types/checkwords.d.ts +14 -0
- package/types/config.d.ts +7 -0
- package/types/destpoint.d.ts +87 -0
- package/types/draftspend.d.ts +16 -0
- package/types/factwords.d.ts +7 -0
- 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 +7 -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 +2 -1
- package/types/panel/authorroutes.d.ts +11 -2
- package/types/panel/authorsession.d.ts +58 -3
- package/types/panel/jobgrid.d.ts +405 -0
- package/types/panel/jobplan.d.ts +10 -4
- 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 +427 -6
- 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 +88 -0
- package/types/plan.d.ts +1 -0
- package/types/prcheckout.d.ts +151 -0
- package/types/readshim.d.ts +4 -3
- package/types/replay.d.ts +3 -0
- package/types/reuse.d.ts +2 -2
- package/types/revises.d.ts +23 -0
- package/types/rubricstep.d.ts +14 -5
- package/types/run.d.ts +18 -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
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/** every whole-output word number in a guardrail ("under 600 words" -> [600]); a "<n> words each" / "per section" size is never listed here @param {unknown} g @returns {number[]} */
|
|
2
|
+
export function guardrailWordNumbers(g: unknown): number[];
|
|
3
|
+
/** every standalone number in a guardrail's own text (digits not joined to letters) @param {unknown} g @returns {number[]} */
|
|
4
|
+
export function guardrailStandaloneNumbers(g: unknown): number[];
|
|
5
|
+
/** the "<n> words each" / "<n> words per section" size, or null @param {unknown} g @returns {number|null} */
|
|
6
|
+
export function guardrailWordsPerSection(g: unknown): number | null;
|
|
7
|
+
/** the first "<N> sections" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
|
|
8
|
+
export function guardrailSectionCount(g: unknown): number | null;
|
|
9
|
+
/** the first "<N> bullets / list items / items / lines / points" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
|
|
10
|
+
export function guardrailItemCount(g: unknown): number | null;
|
|
11
|
+
/** @typedef {{line: number, rule: number, text: string}} Rule */
|
|
12
|
+
/**
|
|
13
|
+
* Every `~` rule of a rubric job that this call settles, in line order. `rule` is the rule's number on its line (the number a part's `rules` and the answers use). A rule a
|
|
14
|
+
* kept page word already carries (the look tied it by line and rule number) or that the look already put under Not checked is left to that, EXCEPT a countable rule (`isCountable`: a word, list-item/line or section count), which always comes here: the look's fact stays beside the pick (keep-both). A repeated text on a line is
|
|
15
|
+
* one rule here, asked once.
|
|
16
|
+
* @param {{n: number, rule?: string, rules?: string[]}[]} jobLines @param {{inputs?: {value?: string}[]|null, look?: any}} [o]
|
|
17
|
+
* @returns {Rule[]}
|
|
18
|
+
*/
|
|
19
|
+
export function scopedRules(jobLines: {
|
|
20
|
+
n: number;
|
|
21
|
+
rule?: string;
|
|
22
|
+
rules?: string[];
|
|
23
|
+
}[], { inputs, look }?: {
|
|
24
|
+
inputs?: {
|
|
25
|
+
value?: string;
|
|
26
|
+
}[] | null;
|
|
27
|
+
look?: any;
|
|
28
|
+
}): Rule[];
|
|
29
|
+
/**
|
|
30
|
+
* Keep a suggestion only if its rule is on bareguard's list, it carries only that rule's own fields, every number in it is a number the guardrail names and every word in it
|
|
31
|
+
* is a word of the guardrail. Anything else is dropped, with the reason. `none` is a drop with the reason `none`.
|
|
32
|
+
* @param {string} guardrail @param {any} sug the model's entry for this guardrail
|
|
33
|
+
* @returns {{kept: true, check: Record<string, any>}|{kept: false, why: string}}
|
|
34
|
+
*/
|
|
35
|
+
export function keepOrDrop(guardrail: string, sug: any): {
|
|
36
|
+
kept: true;
|
|
37
|
+
check: Record<string, any>;
|
|
38
|
+
} | {
|
|
39
|
+
kept: false;
|
|
40
|
+
why: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The user message: the job's lines, and under a line only the guardrails this call settles, numbered by their rule number on the line.
|
|
44
|
+
* @param {{n: number, text: string}[]} lines @param {Rule[]} scoped @returns {string}
|
|
45
|
+
*/
|
|
46
|
+
export function suggestUserText(lines: {
|
|
47
|
+
n: number;
|
|
48
|
+
text: string;
|
|
49
|
+
}[], scoped: Rule[]): string;
|
|
50
|
+
/**
|
|
51
|
+
* The check CODE proposes for a count rule when the call yields none (R10, ours; fwd has no such fallback): a bullets / list-items / points count -> listItems N, a lines count ->
|
|
52
|
+
* maxLines N, ONE word number -> minWords N when the rule says "at least / minimum / more than", else maxWords N. A section count names no sections, so none is built; a rule naming two different counts ("3 bullets under 80 words") is not built either; a rule with
|
|
53
|
+
* several word numbers or a range ("between 100 and 200 words") is not guessed. The result passes `keepOrDrop`, so every number is one the rule names.
|
|
54
|
+
* @param {string} text @returns {Record<string, any>|null}
|
|
55
|
+
*/
|
|
56
|
+
export function countCheck(text: string): Record<string, any> | null;
|
|
57
|
+
/**
|
|
58
|
+
* What the call's answer comes to, one row per scoped rule: the check kept (or null) and why it was dropped. A rule the answer never mentions is dropped as `no entry`; an
|
|
59
|
+
* entry for a rule that was not sent is ignored.
|
|
60
|
+
* @param {Rule[]} scoped @param {any} args the tool call's arguments
|
|
61
|
+
* @returns {(Rule & {check: Record<string, any>|null, why: string|null})[]}
|
|
62
|
+
*/
|
|
63
|
+
export function rowsFromAnswer(scoped: Rule[], args: any): (Rule & {
|
|
64
|
+
check: Record<string, any> | null;
|
|
65
|
+
why: string | null;
|
|
66
|
+
})[];
|
|
67
|
+
/**
|
|
68
|
+
* @typedef {{line: number, rule: number, source: 'look', ask: 'check'|'no-check', ruleText: string, question: string, reading?: string, check?: Record<string, any>, counted: boolean, pairRule?: number}} PickAsk
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* The asks for the rows: `Line n, guardrail "<...>": I propose <check in plain words>.` for a kept check, `Line n, guardrail "<...>": I can't check this. Your own words, or
|
|
72
|
+
* Not checked?` when nothing was kept. A proposal is not counted toward the 3-ask cap; a can't-check ask is (fwd am16 (5)). Both ride the existing code-forced look ask path
|
|
73
|
+
* (`source: 'look'`), so the chat message, the answer words and the draft log rows are the look asks' own.
|
|
74
|
+
* @param {ReturnType<typeof rowsFromAnswer>} rows @returns {PickAsk[]}
|
|
75
|
+
*/
|
|
76
|
+
export function checkAsks(rows: ReturnType<typeof rowsFromAnswer>): PickAsk[];
|
|
77
|
+
/**
|
|
78
|
+
* Settle every scoped rule against the person's answers: a rule with a picked check is checked (and the `~` line an agree wrote is covered by that pick); every other rule is
|
|
79
|
+
* Not checked, with the reason (`person-left` = they chose it, `own-words` = they gave their own words, `no-pick` = nothing was picked).
|
|
80
|
+
* @param {Rule[]} rules @param {Pick[]} picks @param {{line: number, rule: number, kept?: boolean}[]} left @param {{n: number, rule?: string, rules?: string[]}[]} jobLines the lines AFTER the answers were added
|
|
81
|
+
* @returns {{checks: {line: number, text: string, check: Record<string, any>, rules: number[], kept: boolean}[], notes: (Rule & {reason: NoteReason, also: number[], kept: boolean})[]}}
|
|
82
|
+
*/
|
|
83
|
+
export function settleRules(rules: Rule[], picks: Pick[], left: {
|
|
84
|
+
line: number;
|
|
85
|
+
rule: number;
|
|
86
|
+
kept?: boolean;
|
|
87
|
+
}[], jobLines: {
|
|
88
|
+
n: number;
|
|
89
|
+
rule?: string;
|
|
90
|
+
rules?: string[];
|
|
91
|
+
}[]): {
|
|
92
|
+
checks: {
|
|
93
|
+
line: number;
|
|
94
|
+
text: string;
|
|
95
|
+
check: Record<string, any>;
|
|
96
|
+
rules: number[];
|
|
97
|
+
kept: boolean;
|
|
98
|
+
}[];
|
|
99
|
+
notes: (Rule & {
|
|
100
|
+
reason: NoteReason;
|
|
101
|
+
also: number[];
|
|
102
|
+
kept: boolean;
|
|
103
|
+
})[];
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* RUBRIC jobs only (the caller gates on the job's lang): a part the drafter wrote as `none` or `judged` is a thing no rule can check, so it is
|
|
107
|
+
* listed under Not checked with its own words instead of failing the whole plan (hamr's ruling 2026-11-09, as fwd lists what the drafter cannot check).
|
|
108
|
+
* A part that is a verbatim copy of one of the person's `~` rules, or lists rule numbers, gives a `refused` entry per rule no other part carries (shown as that rule's own words); a part that is NOT a verbatim copy of a rule (the job sentence itself, the drafter's own wording) also becomes one line in `notes`, so its words are never lost. Never silent, never a line-level refusal (that would silence the line's other rule reds).
|
|
109
|
+
* Runs BEFORE applyPicks, so a rule the person's picks settle gets code's own reason there. `guard` and every other class are untouched.
|
|
110
|
+
* A stage left with no parts stays: an empty stage is the legal prose stage ("what the text says - you judge it at Accept"). Pure.
|
|
111
|
+
* @param {any} declaration @param {any[]|null|undefined} jobLines @param {boolean} rubric whether the job is a rubric job (the draft gate's `lang === RUBRIC_LANG`); anything else is returned untouched, its reds stand @returns {any}
|
|
112
|
+
*/
|
|
113
|
+
export function moveUncheckable(declaration: any, jobLines: any[] | null | undefined, rubric: boolean): any;
|
|
114
|
+
/** a part of a rubric-step stage, from a pick: the check's own fields, the rule's words, and the `~` rule numbers it carries out @param {Record<string, any>} check @param {string} text @param {number[]} rules */
|
|
115
|
+
export function partOfPick(check: Record<string, any>, text: string, rules: number[]): {
|
|
116
|
+
rules: number[];
|
|
117
|
+
text: string;
|
|
118
|
+
class: string;
|
|
119
|
+
check: any;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Put the person's picks into the drafted declaration (a pure function; the input is untouched): on every rubric-step stage of a line this call settles, the drafter's own
|
|
123
|
+
* word/section/line/list/phrase checks are gone (the drafter writes none, whatever it sent), a part per picked check is added carrying the `~` rule numbers it settles, and every
|
|
124
|
+
* other settled rule goes under Not checked (`refused` with a rule number and the reason). A rule a fact or guard part of the draft already carries is left to that part.
|
|
125
|
+
* With no picks settled (`null`) it only drops a `picks` record the drafter sent.
|
|
126
|
+
* @param {any} declaration @param {ReturnType<typeof settleRules>|null} settled @returns {any}
|
|
127
|
+
*/
|
|
128
|
+
export function applyPicks(declaration: any, settled: ReturnType<typeof settleRules> | null): any;
|
|
129
|
+
/**
|
|
130
|
+
* RUBRIC jobs only (the caller gates on the job's lang; anything else is returned untouched, its reds stand). Two small, mechanical steps on every rubric-step stage, run
|
|
131
|
+
* before validation (hamr's ruling 2026-11-09):
|
|
132
|
+
* F1 source fill: when the job has EXACTLY ONE input label, a `fact` part, or a `cited` part, whose `source` is missing or empty gets that label. With 2+ labels nothing is filled; a
|
|
133
|
+
* wrong non-empty source is never rewritten (its red stands).
|
|
134
|
+
* F2 fact merge: when ONE stage holds 2+ `fact` parts they become ONE fact part (where the first stood): the `facts` of all in order, the union of `rules` and of `covers`, the one shared
|
|
135
|
+
* `source`, the `text`s joined with "; ". Only when it is safe, else the parts stay and the existing second-fact-list red fires: the sources differ (after F1), two facts share a name
|
|
136
|
+
* (compared white-space and case blind), the parts' `count`s differ (a part with no count agrees with any; the merged part carries the one count), a part is not a plain object or has a
|
|
137
|
+
* field a fact part does not carry, or `facts` is not a list.
|
|
138
|
+
* Runs AFTER applyPicks (its strip of a count that restates a pick has already happened). Pure.
|
|
139
|
+
* @param {any} declaration @param {string[]|null|undefined} inputLabels the labels of the job's inputs @param {boolean} rubric the draft gate's `lang === RUBRIC_LANG` @returns {any}
|
|
140
|
+
*/
|
|
141
|
+
export function fillAndMergeFacts(declaration: any, inputLabels: string[] | null | undefined, rubric: boolean): any;
|
|
142
|
+
/**
|
|
143
|
+
* RETENTION record of one rubric draft (PRD v1.131 tick 7; record only). Per job line: `aiParts` = what the drafter wrote on it that is the AI's own check or extra (a fact counts once per
|
|
144
|
+
* fact it lists, a `cited` part, a part code later moves as `none` / `judged`; guards and the drafter's own count checks are not counted, the picks strip those), `kept` = how many of
|
|
145
|
+
* those are still in the final declaration, `dropped` = what code removed (the move to Not checked, the drop after the last try), `picks` = the line has code-matched count picks. A merge
|
|
146
|
+
* of fact parts keeps every fact, so it drops nothing. Pure; no words, only counts.
|
|
147
|
+
* @param {any} drafted the declaration as the drafter sent it @param {any} final the declaration the draft ended with @param {any[]|null|undefined} jobLines
|
|
148
|
+
* @returns {{line: number, aiParts: number, kept: number, dropped: number, picks: boolean}[]}
|
|
149
|
+
*/
|
|
150
|
+
export function retentionOf(drafted: any, final: any, jobLines: any[] | null | undefined): {
|
|
151
|
+
line: number;
|
|
152
|
+
aiParts: number;
|
|
153
|
+
kept: number;
|
|
154
|
+
dropped: number;
|
|
155
|
+
picks: boolean;
|
|
156
|
+
}[];
|
|
157
|
+
/**
|
|
158
|
+
* RUBRIC jobs only, run ONLY after the LAST try failed the gate (PRD v1.131 tick 4, hamr's ruling 2026-11-09). When EVERY red points at one part of a rubric-step stage and that part is not
|
|
159
|
+
* a code-matched pick (a part in `declaration.picks`) nor code-owned (a guard, `numbersFromFacts`), the AI's parts those reds name are dropped and listed under Not checked: a pure extra as a
|
|
160
|
+
* note with its words, a part that served a `~` rule as a `refused` entry for each rule no surviving part carries (rule numbers outside the line's rules are ignored, as moveUncheckable does).
|
|
161
|
+
* Any red on a pick / code-owned part, or any red not tied to one part, returns `{refused}` and the plan is refused as today. Pure.
|
|
162
|
+
* @param {any} declaration the declaration as the gate validated it @param {{path?: string, code?: string}[]} reds @param {any[]|null|undefined} jobLines
|
|
163
|
+
* @returns {{declaration: any, dropped: {line: number, words: string, rules: number[]}[]}|{refused: string}}
|
|
164
|
+
*/
|
|
165
|
+
export function dropExtras(declaration: any, reds: {
|
|
166
|
+
path?: string;
|
|
167
|
+
code?: string;
|
|
168
|
+
}[], jobLines: any[] | null | undefined): {
|
|
169
|
+
declaration: any;
|
|
170
|
+
dropped: {
|
|
171
|
+
line: number;
|
|
172
|
+
words: string;
|
|
173
|
+
rules: number[];
|
|
174
|
+
}[];
|
|
175
|
+
} | {
|
|
176
|
+
refused: string;
|
|
177
|
+
};
|
|
178
|
+
/** the one tool the suggestion call uses */
|
|
179
|
+
export const SUGGEST_TOOL: "suggest_checks";
|
|
180
|
+
export function isCountable(g: unknown): boolean;
|
|
181
|
+
export function isUrlInput(v: unknown): boolean;
|
|
182
|
+
export function hasRoutingInput(inputs: {
|
|
183
|
+
value?: string;
|
|
184
|
+
}[] | null | undefined): boolean;
|
|
185
|
+
export function codeScope(inputs: {
|
|
186
|
+
value?: string;
|
|
187
|
+
}[] | null | undefined, g: string): "in" | "out";
|
|
188
|
+
export const SUGGEST_SYSTEM: string;
|
|
189
|
+
/** the tool's parameter schema: one `anyOf` variant per offered rule, plus `none` */
|
|
190
|
+
export const SUGGEST_SCHEMA: Readonly<{
|
|
191
|
+
type: "object";
|
|
192
|
+
properties: {
|
|
193
|
+
checks: {
|
|
194
|
+
type: string;
|
|
195
|
+
description: string;
|
|
196
|
+
items: {
|
|
197
|
+
anyOf: any[];
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
required: string[];
|
|
202
|
+
additionalProperties: false;
|
|
203
|
+
}>;
|
|
204
|
+
/** the instruction a retry carries (the structured ladder's own words, naming this tool) */
|
|
205
|
+
export const SUGGEST_INSTRUCTION: "Your reply did not deliver exactly one suggest_checks call. Call suggest_checks exactly once, with one entry per guardrail as its arguments. Do not write the answer as text.";
|
|
206
|
+
export function suggestTool(box: {
|
|
207
|
+
calls: any[];
|
|
208
|
+
}): {
|
|
209
|
+
name: string;
|
|
210
|
+
description: string;
|
|
211
|
+
parameters: Readonly<{
|
|
212
|
+
type: "object";
|
|
213
|
+
properties: {
|
|
214
|
+
checks: {
|
|
215
|
+
type: string;
|
|
216
|
+
description: string;
|
|
217
|
+
items: {
|
|
218
|
+
anyOf: any[];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
required: string[];
|
|
223
|
+
additionalProperties: false;
|
|
224
|
+
}>;
|
|
225
|
+
execute: (args: any) => Promise<string>;
|
|
226
|
+
};
|
|
227
|
+
export function suggestChannel(): {
|
|
228
|
+
name: string;
|
|
229
|
+
instruction: string;
|
|
230
|
+
textPath: string;
|
|
231
|
+
tool: (box: {
|
|
232
|
+
calls: any[];
|
|
233
|
+
}) => {
|
|
234
|
+
name: string;
|
|
235
|
+
description: string;
|
|
236
|
+
parameters: Readonly<{
|
|
237
|
+
type: "object";
|
|
238
|
+
properties: {
|
|
239
|
+
checks: {
|
|
240
|
+
type: string;
|
|
241
|
+
description: string;
|
|
242
|
+
items: {
|
|
243
|
+
anyOf: any[];
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
required: string[];
|
|
248
|
+
additionalProperties: false;
|
|
249
|
+
}>;
|
|
250
|
+
execute: (args: any) => Promise<string>;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
/** the can't-check ask, as the signed words say it */
|
|
254
|
+
export const CANT_CHECK_WORDS: "I can't check this. Your own words, or Not checked?";
|
|
255
|
+
/**
|
|
256
|
+
* @typedef {{line: number, rule: number, check: Record<string, any>|null, added?: string, own?: boolean, kept?: boolean}} Pick
|
|
257
|
+
* `check` = the check the person agreed to (null for their own words); `added` = the `~` rule the answer wrote on the line; `own` = their own words
|
|
258
|
+
* @typedef {'person-left'|'own-words'|'no-pick'} NoteReason
|
|
259
|
+
*/
|
|
260
|
+
/** the one table of Not checked reasons, in the person's words (fwd src/pagedropwords.js, adapted) @type {Record<NoteReason, string>} */
|
|
261
|
+
export const NOTE_WORDS: Record<NoteReason, string>;
|
|
262
|
+
/** the reason a part the drafter could not express as a check is listed under Not checked (fwd's am16: the drafter writes no check of its own, what no rule can check is the person's to judge) */
|
|
263
|
+
export const UNCHECKABLE_WORDS: "No rule can check this, so you judge it at Accept.";
|
|
264
|
+
/** the reason a dropped AI extra is listed under Not checked */
|
|
265
|
+
export const DROPPED_WORDS: "The AI couldn't build a working check for this, so you judge it at Accept.";
|
|
266
|
+
export type Rule = {
|
|
267
|
+
line: number;
|
|
268
|
+
rule: number;
|
|
269
|
+
text: string;
|
|
270
|
+
};
|
|
271
|
+
export type PickAsk = {
|
|
272
|
+
line: number;
|
|
273
|
+
rule: number;
|
|
274
|
+
source: "look";
|
|
275
|
+
ask: "check" | "no-check";
|
|
276
|
+
ruleText: string;
|
|
277
|
+
question: string;
|
|
278
|
+
reading?: string;
|
|
279
|
+
check?: Record<string, any>;
|
|
280
|
+
counted: boolean;
|
|
281
|
+
pairRule?: number;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* `check` = the check the person agreed to (null for their own words); `added` = the `~` rule the answer wrote on the line; `own` = their own words
|
|
285
|
+
*/
|
|
286
|
+
export type Pick = {
|
|
287
|
+
line: number;
|
|
288
|
+
rule: number;
|
|
289
|
+
check: Record<string, any> | null;
|
|
290
|
+
added?: string;
|
|
291
|
+
own?: boolean;
|
|
292
|
+
kept?: boolean;
|
|
293
|
+
};
|
|
294
|
+
export type NoteReason = "person-left" | "own-words" | "no-pick";
|
|
295
|
+
import { plainWords } from './checkwords.js';
|
|
296
|
+
import { OFFERED } from './checkwords.js';
|
|
297
|
+
export { plainWords, OFFERED };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {{jobLines: {n: number, text: string}[], scoped: {line: number, rule: number, text: string}[], generate: Function, ceilingUsd?: number|null,
|
|
3
|
+
* onCall?: (call: any) => void, priorCalls?: any[], priorRaws?: any[]}} o
|
|
4
|
+
* @returns {Promise<{state: 'ok'|'absent', reason: string|null, rows: ReturnType<typeof rowsFromAnswer>, calls: any[], raws: any[]}>}
|
|
5
|
+
*/
|
|
6
|
+
export function runCheckSuggest({ jobLines, scoped, generate, ceilingUsd, onCall, priorCalls, priorRaws }: {
|
|
7
|
+
jobLines: {
|
|
8
|
+
n: number;
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
scoped: {
|
|
12
|
+
line: number;
|
|
13
|
+
rule: number;
|
|
14
|
+
text: string;
|
|
15
|
+
}[];
|
|
16
|
+
generate: Function;
|
|
17
|
+
ceilingUsd?: number | null;
|
|
18
|
+
onCall?: (call: any) => void;
|
|
19
|
+
priorCalls?: any[];
|
|
20
|
+
priorRaws?: any[];
|
|
21
|
+
}): Promise<{
|
|
22
|
+
state: "ok" | "absent";
|
|
23
|
+
reason: string | null;
|
|
24
|
+
rows: ReturnType<typeof rowsFromAnswer>;
|
|
25
|
+
calls: any[];
|
|
26
|
+
raws: any[];
|
|
27
|
+
}>;
|
|
28
|
+
/** the label of the call, as the drafting book and the draft log see it */
|
|
29
|
+
export const SUGGEST_LABEL: "check-suggest";
|
|
30
|
+
import { rowsFromAnswer } from './checkpick.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The check in plain words, one fixed phrase per rule: the ask, the `~` line an agree writes, the plan card and the Audit all read this one function.
|
|
3
|
+
* @param {{rule: string, value?: number, size?: number, wordsPerSection?: number, names?: string[], phrases?: string[]}} c @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function plainWords(c: {
|
|
6
|
+
rule: string;
|
|
7
|
+
value?: number;
|
|
8
|
+
size?: number;
|
|
9
|
+
wordsPerSection?: number;
|
|
10
|
+
names?: string[];
|
|
11
|
+
phrases?: string[];
|
|
12
|
+
}): string;
|
|
13
|
+
/** the rules of bareguard's list a person may pick here (text rules only: the ones a plain answer can be judged by) */
|
|
14
|
+
export const OFFERED: readonly string[];
|
package/types/config.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ export function providerFieldProblem(field: string, v: unknown): string | null;
|
|
|
31
31
|
* @returns {string|null}
|
|
32
32
|
*/
|
|
33
33
|
export function modelsProblem(list: unknown): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* The rule for `mcpPaths` (extra MCP config files the person added): a list of absolute, NUL-free paths, no duplicates. Plain words, or null.
|
|
36
|
+
* (The Settings > MCP tab, R3, is the writer; `~` is expanded there, so what is stored is always absolute. One line, at most 500 characters: fwd's rule.)
|
|
37
|
+
* @param {unknown} list
|
|
38
|
+
* @returns {string|null}
|
|
39
|
+
*/
|
|
40
|
+
export function mcpPathProblem(list: unknown): string | null;
|
|
34
41
|
/**
|
|
35
42
|
* Apply a patch and write. `null` deletes a field. Top-level fields shallow-merge;
|
|
36
43
|
* `keys` merges per key variable name, then per field; `models.<ENV>` is REPLACED WHOLE (`null`
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the AI is told (the numbered job text only, no `~` rules) and the one rule, with a legal example.
|
|
3
|
+
* @param {{jobLines: {n: number, text: string}[], destination: string}} o @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function destPrompt({ jobLines, destination }: {
|
|
6
|
+
jobLines: {
|
|
7
|
+
n: number;
|
|
8
|
+
text: string;
|
|
9
|
+
}[];
|
|
10
|
+
destination: string;
|
|
11
|
+
}): string;
|
|
12
|
+
/** @typedef {{line: number, file: string, folder: string}} DestPoint */
|
|
13
|
+
/** does `file` lie under the Destination (a folder, a file, a glob, or `.`)? @param {string} file @param {string} destination @returns {boolean} */
|
|
14
|
+
export function destinationCovers(file: string, destination: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Read the AI's reply and decide, all in code. Malformed (no repair): not JSON, not `{points:[...]}`, a point that is not an object with a whole line, a string file and a string folder.
|
|
17
|
+
* A point survives only when its line is a job line, the file path is written in that line's own text, the file is in the repo's committed tree, the folder is a real parent folder
|
|
18
|
+
* of that file, and the file is NOT under the Destination. The survivors are ordered by line.
|
|
19
|
+
* @param {unknown} text @param {{jobLines: {n: number, text: string}[], files: readonly string[], destination: string}} o
|
|
20
|
+
* @returns {{status: 'malformed'}|{status: 'ok', points: DestPoint[], dropped: number}}
|
|
21
|
+
*/
|
|
22
|
+
export function decideDestPoint(text: unknown, { jobLines, files, destination }: {
|
|
23
|
+
jobLines: {
|
|
24
|
+
n: number;
|
|
25
|
+
text: string;
|
|
26
|
+
}[];
|
|
27
|
+
files: readonly string[];
|
|
28
|
+
destination: string;
|
|
29
|
+
}): {
|
|
30
|
+
status: "malformed";
|
|
31
|
+
} | {
|
|
32
|
+
status: "ok";
|
|
33
|
+
points: DestPoint[];
|
|
34
|
+
dropped: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Run the pointing call: one call (one retry on a malformed reply, a transport failure or a 429). Never throws on a call casualty; every failure is `absent` (no question).
|
|
38
|
+
* @param {{jobLines: {n: number, text: string}[], files: readonly string[], destination: string, provider?: any, maxTokens?: number, ceilingUsd?: number|null,
|
|
39
|
+
* callTimeoutMs?: number, onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string, raw?: string}) => void,
|
|
40
|
+
* createLoop?: Function, rates?: {in: number, out: number}|null, callOptions?: Record<string, any>, sleep?: (ms: number) => Promise<void>}} o
|
|
41
|
+
* @returns {Promise<{state: 'point'|'none'|'absent', point: DestPoint|null, reason: string|null, calls: {label: string, costUsd: number|null, unpricedRounds: number}[]}>}
|
|
42
|
+
*/
|
|
43
|
+
export function runDestPoint({ jobLines, files, destination, provider, maxTokens, ceilingUsd, callTimeoutMs, onCall, createLoop, rates, callOptions, sleep, }: {
|
|
44
|
+
jobLines: {
|
|
45
|
+
n: number;
|
|
46
|
+
text: string;
|
|
47
|
+
}[];
|
|
48
|
+
files: readonly string[];
|
|
49
|
+
destination: string;
|
|
50
|
+
provider?: any;
|
|
51
|
+
maxTokens?: number;
|
|
52
|
+
ceilingUsd?: number | null;
|
|
53
|
+
callTimeoutMs?: number;
|
|
54
|
+
onCall?: (call: {
|
|
55
|
+
label: string;
|
|
56
|
+
costUsd: number | null;
|
|
57
|
+
unpricedRounds: number;
|
|
58
|
+
thinkingStatus?: string;
|
|
59
|
+
raw?: string;
|
|
60
|
+
}) => void;
|
|
61
|
+
createLoop?: Function;
|
|
62
|
+
rates?: {
|
|
63
|
+
in: number;
|
|
64
|
+
out: number;
|
|
65
|
+
} | null;
|
|
66
|
+
callOptions?: Record<string, any>;
|
|
67
|
+
sleep?: (ms: number) => Promise<void>;
|
|
68
|
+
}): Promise<{
|
|
69
|
+
state: "point" | "none" | "absent";
|
|
70
|
+
point: DestPoint | null;
|
|
71
|
+
reason: string | null;
|
|
72
|
+
calls: {
|
|
73
|
+
label: string;
|
|
74
|
+
costUsd: number | null;
|
|
75
|
+
unpricedRounds: number;
|
|
76
|
+
}[];
|
|
77
|
+
}>;
|
|
78
|
+
/** the label of the one paid call, as the drafting book sees it */
|
|
79
|
+
export const DEST_CALL_LABEL: "dest-point";
|
|
80
|
+
export const DEST_SYSTEM: "You read the numbered lines of a code job. You never invent words: every file path you name must be copied, character for character, from the job line that holds it.";
|
|
81
|
+
export function destQuestionText(p: DestPoint, destination: string): string;
|
|
82
|
+
export function yesNoOf(text: unknown): "yes" | "no" | null;
|
|
83
|
+
export type DestPoint = {
|
|
84
|
+
line: number;
|
|
85
|
+
file: string;
|
|
86
|
+
folder: string;
|
|
87
|
+
};
|
package/types/draftspend.d.ts
CHANGED
|
@@ -88,6 +88,22 @@ export function readDraftSteps(dir: string): {
|
|
|
88
88
|
}[];
|
|
89
89
|
humans: ReturnType<typeof humanRowWords>[];
|
|
90
90
|
}[];
|
|
91
|
+
/**
|
|
92
|
+
* fwd am14 item 6: the label this draft's record carries (`revise 1`, `revise 2`, `start over`; src/revises.js `draftLabelOf` owns the words), or null for a first draft.
|
|
93
|
+
* @param {string} dir
|
|
94
|
+
* @returns {string|null}
|
|
95
|
+
*/
|
|
96
|
+
export function readDraftLabel(dir: string): string | null;
|
|
97
|
+
/**
|
|
98
|
+
* The checks the draft ended with, each marked who added it (`agent` = the drafter, `you` = the person's own pick): the last `draft-checks` line of the log, or `[]` (a draft from before it, or a job that has none).
|
|
99
|
+
* @param {string} dir
|
|
100
|
+
* @returns {{line: number, text: string, by: 'agent'|'you'}[]}
|
|
101
|
+
*/
|
|
102
|
+
export function readDraftChecks(dir: string): {
|
|
103
|
+
line: number;
|
|
104
|
+
text: string;
|
|
105
|
+
by: "agent" | "you";
|
|
106
|
+
}[];
|
|
91
107
|
/**
|
|
92
108
|
* The DRAFTING PART of a run (hamr 2026-10-06, option A): the first part of the run's views, built from the session's
|
|
93
109
|
* drafting log. `null` when the run did not come out of a panel session, or the log carries no metered call (a Reuse
|
package/types/factwords.d.ts
CHANGED
|
@@ -32,6 +32,13 @@ export function keptSetOf(look: {
|
|
|
32
32
|
decimal?: string;
|
|
33
33
|
}[];
|
|
34
34
|
} | null;
|
|
35
|
+
/**
|
|
36
|
+
* The label lists the drafter is told, one per input: ONE owner with the proof above. An input the page-word map read (a look with a
|
|
37
|
+
* `dropped` list) is offered the labels `keptSetOf` accepts, nothing else; any other input keeps the code-made list the proof reads.
|
|
38
|
+
* @param {Record<string, string>} texts @param {Parameters<typeof keptSetOf>[0]} look
|
|
39
|
+
* @returns {string[]}
|
|
40
|
+
*/
|
|
41
|
+
export function labelListsFor(texts: Record<string, string>, look: Parameters<typeof keptSetOf>[0]): string[];
|
|
35
42
|
/**
|
|
36
43
|
* The reds for ONE fact part against its frozen source text.
|
|
37
44
|
* @param {{part: any, text: string, line: number|string, scan?: import('./labelscan.js').LabelScan, kept?: ReturnType<typeof keptSetOf>}} o
|
package/types/job.d.ts
CHANGED
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
* @returns {string|null} a red `detail`, or `null` when the value is admitted
|
|
26
26
|
*/
|
|
27
27
|
export function validateBaseUrl(value: unknown): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The ONE reader of a job's flow type: the field when present; an `mcp` block with no `flowType` is a Tickets job; no `mcp` block is plain.
|
|
30
|
+
* @param {Record<string, any>} spec @returns {'plain'|'mcp'|'tickets'}
|
|
31
|
+
*/
|
|
32
|
+
export function flowTypeOf(spec: Record<string, any>): "plain" | "mcp" | "tickets";
|
|
28
33
|
/**
|
|
29
34
|
* Validate an operator-owned job spec (`schema: "job-v1"`). Never throws on
|
|
30
35
|
* JSON text or plain parsed data — the ingest contract; a live object with a
|
|
@@ -271,6 +276,14 @@ export const PROVIDERS: readonly string[];
|
|
|
271
276
|
* candidate at N3. `provider` is part of the key by definition (top-level,
|
|
272
277
|
* not duplicated here). */
|
|
273
278
|
export const CONDITION_KEYS: readonly string[];
|
|
279
|
+
/** the job's flow types; `flowType` is set by code from the job card and signed with the job (fwdloop M13 piece 4) */
|
|
280
|
+
export const FLOW_TYPES: readonly string[];
|
|
281
|
+
/** the words the card's Flow type menu and the Job tab use for each flow type (fwd's am2 names) */
|
|
282
|
+
export const FLOW_TYPE_LABELS: Readonly<{
|
|
283
|
+
plain: "plain";
|
|
284
|
+
mcp: "MCP";
|
|
285
|
+
tickets: "Tickets MCP";
|
|
286
|
+
}>;
|
|
274
287
|
/**
|
|
275
288
|
* The fields a "Reuse workflow" run may change: where the work lands (the write fence, `writeScope`, and a
|
|
276
289
|
* `destination`/`source` where a spec ever carries them), the `inputs` the person pointed at (P7: Inputs is open on a reuse) and the two ceilings. Everything else in a signed spec is
|
package/types/jobblock.d.ts
CHANGED
|
@@ -35,6 +35,15 @@ export function parseInputs(text: unknown): {
|
|
|
35
35
|
* @returns {string}
|
|
36
36
|
*/
|
|
37
37
|
export function renderJobLines(lines: JobLine[]): string;
|
|
38
|
+
/**
|
|
39
|
+
* The job lines as the job BOX reads them (R10): each line's text, then one `~` line per rule. The inverse of {@link parseJobBlock}, so a card reopened by a Revise holds
|
|
40
|
+
* the `~` lines the person's answers added.
|
|
41
|
+
* @param {{text: string, rules: string[]}[]} lines @returns {string}
|
|
42
|
+
*/
|
|
43
|
+
export function jobBoxText(lines: {
|
|
44
|
+
text: string;
|
|
45
|
+
rules: string[];
|
|
46
|
+
}[]): string;
|
|
38
47
|
/**
|
|
39
48
|
* The PASS:/FAIL: examples the person wrote, each kept with its line number (answer 2 of a rubric interview — what the
|
|
40
49
|
* calibration compile reads). Empty string when there are none.
|
package/types/labelscan.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export function labelOnList(scan: LabelScan, shape: string, idOrText: unknown):
|
|
|
21
21
|
* @returns {string}
|
|
22
22
|
*/
|
|
23
23
|
export function renderLabelList(inputLabel: string, scan: LabelScan): string;
|
|
24
|
+
/**
|
|
25
|
+
* The list a page-word map input is shown: ONLY the labels the map kept (what the draft gate's `keptSetOf` accepts), so the prompt and the
|
|
26
|
+
* proof read the same words. Empty = no label was kept, so the drafter leaves the label out.
|
|
27
|
+
* @param {string} inputLabel @param {string[]} labels
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
export function renderKeptLabelList(inputLabel: string, labels: string[]): string;
|
|
24
31
|
/** the shapes a list is made for */
|
|
25
32
|
export const LABEL_SHAPES: readonly string[];
|
|
26
33
|
/** a label must occur at least this often to be listed (1: a one-page document with one total still has its label; the list is cut to the highest counts) */
|
package/types/launcher.d.ts
CHANGED
|
@@ -23,13 +23,14 @@
|
|
|
23
23
|
* @property {((target: string) => Promise<boolean>)} [open] default the shared OS opener
|
|
24
24
|
* @property {(port: number) => Promise<boolean>} [portFree] default: try to bind 127.0.0.1:port
|
|
25
25
|
* @property {(ms: number) => Promise<void>} [sleep]
|
|
26
|
+
* @property {() => number} [clock] monotonic ms clock for stop's wait-until-gone deadlines (default performance.now); tests pass a fake one so load cannot move a deadline
|
|
26
27
|
* @property {(question: string) => Promise<string>} [ask] the y/N and menu reader
|
|
27
28
|
* @property {string} [bareloopBin] default bin/bareloop.mjs of this package
|
|
28
29
|
* @property {import('./tty-colour.js').Paint} [paint] colour for stdout lines (default none); {@link makePaint} decides TTY / NO_COLOR / TERM
|
|
29
30
|
* @property {import('./tty-colour.js').Paint} [paintErr] colour for stderr lines (default: `paint`)
|
|
30
31
|
* @property {number} [now] ms clock for the run list's age rules (default: real time); tests pass their own
|
|
31
32
|
* @property {string} [platform]
|
|
32
|
-
* @property {Record<string, string|undefined>} [env] raw env handed to the panel child (default process.env)
|
|
33
|
+
* @property {Record<string, string|undefined>} [env] raw env: handed whole to the panel child, stripped by npmEnv for the update npm child (default process.env)
|
|
33
34
|
*/
|
|
34
35
|
/**
|
|
35
36
|
* The run counts, from the panel's own `listRuns` rows. `status.key === 'running'` is the panel's word; `needs` is the one tag
|
|
@@ -294,6 +295,10 @@ export type LauncherDeps = {
|
|
|
294
295
|
*/
|
|
295
296
|
portFree?: ((port: number) => Promise<boolean>) | undefined;
|
|
296
297
|
sleep?: ((ms: number) => Promise<void>) | undefined;
|
|
298
|
+
/**
|
|
299
|
+
* monotonic ms clock for stop's wait-until-gone deadlines (default performance.now); tests pass a fake one so load cannot move a deadline
|
|
300
|
+
*/
|
|
301
|
+
clock?: (() => number) | undefined;
|
|
297
302
|
/**
|
|
298
303
|
* the y/N and menu reader
|
|
299
304
|
*/
|
|
@@ -316,7 +321,7 @@ export type LauncherDeps = {
|
|
|
316
321
|
now?: number | undefined;
|
|
317
322
|
platform?: string | undefined;
|
|
318
323
|
/**
|
|
319
|
-
* raw env handed to the panel child (default process.env)
|
|
324
|
+
* raw env: handed whole to the panel child, stripped by npmEnv for the update npm child (default process.env)
|
|
320
325
|
*/
|
|
321
326
|
env?: Record<string, string | undefined> | undefined;
|
|
322
327
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** append ONE line; throws when it cannot be written @param {string|undefined} home @param {Record<string, any>} entry */
|
|
2
|
+
export function appendMcpCheck(home: string | undefined, entry: Record<string, any>): void;
|
|
3
|
+
/** the newest line per `path\tserver` @param {string|undefined} home @returns {Map<string, any>} */
|
|
4
|
+
export function newestMcpChecks(home: string | undefined): Map<string, any>;
|
|
5
|
+
/** the tool names of the newest OK line (with at least one tool) for this server at this path, or null @param {string|undefined} home @param {string} server @param {string} path @returns {string[]|null} */
|
|
6
|
+
export function newestOkMcpTools(home: string | undefined, server: string, path: string): string[] | null;
|
|
7
|
+
export const MCP_CHECKS_FILE: "mcp-checks.jsonl";
|
|
8
|
+
export function mcpChecksFile(home: string | undefined): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} server
|
|
3
|
+
* @param {{ home?: string, mcpHome?: string }} [o] `home` the config home (undefined = `~/.config/bareloop`); `mcpHome` the person's home folder the MCP config places live under (tests inject one)
|
|
4
|
+
* @returns {{ ok: true, server: string, tools: string[] } | { ok: false, say: string }}
|
|
5
|
+
*/
|
|
6
|
+
export function mcpPickFor(server: string, o?: {
|
|
7
|
+
home?: string;
|
|
8
|
+
mcpHome?: string;
|
|
9
|
+
}): {
|
|
10
|
+
ok: true;
|
|
11
|
+
server: string;
|
|
12
|
+
tools: string[];
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
say: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The spec with the card's flow type and MCP pick signed into it. A `plain` pick writes NOTHING (no `flowType` key, no `mcp`), so every plain job keeps the hash it had before
|
|
19
|
+
* the card had these controls. The `mcp` block is the pick's server and EVERY tool of its newest check; the agent never sets it (`assembleSpec` refuses a draft that carries it).
|
|
20
|
+
* @template {Record<string, any>} T
|
|
21
|
+
* R5: a Tickets job also signs the drafter's PROPOSED `ticketFilter` (already read by `ticketFilterReds`), if it made one: the person signs the whole hash. Never on an `mcp` job.
|
|
22
|
+
* @param {T} spec @param {'plain'|'mcp'|'tickets'} flowType @param {{ server: string, tools: string[] }|null} pick @param {{priority?: string[], labels?: string[]}|undefined} [ticketFilter]
|
|
23
|
+
* @returns {T}
|
|
24
|
+
*/
|
|
25
|
+
export function signFlow<T extends Record<string, any>>(spec: T, flowType: "plain" | "mcp" | "tickets", pick: {
|
|
26
|
+
server: string;
|
|
27
|
+
tools: string[];
|
|
28
|
+
} | null, ticketFilter?: {
|
|
29
|
+
priority?: string[];
|
|
30
|
+
labels?: string[];
|
|
31
|
+
} | undefined): T;
|
|
32
|
+
/** the one refusal for an MCP nobody has checked (or whose check never succeeded) */
|
|
33
|
+
export const NEVER_CHECKED_SAY: "press check tools in Settings > MCP first";
|