@yagni-app/code-staging 0.0.0 → 0.1.0-staging.1002.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.
- package/LICENSE.md +55 -0
- package/README.md +166 -0
- package/dist/branding.d.ts +25 -0
- package/dist/branding.js +27 -0
- package/dist/claudeCompat.d.ts +78 -0
- package/dist/claudeCompat.js +198 -0
- package/dist/cli.d.ts +55 -0
- package/dist/cli.js +326 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +28 -0
- package/dist/credentials.d.ts +41 -0
- package/dist/credentials.js +75 -0
- package/dist/distribution.d.ts +15 -0
- package/dist/distribution.js +45 -0
- package/dist/doctor.d.ts +94 -0
- package/dist/doctor.js +343 -0
- package/dist/extension/advisor.d.ts +84 -0
- package/dist/extension/advisor.js +101 -0
- package/dist/extension/askAdvisorTool.d.ts +83 -0
- package/dist/extension/askAdvisorTool.js +188 -0
- package/dist/extension/askYagniTool.d.ts +39 -0
- package/dist/extension/askYagniTool.js +63 -0
- package/dist/extension/bless.d.ts +45 -0
- package/dist/extension/bless.js +74 -0
- package/dist/extension/branding.d.ts +48 -0
- package/dist/extension/branding.js +119 -0
- package/dist/extension/chipEditor.d.ts +117 -0
- package/dist/extension/chipEditor.js +369 -0
- package/dist/extension/config.d.ts +112 -0
- package/dist/extension/config.js +108 -0
- package/dist/extension/costHud.d.ts +73 -0
- package/dist/extension/costHud.js +123 -0
- package/dist/extension/decisionCapture.d.ts +52 -0
- package/dist/extension/decisionCapture.js +66 -0
- package/dist/extension/decisions.d.ts +83 -0
- package/dist/extension/decisions.js +200 -0
- package/dist/extension/diagnostics.d.ts +41 -0
- package/dist/extension/diagnostics.js +110 -0
- package/dist/extension/index.d.ts +116 -0
- package/dist/extension/index.js +388 -0
- package/dist/extension/initDone.d.ts +28 -0
- package/dist/extension/initDone.js +66 -0
- package/dist/extension/initPass.d.ts +152 -0
- package/dist/extension/initPass.js +394 -0
- package/dist/extension/nextWorkTool.d.ts +51 -0
- package/dist/extension/nextWorkTool.js +80 -0
- package/dist/extension/permission.d.ts +91 -0
- package/dist/extension/permission.js +236 -0
- package/dist/extension/pipeline/activity.d.ts +37 -0
- package/dist/extension/pipeline/activity.js +151 -0
- package/dist/extension/pipeline/activityFeed.d.ts +59 -0
- package/dist/extension/pipeline/activityFeed.js +175 -0
- package/dist/extension/pipeline/budget.d.ts +48 -0
- package/dist/extension/pipeline/budget.js +68 -0
- package/dist/extension/pipeline/checkpoint.d.ts +31 -0
- package/dist/extension/pipeline/checkpoint.js +176 -0
- package/dist/extension/pipeline/eval.d.ts +168 -0
- package/dist/extension/pipeline/eval.js +182 -0
- package/dist/extension/pipeline/events.d.ts +56 -0
- package/dist/extension/pipeline/events.js +147 -0
- package/dist/extension/pipeline/findings.d.ts +42 -0
- package/dist/extension/pipeline/findings.js +144 -0
- package/dist/extension/pipeline/finish.d.ts +128 -0
- package/dist/extension/pipeline/finish.js +307 -0
- package/dist/extension/pipeline/goCommand.d.ts +128 -0
- package/dist/extension/pipeline/goCommand.js +972 -0
- package/dist/extension/pipeline/goCompareCommand.d.ts +48 -0
- package/dist/extension/pipeline/goCompareCommand.js +184 -0
- package/dist/extension/pipeline/goFlags.d.ts +40 -0
- package/dist/extension/pipeline/goFlags.js +46 -0
- package/dist/extension/pipeline/goStatusCommands.d.ts +59 -0
- package/dist/extension/pipeline/goStatusCommands.js +188 -0
- package/dist/extension/pipeline/invocation.d.ts +45 -0
- package/dist/extension/pipeline/invocation.js +64 -0
- package/dist/extension/pipeline/orchestrator.d.ts +131 -0
- package/dist/extension/pipeline/orchestrator.js +636 -0
- package/dist/extension/pipeline/personas.d.ts +44 -0
- package/dist/extension/pipeline/personas.js +248 -0
- package/dist/extension/pipeline/resilience.d.ts +85 -0
- package/dist/extension/pipeline/resilience.js +166 -0
- package/dist/extension/pipeline/resume.d.ts +18 -0
- package/dist/extension/pipeline/resume.js +106 -0
- package/dist/extension/pipeline/runRegistry.d.ts +112 -0
- package/dist/extension/pipeline/runRegistry.js +202 -0
- package/dist/extension/pipeline/runSession.d.ts +152 -0
- package/dist/extension/pipeline/runSession.js +167 -0
- package/dist/extension/pipeline/runState.d.ts +158 -0
- package/dist/extension/pipeline/runState.js +264 -0
- package/dist/extension/pipeline/runner.d.ts +79 -0
- package/dist/extension/pipeline/runner.js +298 -0
- package/dist/extension/pipeline/scrubSecrets.d.ts +15 -0
- package/dist/extension/pipeline/scrubSecrets.js +32 -0
- package/dist/extension/pipeline/stages.d.ts +51 -0
- package/dist/extension/pipeline/stages.js +113 -0
- package/dist/extension/pipeline/ticketResolution.d.ts +34 -0
- package/dist/extension/pipeline/ticketResolution.js +75 -0
- package/dist/extension/pipeline/types.d.ts +436 -0
- package/dist/extension/pipeline/types.js +48 -0
- package/dist/extension/pipeline/verify.d.ts +277 -0
- package/dist/extension/pipeline/verify.js +758 -0
- package/dist/extension/pipeline/workspace.d.ts +32 -0
- package/dist/extension/pipeline/workspace.js +73 -0
- package/dist/extension/pipeline/worktree.d.ts +107 -0
- package/dist/extension/pipeline/worktree.js +200 -0
- package/dist/extension/provider.d.ts +11 -0
- package/dist/extension/provider.js +26 -0
- package/dist/extension/recall.d.ts +93 -0
- package/dist/extension/recall.js +187 -0
- package/dist/extension/recordContextTool.d.ts +38 -0
- package/dist/extension/recordContextTool.js +85 -0
- package/dist/extension/recordDecisionTool.d.ts +52 -0
- package/dist/extension/recordDecisionTool.js +102 -0
- package/dist/extension/repoDocs.d.ts +81 -0
- package/dist/extension/repoDocs.js +260 -0
- package/dist/extension/resilientFetch.d.ts +60 -0
- package/dist/extension/resilientFetch.js +133 -0
- package/dist/extension/reviewTool.d.ts +34 -0
- package/dist/extension/reviewTool.js +81 -0
- package/dist/extension/spool.d.ts +92 -0
- package/dist/extension/spool.js +266 -0
- package/dist/extension/stateHome.d.ts +2 -0
- package/dist/extension/stateHome.js +6 -0
- package/dist/extension/subagents.d.ts +135 -0
- package/dist/extension/subagents.js +281 -0
- package/dist/extension/surface.d.ts +10 -0
- package/dist/extension/surface.js +12 -0
- package/dist/extension/todos.d.ts +110 -0
- package/dist/extension/todos.js +217 -0
- package/dist/extension/tokenProvider.d.ts +93 -0
- package/dist/extension/tokenProvider.js +234 -0
- package/dist/launch.d.ts +76 -0
- package/dist/launch.js +111 -0
- package/dist/login.d.ts +45 -0
- package/dist/login.js +142 -0
- package/dist/logout.d.ts +14 -0
- package/dist/logout.js +34 -0
- package/dist/paths.d.ts +31 -0
- package/dist/paths.js +87 -0
- package/dist/piPackage.d.ts +33 -0
- package/dist/piPackage.js +71 -0
- package/dist/profiles.d.ts +80 -0
- package/dist/profiles.js +222 -0
- package/dist/refresh.d.ts +70 -0
- package/dist/refresh.js +117 -0
- package/dist/upgrade.d.ts +97 -0
- package/dist/upgrade.js +284 -0
- package/package.json +39 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PURE child-invocation builder — the direct analogue of yagni-code-cli's
|
|
3
|
+
* `buildLaunch` (no spawn, no fs).
|
|
4
|
+
*
|
|
5
|
+
* `buildStageInvocation` produces the per-stage pi PASSTHROUGH argv exactly as
|
|
6
|
+
* the subagent example assembles it (runSingleAgent L294-330):
|
|
7
|
+
* --mode json -p --no-session --model <tier> --tools <csv>
|
|
8
|
+
* --append-system-prompt <file> 'Task: <rendered>'
|
|
9
|
+
*
|
|
10
|
+
* `groundedChildArgv` prepends the grounding pi-args the yagni-code launcher
|
|
11
|
+
* would otherwise add (`-e <self> --provider yagni`) because v1 spawns pi
|
|
12
|
+
* directly, NOT the yagni-code bin, to avoid a yagni-code-cli ↔ pi-extension-yagni
|
|
13
|
+
* circular dependency (token / base-url / agent-dir are inherited from the
|
|
14
|
+
* parent's env, not re-built here).
|
|
15
|
+
*
|
|
16
|
+
* `renderTemplate` does the {ticket}/{previous} substitution, mirroring the
|
|
17
|
+
* chain's `step.task.replace(/{previous}/g, …)`.
|
|
18
|
+
*/
|
|
19
|
+
/** Fill {ticket}/{previous}; an absent var renders as empty string. */
|
|
20
|
+
export function renderTemplate(tmpl, vars) {
|
|
21
|
+
return tmpl
|
|
22
|
+
.replace(/\{ticket\}/g, vars.ticket ?? "")
|
|
23
|
+
.replace(/\{previous\}/g, vars.previous ?? "");
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Build the pi passthrough argv for one stage (from `--mode` onward). The
|
|
27
|
+
* positional rendered prompt is always the last arg, prefixed `Task: `.
|
|
28
|
+
*/
|
|
29
|
+
export function buildStageInvocation(stage, ctx) {
|
|
30
|
+
const task = renderTemplate(stage.taskTemplate, {
|
|
31
|
+
ticket: ctx.ticket,
|
|
32
|
+
previous: ctx.previous,
|
|
33
|
+
});
|
|
34
|
+
return [
|
|
35
|
+
"--mode",
|
|
36
|
+
"json",
|
|
37
|
+
"-p",
|
|
38
|
+
"--no-session",
|
|
39
|
+
"--model",
|
|
40
|
+
stage.model,
|
|
41
|
+
"--tools",
|
|
42
|
+
stage.tools.join(","),
|
|
43
|
+
"--append-system-prompt",
|
|
44
|
+
ctx.promptFilePath,
|
|
45
|
+
`Task: ${task}`,
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Prepend the grounding args (the pi cli script, our extension, and the default
|
|
50
|
+
* `yagni` provider) before a stage passthrough. Mirrors buildLaunch's
|
|
51
|
+
* `userChoseProvider` guard so a passthrough that already chose a provider is
|
|
52
|
+
* left untouched.
|
|
53
|
+
*/
|
|
54
|
+
export function groundedChildArgv(stageArgv, opts) {
|
|
55
|
+
const userChoseProvider = stageArgv.includes("--provider");
|
|
56
|
+
return [
|
|
57
|
+
opts.piCli,
|
|
58
|
+
"-e",
|
|
59
|
+
opts.extensionPath,
|
|
60
|
+
...(userChoseProvider ? [] : ["--provider", "yagni"]),
|
|
61
|
+
...stageArgv,
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=invocation.js.map
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pipeline driver.
|
|
3
|
+
*
|
|
4
|
+
* Sequences `runStage` for the build stages (map → plan → implement), threading
|
|
5
|
+
* each stage's `finalOutput` into the next as `{previous}` (mirrors the subagent
|
|
6
|
+
* example's chain). Then it runs the bounded review→fix LOOP: each round fans the
|
|
7
|
+
* review stage out across the 3 lenses (parallel, bounded by MAX_CONCURRENCY),
|
|
8
|
+
* parses each lens with `parseFindings` (with ONE cheap format-recovery re-ask
|
|
9
|
+
* for a healthy lens that broke the findings contract — spec §3e), unions them,
|
|
10
|
+
* and asks the PURE `shouldStop`. If not stopped it runs the fix stage against
|
|
11
|
+
* ONLY the blocking findings, increments the round, and re-reviews.
|
|
12
|
+
*
|
|
13
|
+
* ALL branching is delegated to the pure `shouldStop` / `parseFindings`; the
|
|
14
|
+
* orchestrator is just sequencing + an injectable `runStage`, so it is
|
|
15
|
+
* unit-tested with a fake `runStage`. The explicit stop reason is always logged
|
|
16
|
+
* (spec §7.3 — no silent truncation). An early build-stage failure short-circuits
|
|
17
|
+
* the pipeline by throwing (the /go handler catches and reports it). In the
|
|
18
|
+
* review→fix loop, a user abort or a crashed review/fix child is surfaced as an
|
|
19
|
+
* honest `aborted` / `failed` stopReason rather than being mis-read as `clean`
|
|
20
|
+
* (an aborted/crashed child has empty output, which otherwise parses to zero
|
|
21
|
+
* findings — i.e. a false "reviewed and clean").
|
|
22
|
+
*/
|
|
23
|
+
import { type RunBudget } from "./budget.js";
|
|
24
|
+
import { runStage as defaultRunStage } from "./runner.js";
|
|
25
|
+
import { type VerifyOutcome } from "./verify.js";
|
|
26
|
+
import { snapshotWorkspace as defaultSnapshotWorkspace } from "./workspace.js";
|
|
27
|
+
import { type CheckpointStore, type PipelineStage, type JsonEvent, type PipelineProgress, type PipelineResult, type ResumePlan, type StageId, type StageResult, type StageTag } from "./types.js";
|
|
28
|
+
export interface RunPipelineDeps {
|
|
29
|
+
cwd: string;
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
runStage?: typeof defaultRunStage;
|
|
32
|
+
/**
|
|
33
|
+
* P4 deterministic verify gate (default = repo test/typecheck via bash, wrapped
|
|
34
|
+
* in R1's timeout). Runs each review round so a fix that breaks the build is
|
|
35
|
+
* caught; a non-zero exit becomes `critical` Findings fed through the same
|
|
36
|
+
* review -> fix loop, so the loop cannot stop `clean` while the build is broken.
|
|
37
|
+
* Fail-open: when no command is detectable or it cannot run, it adds no findings
|
|
38
|
+
* and records an honest note. Injected as a whole for unit testing.
|
|
39
|
+
*/
|
|
40
|
+
runVerify?: (cwd: string, signal?: AbortSignal, baselinePaths?: string[]) => Promise<VerifyOutcome>;
|
|
41
|
+
/**
|
|
42
|
+
* The REAL ticket brief (verbatim title + description) resolved from the ticket
|
|
43
|
+
* reference, injected into every stage's `{ticket}` prompt slot so the agents plan
|
|
44
|
+
* on the actual ticket, not the bare "YAG-234". Absent => the raw arg is used (the
|
|
45
|
+
* honest blind fallback). Kept off the checkpoint records, which keep the raw ref.
|
|
46
|
+
*/
|
|
47
|
+
ticketBrief?: string;
|
|
48
|
+
/**
|
|
49
|
+
* R3-b run-level budget / turn ceiling. Defaults to generous safety bounds
|
|
50
|
+
* (DEFAULT_RUN_BUDGET); when aggregate usage crosses one the run stops honestly
|
|
51
|
+
* with `budget_exceeded` rather than spending on. Tunable per lane / per caller.
|
|
52
|
+
*/
|
|
53
|
+
budget?: RunBudget;
|
|
54
|
+
/**
|
|
55
|
+
* M6 eval: the stage list to run. Defaults to selectStages("full"); the blind
|
|
56
|
+
* lane passes a grounding-tool-stripped copy (see eval.ts#blindStages).
|
|
57
|
+
*/
|
|
58
|
+
stages?: PipelineStage[];
|
|
59
|
+
/**
|
|
60
|
+
* M6 eval: when false, run the BLIND lane (grounding-free personas via
|
|
61
|
+
* personaBody's grounded flag, paired with grounding-stripped stages). Defaults
|
|
62
|
+
* true, so every real /go is grounded; nothing but the eval ever sets it false.
|
|
63
|
+
*/
|
|
64
|
+
grounded?: boolean;
|
|
65
|
+
/** Environment inherited by spawned child stages. Defaults to the parent process env. */
|
|
66
|
+
childEnv?: NodeJS.ProcessEnv;
|
|
67
|
+
/**
|
|
68
|
+
* The no-op guard's git seam (injected for unit tests). Captures the repo
|
|
69
|
+
* HEAD + porcelain status so the orchestrator can tell whether the build half
|
|
70
|
+
* actually produced a change. Defaults to a real `git` shell-out.
|
|
71
|
+
*/
|
|
72
|
+
snapshotWorkspace?: typeof defaultSnapshotWorkspace;
|
|
73
|
+
/** Structured progress signal driving the live feed's stage + header state. */
|
|
74
|
+
onProgress?: (p: PipelineProgress) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Live tap on each child's NDJSON events, already attributed to the emitting
|
|
77
|
+
* stage (and review lens / round). The review fan-out runs lenses in parallel,
|
|
78
|
+
* so each lens gets its OWN tag closure to keep interleaved events attributed.
|
|
79
|
+
*/
|
|
80
|
+
onEvent?: (ev: JsonEvent, tag: StageTag) => void;
|
|
81
|
+
logger?: (event: string, data?: unknown) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Optional pipeline-stage boundary hook. Fired at the start of every stage and
|
|
84
|
+
* at the finish of each (review rounds also carry the round + finding count).
|
|
85
|
+
* Used by /go to stream a live map→plan→implement→review→fix tracker onto the
|
|
86
|
+
* Work page. Optional + fail-soft at the call site, so existing callers/tests
|
|
87
|
+
* are unaffected and a slow/failing recorder never blocks the pipeline.
|
|
88
|
+
*
|
|
89
|
+
* `output` carries a stage's `finalOutput` ONLY on the plan FINISH boundary, so
|
|
90
|
+
* /go can record the plan onto the work item without streaming every stage's
|
|
91
|
+
* full text. It is absent on every other boundary.
|
|
92
|
+
*/
|
|
93
|
+
onStage?: (s: {
|
|
94
|
+
stage: StageId;
|
|
95
|
+
phase: "start" | "finish";
|
|
96
|
+
round?: number;
|
|
97
|
+
findings?: number;
|
|
98
|
+
output?: string;
|
|
99
|
+
}) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Optional, fail-soft durable journal seam (spec: 2026-06-29-go-resilience).
|
|
102
|
+
* When present, the orchestrator appends a checkpoint at each completed
|
|
103
|
+
* boundary (run_start / build_done / round_done) so an interrupted /go can be
|
|
104
|
+
* resumed. Like `onStage`, it is optional + side-effect-only and stays OFF the
|
|
105
|
+
* `onProgress` channel, so absent it is byte-identical to today.
|
|
106
|
+
*/
|
|
107
|
+
checkpoint?: CheckpointStore;
|
|
108
|
+
/**
|
|
109
|
+
* When the caller's `planResume` decided the run is resumable, this carries the
|
|
110
|
+
* loop re-entry point (round + reviewInput + reconstructed prior rounds). The
|
|
111
|
+
* orchestrator then SKIPS the build half entirely (the diff is already in the
|
|
112
|
+
* tree) and re-enters the bounded review→fix loop at `resumeFrom.round`.
|
|
113
|
+
*/
|
|
114
|
+
resumeFrom?: ResumePlan;
|
|
115
|
+
/** Identity stamped onto every checkpoint record (run key + backend handle). */
|
|
116
|
+
checkpointMeta?: {
|
|
117
|
+
sessionKey: string;
|
|
118
|
+
runId?: string;
|
|
119
|
+
workItemId?: string;
|
|
120
|
+
repo?: string;
|
|
121
|
+
branch?: string;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** Error thrown when a build stage fails; carries the partial run for the caller. */
|
|
125
|
+
export declare class PipelineStageError extends Error {
|
|
126
|
+
readonly stageId: string;
|
|
127
|
+
readonly partial: StageResult[];
|
|
128
|
+
constructor(stageId: string, message: string, partial: StageResult[]);
|
|
129
|
+
}
|
|
130
|
+
export declare function runPipeline(ticket: string, deps: RunPipelineDeps): Promise<PipelineResult>;
|
|
131
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|