@ornexus/neocortex 4.60.61 → 4.60.62
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/release-source.json +1 -0
- package/dist/sbom.cdx.json +150 -47
- package/install.ps1 +1 -1
- package/install.sh +1 -1
- package/package.json +9 -4
- package/packages/client/dist/cli.js +52 -2
- package/packages/client/dist/commands/invoke.d.ts +1 -0
- package/packages/client/dist/commands/invoke.js +80 -73
- package/packages/client/dist/commands/legacy-epic-terminal.d.ts +9 -0
- package/packages/client/dist/commands/legacy-epic-terminal.js +1 -0
- package/packages/client/dist/commands/legacy-story-pr.d.ts +2 -1
- package/packages/client/dist/commands/legacy-story-pr.js +1 -1
- package/packages/client/dist/commands/mutation-qa-checkpoint.d.ts +39 -0
- package/packages/client/dist/commands/mutation-qa-checkpoint.js +5 -0
- package/packages/client/dist/commands/mutation-qa-gate.d.ts +35 -0
- package/packages/client/dist/commands/mutation-qa-gate.js +1 -0
- package/packages/client/dist/commands/mutation-qa-git.d.ts +2 -0
- package/packages/client/dist/commands/mutation-qa-git.js +1 -0
- package/packages/client/dist/commands/mutation-qa-policy.d.ts +15 -0
- package/packages/client/dist/commands/mutation-qa-policy.js +1 -0
- package/packages/client/dist/commands/mutation-qa-run.d.ts +14 -0
- package/packages/client/dist/commands/mutation-qa-run.js +3 -0
- package/packages/client/dist/commands/mutation-qa-verdict.d.ts +21 -0
- package/packages/client/dist/commands/mutation-qa-verdict.js +1 -0
- package/packages/client/dist/commands/mutation-qa.d.ts +22 -0
- package/packages/client/dist/commands/mutation-qa.js +1 -0
- package/packages/client/dist/commands/property-qa.d.ts +1 -0
- package/packages/client/dist/commands/property-qa.js +1 -0
- package/packages/client/dist/commands/qa-scan-capture.d.ts +52 -0
- package/packages/client/dist/commands/qa-scan-capture.js +11 -0
- package/packages/client/dist/commands/qa-scan-discovery.d.ts +36 -0
- package/packages/client/dist/commands/qa-scan-discovery.js +3 -0
- package/packages/client/dist/commands/qa-scan-review.d.ts +119 -0
- package/packages/client/dist/commands/qa-scan-review.js +5 -0
- package/packages/client/dist/commands/refactor-characterization.d.ts +47 -0
- package/packages/client/dist/commands/refactor-characterization.js +12 -0
- package/packages/client/dist/commands/refactor-commit.d.ts +45 -0
- package/packages/client/dist/commands/refactor-commit.js +13 -0
- package/packages/client/dist/commands/refactor-review.d.ts +37 -0
- package/packages/client/dist/commands/refactor-review.js +5 -0
- package/packages/client/dist/commands/refactor-root.d.ts +85 -0
- package/packages/client/dist/commands/refactor-root.js +7 -0
- package/packages/client/dist/generated/command-registry.generated.d.ts +9 -9
- package/packages/client/dist/generated/command-registry.generated.js +1 -1
- package/packages/client/dist/generated/public-projections.generated.d.ts +20 -20
- package/packages/client/dist/generated/public-projections.generated.js +1 -1
- package/packages/client/dist/git/legacy-story-pr.d.ts +137 -6
- package/packages/client/dist/git/legacy-story-pr.js +51 -43
- package/packages/client/dist/license/license-client.js +1 -1
- package/packages/client/dist/private-execution/delivery.d.ts +49 -4
- package/packages/client/dist/private-execution/delivery.js +4 -2
- package/packages/client/dist/private-execution/isolated-admission.d.ts +7 -0
- package/packages/client/dist/private-execution/isolated-admission.js +10 -10
- package/packages/client/dist/private-execution/private-report-store.d.ts +17 -0
- package/packages/client/dist/private-execution/private-report-store.js +1 -0
- package/packages/client/dist/private-execution/property-test-candidate.d.ts +14 -0
- package/packages/client/dist/private-execution/property-test-candidate.js +1 -0
- package/packages/client/dist/private-execution/property-test-choices.d.ts +15 -0
- package/packages/client/dist/private-execution/property-test-choices.js +3 -0
- package/packages/client/dist/private-execution/property-test-plan.d.ts +65 -0
- package/packages/client/dist/private-execution/property-test-plan.js +7 -0
- package/packages/client/dist/private-execution/property-test-review.d.ts +58 -0
- package/packages/client/dist/private-execution/property-test-review.js +4 -0
- package/packages/client/dist/private-execution/property-test-runtime.d.ts +18 -0
- package/packages/client/dist/private-execution/property-test-runtime.js +9 -0
- package/packages/client/dist/private-execution/property-test-source.d.ts +8 -0
- package/packages/client/dist/private-execution/property-test-source.js +1 -0
- package/packages/client/dist/state/project-state-snapshot.js +1 -1
- package/packages/shared/dist/generated/command-registry.generated.js +9 -9
- package/packages/shared/dist/generated/invocation-schema.generated.js +2 -2
- package/packages/shared/dist/generated/public-projections.generated.js +18 -18
- package/packages/shared/dist/invocation/index.d.ts +1 -1
- package/packages/shared/dist/invocation/index.js +13 -0
- package/packages/shared/dist/merge-readiness/c12-registry-projection.js +111 -0
- package/packages/shared/dist/merge-readiness/c12-remote-observation.js +60 -0
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/skill/SKILL.md +1 -1
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex-root.md +2 -2
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex.md +2 -2
- package/targets-stubs/codex/AGENTS.md +1 -1
- package/targets-stubs/cursor/agent.md +2 -2
- package/targets-stubs/gemini-cli/agent.md +2 -2
- package/targets-stubs/opencode/neocortex-root.md +1 -1
- package/targets-stubs/vscode/neocortex.agent.md +2 -2
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface PropertyTestCatalog {
|
|
2
|
+
readonly schemaVersion: 1;
|
|
3
|
+
readonly prdPath: string;
|
|
4
|
+
readonly prdSha256: string;
|
|
5
|
+
readonly aggregates: readonly {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly invariantCount: number;
|
|
8
|
+
readonly suggestedFiles: readonly string[];
|
|
9
|
+
}[];
|
|
10
|
+
readonly invariantCount: number;
|
|
11
|
+
readonly publicSafe: true;
|
|
12
|
+
}
|
|
13
|
+
export interface PropertyTestChoices {
|
|
14
|
+
readonly prdSha256: string;
|
|
15
|
+
readonly language: 'typescript' | 'python';
|
|
16
|
+
readonly numRuns: 100 | 1000 | 10000;
|
|
17
|
+
/** Explicit operator-confirmed aggregate-to-file mapping; no implicit default. */
|
|
18
|
+
readonly mappings: Readonly<Record<string, string>>;
|
|
19
|
+
}
|
|
20
|
+
export interface PropertyTestPlan {
|
|
21
|
+
readonly schemaVersion: 1;
|
|
22
|
+
readonly prdPath: string;
|
|
23
|
+
readonly prdSha256: string;
|
|
24
|
+
readonly language: PropertyTestChoices['language'];
|
|
25
|
+
readonly numRuns: PropertyTestChoices['numRuns'];
|
|
26
|
+
readonly aggregates: readonly {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly invariantCount: number;
|
|
29
|
+
readonly implementationFile: string;
|
|
30
|
+
readonly implementationSha256: string;
|
|
31
|
+
readonly testFile: string;
|
|
32
|
+
readonly testPreimageSha256: string | null;
|
|
33
|
+
}[];
|
|
34
|
+
readonly writeSet: readonly string[];
|
|
35
|
+
readonly planSha256: string;
|
|
36
|
+
readonly checkpointAccepted: false;
|
|
37
|
+
readonly publicSafe: true;
|
|
38
|
+
}
|
|
39
|
+
/** Closed request projection: the PRD expressions, mappings and test bodies stay local. */
|
|
40
|
+
export interface PropertyTestExecutionInput {
|
|
41
|
+
readonly schemaVersion: 1;
|
|
42
|
+
readonly prdPath: 'prd.md' | 'docs/architecture/prd.md';
|
|
43
|
+
readonly prdSha256: string;
|
|
44
|
+
readonly planSha256: string;
|
|
45
|
+
readonly pathsSha256: string;
|
|
46
|
+
readonly aggregateCount: number;
|
|
47
|
+
readonly invariantCount: number;
|
|
48
|
+
readonly pathCount: number;
|
|
49
|
+
readonly language: PropertyTestChoices['language'];
|
|
50
|
+
readonly numRuns: PropertyTestChoices['numRuns'];
|
|
51
|
+
readonly publicSafe: true;
|
|
52
|
+
}
|
|
53
|
+
export interface PropertyTestInvariantRef {
|
|
54
|
+
readonly aggregate: string;
|
|
55
|
+
readonly ordinal: number;
|
|
56
|
+
/** Hash of the exact PRD row and its position; never an expression body. */
|
|
57
|
+
readonly invariantSha256: string;
|
|
58
|
+
}
|
|
59
|
+
/** Closed identifiers for root semantic review; the PRD text stays local. */
|
|
60
|
+
export declare function propertyTestInvariantRefs(markdown: string): readonly PropertyTestInvariantRef[];
|
|
61
|
+
export declare function inspectPropertyTestCatalog(projectRoot: string): PropertyTestCatalog;
|
|
62
|
+
export declare function confirmPropertyTestPlan(projectRoot: string, choices: PropertyTestChoices): PropertyTestPlan;
|
|
63
|
+
export declare function propertyTestExecutionInput(plan: PropertyTestPlan): PropertyTestExecutionInput;
|
|
64
|
+
/** Build root-owned PRD configuration bytes; no invariant expression leaves the local PRD. */
|
|
65
|
+
export declare function renderPropertyTestConfiguration(currentPrd: string, plan: PropertyTestPlan, generatedAt: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{createHash as x}from"node:crypto";import{lstatSync as m,readFileSync as w,realpathSync as P}from"node:fs";import{join as S,relative as F,resolve as R,sep as j}from"node:path";const E=["prd.md","docs/architecture/prd.md"],k=new Set(["Range","Cardinality","SumEquality","Format","Temporal"]),v=/^[A-Z][A-Za-z0-9]{0,79}$/,d=/^[a-f0-9]{64}$/;function l(t){return x("sha256").update(t).digest("hex")}function $(t,e){if(!/^[A-Za-z0-9][A-Za-z0-9._/-]{0,255}$/.test(e)||e.split("/").some(o=>o==="."||o===".."||o.length===0))throw new Error("property-test-invalid-path");const r=R(t,e),n=F(t,r);if(n.startsWith(`..${j}`)||n===".."||n==="")throw new Error("property-test-path-escape");let s=t;for(const o of e.split("/"))if(s=S(s,o),m(s).isSymbolicLink())throw new Error("property-test-symlink");if(!m(r).isFile())throw new Error("property-test-not-regular");return r}function A(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function _(t){const e=[];let r="";for(let n=1;n<t.length-1;n++){const s=t[n];s==="\\"&&t[n+1]==="|"?(r+="|",n++):s==="|"?(e.push(r.trim()),r=""):r+=s}return e.push(r.trim()),e}function O(t,e){let r=t;for(const n of e.split("/")){r=S(r,n);try{const s=m(r);if(s.isSymbolicLink())throw new Error("property-test-symlink");if(r===S(t,e)&&!s.isFile())throw new Error("property-test-invalid-destination")}catch(s){if(s.code==="ENOENT")return null;throw s}}return l(w(r))}function C(t){const e=t.split(/\r?\n/),r=e.findIndex(a=>/^## Aggregate Invariants\s*$/.test(a));if(r<0)throw new Error("property-test-no-invariants-section");const n=new Map,s=[];let o,p;for(const a of e.slice(r+1)){if(/^##\s/.test(a))break;const u=/^###\s+(.+?)\s*$/.exec(a);if(u){if(o=u[1],!v.test(o))throw new Error("property-test-invalid-aggregate");p=void 0;continue}if(!a.startsWith("|")||!a.endsWith("|"))continue;const i=_(a);if(i.every(h=>/^:?-{3,}:?$/.test(h)))continue;if(i.includes("Expression")&&i.includes("Type")){p=i;continue}if(!p||i.length!==p.length)throw new Error("property-test-invalid-table");const y=p,g=h=>i[y.indexOf(h)]??"",c=o??g("Aggregate");if(!v.test(c)||!g("Expression")||!k.has(g("Type"))||!g("Description")||o&&g("Aggregate")&&g("Aggregate")!==o)throw new Error("property-test-invalid-invariant");const f=(n.get(c)??0)+1;if(n.set(c,f),s.push(Object.freeze({aggregate:c,ordinal:f,invariantSha256:l(`property-test-invariant-v1\0${JSON.stringify({aggregate:c,ordinal:f,expression:g("Expression"),type:g("Type"),description:g("Description")})}`)})),n.size>64||[...n.values()].reduce((h,b)=>h+b,0)>1024)throw new Error("property-test-catalog-too-large")}if(n.size===0)throw new Error("property-test-no-aggregates");return{counts:n,rows:s}}function D(t){return C(t).rows}function T(t){const e=P(t),r=[];for(const n of E){let s,o;try{o=w($(e,n)),s=new TextDecoder("utf-8",{fatal:!0}).decode(o)}catch(p){if(p.code==="ENOENT")continue;throw p}if(o.length>2e6)throw new Error("property-test-prd-too-large");/^## Aggregate Invariants\s*$/m.test(s)&&r.push({path:n,sha:l(o),counts:C(s).counts})}if(r.length!==1)throw new Error(r.length?"property-test-ambiguous-prd":"property-test-no-invariants-section");return{root:e,...r[0]}}function z(t,e){const r=A(e);return[`src/domain/${r}.ts`,`src/aggregates/${r}.ts`,`src/${r}.ts`,`src/domain/${r.replaceAll("-","_")}.py`,`aggregates/${r.replaceAll("-","_")}.py`].filter(s=>{try{return $(t,s),!0}catch{return!1}})}function W(t){const e=T(t),r=[...e.counts].sort(([n],[s])=>n.localeCompare(s)).map(([n,s])=>({name:n,invariantCount:s,suggestedFiles:z(e.root,n)}));return{schemaVersion:1,prdPath:e.path,prdSha256:e.sha,aggregates:r,invariantCount:r.reduce((n,s)=>n+s.invariantCount,0),publicSafe:!0}}function G(t,e){const r=T(t);if(!e||!d.test(e.prdSha256)||e.prdSha256!==r.sha||!["typescript","python"].includes(e.language)||![100,1e3,1e4].includes(e.numRuns)||!e.mappings||typeof e.mappings!="object"||Array.isArray(e.mappings)||Object.keys(e).sort().join("\0")!==["language","mappings","numRuns","prdSha256"].join("\0")||Object.keys(e.mappings).sort().join("\0")!==[...r.counts.keys()].sort().join("\0"))throw new Error("property-test-choices-mismatch");const n=new Set,s=[...r.counts].sort(([a],[u])=>a.localeCompare(u)).map(([a,u])=>{const i=e.mappings[a];if(typeof i!="string"||!/^(?:src|aggregates)\/[A-Za-z0-9_./-]+\.(?:ts|py)$/.test(i)||(e.language==="typescript"?!i.endsWith(".ts"):!i.endsWith(".py")))throw new Error("property-test-invalid-mapping");const y=l(w($(r.root,i))),g=A(a),c=e.language==="typescript"?`tests/property/${g}.property.test.ts`:`tests/property/test_${g.replaceAll("-","_")}_properties.py`;if(n.has(c))throw new Error("property-test-write-collision");const f=O(r.root,c);return n.add(c),{name:a,invariantCount:u,implementationFile:i,implementationSha256:y,testFile:c,testPreimageSha256:f}}),o=[...n].sort(),p={schemaVersion:1,prdPath:r.path,prdSha256:r.sha,language:e.language,numRuns:e.numRuns,aggregates:s,writeSet:o};return{...p,planSha256:l(JSON.stringify(p)),checkpointAccepted:!1,publicSafe:!0}}function H(t){if(!E.includes(t.prdPath)||!d.test(t.planSha256)||!d.test(t.prdSha256)||t.aggregates.length<1||t.aggregates.length>64||t.writeSet.length!==t.aggregates.length||t.aggregates.reduce((e,r)=>e+r.invariantCount,0)>1024)throw new Error("property-test-plan-invalid");return{schemaVersion:1,prdPath:t.prdPath,prdSha256:t.prdSha256,planSha256:t.planSha256,pathsSha256:l(JSON.stringify(t.writeSet)),aggregateCount:t.aggregates.length,invariantCount:t.aggregates.reduce((e,r)=>e+r.invariantCount,0),pathCount:t.writeSet.length,language:t.language,numRuns:t.numRuns,publicSafe:!0}}function L(t,e,r){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(r)||!Number.isFinite(Date.parse(r))||!d.test(e.planSha256)||l(t)!==e.prdSha256||/^## Property Test Configuration\s*$/m.test(t)||t.includes("\0"))throw new Error("property-test-configuration-conflict");const n=t.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`;if(n===`\r
|
|
5
|
+
`&&t.replaceAll(`\r
|
|
6
|
+
`,"").includes(`
|
|
7
|
+
`))throw new Error("property-test-configuration-conflict");const s=["## Property Test Configuration","",`- Language: ${e.language}`,`- numRuns: ${e.numRuns}`,`- Generated at: ${r}`,"- Step: property-test (P112.03)",`- Confirmed plan SHA-256: ${e.planSha256}`,"","| Aggregate | Implementation File | Invariants |","|---|---|---|",...e.aggregates.map(o=>`| ${o.name} | ${o.implementationFile} | ${o.invariantCount} |`),""];return`${t.replace(/(?:\r?\n)*$/,"")}${n}${n}${s.join(n)}`}export{G as confirmPropertyTestPlan,W as inspectPropertyTestCatalog,H as propertyTestExecutionInput,D as propertyTestInvariantRefs,L as renderPropertyTestConfiguration};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface PropertyTestReviewPlanV1 {
|
|
2
|
+
readonly schemaVersion: 1;
|
|
3
|
+
readonly kind: 'property-test-review-plan';
|
|
4
|
+
readonly sourceHead: string;
|
|
5
|
+
readonly planSha256: string;
|
|
6
|
+
readonly candidateSha256: string;
|
|
7
|
+
readonly invariants: readonly {
|
|
8
|
+
readonly aggregate: string;
|
|
9
|
+
readonly ordinal: number;
|
|
10
|
+
readonly invariantSha256: string;
|
|
11
|
+
readonly testFile: string;
|
|
12
|
+
readonly testSha256: string;
|
|
13
|
+
readonly lineCount: number;
|
|
14
|
+
}[];
|
|
15
|
+
readonly executionVerified: false;
|
|
16
|
+
readonly qaAccepted: false;
|
|
17
|
+
readonly publicSafe: true;
|
|
18
|
+
}
|
|
19
|
+
export interface PropertyTestSemanticReviewV1 {
|
|
20
|
+
readonly schemaVersion: 1;
|
|
21
|
+
readonly kind: 'property-test-semantic-review';
|
|
22
|
+
readonly sourceHead: string;
|
|
23
|
+
readonly planSha256: string;
|
|
24
|
+
readonly candidateSha256: string;
|
|
25
|
+
readonly verdict: 'approved';
|
|
26
|
+
readonly coverage: readonly {
|
|
27
|
+
readonly invariantSha256: string;
|
|
28
|
+
readonly testFile: string;
|
|
29
|
+
readonly assertionLine: number;
|
|
30
|
+
/** Root-authored explanation of why this assertion proves this PRD invariant. */
|
|
31
|
+
readonly rationale: string;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
export interface PropertyTestReviewReceiptV1 {
|
|
35
|
+
readonly schemaVersion: 1;
|
|
36
|
+
readonly kind: 'property-test-review-acceptance';
|
|
37
|
+
readonly sourceHead: string;
|
|
38
|
+
readonly planSha256: string;
|
|
39
|
+
readonly candidateSha256: string;
|
|
40
|
+
readonly reviewSha256: string;
|
|
41
|
+
readonly invariantCount: number;
|
|
42
|
+
readonly passedTests: number;
|
|
43
|
+
readonly causalFailedTests: number;
|
|
44
|
+
readonly executionVerified: true;
|
|
45
|
+
readonly qaAccepted: true;
|
|
46
|
+
readonly publicSafe: true;
|
|
47
|
+
}
|
|
48
|
+
/** Only hashes, counts and planned paths leave this local planning function. */
|
|
49
|
+
export declare function inspectPropertyTestReviewPlan(projectRoot: string): PropertyTestReviewPlanV1;
|
|
50
|
+
/** Exact-root report shape and complete per-invariant review are mandatory. */
|
|
51
|
+
export declare function validatePropertyTestSemanticReview(projectRoot: string, report: unknown): {
|
|
52
|
+
readonly plan: PropertyTestReviewPlanV1;
|
|
53
|
+
readonly reviewSha256: string;
|
|
54
|
+
};
|
|
55
|
+
/** Explicit root acceptance re-runs physical + causal QA before an immutable private receipt. */
|
|
56
|
+
export declare function acceptPropertyTestSemanticReview(projectRoot: string, report: unknown): PropertyTestReviewReceiptV1;
|
|
57
|
+
/** Revalidate the immutable root decision against the current physical candidate. */
|
|
58
|
+
export declare function readPropertyTestReviewReceipt(projectRoot: string): PropertyTestReviewReceiptV1;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createHash as $,randomUUID as L}from"node:crypto";import{closeSync as k,existsSync as T,fsyncSync as x,linkSync as P,lstatSync as h,mkdirSync as j,openSync as F,readFileSync as g,realpathSync as H,unlinkSync as C,writeFileSync as D}from"node:fs";import{isAbsolute as J,join as w,resolve as S}from"node:path";import{mutationQaGit as E}from"../commands/mutation-qa-git.js";import{inspectPropertyTestCandidate as z}from"./property-test-candidate.js";import{loadPropertyTestCandidatePlan as R}from"./property-test-choices.js";import{propertyTestInvariantRefs as q}from"./property-test-plan.js";import{verifyPropertyTestRuntime as B}from"./property-test-runtime.js";const A=/^[a-f0-9]{64}$/,b=256*1024;function v(n){return $("sha256").update(n).digest("hex")}function m(n,r){return n!==null&&typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).sort().join("\0")===[...r].sort().join("\0")}function V(n,r){if(!/^tests\/property\/[a-z0-9-]+\.property\.test\.ts$/.test(r))throw new Error("property-test-review-unverified");let i=n;for(const[a,e]of r.split("/").entries()){i=w(i,e);const s=h(i);if(s.isSymbolicLink()||(a===r.split("/").length-1?!s.isFile()||s.size<1||s.size>256*1024:!s.isDirectory()))throw new Error("property-test-review-unverified")}return g(i)}function l(n){try{const r=z(n),{root:i,head:a,plan:e}=R(n);if(a!==r.sourceHead||e.planSha256!==r.planSha256)throw new Error("property-test-review-unverified");const s=E(i,["show",`HEAD:${e.prdPath}`]);if(v(s)!==e.prdSha256)throw new Error("property-test-review-unverified");const o=new TextDecoder("utf-8",{fatal:!0}).decode(s),t=q(o);if(t.length!==e.aggregates.reduce((d,p)=>d+p.invariantCount,0)||new Set(t.map(d=>d.invariantSha256)).size!==t.length)throw new Error("property-test-review-unverified");const u=new Map(e.aggregates.map(d=>[d.name,d])),c=new Map(e.aggregates.map(d=>{const p=V(i,d.testFile),y=new TextDecoder("utf-8",{fatal:!0}).decode(p).split(/\r?\n/);return[d.name,{testFile:d.testFile,testSha256:v(p),lineCount:y.length}]})),f=t.map(d=>{const p=u.get(d.aggregate),y=c.get(d.aggregate);if(!p||!y||d.ordinal>p.invariantCount)throw new Error("property-test-review-unverified");return Object.freeze({...d,...y})});if(z(i).artifactSha256!==r.artifactSha256)throw new Error("property-test-review-unverified");return Object.freeze({schemaVersion:1,kind:"property-test-review-plan",sourceHead:a,planSha256:e.planSha256,candidateSha256:r.artifactSha256,invariants:f,executionVerified:!1,qaAccepted:!1,publicSafe:!0})}catch{throw new Error("property-test-review-unverified")}}function N(n,r){try{const i=l(n);if(!m(r,["schemaVersion","kind","sourceHead","planSha256","candidateSha256","verdict","coverage"])||r.schemaVersion!==1||r.kind!=="property-test-semantic-review"||r.verdict!=="approved"||r.sourceHead!==i.sourceHead||r.planSha256!==i.planSha256||r.candidateSha256!==i.candidateSha256||!Array.isArray(r.coverage)||r.coverage.length!==i.invariants.length||Buffer.byteLength(JSON.stringify(r))>b)throw new Error("property-test-review-unverified");const a=new Map(i.invariants.map(t=>[t.invariantSha256,t])),e=new Set,s=new Set,o=new Map([...new Set(i.invariants.map(t=>t.testFile))].map(t=>[t,new TextDecoder("utf-8",{fatal:!0}).decode(V(n,t)).split(/\r?\n/)]));for(const t of r.coverage){if(!m(t,["invariantSha256","testFile","assertionLine","rationale"])||typeof t.invariantSha256!="string"||!A.test(t.invariantSha256)||e.has(t.invariantSha256))throw new Error("property-test-review-unverified");e.add(t.invariantSha256);const u=a.get(t.invariantSha256),c=`${t.testFile}:${t.assertionLine}`;if(!u||t.testFile!==u.testFile||s.has(c)||!Number.isSafeInteger(t.assertionLine)||Number(t.assertionLine)<1||Number(t.assertionLine)>u.lineCount||typeof t.rationale!="string"||t.rationale.length<30||t.rationale.length>500||/[\x00-\x1f\x7f]/.test(t.rationale))throw new Error("property-test-review-unverified");s.add(c);const f=o.get(u.testFile)?.[Number(t.assertionLine)-1]??"";if(!/\b(?:expect|assert|throw)\s*\(/.test(f.split("//")[0]??""))throw new Error("property-test-review-unverified")}if(e.size!==a.size||l(n).candidateSha256!==i.candidateSha256)throw new Error("property-test-review-unverified");return Object.freeze({plan:i,reviewSha256:v(`property-test-semantic-review-v1\0${JSON.stringify(r)}`)})}catch{throw new Error("property-test-review-unverified")}}function O(n,r){const i=E(n,["rev-parse","--show-toplevel"]).toString("utf8").trim(),a=E(n,["rev-parse","--git-common-dir"]).toString("utf8").trim(),e=J(a)?S(a):S(n,a);if(H(n)!==n||i!==n||H(e)!==e||h(e).isSymbolicLink()||h(e).uid!==process.getuid?.())throw new Error("property-test-review-unverified");const s=w(e,"neocortex-property-test");r&&j(s,{recursive:!0,mode:448});const o=h(s);if(!o.isDirectory()||o.isSymbolicLink()||o.uid!==process.getuid?.()||(o.mode&63)!==0)throw new Error("property-test-review-unverified");return s}function X(n,r){try{const i=S(n),a=N(i,r),e=B(i);if(!e.executionVerified||e.qaAccepted||e.outcome!=="execution-proven"||e.sourceHead!==a.plan.sourceHead||e.candidateSha256!==a.plan.candidateSha256||e.passedTests<a.plan.invariants.length||e.causalFailedTests!==e.passedTests||l(i).candidateSha256!==a.plan.candidateSha256)throw new Error("property-test-review-unverified");const s=Object.freeze({schemaVersion:1,kind:"property-test-review-acceptance",sourceHead:a.plan.sourceHead,planSha256:a.plan.planSha256,candidateSha256:a.plan.candidateSha256,reviewSha256:a.reviewSha256,invariantCount:a.plan.invariants.length,passedTests:e.passedTests,causalFailedTests:e.causalFailedTests,executionVerified:!0,qaAccepted:!0,publicSafe:!0}),o=O(i,!0),t=w(o,`review-${s.candidateSha256}.json`),u={report:r,receipt:s},c={schemaVersion:1,kind:"property-test-review-record",...u,checksumSha256:v(`property-test-review-record-v1\0${JSON.stringify(u)}`)};if(T(t)){const p=h(t);if(!p.isFile()||p.isSymbolicLink()||p.uid!==process.getuid?.()||(p.mode&63)!==0||p.size<1||p.size>b+4096||g(t,"utf8")!==`${JSON.stringify(c)}
|
|
2
|
+
`)throw new Error("property-test-review-unverified");return s}const f=w(o,`review-${L()}.tmp`),d=F(f,"wx",384);try{D(d,`${JSON.stringify(c)}
|
|
3
|
+
`),x(d)}finally{k(d)}try{if(l(i).candidateSha256!==s.candidateSha256)throw new Error("property-test-review-unverified");P(f,t);const p=F(o,"r");try{x(p)}finally{k(p)}}finally{T(f)&&C(f)}return s}catch{throw new Error("property-test-review-unverified")}}function Y(n){try{const r=S(n),i=l(r),a=w(O(r,!1),`review-${i.candidateSha256}.json`),e=h(a);if(!e.isFile()||e.isSymbolicLink()||e.uid!==process.getuid?.()||(e.mode&63)!==0||e.size<1||e.size>b+4096)throw new Error("property-test-review-unverified");const s=g(a,"utf8"),o=JSON.parse(s);if(!m(o,["schemaVersion","kind","report","receipt","checksumSha256"])||o.schemaVersion!==1||o.kind!=="property-test-review-record"||typeof o.checksumSha256!="string"||!A.test(o.checksumSha256)||s!==`${JSON.stringify(o)}
|
|
4
|
+
`)throw new Error("property-test-review-unverified");const t={report:o.report,receipt:o.receipt};if(o.checksumSha256!==v(`property-test-review-record-v1\0${JSON.stringify(t)}`))throw new Error("property-test-review-unverified");const u=N(r,o.report),c=o.receipt;if(!m(c,["schemaVersion","kind","sourceHead","planSha256","candidateSha256","reviewSha256","invariantCount","passedTests","causalFailedTests","executionVerified","qaAccepted","publicSafe"])||c.schemaVersion!==1||c.kind!=="property-test-review-acceptance"||c.sourceHead!==i.sourceHead||c.planSha256!==i.planSha256||c.candidateSha256!==i.candidateSha256||c.reviewSha256!==u.reviewSha256||c.invariantCount!==i.invariants.length||!Number.isSafeInteger(c.passedTests)||Number(c.passedTests)<i.invariants.length||c.causalFailedTests!==c.passedTests||c.executionVerified!==!0||c.qaAccepted!==!0||c.publicSafe!==!0||l(r).candidateSha256!==i.candidateSha256)throw new Error("property-test-review-unverified");return Object.freeze(c)}catch{throw new Error("property-test-review-unverified")}}export{X as acceptPropertyTestSemanticReview,l as inspectPropertyTestReviewPlan,Y as readPropertyTestReviewReceipt,N as validatePropertyTestSemanticReview};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type Reason = 'tests-passed' | 'toolchain-unavailable' | 'source-unsupported' | 'install-failed' | 'sandbox-unavailable' | 'tests-failed' | 'mutation-not-causal';
|
|
2
|
+
export interface PropertyTestRuntimeReceiptV1 {
|
|
3
|
+
readonly schemaVersion: 1;
|
|
4
|
+
readonly kind: 'property-test-runtime';
|
|
5
|
+
readonly outcome: 'execution-proven' | 'unverified';
|
|
6
|
+
readonly reasonCode: Reason;
|
|
7
|
+
readonly sourceHead: string | null;
|
|
8
|
+
readonly candidateSha256: string | null;
|
|
9
|
+
readonly testFileCount: number;
|
|
10
|
+
readonly passedTests: number;
|
|
11
|
+
readonly causalFailedTests: number;
|
|
12
|
+
readonly executionVerified: boolean;
|
|
13
|
+
readonly qaAccepted: false;
|
|
14
|
+
readonly publicSafe: true;
|
|
15
|
+
}
|
|
16
|
+
/** An unavailable host or toolchain yields no verdict; only positive + causal runs prove execution. */
|
|
17
|
+
export declare function verifyPropertyTestRuntime(projectRoot: string): PropertyTestRuntimeReceiptV1;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{spawnSync as Z}from"node:child_process";import{createHash as $}from"node:crypto";import{existsSync as b,lstatSync as y,mkdirSync as L,mkdtempSync as O,readFileSync as te,realpathSync as F,rmSync as V,writeFileSync as x}from"node:fs";import{homedir as se,tmpdir as M}from"node:os";import{dirname as ne,join as u,posix as I,resolve as oe}from"node:path";import{parse as re}from"@babel/parser";import{parseDocument as ie}from"yaml";import{mutationQaGit as ae}from"../commands/mutation-qa-git.js";import{loadPropertyTestCandidatePlan as ce}from"./property-test-choices.js";import{inspectPropertyTestCandidate as X}from"./property-test-candidate.js";const z="P222_PROPERTY_CAUSAL_CANARY",ue=512,le=16*1024*1024,pe=256*1024;class q extends Error{reason;constructor(o){super(o),this.reason=o}}function c(n){throw new q(n)}function g(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function J(n,o,t,r,e=0,s=0){const a=n==="tests-passed";return Object.freeze({schemaVersion:1,kind:"property-test-runtime",outcome:a?"execution-proven":"unverified",reasonCode:n,sourceHead:o,candidateSha256:t,testFileCount:r,passedTests:e,causalFailedTests:s,executionVerified:a,qaAccepted:!1,publicSafe:!0})}function v(n,o,t){(!/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*$/.test(o)||o.split("/").some(s=>s==="."||s===".."))&&c("source-unsupported");let r=n;const e=o.split("/");for(const[s,a]of e.entries()){r=u(r,a);const p=y(r);(p.isSymbolicLink()||(s===e.length-1?!p.isFile()||p.size<1||p.size>t:!p.isDirectory()))&&c("source-unsupported")}return te(r)}function H(n){try{const o=new TextDecoder("utf-8",{fatal:!0}).decode(n),t=ie(o,{strict:!0,uniqueKeys:!0,schema:"core",customTags:[]});if(t.errors.length||t.warnings.length)return null;const r=JSON.parse(o);return g(r)?r:null}catch{return null}}function de(n,o){const t=H(n),r=H(o);if(!t||!r||t.workspaces!==void 0||![2,3].includes(Number(r.lockfileVersion))||!g(r.packages)||!g(r.packages[""])||Object.keys(r.packages).length>1e4)return!1;const e=/^(?:\^|~)?[0-9]+\.[0-9]+\.[0-9]+$/;for(const l of["dependencies","devDependencies","optionalDependencies","peerDependencies"])if(t[l]!==void 0&&(!g(t[l])||Object.values(t[l]).some(h=>typeof h!="string"||!e.test(h))))return!1;const s={...g(t.dependencies)?t.dependencies:{},...g(t.devDependencies)?t.devDependencies:{}},a=r.packages[""],p=g(a)?{...g(a.dependencies)?a.dependencies:{},...g(a.devDependencies)?a.devDependencies:{}}:{};if(typeof s.vitest!="string"||typeof s["fast-check"]!="string"||p.vitest!==s.vitest||p["fast-check"]!==s["fast-check"])return!1;for(const[l,h]of Object.entries(r.packages)){if(!g(h)||h.link===!0)return!1;if(l!==""){if(!/^node_modules\/(?:@[^/]+\/)?[^/]+(?:\/node_modules\/(?:@[^/]+\/)?[^/]+)*$/.test(l)||h.resolved===void 0||typeof h.resolved!="string"||typeof h.integrity!="string"||!/^sha512-[A-Za-z0-9+/]+={0,2}$/.test(h.integrity))return!1;try{const d=new URL(h.resolved);if(d.protocol!=="https:"||d.hostname!=="registry.npmjs.org"||d.port||d.username||d.password||d.search||d.hash||!d.pathname.startsWith("/")||d.pathname.includes(".."))return!1}catch{return!1}}}return!0}function fe(){for(const n of(process.env.PATH??"").split(":")){if(!n.startsWith("/"))continue;const o=u(n,"npm");if(b(o))try{const t=F(o);return(t.startsWith("/usr/")||t.startsWith("/home/linuxbrew/.linuxbrew/"))&&t.endsWith(".js")&&y(t).isFile()?t:null}catch{return null}}return null}function me(n,o,t){const r=re(o,{sourceType:"module",plugins:["typescript"]}),e=new Set;for(const s of r.program.body)if(!(s.type!=="ImportDeclaration"||s.importKind==="type"||!s.source.value.startsWith(".")||I.normalize(I.join(I.dirname(n),s.source.value)).replace(/\.(?:ts|js)$/,"")!==t.replace(/\.ts$/,"")))for(const p of s.specifiers){p.type==="ImportNamespaceSpecifier"&&c("source-unsupported");const l=p.type==="ImportDefaultSpecifier"?"default":p.imported.type==="Identifier"?p.imported.name:p.imported.value;/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(l)||c("source-unsupported"),e.add(l)}return e.size||c("source-unsupported"),e}function he(n,o,t,r){const e=["--die-with-parent","--new-session","--unshare-all","--clearenv","--setenv","HOME","/tmp","--setenv","TMPDIR","/tmp","--setenv","PATH","/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin","--setenv","CI","true","--setenv","NODE_ENV","test","--ro-bind","/usr","/usr"];for(const s of["/lib","/lib64","/bin"])b(s)&&e.push("--ro-bind",s,s);b("/home/linuxbrew/.linuxbrew")&&e.push("--ro-bind","/home/linuxbrew/.linuxbrew","/home/linuxbrew/.linuxbrew"),e.push("--dir","/etc");for(const s of["passwd","group","hosts","nsswitch.conf"])e.push("--ro-bind",u(n,".sandbox-etc",s),`/etc/${s}`);return[...e,"--dev","/dev","--proc","/proc","--tmpfs","/tmp","--ro-bind",n,"/work","--bind",o,"/results","--chdir","/work","--",r,"node_modules/vitest/vitest.mjs","run","--maxWorkers=1",...t,"--reporter=json","--outputFile=/results/report.json"]}function be(n,o,t,r){const e=["--die-with-parent","--new-session","--unshare-all","--clearenv","--setenv","HOME","/tmp","--setenv","TMPDIR","/tmp","--setenv","PATH","/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin","--setenv","CI","true","--setenv","NO_UPDATE_NOTIFIER","1","--setenv","npm_config_cache","/npm-cache","--setenv","npm_config_userconfig","/dev/null","--setenv","npm_config_globalconfig","/tmp/npm-global.npmrc","--ro-bind","/usr","/usr"];for(const s of["/lib","/lib64","/bin"])b(s)&&e.push("--ro-bind",s,s);b("/home/linuxbrew/.linuxbrew")&&e.push("--ro-bind","/home/linuxbrew/.linuxbrew","/home/linuxbrew/.linuxbrew"),e.push("--dir","/etc");for(const s of["passwd","group","hosts","nsswitch.conf"])e.push("--ro-bind",u(n,".sandbox-etc",s),`/etc/${s}`);return[...e,"--dev","/dev","--proc","/proc","--tmpfs","/tmp","--ro-bind",o,"/npm-cache","--bind",n,"/work","--chdir","/work","--",t,r,"ci","--offline","--ignore-scripts","--no-audit","--no-fund"]}function K(n,o,t,r){const e=Z("/usr/bin/bwrap",he(n,o,t,r),{env:{PATH:"/usr/bin:/bin"},timeout:18e4,stdio:"ignore"});return(e.error||e.signal||e.status===null)&&c("sandbox-unavailable"),e.status}function G(n,o){b(u(n,"report.json"))||c("sandbox-unavailable");const t=H(v(n,"report.json",2*1024*1024));(!t||!Array.isArray(t.testResults)||t.testResults.length!==o.length)&&c("tests-failed");const r=new Map;for(const e of t.testResults)(!g(e)||typeof e.name!="string"||!o.some(s=>e.name===`/work/${s}`)||r.has(e.name)||!Array.isArray(e.assertionResults))&&c("tests-failed"),r.set(e.name,e.assertionResults);return o.flatMap(e=>r.get(`/work/${e}`))}function Fe(n){let o=null,t=null,r=0,e=0,s=0,a;const p=[];try{const l=F(process.execPath);(process.platform!=="linux"||!b("/usr/bin/bwrap")||!(l.startsWith("/usr/")||l.startsWith("/home/linuxbrew/.linuxbrew/"))||!y("/usr/bin/bwrap").isFile())&&c("sandbox-unavailable");const h=fe();h||c("toolchain-unavailable");const d=u(se(),".npm");(!b(d)||F(d)!==d||!y(d).isDirectory()||y(d).uid!==process.getuid?.())&&c("toolchain-unavailable");const f=oe(n);(F(f)!==f||!y(f).isDirectory())&&c("source-unsupported");const N=X(f);o=N.sourceHead,t=N.artifactSha256;const{plan:w}=ce(f);r=w.writeSet.length,w.language!=="typescript"&&c("toolchain-unavailable");for(const i of[".npmrc","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"])b(u(f,i))&&c("toolchain-unavailable");(!b(u(f,"package.json"))||!b(u(f,"package-lock.json")))&&c("toolchain-unavailable");const k=v(f,"package.json",1024*1024),j=v(f,"package-lock.json",8*1024*1024);de(k,j)||c("toolchain-unavailable");const W=ae(f,["ls-files","-z","--","src","app","lib","packages","clients"]).toString("utf8").split("\0").filter(Boolean).filter(i=>/^(?:src|app|lib|packages|clients)\//.test(i)&&/\.(?:ts|tsx|js|jsx|mjs|cjs|json)$/.test(i));W.length>ue&&c("source-unsupported");const S=new Map([["package.json",k],["package-lock.json",j]]);for(const i of W)S.set(i,v(f,i,1024*1024));const P=new Map;for(const i of w.aggregates){const m=v(f,i.testFile,pe),E=new TextDecoder("utf-8",{fatal:!0}).decode(m),D=me(i.testFile,E,i.implementationFile),Y=P.get(i.implementationFile)??new Set;for(const ee of D)Y.add(ee);P.set(i.implementationFile,Y),S.set(i.testFile,m)}[...S.values()].reduce((i,m)=>i+m.length,0)>le&&c("source-unsupported"),a=O(u(M(),"p222-property-runtime-")),L(u(a,".sandbox-etc"),{mode:448});const Q=process.getuid?.()??1e3,B=process.getgid?.()??1e3;for(const[i,m]of Object.entries({passwd:`sandbox:x:${Q}:${B}:Sandbox:/work:/bin/sh
|
|
2
|
+
`,group:`sandbox:x:${B}:
|
|
3
|
+
`,hosts:`127.0.0.1 localhost
|
|
4
|
+
`,"nsswitch.conf":`passwd: files
|
|
5
|
+
group: files
|
|
6
|
+
hosts: files
|
|
7
|
+
`}))x(u(a,".sandbox-etc",i),m,{mode:384});x(u(a,"package.json"),k,{mode:384}),x(u(a,"package-lock.json"),j,{mode:384});const R=Z("/usr/bin/bwrap",be(a,d,l,h),{cwd:a,env:{PATH:"/usr/bin:/bin"},timeout:18e4,stdio:"ignore"});(R.error||R.signal||R.status!==0)&&c("install-failed");for(const[i,m]of S)i==="package.json"||i==="package-lock.json"||(L(u(a,ne(i)),{recursive:!0,mode:448}),x(u(a,i),m,{mode:384}));const A=O(u(M(),"p222-property-report-"));p.push(A),K(a,A,w.writeSet,l)!==0&&c(b(u(A,"report.json"))?"tests-failed":"sandbox-unavailable");const _=G(A,w.writeSet);(_.length<w.aggregates.reduce((i,m)=>i+m.invariantCount,0)||_.some(i=>i.status!=="passed"))&&c("tests-failed"),e=_.length;for(const[i,m]of P){const E=[...m].map(D=>D==="default"?`export default function(){throw new Error('${z}')}`:`export const ${D}=function(){throw new Error('${z}')}`).join(`
|
|
8
|
+
`);x(u(a,i),`${E}
|
|
9
|
+
`,{mode:384})}const T=O(u(M(),"p222-property-report-"));p.push(T),(K(a,T,w.writeSet,l)===0||!b(u(T,"report.json")))&&c("mutation-not-causal");const C=G(T,w.writeSet);(C.length!==_.length||C.some(i=>i.status!=="failed"||!Array.isArray(i.failureMessages)||!i.failureMessages.some(m=>typeof m=="string"&&m.includes(z))))&&c("mutation-not-causal"),s=C.length;const U=X(f);return(U.sourceHead!==o||U.artifactSha256!==t||$("sha256").update(k).digest("hex")!==$("sha256").update(v(f,"package.json",1024*1024)).digest("hex")||$("sha256").update(j).digest("hex")!==$("sha256").update(v(f,"package-lock.json",8*1024*1024)).digest("hex"))&&c("source-unsupported"),J("tests-passed",o,t,r,e,s)}catch(l){return J(l instanceof q?l.reason:"source-unsupported",o,t,r,e,s)}finally{for(const l of p)V(l,{recursive:!0,force:!0});a&&V(a,{recursive:!0,force:!0})}}export{Fe as verifyPropertyTestRuntime};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Require direct Vitest cases with real fast-check calls and a value import from the mapped module. */
|
|
2
|
+
export declare function validatePropertyTestTypeScriptSource(input: {
|
|
3
|
+
source: string;
|
|
4
|
+
testFile: string;
|
|
5
|
+
implementationFile: string;
|
|
6
|
+
invariantCount: number;
|
|
7
|
+
numRuns: number;
|
|
8
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parse as h}from"@babel/parser";import{posix as f}from"node:path";const g=1e5;function o(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function u(e,n){return o(e)&&e.type==="Identifier"&&e.name===n}function y(e,n,l){return o(e)&&e.type==="MemberExpression"&&e.computed===!1&&u(e.object,n)&&u(e.property,l)}function w(e,n,l){if(!o(e)||e.type!=="CallExpression"||!y(e.callee,n,"assert")||!Array.isArray(e.arguments)||e.arguments.length!==2)return!1;const i=e.arguments[0],p=e.arguments[1];if(!o(i)||i.type!=="CallExpression"||!(y(i.callee,n,"property")||y(i.callee,n,"asyncProperty"))||!Array.isArray(i.arguments)||i.arguments.length<2||!o(i.arguments[i.arguments.length-1])||!["ArrowFunctionExpression","FunctionExpression"].includes(String(i.arguments[i.arguments.length-1].type))||!o(p)||p.type!=="ObjectExpression"||!Array.isArray(p.properties))return!1;const c=p.properties.filter(t=>o(t)&&t.type==="ObjectProperty"&&t.computed===!1&&(u(t.key,"numRuns")||o(t.key)&&t.key.type==="StringLiteral"&&t.key.value==="numRuns"));return c.length===1&&o(c[0])&&o(c[0].value)&&c[0].value.type==="NumericLiteral"&&c[0].value.value===l&&p.properties.every(t=>o(t)&&t.type==="ObjectProperty"&&t.computed===!1)}function A(e,n,l){const i=[e];let p=0;for(;i.length;){const c=i.pop();if(o(c)){if(++p>g)throw new Error("property-test-source-invalid");if(w(c,n,l))return!0;for(const[t,m]of Object.entries(c))t==="loc"||t==="extra"||t==="comments"||t==="leadingComments"||t==="trailingComments"||(Array.isArray(m)?i.push(...m):o(m)&&i.push(m))}}return!1}function v(e){let n;try{n=h(e.source,{sourceType:"module",plugins:["typescript"]})}catch{throw new Error("property-test-source-invalid")}const l=e.implementationFile.replace(/\.ts$/,"");let i;const p=new Set;let c=!1;for(const s of n.program.body)if(!(s.type!=="ImportDeclaration"||s.importKind==="type"))if(s.source.value==="fast-check"){if(i||s.specifiers.length!==1||!["ImportDefaultSpecifier","ImportNamespaceSpecifier"].includes(s.specifiers[0].type))throw new Error("property-test-source-invalid");i=s.specifiers[0].local.name}else if(s.source.value==="vitest")for(const r of s.specifiers)r.type==="ImportSpecifier"&&r.importKind!=="type"&&r.imported.type==="Identifier"&&["it","test"].includes(r.imported.name)&&p.add(r.local.name);else s.source.value.startsWith(".")&&f.normalize(f.join(f.dirname(e.testFile),s.source.value)).replace(/\.(?:ts|js)$/,"")===l&&s.specifiers.some(a=>a.type!=="ImportSpecifier"||a.importKind!=="type")&&(c=!0);if(!i||p.size===0||!c)throw new Error("property-test-source-invalid");const t=[n.program];let m=0,d=0;for(;t.length;){const s=t.pop();if(o(s)){if(++m>g)throw new Error("property-test-source-invalid");if(s.type==="CallExpression"){const r=s.callee;if(o(r)&&r.type==="MemberExpression"&&o(r.object)&&r.object.type==="Identifier"&&(p.has(String(r.object.name))||r.object.name==="describe")&&o(r.property)&&["skip","todo","only"].includes(String(r.property.name)))throw new Error("property-test-source-invalid");if(o(r)&&r.type==="Identifier"&&p.has(String(r.name))){const a=s.arguments;if(!Array.isArray(a)||a.length<2||!A(a[1],i,e.numRuns))throw new Error("property-test-source-invalid");d++}}for(const[r,a]of Object.entries(s))r==="loc"||r==="extra"||r==="comments"||r==="leadingComments"||r==="trailingComments"||(Array.isArray(a)?t.push(...a):o(a)&&t.push(a))}}if(d<e.invariantCount)throw new Error("property-test-source-invalid")}export{v as validatePropertyTestTypeScriptSource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as H}from"node:crypto";import{analyzeDependencyDag as I,StructuralDagError as y}from"./structural-dag-projection.js";import{classifyInvocationShapeV2 as O}from"./invocation-shape.js";const N=12,J=16,k=["active","archived","rolled-back","synthetic","orphan"],Q=new Set(["in-progress","branch-ready","diagnose","research","write-spec","create-tasks","implemented","refactor-suggest-done","property-tests-emitted","tests-validated","qa-gate-passed","memory-updated","committed","synced","pr-created","pr-reviewed","partial"]),n=(r,e,t={})=>({commandId:r,stateProjectionPolicy:e,...t}),D=Object.freeze({status:n("status","full"),"arch-plan":n("arch-plan","full"),"arch-prd":n("arch-prd","full"),"arch-architecture":n("arch-architecture","epic-targeted",{structuralRequired:!0}),"arch-api-contracts":n("arch-api-contracts","epic-targeted",{structuralRequired:!0}),"arch-api-integrations":n("arch-api-integrations","epic-targeted",{structuralRequired:!0}),"arch-database":n("arch-database","epic-targeted",{structuralRequired:!0}),"arch-security":n("arch-security","epic-targeted",{structuralRequired:!0}),"arch-design-system":n("arch-design-system","epic-targeted",{structuralRequired:!0}),"arch-ux-design":n("arch-ux-design","epic-targeted",{structuralRequired:!0}),"arch-performance":n("arch-performance","epic-targeted",{structuralRequired:!0}),"arch-testing":n("arch-testing","epic-targeted",{structuralRequired:!0}),"arch-infrastructure":n("arch-infrastructure","epic-targeted",{structuralRequired:!0}),"arch-review":n("arch-review","epic-targeted",{structuralRequired:!0}),"arch-fitness-functions":n("arch-fitness-functions","epic-targeted",{structuralRequired:!0}),"create-epic":n("create-epic","epic-summary"),"idea-diagnose":n("idea-diagnose","full"),"idea-research":n("idea-research","epic-targeted",{structuralRequired:!0}),"generate-epic":n("generate-epic","epic-targeted",{structuralRequired:!0}),exec:n("exec","story-targeted",{structuralRequired:!0}),yolo:n("yolo","story-targeted",{structuralRequired:!0}),"yolo-inline":n("yolo-inline","story-targeted",{structuralRequired:!0}),epic:n("epic","epic-targeted",{structuralRequired:!0}),"setup-branch":n("setup-branch","story-targeted",{structuralRequired:!0}),diagnose:n("diagnose","adaptive-targeted"),"diagnose-inline":n("diagnose-inline","full"),research:n("research","adaptive-targeted"),"research-inline":n("research-inline","full"),"write-spec":n("write-spec","story-targeted",{structuralRequired:!0}),"create-tasks":n("create-tasks","story-targeted",{structuralRequired:!0}),implement:n("implement","story-targeted",{structuralRequired:!0}),commit:n("commit","story-targeted",{structuralRequired:!0}),"commit-push":n("commit","story-targeted",{structuralRequired:!0}),sync:n("sync","story-targeted",{structuralRequired:!0}),"sync-main":n("sync","story-targeted",{structuralRequired:!0}),"create-pr":n("create-pr","story-targeted",{structuralRequired:!0}),review:n("review","story-targeted"),"review-pr":n("review","story-targeted"),merge:n("merge","story-targeted",{structuralRequired:!0}),"merge-pr":n("merge","story-targeted",{structuralRequired:!0}),"fix-blocked":n("fix-blocked","story-targeted"),"finalize-epic":n("finalize-epic","epic-targeted"),"resolve-conflicts":n("resolve-conflicts","story-targeted"),"update-memory":n("update-memory","full"),"update-project-memory":n("update-memory","story-targeted",{structuralRequired:!0}),refactor:n("refactor","adaptive-targeted"),"refactor-suggest":n("refactor","story-targeted",{structuralRequired:!0}),cleanup:n("cleanup","full"),audit:n("audit","full"),"tech-debt":n("tech-debt","full"),menu:n("menu","full"),plans:n("plans","full"),billing:n("billing","full"),subscribe:n("subscribe","full"),"qa-scan":n("qa-scan","full"),yoloop:n("yoloop","yoloop-targeted",{structuralRequired:!0}),"migrate-state":n("migrate-state","full"),"migrate-project-id":n("migrate-project-id","full"),"policy-audit":n("policy-audit","full"),"mutation-test":n("mutation-test","full"),"sync-openapi":n("sync-openapi","full"),"generate-pacts":n("generate-pacts","full"),"verify-pacts":n("verify-pacts","full"),"property-test":n("property-test","full"),"property-tests":n("property-test","story-targeted",{structuralRequired:!0}),"chaos-plan":n("chaos-plan","full"),"ui-ux-review":n("ui-ux-review","adaptive-targeted"),"solyd-system":n("solyd-system","adaptive-targeted"),goal:n("goal","continuity-scoped"),loop:n("loop","continuity-scoped"),jobs:n("jobs","continuity-scoped"),runner:n("runner","continuity-scoped"),"goal-tick":n("goal-tick","continuity-scoped"),"loop-tick":n("loop-tick","continuity-scoped"),"validate-tests":n("validate-tests","story-targeted",{structuralRequired:!0}),"qa-gate":n("qa-gate","story-targeted",{structuralRequired:!0})}),X=Object.freeze({st:"status",arquitetura:"arch-plan",architecture:"arch-plan",arch:"arch-plan",prd:"arch-prd","product-requirements":"arch-prd","arch-doc":"arch-architecture","tech-architecture":"arch-architecture","api-contracts":"arch-api-contracts","api-contract":"arch-api-contracts","api-integrations":"arch-api-integrations","api-int":"arch-api-integrations","database-schema":"arch-database","db-schema":"arch-database",db:"arch-database","cyber-security":"arch-security",security:"arch-security",sec:"arch-security","design-system":"arch-design-system",ds:"arch-design-system","atomic-design":"arch-design-system","ux-design":"arch-ux-design",ux:"arch-ux-design",wireframes:"arch-ux-design",wireframe:"arch-ux-design","user-flows":"arch-ux-design",performance:"arch-performance",perf:"arch-performance","capacity-planning":"arch-performance",capacity:"arch-performance","arch-perf":"arch-performance","performance-strategy":"arch-performance","testing-strategy":"arch-testing","test-plan":"arch-testing","test-strategy":"arch-testing","arch-test":"arch-testing",infrastructure:"arch-infrastructure",infra:"arch-infrastructure","deploy-plan":"arch-infrastructure",deployment:"arch-infrastructure","arch-infra":"arch-infrastructure","arch-deploy":"arch-infrastructure","review-consolidation":"arch-review",consolidation:"arch-review","architecture-review":"arch-review","arch-consolidation":"arch-review",fitness:"arch-fitness-functions","fitness-functions":"arch-fitness-functions",archfit:"arch-fitness-functions","arch-fit":"arch-fitness-functions","fit-funcs":"arch-fitness-functions","criar-epic":"create-epic",planejamento:"create-epic","idea-diag":"idea-diagnose","idea-pesq":"idea-research","gerar-epic":"generate-epic",executar:"exec",pipeline:"exec","parallel-epic":"epic",setup:"setup-branch",branch:"setup-branch",diag:"diagnose",diagnostico:"diagnose",c02:"diagnose",pesquisar:"research",pesq:"research","research-fix":"research",c03:"research",spec:"write-spec",especificacao:"write-spec",c04:"write-spec",tasks:"create-tasks",tarefas:"create-tasks",c05:"create-tasks",impl:"implement",implementar:"implement",c06:"implement",push:"commit",commit_push:"commit",cp:"commit",c07:"commit",sincronizar:"sync",c08:"sync",pr:"create-pr",c09:"create-pr",revisar:"review",c11:"review",mesclar:"merge",c12:"merge",fix:"fix-blocked",corrigir:"fix-blocked",finalizar:"finalize-epic",conflitos:"resolve-conflicts",memoria:"update-memory",refactoring:"refactor",refact:"refactor",refac:"refactor",rf:"refactor","cleanup-code":"refactor","code-cleanup":"refactor","code-quality":"refactor","improve-code":"refactor",modernize:"refactor",modernization:"refactor",legacy:"refactor","legacy-code":"refactor","debt-pay":"refactor","pay-debt":"refactor","debt-reduction":"refactor","smell-fix":"refactor","fix-smells":"refactor","code-smells":"refactor",strangler:"refactor","strangler-fig":"refactor",limpar:"cleanup",limpeza:"cleanup",auditar:"audit",auditoria:"audit",debt:"tech-debt",debts:"tech-debt","debt-list":"tech-debt","tech-debts":"tech-debt",td:"tech-debt",help:"menu",ajuda:"menu","?":"menu",commands:"menu",cmds:"menu",planos:"plans",pricing:"plans",bill:"billing",subscription:"billing",sub:"billing",upgrade:"subscribe",checkout:"subscribe",qa:"qa-scan","qa-test":"qa-scan","visual-qa":"qa-scan","e2e-scan":"qa-scan",troubleshoot:"qa-scan","debug-ui":"qa-scan",scan:"qa-scan",a11y:"qa-scan",accessibility:"qa-scan",wcag:"qa-scan","auto-yolo":"yoloop","epic-runner":"yoloop","story-runner":"yoloop","loop-yolo":"yoloop","auto-epic":"yoloop",migrate:"migrate-state","state-migrate":"migrate-state","schema-migrate":"migrate-state",policy:"policy-audit","audit-policy":"policy-audit","policy-history":"policy-audit",policies:"policy-audit",mutation:"mutation-test",stryker:"mutation-test","kill-mutants":"mutation-test","openapi-sync":"sync-openapi","api-sync":"sync-openapi","spec-sync":"sync-openapi","regen-openapi":"sync-openapi",pacts:"generate-pacts","gen-pacts":"generate-pacts","regen-pacts":"generate-pacts","create-pacts":"generate-pacts","verify-pact":"verify-pacts","pact-verify":"verify-pacts","check-pacts":"verify-pacts","pact-check":"verify-pacts",property:"property-test",pbt:"property-test",proptest:"property-test","invariant-test":"property-test",chaos:"chaos-plan",gameday:"chaos-plan","resilience-test":"chaos-plan","ux-review":"ui-ux-review","design-review":"ui-ux-review","visual-review":"ui-ux-review","product-polish":"ui-ux-review","security-system":"solyd-system","authorized-security":"solyd-system","sec-system":"solyd-system",goals:"goal","durable-goal":"goal","continuity-goal":"goal",loops:"loop","durable-loop":"loop","continuity-loop":"loop",job:"jobs","continuity-jobs":"jobs","neocortex-runner":"runner","continuity-runner":"runner"}),ee=Object.freeze({1:"status",3:"arch-plan",4:"arch-prd",5:"arch-architecture",6:"arch-api-contracts",7:"arch-api-integrations",8:"arch-database",9:"arch-security",10:"arch-design-system",11:"arch-ux-design",12:"arch-performance",13:"arch-testing",14:"arch-infrastructure",15:"arch-review",16:"arch-fitness-functions",17:"create-epic",18:"idea-diagnose",19:"idea-research",20:"generate-epic",21:"exec",22:"yolo",23:"epic",24:"setup-branch",25:"diagnose",26:"research",27:"write-spec",28:"create-tasks",29:"implement",30:"commit",31:"sync",32:"create-pr",33:"review",34:"merge",35:"fix-blocked",36:"finalize-epic",37:"resolve-conflicts",38:"update-memory",39:"refactor",40:"cleanup",41:"audit",42:"tech-debt",43:"menu",44:"plans",45:"billing",46:"subscribe",47:"qa-scan",48:"yoloop",49:"migrate-state",50:"policy-audit",51:"mutation-test",52:"sync-openapi",53:"generate-pacts",54:"verify-pacts",55:"property-test",56:"chaos-plan",57:"ui-ux-review",58:"solyd-system",59:"goal",60:"loop",61:"jobs",62:"runner"});function d(r,e=120){if(typeof r!="string")return;const t=r.trim();if(t)return t.replace(/[^a-z0-9_.:-]+/gi,"_").slice(0,e)}function A(r,e=120){if(typeof r!="string")return;const t=r.trim(),i=d(r,e);return i===t?i:void 0}function w(r){if(typeof r!="string")return;const e=r.trim();if(!(!e||e.length>240||!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(e)||e.includes("..")||e.includes("//")||e.includes("@{")||e.endsWith("/")||e.endsWith(".")||e.split("/").some(t=>!t||t.startsWith(".")||t.endsWith(".lock"))))return e}function te(r){if(typeof r!="string")return;const e=r.replace(/\\/g,"/");if(!(!e||e.length>240||e.startsWith("/")||/^[A-Za-z]:/.test(e)||e.includes("..")||e.includes("//")||e.split("/").includes(".")||!/^[A-Za-z0-9._/:@#-]+$/.test(e)))return e}function S(r){if(r===void 0||!Array.isArray(r)||r.length>128)return;const e=r.map(te);if(!e.some(t=>t===void 0))return[...new Set(e)].sort((t,i)=>t.localeCompare(i,"en"))}function re(r){return typeof r=="string"&&Q.has(r.trim().toLowerCase().replace(/_/g,"-"))}function C(r,e){const t={};for(const i of e){const c=r[i];typeof c=="string"||typeof c=="boolean"||typeof c=="number"&&Number.isFinite(c)?t[i]=c:Array.isArray(c)&&c.every(o=>typeof o=="string")&&(t[i]=[...c])}return t}function ie(r,e){const t=e.checkpoint;if(!h(t)||t.schemaVersion!==1||t.storyId!==r||t.epicId!==e.epic_id||!w(t.branch)||typeof t.baseSha!="string"||!/^[0-9a-f]{7,64}$/i.test(t.baseSha)||typeof t.headSha!="string"||!/^[0-9a-f]{7,64}$/i.test(t.headSha)||t.baseSha===t.headSha||!A(t.idempotencyKey)||typeof t.recordedAt!="string"||!Number.isFinite(Date.parse(t.recordedAt))||!Array.isArray(t.commits)||t.commits.length===0||t.commits.length>256||t.commits.some(c=>typeof c!="string"||!/^[0-9a-f]{7,64}$/i.test(c))||!Array.isArray(t.receiptRefs)||t.receiptRefs.length===0||t.receiptRefs.length>256||t.receiptRefs.some(c=>typeof c!="string"||c.length>240||c.includes("..")||!/^[A-Za-z0-9._:/#\-[\]]+$/.test(c))||!h(t.qaReceipt)||t.qaReceipt.kind!=="story_qa_evidence"||t.qaReceipt.producer!=="local-yolo-tdd"||!["passed","blocked"].includes(String(t.qaVerdict))||!["approved","changes-requested","pending"].includes(String(t.reviewVerdict))||(t.reviewVerdict==="pending"?t.reviewReceipt!==void 0:!h(t.reviewReceipt)))return;const i=C(t,["schemaVersion","storyId","epicId","branch","baseSha","headSha","idempotencyKey","dispatchId","bundleId","bundleDigest","graphRevision","claimRevision","qaVerdict","reviewVerdict","recordedAt","commits","receiptRefs"]);return i.qaReceipt=C(t.qaReceipt,["schemaVersion","kind","producer","evidenceVersion","storyId","epicId","contract","command","manifestDigest","gateIds","resultDigest","baseSha","headSha","bundleDigest","graphRevision","sourceEvidenceDigest","verdict","checkedAt","receiptRef"]),h(t.reviewReceipt)&&(i.reviewReceipt=C(t.reviewReceipt,["schemaVersion","kind","producer","storyId","epicId","baseSha","headSha","bundleDigest","graphRevision","sourceEvidenceDigest","qaReceiptRef","verdict","reviewedAt","receiptRef"])),i}function ce(r,e){const t=e.checkpoint_verification;if(!(!h(t)||t.schemaVersion!==1||t.kind!=="story_checkpoint_physical_verification"||t.producer!=="client-p205-transient-v1"||t.publicSafe!==!0||t.storyId!==r||t.epicId!==e.epic_id||!["verified","rejected"].includes(String(t.verdict))))return C(t,["schemaVersion","kind","producer","storyId","epicId","branch","baseSha","headSha","aggregateHeadSha","commitBodyDigest","changedPathsDigest","claimVerification","effectiveClaimRevision","command","manifestDigest","gateIds","resultDigest","graphRevision","executionEvidenceDigest","sourceEvidenceDigest","verifiedAt","verdict","reasonCodes","publicSafe"])}function U(r,e){const t=e.scheduling_checkpoint_evidence,i=new Set(["schemaVersion","kind","producer","storyId","epicId","branch","baseSha","headSha","graphRevision","effectiveClaimRevision","sourceEvidenceDigest","verifiedAt","reasonCodes","integrationAuthorized","publicSafe"]);if(!(!h(t)||Object.keys(t).some(c=>!i.has(c))||t.schemaVersion!==1||t.kind!=="story_scheduling_checkpoint_evidence"||t.producer!=="client-git-physical-v1"||t.publicSafe!==!0||t.integrationAuthorized!==!1||t.storyId!==r||t.epicId!==e.epic_id||!w(t.branch)||typeof t.baseSha!="string"||!/^[0-9a-f]{40,64}$/i.test(t.baseSha)||typeof t.headSha!="string"||!/^[0-9a-f]{40,64}$/i.test(t.headSha)||typeof t.graphRevision!="string"||!/^[0-9a-f]{64}$/i.test(t.graphRevision)||typeof t.effectiveClaimRevision!="string"||!/^[0-9a-f]{64}$/i.test(t.effectiveClaimRevision)||typeof t.sourceEvidenceDigest!="string"||!/^[0-9a-f]{64}$/i.test(t.sourceEvidenceDigest)||typeof t.verifiedAt!="string"||!Number.isFinite(Date.parse(t.verifiedAt))||!Array.isArray(t.reasonCodes)||t.reasonCodes.length!==1||t.reasonCodes[0]!=="checkpoint-git-scheduling-verified"))return C(t,[...i])}function oe(r,e){const t={...e},i=U(r,e);return i?(t.scheduling_checkpoint_evidence=i,delete t.checkpoint,delete t.checkpoint_verification):delete t.scheduling_checkpoint_evidence,t}function h(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function _(...r){const e=new Set,t=[];for(const i of r)for(const c of i??[]){const o=d(c,80);if(!(!o||e.has(o))&&(e.add(o),t.push(o),t.length>=J))return t}return t}function ne(r){return r.trim().replace(/^@?\*/,"").replace(/^@/,"").toLowerCase()}function se(r){return r.trim().split(/\s+/,1)[0]??""}function M(r){const e=se(r);if(!e)return D.menu;const t=ne(e),i=ee[t]??X[t]??t;return D[i]??null}function ae(r,e,t,i="full-compatible",c=["full-state"]){return{kind:"full",commandId:t?.commandId??null,stateProjectionPolicy:t?.stateProjectionPolicy??null,projectionMode:i,trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:Object.keys(e.stories).length,includedEpicCount:Object.keys(e.epics).length,omittedStoryCount:0,omittedEpicCount:0,reason:"full-state",reasonCodes:_(c)}}function ze(r,e,t,i="full-compatible",c=["full-state"]){const o=ae(r,e,t,i,c);return v({...e,scope:o},e,o)}function de(r){const[e]=r.trim().split(/\s+/,1);return e?/^[A-Z]?\d+(?:\.\d+)+$/i.test(e.replace(/^@/,""))||/(?:^|\/)[A-Z]?\d+(?:\.\d+)+\.story\.md$/i.test(e.replace(/^@/,"")):!1}function z(r){const e=r.match(/(?:^|[/@\s])([A-Z]?\d+(?:\.\d+)+)\.story\.md\b/i);return e?.[1]?e[1]:r.match(/(?:^|\s|@)([A-Z]?\d+(?:\.\d+)+)(?=$|\s)/i)?.[1]??null}function ue(r){const e=r.trim(),t=e.search(/\s/);return t===-1?"":e.slice(t).trim()}function T(r){return ue(r).split(/\s+/).map(e=>e.replace(/^@/,"").replace(/^['"]|['"]$/g,"")).filter(e=>e.length>0&&!e.startsWith("-"))}function Fe(r){return T(r)[0]??null}function F(r,e){const i=r.replace(/^@/,"").replace(/^epic-/i,"").replace(/\.md$/i,""),c=[i,i.toUpperCase(),/^p\d+$/i.test(i)?`P${i.replace(/^p/i,"")}`:null,/^\d+$/.test(i)?`P${i}`:null].filter(o=>typeof o=="string"&&o.length>0);for(const o of c)if(e.epics[o])return o;return null}function le(r,e){const t=r.match(/(?:^|[/@\s])epic-(P?\d+)\.md\b/i);return t?.[1]?F(t[1],e):null}function R(r,e){const t=le(r,e);if(t)return t;for(const i of T(r)){if(/^[A-Z]?\d+(?:\.\d+)+$/i.test(i))continue;const c=F(i,e);if(c)return c}return null}function pe(r,e){const t=R(r,e);if(t)return t;const i=e.yoloop,c=i?.state?.currentSession?.currentEpicId;if(typeof c=="string"&&e.epics[c])return c;const o=i?.lock?.currentEpicId??i?.lock?.epicId;return typeof o=="string"&&e.epics[o]?o:null}function fe(r){const e=r.match(/(?:^|[/@\s])epic-(P?\d+)\.md\b/i)?.[1];if(e)return/^P/i.test(e)?e.toUpperCase():`P${e}`;for(const t of T(r)){if(/^P\d+$/i.test(t))return t.toUpperCase();if(/^\d+$/.test(t))return`P${t}`}return null}function j(r,e){if(typeof r.epic_id=="string"&&r.epic_id.length>0)return r.epic_id;const t=e.split(".").slice(0,-1).join(".");return t.length>0?t:null}function L(r){return typeof r=="string"&&["done","completed","merged","cancelled","canceled","abandoned"].includes(r.toLowerCase())}function q(r,e,t){if(t.has(r))return;const i=e.stories[r];if(!i)return;t.add(r);const c=i.depends_on;if(Array.isArray(c))for(const o of c)typeof o=="string"&&q(o,e,t)}function ye(r,e){const t=I(e.stories,[r]),i={};for(const c of t.orderedIds){const o=e.stories[c];o&&(i[c]=o)}return i}function $(r,e,t=[]){const i={};for(const c of t)e.epics[c]&&(i[c]=e.epics[c]);for(const[c,o]of Object.entries(r)){const s=j(o,c);s&&e.epics[s]&&(i[s]=e.epics[s])}return i}function me(r,e,t){if(t.has(r))return;const i=e.epics[r];if(!i)return;t.add(r);const c=i.depends_on;if(Array.isArray(c))for(const o of c)typeof o=="string"&&o.length>0&&me(o,e,t)}function V(r,e,t){const i=I(t.epics,[r]),c=new Set(i.orderedIds);for(const[s,a]of Object.entries(e)){const u=j(a,s);u&&t.epics[u]&&c.add(u)}const o={};for(const s of[...c].sort((a,u)=>a.localeCompare(u,"en"))){const a=t.epics[s];a&&(o[s]=s===r?a:K(s,a))}return o}function G(r,e,t){const i=e.stories;if(!Array.isArray(i)||i.some(s=>typeof s!="string"||s.length===0))throw new y("STRUCTURAL_DEPENDENCY_MISSING",{nodes:0,edges:0,malformedStoryMemberships:1});const c=I(t.stories,i),o={};for(const s of c.orderedIds){const a=t.stories[s];a&&(o[s]=j(a,s)===r?oe(s,a):Y(s,a))}return o}function ge(r,e,t){const i=[...e.stories].sort((s,a)=>s.localeCompare(a,"en")),c=Object.entries(t).filter(([s,a])=>j(a,s)===r).map(([s])=>s).sort((s,a)=>s.localeCompare(a,"en")),o=H("sha256").update(`target-epic-coverage-v1\0${JSON.stringify({targetEpicId:r,declaredStoryIds:i,includedStoryIds:c})}`).digest("hex");return{schemaVersion:"TargetEpicCoverage/1.0",targetEpicId:r,declaredStoryIds:i,includedStoryIds:c,membershipSha256:o,publicSafe:!0}}function Y(r,e){const t=Array.isArray(e.depends_on)?[...new Set(e.depends_on.filter(m=>typeof m=="string"&&m.length>0))].sort((m,E)=>m.localeCompare(E,"en")):[],i={id:d(e.id)??r,...d(e.epic_id)?{epic_id:d(e.epic_id)}:{},...d(e.status,40)?{status:d(e.status,40)}:{},depends_on:t},c=U(r,e);if(!re(e.status))return{...i,...c?{scheduling_checkpoint_evidence:c}:{}};const o=e.source==="create-epic"||e.source==="discovered"?e.source:void 0,s=w(e.branch_name),a=A(e.last_step,120),u=Array.isArray(e.steps_completed)&&e.steps_completed.length<=64?e.steps_completed.map(m=>A(m,120)):[],l=u.length>0&&u.every(m=>m!==void 0)?u:void 0,f=typeof e.pr_number=="number"&&Number.isSafeInteger(e.pr_number)&&e.pr_number>0?e.pr_number:void 0,p=ie(r,e),g=p?ce(r,e):void 0;return{...i,...o?{source:o}:{},...s?{branch_name:s}:{},...a?{last_step:a}:{},...l?{steps_completed:l}:{},...f?{pr_number:f}:{},...p?{checkpoint:p}:{},...g?{checkpoint_verification:g}:{},...c?{scheduling_checkpoint_evidence:c}:{},...S(e.files_to_modify)!==void 0?{files_to_modify:S(e.files_to_modify)}:{},...S(e.contracts)!==void 0?{contracts:S(e.contracts)}:{},...S(e.contract_refs)!==void 0?{contract_refs:S(e.contract_refs)}:{},...S(e.shared_surfaces)!==void 0?{shared_surfaces:S(e.shared_surfaces)}:{}}}function K(r,e){const t=Array.isArray(e.stories)?[...new Set(e.stories.filter(c=>typeof c=="string"&&c.length>0))].sort((c,o)=>c.localeCompare(o,"en")):[],i=Array.isArray(e.depends_on)?[...new Set(e.depends_on.filter(c=>typeof c=="string"&&c.length>0))].sort((c,o)=>c.localeCompare(o,"en")):[];return{id:d(e.id)??r,...d(e.status,40)?{status:d(e.status,40)}:{},...d(e.lifecycle_classification,40)?{lifecycle_classification:d(e.lifecycle_classification,40)}:{},stories:t,depends_on:i}}function he(r,e,t){const i=I(e.stories),c=I(e.epics),o=Object.fromEntries(i.orderedIds.map(u=>[u,Y(u,e.stories[u])])),s=Object.fromEntries(c.orderedIds.map(u=>[u,K(u,e.epics[u])])),a={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:"yoloop-discovery",trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:i.orderedIds.length,includedEpicCount:c.orderedIds.length,omittedStoryCount:0,omittedEpicCount:0,reason:"targeted-invocation",reasonCodes:_(["structural-required","yoloop-discovery",`structural-edges-${i.edgeCount+c.edgeCount}`,"content-fields-omitted"])};return v({...e,stories:o,epics:s,scope:a},e,a)}function be(r,e){const t=new Set,i=r.stories;if(Array.isArray(i))for(const o of i)typeof o=="string"&&q(o,e,t);const c={};for(const o of t){const s=e.stories[o];s&&(c[o]=s)}return c}function _e(r){const e={};for(const[t,i]of Object.entries(r.epics))e[t]={id:d(i.id)??t,...d(i.status)?{status:d(i.status)}:{},...k.includes(i.lifecycle_classification)?{lifecycle_classification:i.lifecycle_classification}:{},...typeof i.total_stories=="number"&&Number.isFinite(i.total_stories)?{total_stories:i.total_stories}:{},...typeof i.completed_stories=="number"&&Number.isFinite(i.completed_stories)?{completed_stories:i.completed_stories}:{}};return e}function W(r){const e={};for(const t of Object.values(r)){const i=d(t.status,40)??"unknown";e[i]=(e[i]??0)+1}return e}function Se(r){const e=Object.fromEntries(k.map(t=>[t,0]));for(const t of Object.values(r)){const i=k.includes(t.lifecycle_classification)?t.lifecycle_classification:"active";e[i]=(e[i]??0)+1}return e}function P(r,e){if(!e)return!0;const t=r.epics[e];return t?!k.includes(t.lifecycle_classification)||t.lifecycle_classification==="active":!0}function Z(r){for(const e of["last_updated","updated_at","completed_at","created_at","discovered_at"]){const t=r[e];if(typeof t!="string")continue;const i=Date.parse(t);if(Number.isFinite(i))return i}return 0}function je(r){return Object.entries(r.stories).map(([e,t])=>({id:e,story:t,timestamp:Z(t)})).sort((e,t)=>t.timestamp-e.timestamp||e.id.localeCompare(t.id)).slice(0,N).map(({id:e,story:t})=>({id:e,...d(t.epic_id)?{epicId:d(t.epic_id)}:{},...d(t.status,40)?{status:d(t.status,40)}:{},...d(t.last_step??t.lastStep)?{lastStep:d(t.last_step??t.lastStep)}:{},...d(t.last_updated??t.updated_at??t.completed_at??t.created_at)?{lastUpdated:d(t.last_updated??t.updated_at??t.completed_at??t.created_at)}:{}}))}function ve(r){const e=r.current_session;if(!e)return;const t={activeEpicId:d(e.active_epic_id)??null,activeStoryId:d(e.active_story_id)??null,activeStepId:d(e.active_step_id)??null,sessionId:d(e.session_id)??null,startedAt:d(e.started_at)??null};return Object.values(t).some(i=>i!=null)?t:void 0}function Ie(r){const e=r.yoloop;if(!h(e))return;const t=h(e.state)?e.state:void 0,i=h(t?.currentSession)?t.currentSession:void 0,c=h(e.lock)?e.lock:void 0,o={...typeof e.active=="boolean"?{active:e.active}:{},currentEpicId:d(i?.currentEpicId??e.currentEpicId)??null,currentStoryId:d(i?.currentStoryId??e.currentStoryId)??null,sessionId:d(i?.sessionId??e.sessionId)??null,lockEpicId:d(c?.currentEpicId??c?.epicId)??null};return Object.keys(o).length>0?o:void 0}function ke(r){const e=r.continuity;if(!h(e))return;const t=Array.isArray(e.reasonCodes)?e.reasonCodes.filter(i=>typeof i=="string"):void 0;return{present:!0,activeJobId:d(e.activeJobId??e.jobId)??null,activeGoalId:d(e.activeGoalId??e.goalId)??null,activeLoopId:d(e.activeLoopId??e.loopId)??null,...t&&t.length>0?{reasonCodes:_(t)}:{}}}function Ce(r,e,t){const i=d(e?.activeStoryId),c=d(e?.activeEpicId),o=d(e?.activeStepId),s=i&&r.stories[i]?j(r.stories[i],i):null;if((i||c||o)&&P(r,c??s))return{epicId:c??null,storyId:i??null,stepId:o??null};const a=d(t?.currentStoryId),u=d(t?.currentEpicId??t?.lockEpicId);if((a||u)&&P(r,u))return{epicId:u??null,storyId:a??null,stepId:null};const l=Object.entries(r.stories).map(([f,p])=>({id:f,story:p,timestamp:Z(p)})).filter(({id:f,story:p})=>!L(p.status)&&P(r,j(p,f))).sort((f,p)=>p.timestamp-f.timestamp||f.id.localeCompare(p.id))[0];return l?{epicId:j(l.story,l.id),storyId:l.id,stepId:d(l.story.last_step??l.story.lastStep)??null}:{epicId:null,storyId:null,stepId:null}}function Ee(r,e){const t=W(r.stories),i=W(r.epics),c=Se(r.epics),o=Object.values(r.epics).filter(g=>(k.includes(g.lifecycle_classification)?g.lifecycle_classification:"active")==="active"&&!L(g.status)).length,s=ve(r),a=Ie(r),u=ke(r),l=Ce(r,s,a),f=je(r),p=_(e.reasonCodes,["state-summary-attached","state-summary-bounded",`projection-${e.projectionMode??e.kind}`,e.stateProjectionPolicy?`policy-${e.stateProjectionPolicy}`:"policy-unknown",f.length>=N?"recent-stories-capped":"recent-stories-bounded",l.storyId||l.epicId?"active-ref-derived":"active-ref-empty",a?"yoloop-session-present":"yoloop-session-absent",u?"continuity-session-present":"continuity-session-absent"]);return{schemaVersion:1,totals:{stories:Object.keys(r.stories).length,epics:Object.keys(r.epics).length,storyStatus:t,epicStatus:i,epicLifecycle:c,activeEpics:o,blockedStories:t.blocked??0},active:l,blockedCount:t.blocked??0,recentStories:f,...s?{currentSession:s}:{},...a?{currentYoloopSession:a}:{},...u?{currentContinuitySession:u}:{},projection:{commandId:e.commandId??null,stateProjectionPolicy:e.stateProjectionPolicy??null,projectionMode:e.projectionMode,scopeKind:e.kind,includedStoryCount:e.includedStoryCount,includedEpicCount:e.includedEpicCount??Object.keys(r.epics).length,omittedStoryCount:e.omittedStoryCount,omittedEpicCount:e.omittedEpicCount,reason:e.reason},reasonCodes:p,publicSafe:!0}}function v(r,e,t){return{...r,stateSummary:Ee(e,t)}}function Re(r,e,t){const i={};for(const o of Object.keys(e.epics))i[o]={id:o};const c={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:"summary-only",trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:0,includedEpicCount:Object.keys(i).length,omittedStoryCount:Object.keys(e.stories).length,omittedEpicCount:0,reason:"epic-summary",reasonCodes:["epic-summary","stories-omitted","epic-stubs-only"]};return v({...e,stories:{},epics:i,scope:c},e,c)}function b(r,e,t,i=["summary-only","stories-omitted"],c="summary-only"){const o=_e(e),s={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:c,trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:0,includedEpicCount:Object.keys(o).length,omittedStoryCount:Object.keys(e.stories).length,omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(o).length),reason:"summary-only",reasonCodes:_(i)};return v({...e,stories:{},epics:o,scope:s},e,s)}function x(r,e,t,i,c,o){const s=e.stories[i];if(!s)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"story"});const a=j(s,i);if(!a)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const u=e.epics[a];if(!u)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const l=c==="yolo-story",f=l?G(a,u,e):ye(i,e),p=l?V(a,f,e):$(f,e);if(!f[i]||!p[a])throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(f).length,epics:Object.keys(p).length,targetKind:"story"});const g={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:c,trigger:r,targetEpicId:a,targetStoryId:i,includedStoryCount:Object.keys(f).length,includedEpicCount:Object.keys(p).length,omittedStoryCount:Math.max(0,Object.keys(e.stories).length-Object.keys(f).length),omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(p).length),reason:"targeted-invocation",reasonCodes:_(o,l?["epic-graph-authority-complete"]:[])};return v({...e,stories:f,epics:p,scope:g},e,g)}function B(r,e,t,i,c,o){const s=e.epics[i];if(!s)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const a=be(s,e),u=$(a,e,[i]);if(!u[i])throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(a).length,epics:Object.keys(u).length,targetKind:"epic"});const l={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:c,trigger:r,targetEpicId:i,targetStoryId:null,includedStoryCount:Object.keys(a).length,includedEpicCount:Object.keys(u).length,omittedStoryCount:Math.max(0,Object.keys(e.stories).length-Object.keys(a).length),omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(u).length),reason:"targeted-invocation",reasonCodes:_(o)};return v({...e,stories:a,epics:u,scope:l},e,l)}function Oe(r,e,t){const i=fe(r),c=R(r,e);if(i&&!c)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const o=pe(r,e),s=O({commandId:t.commandId,explicitYoloopEpicId:c,sessionYoloopEpicId:c?null:o});if(s==="yoloop-discovery")return he(r,e,t);if(!o||s!=="yoloop-target"&&s!=="yoloop-session")throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const a=e.epics[o];if(!a)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const u=G(o,a,e),l=V(o,u,e);if(!l[o])throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(u).length,epics:Object.keys(l).length,targetKind:"epic"});const f=s,p={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:f,trigger:r,targetEpicId:o,targetStoryId:null,targetEpicCoverage:ge(o,a,u),includedStoryCount:Object.keys(u).length,includedEpicCount:Object.keys(l).length,omittedStoryCount:Math.max(0,Object.keys(e.stories).length-Object.keys(u).length),omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(l).length),reason:"targeted-invocation",reasonCodes:["structural-required",f,"yoloop-targeted"]};return v({...e,stories:u,epics:l,scope:p},e,p)}function Ae(r,e){const t={};for(const[i,c]of Object.entries(r.epics)){const o=Array.isArray(c.stories)?c.stories.filter(s=>typeof s=="string"&&e.has(s)):[];t[i]={id:d(c.id)??i,...d(c.status,40)?{status:d(c.status,40)}:{},...typeof c.total_stories=="number"&&Number.isFinite(c.total_stories)?{total_stories:c.total_stories}:{},...typeof c.completed_stories=="number"&&Number.isFinite(c.completed_stories)?{completed_stories:c.completed_stories}:{},...o.length>0?{stories:o}:{},...o.length>0&&Array.isArray(c.depends_on)?{depends_on:c.depends_on.filter(s=>typeof s=="string"&&s.length>0)}:{},...o.length>0&&(c.branch_mode==="epic"||c.branch_mode==="story")?{branch_mode:c.branch_mode}:{},...o.length>0&&typeof c.execution_branch=="string"?{execution_branch:c.execution_branch}:{},...o.length>0&&typeof c.origin_branch=="string"?{origin_branch:c.origin_branch}:{},...o.length>0&&(c.branch_lease===null||typeof c.branch_lease=="object")?{branch_lease:c.branch_lease}:{},...o.length>0&&(c.origin_binding===null||typeof c.origin_binding=="object")?{origin_binding:c.origin_binding}:{},...o.length>0&&(c.aggregate_qa_receipt===null||typeof c.aggregate_qa_receipt=="object")?{aggregate_qa_receipt:c.aggregate_qa_receipt}:{}}}return t}function we(r){return r.stateSummary?.totals.stories??(r.scope?.includedStoryCount??Object.keys(r.stories).length)+(r.scope?.omittedStoryCount??0)}function Te(r){return r.stateSummary?.totals.epics??(r.scope?.includedEpicCount??Object.keys(r.epics).length)+(r.scope?.omittedEpicCount??0)}function qe(r,e){if(r.stateSummary)return{...r.stateSummary,projection:{...r.stateSummary.projection,scopeKind:"projected",projectionMode:e.projectionMode,includedStoryCount:e.includedStoryCount,includedEpicCount:e.includedEpicCount??r.stateSummary.projection.includedEpicCount,omittedStoryCount:e.omittedStoryCount,omittedEpicCount:e.omittedEpicCount,reason:"body-size"},reasonCodes:_(r.stateSummary.reasonCodes,["payload-size-guardrail","state-summary-preserved","nonessential-state-degraded"])}}function Le(r){const e=r.scope,t=new Set,i=e?.projectionMode==="structural-required"||e?.projectionMode==="yolo-story"||e?.projectionMode==="yoloop-target"||e?.projectionMode==="yoloop-session"||e?.projectionMode==="yoloop-discovery";if(i)for(const m of Object.keys(r.stories))t.add(m);else e?.targetStoryId&&q(e.targetStoryId,r,t);const c={};for(const m of t){const E=r.stories[m];E&&(c[m]=E)}const o=Ae(r,t),s=Object.keys(c).length,a=Object.keys(o).length,u=Math.max(0,we(r)-s),l=Math.max(0,Te(r)-a),f=i?e?.projectionMode??"structural-required":e?.projectionMode==="yolo-story"?"yolo-story":"summary-only",p={kind:"projected",commandId:e?.commandId??null,stateProjectionPolicy:e?.stateProjectionPolicy??null,projectionMode:f,targetEpicId:e?.targetEpicId??null,targetStoryId:e?.targetStoryId??null,...e?.targetEpicCoverage?{targetEpicCoverage:e.targetEpicCoverage}:{},includedStoryCount:s,includedEpicCount:a,omittedStoryCount:u,omittedEpicCount:l,reason:"body-size",reasonCodes:_(e?.reasonCodes,["payload-size-guardrail",t.size>0?"structural-targets-preserved":"stories-omitted","epics-stubbed","state-summary-preserved","redundant-trigger-omitted"])},g=qe(r,p);return{...r,stories:c,epics:o,scope:p,...g?{stateSummary:g}:{}}}function Pe(r,e){const t=r.trim(),i=M(t);try{if(!i){if(de(t)){const o=n("story-reference","story-targeted"),s=z(t);if(s)return x(t,e,o,s,"targeted-story",["story-reference-targeted"])}return b(t,e,n("unknown","adaptive-targeted"),["unknown-command-summary-only"])}if(i.stateProjectionPolicy==="epic-summary")return Re(t,e,i);if(i.stateProjectionPolicy==="yoloop-targeted")return Oe(t,e,i);const c=z(t);if(i.stateProjectionPolicy==="story-targeted"){if(c){const s=O({commandId:i.commandId,targetStoryId:c})==="yolo-story";return x(t,e,i,c,s?"yolo-story":i.structuralRequired?"structural-required":"targeted-story",[s?"yolo-story":i.structuralRequired?"structural-required":"targeted-story"])}if(i.commandId==="yolo"||i.commandId==="yolo-inline"){const o=O({commandId:i.commandId});return b(t,e,i,["yolo-inline","stories-omitted","historical-content-omitted"],o??"yolo-inline")}return i.commandId==="commit"&&/^\*?(?:commit|commit-push)$/i.test(t)?b(t,e,i,["working-tree-commit","stories-omitted","historical-content-omitted"]):i.structuralRequired?(()=>{throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"story"})})():b(t,e,i,["story-target-missing-summary-only"])}if(i.stateProjectionPolicy==="adaptive-targeted"){if(c&&e.stories[c])return x(t,e,i,c,"targeted-story",["adaptive-story-targeted"]);const o=R(t,e);return o?B(t,e,i,o,"targeted-epic",["adaptive-epic-targeted"]):b(t,e,i,["adaptive-summary-only","target-unresolved-summary-only"])}if(i.stateProjectionPolicy==="epic-targeted"){if(i.commandId.startsWith("arch-")&&/(?:^|\s)epic-arch\s*$/i.test(t)&&e.archPlan?.execution?.currentStageCommand===i.commandId)return b(t,e,i,["architecture-root-delegated"]);const o=R(t,e);return o?B(t,e,i,o,i.structuralRequired?"structural-required":"targeted-epic",[i.structuralRequired?"structural-required":"targeted-epic"]):i.structuralRequired?(()=>{throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"})})():b(t,e,i,["epic-target-missing-summary-only"])}return i.stateProjectionPolicy==="continuity-scoped"?b(t,e,i,["continuity-scoped-summary-only"]):b(t,e,i,["policy-full-summary-only"])}catch(c){if(c instanceof y)throw c;if(i?.structuralRequired)throw new y("STRUCTURAL_DEPENDENCY_MISSING",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,projectionErrors:1});return b(t,e,i??n("unknown","adaptive-targeted"),["projection-error-summary-only"])}}const xe=new Set(["yolo-story","yolo-inline","yoloop-target","yoloop-session","yoloop-discovery"]);function Ne(r){let e=0;for(const t of[r.stories,r.epics])for(const i of Object.values(t))Array.isArray(i.depends_on)&&(e+=i.depends_on.filter(c=>typeof c=="string").length);return e}function $e(r,e){const t=M(r.trim());if(!t||!["yolo","yolo-inline","yoloop"].includes(t.commandId))return null;try{const i=Pe(r,e),c=i.scope?.projectionMode;if(!c||!xe.has(c))throw new y("STRUCTURAL_DEPENDENCY_MISSING",{stories:Object.keys(i.stories).length,epics:Object.keys(i.epics).length,projectionShapeErrors:1});return Object.freeze({ok:!0,version:2,shape:c,snapshot:i,included:{epics:i.scope?.includedEpicCount??Object.keys(i.epics).length,stories:i.scope?.includedStoryCount??Object.keys(i.stories).length,edges:Ne(i)},omitted:{epics:i.scope?.omittedEpicCount??0,stories:i.scope?.omittedStoryCount??0},cycleCount:0})}catch(i){if(!(i instanceof y))throw i;return Object.freeze({ok:!1,code:i.code,publicDetails:i.publicDetails})}}export{Le as degradeStateSnapshotForPayloadLimit,Pe as projectStateSnapshotForInvoke,$e as projectStateSnapshotResultV2ForInvoke};
|
|
1
|
+
import{createHash as H}from"node:crypto";import{analyzeDependencyDag as I,StructuralDagError as y}from"./structural-dag-projection.js";import{classifyInvocationShapeV2 as O}from"./invocation-shape.js";const U=12,J=16,k=["active","archived","rolled-back","synthetic","orphan"],Q=new Set(["in-progress","branch-ready","diagnose","research","write-spec","create-tasks","implemented","refactor-suggest-done","property-tests-emitted","tests-validated","qa-gate-passed","memory-updated","committed","synced","pr-created","pr-reviewed","partial"]),n=(r,e,t={})=>({commandId:r,stateProjectionPolicy:e,...t}),A=Object.freeze({status:n("status","full"),"arch-plan":n("arch-plan","full"),"arch-prd":n("arch-prd","full"),"arch-architecture":n("arch-architecture","epic-targeted",{structuralRequired:!0}),"arch-api-contracts":n("arch-api-contracts","epic-targeted",{structuralRequired:!0}),"arch-api-integrations":n("arch-api-integrations","epic-targeted",{structuralRequired:!0}),"arch-database":n("arch-database","epic-targeted",{structuralRequired:!0}),"arch-security":n("arch-security","epic-targeted",{structuralRequired:!0}),"arch-design-system":n("arch-design-system","epic-targeted",{structuralRequired:!0}),"arch-ux-design":n("arch-ux-design","epic-targeted",{structuralRequired:!0}),"arch-performance":n("arch-performance","epic-targeted",{structuralRequired:!0}),"arch-testing":n("arch-testing","epic-targeted",{structuralRequired:!0}),"arch-infrastructure":n("arch-infrastructure","epic-targeted",{structuralRequired:!0}),"arch-review":n("arch-review","epic-targeted",{structuralRequired:!0}),"arch-fitness-functions":n("arch-fitness-functions","epic-targeted",{structuralRequired:!0}),"create-epic":n("create-epic","epic-summary"),"idea-diagnose":n("idea-diagnose","full"),"idea-research":n("idea-research","epic-targeted",{structuralRequired:!0}),"generate-epic":n("generate-epic","epic-targeted",{structuralRequired:!0}),exec:n("exec","story-targeted",{structuralRequired:!0}),yolo:n("yolo","story-targeted",{structuralRequired:!0}),"yolo-inline":n("yolo-inline","story-targeted",{structuralRequired:!0}),epic:n("epic","epic-targeted",{structuralRequired:!0}),"setup-branch":n("setup-branch","story-targeted",{structuralRequired:!0}),diagnose:n("diagnose","adaptive-targeted"),"diagnose-inline":n("diagnose-inline","full"),research:n("research","adaptive-targeted"),"research-inline":n("research-inline","full"),"write-spec":n("write-spec","story-targeted",{structuralRequired:!0}),"create-tasks":n("create-tasks","story-targeted",{structuralRequired:!0}),implement:n("implement","story-targeted",{structuralRequired:!0}),commit:n("commit","story-targeted",{structuralRequired:!0}),"commit-push":n("commit","story-targeted",{structuralRequired:!0}),sync:n("sync","story-targeted",{structuralRequired:!0}),"sync-main":n("sync","story-targeted",{structuralRequired:!0}),"create-pr":n("create-pr","story-targeted",{structuralRequired:!0}),review:n("review","story-targeted"),"review-pr":n("review","story-targeted"),merge:n("merge","story-targeted",{structuralRequired:!0}),"merge-pr":n("merge","story-targeted",{structuralRequired:!0}),"fix-blocked":n("fix-blocked","story-targeted"),"finalize-epic":n("finalize-epic","epic-targeted"),"resolve-conflicts":n("resolve-conflicts","story-targeted"),"update-memory":n("update-memory","full"),"update-project-memory":n("update-memory","story-targeted",{structuralRequired:!0}),refactor:n("refactor","adaptive-targeted"),"refactor-suggest":n("refactor","story-targeted",{structuralRequired:!0}),cleanup:n("cleanup","full"),audit:n("audit","full"),"tech-debt":n("tech-debt","full"),menu:n("menu","full"),plans:n("plans","full"),billing:n("billing","full"),subscribe:n("subscribe","full"),"qa-scan":n("qa-scan","full"),yoloop:n("yoloop","yoloop-targeted",{structuralRequired:!0}),"migrate-state":n("migrate-state","full"),"migrate-project-id":n("migrate-project-id","full"),"policy-audit":n("policy-audit","full"),"mutation-test":n("mutation-test","full"),"sync-openapi":n("sync-openapi","full"),"generate-pacts":n("generate-pacts","full"),"verify-pacts":n("verify-pacts","full"),"property-test":n("property-test","full"),"property-tests":n("property-test","story-targeted",{structuralRequired:!0}),"chaos-plan":n("chaos-plan","full"),"ui-ux-review":n("ui-ux-review","adaptive-targeted"),"solyd-system":n("solyd-system","adaptive-targeted"),goal:n("goal","continuity-scoped"),loop:n("loop","continuity-scoped"),jobs:n("jobs","continuity-scoped"),runner:n("runner","continuity-scoped"),"goal-tick":n("goal-tick","continuity-scoped"),"loop-tick":n("loop-tick","continuity-scoped"),"validate-tests":n("validate-tests","story-targeted",{structuralRequired:!0}),"qa-gate":n("qa-gate","story-targeted",{structuralRequired:!0})}),X=Object.freeze({st:"status",arquitetura:"arch-plan",architecture:"arch-plan",arch:"arch-plan",prd:"arch-prd","product-requirements":"arch-prd","arch-doc":"arch-architecture","tech-architecture":"arch-architecture","api-contracts":"arch-api-contracts","api-contract":"arch-api-contracts","api-integrations":"arch-api-integrations","api-int":"arch-api-integrations","database-schema":"arch-database","db-schema":"arch-database",db:"arch-database","cyber-security":"arch-security",security:"arch-security",sec:"arch-security","design-system":"arch-design-system",ds:"arch-design-system","atomic-design":"arch-design-system","ux-design":"arch-ux-design",ux:"arch-ux-design",wireframes:"arch-ux-design",wireframe:"arch-ux-design","user-flows":"arch-ux-design",performance:"arch-performance",perf:"arch-performance","capacity-planning":"arch-performance",capacity:"arch-performance","arch-perf":"arch-performance","performance-strategy":"arch-performance","testing-strategy":"arch-testing","test-plan":"arch-testing","test-strategy":"arch-testing","arch-test":"arch-testing",infrastructure:"arch-infrastructure",infra:"arch-infrastructure","deploy-plan":"arch-infrastructure",deployment:"arch-infrastructure","arch-infra":"arch-infrastructure","arch-deploy":"arch-infrastructure","review-consolidation":"arch-review",consolidation:"arch-review","architecture-review":"arch-review","arch-consolidation":"arch-review",fitness:"arch-fitness-functions","fitness-functions":"arch-fitness-functions",archfit:"arch-fitness-functions","arch-fit":"arch-fitness-functions","fit-funcs":"arch-fitness-functions","criar-epic":"create-epic",planejamento:"create-epic","idea-diag":"idea-diagnose","idea-pesq":"idea-research","gerar-epic":"generate-epic",executar:"exec",pipeline:"exec","parallel-epic":"epic",setup:"setup-branch",branch:"setup-branch",diag:"diagnose",diagnostico:"diagnose",c02:"diagnose",pesquisar:"research",pesq:"research","research-fix":"research",c03:"research",spec:"write-spec",especificacao:"write-spec",c04:"write-spec",tasks:"create-tasks",tarefas:"create-tasks",c05:"create-tasks",impl:"implement",implementar:"implement",c06:"implement",push:"commit",commit_push:"commit",cp:"commit",c07:"commit",sincronizar:"sync",c08:"sync",pr:"create-pr",c09:"create-pr",revisar:"review",c11:"review",mesclar:"merge",c12:"merge",fix:"fix-blocked",corrigir:"fix-blocked",finalizar:"finalize-epic",conflitos:"resolve-conflicts",memoria:"update-memory",refactoring:"refactor",refact:"refactor",refac:"refactor",rf:"refactor","cleanup-code":"refactor","code-cleanup":"refactor","code-quality":"refactor","improve-code":"refactor",modernize:"refactor",modernization:"refactor",legacy:"refactor","legacy-code":"refactor","debt-pay":"refactor","pay-debt":"refactor","debt-reduction":"refactor","smell-fix":"refactor","fix-smells":"refactor","code-smells":"refactor",strangler:"refactor","strangler-fig":"refactor",limpar:"cleanup",limpeza:"cleanup",auditar:"audit",auditoria:"audit",debt:"tech-debt",debts:"tech-debt","debt-list":"tech-debt","tech-debts":"tech-debt",td:"tech-debt",help:"menu",ajuda:"menu","?":"menu",commands:"menu",cmds:"menu",planos:"plans",pricing:"plans",bill:"billing",subscription:"billing",sub:"billing",upgrade:"subscribe",checkout:"subscribe",qa:"qa-scan","qa-test":"qa-scan","visual-qa":"qa-scan","e2e-scan":"qa-scan",troubleshoot:"qa-scan","debug-ui":"qa-scan",scan:"qa-scan",a11y:"qa-scan",accessibility:"qa-scan",wcag:"qa-scan","auto-yolo":"yoloop","epic-runner":"yoloop","story-runner":"yoloop","loop-yolo":"yoloop","auto-epic":"yoloop",migrate:"migrate-state","state-migrate":"migrate-state","schema-migrate":"migrate-state",policy:"policy-audit","audit-policy":"policy-audit","policy-history":"policy-audit",policies:"policy-audit",mutation:"mutation-test",stryker:"mutation-test","kill-mutants":"mutation-test","openapi-sync":"sync-openapi","api-sync":"sync-openapi","spec-sync":"sync-openapi","regen-openapi":"sync-openapi",pacts:"generate-pacts","gen-pacts":"generate-pacts","regen-pacts":"generate-pacts","create-pacts":"generate-pacts","verify-pact":"verify-pacts","pact-verify":"verify-pacts","check-pacts":"verify-pacts","pact-check":"verify-pacts",property:"property-test",pbt:"property-test",proptest:"property-test","invariant-test":"property-test",chaos:"chaos-plan",gameday:"chaos-plan","resilience-test":"chaos-plan","ux-review":"ui-ux-review","design-review":"ui-ux-review","visual-review":"ui-ux-review","product-polish":"ui-ux-review","security-system":"solyd-system","authorized-security":"solyd-system","sec-system":"solyd-system",goals:"goal","durable-goal":"goal","continuity-goal":"goal",loops:"loop","durable-loop":"loop","continuity-loop":"loop",job:"jobs","continuity-jobs":"jobs","neocortex-runner":"runner","continuity-runner":"runner"}),ee=Object.freeze({1:"status",3:"arch-plan",4:"arch-prd",5:"arch-architecture",6:"arch-api-contracts",7:"arch-api-integrations",8:"arch-database",9:"arch-security",10:"arch-design-system",11:"arch-ux-design",12:"arch-performance",13:"arch-testing",14:"arch-infrastructure",15:"arch-review",16:"arch-fitness-functions",17:"create-epic",18:"idea-diagnose",19:"idea-research",20:"generate-epic",21:"exec",22:"yolo",23:"epic",24:"setup-branch",25:"diagnose",26:"research",27:"write-spec",28:"create-tasks",29:"implement",30:"commit",31:"sync",32:"create-pr",33:"review",34:"merge",35:"fix-blocked",36:"finalize-epic",37:"resolve-conflicts",38:"update-memory",39:"refactor",40:"cleanup",41:"audit",42:"tech-debt",43:"menu",44:"plans",45:"billing",46:"subscribe",47:"qa-scan",48:"yoloop",49:"migrate-state",50:"policy-audit",51:"mutation-test",52:"sync-openapi",53:"generate-pacts",54:"verify-pacts",55:"property-test",56:"chaos-plan",57:"ui-ux-review",58:"solyd-system",59:"goal",60:"loop",61:"jobs",62:"runner"});function d(r,e=120){if(typeof r!="string")return;const t=r.trim();if(t)return t.replace(/[^a-z0-9_.:-]+/gi,"_").slice(0,e)}function w(r,e=120){if(typeof r!="string")return;const t=r.trim(),i=d(r,e);return i===t?i:void 0}function T(r){if(typeof r!="string")return;const e=r.trim();if(!(!e||e.length>240||!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(e)||e.includes("..")||e.includes("//")||e.includes("@{")||e.endsWith("/")||e.endsWith(".")||e.split("/").some(t=>!t||t.startsWith(".")||t.endsWith(".lock"))))return e}function te(r){if(typeof r!="string")return;const e=r.replace(/\\/g,"/");if(!(!e||e.length>240||e.startsWith("/")||/^[A-Za-z]:/.test(e)||e.includes("..")||e.includes("//")||e.split("/").includes(".")||!/^[A-Za-z0-9._/:@#-]+$/.test(e)))return e}function S(r){if(r===void 0||!Array.isArray(r)||r.length>128)return;const e=r.map(te);if(!e.some(t=>t===void 0))return[...new Set(e)].sort((t,i)=>t.localeCompare(i,"en"))}function re(r){return typeof r=="string"&&Q.has(r.trim().toLowerCase().replace(/_/g,"-"))}function C(r,e){const t={};for(const i of e){const c=r[i];typeof c=="string"||typeof c=="boolean"||typeof c=="number"&&Number.isFinite(c)?t[i]=c:Array.isArray(c)&&c.every(o=>typeof o=="string")&&(t[i]=[...c])}return t}function ie(r,e){const t=e.checkpoint;if(!h(t)||t.schemaVersion!==1||t.storyId!==r||t.epicId!==e.epic_id||!T(t.branch)||typeof t.baseSha!="string"||!/^[0-9a-f]{7,64}$/i.test(t.baseSha)||typeof t.headSha!="string"||!/^[0-9a-f]{7,64}$/i.test(t.headSha)||t.baseSha===t.headSha||!w(t.idempotencyKey)||typeof t.recordedAt!="string"||!Number.isFinite(Date.parse(t.recordedAt))||!Array.isArray(t.commits)||t.commits.length===0||t.commits.length>256||t.commits.some(c=>typeof c!="string"||!/^[0-9a-f]{7,64}$/i.test(c))||!Array.isArray(t.receiptRefs)||t.receiptRefs.length===0||t.receiptRefs.length>256||t.receiptRefs.some(c=>typeof c!="string"||c.length>240||c.includes("..")||!/^[A-Za-z0-9._:/#\-[\]]+$/.test(c))||!h(t.qaReceipt)||t.qaReceipt.kind!=="story_qa_evidence"||t.qaReceipt.producer!=="local-yolo-tdd"||!["passed","blocked"].includes(String(t.qaVerdict))||!["approved","changes-requested","pending"].includes(String(t.reviewVerdict))||(t.reviewVerdict==="pending"?t.reviewReceipt!==void 0:!h(t.reviewReceipt)))return;const i=C(t,["schemaVersion","storyId","epicId","branch","baseSha","headSha","idempotencyKey","dispatchId","bundleId","bundleDigest","graphRevision","claimRevision","qaVerdict","reviewVerdict","recordedAt","commits","receiptRefs"]);return i.qaReceipt=C(t.qaReceipt,["schemaVersion","kind","producer","evidenceVersion","storyId","epicId","contract","command","manifestDigest","gateIds","resultDigest","baseSha","headSha","bundleDigest","graphRevision","sourceEvidenceDigest","verdict","checkedAt","receiptRef"]),h(t.reviewReceipt)&&(i.reviewReceipt=C(t.reviewReceipt,["schemaVersion","kind","producer","storyId","epicId","baseSha","headSha","bundleDigest","graphRevision","sourceEvidenceDigest","qaReceiptRef","verdict","reviewedAt","receiptRef"])),i}function ce(r,e){const t=e.checkpoint_verification;if(!(!h(t)||t.schemaVersion!==1||t.kind!=="story_checkpoint_physical_verification"||t.producer!=="client-p205-transient-v1"||t.publicSafe!==!0||t.storyId!==r||t.epicId!==e.epic_id||!["verified","rejected"].includes(String(t.verdict))))return C(t,["schemaVersion","kind","producer","storyId","epicId","branch","baseSha","headSha","aggregateHeadSha","commitBodyDigest","changedPathsDigest","claimVerification","effectiveClaimRevision","command","manifestDigest","gateIds","resultDigest","graphRevision","executionEvidenceDigest","sourceEvidenceDigest","verifiedAt","verdict","reasonCodes","publicSafe"])}function M(r,e){const t=e.scheduling_checkpoint_evidence,i=new Set(["schemaVersion","kind","producer","storyId","epicId","branch","baseSha","headSha","graphRevision","effectiveClaimRevision","sourceEvidenceDigest","verifiedAt","reasonCodes","integrationAuthorized","publicSafe"]);if(!(!h(t)||Object.keys(t).some(c=>!i.has(c))||t.schemaVersion!==1||t.kind!=="story_scheduling_checkpoint_evidence"||t.producer!=="client-git-physical-v1"||t.publicSafe!==!0||t.integrationAuthorized!==!1||t.storyId!==r||t.epicId!==e.epic_id||!T(t.branch)||typeof t.baseSha!="string"||!/^[0-9a-f]{40,64}$/i.test(t.baseSha)||typeof t.headSha!="string"||!/^[0-9a-f]{40,64}$/i.test(t.headSha)||typeof t.graphRevision!="string"||!/^[0-9a-f]{64}$/i.test(t.graphRevision)||typeof t.effectiveClaimRevision!="string"||!/^[0-9a-f]{64}$/i.test(t.effectiveClaimRevision)||typeof t.sourceEvidenceDigest!="string"||!/^[0-9a-f]{64}$/i.test(t.sourceEvidenceDigest)||typeof t.verifiedAt!="string"||!Number.isFinite(Date.parse(t.verifiedAt))||!Array.isArray(t.reasonCodes)||t.reasonCodes.length!==1||t.reasonCodes[0]!=="checkpoint-git-scheduling-verified"))return C(t,[...i])}function oe(r,e){const t={...e},i=M(r,e);return i?(t.scheduling_checkpoint_evidence=i,delete t.checkpoint,delete t.checkpoint_verification):delete t.scheduling_checkpoint_evidence,t}function h(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function _(...r){const e=new Set,t=[];for(const i of r)for(const c of i??[]){const o=d(c,80);if(!(!o||e.has(o))&&(e.add(o),t.push(o),t.length>=J))return t}return t}function ne(r){return r.trim().replace(/^@?\*/,"").replace(/^@/,"").toLowerCase()}function se(r){return r.trim().split(/\s+/,1)[0]??""}function z(r){if(/^@epic-P[0-9]{1,12}$/.test(r.trim()))return A.epic;const e=se(r);if(!e)return A.menu;const t=ne(e),i=ee[t]??X[t]??t;return A[i]??null}function ae(r,e,t,i="full-compatible",c=["full-state"]){return{kind:"full",commandId:t?.commandId??null,stateProjectionPolicy:t?.stateProjectionPolicy??null,projectionMode:i,trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:Object.keys(e.stories).length,includedEpicCount:Object.keys(e.epics).length,omittedStoryCount:0,omittedEpicCount:0,reason:"full-state",reasonCodes:_(c)}}function ze(r,e,t,i="full-compatible",c=["full-state"]){const o=ae(r,e,t,i,c);return v({...e,scope:o},e,o)}function de(r){const[e]=r.trim().split(/\s+/,1);return e?/^[A-Z]?\d+(?:\.\d+)+$/i.test(e.replace(/^@/,""))||/(?:^|\/)[A-Z]?\d+(?:\.\d+)+\.story\.md$/i.test(e.replace(/^@/,"")):!1}function F(r){const e=r.match(/(?:^|[/@\s])([A-Z]?\d+(?:\.\d+)+)\.story\.md\b/i);return e?.[1]?e[1]:r.match(/(?:^|\s|@)([A-Z]?\d+(?:\.\d+)+)(?=$|\s)/i)?.[1]??null}function ue(r){const e=r.trim(),t=e.search(/\s/);return t===-1?"":e.slice(t).trim()}function q(r){return ue(r).split(/\s+/).map(e=>e.replace(/^@/,"").replace(/^['"]|['"]$/g,"")).filter(e=>e.length>0&&!e.startsWith("-"))}function Fe(r){return q(r)[0]??null}function P(r,e){const i=r.replace(/^@/,"").replace(/^epic-/i,"").replace(/\.md$/i,""),c=[i,i.toUpperCase(),/^p\d+$/i.test(i)?`P${i.replace(/^p/i,"")}`:null,/^\d+$/.test(i)?`P${i}`:null].filter(o=>typeof o=="string"&&o.length>0);for(const o of c)if(e.epics[o])return o;return null}function le(r,e){const t=r.match(/(?:^|[/@\s])epic-(P?\d+)\.md\b/i);return t?.[1]?P(t[1],e):null}function R(r,e){const t=r.trim().match(/^@epic-(P[0-9]{1,12})$/);if(t)return P(t[1],e);const i=le(r,e);if(i)return i;for(const c of q(r)){if(/^[A-Z]?\d+(?:\.\d+)+$/i.test(c))continue;const o=P(c,e);if(o)return o}return null}function pe(r,e){const t=R(r,e);if(t)return t;const i=e.yoloop,c=i?.state?.currentSession?.currentEpicId;if(typeof c=="string"&&e.epics[c])return c;const o=i?.lock?.currentEpicId??i?.lock?.epicId;return typeof o=="string"&&e.epics[o]?o:null}function fe(r){const e=r.match(/(?:^|[/@\s])epic-(P?\d+)\.md\b/i)?.[1];if(e)return/^P/i.test(e)?e.toUpperCase():`P${e}`;for(const t of q(r)){if(/^P\d+$/i.test(t))return t.toUpperCase();if(/^\d+$/.test(t))return`P${t}`}return null}function j(r,e){if(typeof r.epic_id=="string"&&r.epic_id.length>0)return r.epic_id;const t=e.split(".").slice(0,-1).join(".");return t.length>0?t:null}function L(r){return typeof r=="string"&&["done","completed","merged","cancelled","canceled","abandoned"].includes(r.toLowerCase())}function x(r,e,t){if(t.has(r))return;const i=e.stories[r];if(!i)return;t.add(r);const c=i.depends_on;if(Array.isArray(c))for(const o of c)typeof o=="string"&&x(o,e,t)}function ye(r,e){const t=I(e.stories,[r]),i={};for(const c of t.orderedIds){const o=e.stories[c];o&&(i[c]=o)}return i}function $(r,e,t=[]){const i={};for(const c of t)e.epics[c]&&(i[c]=e.epics[c]);for(const[c,o]of Object.entries(r)){const s=j(o,c);s&&e.epics[s]&&(i[s]=e.epics[s])}return i}function me(r,e,t){if(t.has(r))return;const i=e.epics[r];if(!i)return;t.add(r);const c=i.depends_on;if(Array.isArray(c))for(const o of c)typeof o=="string"&&o.length>0&&me(o,e,t)}function V(r,e,t){const i=I(t.epics,[r]),c=new Set(i.orderedIds);for(const[s,a]of Object.entries(e)){const u=j(a,s);u&&t.epics[u]&&c.add(u)}const o={};for(const s of[...c].sort((a,u)=>a.localeCompare(u,"en"))){const a=t.epics[s];a&&(o[s]=s===r?a:K(s,a))}return o}function G(r,e,t){const i=e.stories;if(!Array.isArray(i)||i.some(s=>typeof s!="string"||s.length===0))throw new y("STRUCTURAL_DEPENDENCY_MISSING",{nodes:0,edges:0,malformedStoryMemberships:1});const c=I(t.stories,i),o={};for(const s of c.orderedIds){const a=t.stories[s];a&&(o[s]=j(a,s)===r?oe(s,a):Y(s,a))}return o}function ge(r,e,t){const i=[...e.stories].sort((s,a)=>s.localeCompare(a,"en")),c=Object.entries(t).filter(([s,a])=>j(a,s)===r).map(([s])=>s).sort((s,a)=>s.localeCompare(a,"en")),o=H("sha256").update(`target-epic-coverage-v1\0${JSON.stringify({targetEpicId:r,declaredStoryIds:i,includedStoryIds:c})}`).digest("hex");return{schemaVersion:"TargetEpicCoverage/1.0",targetEpicId:r,declaredStoryIds:i,includedStoryIds:c,membershipSha256:o,publicSafe:!0}}function Y(r,e){const t=Array.isArray(e.depends_on)?[...new Set(e.depends_on.filter(m=>typeof m=="string"&&m.length>0))].sort((m,E)=>m.localeCompare(E,"en")):[],i={id:d(e.id)??r,...d(e.epic_id)?{epic_id:d(e.epic_id)}:{},...d(e.status,40)?{status:d(e.status,40)}:{},depends_on:t},c=M(r,e);if(!re(e.status))return{...i,...c?{scheduling_checkpoint_evidence:c}:{}};const o=e.source==="create-epic"||e.source==="discovered"?e.source:void 0,s=T(e.branch_name),a=w(e.last_step,120),u=Array.isArray(e.steps_completed)&&e.steps_completed.length<=64?e.steps_completed.map(m=>w(m,120)):[],l=u.length>0&&u.every(m=>m!==void 0)?u:void 0,f=typeof e.pr_number=="number"&&Number.isSafeInteger(e.pr_number)&&e.pr_number>0?e.pr_number:void 0,p=ie(r,e),g=p?ce(r,e):void 0;return{...i,...o?{source:o}:{},...s?{branch_name:s}:{},...a?{last_step:a}:{},...l?{steps_completed:l}:{},...f?{pr_number:f}:{},...p?{checkpoint:p}:{},...g?{checkpoint_verification:g}:{},...c?{scheduling_checkpoint_evidence:c}:{},...S(e.files_to_modify)!==void 0?{files_to_modify:S(e.files_to_modify)}:{},...S(e.contracts)!==void 0?{contracts:S(e.contracts)}:{},...S(e.contract_refs)!==void 0?{contract_refs:S(e.contract_refs)}:{},...S(e.shared_surfaces)!==void 0?{shared_surfaces:S(e.shared_surfaces)}:{}}}function K(r,e){const t=Array.isArray(e.stories)?[...new Set(e.stories.filter(c=>typeof c=="string"&&c.length>0))].sort((c,o)=>c.localeCompare(o,"en")):[],i=Array.isArray(e.depends_on)?[...new Set(e.depends_on.filter(c=>typeof c=="string"&&c.length>0))].sort((c,o)=>c.localeCompare(o,"en")):[];return{id:d(e.id)??r,...d(e.status,40)?{status:d(e.status,40)}:{},...d(e.lifecycle_classification,40)?{lifecycle_classification:d(e.lifecycle_classification,40)}:{},stories:t,depends_on:i}}function he(r,e,t){const i=I(e.stories),c=I(e.epics),o=Object.fromEntries(i.orderedIds.map(u=>[u,Y(u,e.stories[u])])),s=Object.fromEntries(c.orderedIds.map(u=>[u,K(u,e.epics[u])])),a={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:"yoloop-discovery",trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:i.orderedIds.length,includedEpicCount:c.orderedIds.length,omittedStoryCount:0,omittedEpicCount:0,reason:"targeted-invocation",reasonCodes:_(["structural-required","yoloop-discovery",`structural-edges-${i.edgeCount+c.edgeCount}`,"content-fields-omitted"])};return v({...e,stories:o,epics:s,scope:a},e,a)}function be(r,e){const t=new Set,i=r.stories;if(Array.isArray(i))for(const o of i)typeof o=="string"&&x(o,e,t);const c={};for(const o of t){const s=e.stories[o];s&&(c[o]=s)}return c}function _e(r){const e={};for(const[t,i]of Object.entries(r.epics))e[t]={id:d(i.id)??t,...d(i.status)?{status:d(i.status)}:{},...k.includes(i.lifecycle_classification)?{lifecycle_classification:i.lifecycle_classification}:{},...typeof i.total_stories=="number"&&Number.isFinite(i.total_stories)?{total_stories:i.total_stories}:{},...typeof i.completed_stories=="number"&&Number.isFinite(i.completed_stories)?{completed_stories:i.completed_stories}:{}};return e}function W(r){const e={};for(const t of Object.values(r)){const i=d(t.status,40)??"unknown";e[i]=(e[i]??0)+1}return e}function Se(r){const e=Object.fromEntries(k.map(t=>[t,0]));for(const t of Object.values(r)){const i=k.includes(t.lifecycle_classification)?t.lifecycle_classification:"active";e[i]=(e[i]??0)+1}return e}function N(r,e){if(!e)return!0;const t=r.epics[e];return t?!k.includes(t.lifecycle_classification)||t.lifecycle_classification==="active":!0}function Z(r){for(const e of["last_updated","updated_at","completed_at","created_at","discovered_at"]){const t=r[e];if(typeof t!="string")continue;const i=Date.parse(t);if(Number.isFinite(i))return i}return 0}function je(r){return Object.entries(r.stories).map(([e,t])=>({id:e,story:t,timestamp:Z(t)})).sort((e,t)=>t.timestamp-e.timestamp||e.id.localeCompare(t.id)).slice(0,U).map(({id:e,story:t})=>({id:e,...d(t.epic_id)?{epicId:d(t.epic_id)}:{},...d(t.status,40)?{status:d(t.status,40)}:{},...d(t.last_step??t.lastStep)?{lastStep:d(t.last_step??t.lastStep)}:{},...d(t.last_updated??t.updated_at??t.completed_at??t.created_at)?{lastUpdated:d(t.last_updated??t.updated_at??t.completed_at??t.created_at)}:{}}))}function ve(r){const e=r.current_session;if(!e)return;const t={activeEpicId:d(e.active_epic_id)??null,activeStoryId:d(e.active_story_id)??null,activeStepId:d(e.active_step_id)??null,sessionId:d(e.session_id)??null,startedAt:d(e.started_at)??null};return Object.values(t).some(i=>i!=null)?t:void 0}function Ie(r){const e=r.yoloop;if(!h(e))return;const t=h(e.state)?e.state:void 0,i=h(t?.currentSession)?t.currentSession:void 0,c=h(e.lock)?e.lock:void 0,o={...typeof e.active=="boolean"?{active:e.active}:{},currentEpicId:d(i?.currentEpicId??e.currentEpicId)??null,currentStoryId:d(i?.currentStoryId??e.currentStoryId)??null,sessionId:d(i?.sessionId??e.sessionId)??null,lockEpicId:d(c?.currentEpicId??c?.epicId)??null};return Object.keys(o).length>0?o:void 0}function ke(r){const e=r.continuity;if(!h(e))return;const t=Array.isArray(e.reasonCodes)?e.reasonCodes.filter(i=>typeof i=="string"):void 0;return{present:!0,activeJobId:d(e.activeJobId??e.jobId)??null,activeGoalId:d(e.activeGoalId??e.goalId)??null,activeLoopId:d(e.activeLoopId??e.loopId)??null,...t&&t.length>0?{reasonCodes:_(t)}:{}}}function Ce(r,e,t){const i=d(e?.activeStoryId),c=d(e?.activeEpicId),o=d(e?.activeStepId),s=i&&r.stories[i]?j(r.stories[i],i):null;if((i||c||o)&&N(r,c??s))return{epicId:c??null,storyId:i??null,stepId:o??null};const a=d(t?.currentStoryId),u=d(t?.currentEpicId??t?.lockEpicId);if((a||u)&&N(r,u))return{epicId:u??null,storyId:a??null,stepId:null};const l=Object.entries(r.stories).map(([f,p])=>({id:f,story:p,timestamp:Z(p)})).filter(({id:f,story:p})=>!L(p.status)&&N(r,j(p,f))).sort((f,p)=>p.timestamp-f.timestamp||f.id.localeCompare(p.id))[0];return l?{epicId:j(l.story,l.id),storyId:l.id,stepId:d(l.story.last_step??l.story.lastStep)??null}:{epicId:null,storyId:null,stepId:null}}function Ee(r,e){const t=W(r.stories),i=W(r.epics),c=Se(r.epics),o=Object.values(r.epics).filter(g=>(k.includes(g.lifecycle_classification)?g.lifecycle_classification:"active")==="active"&&!L(g.status)).length,s=ve(r),a=Ie(r),u=ke(r),l=Ce(r,s,a),f=je(r),p=_(e.reasonCodes,["state-summary-attached","state-summary-bounded",`projection-${e.projectionMode??e.kind}`,e.stateProjectionPolicy?`policy-${e.stateProjectionPolicy}`:"policy-unknown",f.length>=U?"recent-stories-capped":"recent-stories-bounded",l.storyId||l.epicId?"active-ref-derived":"active-ref-empty",a?"yoloop-session-present":"yoloop-session-absent",u?"continuity-session-present":"continuity-session-absent"]);return{schemaVersion:1,totals:{stories:Object.keys(r.stories).length,epics:Object.keys(r.epics).length,storyStatus:t,epicStatus:i,epicLifecycle:c,activeEpics:o,blockedStories:t.blocked??0},active:l,blockedCount:t.blocked??0,recentStories:f,...s?{currentSession:s}:{},...a?{currentYoloopSession:a}:{},...u?{currentContinuitySession:u}:{},projection:{commandId:e.commandId??null,stateProjectionPolicy:e.stateProjectionPolicy??null,projectionMode:e.projectionMode,scopeKind:e.kind,includedStoryCount:e.includedStoryCount,includedEpicCount:e.includedEpicCount??Object.keys(r.epics).length,omittedStoryCount:e.omittedStoryCount,omittedEpicCount:e.omittedEpicCount,reason:e.reason},reasonCodes:p,publicSafe:!0}}function v(r,e,t){return{...r,stateSummary:Ee(e,t)}}function Re(r,e,t){const i={};for(const o of Object.keys(e.epics))i[o]={id:o};const c={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:"summary-only",trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:0,includedEpicCount:Object.keys(i).length,omittedStoryCount:Object.keys(e.stories).length,omittedEpicCount:0,reason:"epic-summary",reasonCodes:["epic-summary","stories-omitted","epic-stubs-only"]};return v({...e,stories:{},epics:i,scope:c},e,c)}function b(r,e,t,i=["summary-only","stories-omitted"],c="summary-only"){const o=_e(e),s={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:c,trigger:r,targetEpicId:null,targetStoryId:null,includedStoryCount:0,includedEpicCount:Object.keys(o).length,omittedStoryCount:Object.keys(e.stories).length,omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(o).length),reason:"summary-only",reasonCodes:_(i)};return v({...e,stories:{},epics:o,scope:s},e,s)}function D(r,e,t,i,c,o){const s=e.stories[i];if(!s)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"story"});const a=j(s,i);if(!a)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const u=e.epics[a];if(!u)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const l=c==="yolo-story",f=l?G(a,u,e):ye(i,e),p=l?V(a,f,e):$(f,e);if(!f[i]||!p[a])throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(f).length,epics:Object.keys(p).length,targetKind:"story"});const g={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:c,trigger:r,targetEpicId:a,targetStoryId:i,includedStoryCount:Object.keys(f).length,includedEpicCount:Object.keys(p).length,omittedStoryCount:Math.max(0,Object.keys(e.stories).length-Object.keys(f).length),omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(p).length),reason:"targeted-invocation",reasonCodes:_(o,l?["epic-graph-authority-complete"]:[])};return v({...e,stories:f,epics:p,scope:g},e,g)}function B(r,e,t,i,c,o){const s=e.epics[i];if(!s)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const a=be(s,e),u=$(a,e,[i]);if(!u[i])throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(a).length,epics:Object.keys(u).length,targetKind:"epic"});const l={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:c,trigger:r,targetEpicId:i,targetStoryId:null,includedStoryCount:Object.keys(a).length,includedEpicCount:Object.keys(u).length,omittedStoryCount:Math.max(0,Object.keys(e.stories).length-Object.keys(a).length),omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(u).length),reason:"targeted-invocation",reasonCodes:_(o)};return v({...e,stories:a,epics:u,scope:l},e,l)}function Oe(r,e,t){const i=fe(r),c=R(r,e);if(i&&!c)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const o=pe(r,e),s=O({commandId:t.commandId,explicitYoloopEpicId:c,sessionYoloopEpicId:c?null:o});if(s==="yoloop-discovery")return he(r,e,t);if(!o||s!=="yoloop-target"&&s!=="yoloop-session")throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const a=e.epics[o];if(!a)throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"});const u=G(o,a,e),l=V(o,u,e);if(!l[o])throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(u).length,epics:Object.keys(l).length,targetKind:"epic"});const f=s,p={kind:"projected",commandId:t.commandId,stateProjectionPolicy:t.stateProjectionPolicy,projectionMode:f,trigger:r,targetEpicId:o,targetStoryId:null,targetEpicCoverage:ge(o,a,u),includedStoryCount:Object.keys(u).length,includedEpicCount:Object.keys(l).length,omittedStoryCount:Math.max(0,Object.keys(e.stories).length-Object.keys(u).length),omittedEpicCount:Math.max(0,Object.keys(e.epics).length-Object.keys(l).length),reason:"targeted-invocation",reasonCodes:["structural-required",f,"yoloop-targeted"]};return v({...e,stories:u,epics:l,scope:p},e,p)}function Ae(r,e){const t={};for(const[i,c]of Object.entries(r.epics)){const o=Array.isArray(c.stories)?c.stories.filter(s=>typeof s=="string"&&e.has(s)):[];t[i]={id:d(c.id)??i,...d(c.status,40)?{status:d(c.status,40)}:{},...typeof c.total_stories=="number"&&Number.isFinite(c.total_stories)?{total_stories:c.total_stories}:{},...typeof c.completed_stories=="number"&&Number.isFinite(c.completed_stories)?{completed_stories:c.completed_stories}:{},...o.length>0?{stories:o}:{},...o.length>0&&Array.isArray(c.depends_on)?{depends_on:c.depends_on.filter(s=>typeof s=="string"&&s.length>0)}:{},...o.length>0&&(c.branch_mode==="epic"||c.branch_mode==="story")?{branch_mode:c.branch_mode}:{},...o.length>0&&typeof c.execution_branch=="string"?{execution_branch:c.execution_branch}:{},...o.length>0&&typeof c.origin_branch=="string"?{origin_branch:c.origin_branch}:{},...o.length>0&&(c.branch_lease===null||typeof c.branch_lease=="object")?{branch_lease:c.branch_lease}:{},...o.length>0&&(c.origin_binding===null||typeof c.origin_binding=="object")?{origin_binding:c.origin_binding}:{},...o.length>0&&(c.aggregate_qa_receipt===null||typeof c.aggregate_qa_receipt=="object")?{aggregate_qa_receipt:c.aggregate_qa_receipt}:{}}}return t}function we(r){return r.stateSummary?.totals.stories??(r.scope?.includedStoryCount??Object.keys(r.stories).length)+(r.scope?.omittedStoryCount??0)}function Te(r){return r.stateSummary?.totals.epics??(r.scope?.includedEpicCount??Object.keys(r.epics).length)+(r.scope?.omittedEpicCount??0)}function qe(r,e){if(r.stateSummary)return{...r.stateSummary,projection:{...r.stateSummary.projection,scopeKind:"projected",projectionMode:e.projectionMode,includedStoryCount:e.includedStoryCount,includedEpicCount:e.includedEpicCount??r.stateSummary.projection.includedEpicCount,omittedStoryCount:e.omittedStoryCount,omittedEpicCount:e.omittedEpicCount,reason:"body-size"},reasonCodes:_(r.stateSummary.reasonCodes,["payload-size-guardrail","state-summary-preserved","nonessential-state-degraded"])}}function Le(r){const e=r.scope,t=new Set,i=e?.projectionMode==="structural-required"||e?.projectionMode==="yolo-story"||e?.projectionMode==="yoloop-target"||e?.projectionMode==="yoloop-session"||e?.projectionMode==="yoloop-discovery";if(i)for(const m of Object.keys(r.stories))t.add(m);else e?.targetStoryId&&x(e.targetStoryId,r,t);const c={};for(const m of t){const E=r.stories[m];E&&(c[m]=E)}const o=Ae(r,t),s=Object.keys(c).length,a=Object.keys(o).length,u=Math.max(0,we(r)-s),l=Math.max(0,Te(r)-a),f=i?e?.projectionMode??"structural-required":e?.projectionMode==="yolo-story"?"yolo-story":"summary-only",p={kind:"projected",commandId:e?.commandId??null,stateProjectionPolicy:e?.stateProjectionPolicy??null,projectionMode:f,targetEpicId:e?.targetEpicId??null,targetStoryId:e?.targetStoryId??null,...e?.targetEpicCoverage?{targetEpicCoverage:e.targetEpicCoverage}:{},includedStoryCount:s,includedEpicCount:a,omittedStoryCount:u,omittedEpicCount:l,reason:"body-size",reasonCodes:_(e?.reasonCodes,["payload-size-guardrail",t.size>0?"structural-targets-preserved":"stories-omitted","epics-stubbed","state-summary-preserved","redundant-trigger-omitted"])},g=qe(r,p);return{...r,stories:c,epics:o,scope:p,...g?{stateSummary:g}:{}}}function Pe(r,e){const t=r.trim(),i=z(t);try{if(!i){if(de(t)){const o=n("story-reference","story-targeted"),s=F(t);if(s)return D(t,e,o,s,"targeted-story",["story-reference-targeted"])}return b(t,e,n("unknown","adaptive-targeted"),["unknown-command-summary-only"])}if(i.stateProjectionPolicy==="epic-summary")return Re(t,e,i);if(i.stateProjectionPolicy==="yoloop-targeted")return Oe(t,e,i);const c=F(t);if(i.stateProjectionPolicy==="story-targeted"){if(c){const s=O({commandId:i.commandId,targetStoryId:c})==="yolo-story";return D(t,e,i,c,s?"yolo-story":i.structuralRequired?"structural-required":"targeted-story",[s?"yolo-story":i.structuralRequired?"structural-required":"targeted-story"])}if(i.commandId==="yolo"||i.commandId==="yolo-inline"){const o=O({commandId:i.commandId});return b(t,e,i,["yolo-inline","stories-omitted","historical-content-omitted"],o??"yolo-inline")}return i.commandId==="commit"&&/^\*?(?:commit|commit-push)$/i.test(t)?b(t,e,i,["working-tree-commit","stories-omitted","historical-content-omitted"]):i.structuralRequired?(()=>{throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"story"})})():b(t,e,i,["story-target-missing-summary-only"])}if(i.stateProjectionPolicy==="adaptive-targeted"){if(c&&e.stories[c])return D(t,e,i,c,"targeted-story",["adaptive-story-targeted"]);const o=R(t,e);return o?B(t,e,i,o,"targeted-epic",["adaptive-epic-targeted"]):b(t,e,i,["adaptive-summary-only","target-unresolved-summary-only"])}if(i.stateProjectionPolicy==="epic-targeted"){if(i.commandId.startsWith("arch-")&&/(?:^|\s)epic-arch\s*$/i.test(t)&&e.archPlan?.execution?.currentStageCommand===i.commandId)return b(t,e,i,["architecture-root-delegated"]);const o=R(t,e);return o?B(t,e,i,o,i.structuralRequired?"structural-required":"targeted-epic",[i.structuralRequired?"structural-required":"targeted-epic"]):i.structuralRequired?(()=>{throw new y("STRUCTURAL_TARGET_NOT_FOUND",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,targetKind:"epic"})})():b(t,e,i,["epic-target-missing-summary-only"])}return i.stateProjectionPolicy==="continuity-scoped"?b(t,e,i,["continuity-scoped-summary-only"]):b(t,e,i,["policy-full-summary-only"])}catch(c){if(c instanceof y)throw c;if(i?.structuralRequired)throw new y("STRUCTURAL_DEPENDENCY_MISSING",{stories:Object.keys(e.stories).length,epics:Object.keys(e.epics).length,projectionErrors:1});return b(t,e,i??n("unknown","adaptive-targeted"),["projection-error-summary-only"])}}const xe=new Set(["yolo-story","yolo-inline","yoloop-target","yoloop-session","yoloop-discovery"]);function Ne(r){let e=0;for(const t of[r.stories,r.epics])for(const i of Object.values(t))Array.isArray(i.depends_on)&&(e+=i.depends_on.filter(c=>typeof c=="string").length);return e}function $e(r,e){const t=z(r.trim());if(!t||!["yolo","yolo-inline","yoloop"].includes(t.commandId))return null;try{const i=Pe(r,e),c=i.scope?.projectionMode;if(!c||!xe.has(c))throw new y("STRUCTURAL_DEPENDENCY_MISSING",{stories:Object.keys(i.stories).length,epics:Object.keys(i.epics).length,projectionShapeErrors:1});return Object.freeze({ok:!0,version:2,shape:c,snapshot:i,included:{epics:i.scope?.includedEpicCount??Object.keys(i.epics).length,stories:i.scope?.includedStoryCount??Object.keys(i.stories).length,edges:Ne(i)},omitted:{epics:i.scope?.omittedEpicCount??0,stories:i.scope?.omittedStoryCount??0},cycleCount:0})}catch(i){if(!(i instanceof y))throw i;return Object.freeze({ok:!1,code:i.code,publicDetails:i.publicDetails})}}export{Le as degradeStateSnapshotForPayloadLimit,Pe as projectStateSnapshotForInvoke,$e as projectStateSnapshotResultV2ForInvoke};
|
|
@@ -2,41 +2,41 @@
|
|
|
2
2
|
export { PUBLIC_PROJECTION_BUNDLE, PUBLIC_PROJECTION_GENERATION_ID, PUBLIC_PROJECTION_BUNDLE_HASH } from './public-projections.generated.js';
|
|
3
3
|
export const COMMAND_REGISTRY_SCHEMA_VERSION = 1;
|
|
4
4
|
export const COMMAND_REGISTRY_VERSION = "1.0.0";
|
|
5
|
-
export const COMMAND_REGISTRY_CHECKSUM = "
|
|
5
|
+
export const COMMAND_REGISTRY_CHECKSUM = "184a2d616e0734fd3173d60889d74bae031280513831ec1f0a3a8c36959d2994";
|
|
6
6
|
export const COMMAND_REGISTRY_PROJECTION_MANIFEST = {
|
|
7
7
|
"schemaVersion": 1,
|
|
8
8
|
"registryVersion": "1.0.0",
|
|
9
|
-
"registryChecksum": "
|
|
9
|
+
"registryChecksum": "184a2d616e0734fd3173d60889d74bae031280513831ec1f0a3a8c36959d2994",
|
|
10
10
|
"projections": [
|
|
11
11
|
{
|
|
12
12
|
"kind": "admin",
|
|
13
13
|
"entryCount": 62,
|
|
14
|
-
"sha256": "
|
|
14
|
+
"sha256": "03492ffc9a4b868286c5dd9b62d04d16f61871dcf8a073f6d6fba6878fd765ea"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"kind": "client",
|
|
18
18
|
"entryCount": 62,
|
|
19
|
-
"sha256": "
|
|
19
|
+
"sha256": "03492ffc9a4b868286c5dd9b62d04d16f61871dcf8a073f6d6fba6878fd765ea"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"kind": "docs",
|
|
23
23
|
"entryCount": 62,
|
|
24
|
-
"sha256": "
|
|
24
|
+
"sha256": "03492ffc9a4b868286c5dd9b62d04d16f61871dcf8a073f6d6fba6878fd765ea"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"kind": "metrics",
|
|
28
28
|
"entryCount": 62,
|
|
29
|
-
"sha256": "
|
|
29
|
+
"sha256": "03492ffc9a4b868286c5dd9b62d04d16f61871dcf8a073f6d6fba6878fd765ea"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"kind": "server",
|
|
33
33
|
"entryCount": 67,
|
|
34
|
-
"sha256": "
|
|
34
|
+
"sha256": "d2071a42b5707e72be9886433c5ce19123d55a8641e30092f5a9354182fc51df"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"kind": "shared",
|
|
38
38
|
"entryCount": 67,
|
|
39
|
-
"sha256": "
|
|
39
|
+
"sha256": "91620a92df8c33a339cf6cab26befba92cbac608cd2fdaf3801ceacd5e15e703"
|
|
40
40
|
}
|
|
41
41
|
]
|
|
42
42
|
};
|
|
@@ -1223,7 +1223,7 @@ export const GENERATED_SHARED_COMMANDS = [
|
|
|
1223
1223
|
"minimumTier": "pro",
|
|
1224
1224
|
"mutationClass": "stateful",
|
|
1225
1225
|
"privilege": "authenticated",
|
|
1226
|
-
"quotaClass": "
|
|
1226
|
+
"quotaClass": "workflow",
|
|
1227
1227
|
"replayClass": "signed-request",
|
|
1228
1228
|
"strictReadOnly": "deny"
|
|
1229
1229
|
},
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
export const GENERATED_INVOCATION_SCHEMA_MANIFEST = {
|
|
3
3
|
"schemaVersion": "p205-invocation-schema-v1",
|
|
4
4
|
"registryVersion": "1.0.0",
|
|
5
|
-
"registryChecksum": "
|
|
6
|
-
"schemaChecksum": "
|
|
5
|
+
"registryChecksum": "184a2d616e0734fd3173d60889d74bae031280513831ec1f0a3a8c36959d2994",
|
|
6
|
+
"schemaChecksum": "96a90d1d7dc2694bb7614e1913c5895cdace83c7436d2033a4d116c0cf99bf40",
|
|
7
7
|
"commandCount": 62,
|
|
8
8
|
"optionCount": 48,
|
|
9
9
|
"positionalCount": 44,
|