@akagilnc/pi-workflow-roles 0.1.4403 → 0.1.4419
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 +4 -3
- package/README.zh-CN.md +5 -4
- package/THIRD_PARTY_NOTICES.md +8 -6
- package/dist/acp-host/production-host.js +249 -624
- package/dist/headless-host/production-host.js +251 -626
- package/dist/migrate-book-topology.js +23 -6
- package/dist/package-resources/method-skill.js +6 -1
- package/dist/pi/role-turn-host.js +3 -1
- package/dist/public-cli/invocation.js +83 -32
- package/dist/public-cli/main.js +240 -306
- package/dist/public-cli/option-definitions.js +23 -6
- package/dist/public-cli/post-admission.js +0 -4
- package/dist/public-cli/run-lifecycle.js +25 -4
- package/dist/public-cli/settlement.js +6 -77
- package/dist/role-activation-flags.js +1 -0
- package/extensions/role-runtime.ts +3 -5
- package/package.json +1 -1
- package/resources/836-deleted-machine-instruction-inventory.md +1 -1
- package/resources/methods/ak-cross-m-review/CONTEXT.md +48 -0
- package/resources/methods/ak-cross-m-review/LICENSE +21 -0
- package/resources/methods/ak-cross-m-review/SKILL.md +170 -0
- package/resources/methods/ak-cross-m-review/prompts/cmr-completeness.md +118 -0
- package/resources/methods/ak-cross-m-review/prompts/cmr-reviewer.md +128 -0
- package/resources/methods/ak-cross-m-review/provenance.json +41 -0
- package/souls/judge.md +1 -1
- package/souls/reviewer.md +1 -1
- package/src/archivist-record-entry.ts +1 -1
- package/src/canonical-skill-binding.ts +2 -2
- package/src/host-contracts.ts +2 -0
- package/src/package-contracts/reviewer-output.ts +4 -2
- package/src/package-resources/method-skill.ts +7 -2
- package/src/pi/role-turn-host.ts +3 -1
- package/src/public-cli/invocation.ts +108 -39
- package/src/public-cli/option-definitions.ts +23 -6
- package/src/public-cli/post-admission.ts +0 -4
- package/src/public-cli/reviewer-run.ts +39 -16
- package/src/public-cli/run-lifecycle.ts +33 -3
- package/src/public-cli/settlement.ts +8 -73
- package/src/reviewer-role.ts +27 -16
- package/src/role-activation-flags.ts +1 -0
- package/src/role-runtime-dependencies.ts +2 -4
- package/src/role-runtime.ts +9 -26
- package/src/worker-role.ts +1 -1
- package/dist/adr-path-refs.js +0 -23
- package/dist/public-cli/reviewer-dispatch-rejection.js +0 -77
- package/dist/reviewer-dispatch.js +0 -14
- package/dist/reviewer-git-snapshot.js +0 -32
- package/dist/reviewer-pinned-git.js +0 -308
- package/dist/reviewer-preflight-error.js +0 -15
- package/dist/reviewer-prompt-identity.js +0 -10
- package/resources/methods/code-review/SKILL.md +0 -92
- package/resources/methods/code-review/agents/openai.yaml +0 -3
- package/resources/methods/code-review/provenance.json +0 -26
- package/src/adr-path-refs.ts +0 -25
- package/src/public-cli/reviewer-dispatch-rejection.ts +0 -106
- package/src/reviewer-dispatch.ts +0 -39
- package/src/reviewer-git-snapshot.ts +0 -45
- package/src/reviewer-pinned-git.ts +0 -330
- package/src/reviewer-preflight-error.ts +0 -14
- package/src/reviewer-prompt-identity.ts +0 -17
|
@@ -14526,18 +14526,32 @@ var init_option_definitions = __esm({
|
|
|
14526
14526
|
zh: "\u5FC5\u586B\uFF1B\u9489\u4F4F\u5BA1\u67E5\u76EE\u6807\u7684 fixed-point revision\u3002"
|
|
14527
14527
|
}
|
|
14528
14528
|
},
|
|
14529
|
+
{
|
|
14530
|
+
id: "lens",
|
|
14531
|
+
owner: "reviewer",
|
|
14532
|
+
canonical: "--lens",
|
|
14533
|
+
aliases: [],
|
|
14534
|
+
valueMetavar: "completeness|correctness",
|
|
14535
|
+
required: true,
|
|
14536
|
+
repeatable: false,
|
|
14537
|
+
form: "option",
|
|
14538
|
+
description: {
|
|
14539
|
+
en: "Required single review lens: completeness or correctness (no default).",
|
|
14540
|
+
zh: "\u5FC5\u586B\u5355 lens\uFF1Acompleteness \u6216 correctness\uFF08\u65E0\u9ED8\u8BA4\u503C\uFF09\u3002"
|
|
14541
|
+
}
|
|
14542
|
+
},
|
|
14529
14543
|
{
|
|
14530
14544
|
id: "authority-ref",
|
|
14531
14545
|
owner: "reviewer",
|
|
14532
14546
|
canonical: "--authority-ref",
|
|
14533
14547
|
aliases: [],
|
|
14534
14548
|
valueMetavar: "ref",
|
|
14535
|
-
required:
|
|
14549
|
+
required: true,
|
|
14536
14550
|
repeatable: true,
|
|
14537
14551
|
form: "option",
|
|
14538
14552
|
description: {
|
|
14539
|
-
en: "
|
|
14540
|
-
zh: "\u6301\u4E45 authority \u5F15\u7528/URL\uFF08\u53EF\u91CD\u590D\uFF1B\u4EC5 ref\uFF0C\u975E\u5185\u8054\u6563\u6587\uFF09\u3002"
|
|
14553
|
+
en: "Required durable authority reference/URL (repeatable; refs only, not inline prose).",
|
|
14554
|
+
zh: "\u5FC5\u586B\u6301\u4E45 authority \u5F15\u7528/URL\uFF08\u53EF\u91CD\u590D\uFF1B\u4EC5 ref\uFF0C\u975E\u5185\u8054\u6563\u6587\uFF09\u3002"
|
|
14541
14555
|
}
|
|
14542
14556
|
}
|
|
14543
14557
|
];
|
|
@@ -14729,10 +14743,13 @@ var init_option_definitions = __esm({
|
|
|
14729
14743
|
},
|
|
14730
14744
|
reviewer: {
|
|
14731
14745
|
command: "reviewer",
|
|
14732
|
-
summary: "Fixed-target
|
|
14733
|
-
usage: [
|
|
14746
|
+
summary: "Fixed-target single-lens review (completeness or correctness).",
|
|
14747
|
+
usage: [
|
|
14748
|
+
"ak-role reviewer --base <revision> --lens completeness|correctness --authority-ref <ref> [options] <instruction>"
|
|
14749
|
+
],
|
|
14734
14750
|
examples: [
|
|
14735
|
-
'ak-role reviewer --base main "Review the branch
|
|
14751
|
+
'ak-role reviewer --base main --lens completeness --authority-ref docs/adr/0001.md "Review the branch."',
|
|
14752
|
+
"ak-role reviewer --base main --lens correctness --authority-ref CLAUDE.md --authority-ref docs/adr/0001.md"
|
|
14736
14753
|
]
|
|
14737
14754
|
},
|
|
14738
14755
|
collector: {
|
|
@@ -26,7 +26,12 @@ const SHA256_RE = /^[0-9a-f]{64}$/;
|
|
|
26
26
|
const REQUIRED_COMPANIONS = {
|
|
27
27
|
tdd: ["tests.md", "mocking.md", "agents/openai.yaml"],
|
|
28
28
|
"diagnosing-bugs": ["agents/openai.yaml", "scripts/hitl-loop.template.sh"],
|
|
29
|
-
"
|
|
29
|
+
"ak-cross-m-review": [
|
|
30
|
+
"CONTEXT.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"prompts/cmr-completeness.md",
|
|
33
|
+
"prompts/cmr-reviewer.md",
|
|
34
|
+
],
|
|
30
35
|
"resolving-merge-conflicts": ["agents/openai.yaml"],
|
|
31
36
|
};
|
|
32
37
|
/** Git blob OID for raw file bytes (sha1 of `blob <size>\\0` + content). */
|
|
@@ -134,7 +134,9 @@ function piUserDialogueBody(request) {
|
|
|
134
134
|
const _exhaustive = request.continuation;
|
|
135
135
|
return _exhaustive;
|
|
136
136
|
})();
|
|
137
|
-
return
|
|
137
|
+
return request.continuation.kind === "resume" && request.activation.role === "reviewer"
|
|
138
|
+
? rawPrompt
|
|
139
|
+
: applyPiNativeSkillInvocation(request.methods, rawPrompt);
|
|
138
140
|
}
|
|
139
141
|
const execFileAsync = promisify(execFile);
|
|
140
142
|
async function resolveSelectedPi(command, cwd, env) {
|
|
@@ -379,6 +379,48 @@ function requireOptionPath(flag, value) {
|
|
|
379
379
|
}
|
|
380
380
|
return value;
|
|
381
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Shared Skill-arg token rule for caller-controlled values projected into the
|
|
384
|
+
* space-joined Skill invocation line. Rejects blank, whitespace (smuggles the
|
|
385
|
+
* next option), and a leading `-` (read as the next Skill option). Not a
|
|
386
|
+
* general free-text gate — only the projection admission seam.
|
|
387
|
+
*/
|
|
388
|
+
function requireSkillArgToken(value, messages) {
|
|
389
|
+
if (value === undefined || value.trim() === "") {
|
|
390
|
+
throw new CliUsageError(messages.empty);
|
|
391
|
+
}
|
|
392
|
+
if (/\s/.test(value)) {
|
|
393
|
+
throw new CliUsageError(messages.whitespace);
|
|
394
|
+
}
|
|
395
|
+
if (value.startsWith("-")) {
|
|
396
|
+
throw new CliUsageError(messages.optionLike);
|
|
397
|
+
}
|
|
398
|
+
return value;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Reviewer --base admission: nonempty single Skill-arg token (shared rule with
|
|
402
|
+
* requireAuthorityRef). Multi-token / option-like values smuggle extra flags
|
|
403
|
+
* (e.g. `--lens all`, `--authority x`).
|
|
404
|
+
*/
|
|
405
|
+
export function requireReviewerBaseRevision(value) {
|
|
406
|
+
return requireSkillArgToken(value, {
|
|
407
|
+
empty: "--base requires a nonempty revision",
|
|
408
|
+
whitespace: "--base requires a single-token revision",
|
|
409
|
+
optionLike: "--base requires a single-token revision",
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
/** Shared ReviewerLens predicate — sole interpretation owner for fresh + durable. */
|
|
413
|
+
export function isReviewerLens(value) {
|
|
414
|
+
return value === "completeness" || value === "correctness";
|
|
415
|
+
}
|
|
416
|
+
/** Public --lens enum; sole owner for parse + fresh admission. */
|
|
417
|
+
export function requireReviewerLens(value) {
|
|
418
|
+
const trimmed = (value ?? "").trim();
|
|
419
|
+
if (!isReviewerLens(trimmed)) {
|
|
420
|
+
throw new CliUsageError("--lens requires completeness or correctness");
|
|
421
|
+
}
|
|
422
|
+
return trimmed;
|
|
423
|
+
}
|
|
382
424
|
/** True when token is a retained rejected spelling for the owner (#342). */
|
|
383
425
|
function isRejectedPublicSpelling(owner, token) {
|
|
384
426
|
for (const entry of REJECTED_PUBLIC_SPELLINGS) {
|
|
@@ -398,18 +440,16 @@ function roleOptions(owner) {
|
|
|
398
440
|
/**
|
|
399
441
|
* Public --authority-ref admission grammar (refs-only).
|
|
400
442
|
* Unique owner for fresh argv and durable resume restore — no string-only parallel.
|
|
401
|
-
* Accepts durable reference tokens as-is; rejects blank
|
|
402
|
-
* (whitespace-bearing sentences)
|
|
443
|
+
* Accepts durable reference tokens as-is; rejects blank, inline Spec prose
|
|
444
|
+
* (whitespace-bearing sentences), and option-like leading `-` (Skill-arg boundary).
|
|
445
|
+
* Does not fetch, normalize, or judge content.
|
|
403
446
|
*/
|
|
404
447
|
export function requireAuthorityRef(value) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
throw new CliUsageError("--authority-ref requires a durable reference, not inline Spec prose");
|
|
411
|
-
}
|
|
412
|
-
return value;
|
|
448
|
+
return requireSkillArgToken(value, {
|
|
449
|
+
empty: "--authority-ref requires a nonempty durable reference",
|
|
450
|
+
whitespace: "--authority-ref requires a durable reference, not inline Spec prose",
|
|
451
|
+
optionLike: "--authority-ref requires a durable reference, not inline Spec prose",
|
|
452
|
+
});
|
|
413
453
|
}
|
|
414
454
|
/**
|
|
415
455
|
* Parse Judge-specific argv after the `judge` token.
|
|
@@ -1663,12 +1703,6 @@ export async function admitNotaryInvocation(options) {
|
|
|
1663
1703
|
export function buildNotaryTransportPrompt(_admitted, engineMaterial) {
|
|
1664
1704
|
return appendEngineSessionMaterial([NOTARY_FIXED_KICKOFF], engineMaterial).join("\n");
|
|
1665
1705
|
}
|
|
1666
|
-
/**
|
|
1667
|
-
* Parse Reviewer-specific argv after the `reviewer` token.
|
|
1668
|
-
* Public flags: --project, required --base, optional repeatable --authority-ref.
|
|
1669
|
-
* Reviewer gathers its own evidence; users submit neither attachments nor capability packets.
|
|
1670
|
-
* Caller instruction remains scope/procedure provenance — not Spec authority.
|
|
1671
|
-
*/
|
|
1672
1706
|
/**
|
|
1673
1707
|
* Parse Gleaner-Left argv after the `gleaner-left` token.
|
|
1674
1708
|
* Public flags: --project, required --base. No --attach / ticket face (unanchored self-fetch).
|
|
@@ -1788,6 +1822,7 @@ export function parseReviewerArgv(args) {
|
|
|
1788
1822
|
const authorityRefs = [];
|
|
1789
1823
|
let project;
|
|
1790
1824
|
let baseRevision;
|
|
1825
|
+
let lens;
|
|
1791
1826
|
const positional = [];
|
|
1792
1827
|
const tokens = [...args];
|
|
1793
1828
|
const definitions = roleOptions("reviewer");
|
|
@@ -1805,7 +1840,12 @@ export function parseReviewerArgv(args) {
|
|
|
1805
1840
|
continue;
|
|
1806
1841
|
}
|
|
1807
1842
|
if (taken.def.id === "base") {
|
|
1808
|
-
baseRevision =
|
|
1843
|
+
baseRevision = requireReviewerBaseRevision(taken.value);
|
|
1844
|
+
continue;
|
|
1845
|
+
}
|
|
1846
|
+
if (taken.def.id === "lens") {
|
|
1847
|
+
// Empty and other non-enum values share one message — do not borrow path helper.
|
|
1848
|
+
lens = requireReviewerLens(taken.value);
|
|
1809
1849
|
continue;
|
|
1810
1850
|
}
|
|
1811
1851
|
if (taken.def.id === "authority-ref") {
|
|
@@ -1820,29 +1860,32 @@ export function parseReviewerArgv(args) {
|
|
|
1820
1860
|
}
|
|
1821
1861
|
positional.push(token);
|
|
1822
1862
|
}
|
|
1823
|
-
// Unconditional required (
|
|
1863
|
+
// Unconditional required (--base/--lens/--authority-ref) from typed table (#342).
|
|
1824
1864
|
options.assertRequired();
|
|
1825
1865
|
return {
|
|
1826
1866
|
instruction: positional.join(" "),
|
|
1827
1867
|
attachmentPaths,
|
|
1828
1868
|
baseRevision: baseRevision,
|
|
1869
|
+
lens: lens,
|
|
1829
1870
|
authorityRefs,
|
|
1830
1871
|
...(project === undefined ? {} : { project }),
|
|
1831
1872
|
};
|
|
1832
1873
|
}
|
|
1833
1874
|
/**
|
|
1834
|
-
* Admit a Reviewer Role run on the fixed base
|
|
1835
|
-
* Caller instruction is optional provenance;
|
|
1836
|
-
*
|
|
1875
|
+
* Admit a Reviewer Role run on the fixed base + lens + authority set.
|
|
1876
|
+
* Caller instruction is optional provenance; typed fields project Skill inputs.
|
|
1877
|
+
* authorityRefs are frozen as durable references only — not Spec prose.
|
|
1837
1878
|
*/
|
|
1838
1879
|
export async function admitReviewerInvocation(options) {
|
|
1839
1880
|
if (options.project !== undefined) {
|
|
1840
1881
|
requireOptionPath("--project", options.project);
|
|
1841
1882
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1883
|
+
const baseRevision = requireReviewerBaseRevision(options.baseRevision);
|
|
1884
|
+
const lens = requireReviewerLens(options.lens);
|
|
1885
|
+
if (options.authorityRefs.length === 0) {
|
|
1886
|
+
throw new CliUsageError("reviewer requires --authority-ref <ref>");
|
|
1844
1887
|
}
|
|
1845
|
-
const authorityRefs = Object.freeze(
|
|
1888
|
+
const authorityRefs = Object.freeze(options.authorityRefs.map((ref) => requireAuthorityRef(ref)));
|
|
1846
1889
|
const projectRoot = resolve(options.project ?? options.cwd);
|
|
1847
1890
|
const runId = (options.createRunId ?? uuidv7)();
|
|
1848
1891
|
const { principal, sessionDirectory, sessionFile, runDirectory, attachmentsDirectory, ledgerHome, bookKey, } = issueAdmissionPlacement(options.principalAuthority, {
|
|
@@ -1865,7 +1908,8 @@ export async function admitReviewerInvocation(options) {
|
|
|
1865
1908
|
principal,
|
|
1866
1909
|
instruction,
|
|
1867
1910
|
instructionEmpty,
|
|
1868
|
-
baseRevision
|
|
1911
|
+
baseRevision,
|
|
1912
|
+
lens,
|
|
1869
1913
|
authorityRefs: [...authorityRefs],
|
|
1870
1914
|
attachments: attachments.map((a) => ({
|
|
1871
1915
|
provenancePath: a.provenancePath,
|
|
@@ -1892,19 +1936,26 @@ export async function admitReviewerInvocation(options) {
|
|
|
1892
1936
|
runDirectory,
|
|
1893
1937
|
principal,
|
|
1894
1938
|
admittedRequestPath,
|
|
1895
|
-
baseRevision
|
|
1939
|
+
baseRevision,
|
|
1940
|
+
lens,
|
|
1896
1941
|
authorityRefs,
|
|
1897
1942
|
};
|
|
1898
1943
|
}
|
|
1944
|
+
/** Frozen Skill arg projection shared by initial and resume (never reverse-parsed). */
|
|
1945
|
+
export function buildReviewerSkillArgProjection(admitted) {
|
|
1946
|
+
return [
|
|
1947
|
+
`--base ${admitted.baseRevision}`,
|
|
1948
|
+
`--lens ${admitted.lens}`,
|
|
1949
|
+
...admitted.authorityRefs.map((ref) => `--authority ${ref}`),
|
|
1950
|
+
].join(" ");
|
|
1951
|
+
}
|
|
1899
1952
|
/**
|
|
1900
|
-
* Build the
|
|
1901
|
-
*
|
|
1902
|
-
*
|
|
1953
|
+
* Build the host-neutral prompt transport for an admitted Reviewer request.
|
|
1954
|
+
* Typed base/lens/authority project to Skill invocation args (never reverse-parsed from prose).
|
|
1955
|
+
* Optional caller words + engine material follow.
|
|
1903
1956
|
*/
|
|
1904
1957
|
export function buildReviewerTransportPrompt(admitted, engineMaterial) {
|
|
1905
|
-
const lines = [
|
|
1906
|
-
`本次审查的固定基点:${admitted.baseRevision}`,
|
|
1907
|
-
];
|
|
1958
|
+
const lines = [buildReviewerSkillArgProjection(admitted)];
|
|
1908
1959
|
if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
|
|
1909
1960
|
lines.push("", admitted.instruction);
|
|
1910
1961
|
}
|