@turri-dev/cli 0.1.8-next.91b957c → 0.1.8-next.a9bda1b
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.
|
@@ -79,11 +79,6 @@ export declare function stepsOf(input: PlanInput, draft: DraftJob[]): Array<Draf
|
|
|
79
79
|
step: SpecStep;
|
|
80
80
|
}>;
|
|
81
81
|
export declare const MAX_SPECS_PER_JOB = 3;
|
|
82
|
-
/** The most a pulse's title is - in words, and in characters - however it was made: a host shows it as its heading. */
|
|
83
|
-
export declare const TITLE_WORDS = 10;
|
|
84
|
-
export declare const TITLE_CHARS = 70;
|
|
85
|
-
/** A title held to `TITLE_WORDS` and `TITLE_CHARS` - or less, for room beside it - cut at a word, with an ellipsis. */
|
|
86
|
-
export declare function shortTitle(text: string, chars?: number, words?: number): string;
|
|
87
82
|
export declare const MAX_LINES_PER_JOB = 120;
|
|
88
83
|
/**
|
|
89
84
|
* A functional spec to build, for the grouping: the number the agent answers with, its text, and whether it is built
|
|
@@ -71,19 +71,6 @@ export function stepsOf(input, draft) {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
export const MAX_SPECS_PER_JOB = 3;
|
|
74
|
-
/** The most a pulse's title is - in words, and in characters - however it was made: a host shows it as its heading. */
|
|
75
|
-
export const TITLE_WORDS = 10;
|
|
76
|
-
export const TITLE_CHARS = 70;
|
|
77
|
-
/** A title held to `TITLE_WORDS` and `TITLE_CHARS` - or less, for room beside it - cut at a word, with an ellipsis. */
|
|
78
|
-
export function shortTitle(text, chars = TITLE_CHARS, words = TITLE_WORDS) {
|
|
79
|
-
const all = text.trim().split(/\s+/).filter((word) => word !== "");
|
|
80
|
-
let cut = all.slice(0, words).join(" ");
|
|
81
|
-
if (all.length <= words && cut.length <= chars)
|
|
82
|
-
return cut;
|
|
83
|
-
if (cut.length > chars - 1)
|
|
84
|
-
cut = cut.slice(0, chars - 1).replace(/\s+\S*$/, "") || cut.slice(0, chars - 1);
|
|
85
|
-
return `${cut.replace(/[\s,.;:-]+$/, "")}…`;
|
|
86
|
-
}
|
|
87
74
|
export const MAX_LINES_PER_JOB = 120;
|
|
88
75
|
/** How often an answer that does not hold goes back to its agent before the plan falls back. */
|
|
89
76
|
const RETRIES = 2;
|
|
@@ -137,9 +124,6 @@ export function groupProblems(specs, answer, maxSpecs = MAX_SPECS_PER_JOB) {
|
|
|
137
124
|
}
|
|
138
125
|
if (group.title.trim() === "")
|
|
139
126
|
problems.push("Every group needs a title.");
|
|
140
|
-
else if (group.title.trim().split(/\s+/).length > TITLE_WORDS || group.title.trim().length > TITLE_CHARS) {
|
|
141
|
-
problems.push(`"${group.title}" is too long for a title: at most ${TITLE_WORDS} words and ${TITLE_CHARS} characters.`);
|
|
142
|
-
}
|
|
143
127
|
}
|
|
144
128
|
return problems;
|
|
145
129
|
}
|
|
@@ -243,8 +227,7 @@ function draftOf(chunks, net) {
|
|
|
243
227
|
})
|
|
244
228
|
.filter((entry) => entry.changes.length > 0)
|
|
245
229
|
.map((entry) => ({
|
|
246
|
-
|
|
247
|
-
title: shortTitle(entry.chunk.title),
|
|
230
|
+
title: entry.chunk.title,
|
|
248
231
|
reason: entry.chunk.built !== undefined
|
|
249
232
|
? "what is built already, changed"
|
|
250
233
|
: entry.chunk.specs.length > 0 && entry.chunk.specs.every(regeneratesAgain)
|
|
@@ -255,7 +238,7 @@ function draftOf(chunks, net) {
|
|
|
255
238
|
}
|
|
256
239
|
/** A spec's first line, as a group's title when no agent gave one. */
|
|
257
240
|
function titleOf(change) {
|
|
258
|
-
return
|
|
241
|
+
return textOf(change).split("\n")[0].replace(/^-\s*/, "").slice(0, 80);
|
|
259
242
|
}
|
|
260
243
|
/**
|
|
261
244
|
* Cut the queue's work - from `input.base` to `input.current` - into jobs, as the three steps say. Returns the draft
|
|
@@ -487,10 +470,7 @@ async function cut(input, agents, notes) {
|
|
|
487
470
|
}
|
|
488
471
|
runs.push(run);
|
|
489
472
|
say(`"${group.title}" is past ${maxLines} lines with its definitions and reqs - split into ${runs.length} pulses`);
|
|
490
|
-
runs.forEach((specs, index) => split.push({
|
|
491
|
-
specs,
|
|
492
|
-
title: specs.length === 1 ? titleOf(bySpec.get(specs[0])) : `${shortTitle(group.title, TITLE_CHARS - 9, TITLE_WORDS - 3)} (${index + 1} of ${runs.length})`,
|
|
493
|
-
}));
|
|
473
|
+
runs.forEach((specs, index) => split.push({ specs, title: specs.length === 1 ? titleOf(bySpec.get(specs[0])) : `${group.title} (${index + 1} of ${runs.length})` }));
|
|
494
474
|
});
|
|
495
475
|
const before = placement;
|
|
496
476
|
// A req placed with a group that split goes with the first functional spec of it.
|
|
@@ -540,8 +520,7 @@ export function groupPrompt(specs, steering, maxSpecs = MAX_SPECS_PER_JOB) {
|
|
|
540
520
|
"Never group specs only because they are of the same kind.",
|
|
541
521
|
"",
|
|
542
522
|
"Only functional specs next to each other in the same module go together, and they stay in the order given: the",
|
|
543
|
-
|
|
544
|
-
"characters: it heads the group's pulse where the person watches the work, and a longer one is cut short there.",
|
|
523
|
+
"order is what each is built on. Give each group a short title that says what it builds.",
|
|
545
524
|
"",
|
|
546
525
|
"The specification is split into modules - a ***plain matter, not how the code is laid out. Each numbers its",
|
|
547
526
|
"functional specs from 1: each below is given with its module and its id there, and a number of its own to answer with.",
|
|
@@ -621,9 +600,9 @@ export function llmChunkAgents(options) {
|
|
|
621
600
|
tool: (take) => defineTool({
|
|
622
601
|
name: "submit_groups",
|
|
623
602
|
label: "Submit the groups",
|
|
624
|
-
description:
|
|
603
|
+
description: "The new functional specs in groups, in order: each group's spec numbers and a short title.",
|
|
625
604
|
parameters: Type.Object({
|
|
626
|
-
groups: Type.Array(Type.Object({ specs: Type.Array(Type.Number()), title: Type.String(
|
|
605
|
+
groups: Type.Array(Type.Object({ specs: Type.Array(Type.Number()), title: Type.String() })),
|
|
627
606
|
notes: Type.Optional(Type.String({ description: NOTES })),
|
|
628
607
|
}),
|
|
629
608
|
async execute(_id, params) {
|