@turri-dev/cli 0.2.4-next.35ab04b → 0.2.4-next.636a651
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/README.md +2 -2
- package/dist/chat-idle.d.ts +2 -2
- package/dist/chat-idle.js +2 -2
- package/dist/chats.d.ts +0 -10
- package/dist/chats.js +0 -23
- package/dist/cli.js +5 -7
- package/dist/config-edit.js +1 -3
- package/dist/config.d.ts +20 -22
- package/dist/config.js +49 -22
- package/dist/conformance-switch.d.ts +7 -17
- package/dist/conformance-switch.js +24 -46
- package/dist/drift-cli.js +1 -1
- package/dist/extension.d.ts +8 -10
- package/dist/extension.js +157 -217
- package/dist/genome.js +9 -48
- package/dist/graph.js +3 -5
- package/dist/host-session.d.ts +4 -15
- package/dist/host-session.js +2 -4
- package/dist/host.d.ts +1 -3
- package/dist/host.js +1 -4
- package/dist/identity.js +0 -1
- package/dist/init-config.d.ts +0 -1
- package/dist/init-config.js +2 -9
- package/dist/installed-providers.d.ts +1 -1
- package/dist/installed-providers.js +1 -1
- package/dist/loop-cli.d.ts +4 -3
- package/dist/loop-cli.js +13 -11
- package/dist/loop-tools.d.ts +26 -3
- package/dist/loop-tools.js +85 -20
- package/dist/new-project.js +2 -2
- package/dist/pi-launch.js +1 -1
- package/dist/pi.js +9 -6
- package/dist/plain/check.d.ts +1 -8
- package/dist/plain/check.js +3 -38
- package/dist/regenerate/activity.d.ts +0 -7
- package/dist/regenerate/activity.js +2 -20
- package/dist/regenerate/agent-shell.js +3 -1
- package/dist/regenerate/audit.js +9 -0
- package/dist/regenerate/chunk-plan.d.ts +5 -0
- package/dist/regenerate/chunk-plan.js +16 -1
- package/dist/regenerate/failure-reports.d.ts +28 -0
- package/dist/regenerate/failure-reports.js +79 -0
- package/dist/regenerate/job-panel.js +3 -1
- package/dist/regenerate/jobs-tree.js +1 -1
- package/dist/regenerate/jobs.d.ts +2 -0
- package/dist/regenerate/jobs.js +4 -0
- package/dist/regenerate/ledger-view.d.ts +11 -24
- package/dist/regenerate/ledger-view.js +14 -60
- package/dist/regenerate/ledger.d.ts +1 -14
- package/dist/regenerate/ledger.js +1 -1
- package/dist/regenerate/loop.d.ts +37 -60
- package/dist/regenerate/loop.js +174 -106
- package/dist/regenerate/regenerate.d.ts +0 -2
- package/dist/regenerate/regenerate.js +4 -15
- package/dist/regenerate/standing.js +1 -1
- package/dist/regenerate/submit-work.d.ts +2 -0
- package/dist/regenerate/submit-work.js +8 -3
- package/dist/regenerate/testing-steps.d.ts +11 -0
- package/dist/regenerate/testing-steps.js +22 -3
- package/dist/regenerate-cli.js +18 -9
- package/dist/self-invocation.d.ts +11 -0
- package/dist/self-invocation.js +33 -7
- package/dist/sentinel.js +8 -5
- package/dist/skill.d.ts +0 -11
- package/dist/skill.js +0 -9
- package/dist/stacks.js +1 -1
- package/dist/tools.js +2 -3
- package/dist/turri-versions.js +2 -1
- package/docs/README.md +0 -2
- package/docs/authoring-plain.md +3 -3
- package/docs/chats.md +1 -3
- package/docs/config.md +11 -13
- package/docs/deploy.md +1 -1
- package/docs/development.md +2 -3
- package/docs/headless.md +5 -4
- package/docs/hosting.md +6 -6
- package/docs/parser.md +2 -2
- package/docs/regenerating.md +14 -12
- package/docs/sentinel.md +4 -4
- package/docs/skills-and-gates.md +4 -8
- package/docs/using.md +10 -18
- package/genome/rules/test-plain-files.md +15 -7
- package/genome/rules/turri-regeneration.md +4 -9
- package/genome/skills/convert-old-syntax/SKILL.md +5 -5
- package/package.json +1 -1
- package/dist/advisor-chat.d.ts +0 -63
- package/dist/advisor-chat.js +0 -290
- package/dist/change-plain-cli.d.ts +0 -1
- package/dist/change-plain-cli.js +0 -55
- package/dist/ledger-cli.d.ts +0 -1
- package/dist/ledger-cli.js +0 -50
- package/dist/ledger-tools.d.ts +0 -10
- package/dist/ledger-tools.js +0 -64
- package/dist/regenerate/advisor-records.d.ts +0 -93
- package/dist/regenerate/advisor-records.js +0 -110
- package/dist/regenerate/advisor-runs.d.ts +0 -87
- package/dist/regenerate/advisor-runs.js +0 -327
- package/dist/regenerate/test-advisor.d.ts +0 -101
- package/dist/regenerate/test-advisor.js +0 -379
- package/dist/spec-tools.d.ts +0 -36
- package/dist/spec-tools.js +0 -128
- package/docs/test-advisor.md +0 -110
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { AdvisorAnswer, AdvisorInput, AdvisorReport } from "./advisor-records.ts";
|
|
2
|
-
/**
|
|
3
|
-
* The test advisor's judgement of one functional spec: does it need explicit testing scenarios, and if so, which inputs
|
|
4
|
-
* should they cover (docs/test-advisor.md). Every step is a plain model call on `models.advisor`, answered through one
|
|
5
|
-
* tool and checked in code, as the planner's grouping agent is - none is a skill, and none can touch the project.
|
|
6
|
-
*
|
|
7
|
-
* - **Classify:** four questions, each yes carrying its evidence - a wrong output that looks right (silent failure), an
|
|
8
|
-
* input two reasonable readings answer differently (divergence), what would change (revisited), the consequence of a
|
|
9
|
-
* bug (cost). A yes whose evidence is empty or malformed counts as no. Silent failure, divergence or cost make the
|
|
10
|
-
* verdict yes; revisited alone does not - the unit tests are the regression protection.
|
|
11
|
-
* - **On a yes, pick the inputs:** one call writes 1-10 boundary probes (and the divergence's input), readers that
|
|
12
|
-
* differ only by their system prompt each predict every probe's output, code compares them, and any disagreement is a
|
|
13
|
-
* candidate - the union, never a majority. The third reader is spared when the first two already disagree. One last
|
|
14
|
-
* call keeps, of each candidate, the readings a reasonable person could hold.
|
|
15
|
-
*/
|
|
16
|
-
/** The functional spec the advisor looks at, and what it reads it with. */
|
|
17
|
-
export interface AdvisorSubject {
|
|
18
|
-
module: string;
|
|
19
|
-
funcId: string;
|
|
20
|
-
/** The functional spec's text. */
|
|
21
|
-
text: string;
|
|
22
|
-
/** The module's .plain file, whole: its definitions, its reqs, the functional specs around it. */
|
|
23
|
-
moduleText: string;
|
|
24
|
-
/** The project's own words on what matters: its AGENTS.md, the steering given in the conversation. */
|
|
25
|
-
context: string[];
|
|
26
|
-
/** A module below's: the tip its scenarios are tested in - built on it, its own functional specs beside it. */
|
|
27
|
-
testedIn?: {
|
|
28
|
-
module: string;
|
|
29
|
-
text: string;
|
|
30
|
-
};
|
|
31
|
-
/** Why the chat asked for the evaluation (evaluate_tests) - "the coding agent failed three times to implement it" - for the classifier, as context. */
|
|
32
|
-
reason?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface AdvisorCallOptions {
|
|
35
|
-
/** Where the calls run: the project. */
|
|
36
|
-
cwd: string;
|
|
37
|
-
/** The advisor's model (advisorModel) - the `advisor` role's config is laid over it as for any agent. */
|
|
38
|
-
model?: string;
|
|
39
|
-
}
|
|
40
|
-
/** The classification: the verdict, the questions that were a yes with their evidence, and the divergence's input. */
|
|
41
|
-
export interface Classification {
|
|
42
|
-
verdict: "yes" | "no";
|
|
43
|
-
questions: AdvisorAnswer[];
|
|
44
|
-
divergence?: {
|
|
45
|
-
input: string;
|
|
46
|
-
readings: [string, string];
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
/** The fewest and most probes a functional spec is given. */
|
|
50
|
-
export declare const MIN_PROBES = 1;
|
|
51
|
-
export declare const MAX_PROBES = 10;
|
|
52
|
-
/** What a reader answers for an input the functional spec does not settle: a scenario on it would pin a guess. */
|
|
53
|
-
export declare const UNSPECIFIED = "unspecified";
|
|
54
|
-
/** The readers: the same task, decorrelated by their system prompts alone. */
|
|
55
|
-
export declare const READERS: ReadonlyArray<{
|
|
56
|
-
name: string;
|
|
57
|
-
system: string;
|
|
58
|
-
}>;
|
|
59
|
-
/** Text compared as the readers' outputs are: whitespace collapsed, case left aside. */
|
|
60
|
-
export declare function normalised(text: string): string;
|
|
61
|
-
type ClassificationAnswer = {
|
|
62
|
-
silent_failure: {
|
|
63
|
-
answer: boolean;
|
|
64
|
-
wrong_output?: string;
|
|
65
|
-
};
|
|
66
|
-
divergence: {
|
|
67
|
-
answer: boolean;
|
|
68
|
-
input?: string;
|
|
69
|
-
reading_a?: string;
|
|
70
|
-
reading_b?: string;
|
|
71
|
-
};
|
|
72
|
-
revisited: {
|
|
73
|
-
answer: boolean;
|
|
74
|
-
would_change?: string;
|
|
75
|
-
};
|
|
76
|
-
cost: {
|
|
77
|
-
answer: boolean;
|
|
78
|
-
consequence?: string;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* The classification, from the call's answer: each yes kept only with its evidence - a yes without it, or with it
|
|
83
|
-
* malformed (two readings that are the same), is a no. The verdict is yes on silent failure, divergence or cost.
|
|
84
|
-
*/
|
|
85
|
-
export declare function classificationOf(answer: ClassificationAnswer): Classification;
|
|
86
|
-
/** Classify a functional spec: one call, four evidence-backed questions. Throws when the call gives no answer. */
|
|
87
|
-
export declare function classify(subject: AdvisorSubject, options: AdvisorCallOptions): Promise<Classification>;
|
|
88
|
-
/**
|
|
89
|
-
* The inputs the readers split on - every probe where any two predictions differ once normalised: the union, never a
|
|
90
|
-
* majority - each with its distinct readings, in the order the readers gave them.
|
|
91
|
-
*/
|
|
92
|
-
export declare function splitInputs(readings: string[][]): Map<number, string[]>;
|
|
93
|
-
/**
|
|
94
|
-
* Pick the inputs a functional spec's scenarios should cover: the probes, the readers' predictions of them, the
|
|
95
|
-
* disagreements in code, and the verifier's word on each. An input the readers agree on comes with their output; one
|
|
96
|
-
* they split on, with every reading the verifier kept - a single reading left is an agreed one, and none left drops it.
|
|
97
|
-
*/
|
|
98
|
-
export declare function pickInputs(subject: AdvisorSubject, classification: Classification, options: AdvisorCallOptions): Promise<AdvisorInput[]>;
|
|
99
|
-
/** The whole judgement: classify, and on a yes pick the inputs. Throws when a call that cannot be done without fails. */
|
|
100
|
-
export declare function advise(subject: AdvisorSubject, options: AdvisorCallOptions): Promise<AdvisorReport>;
|
|
101
|
-
export {};
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { Type } from "typebox";
|
|
3
|
-
import { ask, BEGIN, createExecutor } from "../pi.js";
|
|
4
|
-
/** How many times a call that did not answer, or answered what does not hold, is asked again. */
|
|
5
|
-
const RETRIES = 2;
|
|
6
|
-
/** The fewest and most probes a functional spec is given. */
|
|
7
|
-
export const MIN_PROBES = 1;
|
|
8
|
-
export const MAX_PROBES = 10;
|
|
9
|
-
/** What a reader answers for an input the functional spec does not settle: a scenario on it would pin a guess. */
|
|
10
|
-
export const UNSPECIFIED = "unspecified";
|
|
11
|
-
/** The readers: the same task, decorrelated by their system prompts alone. */
|
|
12
|
-
export const READERS = [
|
|
13
|
-
{
|
|
14
|
-
name: "literal reader",
|
|
15
|
-
system: "You read a functional spec literally: you predict exactly what its words say, and nothing they do not. Where the words are silent, you take the narrowest reading they allow.",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "edge-case hunter",
|
|
19
|
-
system: "You read a functional spec as a tester hunting for edge cases: empty and huge values, limits, duplicates, order, rounding, time zones, missing data. You predict what a careful implementation would do at each edge.",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "another domain's reader",
|
|
23
|
-
system: "You read a functional spec as someone from another domain would - a different field, a different country, a different habit of mind - bringing the conventions that domain takes for granted. You predict what you would expect the output to be.",
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
/** Ask one call, and ask again with what was wrong, until it holds or the retries are spent. */
|
|
27
|
-
async function askAdvisor(options) {
|
|
28
|
-
let answer;
|
|
29
|
-
const tool = options.tool((given) => (answer = given));
|
|
30
|
-
const session = await createExecutor({
|
|
31
|
-
cwd: options.cwd,
|
|
32
|
-
customTools: [tool],
|
|
33
|
-
tools: [tool.name],
|
|
34
|
-
model: options.model,
|
|
35
|
-
label: options.label,
|
|
36
|
-
role: "advisor",
|
|
37
|
-
task: options.task,
|
|
38
|
-
...(options.system !== undefined ? { system: options.system } : {}),
|
|
39
|
-
budget: { calls: 4, finish: [tool.name] },
|
|
40
|
-
});
|
|
41
|
-
try {
|
|
42
|
-
await ask(session, BEGIN);
|
|
43
|
-
for (let again = 0; again < RETRIES; again += 1) {
|
|
44
|
-
if (answer !== undefined && options.check(answer).length === 0)
|
|
45
|
-
return answer;
|
|
46
|
-
const problems = answer === undefined ? [`You did not call ${tool.name}.`] : options.check(answer);
|
|
47
|
-
answer = undefined;
|
|
48
|
-
await ask(session, `That does not hold:\n- ${problems.join("\n- ")}\n\nCall ${tool.name} again, with it fixed.`);
|
|
49
|
-
}
|
|
50
|
-
return answer !== undefined && options.check(answer).length === 0 ? answer : undefined;
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
session.dispose();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/** Text compared as the readers' outputs are: whitespace collapsed, case left aside. */
|
|
57
|
-
export function normalised(text) {
|
|
58
|
-
return text.trim().replace(/\s+/g, " ").toLowerCase();
|
|
59
|
-
}
|
|
60
|
-
/** What every call is given: the functional spec, its module, and the project's own words on what matters. */
|
|
61
|
-
function subjectBlock(subject) {
|
|
62
|
-
return [
|
|
63
|
-
`<functional_spec module="${subject.module}" func_id="${subject.funcId}">`,
|
|
64
|
-
subject.text.trim(),
|
|
65
|
-
"</functional_spec>",
|
|
66
|
-
"",
|
|
67
|
-
`<module name="${subject.module}">`,
|
|
68
|
-
subject.moduleText.trim(),
|
|
69
|
-
"</module>",
|
|
70
|
-
...(subject.testedIn !== undefined
|
|
71
|
-
? [
|
|
72
|
-
"",
|
|
73
|
-
`Its scenarios are tested against the code of ${subject.testedIn.module}, which is built on ${subject.module}: what a command`,
|
|
74
|
-
`or a listing shows there includes ${subject.testedIn.module}'s own functional specs.`,
|
|
75
|
-
`<module name="${subject.testedIn.module}">`,
|
|
76
|
-
subject.testedIn.text.trim(),
|
|
77
|
-
"</module>",
|
|
78
|
-
]
|
|
79
|
-
: []),
|
|
80
|
-
...(subject.context.length > 0 ? ["", "<the project's own words on what matters>", ...subject.context.map((text) => text.trim()), "</the project's own words on what matters>"] : []),
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
const stringOf = (value) => (typeof value === "string" ? value.trim() : "");
|
|
84
|
-
/**
|
|
85
|
-
* The classification, from the call's answer: each yes kept only with its evidence - a yes without it, or with it
|
|
86
|
-
* malformed (two readings that are the same), is a no. The verdict is yes on silent failure, divergence or cost.
|
|
87
|
-
*/
|
|
88
|
-
export function classificationOf(answer) {
|
|
89
|
-
const questions = [];
|
|
90
|
-
const add = (question, yes, evidence) => {
|
|
91
|
-
if (yes && evidence !== "")
|
|
92
|
-
questions.push({ question, evidence });
|
|
93
|
-
};
|
|
94
|
-
add("silent-failure", answer.silent_failure?.answer === true, stringOf(answer.silent_failure?.wrong_output));
|
|
95
|
-
const input = stringOf(answer.divergence?.input);
|
|
96
|
-
const a = stringOf(answer.divergence?.reading_a);
|
|
97
|
-
const b = stringOf(answer.divergence?.reading_b);
|
|
98
|
-
const diverges = answer.divergence?.answer === true && input !== "" && a !== "" && b !== "" && normalised(a) !== normalised(b);
|
|
99
|
-
add("divergence", diverges, diverges ? `${input} - one reading: ${a}; the other: ${b}` : "");
|
|
100
|
-
add("revisited", answer.revisited?.answer === true, stringOf(answer.revisited?.would_change));
|
|
101
|
-
add("cost", answer.cost?.answer === true, stringOf(answer.cost?.consequence));
|
|
102
|
-
const decisive = questions.some((answered) => answered.question !== "revisited");
|
|
103
|
-
return { verdict: decisive ? "yes" : "no", questions, ...(diverges ? { divergence: { input, readings: [a, b] } } : {}) };
|
|
104
|
-
}
|
|
105
|
-
function classifyPrompt(subject) {
|
|
106
|
-
return [
|
|
107
|
-
"You decide whether one functional spec of a ***plain module needs explicit testing scenarios: black-box tests written",
|
|
108
|
-
"from scenarios, beside the unit tests its coding agent writes anyway. Not everything should be tested this way - only",
|
|
109
|
-
"functionality where a wrong implementation would go unnoticed, where readers would disagree, or where a bug is costly.",
|
|
110
|
-
"",
|
|
111
|
-
...subjectBlock(subject),
|
|
112
|
-
...(subject.reason !== undefined && subject.reason.trim() !== ""
|
|
113
|
-
? ["", "<why it was asked for>", subject.reason.trim(), "</why it was asked for>", "This is context, not evidence: answer the questions from the functional spec, its module and the project."]
|
|
114
|
-
: []),
|
|
115
|
-
"",
|
|
116
|
-
"Answer four questions about the functional spec. Each yes needs concrete evidence; without it, answer no.",
|
|
117
|
-
"1. silent_failure: could an incorrect implementation give output that looks plausible but is wrong? Evidence: one such",
|
|
118
|
-
" wrong output, concretely - the input and the wrong output it would give.",
|
|
119
|
-
"2. divergence: is there an input for which two reasonable readings of the text give different outputs? Evidence: the",
|
|
120
|
-
" input, and the output under each reading.",
|
|
121
|
-
"3. revisited: is this functionality likely to be changed or built on later? Evidence: what would change.",
|
|
122
|
-
"4. cost: would a bug in it cause financial loss, security exposure, data loss, or harm to users' trust? Evidence: the",
|
|
123
|
-
" consequence.",
|
|
124
|
-
"",
|
|
125
|
-
"Judge only this functional spec, from what the module and the project say. Do not answer yes to be safe: a yes",
|
|
126
|
-
"starts work, and a functional spec with nothing at stake is better left to its unit tests.",
|
|
127
|
-
"Call submit_classification once.",
|
|
128
|
-
].join("\n");
|
|
129
|
-
}
|
|
130
|
-
/** Classify a functional spec: one call, four evidence-backed questions. Throws when the call gives no answer. */
|
|
131
|
-
export async function classify(subject, options) {
|
|
132
|
-
const answer = await askAdvisor({
|
|
133
|
-
cwd: options.cwd,
|
|
134
|
-
model: options.model,
|
|
135
|
-
label: `${subject.module}:${subject.funcId} test advisor classifying`,
|
|
136
|
-
task: classifyPrompt(subject),
|
|
137
|
-
check: () => [],
|
|
138
|
-
tool: (take) => defineTool({
|
|
139
|
-
name: "submit_classification",
|
|
140
|
-
label: "Submit the classification",
|
|
141
|
-
description: "The four answers, each yes with its evidence.",
|
|
142
|
-
parameters: Type.Object({
|
|
143
|
-
silent_failure: Type.Object({ answer: Type.Boolean(), wrong_output: Type.Optional(Type.String({ description: "An input, and the plausible but wrong output an incorrect implementation would give." })) }),
|
|
144
|
-
divergence: Type.Object({
|
|
145
|
-
answer: Type.Boolean(),
|
|
146
|
-
input: Type.Optional(Type.String({ description: "The input two reasonable readings disagree on." })),
|
|
147
|
-
reading_a: Type.Optional(Type.String({ description: "The output under one reading." })),
|
|
148
|
-
reading_b: Type.Optional(Type.String({ description: "The output under the other." })),
|
|
149
|
-
}),
|
|
150
|
-
revisited: Type.Object({ answer: Type.Boolean(), would_change: Type.Optional(Type.String({ description: "What would change, or be built on it." })) }),
|
|
151
|
-
cost: Type.Object({ answer: Type.Boolean(), consequence: Type.Optional(Type.String({ description: "What a bug would cost, and whom." })) }),
|
|
152
|
-
}),
|
|
153
|
-
async execute(_id, params) {
|
|
154
|
-
take(params);
|
|
155
|
-
return { content: [{ type: "text", text: "Recorded." }], details: {}, terminate: true };
|
|
156
|
-
},
|
|
157
|
-
}),
|
|
158
|
-
});
|
|
159
|
-
if (answer === undefined)
|
|
160
|
-
throw new Error("the classification call gave no answer");
|
|
161
|
-
return classificationOf(answer);
|
|
162
|
-
}
|
|
163
|
-
function probesPrompt(subject, classification) {
|
|
164
|
-
return [
|
|
165
|
-
"This functional spec needs explicit testing scenarios. Pick the inputs they should cover.",
|
|
166
|
-
"",
|
|
167
|
-
...subjectBlock(subject),
|
|
168
|
-
"",
|
|
169
|
-
"<why it needs them>",
|
|
170
|
-
...classification.questions.map((answered) => `- ${answered.question}: ${answered.evidence}`),
|
|
171
|
-
"</why it needs them>",
|
|
172
|
-
"",
|
|
173
|
-
`Write the probes - as many as the functional spec has real boundaries, ${MIN_PROBES} to ${MAX_PROBES}, one when it has a single input:`,
|
|
174
|
-
"concrete inputs at the boundaries of what the functional spec says - limits, empty and missing values, duplicates,",
|
|
175
|
-
"order, the cases its wording leaves open - each one an input a black-box test can give through the interface the",
|
|
176
|
-
"functional spec names. Concrete values, never descriptions (\"a long name\").",
|
|
177
|
-
"Only inputs whose output the functional spec bears on: never a command, flag, alias or option it does not name, and",
|
|
178
|
-
"never one that exercises another functional spec of the module instead - a test of what it does not say would pin a guess.",
|
|
179
|
-
"Never pad to reach a number: an input that tests nothing new is noise in the scenarios. Do not say what the output",
|
|
180
|
-
"should be. Call submit_probes once.",
|
|
181
|
-
].join("\n");
|
|
182
|
-
}
|
|
183
|
-
/** The probes: 1-10 boundary inputs, and the divergence's input when the classification found one. */
|
|
184
|
-
async function probes(subject, classification, options) {
|
|
185
|
-
const answer = await askAdvisor({
|
|
186
|
-
cwd: options.cwd,
|
|
187
|
-
model: options.model,
|
|
188
|
-
label: `${subject.module}:${subject.funcId} test advisor probes`,
|
|
189
|
-
task: probesPrompt(subject, classification),
|
|
190
|
-
check: (given) => {
|
|
191
|
-
const inputs = given.probes.map((probe) => stringOf(probe.input)).filter((input) => input !== "");
|
|
192
|
-
return inputs.length < MIN_PROBES || inputs.length > MAX_PROBES ? [`Give ${MIN_PROBES} to ${MAX_PROBES} probes, each a concrete input; you gave ${inputs.length}.`] : [];
|
|
193
|
-
},
|
|
194
|
-
tool: (take) => defineTool({
|
|
195
|
-
name: "submit_probes",
|
|
196
|
-
label: "Submit the probes",
|
|
197
|
-
description: `${MIN_PROBES} to ${MAX_PROBES} concrete boundary inputs.`,
|
|
198
|
-
parameters: Type.Object({ probes: Type.Array(Type.Object({ input: Type.String() })) }),
|
|
199
|
-
async execute(_id, params) {
|
|
200
|
-
take(params);
|
|
201
|
-
return { content: [{ type: "text", text: "Recorded." }], details: {}, terminate: true };
|
|
202
|
-
},
|
|
203
|
-
}),
|
|
204
|
-
});
|
|
205
|
-
if (answer === undefined)
|
|
206
|
-
throw new Error("the probes call gave no probes");
|
|
207
|
-
const inputs = [];
|
|
208
|
-
const add = (input) => {
|
|
209
|
-
if (input !== "" && !inputs.some((known) => normalised(known) === normalised(input)))
|
|
210
|
-
inputs.push(input);
|
|
211
|
-
};
|
|
212
|
-
for (const probe of answer.probes)
|
|
213
|
-
add(stringOf(probe.input));
|
|
214
|
-
if (classification.divergence !== undefined)
|
|
215
|
-
add(classification.divergence.input);
|
|
216
|
-
return inputs;
|
|
217
|
-
}
|
|
218
|
-
function readerPrompt(subject, inputs) {
|
|
219
|
-
return [
|
|
220
|
-
"Predict what an implementation of this functional spec outputs for each input below.",
|
|
221
|
-
"",
|
|
222
|
-
...subjectBlock(subject),
|
|
223
|
-
"",
|
|
224
|
-
"<inputs>",
|
|
225
|
-
...inputs.map((input, index) => `${index + 1}. ${input}`),
|
|
226
|
-
"</inputs>",
|
|
227
|
-
"",
|
|
228
|
-
"For every input, by its number, give the output you expect - concrete, as a test would check it, in a line. Where",
|
|
229
|
-
"the functional spec leaves it open, give the output your reading of it leads to. Where it says nothing that bears on",
|
|
230
|
-
`the input at all - a command or an option it does not name - answer exactly ${UNSPECIFIED}. Call submit_predictions once.`,
|
|
231
|
-
].join("\n");
|
|
232
|
-
}
|
|
233
|
-
/** One reader's predictions, by probe - or nothing when it gave none that hold. */
|
|
234
|
-
async function predictions(subject, inputs, reader, options) {
|
|
235
|
-
const answer = await askAdvisor({
|
|
236
|
-
cwd: options.cwd,
|
|
237
|
-
model: options.model,
|
|
238
|
-
label: `${subject.module}:${subject.funcId} test advisor ${reader.name}`,
|
|
239
|
-
task: readerPrompt(subject, inputs),
|
|
240
|
-
system: reader.system,
|
|
241
|
-
check: (given) => {
|
|
242
|
-
const missing = inputs.flatMap((_input, index) => (given.predictions.filter((prediction) => prediction.input === index + 1 && stringOf(prediction.output) !== "").length === 1 ? [] : [index + 1]));
|
|
243
|
-
return missing.length > 0 ? [`Give exactly one output for every input; not for: ${missing.join(", ")}.`] : [];
|
|
244
|
-
},
|
|
245
|
-
tool: (take) => defineTool({
|
|
246
|
-
name: "submit_predictions",
|
|
247
|
-
label: "Submit the predictions",
|
|
248
|
-
description: "The output expected for every input, by its number.",
|
|
249
|
-
parameters: Type.Object({ predictions: Type.Array(Type.Object({ input: Type.Number(), output: Type.String() })) }),
|
|
250
|
-
async execute(_id, params) {
|
|
251
|
-
take(params);
|
|
252
|
-
return { content: [{ type: "text", text: "Recorded." }], details: {}, terminate: true };
|
|
253
|
-
},
|
|
254
|
-
}),
|
|
255
|
-
});
|
|
256
|
-
if (answer === undefined)
|
|
257
|
-
return undefined;
|
|
258
|
-
return inputs.map((_input, index) => stringOf(answer.predictions.find((prediction) => prediction.input === index + 1)?.output));
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* The inputs the readers split on - every probe where any two predictions differ once normalised: the union, never a
|
|
262
|
-
* majority - each with its distinct readings, in the order the readers gave them.
|
|
263
|
-
*/
|
|
264
|
-
export function splitInputs(readings) {
|
|
265
|
-
const split = new Map();
|
|
266
|
-
const count = readings[0]?.length ?? 0;
|
|
267
|
-
for (let index = 0; index < count; index += 1) {
|
|
268
|
-
const distinct = [];
|
|
269
|
-
for (const reader of readings) {
|
|
270
|
-
const output = reader[index] ?? "";
|
|
271
|
-
if (!distinct.some((known) => normalised(known) === normalised(output)))
|
|
272
|
-
distinct.push(output);
|
|
273
|
-
}
|
|
274
|
-
if (distinct.length > 1)
|
|
275
|
-
split.set(index, distinct);
|
|
276
|
-
}
|
|
277
|
-
return split;
|
|
278
|
-
}
|
|
279
|
-
function verifyPrompt(subject, candidates) {
|
|
280
|
-
return [
|
|
281
|
-
"Readers of this functional spec disagreed on the outputs of some inputs. For each, say which readings a reasonable",
|
|
282
|
-
"person could hold, given the functional spec, its module and the project.",
|
|
283
|
-
"",
|
|
284
|
-
...subjectBlock(subject),
|
|
285
|
-
"",
|
|
286
|
-
"<disagreements>",
|
|
287
|
-
...candidates.flatMap((candidate, index) => [`${index + 1}. input: ${candidate.input}`, ...candidate.readings.map((reading, at) => ` reading ${at + 1}: ${reading}`)]),
|
|
288
|
-
"</disagreements>",
|
|
289
|
-
"",
|
|
290
|
-
"For every disagreement, by its number, list the numbers of the readings a reasonable person could hold. Leave out a",
|
|
291
|
-
`reading only a misreading or a mistake leads to. A reading of ${UNSPECIFIED} holds when the functional spec says nothing`,
|
|
292
|
-
"that settles the input. Call submit_verification once.",
|
|
293
|
-
].join("\n");
|
|
294
|
-
}
|
|
295
|
-
/** Of each candidate, the readings a reasonable person could hold - or nothing when the call gave no answer that holds. */
|
|
296
|
-
async function verify(subject, candidates, options) {
|
|
297
|
-
const answer = await askAdvisor({
|
|
298
|
-
cwd: options.cwd,
|
|
299
|
-
model: options.model,
|
|
300
|
-
label: `${subject.module}:${subject.funcId} test advisor verifier`,
|
|
301
|
-
task: verifyPrompt(subject, candidates),
|
|
302
|
-
check: (given) => {
|
|
303
|
-
const problems = [];
|
|
304
|
-
candidates.forEach((candidate, index) => {
|
|
305
|
-
const said = given.inputs.filter((item) => item.input === index + 1);
|
|
306
|
-
if (said.length !== 1)
|
|
307
|
-
problems.push(`Say once which readings of disagreement ${index + 1} hold.`);
|
|
308
|
-
else if (said[0].reasonable.some((number) => !Number.isInteger(number) || number < 1 || number > candidate.readings.length))
|
|
309
|
-
problems.push(`Disagreement ${index + 1} has readings 1 to ${candidate.readings.length} only.`);
|
|
310
|
-
});
|
|
311
|
-
return problems;
|
|
312
|
-
},
|
|
313
|
-
tool: (take) => defineTool({
|
|
314
|
-
name: "submit_verification",
|
|
315
|
-
label: "Submit the verification",
|
|
316
|
-
description: "For every disagreement, by its number, the numbers of the readings a reasonable person could hold.",
|
|
317
|
-
parameters: Type.Object({ inputs: Type.Array(Type.Object({ input: Type.Number(), reasonable: Type.Array(Type.Number()) })) }),
|
|
318
|
-
async execute(_id, params) {
|
|
319
|
-
take(params);
|
|
320
|
-
return { content: [{ type: "text", text: "Recorded." }], details: {}, terminate: true };
|
|
321
|
-
},
|
|
322
|
-
}),
|
|
323
|
-
});
|
|
324
|
-
if (answer === undefined)
|
|
325
|
-
return undefined;
|
|
326
|
-
return candidates.map((candidate, index) => {
|
|
327
|
-
const reasonable = answer.inputs.find((item) => item.input === index + 1)?.reasonable ?? [];
|
|
328
|
-
return candidate.readings.filter((_reading, at) => reasonable.includes(at + 1));
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Pick the inputs a functional spec's scenarios should cover: the probes, the readers' predictions of them, the
|
|
333
|
-
* disagreements in code, and the verifier's word on each. An input the readers agree on comes with their output; one
|
|
334
|
-
* they split on, with every reading the verifier kept - a single reading left is an agreed one, and none left drops it.
|
|
335
|
-
*/
|
|
336
|
-
export async function pickInputs(subject, classification, options) {
|
|
337
|
-
const inputs = await probes(subject, classification, options);
|
|
338
|
-
// Two readers first; the third only when they agree on every probe - a disagreement already found is enough.
|
|
339
|
-
const first = await Promise.all(READERS.slice(0, 2).map((reader) => predictions(subject, inputs, reader, options)));
|
|
340
|
-
const readings = first.filter((reading) => reading !== undefined);
|
|
341
|
-
if (readings.length === 0 || splitInputs(readings).size === 0) {
|
|
342
|
-
for (const reader of READERS.slice(2)) {
|
|
343
|
-
const more = await predictions(subject, inputs, reader, options);
|
|
344
|
-
if (more !== undefined)
|
|
345
|
-
readings.push(more);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (readings.length === 0)
|
|
349
|
-
throw new Error("no reader predicted the probes' outputs");
|
|
350
|
-
const split = splitInputs(readings);
|
|
351
|
-
const candidates = [...split].map(([index, distinct]) => ({ index, input: inputs[index], readings: distinct }));
|
|
352
|
-
// Without the verifier's word, every reading stands: a split left unsettled is the chat's to settle as it writes.
|
|
353
|
-
const kept = candidates.length > 0 ? ((await verify(subject, candidates, options)) ?? candidates.map((candidate) => candidate.readings)) : [];
|
|
354
|
-
const out = [];
|
|
355
|
-
inputs.forEach((input, index) => {
|
|
356
|
-
const at = candidates.findIndex((candidate) => candidate.index === index);
|
|
357
|
-
// An input the functional spec does not settle is left out: a scenario on it would pin a guess.
|
|
358
|
-
if (at === -1) {
|
|
359
|
-
if (normalised(readings[0][index]) !== UNSPECIFIED)
|
|
360
|
-
out.push({ input, agreed: readings[0][index] });
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
const held = kept[at] ?? [];
|
|
364
|
-
if (held.some((reading) => normalised(reading) === UNSPECIFIED))
|
|
365
|
-
return;
|
|
366
|
-
if (held.length > 1)
|
|
367
|
-
out.push({ input, readings: held });
|
|
368
|
-
else if (held.length === 1)
|
|
369
|
-
out.push({ input, agreed: held[0] });
|
|
370
|
-
});
|
|
371
|
-
return out;
|
|
372
|
-
}
|
|
373
|
-
/** The whole judgement: classify, and on a yes pick the inputs. Throws when a call that cannot be done without fails. */
|
|
374
|
-
export async function advise(subject, options) {
|
|
375
|
-
const classification = await classify(subject, options);
|
|
376
|
-
if (classification.verdict === "no")
|
|
377
|
-
return { verdict: "no", questions: classification.questions, inputs: [] };
|
|
378
|
-
return { verdict: "yes", questions: classification.questions, inputs: await pickInputs(subject, classification, options) };
|
|
379
|
-
}
|
package/dist/spec-tools.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { type WorkLoop } from "./regenerate/loop.ts";
|
|
3
|
-
import { type LiveReviewer } from "./tools.ts";
|
|
4
|
-
/** Whether a question has been answered since the last new spec change was written. */
|
|
5
|
-
export interface SpecPace {
|
|
6
|
-
/** A question was answered; `owesChange` false for one no change comes from - a phase's confirmation, a dismissal. */
|
|
7
|
-
answered(owesChange?: boolean): void;
|
|
8
|
-
/** Whether an answer has come since the last change, and is not written yet. */
|
|
9
|
-
owed(): boolean;
|
|
10
|
-
}
|
|
11
|
-
type AnyTool = ToolDefinition<any, any, any>;
|
|
12
|
-
/**
|
|
13
|
-
* Writing a spec change as a diff, and building it, as one step.
|
|
14
|
-
*
|
|
15
|
-
* In an interview whose unit of work is a spec change, every change is meant to be built the
|
|
16
|
-
* moment it is written. Left to two tool calls - change the file, then start the render - the
|
|
17
|
-
* second is the one that gets forgotten, and nothing notices. So the diff is applied and its
|
|
18
|
-
* build queued in the same call: a change cannot reach the specs without its render being
|
|
19
|
-
* started. A new change needs an answer since the last one; a correction does not.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createSpecDiffTools(options: {
|
|
22
|
-
loop: WorkLoop;
|
|
23
|
-
cwd: string;
|
|
24
|
-
liveReview?: LiveReviewer;
|
|
25
|
-
/** One new change per answer (the default); false, for a skill that writes the specs on its own. */
|
|
26
|
-
paced?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Whether the phase the interview is in lets a change come without an answer before it: one where each answer owes a
|
|
29
|
-
* change instead (`owed`, refused a next question until it is written), and the agent writes what it decides itself.
|
|
30
|
-
*/
|
|
31
|
-
free?: () => boolean;
|
|
32
|
-
}): {
|
|
33
|
-
tools: AnyTool[];
|
|
34
|
-
pace: SpecPace;
|
|
35
|
-
};
|
|
36
|
-
export {};
|
package/dist/spec-tools.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { Type } from "typebox";
|
|
4
|
-
import { advisingNote } from "./advisor-chat.js";
|
|
5
|
-
import { checkTouchedPlain, formatCheckResults } from "./plain/check.js";
|
|
6
|
-
import { applySpecDiff, plainFilesOf, revertSpecDiff } from "./regenerate/regenerate.js";
|
|
7
|
-
import { refuseTestPlainFile } from "./test-plain-files.js";
|
|
8
|
-
import { describeModules } from "./regenerate/loop.js";
|
|
9
|
-
import { reviewNote } from "./tools.js";
|
|
10
|
-
import { STACK_PARAM, stacklessBuild, withCallStack } from "./loop-tools.js";
|
|
11
|
-
import { stackNamed } from "./config.js";
|
|
12
|
-
import { projectDirOf } from "./regenerate/paths.js";
|
|
13
|
-
/**
|
|
14
|
-
* Writing a spec change as a diff, and building it, as one step.
|
|
15
|
-
*
|
|
16
|
-
* In an interview whose unit of work is a spec change, every change is meant to be built the
|
|
17
|
-
* moment it is written. Left to two tool calls - change the file, then start the render - the
|
|
18
|
-
* second is the one that gets forgotten, and nothing notices. So the diff is applied and its
|
|
19
|
-
* build queued in the same call: a change cannot reach the specs without its render being
|
|
20
|
-
* started. A new change needs an answer since the last one; a correction does not.
|
|
21
|
-
*/
|
|
22
|
-
export function createSpecDiffTools(options) {
|
|
23
|
-
const { loop, cwd, liveReview } = options;
|
|
24
|
-
const skillPaced = options.paced !== false;
|
|
25
|
-
const isPaced = () => skillPaced && options.free?.() !== true;
|
|
26
|
-
/** An answer has come since the last change: it is owed one. */
|
|
27
|
-
let owed = false;
|
|
28
|
-
let answeredSinceLastDiff = true;
|
|
29
|
-
const writeDiff = defineTool({
|
|
30
|
-
name: "change_plain",
|
|
31
|
-
label: "Write spec diff",
|
|
32
|
-
description: "Apply a change to the ***plain specs, given as a git diff of the .plain files, and start building it in " +
|
|
33
|
-
"the background. The diff is applied with git; if the specs no longer parse, it is undone and nothing is " +
|
|
34
|
-
"built. Any section may change - definitions, implementation reqs, functional specs, added, changed or removed - and " +
|
|
35
|
-
"every change is built, whatever it touches. A diff may touch test plain files too - tests/<module>/<func-id>.plain, " +
|
|
36
|
-
"a functional spec's conformance and acceptance scenarios. A functional spec with none has no test plain file: " +
|
|
37
|
-
"write one only to give it scenarios.",
|
|
38
|
-
promptSnippet: "apply a git diff of the .plain specs and start building it",
|
|
39
|
-
promptGuidelines: [
|
|
40
|
-
"Every change to a .plain file in the product phase goes through change_plain, as a git diff with paths relative to the project root. It writes the change and starts its build in one step.",
|
|
41
|
-
"A functional spec is a `# <func-id>` heading and its text. One with scenarios has a test plain file, tests/<module>/<func-id>.plain: its `module:` and `func_id:`, then `***conformance tests***` and `***acceptance tests***`, each scenario a `# <scenario-id>` heading and its text - a section only when it has a scenario, an empty one being a syntax error. One with no scenarios has no test plain file. plain_file stays the module's .plain file when the diff touches only its test plain files.",
|
|
42
|
-
skillPaced
|
|
43
|
-
? "One change per answer, and a new one only after the user has answered a question about it. Set fixes_earlier to correct something already written."
|
|
44
|
-
: "Write the changes one after another, on your own: no answer is needed between them, and none is asked for. Set fixes_earlier to correct something already written.",
|
|
45
|
-
"In a project of stacks, the change is built with the stack named after the module - backend.plain with config.turri.backend.yaml - by itself. For a module whose stack has another name, pass it as stack. A change that cannot be built yet for want of a stack is written all the same: carry on, and pass the stack with the next change.",
|
|
46
|
-
"To take something out of what is already written and queued - the user drops a page or a feature - write the diff that removes it from every spec that names it, with fixes_earlier. What is left to build is worked out from the spec each time, and a build the change undoes is stopped by itself; never stop builds to drop a change - it stays in the files.",
|
|
47
|
-
],
|
|
48
|
-
parameters: Type.Object({
|
|
49
|
-
plain_file: Type.String({ description: "The .plain file of the module the change is built for" }),
|
|
50
|
-
diff: Type.String({ description: "The change, as a git diff (diff --git a/<file> b/<file> ...)" }),
|
|
51
|
-
fixes_earlier: Type.Optional(Type.Boolean({ description: "This corrects something already written - a contradiction, a review finding" })),
|
|
52
|
-
stack: STACK_PARAM,
|
|
53
|
-
guidance: Type.Optional(Type.String({
|
|
54
|
-
description: "How to plan the queue for this change, in a sentence or two - which functional specs go together, what first - as the " +
|
|
55
|
-
"user said it or as the interview settled it. A strong preference for the planner. Omit when there is none.",
|
|
56
|
-
})),
|
|
57
|
-
}),
|
|
58
|
-
async execute(_id, params) {
|
|
59
|
-
const paced = isPaced();
|
|
60
|
-
if (paced && params.fixes_earlier !== true && !answeredSinceLastDiff) {
|
|
61
|
-
throw new Error("No question has been answered since the last spec change. Each change comes from its own answer: ask " +
|
|
62
|
-
"the user with ask_user first. To correct something already written, set fixes_earlier.");
|
|
63
|
-
}
|
|
64
|
-
const touched = plainFilesOf(params.diff);
|
|
65
|
-
if (touched.length === 0)
|
|
66
|
-
throw new Error("The diff changes no .plain file. Nothing was written.");
|
|
67
|
-
refuseTestPlainFile(resolve(cwd, params.plain_file));
|
|
68
|
-
const result = applySpecDiff(params.diff, cwd);
|
|
69
|
-
// A change that breaks a spec is not written at all, so nothing is ever built from a file that cannot be parsed:
|
|
70
|
-
// each module it touched is parsed with its test plain files - an import module as the modules that import it
|
|
71
|
-
// read it, a test plain file as its module - as parse reads them. A module with no functional specs yet is
|
|
72
|
-
// not broken.
|
|
73
|
-
const failed = checkTouchedPlain([params.plain_file, ...touched].map((file) => resolve(cwd, file))).filter((check) => !check.ok);
|
|
74
|
-
if (failed.length > 0) {
|
|
75
|
-
if (result === "applied")
|
|
76
|
-
revertSpecDiff(params.diff, cwd);
|
|
77
|
-
throw new Error(`Nothing was written: with this change the ***plain no longer checks.\n${formatCheckResults(failed)}`);
|
|
78
|
-
}
|
|
79
|
-
if (params.fixes_earlier !== true)
|
|
80
|
-
answeredSinceLastDiff = false;
|
|
81
|
-
owed = false;
|
|
82
|
-
liveReview?.notice(`${params.plain_file}, after the change to ${touched.join(", ")}`);
|
|
83
|
-
// In the files, the change is work: the loop works out what is left to build and plans it - with the stack the call
|
|
84
|
-
// names, else the module's own. A spec change, not a request: a module the person halted stays halted. The change
|
|
85
|
-
// is written whatever the stack: one that cannot be built yet is said, and built once it can - nothing is lost.
|
|
86
|
-
const building = resolve(cwd, params.plain_file);
|
|
87
|
-
let stackless;
|
|
88
|
-
try {
|
|
89
|
-
stackless = params.stack === undefined ? stacklessBuild(building) : (stackNamed(projectDirOf(building), params.stack), undefined);
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
stackless = error instanceof Error ? error.message : String(error);
|
|
93
|
-
}
|
|
94
|
-
const statuses = stackless === undefined
|
|
95
|
-
? await withCallStack(building, params.stack, () => loop.bringUp(params.plain_file, { specChange: true, ...(params.guidance !== undefined ? { guidance: params.guidance } : {}) }))
|
|
96
|
-
: [];
|
|
97
|
-
const lines = [
|
|
98
|
-
result === "applied" ? `Applied the change to ${touched.join(", ")}.` : `The change to ${touched.join(", ")} was already applied.`,
|
|
99
|
-
stackless === undefined
|
|
100
|
-
? `Building in the background:\n${describeModules(statuses)}\n`
|
|
101
|
-
: `Not built yet - ${stackless} The change is in the spec: pass stack with the next change, or call regenerate with it, and everything written so far is built.\n`,
|
|
102
|
-
// An interview goes back to its questions; a skill that writes on its own, straight to its next change - a stop to ask ends it.
|
|
103
|
-
paced
|
|
104
|
-
? "Carry on with the interview."
|
|
105
|
-
: skillPaced
|
|
106
|
-
? "Carry on: write the next change you decided yourself, or ask the next question - every answer is written as a change before the question after it."
|
|
107
|
-
: "Write the next change now, without stopping to ask: this skill goes on until everything it is to write is written.",
|
|
108
|
-
];
|
|
109
|
-
// The functional specs the test advisor took up, for the agent to say so rather than offer their scenarios.
|
|
110
|
-
const advising = advisingNote(loop, building);
|
|
111
|
-
return {
|
|
112
|
-
content: [{ type: "text", text: lines.join(" ") + reviewNote(liveReview) + (advising !== "" ? `\n\n${advising}` : "") }],
|
|
113
|
-
details: { jobIds: statuses.flatMap((status) => (status.running !== undefined ? [status.running.jobId] : [])), files: touched },
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
return {
|
|
118
|
-
tools: [writeDiff],
|
|
119
|
-
pace: {
|
|
120
|
-
answered(owesChange = true) {
|
|
121
|
-
answeredSinceLastDiff = true;
|
|
122
|
-
if (owesChange)
|
|
123
|
-
owed = true;
|
|
124
|
-
},
|
|
125
|
-
owed: () => owed,
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
}
|