@yagni-app/code-staging 1.2.14-staging.2349.1 → 1.2.14-staging.2353.1
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.
|
@@ -143,9 +143,27 @@ export interface TurnFacts {
|
|
|
143
143
|
preview?: boolean;
|
|
144
144
|
/** Who writes the change, as the host said (`codeWriter.ts`); absent, the session. */
|
|
145
145
|
codeWriter?: CodeWriter;
|
|
146
|
+
/**
|
|
147
|
+
* `conversation-put-back.md`, as the host wrote it: the conversation was put
|
|
148
|
+
* back on a new machine before this turn, and what that machine lacks.
|
|
149
|
+
*/
|
|
150
|
+
conversationPutBack?: string | null;
|
|
151
|
+
/**
|
|
152
|
+
* The input folder has `own-plans.md`: this yak approves its own plans, so
|
|
153
|
+
* no person answers the plan's questions. Only ever on a plan turn.
|
|
154
|
+
*/
|
|
155
|
+
ownPlans?: boolean;
|
|
146
156
|
}
|
|
157
|
+
/** The file the host writes when a yak approves its own plans (`attempts/inputs.ts`, `yaks/ownPlans.ts`). */
|
|
158
|
+
export declare const OWN_PLANS_FILE_NAME = "own-plans.md";
|
|
147
159
|
/** The file the host writes a person's note for the next step to (`attempts/inputs.ts`). */
|
|
148
160
|
export declare const NEXT_STEP_NOTE_FILE_NAME = "next-step-note.md";
|
|
161
|
+
/**
|
|
162
|
+
* The file the host writes when it put the conversation back on a new
|
|
163
|
+
* machine before this turn (`attempts/conversationPutBack.ts`): what is gone
|
|
164
|
+
* from the machine. Only on the turn it was put back for.
|
|
165
|
+
*/
|
|
166
|
+
export declare const CONVERSATION_PUT_BACK_FILE_NAME = "conversation-put-back.md";
|
|
149
167
|
/** The file the host writes a yak's new messages to (`attempts/inputs.ts`, `yaks/turns.ts`). */
|
|
150
168
|
export declare const NEW_SINCE_LAST_TURN_FILE_NAME = "new-since-last-turn.md";
|
|
151
169
|
/** The file the host names a yak's System's other repositories in (`attempts/inputs.ts`, YAG-1211). */
|
|
@@ -177,8 +177,16 @@ function feedStage(stage) {
|
|
|
177
177
|
return "fix";
|
|
178
178
|
return "implement";
|
|
179
179
|
}
|
|
180
|
+
/** The file the host writes when a yak approves its own plans (`attempts/inputs.ts`, `yaks/ownPlans.ts`). */
|
|
181
|
+
export const OWN_PLANS_FILE_NAME = "own-plans.md";
|
|
180
182
|
/** The file the host writes a person's note for the next step to (`attempts/inputs.ts`). */
|
|
181
183
|
export const NEXT_STEP_NOTE_FILE_NAME = "next-step-note.md";
|
|
184
|
+
/**
|
|
185
|
+
* The file the host writes when it put the conversation back on a new
|
|
186
|
+
* machine before this turn (`attempts/conversationPutBack.ts`): what is gone
|
|
187
|
+
* from the machine. Only on the turn it was put back for.
|
|
188
|
+
*/
|
|
189
|
+
export const CONVERSATION_PUT_BACK_FILE_NAME = "conversation-put-back.md";
|
|
182
190
|
/** The file the host writes a yak's new messages to (`attempts/inputs.ts`, `yaks/turns.ts`). */
|
|
183
191
|
export const NEW_SINCE_LAST_TURN_FILE_NAME = "new-since-last-turn.md";
|
|
184
192
|
/** The file the host names a yak's System's other repositories in (`attempts/inputs.ts`, YAG-1211). */
|
|
@@ -220,8 +228,10 @@ const REPORT_CONTRACT = (outDir) => `Last, write ${join(outDir, SESSION_REPORT_F
|
|
|
220
228
|
'"planChanges": [{"step": <the step\'s number in plan.md, or null for the plan as a whole>, ' +
|
|
221
229
|
'"instead": "<what you did instead>", "why": "<why>"}]}. ' +
|
|
222
230
|
"List every check you ran on the final tree with its real exit code; a check you did not run is " +
|
|
223
|
-
'not a pass, and goes in "notVerified". "baseline" is "fails_on_base" only when the check
|
|
224
|
-
|
|
231
|
+
'not a pass, and goes in "notVerified". "baseline" is "fails_on_base" only when the check failed on ' +
|
|
232
|
+
"the unchanged code in a run this attempt made, yours or one checks.json's baseMeasured names; a " +
|
|
233
|
+
'record alone never makes it so. A check may carry "note": the new test that proves a behavior ' +
|
|
234
|
+
'change says there what it showed failing without the change. "planChanges" lists only a step you did differently than plan.md ' +
|
|
225
235
|
"says, or left out, never a choice the plan left to you. Then end your turn.";
|
|
226
236
|
/** The build rule that says who writes the change: the host's value, in words. */
|
|
227
237
|
const WRITER_RULE = (who) => who.writer === "helper"
|
|
@@ -235,9 +245,11 @@ const PULL_REQUEST_CONTRACT = (outDir) => `Before the report, write ${join(outDi
|
|
|
235
245
|
"environment: everyone on the repository reads it. Write no title, checks table or plan version: YAGNI adds those.";
|
|
236
246
|
const BUILD_RULES = (outDir, who) => [
|
|
237
247
|
"Write tools are on now. Work as your playbook says:",
|
|
238
|
-
"- Prefer the smallest change that meets the ticket.",
|
|
248
|
+
"- Prefer the smallest change that meets the ticket, and keep the diff to what the ticket needs.",
|
|
239
249
|
WRITER_RULE(who),
|
|
240
|
-
"-
|
|
250
|
+
"- Read the repository's CI workflows (.github/workflows, or the CI it uses) and run every check there your diff can trip, beside checks.json and the plan's checks; fix what your change breaks.",
|
|
251
|
+
"- Each behavior change gets a test. Run it once without the change and see it fail, then with it; in the report, that test's check says in its note what failed without the change.",
|
|
252
|
+
"- A check checks.json marks measureOnBase, or one you would call fails_on_base, is measured on the unchanged code during this attempt: before your first edit, or in a git worktree at the commit this branch started from. A red in the repository's record is not a measurement, however recent; a baseMeasured entry in checks.json is.",
|
|
241
253
|
"- Before you finish, dispatch a fresh verification subagent on your diff with the ticket and the plan, and fix what it finds that is real.",
|
|
242
254
|
"- Commit on the branch you are on. Never push and never open or edit a pull request: YAGNI pushes your commits and opens it.",
|
|
243
255
|
`- ${PULL_REQUEST_CONTRACT(outDir)}`,
|
|
@@ -260,13 +272,16 @@ const PLAN_TOOLS = "read, grep, find, ls, bash, ask_yagni, team_read, prototype_
|
|
|
260
272
|
* folder) the turn also draws the plan's UI preview: it gets write and edit
|
|
261
273
|
* for the preview's files, and the rule that says when to draw one.
|
|
262
274
|
*/
|
|
263
|
-
const planRules = (preview) => [
|
|
275
|
+
const planRules = (preview, ownPlans) => [
|
|
264
276
|
preview
|
|
265
277
|
? `This turn you have ${PLAN_TOOLS}, and write and edit for the UI preview's files in ${preview.outDir} only: never for a file in the repository.`
|
|
266
278
|
: `This turn you have ${PLAN_TOOLS}, and no edit or write tool.`,
|
|
267
279
|
...PLAN_RULES_BEFORE_PREVIEW,
|
|
268
280
|
...(preview ? [previewRule(preview.inputDir, preview.outDir)] : []),
|
|
269
|
-
|
|
281
|
+
`${PLAN_FORMAT_RULE} ${ownPlans ? DECIDE_RULE : QUESTION_RULE}`,
|
|
282
|
+
PLAN_CLOSE_RULE,
|
|
283
|
+
PLAN_JSON_CONTRACT,
|
|
284
|
+
ownPlans ? OWN_PLANS_STOP : PLAN_STOP,
|
|
270
285
|
].join("\n\n");
|
|
271
286
|
/** When a plan turn draws the plan's UI preview, and what it writes when the plan has nothing to show. */
|
|
272
287
|
const previewRule = (inputDir, outDir) => `A person reads this plan beside its UI preview, and you draw it: read ${join(inputDir, UI_PREVIEW_BRIEF_FILE_NAME)} before you plan. ` +
|
|
@@ -281,14 +296,25 @@ const previewReask = (inputDir, outDir, problems) => `The plan has no UI preview
|
|
|
281
296
|
const PLAN_RULES_BEFORE_PREVIEW = [
|
|
282
297
|
"Run whatever settles a fact: the tests, a type check, the app, Docker, a query. Change no tracked file and commit nothing: anything this turn changes in the repository is put back before the plan's gate.",
|
|
283
298
|
`Call team_read with tool "${DECISIONS_READ_TOOL}" before you ask a person anything: a question an earlier decision on this repository already answers is not a question.`,
|
|
284
|
-
"Check the ticket before you plan on it: each premise it states that the plan relies on, against the code, the git history or the data.",
|
|
285
|
-
];
|
|
286
|
-
const PLAN_RULES_AFTER_PREVIEW = [
|
|
287
|
-
"End the turn with the plan as your last message. Open it with ## Ticket check: a table of premise | checked, or not checkable | the command, file:line or query that shows it, one row per premise. Then ## Done when: the ticket's acceptance criteria, or yours when it has none, one line each. Then ## Goal (one sentence), ## Plan (numbered steps, each naming the file or function), ## Files to modify / create (say \"new\" beside a file the plan creates), ## Checks and ## Risks, then the plan-json block. Where there is a real choice of approach, ask it as a decision question with your recommendation and its alternatives; the plan's steps follow your recommendation.",
|
|
288
|
-
'When the ticket check shows the problem is already gone, recommend closing the ticket instead of planning a change: ## Goal says so in one sentence, the ticket check holds the evidence, ## Plan says "Nothing to build." with no numbered steps, and the plan-json block carries "closeTicket" with the evidence and names no checks and no paths. A person then decides whether to close it.',
|
|
289
|
-
PLAN_JSON_CONTRACT,
|
|
290
|
-
"Then stop: a fresh reviewer reads the plan next, and its major findings come back to you in this session to revise. A person approves the plan before anything is built.",
|
|
299
|
+
"Check the ticket before you plan on it: each premise it states that the plan relies on, against the code, the git history or the data. Read each one yourself, in this session: a searcher subagent's summary only says where to look.",
|
|
291
300
|
];
|
|
301
|
+
const PLAN_FORMAT_RULE = 'End the turn with the plan as your last message. Open it with ## Ticket check: a table of premise | checked, or not checkable | the command, file:line or query that shows it, one row per premise. Then ## Done when: the ticket\'s acceptance criteria, or yours when it has none, one line each. Then ## Goal (one sentence), ## Plan (numbered steps, each naming the file or function), ## Files to modify / create (say "new" beside a file the plan creates), ## Checks and ## Risks, then the plan-json block.';
|
|
302
|
+
/** Where a person answers the plan: a real choice is theirs to make. */
|
|
303
|
+
const QUESTION_RULE = "Where there is a real choice of approach, ask it as a decision question with your recommendation and its alternatives; the plan's steps follow your recommendation.";
|
|
304
|
+
/**
|
|
305
|
+
* Where the yak approves its own plans (`own-plans.md`): YAGNI takes every
|
|
306
|
+
* recommendation, so a question only records a change of direction.
|
|
307
|
+
*/
|
|
308
|
+
const DECIDE_RULE = "This yak approves its own plans: no person answers this plan's questions, and YAGNI takes your recommendation on each one. So where there is a real choice of approach, decide on your recommendation: the plan's steps follow it, and ## Risks states it as the assumption you plan on, with what would change it. Put a question in the plan-json block only for a change of direction, with the evidence (file:line, command or query) in its checked lines: the ticket's premise is false, or the right change is far larger than the ticket.";
|
|
309
|
+
const PLAN_CLOSE_RULE = 'When the ticket check shows the problem is already gone, recommend closing the ticket instead of planning a change: ## Goal says so in one sentence, the ticket check holds the evidence, ## Plan says "Nothing to build." with no numbered steps, and the plan-json block carries "closeTicket" with the evidence and names no checks and no paths. A person then decides whether to close it.';
|
|
310
|
+
const PLAN_STOP = "Then stop: a fresh reviewer reads the plan next, and its major findings come back to you in this session to revise. A person approves the plan before anything is built.";
|
|
311
|
+
const OWN_PLANS_STOP = "Then stop: a fresh reviewer reads the plan next, and its major findings come back to you in this session to revise. Once it finds nothing major, YAGNI approves the plan for this yak and the build starts.";
|
|
312
|
+
/**
|
|
313
|
+
* How a turn treats a review's items. The host acknowledges each thread at
|
|
314
|
+
* take and posts the outcomes after its push (`attempts/review.ts`), with the
|
|
315
|
+
* marker Proctor reads, so a reply of the session's own is noise or worse.
|
|
316
|
+
*/
|
|
317
|
+
const FIX_RULE = "For each item: check it against the pull request on GitHub as it is now (read it with gh, and only read), then fix it, with a test that fails without the fix where it changes behavior, or dispute it with evidence a reviewer can check. Never reply, comment, react or resolve on GitHub: YAGNI posts your outcomes on each thread after it pushes your commit.";
|
|
292
318
|
/** The one message a turn sends the session. Pure. */
|
|
293
319
|
export function turnMessage(facts) {
|
|
294
320
|
const at = (file) => join(facts.inputDir, file);
|
|
@@ -297,6 +323,11 @@ export function turnMessage(facts) {
|
|
|
297
323
|
// your last turn" and carries each message fenced, so the session hears
|
|
298
324
|
// them in this turn's message, ahead of the rules it ends on.
|
|
299
325
|
const newSince = facts.newSinceLastTurn?.trim();
|
|
326
|
+
// The host's file opens with "# This machine is new": said first, before
|
|
327
|
+
// anything the turn reads or runs on the machine.
|
|
328
|
+
const putBack = facts.resumed ? facts.conversationPutBack?.trim() : undefined;
|
|
329
|
+
if (putBack)
|
|
330
|
+
parts.push(putBack);
|
|
300
331
|
if (facts.stage === "plan") {
|
|
301
332
|
if (facts.resumed && facts.sentBack) {
|
|
302
333
|
parts.push(`A person sent your plan back. What they asked is in ${at("ticket.md")}, and the plan they sent back is ${at("sent-back-plan.md")}. Plan again: keep what they did not ask to change. ${PLANNED_ANYWAY}`);
|
|
@@ -305,14 +336,14 @@ export function turnMessage(facts) {
|
|
|
305
336
|
parts.push(`Plan this ticket again from ${at("ticket.md")}.`);
|
|
306
337
|
}
|
|
307
338
|
else {
|
|
308
|
-
parts.push("This is the plan turn of a YAGNI attempt. Work the ticket as your playbook says, up to the plan: nothing is built until
|
|
339
|
+
parts.push("This is the plan turn of a YAGNI attempt. Work the ticket as your playbook says, up to the plan: nothing is built until the plan is approved.", INPUTS(facts.inputDir));
|
|
309
340
|
if (facts.sentBack) {
|
|
310
341
|
parts.push(`A person sent an earlier plan back: what they asked is in ${at("ticket.md")}, and that plan is ${at("sent-back-plan.md")}. ${PLANNED_ANYWAY}`);
|
|
311
342
|
}
|
|
312
343
|
}
|
|
313
344
|
if (newSince)
|
|
314
345
|
parts.push(newSince);
|
|
315
|
-
parts.push(planRules(facts.preview ? { inputDir: facts.inputDir, outDir: facts.outDir } : undefined));
|
|
346
|
+
parts.push(planRules(facts.preview ? { inputDir: facts.inputDir, outDir: facts.outDir } : undefined, facts.ownPlans === true));
|
|
316
347
|
return parts.join("\n\n");
|
|
317
348
|
}
|
|
318
349
|
if (facts.stage === "implement" && facts.resumed && !facts.continuation) {
|
|
@@ -321,7 +352,7 @@ export function turnMessage(facts) {
|
|
|
321
352
|
parts.push(`The person approved the plan. The plan as approved is ${at("plan.md")}: their answers are already in it, under Decisions and Not doing, and it supersedes the draft you wrote earlier in this session. Build that plan. Leave out everything under Not doing. ${PLAN_CHANGES_RULE}`);
|
|
322
353
|
}
|
|
323
354
|
else if (facts.stage === "fix" && facts.review) {
|
|
324
|
-
parts.push(`A review or the CI on this attempt's pull request asks for changes. They are in ${at("ticket.md")}, under "Review on this attempt's pull request", each with its id; the branch may hold a person's commits since your last turn, so read the code as it is now. Address every item with the smallest change that does it, write the outcomes file that section names, and commit
|
|
355
|
+
parts.push(`A review or the CI on this attempt's pull request asks for changes. They are in ${at("ticket.md")}, under "Review on this attempt's pull request", each with its id; the branch may hold a person's commits since your last turn, so read the code as it is now. Address every item with the smallest change that does it, write the outcomes file that section names, and commit.`, FIX_RULE);
|
|
325
356
|
}
|
|
326
357
|
else {
|
|
327
358
|
const why = facts.continuation?.priorStop
|
|
@@ -337,7 +368,7 @@ export function turnMessage(facts) {
|
|
|
337
368
|
parts.push("Check the work on this branch against the plan: run the checks, fix only what this change broke, and commit any fix.");
|
|
338
369
|
}
|
|
339
370
|
if (facts.review) {
|
|
340
|
-
parts.push(`A review or the CI on this attempt's pull request asks for changes: they are in ${at("ticket.md")}, under "Review on this attempt's pull request". Address every item and write the outcomes file that section names
|
|
371
|
+
parts.push(`A review or the CI on this attempt's pull request asks for changes: they are in ${at("ticket.md")}, under "Review on this attempt's pull request". Address every item and write the outcomes file that section names.`, FIX_RULE);
|
|
341
372
|
}
|
|
342
373
|
}
|
|
343
374
|
if (facts.handOffAnswer) {
|
|
@@ -420,7 +451,12 @@ export function parseSessionReport(text, known = new Map()) {
|
|
|
420
451
|
/** The checks the host named in `checks.json`, by their command, with how each stands on the base. */
|
|
421
452
|
function knownBaselines(inputDir, readFile) {
|
|
422
453
|
const read = readMissionChecksFile(join(inputDir, MISSION_CHECKS_FILE_NAME), readFile);
|
|
423
|
-
|
|
454
|
+
// A check the session was told to measure on the base takes no baseline
|
|
455
|
+
// from the record: only the session's own measurement may excuse it.
|
|
456
|
+
return new Map((read.file?.checks ?? []).map((check) => [
|
|
457
|
+
check.command.replace(/\s+/g, " "),
|
|
458
|
+
check.measureOnBase ? "runnable" : check.status,
|
|
459
|
+
]));
|
|
424
460
|
}
|
|
425
461
|
/** The report's checks and its words on `result.json`: the model's own account, never the host's proof. */
|
|
426
462
|
export function withReport(attempt, report) {
|
|
@@ -755,7 +791,11 @@ async function runTurn(input, deps, pulse) {
|
|
|
755
791
|
sentBack: exists(join(input.inputDir, "sent-back-plan.md")),
|
|
756
792
|
nextStepNote: input.stage === "plan" ? null : readOrNull(join(input.inputDir, NEXT_STEP_NOTE_FILE_NAME)),
|
|
757
793
|
newSinceLastTurn: readOrNull(join(input.inputDir, NEW_SINCE_LAST_TURN_FILE_NAME)),
|
|
794
|
+
conversationPutBack: readOrNull(join(input.inputDir, CONVERSATION_PUT_BACK_FILE_NAME)),
|
|
758
795
|
...(drawsPreview ? { preview: true } : {}),
|
|
796
|
+
...(input.stage === "plan" && exists(join(input.inputDir, OWN_PLANS_FILE_NAME))
|
|
797
|
+
? { ownPlans: true }
|
|
798
|
+
: {}),
|
|
759
799
|
// The env the turn's child runs on, so the message and the agents the
|
|
760
800
|
// child is offered (`builtinAgents`) read one value.
|
|
761
801
|
codeWriter: resolveCodeWriter(input.childEnv),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yagni-app/code-staging",
|
|
3
|
-
"version": "1.2.14-staging.
|
|
3
|
+
"version": "1.2.14-staging.2353.1",
|
|
4
4
|
"description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"turndown": "^7.2.4",
|
|
59
59
|
"typebox": "^1.3.15"
|
|
60
60
|
},
|
|
61
|
-
"yagniSourceSha": "
|
|
61
|
+
"yagniSourceSha": "30f071e3ce2b13a61dee9fc661779164bf9bcf29"
|
|
62
62
|
}
|