@ornexus/neocortex 4.65.1 → 4.66.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/release-source.json +1 -1
- package/dist/sbom.cdx.json +1206 -1193
- package/install.ps1 +243 -77
- package/install.sh +221 -102
- package/package.json +2 -2
- package/packages/client/dist/adapters/platform-detector.js +1 -1
- package/packages/client/dist/agent/refresh-stubs.d.ts +50 -0
- package/packages/client/dist/agent/refresh-stubs.js +2 -2
- package/packages/client/dist/cli.js +5 -4
- package/packages/client/dist/commands/doctor.d.ts +26 -1
- package/packages/client/dist/commands/doctor.js +2 -2
- package/packages/client/dist/commands/invoke.d.ts +183 -5
- package/packages/client/dist/commands/invoke.js +94 -87
- package/packages/client/dist/commands/planning-qa.d.ts +64 -0
- package/packages/client/dist/commands/planning-qa.js +1 -0
- package/packages/client/dist/commands/refactor-control.js +3 -3
- package/packages/client/dist/commands/story-checkpoint.d.ts +3 -1
- package/packages/client/dist/commands/story-checkpoint.js +1 -1
- package/packages/client/dist/commands/story-worktree.d.ts +1 -1
- package/packages/client/dist/commands/story-worktree.js +1 -1
- package/packages/client/dist/git/direct-yolo-checkpoint.d.ts +64 -1
- package/packages/client/dist/git/direct-yolo-checkpoint.js +4 -3
- package/packages/client/dist/git/epic-lifecycle-evidence.d.ts +184 -0
- package/packages/client/dist/git/epic-lifecycle-evidence.js +6 -0
- package/packages/client/dist/git/git-lifecycle-store.d.ts +23 -0
- package/packages/client/dist/git/git-lifecycle-store.js +9 -8
- package/packages/client/dist/git/governance-runtime-store.d.ts +172 -0
- package/packages/client/dist/git/governance-runtime-store.js +3 -0
- package/packages/client/dist/git/story-worktree-cleanup.js +1 -1
- package/packages/client/dist/git/story-worktree-integration.js +3 -3
- package/packages/client/dist/git/story-worktree-manager.d.ts +39 -0
- package/packages/client/dist/git/story-worktree-manager.js +3 -3
- package/packages/client/dist/git/story-write-set-extension.d.ts +62 -0
- package/packages/client/dist/git/story-write-set-extension.js +1 -1
- package/packages/client/dist/memory/shared-project-memory-types.d.ts +39 -2
- package/packages/client/dist/memory/shared-project-memory-types.js +2 -2
- package/packages/client/dist/policy/subagent-approval-policy.js +1 -1
- package/packages/client/dist/private-execution/codex-executor.d.ts +21 -1
- package/packages/client/dist/private-execution/codex-executor.js +4 -4
- package/packages/client/dist/private-execution/delivery.d.ts +17 -11
- package/packages/client/dist/private-execution/delivery.js +8 -6
- package/packages/client/dist/private-execution/diagnosis-root-review.d.ts +89 -0
- package/packages/client/dist/private-execution/diagnosis-root-review.js +2 -2
- package/packages/client/dist/private-execution/frozen-handoff.js +3 -3
- package/packages/client/dist/private-execution/harness-adapters/antigravity.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/antigravity.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/claude-code.d.ts +8 -0
- package/packages/client/dist/private-execution/harness-adapters/claude-code.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/codex.d.ts +7 -0
- package/packages/client/dist/private-execution/harness-adapters/codex.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/copilot-cli.d.ts +8 -0
- package/packages/client/dist/private-execution/harness-adapters/copilot-cli.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/cursor.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/cursor.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/deepseek.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/deepseek.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/gemini.d.ts +8 -0
- package/packages/client/dist/private-execution/harness-adapters/gemini.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/grok.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/grok.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/index.d.ts +73 -0
- package/packages/client/dist/private-execution/harness-adapters/index.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/kimi.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/kimi.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/openclaw.d.ts +9 -0
- package/packages/client/dist/private-execution/harness-adapters/openclaw.js +1 -0
- package/packages/client/dist/private-execution/harness-adapters/opencode.d.ts +7 -0
- package/packages/client/dist/private-execution/harness-adapters/opencode.js +1 -0
- package/packages/client/dist/private-execution/harness-ephemeral-home.d.ts +19 -0
- package/packages/client/dist/private-execution/harness-ephemeral-home.js +1 -0
- package/packages/client/dist/private-execution/harness-executor.d.ts +79 -0
- package/packages/client/dist/private-execution/harness-executor.js +1 -0
- package/packages/client/dist/private-execution/harness-process.d.ts +43 -0
- package/packages/client/dist/private-execution/harness-process.js +1 -0
- package/packages/client/dist/private-execution/isolated-admission.js +12 -12
- package/packages/client/dist/private-execution/isolated-workspace.d.ts +16 -1
- package/packages/client/dist/private-execution/isolated-workspace.js +1 -1
- package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.d.ts +75 -1
- package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +5 -5
- package/packages/client/dist/private-execution/planning-generation-checkpoint.d.ts +9 -1
- package/packages/client/dist/private-execution/planning-generation-checkpoint.js +4 -4
- package/packages/client/dist/private-execution/planning-research-checkpoint.d.ts +9 -1
- package/packages/client/dist/private-execution/planning-research-checkpoint.js +4 -4
- package/packages/client/dist/private-execution/root-memory-request.d.ts +4 -1
- package/packages/client/dist/private-execution/root-memory-request.js +1 -1
- package/packages/client/dist/runner/epic-background-dispatcher.d.ts +3 -1
- package/packages/client/dist/runner/epic-background-dispatcher.js +1 -1
- package/packages/client/dist/runner/headless/claude-code-adapter.js +1 -1
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.d.ts +1 -22
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +6 -10
- package/packages/client/dist/runner/headless/managed-profile.d.ts +20 -0
- package/packages/client/dist/runner/headless/managed-profile.js +1 -1
- package/packages/client/dist/runner/headless/opencode-adapter.js +2 -2
- package/packages/client/dist/runner/headless/run-yoloop.d.ts +40 -0
- package/packages/client/dist/runner/headless/run-yoloop.js +2 -2
- package/packages/client/dist/runner/headless/types.d.ts +20 -0
- package/packages/client/dist/runner/headless/types.js +2 -2
- package/packages/client/dist/state/project-state-snapshot.d.ts +10 -0
- package/packages/client/dist/state/project-state-snapshot.js +1 -1
- package/packages/client/dist/state/structural-dag-projection.d.ts +26 -0
- package/packages/client/dist/state/structural-dag-projection.js +1 -1
- package/packages/client/dist/yoloop/target-normalization.js +1 -1
- package/packages/client/dist/yoloop/yoloop-client-state-store.d.ts +67 -0
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1 -1
- package/packages/shared/dist/compatibility/index.js +96 -0
- package/packages/shared/dist/planning/diagnosis-state.js +105 -1
- package/packages/shared/dist/project-memory-targets.js +36 -5
- package/targets-stubs/antigravity/README.md +1 -1
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/install-antigravity.sh +1 -1
- package/targets-stubs/antigravity/mcp-config.json +0 -3
- package/targets-stubs/antigravity/neocortex.md +25 -13
- package/targets-stubs/antigravity/skill/SKILL.md +4 -4
- package/targets-stubs/claude-code/.mcp.json +0 -4
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +2 -4
- package/targets-stubs/claude-code/neocortex-root.md +33 -43
- package/targets-stubs/claude-code/neocortex-sentinel.md +261 -0
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -3
- package/targets-stubs/claude-code/neocortex.md +61 -84
- package/targets-stubs/codex/AGENTS.md +19 -18
- package/targets-stubs/codex/README.md +1 -1
- package/targets-stubs/codex/config-mcp.toml +0 -3
- package/targets-stubs/codex/neocortex-sentinel.toml +87 -0
- package/targets-stubs/codex/neocortex.toml +23 -44
- package/targets-stubs/cursor/README.md +1 -1
- package/targets-stubs/cursor/agent.md +26 -15
- package/targets-stubs/cursor/mcp.json +0 -3
- package/targets-stubs/deepseek-harness/SKILL.md +11 -8
- package/targets-stubs/gemini-cli/README.md +1 -1
- package/targets-stubs/gemini-cli/agent.md +25 -12
- package/targets-stubs/gemini-cli/agents/neocortex-sentinel.md +75 -0
- package/targets-stubs/gemini-cli/agents/neocortex.md +280 -49
- package/targets-stubs/gemini-cli/settings-mcp.json +0 -3
- package/targets-stubs/grok/SKILL.md +13 -1
- package/targets-stubs/grok/agents/neocortex-sentinel.md +64 -0
- package/targets-stubs/grok/config-mcp.toml +0 -3
- package/targets-stubs/grok/install-grok.sh +51 -1
- package/targets-stubs/kimi/mcp.json +0 -6
- package/targets-stubs/kimi/neocortex.md +21 -8
- package/targets-stubs/lib/managed-config-merge.js +301 -6
- package/targets-stubs/lib/managed-profile.sh +12 -1
- package/targets-stubs/lib/mcp-merge.js +122 -8
- package/targets-stubs/openclaw/SKILL.md +33 -4
- package/targets-stubs/opencode/neocortex-root.md +41 -41
- package/targets-stubs/opencode/neocortex-sentinel.md +115 -0
- package/targets-stubs/opencode/neocortex.md +292 -67
- package/targets-stubs/opencode/opencode-mcp.json +0 -7
- package/targets-stubs/vscode/README.md +1 -1
- package/targets-stubs/vscode/mcp.json +0 -4
- package/targets-stubs/vscode/neocortex.agent.md +29 -18
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type PlanningQaEvidenceBindingV1, type PlanningQaPhase } from '../private-execution/planning-diagnosis-checkpoint.js';
|
|
2
|
+
/** P229.05 public receipt fragment; the seal stays root-owned and recomputes the binding. */
|
|
3
|
+
export interface PlanningQaAdmissionEvidenceV1 {
|
|
4
|
+
readonly schemaVersion: 1;
|
|
5
|
+
readonly phase: PlanningQaPhase;
|
|
6
|
+
readonly epicId: string;
|
|
7
|
+
readonly qaEvidenceId: string;
|
|
8
|
+
readonly rootSealRequired: true;
|
|
9
|
+
readonly publicSafe: true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* P229.05 (P228-CON-QA-EVIDENCE): the binding the root review of an admitted P01-P03
|
|
13
|
+
* workspace carries. `sourceHead` is the admission base (the reviews require
|
|
14
|
+
* `admission.baseSha === sourceHead`) and the artifact digests are read from `root`, where
|
|
15
|
+
* the admission already applied the patch; the names match each phase's root review.
|
|
16
|
+
*/
|
|
17
|
+
export declare function planningQaAdmissionBinding(phase: PlanningQaPhase, input: {
|
|
18
|
+
readonly root: string;
|
|
19
|
+
readonly claimId: string;
|
|
20
|
+
readonly epicId: string;
|
|
21
|
+
readonly admission: {
|
|
22
|
+
readonly baseSha: string;
|
|
23
|
+
readonly patchSha256: string;
|
|
24
|
+
readonly changedPaths: readonly string[];
|
|
25
|
+
};
|
|
26
|
+
}): PlanningQaEvidenceBindingV1;
|
|
27
|
+
/**
|
|
28
|
+
* P229.05 (P222.20, P228-CON-QA-EVIDENCE): digest-bound QA evidence published after a
|
|
29
|
+
* planning admission on the executor port. `qaEvidenceId === planningQaEvidenceId(phase,
|
|
30
|
+
* binding)`; it grants no seal and the root review/seal recompute and compare it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function derivePlanningQaEvidenceForAdmission(phase: PlanningQaPhase, binding: PlanningQaEvidenceBindingV1): PlanningQaAdmissionEvidenceV1;
|
|
33
|
+
/** P229.05: published when the evidence cannot be derived after an already-effective admission. */
|
|
34
|
+
export interface PlanningQaUnavailableV1 {
|
|
35
|
+
readonly schemaVersion: 1;
|
|
36
|
+
readonly phase: PlanningQaPhase;
|
|
37
|
+
readonly status: 'unavailable';
|
|
38
|
+
readonly reasonCode: 'private-execution-planning-qa-unavailable';
|
|
39
|
+
readonly rootSealRequired: true;
|
|
40
|
+
readonly publicSafe: true;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* P229.05: the `planningQa` receipt fragment for an admitted port step. The admission
|
|
44
|
+
* already applied the patch and the lease is consumed, so a derivation failure never
|
|
45
|
+
* fails the step: it publishes a bounded `unavailable` status (no qaEvidenceId) and the
|
|
46
|
+
* root review/seal stays required.
|
|
47
|
+
*/
|
|
48
|
+
export declare function planningQaReceiptFragment(phase: PlanningQaPhase, input: {
|
|
49
|
+
readonly root: string;
|
|
50
|
+
readonly claimId: string;
|
|
51
|
+
readonly epicId: string;
|
|
52
|
+
readonly admission: {
|
|
53
|
+
readonly baseSha: string;
|
|
54
|
+
readonly patchSha256: string;
|
|
55
|
+
readonly changedPaths: readonly string[];
|
|
56
|
+
};
|
|
57
|
+
}): PlanningQaAdmissionEvidenceV1 | PlanningQaUnavailableV1;
|
|
58
|
+
/**
|
|
59
|
+
* P228-CON-QA-EVIDENCE: the root records host-neutral QA for an admitted planning artifact.
|
|
60
|
+
* The command is read-only; it prints a `qaEvidenceId` bound to the admission patch and
|
|
61
|
+
* artifact digests, which the matching `planning-<phase> seal` then requires.
|
|
62
|
+
*/
|
|
63
|
+
export declare function planningQaCliHandler(args: readonly string[]): Promise<number>;
|
|
64
|
+
export declare function planningQaCliHandlerWithIO(args: readonly string[], input: AsyncIterable<string | Buffer>, output: Pick<Console, 'log' | 'error'>): Promise<number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createHash as h}from"node:crypto";import{lstatSync as g,readFileSync as m}from"node:fs";import{join as f}from"node:path";import{planningQaEvidenceId as I,recordPlanningDiagnosisQaEvidence as E}from"../private-execution/planning-diagnosis-checkpoint.js";import{recordPlanningResearchQaEvidence as w}from"../private-execution/planning-research-checkpoint.js";import{recordPlanningGenerationQaEvidence as v}from"../private-execution/planning-generation-checkpoint.js";const S=64*1024,c=["diagnosis","research","generation"],y=1024*1024,q=24,d=".neocortex/planning/planning.json",$=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,p=/^P[1-9][0-9]{0,11}$/;function A(n,e){try{const r=g(f(n,e));if(!r.isFile()||r.isSymbolicLink()||r.size<1||r.size>y)throw new Error("artifact");return h("sha256").update(m(f(n,e))).digest("hex")}catch{throw new Error("planning-qa-artifact-unavailable")}}function P(n,e){if(!c.includes(n)||!p.test(e.epicId))throw new Error("planning-qa-admission-invalid");const r=`.neocortex/planning/epic-${e.epicId}`,t=a=>A(e.root,a);let i;if(n==="diagnosis")i={idea:t(`${r}/idea.json`),diagnosis:t(`${r}/diagnosis.md`),enrichment:t(`${r}/enriched-prompt.md`),index:t(d)};else if(n==="research")i={research:t(`${r}/research.md`),index:t(d)};else{const a=new RegExp(`^docs/stories/${e.epicId}\\.[0-9]{2}\\.story\\.md$`),s=e.admission.changedPaths.filter(o=>a.test(o)).length,l=Array.from({length:s},(o,u)=>`docs/stories/${e.epicId}.${String(u+1).padStart(2,"0")}.story.md`);if(s<1||s>q||l.some(o=>!e.admission.changedPaths.includes(o)))throw new Error("planning-qa-artifact-unavailable");i={epic:t(`docs/epics/epic-${e.epicId}.md`),index:t(d),stories:Object.fromEntries(l.map(o=>[o,t(o)]))}}return{claimId:e.claimId,epicId:e.epicId,sourceHead:e.admission.baseSha,admissionPatchSha256:e.admission.patchSha256,artifactDigests:i}}function x(n,e){if(!c.includes(n)||typeof e!="object"||e===null||typeof e.claimId!="string"||!$.test(e.claimId)||typeof e.epicId!="string"||!p.test(e.epicId)||typeof e.sourceHead!="string"||!/^[a-f0-9]{40,64}$/.test(e.sourceHead)||typeof e.admissionPatchSha256!="string"||!/^[a-f0-9]{64}$/.test(e.admissionPatchSha256)||typeof e.artifactDigests!="object"||e.artifactDigests===null)throw new Error("planning-qa-admission-invalid");let r;try{r=I(n,e)}catch{throw new Error("planning-qa-admission-invalid")}return{schemaVersion:1,phase:n,epicId:e.epicId,qaEvidenceId:r,rootSealRequired:!0,publicSafe:!0}}function k(n,e){try{return x(n,P(n,e))}catch{return{schemaVersion:1,phase:n,status:"unavailable",reasonCode:"private-execution-planning-qa-unavailable",rootSealRequired:!0,publicSafe:!0}}}const R="usage: planning-qa record --phase <diagnosis|research|generation> [--project-root <path>] < review.json";async function _(n){const e=[];let r=0;for await(const t of n){const i=Buffer.isBuffer(t)?t:Buffer.from(t);if(r+=i.length,r>S)throw new Error("planning-qa-review-too-large");e.push(i)}if(r===0)throw new Error("planning-qa-review-missing");try{return JSON.parse(Buffer.concat(e).toString("utf8"))}catch{throw new Error("planning-qa-review-invalid")}}function N(n){if(n[0]!=="record")return null;let e,r;for(let t=1;t<n.length;t+=2){const i=n[t],a=n[t+1];if(a===void 0)return null;if(i==="--phase"&&e===void 0&&c.includes(a))e=a;else if(i==="--project-root"&&r===void 0)r=a;else return null}return e?{phase:e,...r===void 0?{}:{projectRoot:r}}:null}function j(n,e){if(/^planning-qa-[a-z-]+$/.test(n))return n;const r=`planning-${e}-`;return n.startsWith(r)&&/^[a-z-]+$/.test(n.slice(r.length))?`planning-qa-${n.slice(r.length)}`:/^planning-(research|generation)-predecessor-invalid$/.test(n)?"planning-qa-predecessor-invalid":"planning-qa-record-failed"}async function z(n){return T(n,process.stdin,console)}async function T(n,e,r){const t=N(n);if(!t)return r.error(R),1;try{const i=await _(e),a=t.projectRoot??process.cwd(),s=t.phase==="diagnosis"?E(a,i):t.phase==="research"?w(a,i):v(a,i);return r.log(JSON.stringify({ok:!0,phase:t.phase,epicId:s.epicId,qaEvidenceId:s.qaEvidenceId,publicSafe:!0})),0}catch(i){const a=i instanceof Error?i.message:"";return r.error(JSON.stringify({ok:!1,reasonCode:j(a,t.phase),publicSafe:!0})),1}}export{x as derivePlanningQaEvidenceForAdmission,P as planningQaAdmissionBinding,z as planningQaCliHandler,T as planningQaCliHandlerWithIO,k as planningQaReceiptFragment};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{lstatSync as
|
|
2
|
-
`),0}catch(n){const t=n instanceof Error?n.message.replace(/^qa-/,"refactor-"):"",c=
|
|
3
|
-
`),1}}export{
|
|
1
|
+
import{lstatSync as R,readFileSync as b,realpathSync as k}from"node:fs";import{join as y,resolve as g}from"node:path";import{signNxInvokeRequest as q}from"../../../shared/dist/nx-invoke-signature.js";import{createCompatibilityOffer as N}from"../../../shared/dist/compatibility/index.js";import{COMMAND_REGISTRY_VERSION as w,COMMAND_REGISTRY_CHECKSUM as E}from"../generated/command-registry.generated.js";import{CLIENT_VERSION as O}from"../version.js";import{loadSecureConfig as _}from"../config/secure-config.js";import{neocortexProfileDirectory as A}from"../config/profile-directory.js";import{EncryptedCache as T}from"../cache/encrypted-cache.js";import{LicenseClient as I}from"../license/license-client.js";import{detectPlatform as L}from"../adapters/platform-detector.js";const S=new Set(["refactor-control-input-invalid","refactor-control-auth-required","refactor-control-tier-required","refactor-control-read-only","refactor-control-signature-required","refactor-control-client-unsupported","refactor-control-registry-mismatch","refactor-control-executor-unavailable"]),j=new Set(["arguments-invalid","authorization-required","project-unbound","auth-required","response-invalid","request-refused","outcome-unknown"].map(e=>`refactor-root-control-${e}`));async function $(e){const o=e.body?.getReader();if(!o)throw new Error("refactor-root-control-response-invalid");let n=!1;try{const t=[];let c=0;for(;;){const a=await o.read();if(a.done){n=!0;break}if(c+=a.value.byteLength,c>16384)throw new Error("refactor-root-control-response-invalid");t.push(Buffer.from(a.value))}return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(Buffer.concat(t,c)))}catch{throw new Error("refactor-root-control-response-invalid")}finally{n||await o.cancel().catch(()=>{}),o.releaseLock()}}async function v(e,o,n=fetch){if(e!=="refactor"&&e!=="qa")throw new Error("refactor-root-control-arguments-invalid");const t=`/api/v1/invoke/${e}/control`,c=q({method:"POST",target:t,body:Buffer.from(JSON.stringify({projectId:o.projectId,storyId:o.storyId,platformTarget:o.platformTarget,registryVersion:w,registryChecksum:E,compatibility:N({clientVersion:O,registryVersion:w,registryChecksum:E})})),bearerToken:o.token,clientVersion:O}),a=await n(`${o.serverUrl.replace(/\/+$/,"")}${t}`,{method:"POST",redirect:"error",signal:AbortSignal.timeout(2e5),headers:{...c.headers,Authorization:`Bearer ${o.token}`},body:c.body}),r=await $(a);if(!a.ok)throw new Error(typeof r?.error_code=="string"&&S.has(r.error_code.replace(/^qa-/,"refactor-"))&&r.error_code.startsWith(`${e}-`)?r.error_code:"refactor-root-control-request-refused");const d=["schemaVersion","kind","status","completedStages","authority","qaAccepted","gitAuthority","billingAuthority","publicSafe"];if(!r||typeof r!="object"||Array.isArray(r)||Object.keys(r).some(s=>!d.includes(s))||r.schemaVersion!==1||r.kind!==`root-${e}-control`||typeof r.status!="string"||!["advanced","waiting","blocked","candidate-ready",...e==="qa"?["debt"]:[]].includes(r.status)||r.authority!==(e==="qa"?"LOCAL_ROOT_QA_CANDIDATE_ONLY":"LOCAL_ROOT_CANDIDATE_ONLY")||r.qaAccepted!==!1||r.gitAuthority!=="NONE"||r.billingAuthority!=="NONE"||r.publicSafe!==!0||r.completedStages!==void 0&&(typeof r.completedStages!="number"||!Number.isInteger(r.completedStages)||r.completedStages<0||r.completedStages>(e==="qa"?3:7)))throw new Error("refactor-root-control-response-invalid");return r}async function F(e,o=fetch){return v("refactor",e,o)}async function G(e,o="refactor"){try{let n="",t="",c=!1,a="json";const r=[...e];if(r.shift()!=="control")throw new Error("refactor-root-control-arguments-invalid");for(let i=0;i<r.length;i++){const f=r[i];if(f==="--authorize-root-control")c=!0;else if(f==="--project-root")n=r[++i]??"";else if(f==="--story")t=r[++i]??"";else if(f==="--format")a=r[++i]??"";else throw new Error("refactor-root-control-arguments-invalid")}if(!c||!n||a!=="json"||!/^P[0-9]{1,12}(?:\.[0-9]{1,12}){1,3}$/.test(t))throw new Error("refactor-root-control-authorization-required");const d=L({cwd:g(n),env:process.env}).targetId,s=y(g(n),".neocortex","state.json"),u=R(s);if(!u.isFile()||u.isSymbolicLink()||k(s)!==s||u.size>16*1024*1024)throw new Error("refactor-root-control-project-unbound");const p=JSON.parse(b(s,"utf8")).config?.project_id;if(typeof p!="string"||!/^[A-Za-z0-9][A-Za-z0-9_-]{15,127}$/.test(p))throw new Error("refactor-root-control-project-unbound");const l=_({strictReadOnly:!0});if(!l?.licenseKey)throw new Error("refactor-root-control-auth-required");const h=process.env.NEOCORTEX_SERVER_URL??l.serverUrl;if(!h)throw new Error("refactor-root-control-auth-required");const m=await new I({serverUrl:h,licenseKey:l.licenseKey,cacheProvider:new T({cacheDir:y(A(),"cache"),passphrase:l.licenseKey})}).getToken();if(!m)throw new Error("refactor-root-control-auth-required");const C=await v(o,{serverUrl:h,token:m,projectId:p,storyId:t,platformTarget:d});return process.stdout.write(`${JSON.stringify({ok:!0,control:C})}
|
|
2
|
+
`),0}catch(n){const t=n instanceof Error?n.message.replace(/^qa-/,"refactor-"):"",c=j.has(t)||S.has(t)?t:"refactor-root-control-outcome-unknown";return process.stdout.write(`${JSON.stringify({ok:!1,reasonCode:o==="qa"?c.replace(/^refactor-/,"qa-"):c})}
|
|
3
|
+
`),1}}export{G as refactorControlCliHandler,F as requestRefactorControl,v as requestRootControl};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type StoryCheckpointAction = 'setup' | 'accept-setup' | 'handoff' | 'begin' | 'finalize' | 'recover' | 'retry-c01' | 'integrate-worktree' | 'extend-write-set';
|
|
1
|
+
type StoryCheckpointAction = 'setup' | 'accept-setup' | 'handoff' | 'begin' | 'finalize' | 'recover' | 'retry-c01' | 'integrate-worktree' | 'extend-write-set' | 'capture-governance';
|
|
2
2
|
interface StoryCheckpointCliOptions {
|
|
3
3
|
readonly action: StoryCheckpointAction;
|
|
4
4
|
readonly storyId: string;
|
|
@@ -16,6 +16,8 @@ interface StoryCheckpointCliOptions {
|
|
|
16
16
|
readonly storyIds?: readonly string[];
|
|
17
17
|
/** `extend-write-set --paths a,b`: root-authorized write-set extension (hotfix 4.61.6). */
|
|
18
18
|
readonly paths?: readonly string[];
|
|
19
|
+
/** P230.02 (DEC-01): `extend-write-set --request`: child mode, typed request without any write. */
|
|
20
|
+
readonly request?: boolean;
|
|
19
21
|
}
|
|
20
22
|
export declare function parseStoryCheckpointArgs(args: readonly string[]): StoryCheckpointCliOptions;
|
|
21
23
|
export declare function storyCheckpointCliHandler(args: readonly string[]): Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as
|
|
1
|
+
import{readFile as E}from"node:fs/promises";import{resolve as S}from"node:path";import{acceptDirectYoloSetupCheckpoint as I,beginDirectYoloStoryCommit as C,captureDirectYoloStoryGovernance as R,finalizeDirectYoloStoryCheckpoint as W,issueDirectYoloSetupLeaseHandoff as x,prepareDirectYoloSetup as q,recoverLegacyDirectYoloStoryCheckpoint as H}from"../git/direct-yolo-checkpoint.js";import{applyDirectYoloC01Retry as D,inspectDirectYoloC01Retry as z}from"../git/direct-yolo-c01-retry.js";import{integrateStoryWorktree as Y,integrateStoryWorktreeWave as b}from"../git/story-worktree-integration.js";import{detectStoryWriteSetManualEdit as j,extendStoryWriteSet as J,requestStoryWriteSetExtension as N,storyWorktreeTemporaryBranchForManualEditGate as O}from"../git/story-write-set-extension.js";function F(n){const e=n[0];if(e!=="setup"&&e!=="accept-setup"&&e!=="handoff"&&e!=="begin"&&e!=="finalize"&&e!=="recover"&&e!=="retry-c01"&&e!=="integrate-worktree"&&e!=="extend-write-set"&&e!=="capture-governance")throw new Error("story-checkpoint-action-invalid");let s="",c=process.cwd(),r,o="origin",i=!1,p="plain",u,y,g,k=!1,f,v,m,$=!1;for(let a=1;a<n.length;a++){const t=n[a],l=()=>n[++a]??"";if(t==="--story")s=l();else if(t.startsWith("--story="))s=t.slice(8);else if(t==="--paths")m=l();else if(t.startsWith("--paths="))m=t.slice(8);else if(t==="--stories")v=l();else if(t.startsWith("--stories="))v=t.slice(10);else if(t==="--project-root")c=l()||c;else if(t.startsWith("--project-root="))c=t.slice(15);else if(t==="--commit")r=l();else if(t.startsWith("--commit="))r=t.slice(9);else if(t==="--remote")o=l();else if(t.startsWith("--remote="))o=t.slice(9);else if(t==="--push"||t==="--require-remote")i=!0;else if(t==="--setup-handoff-session")u=l();else if(t.startsWith("--setup-handoff-session="))u=t.slice(24);else if(t==="--setup-handoff-token-file")y=l();else if(t.startsWith("--setup-handoff-token-file="))y=t.slice(27);else if(t==="--expected-head")g=l();else if(t.startsWith("--expected-head="))g=t.slice(16);else if(t==="--apply")k=!0;else if(t==="--request")$=!0;else if(t==="--lease")f=l();else if(t.startsWith("--lease="))f=t.slice(8);else if(t==="--format"){const d=l();if(d!=="json"&&d!=="plain")throw new Error("story-checkpoint-format-invalid");p=d}else if(t.startsWith("--format=")){const d=t.slice(9);if(d!=="json"&&d!=="plain")throw new Error("story-checkpoint-format-invalid");p=d}else throw new Error("story-checkpoint-argument-invalid")}let h;if(v!==void 0){if(e!=="integrate-worktree"||s||f!==void 0)throw new Error("story-checkpoint-option-invalid");if(h=v.split(",").map(a=>a.trim()),h.length===0||h.some(a=>!/^P[1-9][0-9]*(?:\.[0-9]+)+$/.test(a))||new Set(h).size!==h.length)throw new Error("story-checkpoint-stories-invalid")}if(!s&&!h)throw new Error("story-checkpoint-story-required");let w;if(e==="extend-write-set"){if(m===void 0)throw new Error("story-checkpoint-paths-required");if(r||i||o!=="origin"||f!==void 0)throw new Error("story-checkpoint-option-invalid");if(w=m.split(",").map(a=>a.trim()),w.length===0||w.some(a=>a.length===0))throw new Error("story-checkpoint-paths-invalid")}else if(m!==void 0||$)throw new Error("story-checkpoint-option-invalid");if(e==="recover"&&!r)throw new Error("story-checkpoint-commit-required");if(e==="recover"&&!i)throw new Error("story-checkpoint-remote-proof-required");if(e==="finalize"&&!i)throw new Error("story-checkpoint-push-required");if(e==="integrate-worktree"&&(!i||r))throw new Error(i?"story-checkpoint-option-invalid":"story-checkpoint-push-required");if(f!==void 0&&(e!=="integrate-worktree"||!/^swt-[a-f0-9]{24}$/.test(f)))throw new Error("story-checkpoint-option-invalid");if(e==="begin"&&(r||i||o!=="origin"))throw new Error("story-checkpoint-option-invalid");if((e==="setup"||e==="accept-setup"||e==="handoff"||e==="capture-governance")&&(r||i||o!=="origin"||f!==void 0))throw new Error("story-checkpoint-option-invalid");if(e==="finalize"&&r)throw new Error("story-checkpoint-option-invalid");if(u===void 0!=(y===void 0))throw new Error("story-checkpoint-setup-handoff-incomplete");if(e!=="begin"&&(u||y))throw new Error("story-checkpoint-option-invalid");if(e!=="retry-c01"&&(g||k))throw new Error("story-checkpoint-option-invalid");if(e==="retry-c01"&&(r||i||o!=="origin"||k&&!/^[a-f0-9]{40,64}$/.test(g??"")))throw new Error("story-checkpoint-option-invalid");return{action:e,storyId:s,projectRoot:S(c),commitSha:r,remote:o,push:i,format:p,...g?{expectedHeadSha:g}:{},...k?{apply:k}:{},...f?{leaseId:f}:{},...h?{storyIds:h}:{},...w?{paths:w}:{},...$?{request:$}:{},...u?{setupHandoffSessionId:u}:{},...y?{setupHandoffTokenFile:S(y)}:{}}}async function K(n){let e;try{e=F(n)}catch(o){return console.error(o instanceof Error?o.message:"story-checkpoint-arguments-invalid"),1}if(e.action==="retry-c01")try{const o=e.apply?await D(e.projectRoot,e.storyId,e.expectedHeadSha):await z(e.projectRoot,e.storyId);return console.log(e.format==="json"?JSON.stringify(o,null,2):`story-checkpoint retry-c01: ${e.apply?"committed":"eligible"}`),0}catch(o){return console.error(o instanceof Error?o.message:"direct-yolo-retry-unverified"),1}let s;if(e.setupHandoffSessionId&&e.setupHandoffTokenFile)try{s={sessionId:e.setupHandoffSessionId,token:(await E(e.setupHandoffTokenFile,"utf8")).trim()}}catch{return console.error("story-checkpoint-setup-handoff-read-failed"),1}if(e.action==="extend-write-set"&&e.request){const o=await N({projectRoot:e.projectRoot,storyId:e.storyId,paths:e.paths??[]});return e.format==="json"?console.log(JSON.stringify({action:e.action,mode:"request",...o},null,2)):o.ok?(console.log(`story-checkpoint ${e.action}: ${o.value.outcome}`),console.log(`paths=${o.value.paths.length} requested=${o.value.requestedPathCount}`),o.value.applyCommand&&console.log(`root-apply=${o.value.applyCommand}`)):console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`),o.ok?0:1}const c=await L(e);if(c)return e.format==="json"?console.log(JSON.stringify({action:e.action,ok:!1,reasonCode:c},null,2)):console.error(`story-checkpoint ${e.action}: ${c}`),1;if(e.action==="extend-write-set"){const o=await J({projectRoot:e.projectRoot,storyId:e.storyId,paths:e.paths??[]});return e.format==="json"?console.log(JSON.stringify({action:e.action,...o},null,2)):o.ok?(console.log(`story-checkpoint ${e.action}: ${o.value.outcome}`),console.log(`paths=${o.value.extensionPathCount} authorized=${o.value.authorizedPathCount}`),console.log(`claim=${o.value.claimRevision}`)):console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`),o.ok?0:1}if(e.action==="integrate-worktree"&&e.storyIds){const o=await b({projectRoot:e.projectRoot,storyIds:e.storyIds,push:e.push,remote:e.remote});if(e.format==="json")console.log(JSON.stringify({action:e.action,mode:"wave",...o},null,2));else if(o.ok){const i=o.value;console.log(`story-checkpoint ${e.action}: wave ${i.outcome}`),console.log(`integrated=${i.integratedStoryIds.length} gate-runs=${i.gateRuns}/${i.gateRunCap}`),console.log(`head=${i.epicHeadAfterSha}`);for(const p of i.stories)console.log(`story=${p.storyId} ${p.outcome}${p.reasonCode?` ${p.reasonCode}`:""}`)}else console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`);return o.ok&&o.value.outcome!=="gate-failed"?0:1}if(e.action==="integrate-worktree"){const o=await Y({projectRoot:e.projectRoot,storyId:e.storyId,push:e.push,remote:e.remote,...e.leaseId?{leaseId:e.leaseId}:{}});if(e.format==="json")console.log(JSON.stringify({action:e.action,...o},null,2));else if(o.ok){console.log(`story-checkpoint ${e.action}: ${o.value.outcome}`),o.value.checkpointHeadSha&&console.log(`head=${o.value.checkpointHeadSha}`);for(const i of o.value.conflictPaths??[])console.log(`conflict=${i}`)}else console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`);return o.ok?0:1}if(e.action==="capture-governance"){const o=await R(e);return e.format==="json"?console.log(JSON.stringify({action:e.action,...o},null,2)):o.ok?(console.log(`story-checkpoint ${e.action}: ok`),console.log(`governance=${o.value.governanceDigest} revision=${o.value.revision}`)):console.error(`story-checkpoint ${e.action}: ${o.reasonCode}`),o.ok?0:1}const r=e.action==="setup"?await q(e):e.action==="accept-setup"?await I(e):e.action==="handoff"?await x(e):e.action==="begin"?await C({...e,...s?{setupLeaseHandoff:s}:{}}):e.action==="finalize"?await W(e):await H({...e,commitSha:e.commitSha});if(e.format==="json")console.log(JSON.stringify({action:e.action,...r},null,2));else if(r.ok)if(console.log(`story-checkpoint ${e.action}: ok`),e.action==="begin"&&"trailers"in r.value)for(const o of r.value.trailers)console.log(o);else"headSha"in r.value&&console.log(`head=${r.value.headSha}`);else console.error(`story-checkpoint ${e.action}: ${r.reasonCode}`);return r.ok?0:1}async function L(n){if(n.action==="begin"||n.action==="finalize"){const e=await j({projectRoot:n.projectRoot,storyId:n.storyId});return e.ok?void 0:e.reasonCode}if(n.action==="integrate-worktree")for(const e of n.storyIds??[n.storyId]){const s=await O(n.projectRoot,e);if(!s)continue;const c=await j({projectRoot:n.projectRoot,storyId:e,candidateRef:s});if(!c.ok)return c.reasonCode}}export{F as parseStoryCheckpointArgs,K as storyCheckpointCliHandler};
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { StoryWorktreeCleanup } from '../git/story-worktree-cleanup.js';
|
|
14
14
|
import { StoryWorktreeManager } from '../git/story-worktree-manager.js';
|
|
15
|
-
export declare const STORY_WORKTREE_ACTIONS: readonly ["create", "adopt", "sync", "status", "release", "cleanup", "recover", "record-push"];
|
|
15
|
+
export declare const STORY_WORKTREE_ACTIONS: readonly ["create", "adopt", "sync", "status", "release", "cleanup", "recover", "record-push", "assert-phase-two"];
|
|
16
16
|
export type StoryWorktreeAction = (typeof STORY_WORKTREE_ACTIONS)[number];
|
|
17
17
|
export interface StoryWorktreeCliOptions {
|
|
18
18
|
readonly action: StoryWorktreeAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{readFile as g,stat as f,writeFile as m}from"node:fs/promises";import{dirname as
|
|
1
|
+
import{readFile as g,stat as f,writeFile as m}from"node:fs/promises";import{dirname as b,isAbsolute as S,resolve as C}from"node:path";import{STORY_WORKTREE_CLEANUP_TRIGGERS as j,StoryWorktreeCleanup as F}from"../git/story-worktree-cleanup.js";import{StoryWorktreeManager as O}from"../git/story-worktree-manager.js";const y=Object.freeze(["create","adopt","sync","status","release","cleanup","recover","record-push","assert-phase-two"]),x=j.filter(e=>e!=="orphan-recovery"),E=Object.freeze({"--project-root":"projectRoot","--format":"format","--epic":"epicId","--story":"storyId","--dispatch":"dispatchId","--base-sha":"baseSha","--graph-revision":"graphRevision","--owner":"ownerId","--lease":"leaseId","--sha":"sha","--directive-file":"directiveFile","--worktree-path":"worktreePath","--path-file":"pathFile","--trigger":"trigger","--remote":"remote"}),P=Object.freeze({"--dry-run":"dryRun"}),u=Object.freeze({create:["epicId","storyId","dispatchId","baseSha","graphRevision"],adopt:["epicId","storyId","dispatchId","baseSha","graphRevision","worktreePath"],sync:["leaseId"],status:[],release:["leaseId"],cleanup:["leaseId","trigger"],recover:[],"record-push":["leaseId","remote"],"assert-phase-two":["storyId"]}),A=Object.freeze({create:[...u.create,"ownerId","pathFile"],adopt:[...u.adopt,"ownerId","pathFile"],sync:["leaseId","sha","directiveFile"],status:["leaseId","epicId","storyId"],release:["leaseId"],cleanup:["leaseId","trigger","dryRun"],recover:["epicId","dryRun"],"record-push":["leaseId","remote"],"assert-phase-two":["storyId"]});class o extends Error{reasonCode;constructor(t){super(t),this.reasonCode=t}}function W(e,t=process.cwd()){const a=e[0];if(!y.includes(a))throw new o("story-worktree-action-invalid");const r={};for(let s=1;s<e.length;s++){const d=e[s],l=P[d];if(l){if(r[l]!==void 0)throw new o("story-worktree-argument-invalid");r[l]="true";continue}const c=d.indexOf("="),R=c>0?d.slice(0,c):d,w=E[R];if(!w)throw new o("story-worktree-argument-invalid");const h=c>0?d.slice(c+1):e[++s];if(h===void 0||h===""||r[w]!==void 0)throw new o("story-worktree-argument-invalid");r[w]=h}const i=a,p=new Set([...A[i],"projectRoot","format"]);if(Object.keys(r).some(s=>!p.has(s)))throw new o("story-worktree-option-invalid");if(u[i].some(s=>r[s]===void 0))throw new o("story-worktree-option-required");if(i==="sync"&&r.sha===void 0==(r.directiveFile===void 0))throw new o("story-worktree-sync-source-invalid");if(i==="status"&&[r.leaseId,r.epicId,r.storyId].filter(s=>s!==void 0).length!==1)throw new o("story-worktree-status-selector-invalid");if(i==="cleanup"&&!x.includes(r.trigger))throw new o("story-worktree-trigger-invalid");const n=r.format??"json";if(n!=="json"&&n!=="plain")throw new o("story-worktree-format-invalid");for(const s of["directiveFile","worktreePath","pathFile"])if(r[s]!==void 0&&!S(r[s]))throw new o("story-worktree-path-argument-invalid");const{dryRun:k,...v}=r;return{...v,...k?{dryRun:!0}:{},action:i,projectRoot:C(t,r.projectRoot??"."),format:n}}async function L(e){try{await f(e)}catch{try{if((await f(b(e))).isDirectory())return}catch{}throw new o("story-worktree-path-file-invalid")}throw new o("story-worktree-path-file-exists")}async function _(e,t=new O({projectRoot:e.projectRoot}),a=new F({projectRoot:e.projectRoot,manager:t})){e.pathFile&&await L(e.pathFile);let r;switch(e.action){case"create":r=await t.create({epicId:e.epicId,storyId:e.storyId,dispatchId:e.dispatchId,baseSha:e.baseSha,graphRevision:e.graphRevision,...e.ownerId?{ownerId:e.ownerId}:{}});break;case"adopt":r=await t.adopt({epicId:e.epicId,storyId:e.storyId,dispatchId:e.dispatchId,baseSha:e.baseSha,graphRevision:e.graphRevision,worktreePath:e.worktreePath,...e.ownerId?{ownerId:e.ownerId}:{}});break;case"sync":{let i;if(e.directiveFile)try{i=JSON.parse(await g(e.directiveFile,"utf8"))}catch{return{exitCode:1,payload:{action:"sync",ok:!1,reasonCode:"story-worktree-directive-invalid"}}}r=await t.sync({leaseId:e.leaseId,...e.sha?{integratedSha:e.sha}:{},...i!==void 0?{directive:i}:{}});break}case"status":r=await t.status(e.leaseId?{leaseId:e.leaseId}:e.storyId?{storyId:e.storyId}:{epicId:e.epicId});break;case"release":r=await t.release({leaseId:e.leaseId});break;case"cleanup":r=await a.cleanup({leaseId:e.leaseId,trigger:e.trigger,...e.dryRun?{dryRun:!0}:{}});break;case"recover":r=await a.sweep({...e.epicId?{epicId:e.epicId}:{},...e.dryRun?{dryRun:!0}:{}});break;case"record-push":r=await a.recordPush({leaseId:e.leaseId,remote:e.remote});break;case"assert-phase-two":r=await t.assertPhaseTwo({storyId:e.storyId});break}if(!r.ok)return{exitCode:1,payload:{action:e.action,ok:!1,reasonCode:r.reasonCode,...r.conflictPaths?{conflictPaths:r.conflictPaths}:{}}};if(e.pathFile&&r.privatePath)try{await m(e.pathFile,`${r.privatePath}
|
|
2
2
|
`,{flag:"wx",mode:384})}catch{return{exitCode:1,payload:{action:e.action,ok:!1,reasonCode:"story-worktree-path-file-invalid"}}}return{exitCode:0,payload:{action:e.action,ok:!0,value:r.value}}}function I(e,t){if(t==="json")return JSON.stringify(e,null,2);const a=[`story-worktree ${String(e.action)}: ${e.ok?"ok":"refused"}`];return e.reasonCode&&a.push(`reason=${String(e.reasonCode)}`),a.join(" ")}async function z(e){let t;try{t=W(e)}catch(a){const r=a instanceof o?a.reasonCode:"story-worktree-argument-invalid",i=y.includes(e[0])?e[0]:null;return process.stdout.write(`${JSON.stringify({action:i,ok:!1,reasonCode:r})}
|
|
3
3
|
`),2}try{const{exitCode:a,payload:r}=await _(t);return process.stdout.write(`${I(r,t.format)}
|
|
4
4
|
`),a}catch(a){const r=a instanceof o?a.reasonCode:"story-worktree-internal-error";return process.stdout.write(`${I({action:t.action,ok:!1,reasonCode:r},t.format)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RootProjectMemoryEffect } from '@neocortex/shared';
|
|
2
2
|
import { type StoryCommitCheckpoint } from '../../../shared/dist/yoloop/branch-unit.js';
|
|
3
3
|
import { type GitLifecyclePhysicalIntegrationLockOwner, type P205TransientExecutionAuthority } from './git-lifecycle-store.js';
|
|
4
|
+
import { type GovernanceMode, type StoryGovernanceReceipt } from './governance-runtime-store.js';
|
|
4
5
|
/** P226.08 CON-ORIGIN-08-03: closed public remediation hints; never free text. */
|
|
5
6
|
export type DirectYoloFailureHint = 'fetch-origin-branch' | 'checkout-origin-or-rebase';
|
|
6
7
|
export type DirectYoloCheckpointResult<T> = {
|
|
@@ -24,6 +25,8 @@ export interface DirectYoloCommitPlan {
|
|
|
24
25
|
readonly idempotencyKey: string;
|
|
25
26
|
readonly changedPaths: readonly string[];
|
|
26
27
|
readonly trailers: readonly string[];
|
|
28
|
+
/** P228.26 (DEC-01): present only in `runtime-store`. */
|
|
29
|
+
readonly governance?: StoryGovernanceReceipt;
|
|
27
30
|
}
|
|
28
31
|
export interface DirectYoloSetupHandoffReceipt {
|
|
29
32
|
readonly schemaVersion: 1;
|
|
@@ -36,6 +39,8 @@ export interface DirectYoloSetupHandoffReceipt {
|
|
|
36
39
|
readonly expiresAt: string;
|
|
37
40
|
readonly reused: boolean;
|
|
38
41
|
readonly publicSafe: true;
|
|
42
|
+
/** P228.26 (DEC-01): present only in `runtime-store`. */
|
|
43
|
+
readonly governance?: StoryGovernanceReceipt;
|
|
39
44
|
}
|
|
40
45
|
export interface DirectYoloSetupReceipt {
|
|
41
46
|
readonly schemaVersion: 1;
|
|
@@ -92,6 +97,30 @@ export interface DirectYoloCheckpointOptions {
|
|
|
92
97
|
readonly beforeCheckpointPersist?: () => Promise<void>;
|
|
93
98
|
/** Test seam for crash-window reproduction after durable CAS and before release. */
|
|
94
99
|
readonly afterCheckpointPersist?: () => Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* P230.05 (REQ-03): write-set read by the story-worktree integrator before
|
|
102
|
+
* its fast-forward. When set, finalize binds the claim and the accepted
|
|
103
|
+
* checkpoint to it instead of the write-set re-read from the post-ff state.
|
|
104
|
+
* Internal integrator input only; the CLI never supplies it.
|
|
105
|
+
*/
|
|
106
|
+
readonly preFastForwardAuthorizedWriteSet?: readonly string[];
|
|
107
|
+
}
|
|
108
|
+
/** P230.05: verified bindings of one story commit (trailers, claim, graph epoch, bundle, review). */
|
|
109
|
+
export interface DirectYoloVerifiedCommit {
|
|
110
|
+
readonly baseSha: string;
|
|
111
|
+
readonly changedPaths: readonly string[];
|
|
112
|
+
readonly bundleDigest: string;
|
|
113
|
+
readonly graphRevision: string;
|
|
114
|
+
readonly claimRevision: string;
|
|
115
|
+
readonly idempotencyKey: string;
|
|
116
|
+
readonly governance?: StoryGovernanceReceipt;
|
|
117
|
+
}
|
|
118
|
+
/** P230.05: optional, restricting verification inputs supplied by the integrator. */
|
|
119
|
+
export interface DirectYoloCommitVerificationOptions {
|
|
120
|
+
/** Write-set the claim and changed paths are bound to (pre-ff integrator authority). */
|
|
121
|
+
readonly claimWriteSet?: readonly string[];
|
|
122
|
+
/** Graph revision this commit must carry (per-commit epoch). */
|
|
123
|
+
readonly expectedGraphRevision?: string;
|
|
95
124
|
}
|
|
96
125
|
/**
|
|
97
126
|
* Productive P207 setup boundary. It owns only the current checkout and the
|
|
@@ -108,9 +137,20 @@ export declare function acceptDirectYoloSetupCheckpoint(options: Pick<DirectYolo
|
|
|
108
137
|
export declare function issueDirectYoloSetupLeaseHandoff(options: Pick<DirectYoloCheckpointOptions, 'projectRoot' | 'storyId' | 'nowIso'>): Promise<DirectYoloCheckpointResult<DirectYoloSetupHandoffReceipt>>;
|
|
109
138
|
export declare function beginDirectYoloStoryCommit(options: Pick<DirectYoloCheckpointOptions, 'projectRoot' | 'storyId' | 'nowIso' | 'setupLeaseHandoff' | 'setupHandoffFault'>): Promise<DirectYoloCheckpointResult<DirectYoloCommitPlan>>;
|
|
110
139
|
export declare function finalizeDirectYoloStoryCheckpoint(options: DirectYoloCheckpointOptions): Promise<DirectYoloCheckpointResult<StoryCommitCheckpoint>>;
|
|
140
|
+
/** Authority shape the verifier consumes (logical authority; the branch check is the caller's). */
|
|
141
|
+
type DirectYoloCommitAuthority = Pick<LogicalAuthority, 'projectRoot' | 'epicId' | 'executionBranch' | 'graphRevision' | 'authorizedWriteSet' | 'rootMemoryEffect' | 'governanceMode'>;
|
|
142
|
+
/**
|
|
143
|
+
* P230.05 (REQ-01/REQ-04): verify one story-worktree integration commit with
|
|
144
|
+
* the integrator's pre-fast-forward authority, before any effect on
|
|
145
|
+
* `epic/<ID>` or the remote. Pure: reads Git objects and private plans only.
|
|
146
|
+
*/
|
|
147
|
+
export declare function verifyDirectYoloIntegrationCommit(authority: DirectYoloCommitAuthority, storyId: string, headSha: string, options?: {
|
|
148
|
+
readonly expectedGraphRevision?: string;
|
|
149
|
+
}): Promise<DirectYoloCheckpointResult<DirectYoloVerifiedCommit>>;
|
|
111
150
|
export declare function recoverLegacyDirectYoloStoryCheckpoint(options: DirectYoloCheckpointOptions & {
|
|
112
151
|
readonly commitSha: string;
|
|
113
152
|
}): Promise<DirectYoloCheckpointResult<StoryCommitCheckpoint>>;
|
|
153
|
+
type LogicalAuthority = Awaited<ReturnType<typeof resolveLogicalAuthority>>;
|
|
114
154
|
/**
|
|
115
155
|
* P225.07 root integration authority: the same logical authority as direct
|
|
116
156
|
* C08, required from the root checkout on the execution branch.
|
|
@@ -126,9 +166,10 @@ export declare function resolveDirectYoloIntegrationAuthority(projectRootInput:
|
|
|
126
166
|
graphRevision: string;
|
|
127
167
|
authorizedWriteSet: readonly string[];
|
|
128
168
|
rootMemoryEffect: import("../private-execution/shared-root-memory-types.js").RootProjectMemoryEffect | undefined;
|
|
169
|
+
governanceMode: GovernanceMode;
|
|
129
170
|
}>;
|
|
130
171
|
/** P225.07: the direct C08 write-set rule, shared with root integration. */
|
|
131
|
-
export declare function validateDirectYoloWriteSet(paths: readonly string[], authorizedWriteSet: readonly string[], storyId: string, rootMemoryEffect?: RootProjectMemoryEffect): {
|
|
172
|
+
export declare function validateDirectYoloWriteSet(paths: readonly string[], authorizedWriteSet: readonly string[], storyId: string, rootMemoryEffect?: RootProjectMemoryEffect, governanceMode?: GovernanceMode): {
|
|
132
173
|
readonly ok: true;
|
|
133
174
|
} | {
|
|
134
175
|
readonly ok: false;
|
|
@@ -213,7 +254,29 @@ export declare function persistDirectYoloWaveStoryCheckpoint(input: {
|
|
|
213
254
|
};
|
|
214
255
|
readonly remote?: string;
|
|
215
256
|
readonly nowIso?: string;
|
|
257
|
+
/** P230.05 (REQ-03): the integrator's pre-fast-forward write-set (claim binding). */
|
|
258
|
+
readonly authorizedWriteSet?: readonly string[];
|
|
259
|
+
/** P230.05 (REQ-04): the graph revision this commit was verified against before any effect. */
|
|
260
|
+
readonly expectedGraphRevision?: string;
|
|
216
261
|
}): Promise<DirectYoloCheckpointResult<StoryCommitCheckpoint>>;
|
|
262
|
+
declare function resolveLogicalAuthority(projectRootInput: string, storyId: string): Promise<{
|
|
263
|
+
projectRoot: string;
|
|
264
|
+
storyId: string;
|
|
265
|
+
story: Record<string, unknown>;
|
|
266
|
+
epicId: string;
|
|
267
|
+
executionBranch: string;
|
|
268
|
+
originBranch: string;
|
|
269
|
+
graphRevision: string;
|
|
270
|
+
authorizedWriteSet: readonly string[];
|
|
271
|
+
rootMemoryEffect: import("../private-execution/shared-root-memory-types.js").RootProjectMemoryEffect | undefined;
|
|
272
|
+
governanceMode: GovernanceMode;
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* P228.26 (DEC-04): capture the local governance of a story into the runtime
|
|
276
|
+
* store from the root checkout. `tracked` projects keep governance in Git and
|
|
277
|
+
* are refused with `governance-capture-not-applicable` (nothing is written).
|
|
278
|
+
*/
|
|
279
|
+
export declare function captureDirectYoloStoryGovernance(options: Pick<DirectYoloCheckpointOptions, 'projectRoot' | 'storyId'>): Promise<DirectYoloCheckpointResult<StoryGovernanceReceipt>>;
|
|
217
280
|
/**
|
|
218
281
|
* P227.03 (P227.06 DEBT-1, C11 F1/F2): a root write-set extension scope
|
|
219
282
|
* admitted by the direct checkpoint. It follows the shared P226.05 grammar
|