@codeam/shared 2.75.7 → 2.75.9
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/dist/index.d.mts +108 -9
- package/dist/index.d.ts +108 -9
- package/dist/index.js +185 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +180 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -948,6 +948,13 @@ interface PackStageDef {
|
|
|
948
948
|
* 2026-08-08 — a clean Reviewer was mis-treated as "stage produced no commit".)
|
|
949
949
|
*/
|
|
950
950
|
requiresCommit?: boolean;
|
|
951
|
+
/**
|
|
952
|
+
* Whether this stage is expected to leave a structured findings file
|
|
953
|
+
* (`PACK_FINDINGS_FILE`) at the repo root, which the runner parses into
|
|
954
|
+
* `PackHandoffRecord.findings` so the NEXT stage consumes an explicit list
|
|
955
|
+
* instead of re-deriving it from prose. Review-style stages set this.
|
|
956
|
+
*/
|
|
957
|
+
producesFindings?: boolean;
|
|
951
958
|
}
|
|
952
959
|
interface PackDefinition {
|
|
953
960
|
id: PackId;
|
|
@@ -960,11 +967,44 @@ interface PackDefinition {
|
|
|
960
967
|
}
|
|
961
968
|
type PackRunStatus = 'running' | 'paused' | 'stalled' | 'completed' | 'aborted' | 'failed';
|
|
962
969
|
type PackStageStatus = 'pending' | 'active' | 'done' | 'failed' | 'skipped';
|
|
970
|
+
type PackFindingSeverity = 'blocker' | 'major' | 'minor' | 'nit';
|
|
971
|
+
type PackFindingResolution = 'fixed' | 'deferred' | 'wont_fix' | 'needs_verification';
|
|
972
|
+
/**
|
|
973
|
+
* One review finding, machine-readable. A review-style stage writes a list of
|
|
974
|
+
* these to `PACK_FINDINGS_FILE` (repo root, committed with the stage — the
|
|
975
|
+
* same rail as `SPEC.pack.md`); the runner parses the file into the stage's
|
|
976
|
+
* handoff so the next stage gets an explicit list to verify one by one, and
|
|
977
|
+
* every finding either receives a verdict downstream or is visibly open.
|
|
978
|
+
*/
|
|
979
|
+
interface PackFinding {
|
|
980
|
+
/** Stable short id the next stage references (e.g. `R1`). */
|
|
981
|
+
id: string;
|
|
982
|
+
severity: PackFindingSeverity;
|
|
983
|
+
/** One line: what is wrong. */
|
|
984
|
+
title: string;
|
|
985
|
+
/** Why it matters / what was done, a few lines at most. */
|
|
986
|
+
detail?: string;
|
|
987
|
+
/** Repo-relative path, when the finding points at code. */
|
|
988
|
+
file?: string;
|
|
989
|
+
line?: number;
|
|
990
|
+
resolution: PackFindingResolution;
|
|
991
|
+
/** Commit that resolves it, when `resolution === 'fixed'` (model-claimed; the
|
|
992
|
+
* stage's git-validated handoff commit is the authority). */
|
|
993
|
+
commit?: string;
|
|
994
|
+
}
|
|
995
|
+
/** Repo-root file a `producesFindings` stage writes. Root, NOT `.codeam/` — the
|
|
996
|
+
* workflow article forbids agents from touching the pipeline ledger. */
|
|
997
|
+
declare const PACK_FINDINGS_FILE = "REVIEW-FINDINGS.pack.json";
|
|
998
|
+
/** Upper bound on parsed findings — a runaway list is truncated, not rejected. */
|
|
999
|
+
declare const MAX_PACK_FINDINGS = 50;
|
|
1000
|
+
/** Heading every stage closes its reply with; the runner lifts the section
|
|
1001
|
+
* below it as the handoff summary instead of the reply's raw tail. */
|
|
1002
|
+
declare const PACK_HANDOFF_HEADING = "## Handoff";
|
|
963
1003
|
/** Mechanically captured proof of what a stage delivered. */
|
|
964
1004
|
interface PackHandoffRecord {
|
|
965
1005
|
/** Canonical 10-hex commit abbreviation (git-validated, never model-claimed). */
|
|
966
1006
|
commit: string;
|
|
967
|
-
/**
|
|
1007
|
+
/** The reply's `## Handoff` section when present, else its tail (capped). */
|
|
968
1008
|
summary: string;
|
|
969
1009
|
/** `git diff --stat` summary line between the stage's start and end commits. */
|
|
970
1010
|
diffStat: string;
|
|
@@ -975,6 +1015,12 @@ interface PackHandoffRecord {
|
|
|
975
1015
|
tail: string;
|
|
976
1016
|
};
|
|
977
1017
|
durationMs: number;
|
|
1018
|
+
/** Parsed `PACK_FINDINGS_FILE` for a `producesFindings` stage. Absent when
|
|
1019
|
+
* the stage does not produce findings; empty when it audited and found none. */
|
|
1020
|
+
findings?: PackFinding[];
|
|
1021
|
+
/** Why `findings` is absent/partial on a `producesFindings` stage (no file,
|
|
1022
|
+
* malformed JSON, truncated) or what an empty list checked — always honest. */
|
|
1023
|
+
findingsNote?: string;
|
|
978
1024
|
}
|
|
979
1025
|
interface PackStageState {
|
|
980
1026
|
role: string;
|
|
@@ -985,7 +1031,21 @@ interface PackStageState {
|
|
|
985
1031
|
handoff?: PackHandoffRecord;
|
|
986
1032
|
/** Populated when status === 'failed' (or the run stalled on this stage). */
|
|
987
1033
|
error?: string;
|
|
988
|
-
|
|
1034
|
+
/**
|
|
1035
|
+
* The stage's turn ended with a question for the user (a select prompt the
|
|
1036
|
+
* app renders). The run is paused, NOT nudged — the user answers in the
|
|
1037
|
+
* stage chat and taps Resume, which re-checks the stage's commit gate in the
|
|
1038
|
+
* SAME conversation instead of starting a fresh one.
|
|
1039
|
+
*/
|
|
1040
|
+
awaitingUser?: boolean;
|
|
1041
|
+
/** How many fresh conversations this stage has had (1 = first attempt). */
|
|
1042
|
+
attempts?: number;
|
|
1043
|
+
/** Canonical HEAD when the stage's current attempt began — the diff base for
|
|
1044
|
+
* its handoff, kept stable across an in-place resume. */
|
|
1045
|
+
startCommit?: string;
|
|
1046
|
+
}
|
|
1047
|
+
/** A control the user asked for mid-turn; it takes effect at the stage boundary. */
|
|
1048
|
+
type PackPendingControl = 'pause' | 'abort';
|
|
989
1049
|
interface PackRunState {
|
|
990
1050
|
runId: string;
|
|
991
1051
|
packId: PackId;
|
|
@@ -995,8 +1055,14 @@ interface PackRunState {
|
|
|
995
1055
|
/** Index into `stages` of the stage currently active/next. */
|
|
996
1056
|
currentStage: number;
|
|
997
1057
|
stages: PackStageState[];
|
|
998
|
-
/** Set when status is 'stalled' | 'failed' — the honest reason. */
|
|
1058
|
+
/** Set when status is 'stalled' | 'failed' | 'paused' with a cause — the honest reason. */
|
|
999
1059
|
stalledReason?: string;
|
|
1060
|
+
/** Canonical HEAD before the pipeline's first stage — every stage gets it so
|
|
1061
|
+
* "the pipeline's diff" is `git diff <baseCommit>..HEAD`, never a guess. */
|
|
1062
|
+
baseCommit?: string;
|
|
1063
|
+
/** Set while a pause/abort requested mid-turn waits for the stage boundary;
|
|
1064
|
+
* the UI shows "pausing after this stage" instead of a false PAUSED. */
|
|
1065
|
+
pendingControl?: PackPendingControl;
|
|
1000
1066
|
startedAt: string;
|
|
1001
1067
|
updatedAt: string;
|
|
1002
1068
|
}
|
|
@@ -1031,10 +1097,10 @@ declare function getPackDefinition(id: string): PackDefinition | null;
|
|
|
1031
1097
|
* (PACK_WORKFLOW_ARTICLE) and the task + previous handoff are appended by the
|
|
1032
1098
|
* runner at stage start.
|
|
1033
1099
|
*/
|
|
1034
|
-
declare const SPECIFIER_PROMPT = "# Role: Specifier\n\nYou turn the user's task into a precise, testable specification the rest of the pipeline implements against. You do NOT write implementation code.\n\nMethod:\n1. Read the task and explore the relevant parts of the codebase until you understand the real problem, the desired outcome, and the constraints the code imposes.\n2. Write the specification to `SPEC.pack.md` at the repo root:\n - **Problem** \u2014 what is wrong or missing, and for whom.\n - **Outcome** \u2014 what must be true when this is done.\n - **Acceptance criteria** \u2014 a numbered checklist of observable, testable conditions. Each criterion must be verifiable by a test or a concrete manual check. They must fully cover the outcome.\n - **Out of scope** \u2014 what this task deliberately does not touch.\n - **Verification plan** \u2014 for each criterion, the level that proves it (unit / integration / manual) and why.\n3. Right-size: if the task is clearly too large for one pipeline run, narrow the criteria to a coherent first slice and record the rest under \"Out of scope / next\".\n\nHandoff bar: the spec file is committed; every acceptance criterion is testable as written; a competent implementer could start without asking you anything.";
|
|
1035
|
-
declare const CODER_PROMPT = "# Role: Coder\n\nYou implement the task with test-driven discipline. You are the only stage that adds behavior.\n\nMethod:\n1. Read the task \u2014 and `SPEC.pack.md` if a Specifier stage produced one; its acceptance criteria are your contract. Without a spec, derive the minimal criteria from the task itself before coding.\n2. Test-first where it fits: write the test that proves a criterion, watch it fail, implement until it passes. Where strict test-first doesn't fit, still land tests alongside the change.\n3. Match the project's existing style, structure, and conventions. Simplest design that fully solves the problem \u2014 no speculative abstractions, no \"while I'm here\" changes.\n4. Run the project's tests / linters / build and make them pass.\n\nHandoff bar: every acceptance criterion is implemented and covered by a test; the project's checks pass; the work is committed in focused commits.";
|
|
1036
|
-
declare const REVIEWER_PROMPT = "# Role: Reviewer\n\nYou are a skeptical senior reviewer with fresh eyes \u2014 you did NOT write this code, and your job is to find what's wrong, not to approve it. You also own architectural cleanliness for this change.\n\nMethod:\n1. Read the task, `SPEC.pack.md` (when present), and the diff of the pipeline's commits (`git log` + `git diff` against the state before the pipeline's first commit). Read enough surrounding code to judge in context.\n2. Audit, in priority order:\n - **Correctness** \u2014 logic, edge cases, error paths. For each acceptance criterion: point to the test that proves it, and check the test would FAIL if the behavior broke.\n - **Scope** \u2014 anything beyond the task is flagged and reverted unless it is load-bearing.\n - **Design** \u2014 duplication, dead code, needless complexity, dependency direction, encapsulation. Verify every API/library call actually exists in the project's dependencies.\n - **Conventions & naming** \u2014 matches the surrounding code; names say what things are.\n - **Safety** \u2014 no secrets, credentials, or debugging remnants in code, tests, or fixtures.\n3. Fix what is justified \u2014 smallest change that resolves the finding, keeping behavior. Re-run the checks after material fixes.\n4.
|
|
1037
|
-
declare const QA_PROMPT = "# Role: QA\n\nYou are the final gate. You verify the delivered work against the acceptance criteria as a whole \u2014 end to end, the way a demanding user would \u2014 and produce the run's closing report.\n\nMethod:\n1. Read the task and `SPEC.pack.md` (when present). Your contract is the acceptance criteria; without a spec, derive them from the task.\n2. For EACH criterion, verify it against the real project: run the relevant tests, execute the code paths where feasible, inspect actual behavior/output. Do not take earlier stages' word for anything.\
|
|
1100
|
+
declare const SPECIFIER_PROMPT = "# Role: Specifier\n\nYou turn the user's task into a precise, testable specification the rest of the pipeline implements against. You do NOT write implementation code.\n\nMethod:\n1. Read the task and explore the relevant parts of the codebase until you understand the real problem, the desired outcome, and the constraints the code imposes.\n2. Write the specification to `SPEC.pack.md` at the repo root:\n - **Problem** \u2014 what is wrong or missing, and for whom.\n - **Outcome** \u2014 what must be true when this is done.\n - **Acceptance criteria** \u2014 a numbered checklist of observable, testable conditions. Each criterion must be verifiable by a test or a concrete manual check. They must fully cover the outcome.\n - **Out of scope** \u2014 what this task deliberately does not touch.\n - **Verification plan** \u2014 for each criterion, the level that proves it (unit / integration / manual) and why.\n3. Right-size: if the task is clearly too large for one pipeline run, narrow the criteria to a coherent first slice and record the rest under \"Out of scope / next\".\n\n4. Close with a `## Handoff` section: the criteria count, what you scoped out, and any assumption the Coder must know.\n\nHandoff bar: the spec file is committed; every acceptance criterion is testable as written; a competent implementer could start without asking you anything.";
|
|
1101
|
+
declare const CODER_PROMPT = "# Role: Coder\n\nYou implement the task with test-driven discipline. You are the only stage that adds behavior.\n\nMethod:\n1. Read the task \u2014 and `SPEC.pack.md` if a Specifier stage produced one; its acceptance criteria are your contract. Without a spec, derive the minimal criteria from the task itself before coding.\n2. Test-first where it fits: write the test that proves a criterion, watch it fail, implement until it passes. Where strict test-first doesn't fit, still land tests alongside the change.\n3. Match the project's existing style, structure, and conventions. Simplest design that fully solves the problem \u2014 no speculative abstractions, no \"while I'm here\" changes.\n4. Run the project's tests / linters / build and make them pass.\n5. Close with a `## Handoff` section: which criteria are implemented (by number) and where their tests live, anything you consciously did NOT do, and what the Reviewer should look at first.\n\nHandoff bar: every acceptance criterion is implemented and covered by a test; the project's checks pass; the work is committed in focused commits.";
|
|
1102
|
+
declare const REVIEWER_PROMPT = "# Role: Reviewer\n\nYou are a skeptical senior reviewer with fresh eyes \u2014 you did NOT write this code, and your job is to find what's wrong, not to approve it. You also own architectural cleanliness for this change.\n\nMethod:\n1. Read the task, `SPEC.pack.md` (when present), and the diff of the pipeline's commits (`git log` + `git diff` against the state before the pipeline's first commit). Read enough surrounding code to judge in context.\n2. Audit, in priority order:\n - **Correctness** \u2014 logic, edge cases, error paths. For each acceptance criterion: point to the test that proves it, and check the test would FAIL if the behavior broke.\n - **Scope** \u2014 anything beyond the task is flagged and reverted unless it is load-bearing.\n - **Design** \u2014 duplication, dead code, needless complexity, dependency direction, encapsulation. Verify every API/library call actually exists in the project's dependencies.\n - **Conventions & naming** \u2014 matches the surrounding code; names say what things are.\n - **Safety** \u2014 no secrets, credentials, or debugging remnants in code, tests, or fixtures.\n3. Fix what is justified \u2014 smallest change that resolves the finding, keeping behavior. Re-run the checks after material fixes.\n4. Write your findings as DATA to `REVIEW-FINDINGS.pack.json` at the repo root \u2014 the next stage verifies them one by one, so what is not in this file does not get verified. Exact shape:\n ```json\n {\n \"findings\": [\n {\n \"id\": \"R1\",\n \"severity\": \"blocker | major | minor | nit\",\n \"title\": \"one line: what is wrong\",\n \"detail\": \"why it matters and what you did about it\",\n \"file\": \"src/path/to/file.ts\",\n \"line\": 42,\n \"resolution\": \"fixed | deferred | wont_fix | needs_verification\",\n \"commit\": \"abcdef1234\"\n }\n ],\n \"checked\": [\"what you audited when the list is empty: e.g. error paths of X, test coverage of Y\"]\n }\n ```\n Every finding you fixed says `fixed` with its commit; anything you deliberately left says `deferred` or `wont_fix` with the reason in `detail`; anything you could not verify says `needs_verification`. An empty `findings` array is a valid, honest result \u2014 then `checked` must say what you looked at. Commit this file with your stage.\n5. Close with a `## Handoff` section: what you found (counts by severity), what you fixed, what you deliberately left, and what the next stage must verify.\n\nHandoff bar: checks pass on YOUR final commit; every fix is committed; `REVIEW-FINDINGS.pack.json` is committed and lists every finding with its resolution (an empty list says what you checked).";
|
|
1103
|
+
declare const QA_PROMPT = "# Role: QA\n\nYou are the final gate. You verify the delivered work against the acceptance criteria as a whole \u2014 end to end, the way a demanding user would \u2014 and produce the run's closing report.\n\nMethod:\n1. Read the task and `SPEC.pack.md` (when present). Your contract is the acceptance criteria; without a spec, derive them from the task.\n2. Read `REVIEW-FINDINGS.pack.json` (when present \u2014 the Reviewer's structured findings, also summarized in your handoff input). Every finding there is an item on YOUR checklist: a `fixed` one must be verified fixed without regression; a `deferred`/`wont_fix` one must be judged acceptable or escalated; a `needs_verification` one is yours to settle.\n3. For EACH criterion, verify it against the real project: run the relevant tests, execute the code paths where feasible, inspect actual behavior/output. Do not take earlier stages' word for anything.\n4. Run the project's full checks (tests, lint, types, build) one final time.\n5. Write `QA-REPORT.pack.md` at the repo root with two sections: **Acceptance criteria** \u2014 per-criterion verdict (\u2705 verified / \u26A0\uFE0F partially / \u274C failed \u2014 with evidence for each); **Review findings** \u2014 per finding id, verdict (\u2705 verified fixed / \u26A0\uFE0F still open / \u274C regressed \u2014 with evidence). Then the checks' results, anything not verifiable in this environment (stated plainly), and a short \"ready to ship?\" conclusion.\n6. If a criterion FAILS: fix it only when the fix is small and unambiguous; otherwise mark it failed with exact evidence \u2014 the user decides. Never paper over a failure.\n7. Close with a `## Handoff` section: the ship/no-ship conclusion, the failed or open items by id, and what you could not verify.\n\nHandoff bar: the report is committed; every verdict carries evidence; every finding id from the Reviewer appears in the report; the conclusion is honest about anything unverified.";
|
|
1038
1104
|
|
|
1039
1105
|
/**
|
|
1040
1106
|
* The pack **workflow article** — the shared constitution layer every stage
|
|
@@ -1043,7 +1109,40 @@ declare const QA_PROMPT = "# Role: QA\n\nYou are the final gate. You verify the
|
|
|
1043
1109
|
* commit per stage with the role byline, stay in stage scope, never touch the
|
|
1044
1110
|
* run ledger. Layered-constitution model adapted from swarm-forge.
|
|
1045
1111
|
*/
|
|
1046
|
-
declare const PACK_WORKFLOW_ARTICLE = "## Pipeline rules (you are one stage of an assembly line)\n\nYou are ONE specialist role in a multi-role pipeline running on this repository. Other specialist roles ran before you and/or run after you, each in a separate conversation. Follow these rules exactly:\n\n- **Do only your role's job.** The next stage exists for a reason \u2014 don't do its work, and don't redo a previous stage's work unless your role explicitly calls for correcting it.\n- **Work from the handoff.** The previous stage's handoff (commit + summary) is your input. Start by reading the current state of the working tree \u2014 it already contains all prior stages' work.\n- **Commit your work when your stage is complete.** One or more focused commits; the final state of the tree IS your handoff to the next stage. End every commit message with your role byline on its own line: `By <role>.`\n- **Never leave the tree broken.** Run the project's checks before finishing when the project has them; your stage ends with a working tree the next role can build on.\n- **Do not push, force-push, or touch remotes** \u2014 the pipeline works locally; publishing is the user's call at the end.\n- **Never read, edit, or commit anything under `.codeam/`** \u2014 that is the pipeline's own ledger, not project code.\n- **Finish
|
|
1112
|
+
declare const PACK_WORKFLOW_ARTICLE = "## Pipeline rules (you are one stage of an assembly line)\n\nYou are ONE specialist role in a multi-role pipeline running on this repository. Other specialist roles ran before you and/or run after you, each in a separate conversation. Follow these rules exactly:\n\n- **Do only your role's job.** The next stage exists for a reason \u2014 don't do its work, and don't redo a previous stage's work unless your role explicitly calls for correcting it.\n- **Work from the handoff.** The previous stage's handoff (commit + summary) is your input. Start by reading the current state of the working tree \u2014 it already contains all prior stages' work.\n- **Commit your work when your stage is complete.** One or more focused commits; the final state of the tree IS your handoff to the next stage. End every commit message with your role byline on its own line: `By <role>.`\n- **Never leave the tree broken.** Run the project's checks before finishing when the project has them; your stage ends with a working tree the next role can build on.\n- **Do not push, force-push, or touch remotes** \u2014 the pipeline works locally; publishing is the user's call at the end.\n- **Never read, edit, or commit anything under `.codeam/`** \u2014 that is the pipeline's own ledger, not project code.\n- **Finish with a `## Handoff` section.** When your stage's job is done and committed, end your reply with a heading `## Handoff` followed by 2-6 lines: what you did, what you verified, anything the next stage must know. That section \u2014 not the rest of your reply \u2014 is what the next role receives. Don't ask \"should I continue?\" \u2014 the pipeline advances automatically.\n- **If you need the user's decision** (contradictory requirements, a real product choice), ask ONE clear question and end your reply with 2-4 numbered options on their own lines (`1. \u2026`), then stop. The pipeline pauses until they answer in this conversation; keep working in it once they do, and commit as usual.\n- **If you are genuinely blocked** (missing access, a broken environment you cannot fix), say exactly what is blocking you and stop \u2014 the user is supervising and will decide.";
|
|
1113
|
+
|
|
1114
|
+
interface ParsedPackFindings {
|
|
1115
|
+
findings: PackFinding[];
|
|
1116
|
+
/** What an empty list audited (`checked` in the file), when the stage said so. */
|
|
1117
|
+
checked?: string[];
|
|
1118
|
+
/** Human-readable caveat: entries dropped, list truncated. Absent when clean. */
|
|
1119
|
+
note?: string;
|
|
1120
|
+
}
|
|
1121
|
+
type PackFindingsParseResult = {
|
|
1122
|
+
ok: true;
|
|
1123
|
+
value: ParsedPackFindings;
|
|
1124
|
+
} | {
|
|
1125
|
+
ok: false;
|
|
1126
|
+
error: string;
|
|
1127
|
+
};
|
|
1128
|
+
/**
|
|
1129
|
+
* Parse the contents of `PACK_FINDINGS_FILE`. Accepts the documented shape
|
|
1130
|
+
* `{ "findings": [...], "checked"?: [...] }`, a bare array, and either wrapped
|
|
1131
|
+
* in a markdown fence. Individual entries are validated one by one: a bad entry
|
|
1132
|
+
* is dropped and counted in `note`, it never poisons the rest. Unknown
|
|
1133
|
+
* severity/resolution values are coerced to the conservative end
|
|
1134
|
+
* (`major` / `needs_verification`) rather than dropped — a mislabeled finding
|
|
1135
|
+
* is still a finding the next stage must look at.
|
|
1136
|
+
*/
|
|
1137
|
+
declare function parsePackFindings(raw: string): PackFindingsParseResult;
|
|
1138
|
+
/**
|
|
1139
|
+
* Lift the `## Handoff` section from a stage reply (the workflow article asks
|
|
1140
|
+
* every stage to close with one). Returns null when the reply has no such
|
|
1141
|
+
* heading, so callers fall back to the reply's tail. Case-insensitive on the
|
|
1142
|
+
* heading text, tolerant of `#`/`###`, stops at the next heading of the same
|
|
1143
|
+
* or higher level.
|
|
1144
|
+
*/
|
|
1145
|
+
declare function extractHandoffSection(reply: string): string | null;
|
|
1047
1146
|
|
|
1048
1147
|
/**
|
|
1049
1148
|
* Wire-shape types for the CLI / IDE-plugin → backend producer endpoints
|
|
@@ -1989,4 +2088,4 @@ type UserEventName = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
|
|
|
1989
2088
|
*/
|
|
1990
2089
|
declare const PREVIEW_DETECT_PROMPT: string;
|
|
1991
2090
|
|
|
1992
|
-
export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type AwaitingAnswerOption, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, CODER_PROMPT, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HANDOFF_FENCE_TAG, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HandoffProposal, type HandoffResolution, type HunkLineType, INSTALL_SNIPPETS, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MANAGED_AGENT_ENV, MANAGED_AGENT_SUBTITLE, MANAGED_PROVIDER_DISPLAY_NAMES, MANAGED_PROVIDER_IDS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackHandoffRecord, type PackId, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SPECIFIER_PROMPT, SQUAD_CONFIGURE_COMMAND, SQUAD_HOP_BUDGET_DEFAULT, SQUAD_HOP_BUDGET_MAX, SQUAD_HOP_BUDGET_MIN, SQUAD_SPECIALTIES, SQUAD_STATS_COMMAND, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, SWITCH_AGENT_COMMAND, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type SquadAutoConfig, type SquadConfigurePayload, type SquadConfigureResult, type SquadMemberActivity, type SquadRosterAgent, type SquadRosterData, type SquadStatsResult, type StartTaskFailedResult, type StartTaskPayload, type StreamingChunkEvent, type StreamingChunkKind, type SwitchAgentCommand, type SwitchAgentResult, type SwitchAgentStatus, type SwitchAgentStep, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, clampHopBudget, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, installableAgentIds, internalToPublic, isGuardrailDisposition, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
|
|
2091
|
+
export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type AwaitingAnswerOption, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, CODER_PROMPT, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HANDOFF_FENCE_TAG, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HandoffProposal, type HandoffResolution, type HunkLineType, INSTALL_SNIPPETS, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MANAGED_AGENT_ENV, MANAGED_AGENT_SUBTITLE, MANAGED_PROVIDER_DISPLAY_NAMES, MANAGED_PROVIDER_IDS, MAX_PACK_FINDINGS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_FINDINGS_FILE, PACK_HANDOFF_HEADING, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackFinding, type PackFindingResolution, type PackFindingSeverity, type PackFindingsParseResult, type PackHandoffRecord, type PackId, type PackPendingControl, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type ParsedPackFindings, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SPECIFIER_PROMPT, SQUAD_CONFIGURE_COMMAND, SQUAD_HOP_BUDGET_DEFAULT, SQUAD_HOP_BUDGET_MAX, SQUAD_HOP_BUDGET_MIN, SQUAD_SPECIALTIES, SQUAD_STATS_COMMAND, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, SWITCH_AGENT_COMMAND, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type SquadAutoConfig, type SquadConfigurePayload, type SquadConfigureResult, type SquadMemberActivity, type SquadRosterAgent, type SquadRosterData, type SquadStatsResult, type StartTaskFailedResult, type StartTaskPayload, type StreamingChunkEvent, type StreamingChunkKind, type SwitchAgentCommand, type SwitchAgentResult, type SwitchAgentStatus, type SwitchAgentStep, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, clampHopBudget, classifyStack, detectedIntegrationsFromDeps, extractHandoffSection, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, installableAgentIds, internalToPublic, isGuardrailDisposition, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, parsePackFindings, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
|
package/dist/index.d.ts
CHANGED
|
@@ -948,6 +948,13 @@ interface PackStageDef {
|
|
|
948
948
|
* 2026-08-08 — a clean Reviewer was mis-treated as "stage produced no commit".)
|
|
949
949
|
*/
|
|
950
950
|
requiresCommit?: boolean;
|
|
951
|
+
/**
|
|
952
|
+
* Whether this stage is expected to leave a structured findings file
|
|
953
|
+
* (`PACK_FINDINGS_FILE`) at the repo root, which the runner parses into
|
|
954
|
+
* `PackHandoffRecord.findings` so the NEXT stage consumes an explicit list
|
|
955
|
+
* instead of re-deriving it from prose. Review-style stages set this.
|
|
956
|
+
*/
|
|
957
|
+
producesFindings?: boolean;
|
|
951
958
|
}
|
|
952
959
|
interface PackDefinition {
|
|
953
960
|
id: PackId;
|
|
@@ -960,11 +967,44 @@ interface PackDefinition {
|
|
|
960
967
|
}
|
|
961
968
|
type PackRunStatus = 'running' | 'paused' | 'stalled' | 'completed' | 'aborted' | 'failed';
|
|
962
969
|
type PackStageStatus = 'pending' | 'active' | 'done' | 'failed' | 'skipped';
|
|
970
|
+
type PackFindingSeverity = 'blocker' | 'major' | 'minor' | 'nit';
|
|
971
|
+
type PackFindingResolution = 'fixed' | 'deferred' | 'wont_fix' | 'needs_verification';
|
|
972
|
+
/**
|
|
973
|
+
* One review finding, machine-readable. A review-style stage writes a list of
|
|
974
|
+
* these to `PACK_FINDINGS_FILE` (repo root, committed with the stage — the
|
|
975
|
+
* same rail as `SPEC.pack.md`); the runner parses the file into the stage's
|
|
976
|
+
* handoff so the next stage gets an explicit list to verify one by one, and
|
|
977
|
+
* every finding either receives a verdict downstream or is visibly open.
|
|
978
|
+
*/
|
|
979
|
+
interface PackFinding {
|
|
980
|
+
/** Stable short id the next stage references (e.g. `R1`). */
|
|
981
|
+
id: string;
|
|
982
|
+
severity: PackFindingSeverity;
|
|
983
|
+
/** One line: what is wrong. */
|
|
984
|
+
title: string;
|
|
985
|
+
/** Why it matters / what was done, a few lines at most. */
|
|
986
|
+
detail?: string;
|
|
987
|
+
/** Repo-relative path, when the finding points at code. */
|
|
988
|
+
file?: string;
|
|
989
|
+
line?: number;
|
|
990
|
+
resolution: PackFindingResolution;
|
|
991
|
+
/** Commit that resolves it, when `resolution === 'fixed'` (model-claimed; the
|
|
992
|
+
* stage's git-validated handoff commit is the authority). */
|
|
993
|
+
commit?: string;
|
|
994
|
+
}
|
|
995
|
+
/** Repo-root file a `producesFindings` stage writes. Root, NOT `.codeam/` — the
|
|
996
|
+
* workflow article forbids agents from touching the pipeline ledger. */
|
|
997
|
+
declare const PACK_FINDINGS_FILE = "REVIEW-FINDINGS.pack.json";
|
|
998
|
+
/** Upper bound on parsed findings — a runaway list is truncated, not rejected. */
|
|
999
|
+
declare const MAX_PACK_FINDINGS = 50;
|
|
1000
|
+
/** Heading every stage closes its reply with; the runner lifts the section
|
|
1001
|
+
* below it as the handoff summary instead of the reply's raw tail. */
|
|
1002
|
+
declare const PACK_HANDOFF_HEADING = "## Handoff";
|
|
963
1003
|
/** Mechanically captured proof of what a stage delivered. */
|
|
964
1004
|
interface PackHandoffRecord {
|
|
965
1005
|
/** Canonical 10-hex commit abbreviation (git-validated, never model-claimed). */
|
|
966
1006
|
commit: string;
|
|
967
|
-
/**
|
|
1007
|
+
/** The reply's `## Handoff` section when present, else its tail (capped). */
|
|
968
1008
|
summary: string;
|
|
969
1009
|
/** `git diff --stat` summary line between the stage's start and end commits. */
|
|
970
1010
|
diffStat: string;
|
|
@@ -975,6 +1015,12 @@ interface PackHandoffRecord {
|
|
|
975
1015
|
tail: string;
|
|
976
1016
|
};
|
|
977
1017
|
durationMs: number;
|
|
1018
|
+
/** Parsed `PACK_FINDINGS_FILE` for a `producesFindings` stage. Absent when
|
|
1019
|
+
* the stage does not produce findings; empty when it audited and found none. */
|
|
1020
|
+
findings?: PackFinding[];
|
|
1021
|
+
/** Why `findings` is absent/partial on a `producesFindings` stage (no file,
|
|
1022
|
+
* malformed JSON, truncated) or what an empty list checked — always honest. */
|
|
1023
|
+
findingsNote?: string;
|
|
978
1024
|
}
|
|
979
1025
|
interface PackStageState {
|
|
980
1026
|
role: string;
|
|
@@ -985,7 +1031,21 @@ interface PackStageState {
|
|
|
985
1031
|
handoff?: PackHandoffRecord;
|
|
986
1032
|
/** Populated when status === 'failed' (or the run stalled on this stage). */
|
|
987
1033
|
error?: string;
|
|
988
|
-
|
|
1034
|
+
/**
|
|
1035
|
+
* The stage's turn ended with a question for the user (a select prompt the
|
|
1036
|
+
* app renders). The run is paused, NOT nudged — the user answers in the
|
|
1037
|
+
* stage chat and taps Resume, which re-checks the stage's commit gate in the
|
|
1038
|
+
* SAME conversation instead of starting a fresh one.
|
|
1039
|
+
*/
|
|
1040
|
+
awaitingUser?: boolean;
|
|
1041
|
+
/** How many fresh conversations this stage has had (1 = first attempt). */
|
|
1042
|
+
attempts?: number;
|
|
1043
|
+
/** Canonical HEAD when the stage's current attempt began — the diff base for
|
|
1044
|
+
* its handoff, kept stable across an in-place resume. */
|
|
1045
|
+
startCommit?: string;
|
|
1046
|
+
}
|
|
1047
|
+
/** A control the user asked for mid-turn; it takes effect at the stage boundary. */
|
|
1048
|
+
type PackPendingControl = 'pause' | 'abort';
|
|
989
1049
|
interface PackRunState {
|
|
990
1050
|
runId: string;
|
|
991
1051
|
packId: PackId;
|
|
@@ -995,8 +1055,14 @@ interface PackRunState {
|
|
|
995
1055
|
/** Index into `stages` of the stage currently active/next. */
|
|
996
1056
|
currentStage: number;
|
|
997
1057
|
stages: PackStageState[];
|
|
998
|
-
/** Set when status is 'stalled' | 'failed' — the honest reason. */
|
|
1058
|
+
/** Set when status is 'stalled' | 'failed' | 'paused' with a cause — the honest reason. */
|
|
999
1059
|
stalledReason?: string;
|
|
1060
|
+
/** Canonical HEAD before the pipeline's first stage — every stage gets it so
|
|
1061
|
+
* "the pipeline's diff" is `git diff <baseCommit>..HEAD`, never a guess. */
|
|
1062
|
+
baseCommit?: string;
|
|
1063
|
+
/** Set while a pause/abort requested mid-turn waits for the stage boundary;
|
|
1064
|
+
* the UI shows "pausing after this stage" instead of a false PAUSED. */
|
|
1065
|
+
pendingControl?: PackPendingControl;
|
|
1000
1066
|
startedAt: string;
|
|
1001
1067
|
updatedAt: string;
|
|
1002
1068
|
}
|
|
@@ -1031,10 +1097,10 @@ declare function getPackDefinition(id: string): PackDefinition | null;
|
|
|
1031
1097
|
* (PACK_WORKFLOW_ARTICLE) and the task + previous handoff are appended by the
|
|
1032
1098
|
* runner at stage start.
|
|
1033
1099
|
*/
|
|
1034
|
-
declare const SPECIFIER_PROMPT = "# Role: Specifier\n\nYou turn the user's task into a precise, testable specification the rest of the pipeline implements against. You do NOT write implementation code.\n\nMethod:\n1. Read the task and explore the relevant parts of the codebase until you understand the real problem, the desired outcome, and the constraints the code imposes.\n2. Write the specification to `SPEC.pack.md` at the repo root:\n - **Problem** \u2014 what is wrong or missing, and for whom.\n - **Outcome** \u2014 what must be true when this is done.\n - **Acceptance criteria** \u2014 a numbered checklist of observable, testable conditions. Each criterion must be verifiable by a test or a concrete manual check. They must fully cover the outcome.\n - **Out of scope** \u2014 what this task deliberately does not touch.\n - **Verification plan** \u2014 for each criterion, the level that proves it (unit / integration / manual) and why.\n3. Right-size: if the task is clearly too large for one pipeline run, narrow the criteria to a coherent first slice and record the rest under \"Out of scope / next\".\n\nHandoff bar: the spec file is committed; every acceptance criterion is testable as written; a competent implementer could start without asking you anything.";
|
|
1035
|
-
declare const CODER_PROMPT = "# Role: Coder\n\nYou implement the task with test-driven discipline. You are the only stage that adds behavior.\n\nMethod:\n1. Read the task \u2014 and `SPEC.pack.md` if a Specifier stage produced one; its acceptance criteria are your contract. Without a spec, derive the minimal criteria from the task itself before coding.\n2. Test-first where it fits: write the test that proves a criterion, watch it fail, implement until it passes. Where strict test-first doesn't fit, still land tests alongside the change.\n3. Match the project's existing style, structure, and conventions. Simplest design that fully solves the problem \u2014 no speculative abstractions, no \"while I'm here\" changes.\n4. Run the project's tests / linters / build and make them pass.\n\nHandoff bar: every acceptance criterion is implemented and covered by a test; the project's checks pass; the work is committed in focused commits.";
|
|
1036
|
-
declare const REVIEWER_PROMPT = "# Role: Reviewer\n\nYou are a skeptical senior reviewer with fresh eyes \u2014 you did NOT write this code, and your job is to find what's wrong, not to approve it. You also own architectural cleanliness for this change.\n\nMethod:\n1. Read the task, `SPEC.pack.md` (when present), and the diff of the pipeline's commits (`git log` + `git diff` against the state before the pipeline's first commit). Read enough surrounding code to judge in context.\n2. Audit, in priority order:\n - **Correctness** \u2014 logic, edge cases, error paths. For each acceptance criterion: point to the test that proves it, and check the test would FAIL if the behavior broke.\n - **Scope** \u2014 anything beyond the task is flagged and reverted unless it is load-bearing.\n - **Design** \u2014 duplication, dead code, needless complexity, dependency direction, encapsulation. Verify every API/library call actually exists in the project's dependencies.\n - **Conventions & naming** \u2014 matches the surrounding code; names say what things are.\n - **Safety** \u2014 no secrets, credentials, or debugging remnants in code, tests, or fixtures.\n3. Fix what is justified \u2014 smallest change that resolves the finding, keeping behavior. Re-run the checks after material fixes.\n4.
|
|
1037
|
-
declare const QA_PROMPT = "# Role: QA\n\nYou are the final gate. You verify the delivered work against the acceptance criteria as a whole \u2014 end to end, the way a demanding user would \u2014 and produce the run's closing report.\n\nMethod:\n1. Read the task and `SPEC.pack.md` (when present). Your contract is the acceptance criteria; without a spec, derive them from the task.\n2. For EACH criterion, verify it against the real project: run the relevant tests, execute the code paths where feasible, inspect actual behavior/output. Do not take earlier stages' word for anything.\
|
|
1100
|
+
declare const SPECIFIER_PROMPT = "# Role: Specifier\n\nYou turn the user's task into a precise, testable specification the rest of the pipeline implements against. You do NOT write implementation code.\n\nMethod:\n1. Read the task and explore the relevant parts of the codebase until you understand the real problem, the desired outcome, and the constraints the code imposes.\n2. Write the specification to `SPEC.pack.md` at the repo root:\n - **Problem** \u2014 what is wrong or missing, and for whom.\n - **Outcome** \u2014 what must be true when this is done.\n - **Acceptance criteria** \u2014 a numbered checklist of observable, testable conditions. Each criterion must be verifiable by a test or a concrete manual check. They must fully cover the outcome.\n - **Out of scope** \u2014 what this task deliberately does not touch.\n - **Verification plan** \u2014 for each criterion, the level that proves it (unit / integration / manual) and why.\n3. Right-size: if the task is clearly too large for one pipeline run, narrow the criteria to a coherent first slice and record the rest under \"Out of scope / next\".\n\n4. Close with a `## Handoff` section: the criteria count, what you scoped out, and any assumption the Coder must know.\n\nHandoff bar: the spec file is committed; every acceptance criterion is testable as written; a competent implementer could start without asking you anything.";
|
|
1101
|
+
declare const CODER_PROMPT = "# Role: Coder\n\nYou implement the task with test-driven discipline. You are the only stage that adds behavior.\n\nMethod:\n1. Read the task \u2014 and `SPEC.pack.md` if a Specifier stage produced one; its acceptance criteria are your contract. Without a spec, derive the minimal criteria from the task itself before coding.\n2. Test-first where it fits: write the test that proves a criterion, watch it fail, implement until it passes. Where strict test-first doesn't fit, still land tests alongside the change.\n3. Match the project's existing style, structure, and conventions. Simplest design that fully solves the problem \u2014 no speculative abstractions, no \"while I'm here\" changes.\n4. Run the project's tests / linters / build and make them pass.\n5. Close with a `## Handoff` section: which criteria are implemented (by number) and where their tests live, anything you consciously did NOT do, and what the Reviewer should look at first.\n\nHandoff bar: every acceptance criterion is implemented and covered by a test; the project's checks pass; the work is committed in focused commits.";
|
|
1102
|
+
declare const REVIEWER_PROMPT = "# Role: Reviewer\n\nYou are a skeptical senior reviewer with fresh eyes \u2014 you did NOT write this code, and your job is to find what's wrong, not to approve it. You also own architectural cleanliness for this change.\n\nMethod:\n1. Read the task, `SPEC.pack.md` (when present), and the diff of the pipeline's commits (`git log` + `git diff` against the state before the pipeline's first commit). Read enough surrounding code to judge in context.\n2. Audit, in priority order:\n - **Correctness** \u2014 logic, edge cases, error paths. For each acceptance criterion: point to the test that proves it, and check the test would FAIL if the behavior broke.\n - **Scope** \u2014 anything beyond the task is flagged and reverted unless it is load-bearing.\n - **Design** \u2014 duplication, dead code, needless complexity, dependency direction, encapsulation. Verify every API/library call actually exists in the project's dependencies.\n - **Conventions & naming** \u2014 matches the surrounding code; names say what things are.\n - **Safety** \u2014 no secrets, credentials, or debugging remnants in code, tests, or fixtures.\n3. Fix what is justified \u2014 smallest change that resolves the finding, keeping behavior. Re-run the checks after material fixes.\n4. Write your findings as DATA to `REVIEW-FINDINGS.pack.json` at the repo root \u2014 the next stage verifies them one by one, so what is not in this file does not get verified. Exact shape:\n ```json\n {\n \"findings\": [\n {\n \"id\": \"R1\",\n \"severity\": \"blocker | major | minor | nit\",\n \"title\": \"one line: what is wrong\",\n \"detail\": \"why it matters and what you did about it\",\n \"file\": \"src/path/to/file.ts\",\n \"line\": 42,\n \"resolution\": \"fixed | deferred | wont_fix | needs_verification\",\n \"commit\": \"abcdef1234\"\n }\n ],\n \"checked\": [\"what you audited when the list is empty: e.g. error paths of X, test coverage of Y\"]\n }\n ```\n Every finding you fixed says `fixed` with its commit; anything you deliberately left says `deferred` or `wont_fix` with the reason in `detail`; anything you could not verify says `needs_verification`. An empty `findings` array is a valid, honest result \u2014 then `checked` must say what you looked at. Commit this file with your stage.\n5. Close with a `## Handoff` section: what you found (counts by severity), what you fixed, what you deliberately left, and what the next stage must verify.\n\nHandoff bar: checks pass on YOUR final commit; every fix is committed; `REVIEW-FINDINGS.pack.json` is committed and lists every finding with its resolution (an empty list says what you checked).";
|
|
1103
|
+
declare const QA_PROMPT = "# Role: QA\n\nYou are the final gate. You verify the delivered work against the acceptance criteria as a whole \u2014 end to end, the way a demanding user would \u2014 and produce the run's closing report.\n\nMethod:\n1. Read the task and `SPEC.pack.md` (when present). Your contract is the acceptance criteria; without a spec, derive them from the task.\n2. Read `REVIEW-FINDINGS.pack.json` (when present \u2014 the Reviewer's structured findings, also summarized in your handoff input). Every finding there is an item on YOUR checklist: a `fixed` one must be verified fixed without regression; a `deferred`/`wont_fix` one must be judged acceptable or escalated; a `needs_verification` one is yours to settle.\n3. For EACH criterion, verify it against the real project: run the relevant tests, execute the code paths where feasible, inspect actual behavior/output. Do not take earlier stages' word for anything.\n4. Run the project's full checks (tests, lint, types, build) one final time.\n5. Write `QA-REPORT.pack.md` at the repo root with two sections: **Acceptance criteria** \u2014 per-criterion verdict (\u2705 verified / \u26A0\uFE0F partially / \u274C failed \u2014 with evidence for each); **Review findings** \u2014 per finding id, verdict (\u2705 verified fixed / \u26A0\uFE0F still open / \u274C regressed \u2014 with evidence). Then the checks' results, anything not verifiable in this environment (stated plainly), and a short \"ready to ship?\" conclusion.\n6. If a criterion FAILS: fix it only when the fix is small and unambiguous; otherwise mark it failed with exact evidence \u2014 the user decides. Never paper over a failure.\n7. Close with a `## Handoff` section: the ship/no-ship conclusion, the failed or open items by id, and what you could not verify.\n\nHandoff bar: the report is committed; every verdict carries evidence; every finding id from the Reviewer appears in the report; the conclusion is honest about anything unverified.";
|
|
1038
1104
|
|
|
1039
1105
|
/**
|
|
1040
1106
|
* The pack **workflow article** — the shared constitution layer every stage
|
|
@@ -1043,7 +1109,40 @@ declare const QA_PROMPT = "# Role: QA\n\nYou are the final gate. You verify the
|
|
|
1043
1109
|
* commit per stage with the role byline, stay in stage scope, never touch the
|
|
1044
1110
|
* run ledger. Layered-constitution model adapted from swarm-forge.
|
|
1045
1111
|
*/
|
|
1046
|
-
declare const PACK_WORKFLOW_ARTICLE = "## Pipeline rules (you are one stage of an assembly line)\n\nYou are ONE specialist role in a multi-role pipeline running on this repository. Other specialist roles ran before you and/or run after you, each in a separate conversation. Follow these rules exactly:\n\n- **Do only your role's job.** The next stage exists for a reason \u2014 don't do its work, and don't redo a previous stage's work unless your role explicitly calls for correcting it.\n- **Work from the handoff.** The previous stage's handoff (commit + summary) is your input. Start by reading the current state of the working tree \u2014 it already contains all prior stages' work.\n- **Commit your work when your stage is complete.** One or more focused commits; the final state of the tree IS your handoff to the next stage. End every commit message with your role byline on its own line: `By <role>.`\n- **Never leave the tree broken.** Run the project's checks before finishing when the project has them; your stage ends with a working tree the next role can build on.\n- **Do not push, force-push, or touch remotes** \u2014 the pipeline works locally; publishing is the user's call at the end.\n- **Never read, edit, or commit anything under `.codeam/`** \u2014 that is the pipeline's own ledger, not project code.\n- **Finish
|
|
1112
|
+
declare const PACK_WORKFLOW_ARTICLE = "## Pipeline rules (you are one stage of an assembly line)\n\nYou are ONE specialist role in a multi-role pipeline running on this repository. Other specialist roles ran before you and/or run after you, each in a separate conversation. Follow these rules exactly:\n\n- **Do only your role's job.** The next stage exists for a reason \u2014 don't do its work, and don't redo a previous stage's work unless your role explicitly calls for correcting it.\n- **Work from the handoff.** The previous stage's handoff (commit + summary) is your input. Start by reading the current state of the working tree \u2014 it already contains all prior stages' work.\n- **Commit your work when your stage is complete.** One or more focused commits; the final state of the tree IS your handoff to the next stage. End every commit message with your role byline on its own line: `By <role>.`\n- **Never leave the tree broken.** Run the project's checks before finishing when the project has them; your stage ends with a working tree the next role can build on.\n- **Do not push, force-push, or touch remotes** \u2014 the pipeline works locally; publishing is the user's call at the end.\n- **Never read, edit, or commit anything under `.codeam/`** \u2014 that is the pipeline's own ledger, not project code.\n- **Finish with a `## Handoff` section.** When your stage's job is done and committed, end your reply with a heading `## Handoff` followed by 2-6 lines: what you did, what you verified, anything the next stage must know. That section \u2014 not the rest of your reply \u2014 is what the next role receives. Don't ask \"should I continue?\" \u2014 the pipeline advances automatically.\n- **If you need the user's decision** (contradictory requirements, a real product choice), ask ONE clear question and end your reply with 2-4 numbered options on their own lines (`1. \u2026`), then stop. The pipeline pauses until they answer in this conversation; keep working in it once they do, and commit as usual.\n- **If you are genuinely blocked** (missing access, a broken environment you cannot fix), say exactly what is blocking you and stop \u2014 the user is supervising and will decide.";
|
|
1113
|
+
|
|
1114
|
+
interface ParsedPackFindings {
|
|
1115
|
+
findings: PackFinding[];
|
|
1116
|
+
/** What an empty list audited (`checked` in the file), when the stage said so. */
|
|
1117
|
+
checked?: string[];
|
|
1118
|
+
/** Human-readable caveat: entries dropped, list truncated. Absent when clean. */
|
|
1119
|
+
note?: string;
|
|
1120
|
+
}
|
|
1121
|
+
type PackFindingsParseResult = {
|
|
1122
|
+
ok: true;
|
|
1123
|
+
value: ParsedPackFindings;
|
|
1124
|
+
} | {
|
|
1125
|
+
ok: false;
|
|
1126
|
+
error: string;
|
|
1127
|
+
};
|
|
1128
|
+
/**
|
|
1129
|
+
* Parse the contents of `PACK_FINDINGS_FILE`. Accepts the documented shape
|
|
1130
|
+
* `{ "findings": [...], "checked"?: [...] }`, a bare array, and either wrapped
|
|
1131
|
+
* in a markdown fence. Individual entries are validated one by one: a bad entry
|
|
1132
|
+
* is dropped and counted in `note`, it never poisons the rest. Unknown
|
|
1133
|
+
* severity/resolution values are coerced to the conservative end
|
|
1134
|
+
* (`major` / `needs_verification`) rather than dropped — a mislabeled finding
|
|
1135
|
+
* is still a finding the next stage must look at.
|
|
1136
|
+
*/
|
|
1137
|
+
declare function parsePackFindings(raw: string): PackFindingsParseResult;
|
|
1138
|
+
/**
|
|
1139
|
+
* Lift the `## Handoff` section from a stage reply (the workflow article asks
|
|
1140
|
+
* every stage to close with one). Returns null when the reply has no such
|
|
1141
|
+
* heading, so callers fall back to the reply's tail. Case-insensitive on the
|
|
1142
|
+
* heading text, tolerant of `#`/`###`, stops at the next heading of the same
|
|
1143
|
+
* or higher level.
|
|
1144
|
+
*/
|
|
1145
|
+
declare function extractHandoffSection(reply: string): string | null;
|
|
1047
1146
|
|
|
1048
1147
|
/**
|
|
1049
1148
|
* Wire-shape types for the CLI / IDE-plugin → backend producer endpoints
|
|
@@ -1989,4 +2088,4 @@ type UserEventName = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
|
|
|
1989
2088
|
*/
|
|
1990
2089
|
declare const PREVIEW_DETECT_PROMPT: string;
|
|
1991
2090
|
|
|
1992
|
-
export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type AwaitingAnswerOption, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, CODER_PROMPT, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HANDOFF_FENCE_TAG, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HandoffProposal, type HandoffResolution, type HunkLineType, INSTALL_SNIPPETS, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MANAGED_AGENT_ENV, MANAGED_AGENT_SUBTITLE, MANAGED_PROVIDER_DISPLAY_NAMES, MANAGED_PROVIDER_IDS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackHandoffRecord, type PackId, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SPECIFIER_PROMPT, SQUAD_CONFIGURE_COMMAND, SQUAD_HOP_BUDGET_DEFAULT, SQUAD_HOP_BUDGET_MAX, SQUAD_HOP_BUDGET_MIN, SQUAD_SPECIALTIES, SQUAD_STATS_COMMAND, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, SWITCH_AGENT_COMMAND, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type SquadAutoConfig, type SquadConfigurePayload, type SquadConfigureResult, type SquadMemberActivity, type SquadRosterAgent, type SquadRosterData, type SquadStatsResult, type StartTaskFailedResult, type StartTaskPayload, type StreamingChunkEvent, type StreamingChunkKind, type SwitchAgentCommand, type SwitchAgentResult, type SwitchAgentStatus, type SwitchAgentStep, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, clampHopBudget, classifyStack, detectedIntegrationsFromDeps, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, installableAgentIds, internalToPublic, isGuardrailDisposition, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
|
|
2091
|
+
export { AGENT_REGISTRY, AGENT_STANDARD_BLOCK, AGENT_STANDARD_MARKER, AGENT_STANDARD_TEXT, type AgentAuth, type AgentAuthKind, type AgentId, type AgentMetadata, type AgentMode, type AgentModel, type AgentReviewFinding, type AgentReviewPlan, type AgentReviewReport, type AnswerResolvedEvent, type AwaitingAnswerEvent, type AwaitingAnswerOption, type BeadsActionCommand, type BeadsActionKind, type BeadsActionPayload, type BeadsActionRequest, type BeadsActionType, type BeadsConfigureAction, type BeadsDependencyDto, type BeadsDependencyKind, type BeadsIngestPayload, type BeadsIssueDto, type BeadsIssueStatus, type BeadsMemoryDto, type BeadsProjectDto, type BeadsProvisioningPayload, type BeadsProvisioningStatus, type BeadsSnapshotDto, type BeadsStatus, type BeadsStatusState, type BeadsStatusSummary, type BlameLineWire, type BrokeredIntegrationToken, CODER_PROMPT, type ChromeStep, type ChromeToolType, type CommitEntryWire, DEFAULT_API_BASE_URL, DEFAULT_GUARDRAIL_POLICY, DEP_TO_INTEGRATION, DEV_API_BASE_URL, type DerivedCredentialSource, type EnvVar, type FileBlameEvent, type FileChangeStatus, type FileChangedEvent, type FileHistoryEvent, type FileReviewStatus, GUARDRAIL_CATEGORIES, GUARDRAIL_CATEGORY_META, GUARDRAIL_CONFIGURE_COMMAND, GUARDRAIL_DISPOSITIONS, type GuardrailCategory, type GuardrailCategoryMeta, type GuardrailDisposition, type GuardrailPolicy, HANDOFF_FENCE_TAG, HEARTBEAT_INTERVAL_MS_DEFAULT, HOUSE_AGENT_ID, HOUSE_AGENT_NAME, HOUSE_AGENT_PROVIDER, HOUSE_AGENT_SUBTITLE, HOUSE_AGENT_VENDOR, type HandoffProposal, type HandoffResolution, type HunkLineType, INSTALL_SNIPPETS, INTEGRATION_BRANDING, INTEGRATION_REGISTRY, INTERNAL_TO_PUBLIC, type InputSuggestionChunk, type IntegrationApiKeyField, type IntegrationAuthKind, type IntegrationBranding, type IntegrationCategory, type IntegrationDefinition, type IntegrationDelivery, type IntegrationHealth, type IntegrationId, type IntegrationMcpDelivery, type IntegrationStatus, type IntegrationsManifest, type IntegrationsManifestEntry, LINKED_AGENT_IDS, type LinkedAgentId, MANAGED_AGENT_ENV, MANAGED_AGENT_SUBTITLE, MANAGED_PROVIDER_DISPLAY_NAMES, MANAGED_PROVIDER_IDS, MAX_PACK_FINDINGS, MODEL_CONTEXT_WINDOW, MODEL_PRICING, type ManagedProviderId, type MissingService, type ModelPricing, type NormalizedMessage, OBSERVER_BRIDGE_PORT, PACK_ACTION_COMMAND, PACK_FINDINGS_FILE, PACK_HANDOFF_HEADING, PACK_REGISTRY, PACK_START_COMMAND, PACK_STATUS_COMMAND, PACK_WORKFLOW_ARTICLE, PREVIEW_DETECT_PROMPT, PROTOCOL_VERSION, PUBLIC_TO_INTERNAL, type PackActionKind, type PackActionPayload, type PackDefinition, type PackFinding, type PackFindingResolution, type PackFindingSeverity, type PackFindingsParseResult, type PackHandoffRecord, type PackId, type PackPendingControl, type PackRunState, type PackRunStatus, type PackStageDef, type PackStageState, type PackStageStatus, type PackStartPayload, type ParsedPackFindings, type PendingReviewHunkEvent, type PendingReviewHunkLine, type PrCheck, type PrRef, type PrReviewEntry, type PrReviewVerdict, type PreviewDetection, type PreviewErrorStage, type PreviewState, type PreviewStatus, type PullRequestDetail, type PullRequestSummary, QA_PROMPT, REVIEWER_PROMPT, type RemoteCommand, type RepoStack, type RepoStackDetection, SKILL_REGISTRY, SPECIFIER_PROMPT, SQUAD_CONFIGURE_COMMAND, SQUAD_HOP_BUDGET_DEFAULT, SQUAD_HOP_BUDGET_MAX, SQUAD_HOP_BUDGET_MIN, SQUAD_SPECIALTIES, SQUAD_STATS_COMMAND, SSE_SOCKET_TIMEOUT_MS, STACK_TO_RECOMMENDED, SWITCH_AGENT_COMMAND, type SelectPrompt, type SkillDefinition, type SkillDelivery, type SkillFileDelivery, type SkillId, type SkillRail, type SkillsManifest, type SkillsManifestEntry, type SquadAutoConfig, type SquadConfigurePayload, type SquadConfigureResult, type SquadMemberActivity, type SquadRosterAgent, type SquadRosterData, type SquadStatsResult, type StartTaskFailedResult, type StartTaskPayload, type StreamingChunkEvent, type StreamingChunkKind, type SwitchAgentCommand, type SwitchAgentResult, type SwitchAgentStatus, type SwitchAgentStep, TERMINAL_AGENT_PREFIX, UNKNOWN_MODEL_PRICING, UPCOMING_INTEGRATION_IDS, USER_EVENTS, type UserEventName, clampHopBudget, classifyStack, detectedIntegrationsFromDeps, extractHandoffSection, getAgent, getContextWindow, getEnabledAgents, getEnabledIntegrations, getIntegration, getIntegrationBranding, getIntegrationsByCategory, getPackDefinition, getPricing, getSkillDefinition, installableAgentIds, internalToPublic, isGuardrailDisposition, isKnownAgentId, isKnownIntegrationId, isKnownModel, isLinkedAgentId, isManagedProviderId, isNoopInstallSnippet, isPackId, isSkillId, normalizeAgentId, normalizeGuardrailPolicy, parsePackFindings, publicToInternal, recommendForDeps, renderToLines, resolveApiBaseUrl, skillHasRail, toRemoteCommand, tryGetContextWindow };
|