aios-core 4.2.6 → 4.2.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.
Files changed (26) hide show
  1. package/.aios-core/core/orchestration/context-manager.js +333 -5
  2. package/.aios-core/core/orchestration/dashboard-integration.js +17 -1
  3. package/.aios-core/core/orchestration/execution-profile-resolver.js +107 -0
  4. package/.aios-core/core/orchestration/index.js +3 -0
  5. package/.aios-core/core/orchestration/skill-dispatcher.js +2 -0
  6. package/.aios-core/core/orchestration/subagent-prompt-builder.js +2 -0
  7. package/.aios-core/core/orchestration/workflow-orchestrator.js +113 -5
  8. package/.aios-core/data/entity-registry.yaml +1114 -1336
  9. package/.aios-core/development/agents/ux-design-expert.md +1 -1
  10. package/.aios-core/development/checklists/brownfield-compatibility-checklist.md +114 -0
  11. package/.aios-core/development/scripts/workflow-state-manager.js +128 -1
  12. package/.aios-core/development/tasks/next.md +36 -5
  13. package/.aios-core/hooks/ids-post-commit.js +29 -1
  14. package/.aios-core/hooks/ids-pre-push.js +29 -1
  15. package/.aios-core/infrastructure/contracts/compatibility/aios-4.0.4.yaml +44 -0
  16. package/.aios-core/infrastructure/scripts/validate-parity.js +238 -2
  17. package/.aios-core/install-manifest.yaml +43 -27
  18. package/.aios-core/product/templates/brownfield-risk-report-tmpl.yaml +277 -0
  19. package/.aios-core/workflow-intelligence/engine/suggestion-engine.js +114 -5
  20. package/LICENSE +13 -1
  21. package/README.md +39 -9
  22. package/package.json +8 -6
  23. package/packages/installer/src/wizard/ide-config-generator.js +0 -117
  24. package/packages/installer/src/wizard/index.js +2 -118
  25. package/packages/installer/src/wizard/pro-setup.js +50 -5
  26. package/scripts/semantic-lint.js +190 -0
@@ -23,6 +23,7 @@ const ChecklistRunner = require('./checklist-runner');
23
23
  const TechStackDetector = require('./tech-stack-detector');
24
24
  const ConditionEvaluator = require('./condition-evaluator');
25
25
  const SkillDispatcher = require('./skill-dispatcher');
26
+ const { resolveExecutionProfile } = require('./execution-profile-resolver');
26
27
 
