ai-foreman 1.7.29 → 2.0.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/README.md +1 -1
- package/dist/adapters/claude.d.ts +23 -12
- package/dist/adapters/claude.js +227 -23
- package/dist/adapters/codex.d.ts +17 -7
- package/dist/adapters/codex.js +195 -17
- package/dist/adapters/recovering.d.ts +2 -0
- package/dist/adapters/recovering.js +5 -1
- package/dist/adapters/structured.d.ts +71 -0
- package/dist/adapters/structured.js +213 -0
- package/dist/adapters/types.d.ts +85 -9
- package/dist/agentRun.d.ts +2 -0
- package/dist/agentRun.js +2 -1
- package/dist/boundedTurnEvidence.d.ts +18 -0
- package/dist/boundedTurnEvidence.js +76 -0
- package/dist/branch/currentGuard.d.ts +2 -0
- package/dist/branch/currentGuard.js +2 -0
- package/dist/branch/planner.js +1 -4
- package/dist/branch/runner.d.ts +2 -1
- package/dist/branch/runner.js +10 -7
- package/dist/buildAdmission.js +4 -0
- package/dist/buildApproval.d.ts +15 -0
- package/dist/buildApproval.js +25 -0
- package/dist/buildAssignment.d.ts +1 -0
- package/dist/buildAssignment.js +82 -23
- package/dist/buildInterventions.d.ts +2 -2
- package/dist/buildInterventions.js +11 -4
- package/dist/buildLaunchGate.js +3 -2
- package/dist/builderGuidanceFollowup.js +17 -6
- package/dist/cli/manager.js +22 -20
- package/dist/cli/start.js +22 -26
- package/dist/cli/tickets.d.ts +0 -7
- package/dist/cli/tickets.js +41 -40
- package/dist/continuity.d.ts +10 -14
- package/dist/continuity.js +198 -179
- package/dist/continuityOrigin.d.ts +13 -0
- package/dist/continuityOrigin.js +91 -0
- package/dist/foreman.d.ts +10 -4
- package/dist/foreman.js +51 -193
- package/dist/graph/boundary.d.ts +1 -1
- package/dist/graph/boundary.js +1 -1
- package/dist/graph/host.js +8 -19
- package/dist/graph/manager.d.ts +1 -1
- package/dist/graph/manager.js +1 -1
- package/dist/graph/preparation.d.ts +38 -0
- package/dist/graph/preparation.js +7 -6
- package/dist/graph/semantic.d.ts +1 -0
- package/dist/graph/semantic.js +4 -1
- package/dist/graph/session.js +7 -2
- package/dist/graph/turn.d.ts +2 -3
- package/dist/graph/turn.js +28 -40
- package/dist/handoffProtocol.js +2 -2
- package/dist/handoffs.d.ts +3 -1
- package/dist/handoffs.js +90 -59
- package/dist/hostGraphApplicability.d.ts +2 -1
- package/dist/hostGraphApplicability.js +17 -19
- package/dist/hostQaAugmentation.js +21 -4
- package/dist/hostQaComparison.d.ts +21 -2
- package/dist/hostQaComparison.js +43 -29
- package/dist/hostSourcePreservation.d.ts +38 -0
- package/dist/hostSourcePreservation.js +72 -0
- package/dist/interviews.d.ts +7 -0
- package/dist/interviews.js +18 -1
- package/dist/legacyCommunicationDisplay.d.ts +2 -0
- package/dist/legacyCommunicationDisplay.js +2 -0
- package/dist/managerPacket.js +3 -3
- package/dist/markers.d.ts +4 -3
- package/dist/markers.js +4 -20
- package/dist/probeIpc.d.ts +14 -0
- package/dist/probeIpc.js +29 -0
- package/dist/qaBuildGate.d.ts +21 -0
- package/dist/qaBuildGate.js +47 -12
- package/dist/qaBuilderCoverage.js +22 -13
- package/dist/qaBuilderEvidence.d.ts +16 -1
- package/dist/qaBuilderEvidence.js +48 -8
- package/dist/qaContractCoverage.d.ts +2 -2
- package/dist/qaContractCoverage.js +4 -9
- package/dist/qaContractDelivery.js +34 -20
- package/dist/qaCoverageAssembly.d.ts +22 -0
- package/dist/qaCoverageAssembly.js +16 -0
- package/dist/qaDeliveryJournal.d.ts +2 -0
- package/dist/qaDeliveryJournal.js +19 -0
- package/dist/qaFailureDelivery.js +97 -85
- package/dist/qaHostTransformation.d.ts +26 -0
- package/dist/qaHostTransformation.js +100 -0
- package/dist/qaPreparation.d.ts +8 -20
- package/dist/qaPreparation.js +133 -248
- package/dist/qaPreparationInputs.js +19 -0
- package/dist/qaPrerequisites.d.ts +2 -1
- package/dist/qaPrerequisites.js +21 -1
- package/dist/qaProtocolV2.d.ts +15 -0
- package/dist/qaRecovery.js +21 -4
- package/dist/qaReview.js +220 -395
- package/dist/qaReviewEvidence.d.ts +7 -3
- package/dist/qaReviewEvidence.js +15 -4
- package/dist/qaRuntime.js +1 -1
- package/dist/qaSnapshot.js +71 -21
- package/dist/qaStructuredResponse.d.ts +10 -0
- package/dist/qaStructuredResponse.js +57 -0
- package/dist/qaTimeline.js +5 -3
- package/dist/qaVerificationContract.d.ts +1 -2
- package/dist/qaVerificationContract.js +24 -35
- package/dist/readinessGate.js +5 -4
- package/dist/runtimeReadiness.js +23 -15
- package/dist/statusReporter.d.ts +2 -0
- package/dist/statusReporter.js +2 -0
- package/dist/structuredCutover.d.ts +31 -0
- package/dist/structuredCutover.js +510 -0
- package/dist/structuredCutoverFiles.d.ts +10 -0
- package/dist/structuredCutoverFiles.js +181 -0
- package/dist/structuredDispatchAuthority.d.ts +22 -0
- package/dist/structuredDispatchAuthority.js +110 -0
- package/dist/structuredDispatchRecord.d.ts +29 -0
- package/dist/structuredDispatchRecord.js +36 -0
- package/dist/structuredLiveBudget.d.ts +2 -0
- package/dist/structuredLiveBudget.js +23 -0
- package/dist/structuredOperation.d.ts +18 -0
- package/dist/structuredOperation.js +257 -0
- package/dist/supervisedStart.js +35 -21
- package/dist/ticketPlanning.d.ts +1 -373
- package/dist/ticketPlanning.js +2 -26
- package/dist/ticketPopulation.d.ts +0 -3
- package/dist/ticketPopulation.js +4 -21
- package/dist/ticketPopulationPageAuthority.d.ts +13 -0
- package/dist/ticketPopulationPageAuthority.js +30 -0
- package/dist/ticketPopulationPaging.d.ts +27 -0
- package/dist/ticketPopulationPaging.js +105 -0
- package/dist/tickets/renderMarkdown.d.ts +14 -0
- package/dist/tickets/renderMarkdown.js +39 -5
- package/dist/tickets/ticketLoader.js +10 -0
- package/dist/tickets/ticketSchema.d.ts +107 -0
- package/dist/tickets/ticketSchema.js +4 -1
- package/dist/workflowDb.d.ts +100 -2
- package/dist/workflowDb.js +763 -39
- package/dist/workflowReader.d.ts +1 -0
- package/dist/workflowReader.js +9 -0
- package/package.json +15 -7
package/dist/cli/tickets.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { streamTicketPopulation } from "../ticketPopulationPaging.js";
|
|
2
|
+
import { operationPayload } from "../structuredOperation.js";
|
|
1
3
|
import { Command } from "commander";
|
|
2
4
|
import { accent, error, sanitizeTerminalText, success, warning } from "../terminalStyle.js";
|
|
3
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
6
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
5
7
|
import { parse as parseYaml } from "yaml";
|
|
6
|
-
import { riskNoteRepairProposalV1Schema, zodIssues } from "rafi-spec";
|
|
8
|
+
import { riskNoteRepairOutput, riskNoteRepairProposalV1Schema, zodIssues } from "rafi-spec";
|
|
7
9
|
import { select, text, confirm, isCancel, multiselect } from "@clack/prompts";
|
|
8
10
|
import { loadConfig } from "../config.js";
|
|
9
11
|
import { Log } from "../log.js";
|
|
10
|
-
import { Foreman
|
|
12
|
+
import { Foreman } from "../foreman.js";
|
|
11
13
|
import { printEvents } from "./events.js";
|
|
12
14
|
import { cmdInit, cmdUpdate, cmdComplete, cmdBlock, cmdUnblock, cmdCancel, cmdDiscover, cmdAcceptFutureWork, cmdReorder, cmdRender, cmdValidate, cmdQueue, cmdStackQueue, cmdArchive, cmdReview, } from "../tickets/commands.js";
|
|
13
15
|
import { loadDeliveryConfig } from "../tickets/delivery.js";
|
|
@@ -20,7 +22,7 @@ import { DEFAULT_TICKET_SETUP, configuredPlanningSources, configuredAppName, def
|
|
|
20
22
|
import { deactivateSource, discardStagedSourceCaptures, loadSourceRegistry, refreshSourceRegistry, registerSourceRequests, removeSource, saveSourceRegistry, } from "../sources/sourceRegistry.js";
|
|
21
23
|
import { fetchAndSnapshotUrl, snapshotExternalLocalFile } from "../tickets/sourceFetch.js";
|
|
22
24
|
import { checkpointInterview, completeInterview, createInterviewRecord, failInterview, readInterviewRecords, resumeInterviewRecord, } from "../interviews.js";
|
|
23
|
-
import { applyTicketPopulation, assertRiskPlanOnlyCorrection, authorizeTicketRetirements,
|
|
25
|
+
import { applyTicketPopulation, assertRiskPlanOnlyCorrection, authorizeTicketRetirements, materializeTicketPopulation, recoverTicketPublications, TicketPopulationValidationError } from "../ticketPopulation.js";
|
|
24
26
|
import { loadTickets, saveTickets, validateTicketDefs } from "../tickets/ticketLoader.js";
|
|
25
27
|
import { resolveTicketPaths } from "../tickets/config.js";
|
|
26
28
|
import { formatAllTicketDetails, formatTicketDetails, getAllTicketDetails, getTicketDetails } from "../tickets/details.js";
|
|
@@ -31,25 +33,11 @@ import { listTicketGroups, previewTicketGroupRepair, repairTicketGroups } from "
|
|
|
31
33
|
import { StateDb } from "../tickets/stateDb.js";
|
|
32
34
|
import { ticketDefinitionDigest } from "../tickets/riskWaivers.js";
|
|
33
35
|
import { hasRollbackOrMitigationPlan } from "../tickets/ticketLoader.js";
|
|
36
|
+
import { migrateTrackerRules } from "../tickets/renderMarkdown.js";
|
|
34
37
|
let nestedTicketCommandDepth = 0;
|
|
35
38
|
class TicketInterviewCancelled extends Error {
|
|
36
39
|
}
|
|
37
40
|
function cancelTicketInterview() { throw new TicketInterviewCancelled("ticket interview cancelled"); }
|
|
38
|
-
/**
|
|
39
|
-
* Ticket Maker may append an explanatory note after its machine envelope.
|
|
40
|
-
* Preserve a schema-valid proposal before Foreman's strict generic marker
|
|
41
|
-
* repair path replaces the response with a status-only correction.
|
|
42
|
-
*/
|
|
43
|
-
export function acceptTicketPopulationCompletion(text) {
|
|
44
|
-
try {
|
|
45
|
-
extractTicketPopulationProposal(text);
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
const status = parseStepStatus(text, { requireFinalLine: false });
|
|
51
|
-
return status.kind === "done" || status.kind === "plan_complete" ? status : undefined;
|
|
52
|
-
}
|
|
53
41
|
function fail(msg) {
|
|
54
42
|
if (nestedTicketCommandDepth > 0)
|
|
55
43
|
throw new Error(msg);
|
|
@@ -210,23 +198,13 @@ Return ticket content using Foreman's schema:
|
|
|
210
198
|
- title, area, priority, size, risk, depends_on, summary, acceptance, required_tests, likely_files, rollback, notes.
|
|
211
199
|
- Keep dependencies, acceptance criteria, testing expectations, file hints, risk notes, and implementation notes from the source material. For each ticket, use only the mapped approved slice's acceptance and required tests; do not copy plan-level acceptance criteria or add requirements about sibling slices or unfinished tickets. A ticket's acceptance must remain implementable and verifiable when its own slice is delivered.
|
|
212
200
|
- Preserve additive-slice independence without inventing an absence test: each ticket's own behavior and tests should work against the shared approved baseline and must not depend on sibling implementation. Do not add wording such as "with the sibling absent/present," "without [sibling] present," or "with this slice alone" unless the approved plan explicitly requires sibling absence testing or an isolated branch. Otherwise use positive own-ticket checks, the shared project tests, and the combined-result check.
|
|
213
|
-
-
|
|
201
|
+
- Rafi copies documentation policy and QA preparation decisions directly from the approved slice. Do not include these host-owned fields in your proposal or invent additional requirements. Preserve the approved acceptance and tests.
|
|
214
202
|
- File names and likely_files are implementation hints, not an exhaustive allowlist. Do not invent acceptance criteria or tests that require an exact changed-file list; allow other relevant files needed to complete the approved work. Preserve explicit user-established security, privacy, access, and other safety restrictions. Rafi manages ticket lifecycle state; do not require the Builder to mark tickets done in a document.
|
|
215
203
|
- For every Medium or High risk ticket, \`rollback\` is required. It must state a concrete rollback or mitigation action: what is disabled, reverted, or contained, and how recovery or impact is verified. \`notes\` may add context but never satisfies this requirement. Low-risk tickets may use \`rollback: null\`.
|
|
216
204
|
- Do not store mutable status/progress fields in .tickets/tickets.yaml.
|
|
217
205
|
- Dependencies must reference slice_ref values. Include the exact IDs of existing populated tickets whose removed slices should become obsolete.
|
|
218
206
|
|
|
219
|
-
If source content does not cleanly map to the
|
|
220
|
-
STEP_STATUS: needs_input | question="..." choices="..."
|
|
221
|
-
|
|
222
|
-
Output one JSON object between ${TICKET_POPULATION_PROPOSAL_START} and ${TICKET_POPULATION_PROPOSAL_END} with shape:
|
|
223
|
-
{"version":1,"plan_id":"approved plan ID","revision":1,"tickets":[{"slice_ref":"slc_low","title":"...","area":"...","priority":"P1","size":"S","risk":"Low","summary":"...","acceptance":["..."],"required_tests":["..."],"likely_files":["..."],"documentation":{"required":false,"targets":[],"criteria":[]},"depends_on":[],"rollback":null,"notes":null},{"slice_ref":"slc_medium","title":"...","area":"...","priority":"P1","size":"S","risk":"Medium","summary":"...","acceptance":["..."],"required_tests":["..."],"likely_files":["..."],"documentation":{"required":false,"targets":[],"criteria":[]},"depends_on":["slc_low"],"rollback":"Disable the feature flag, restore the previous handler, and verify the affected error rate returns to baseline.","notes":null}],"retirements":["exact existing ticket ID"]}
|
|
224
|
-
Triple-check that every approved slice appears exactly once.
|
|
225
|
-
|
|
226
|
-
End with exactly one marker line as the final non-empty line; do not append notes or commentary after it:
|
|
227
|
-
STEP_STATUS: done | summary="populated Foreman tickets from existing project ticket sources"
|
|
228
|
-
or
|
|
229
|
-
STEP_STATUS: blocked | reason="why ticket population cannot proceed"`;
|
|
207
|
+
If source content does not cleanly map to the approved plan, return a needs-input or blocked result instead of guessing. Return the full proposal in result.payload of the native ticket-population response. The proposal contains version, plan_id, revision, tickets, and retirements. Do not allocate final ticket IDs.`;
|
|
230
208
|
}
|
|
231
209
|
/** A bounded correction loop ended without a publishable proposal. */
|
|
232
210
|
export class TicketPopulationRiskCorrectionExhaustedError extends Error {
|
|
@@ -546,6 +524,18 @@ async function cmdSetupUpdateCli(opts) {
|
|
|
546
524
|
saveSourceRegistry(dir, patch.sourceRegistry);
|
|
547
525
|
registrySaved = true;
|
|
548
526
|
syncTicketLimits(dir, next.limits);
|
|
527
|
+
if (isTicketsInitialized(dir)) {
|
|
528
|
+
const ticketsConfig = loadTicketsConfig(dir);
|
|
529
|
+
const trackerRulesPath = join(dir, ticketsConfig.paths.trackerRules);
|
|
530
|
+
if (existsSync(trackerRulesPath)) {
|
|
531
|
+
const before = readFileSync(trackerRulesPath, "utf8");
|
|
532
|
+
const migrated = migrateTrackerRules(before, ticketsConfig.paths.progressDoc);
|
|
533
|
+
if (migrated.disposition !== "unchanged") {
|
|
534
|
+
writeFileSync(trackerRulesPath, migrated.content, "utf8");
|
|
535
|
+
console.log(`foreman tickets setup: ${migrated.disposition === "replaced-legacy" ? "upgraded" : "refreshed"} Rafi-managed tracker rules`);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
549
539
|
console.log(`foreman tickets setup: updated ticket setup in ${join(dir, "rafi-config.yaml")}`);
|
|
550
540
|
if (isTicketsInitialized(dir)) {
|
|
551
541
|
const rows = cmdQueue(dir, 1);
|
|
@@ -1480,8 +1470,14 @@ export async function cmdPopulateCli(opts) {
|
|
|
1480
1470
|
if (contextSources.length) {
|
|
1481
1471
|
console.log(`foreman tickets: context sources ${contextSources.join(" ")}`);
|
|
1482
1472
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1473
|
+
const population = (instruction, correction) => streamTicketPopulation({
|
|
1474
|
+
projectDir: dir, interviewId: planningRecord.id, correction, instruction,
|
|
1475
|
+
checkpoint: scope => { planningRecord = checkpointInterview(dir, planningRecord, { decisions: { ...planningRecord.decisions, populationArtifact: scope } }); },
|
|
1476
|
+
dispatch: (instruction, policy) => foreman.runInstruction(instruction, policy),
|
|
1477
|
+
});
|
|
1478
|
+
const initialPopulation = await population(buildPopulateInstruction(approvedPlan.path, contextSources, ticketsConfig.paths.progressDoc), 0);
|
|
1479
|
+
let turn = initialPopulation.turn;
|
|
1480
|
+
planningRecord = checkpointInterview(dir, planningRecord, { runtime: { runtime: roleBuilder.runtime, model: roleBuilder.model, sessionId: builder.sessionId() }, decisions: { ...planningRecord.decisions, proposalResponse: turn.result.text, structuredResponse: turn.result.structured } });
|
|
1485
1481
|
log.write("ticket-populate", {
|
|
1486
1482
|
statusKind: turn.status.kind,
|
|
1487
1483
|
summary: turn.status.summary,
|
|
@@ -1499,7 +1495,9 @@ export async function cmdPopulateCli(opts) {
|
|
|
1499
1495
|
throw new Error(`needs human — ${turn.status.error ?? "builder did not emit done"}`);
|
|
1500
1496
|
}
|
|
1501
1497
|
const existing = loadTickets(resolveTicketPaths(ticketsConfig, dir).tickets);
|
|
1502
|
-
|
|
1498
|
+
if (!turn.result.selectedDispatch)
|
|
1499
|
+
throw new Error("Ticket population response has no sealed dispatch tuple");
|
|
1500
|
+
let proposal = initialPopulation.proposal;
|
|
1503
1501
|
let proposalArtifact = savePopulationProposalArtifact(dir, planningRecord.id, approvedPlan, proposal);
|
|
1504
1502
|
let materialized;
|
|
1505
1503
|
let populationWaiver;
|
|
@@ -1525,18 +1523,22 @@ export async function cmdPopulateCli(opts) {
|
|
|
1525
1523
|
continue;
|
|
1526
1524
|
}
|
|
1527
1525
|
console.log(`foreman tickets: ${ids} need risk plans; asking Ticket Maker for a targeted correction (${correction + 1}/2)`);
|
|
1528
|
-
const
|
|
1526
|
+
const correctedPopulation = await population(`Correct the existing ticket population proposal only. Do not change plan_id, revision, slice_ref mappings, ticket IDs, dependencies, scope, ownership, acceptance criteria, tests, retirements, or any field except \`rollback\` for these tickets: ${ids}. Each listed ticket is Medium or High risk and requires a concrete rollback or mitigation plan in \`rollback\`; \`notes\` cannot satisfy this requirement. Return the complete replacement proposal through native ticket-population pages.`, correction + 1);
|
|
1527
|
+
const correctionTurn = correctedPopulation.turn;
|
|
1529
1528
|
if (correctionTurn.result.isError || (correctionTurn.status.kind !== "done" && correctionTurn.status.kind !== "plan_complete")) {
|
|
1530
1529
|
throw new Error(`Ticket Maker could not correct missing risk plans for ${ids}: ${correctionTurn.status.reason ?? correctionTurn.status.error ?? correctionTurn.result.text.slice(0, 200)}`);
|
|
1531
1530
|
}
|
|
1532
1531
|
turn = correctionTurn;
|
|
1533
1532
|
planningRecord = checkpointInterview(dir, planningRecord, {
|
|
1534
1533
|
runtime: { runtime: roleBuilder.runtime, model: roleBuilder.model, sessionId: builder.sessionId() },
|
|
1535
|
-
decisions: { ...planningRecord.decisions, proposalResponse: turn.result.text, riskPlanCorrections: correction + 1 },
|
|
1534
|
+
decisions: { ...planningRecord.decisions, proposalResponse: turn.result.text, structuredResponse: turn.result.structured, riskPlanCorrections: correction + 1 },
|
|
1536
1535
|
});
|
|
1537
|
-
const corrected =
|
|
1536
|
+
const corrected = correctedPopulation.proposal;
|
|
1538
1537
|
assertRiskPlanOnlyCorrection(proposal, corrected, err.repairableRiskSliceRefs);
|
|
1539
1538
|
proposal = corrected;
|
|
1539
|
+
if (!turn.result.selectedDispatch)
|
|
1540
|
+
throw new Error("Ticket population correction has no sealed dispatch tuple");
|
|
1541
|
+
// A correction is immutable lineage, never a rewrite of the terminal proposal.
|
|
1540
1542
|
proposalArtifact = savePopulationProposalArtifact(dir, planningRecord.id, approvedPlan, proposal);
|
|
1541
1543
|
}
|
|
1542
1544
|
}
|
|
@@ -1599,13 +1601,12 @@ export async function cmdRepairRiskNotesCli(opts) {
|
|
|
1599
1601
|
"You are Ticket Maker in read-only repair mode. Do not edit files.",
|
|
1600
1602
|
"For every listed ticket, supply a concrete rollback or mitigation plan. Do not change any other field or add/remove tickets.",
|
|
1601
1603
|
`Tickets requiring repair:\n${JSON.stringify(targets.map(ticket => ({ id: ticket.id, title: ticket.title, risk: ticket.risk, summary: ticket.summary, acceptance: ticket.acceptance, required_tests: ticket.required_tests })), null, 2)}`,
|
|
1602
|
-
`
|
|
1603
|
-
"End with STEP_STATUS: done | summary=\"risk-note repair proposed\"",
|
|
1604
|
+
`Submit the native risk-note-repair payload: {"version":1,"tickets":[{"id":"T001","rollback":"Concrete reversal or mitigation steps."}]}.`,
|
|
1604
1605
|
].join("\n\n");
|
|
1605
|
-
const turn = await foreman.runInstruction(instruction);
|
|
1606
|
+
const turn = await foreman.runInstruction(instruction, { output: riskNoteRepairOutput });
|
|
1606
1607
|
if (turn.result.isError || (turn.status.kind !== "done" && turn.status.kind !== "plan_complete"))
|
|
1607
1608
|
throw new Error(`Ticket Maker could not propose risk-plan repairs: ${turn.status.reason ?? turn.status.error ?? turn.result.text.slice(0, 300)}`);
|
|
1608
|
-
const proposal =
|
|
1609
|
+
const proposal = operationPayload(turn.result, riskNoteRepairOutput);
|
|
1609
1610
|
const repaired = applyRiskNoteRepairProposal(current, proposal);
|
|
1610
1611
|
for (const target of targets)
|
|
1611
1612
|
console.log(` ${target.id}: ${proposal.tickets.find(item => item.id === target.id).rollback.trim()}`);
|
package/dist/continuity.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ContinuityDelta, ResolvedAgentSettings } from "rafi-spec";
|
|
2
2
|
import type { BuilderAdapter, CompactResult, ContextUsage, NativeAutoCompactionPolicy, NativeCompaction, ProviderSessionUsage, ProviderSettingSwitch, RuntimeFailure, TurnResult } from "./adapters/types.js";
|
|
3
|
+
import type { BuilderHandoffRequest } from "./handoffs.js";
|
|
3
4
|
export declare const CONTINUITY_MARKER = "RAFI_CONTINUITY_DELTA:";
|
|
4
5
|
export declare class ContinuityValidationError extends Error {
|
|
5
6
|
readonly problems: string[];
|
|
@@ -22,12 +23,8 @@ export declare class SessionUnavailableContinuityError extends Error {
|
|
|
22
23
|
readonly guidedRecovery: boolean;
|
|
23
24
|
constructor(runId: string, role: "builder" | "qa", failure: RuntimeFailure);
|
|
24
25
|
}
|
|
26
|
+
export declare const CONTINUITY_REQUIRED_INSTRUCTION = "Include the required bounded continuity object in the operation response; continuity cannot be null for this session.";
|
|
25
27
|
export declare function validateContinuityDelta(value: unknown): ContinuityDelta;
|
|
26
|
-
export declare function parseContinuityDelta(text: string): {
|
|
27
|
-
delta?: ContinuityDelta;
|
|
28
|
-
cleanText: string;
|
|
29
|
-
error?: ContinuityValidationError;
|
|
30
|
-
};
|
|
31
28
|
export declare function mergeContinuityDeltas(deltas: readonly ContinuityDelta[]): ContinuityDelta;
|
|
32
29
|
export declare function baselineContinuityDelta(nextAction?: string): ContinuityDelta;
|
|
33
30
|
export declare function continuityInstruction(role?: "builder" | "qa"): string;
|
|
@@ -53,7 +50,7 @@ export interface ContinuityAdapterOptions {
|
|
|
53
50
|
/** Explicit compatibility recovery may replace a dead predecessor lease only after its first valid checkpoint. */
|
|
54
51
|
replaceRecoveryLeaseAfterCheckpoint?: boolean;
|
|
55
52
|
/** Host-owned validated Builder handoff request processing at a safe turn boundary. */
|
|
56
|
-
handleHandoffRequest?: (text: string, predecessor: BuilderAdapter, frozenAction: string) => Promise<BuilderAdapter | undefined>;
|
|
53
|
+
handleHandoffRequest?: (text: string | BuilderHandoffRequest, predecessor: BuilderAdapter, frozenAction: string) => Promise<BuilderAdapter | undefined>;
|
|
57
54
|
/** QA journals each provider turn separately; wrappers must not repair or redispatch inside one host turn. */
|
|
58
55
|
durableSingleTurn?: boolean;
|
|
59
56
|
}
|
|
@@ -79,15 +76,16 @@ export declare class ContinuityAdapter implements BuilderAdapter {
|
|
|
79
76
|
/** Establish an explicitly requested fresh owner before context probes or work. */
|
|
80
77
|
validateFreshRecovery(): Promise<void>;
|
|
81
78
|
get agent(): "claude" | "codex";
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
logicalActionId?: string;
|
|
86
|
-
purpose?: import("./providerPhase.js").ProviderTurnPurpose;
|
|
87
|
-
}): Promise<TurnResult>;
|
|
79
|
+
/** Every confirmed dispatch publishes a checkpoint, so continuity is mandatory. */
|
|
80
|
+
structuredDispatchRequirement(): import("./adapters/types.js").StructuredDispatchRequirement;
|
|
81
|
+
sendTurn(instruction: string, policy?: import("./adapters/types.js").TurnRequest): Promise<TurnResult>;
|
|
88
82
|
private sendTurnOwned;
|
|
83
|
+
postConfirmedDispatch(reference: import("./adapters/types.js").ConfirmedDispatchReference): Promise<TurnResult>;
|
|
89
84
|
observeEvents(listener: (event: import("./adapters/types.js").BuilderEvent) => void): () => void;
|
|
90
85
|
acceptHandbackTurn(turn: TurnResult): void;
|
|
86
|
+
/** Explicit restart recovery of the already accepted action; never repeats acceptance. */
|
|
87
|
+
resumePlannedContinuation(): Promise<TurnResult | undefined>;
|
|
88
|
+
recoverConfirmedPublications(): Promise<void>;
|
|
91
89
|
sessionId(): string | undefined;
|
|
92
90
|
sessionRef(): import("rafi-spec").ProviderSessionRefV1 | undefined;
|
|
93
91
|
prepareSession(): Promise<import("rafi-spec").ProviderSessionRefV1>;
|
|
@@ -109,9 +107,7 @@ export declare class ContinuityAdapter implements BuilderAdapter {
|
|
|
109
107
|
/** Keep the observable wrapper and event stream stable while moving to an accepted successor. */
|
|
110
108
|
adoptValidatedSuccessor(successor: BuilderAdapter): Promise<void>;
|
|
111
109
|
private publish;
|
|
112
|
-
private moveRecoveryLeaseAfterCheckpoint;
|
|
113
110
|
private recordSessionUnavailable;
|
|
114
|
-
private reconstructionHandoff;
|
|
115
111
|
private revision;
|
|
116
112
|
private pumpEvents;
|
|
117
113
|
}
|