codex-workflow-v2 2.0.0-beta.5 → 2.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,7 +36,7 @@ cross-machine synchronization are not part of its contract.
36
36
  Node.js 22 or newer is required. Consumers pin the exact package version:
37
37
 
38
38
  ```bash
39
- npm install --save-dev --save-exact codex-workflow-v2@2.0.0-beta.5
39
+ npm install --save-dev --save-exact codex-workflow-v2@2.0.0-beta.7
40
40
  npx codex-workflow gateway handshake --repo .
41
41
  npx codex-workflow doctor --repo .
42
42
  ```
@@ -1,2 +1,2 @@
1
1
  export declare const PACKAGE_NAME = "codex-workflow-v2";
2
- export declare const PACKAGE_VERSION = "2.0.0-beta.5";
2
+ export declare const PACKAGE_VERSION = "2.0.0-beta.7";
@@ -1,3 +1,3 @@
1
1
  export const PACKAGE_NAME = 'codex-workflow-v2';
2
- export const PACKAGE_VERSION = '2.0.0-beta.5';
2
+ export const PACKAGE_VERSION = '2.0.0-beta.7';
3
3
  //# sourceMappingURL=version.js.map
@@ -790,6 +790,7 @@ export class WorkflowService {
790
790
  const { identity } = this.#mutationContext(repository);
791
791
  const milestone = this.readMilestoneCurrent(identity.projectId, milestoneId);
792
792
  assertExpectedRevision(milestone, expectedRevision);
793
+ this.requireActiveKnowledgeMap(identity.repositoryRoot, identity.projectId);
793
794
  return prepareMilestoneAutonomyContract({
794
795
  projectId: identity.projectId,
795
796
  milestone,
@@ -803,6 +804,7 @@ export class WorkflowService {
803
804
  const { identity } = this.#mutationContext(repository);
804
805
  const milestone = this.readMilestoneCurrent(identity.projectId, milestoneId);
805
806
  assertExpectedRevision(milestone, expectedRevision);
807
+ this.requireActiveKnowledgeMap(identity.repositoryRoot, identity.projectId);
806
808
  return applyMilestoneAutonomyContract({
807
809
  store: this.store,
808
810
  projectId: identity.projectId,
@@ -851,6 +853,7 @@ export class WorkflowService {
851
853
  if (milestone.status !== 'awaiting_execution_authorization' || !milestone.planHash) {
852
854
  throw new WorkflowError('TRANSITION_BLOCKED', `Milestone ${milestoneId} is not awaiting authorization.`);
853
855
  }
856
+ this.requireActiveKnowledgeMap(identity.repositoryRoot, identity.projectId);
854
857
  const root = this.store.milestoneRoot(identity.projectId, milestoneId);
855
858
  const planHash = this.store.hashArtifact(root, 'plan.json');
856
859
  if (planHash !== milestone.planHash) {
@@ -2913,6 +2916,7 @@ export class WorkflowService {
2913
2916
  observation: status.observation,
2914
2917
  });
2915
2918
  const repositoryRoot = resolveRepositoryIdentity(repository).repositoryRoot;
2919
+ const inspectCurrentKnowledgeMap = () => inspectKnowledgeMap(this.store.readKnowledgeMap(status.projectId), scanProjectKnowledge(repositoryRoot, status.projectId, this.now()));
2916
2920
  const milestonesById = new Map(status.milestones.map((milestone) => [milestone.id, milestone]));
2917
2921
  const requestedTask = taskId === null
2918
2922
  ? null
@@ -3001,7 +3005,7 @@ export class WorkflowService {
3001
3005
  }
3002
3006
  let knowledgeMap;
3003
3007
  try {
3004
- knowledgeMap = this.knowledgeMapStatus(repository);
3008
+ knowledgeMap = inspectCurrentKnowledgeMap();
3005
3009
  }
3006
3010
  catch (error) {
3007
3011
  if (!(error instanceof WorkflowError) || error.code !== 'NOT_FOUND')
@@ -3091,6 +3095,38 @@ export class WorkflowService {
3091
3095
  }
3092
3096
  return withAdoption(withMilestoneCancellation(taskNext ?? this.nextForTaskWithDelegation(status.projectId, activeTask, null)));
3093
3097
  }
3098
+ let repositoryKnowledgeMap;
3099
+ try {
3100
+ repositoryKnowledgeMap = inspectCurrentKnowledgeMap();
3101
+ }
3102
+ catch (error) {
3103
+ if (!(error instanceof WorkflowError) || error.code !== 'NOT_FOUND')
3104
+ throw error;
3105
+ return withAdoption({
3106
+ scope: 'project-memory',
3107
+ status: 'missing',
3108
+ action: 'project-memory scan',
3109
+ authorizesMilestone: false,
3110
+ provenanceNotice: 'Project Knowledge must be current before Discovery or Milestone authorization.',
3111
+ });
3112
+ }
3113
+ if (repositoryKnowledgeMap.status !== 'active' || !repositoryKnowledgeMap.approval) {
3114
+ const action = repositoryKnowledgeMap.status === 'stale'
3115
+ ? 'project-memory reconcile'
3116
+ : 'project-memory approve';
3117
+ const delegatedApprovalOptions = action === 'project-memory approve'
3118
+ ? this.delegatedApprovalOptions(status.projectId, 'project_memory.approve', repositoryKnowledgeMap)
3119
+ : [];
3120
+ return withAdoption({
3121
+ scope: 'project-memory',
3122
+ status: repositoryKnowledgeMap.status,
3123
+ action,
3124
+ revision: repositoryKnowledgeMap.revision,
3125
+ authorizesMilestone: false,
3126
+ provenanceNotice: 'Project Knowledge must be reconciled and approved before Discovery or Milestone authorization.',
3127
+ ...(delegatedApprovalOptions.length > 0 ? { delegatedApprovalOptions } : {}),
3128
+ });
3129
+ }
3094
3130
  const activeMilestone = status.milestones.find((milestone) => !['accepted', 'cancelled'].includes(milestone.status));
3095
3131
  if (activeMilestone) {
3096
3132
  const initialAssembly = status.milestoneInitialAssembly