27
28
  /**
28
29
  * Orchestrates multi-agent workflow execution
@@ -41,11 +42,15 @@ class WorkflowOrchestrator {
41
42
  this.workflowPath = workflowPath;
42
43
  this.options = {
43
44
  yolo: options.yolo || false,
45
+ executionProfile: options.executionProfile || null,
46
+ executionContext: options.executionContext || 'development',
44
47
  parallel: options.parallel !== false, // Default true
45
48
  onPhaseStart: options.onPhaseStart || this._defaultPhaseStart.bind(this),
46
49
  onPhaseComplete: options.onPhaseComplete || this._defaultPhaseComplete.bind(this),
47
50
  dispatchSubagent: options.dispatchSubagent || null,
48
51
  projectRoot: options.projectRoot || process.cwd(),
52
+ confidenceThreshold: this._resolveConfidenceThreshold(options.confidenceThreshold),
53
+ enableConfidenceGate: options.enableConfidenceGate !== false,
49
54
  };
50
55
 
51
56
  this.workflow = null;
@@ -59,6 +64,11 @@ class WorkflowOrchestrator {
59
64
  this.skillDispatcher = new SkillDispatcher(this.options);
60
65
  this.conditionEvaluator = null; // Initialized after pre-flight detection
61
66
  this.techStackProfile = null; // Populated by pre-flight detection
67
+ this.executionProfile = resolveExecutionProfile({
68
+ explicitProfile: this.options.executionProfile,
69
+ context: this.options.executionContext,
70
+ yolo: this.options.yolo,
71
+ });
62
72
 
63
73
  // Execution state
64
74
  this.executionState = {
@@ -395,8 +405,15 @@ class WorkflowOrchestrator {
395
405
  }
396
406
  }
397
407
 
398
- // Generate execution summary
399
- return this._generateExecutionSummary();
408
+ // Generate execution summary + confidence gate
409
+ const summary = this._generateExecutionSummary();
410
+ if (summary.confidenceGate?.enabled && !summary.confidenceGate.passed) {
411
+ await this.contextManager.markFailed(
412
+ `Delivery confidence ${summary.deliveryConfidence.score}% below threshold ${summary.confidenceGate.threshold}%`,
413
+ this.executionState.currentPhase,
414
+ );
415
+ }
416
+ return summary;
400
417
  }
401
418
 
402
419
  /**
@@ -478,7 +495,9 @@ class WorkflowOrchestrator {
478
495
 
479
496
  // V3.1: Save skip result to context with reason
480
497
  const skipResult = this.skillDispatcher.createSkipResult(phase, skipReason);
481
- await this.contextManager.savePhaseOutput(phaseNum, skipResult);
498
+ await this.contextManager.savePhaseOutput(phaseNum, skipResult, {
499
+ handoffTarget: this._getNextPhaseHandoffTarget(phaseNum),
500
+ });
482
501
 
483
502
  return { skipped: true, phase: phaseNum, reason: skipReason };
484
503
  }
@@ -522,6 +541,8 @@ class WorkflowOrchestrator {
522
541
  notes: phase.notes,
523
542
  checklist: phase.checklist,
524
543
  template: phase.template,
544
+ executionProfile: this.executionProfile.profile,
545
+ executionPolicy: this.executionProfile.policy,
525
546
  },
526
547
  );
527
548
 
@@ -534,6 +555,8 @@ class WorkflowOrchestrator {
534
555
  ...context,
535
556
  workflowId: this.workflow.workflow?.id,
536
557
  yoloMode: this.options.yolo,
558
+ executionProfile: this.executionProfile.profile,
559
+ executionPolicy: this.executionProfile.policy,
537
560
  previousPhases: this.executionState.completedPhases,
538
561
  },
539
562
  techStackProfile: this.techStackProfile,
@@ -545,6 +568,11 @@ class WorkflowOrchestrator {
545
568
  ` 🚀 ${this.skillDispatcher.formatDispatchLog(dispatchPayload).split('\n')[0]}`,
546
569
  ),
547
570
  );
571
+ console.log(
572
+ chalk.gray(
573
+ ` 🛡️ Execution profile: ${this.executionProfile.profile} (${this.executionProfile.context})`,
574
+ ),
575
+ );
548
576
 
549
577
  // Dispatch to subagent
550
578
  let result;
@@ -556,7 +584,8 @@ class WorkflowOrchestrator {
556
584
  agentId: phase.agent,
557
585
  prompt,
558
586
  phase,
559
- context,
587
+ context: dispatchPayload.context,
588
+ baseContext: context,
560
589
  });
561
590
 
562
591
  // V3.1: Parse and normalize skill output
@@ -586,6 +615,8 @@ class WorkflowOrchestrator {
586
615
  result,
587
616
  validation,
588
617
  timestamp: new Date().toISOString(),
618
+ }, {
619
+ handoffTarget: this._getNextPhaseHandoffTarget(phaseNum),
589
620
  });
590
621
 
591
622
  // Notify phase complete
@@ -615,6 +646,31 @@ class WorkflowOrchestrator {
615
646
  return this._evaluateConditionLegacy(condition);
616
647
  }
617
648
 
649
+ /**
650
+ * Determine next phase handoff target from workflow sequence.
651
+ * @private
652
+ */
653
+ _getNextPhaseHandoffTarget(currentPhaseNum) {
654
+ const sequence = Array.isArray(this.workflow?.sequence) ? this.workflow.sequence : [];
655
+ const currentIndex = sequence.findIndex((p) => p && p.phase === currentPhaseNum);
656
+ if (currentIndex < 0) {
657
+ return { phase: null, agent: null };
658
+ }
659
+
660
+ for (let i = currentIndex + 1; i < sequence.length; i += 1) {
661
+ const next = sequence[i];
662
+ if (!next || next.workflow_end || !next.phase) {
663
+ continue;
664
+ }
665
+ return {
666
+ phase: next.phase,
667
+ agent: next.agent || null,
668
+ };
669
+ }
670
+
671
+ return { phase: null, agent: null };
672
+ }
673
+
618
674
  /**
619
675
  * Legacy condition evaluation (backward compatibility)
620
676
  * @private
@@ -703,7 +759,8 @@ class WorkflowOrchestrator {
703
759
  const minutes = Math.floor(duration / 60000);
704
760
  const seconds = Math.floor((duration % 60000) / 1000);
705
761
 
706
- return {
762
+ const deliveryConfidence = this.contextManager?.getDeliveryConfidence?.() || null;
763
+ const summary = {
707
764
  workflow: this.workflow.workflow?.id,
708
765
  status: this.executionState.failedPhases.length === 0 ? 'completed' : 'completed_with_errors',
709
766
  duration: `${minutes}m ${seconds}s`,
@@ -717,6 +774,57 @@ class WorkflowOrchestrator {
717
774
  failedPhases: this.executionState.failedPhases,
718
775
  skippedPhases: this.executionState.skippedPhases,
719
776
  outputs: this.contextManager?.getPreviousPhaseOutputs() || {},
777
+ deliveryConfidence,
778
+ };
779
+
780
+ const confidenceGate = this._evaluateConfidenceGate(deliveryConfidence);
781
+ if (confidenceGate.enabled) {
782
+ summary.confidenceGate = confidenceGate;
783
+ if (!confidenceGate.passed && summary.status === 'completed') {
784
+ summary.status = 'failed_confidence_gate';
785
+ }
786
+ }
787
+
788
+ return summary;
789
+ }
790
+
791
+ /**
792
+ * Resolve confidence threshold from explicit option > env > default.
793
+ * @private
794
+ */
795
+ _resolveConfidenceThreshold(explicitThreshold) {
796
+ const explicit = Number(explicitThreshold);
797
+ if (Number.isFinite(explicit)) {
798
+ return explicit;
799
+ }
800
+ const envThreshold = Number(process.env.AIOS_DELIVERY_CONFIDENCE_THRESHOLD);
801
+ return Number.isFinite(envThreshold) ? envThreshold : 70;
802
+ }
803
+
804
+ /**
805
+ * Evaluate delivery confidence gate.
806
+ * @private
807
+ */
808
+ _evaluateConfidenceGate(deliveryConfidence) {
809
+ if (!this.options.enableConfidenceGate) {
810
+ return { enabled: false, threshold: this.options.confidenceThreshold, passed: true };
811
+ }
812
+
813
+ if (!deliveryConfidence || !Number.isFinite(deliveryConfidence.score)) {
814
+ return {
815
+ enabled: true,
816
+ threshold: this.options.confidenceThreshold,
817
+ passed: false,
818
+ reason: 'delivery_confidence_unavailable',
819
+ };
820
+ }
821
+
822
+ const passed = deliveryConfidence.score >= this.options.confidenceThreshold;
823
+ return {
824
+ enabled: true,
825
+ threshold: this.options.confidenceThreshold,
826
+ score: deliveryConfidence.score,
827
+ passed,
720
828
  };
721
829
  }
722
830