sinapse-ai 1.19.0 → 1.19.2
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/.sinapse-ai/core/execution/build-orchestrator.js +31 -0
- package/.sinapse-ai/core/orchestration/bob-orchestrator.js +2 -4
- package/.sinapse-ai/core/orchestration/executors/epic-4-executor.js +57 -40
- package/.sinapse-ai/core/orchestration/gate-evaluator.js +124 -3
- package/.sinapse-ai/core/orchestration/greenfield-handler.js +14 -46
- package/.sinapse-ai/core/orchestration/index.js +0 -12
- package/.sinapse-ai/core/orchestration/master-orchestrator.js +60 -4
- package/.sinapse-ai/core/orchestration/workflow-executor.js +8 -150
- package/.sinapse-ai/data/entity-registry.yaml +315 -527
- package/.sinapse-ai/development/agents/project-lead/MEMORY.md +1 -1
- package/.sinapse-ai/development/agents/project-lead.md +9 -13
- package/.sinapse-ai/development/tasks/push-and-pr.md +1 -1
- package/.sinapse-ai/development/workflows/development-cycle.yaml +1 -12
- package/.sinapse-ai/install-manifest.yaml +26 -34
- package/CHANGELOG.md +41 -26
- package/package.json +1 -1
- package/.sinapse-ai/core/orchestration/terminal-spawner.js +0 -1067
- package/.sinapse-ai/scripts/pm.sh +0 -466
|
@@ -23,9 +23,8 @@ const fsSync = require('fs');
|
|
|
23
23
|
const path = require('path');
|
|
24
24
|
const yaml = require('js-yaml');
|
|
25
25
|
|
|
26
|
-
// Import dependencies from Story 11.1
|
|
26
|
+
// Import dependencies from Story 11.1 and 11.5
|
|
27
27
|
const ExecutorAssignment = require('./executor-assignment');
|
|
28
|
-
const TerminalSpawner = require('./terminal-spawner');
|
|
29
28
|
const { SessionState, ActionType } = require('./session-state');
|
|
30
29
|
|
|
31
30
|
// IDS Gate Wiring: GateEvaluator wires the IDS verification gates into the
|
|
@@ -43,29 +42,6 @@ const DEFAULT_TIMEOUT_MS = 7200000; // 2 hours
|
|
|
43
42
|
const CHECKPOINT_TIMEOUT_MS = 1800000; // 30 minutes
|
|
44
43
|
const STATE_SAVE_INTERVAL_MS = 300000; // 5 minutes
|
|
45
44
|
|
|
46
|
-
/**
|
|
47
|
-
* Determines whether a REAL visual-terminal spawn can occur in the current environment.
|
|
48
|
-
*
|
|
49
|
-
* Combines the platform-support signal (`isSpawnerAvailable()`) with the stricter
|
|
50
|
-
* real-terminal signal (`detectEnvironment().supportsVisualTerminal`). The latter returns
|
|
51
|
-
* `false` in headless contexts (CI / SSH / Docker / VS Code integrated terminal) and `true`
|
|
52
|
-
* only in a native terminal. Without this second check, `isSpawnerAvailable()` alone returns
|
|
53
|
-
* `true` on CI / Windows-without-bash, causing `spawn('bash', [pm.sh])` to fail with ENOENT
|
|
54
|
-
* (test noise) plus a slow subprocess. When this returns `false`, phases skip the spawn and
|
|
55
|
-
* fall through to their existing "manual execution" fallback — no bash, no noise.
|
|
56
|
-
*
|
|
57
|
-
* Note: this intentionally does NOT change `TerminalSpawner.isSpawnerAvailable()` semantics
|
|
58
|
-
* (Conservative Default — Article XI); the hardening lives at the call-sites only.
|
|
59
|
-
*
|
|
60
|
-
* @returns {boolean} True only when a native visual terminal spawn is safe to attempt.
|
|
61
|
-
*/
|
|
62
|
-
function canSpawnVisualTerminal() {
|
|
63
|
-
return (
|
|
64
|
-
TerminalSpawner.isSpawnerAvailable() &&
|
|
65
|
-
TerminalSpawner.detectEnvironment().supportsVisualTerminal
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
45
|
/**
|
|
70
46
|
* Workflow phase status
|
|
71
47
|
* @enum {string}
|
|
@@ -213,25 +189,6 @@ class WorkflowExecutor {
|
|
|
213
189
|
}
|
|
214
190
|
}
|
|
215
191
|
|
|
216
|
-
/**
|
|
217
|
-
* Emits terminal spawn to all registered callbacks (Story 12.6)
|
|
218
|
-
* @param {string} agent - Agent ID
|
|
219
|
-
* @param {number} pid - Process ID
|
|
220
|
-
* @param {string} task - Task being executed
|
|
221
|
-
* @private
|
|
222
|
-
*/
|
|
223
|
-
_emitTerminalSpawn(agent, pid, task) {
|
|
224
|
-
for (const callback of this._terminalSpawnCallbacks) {
|
|
225
|
-
try {
|
|
226
|
-
callback(agent, pid, task);
|
|
227
|
-
} catch (error) {
|
|
228
|
-
if (this.options.debug) {
|
|
229
|
-
console.log(`[WorkflowExecutor] Terminal spawn callback error: ${error.message}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
192
|
/**
|
|
236
193
|
* Loads the workflow definition
|
|
237
194
|
* @returns {Promise<Object>} Workflow definition
|
|
@@ -739,39 +696,8 @@ class WorkflowExecutor {
|
|
|
739
696
|
}
|
|
740
697
|
}
|
|
741
698
|
|
|
742
|
-
//
|
|
743
|
-
|
|
744
|
-
const context = {
|
|
745
|
-
story: storyPath,
|
|
746
|
-
files: [],
|
|
747
|
-
instructions: `Execute *develop for story: ${storyPath}`,
|
|
748
|
-
metadata: this.state.accumulatedContext,
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
const result = await TerminalSpawner.spawnAgent(agent.replace('@', ''), 'develop', {
|
|
752
|
-
context,
|
|
753
|
-
timeout: DEFAULT_TIMEOUT_MS,
|
|
754
|
-
debug: this.options.debug,
|
|
755
|
-
});
|
|
756
|
-
|
|
757
|
-
// Story 12.6: Emit terminal spawn for observability (AC1)
|
|
758
|
-
if (result.pid) {
|
|
759
|
-
this._emitTerminalSpawn(agent, result.pid, 'development');
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
return {
|
|
763
|
-
status: result.success ? PhaseStatus.COMPLETED : PhaseStatus.FAILED,
|
|
764
|
-
implementation: {
|
|
765
|
-
files_created: [],
|
|
766
|
-
files_modified: [],
|
|
767
|
-
tests_added: [],
|
|
768
|
-
},
|
|
769
|
-
output: result.output,
|
|
770
|
-
outputFile: result.outputFile,
|
|
771
|
-
};
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// Fallback: Return pending for manual execution
|
|
699
|
+
// Honest fallback: the dev cycle does not invoke the agent in-process here;
|
|
700
|
+
// execution is handed off (manual) rather than fabricated by a stub.
|
|
775
701
|
return {
|
|
776
702
|
status: PhaseStatus.COMPLETED,
|
|
777
703
|
implementation: {
|
|
@@ -779,7 +705,7 @@ class WorkflowExecutor {
|
|
|
779
705
|
files_modified: [],
|
|
780
706
|
tests_added: [],
|
|
781
707
|
},
|
|
782
|
-
note: '
|
|
708
|
+
note: 'Manual execution required',
|
|
783
709
|
};
|
|
784
710
|
} catch (error) {
|
|
785
711
|
return {
|
|
@@ -1056,42 +982,7 @@ class WorkflowExecutor {
|
|
|
1056
982
|
// Story 12.6: Emit agent spawn for observability (AC1)
|
|
1057
983
|
this._emitAgentSpawn(agent, 'quality_gate');
|
|
1058
984
|
|
|
1059
|
-
//
|
|
1060
|
-
if (phase.spawn_in_terminal && canSpawnVisualTerminal()) {
|
|
1061
|
-
const context = {
|
|
1062
|
-
story: storyPath,
|
|
1063
|
-
files: [],
|
|
1064
|
-
instructions: `Execute quality review for story: ${storyPath}`,
|
|
1065
|
-
metadata: {
|
|
1066
|
-
executor: this.state.executor,
|
|
1067
|
-
implementation: this.state.phaseResults['2_development']?.implementation,
|
|
1068
|
-
},
|
|
1069
|
-
};
|
|
1070
|
-
|
|
1071
|
-
const result = await TerminalSpawner.spawnAgent(agent.replace('@', ''), 'quality-review', {
|
|
1072
|
-
context,
|
|
1073
|
-
timeout: DEFAULT_TIMEOUT_MS / 4, // 30 minutes
|
|
1074
|
-
debug: this.options.debug,
|
|
1075
|
-
});
|
|
1076
|
-
|
|
1077
|
-
// Story 12.6: Emit terminal spawn for observability (AC1)
|
|
1078
|
-
if (result.pid) {
|
|
1079
|
-
this._emitTerminalSpawn(agent, result.pid, 'quality_gate');
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
return {
|
|
1083
|
-
status: result.success ? PhaseStatus.COMPLETED : PhaseStatus.FAILED,
|
|
1084
|
-
review_result: {
|
|
1085
|
-
verdict: result.success ? 'APPROVED' : 'NEEDS_WORK',
|
|
1086
|
-
score: result.success ? 90 : 60,
|
|
1087
|
-
findings: [],
|
|
1088
|
-
recommendations: [],
|
|
1089
|
-
},
|
|
1090
|
-
output: result.output,
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
// Fallback
|
|
985
|
+
// Honest fallback: the review is handed off (manual) rather than fabricated by a stub.
|
|
1095
986
|
return {
|
|
1096
987
|
status: PhaseStatus.COMPLETED,
|
|
1097
988
|
review_result: {
|
|
@@ -1100,7 +991,7 @@ class WorkflowExecutor {
|
|
|
1100
991
|
findings: [],
|
|
1101
992
|
recommendations: [],
|
|
1102
993
|
},
|
|
1103
|
-
note: '
|
|
994
|
+
note: 'Manual review required',
|
|
1104
995
|
};
|
|
1105
996
|
} catch (error) {
|
|
1106
997
|
return {
|
|
@@ -1126,40 +1017,7 @@ class WorkflowExecutor {
|
|
|
1126
1017
|
// Story 12.6: Emit agent spawn for observability (AC1)
|
|
1127
1018
|
this._emitAgentSpawn(agent, 'push');
|
|
1128
1019
|
|
|
1129
|
-
//
|
|
1130
|
-
if (phase.spawn_in_terminal && canSpawnVisualTerminal()) {
|
|
1131
|
-
const context = {
|
|
1132
|
-
story: storyPath,
|
|
1133
|
-
files: [],
|
|
1134
|
-
instructions: `Execute *pre-push and *push for story: ${storyPath}`,
|
|
1135
|
-
metadata: {
|
|
1136
|
-
review_result: this.state.phaseResults['4_quality_gate']?.review_result,
|
|
1137
|
-
},
|
|
1138
|
-
};
|
|
1139
|
-
|
|
1140
|
-
const result = await TerminalSpawner.spawnAgent(agent.replace('@', ''), 'push-and-pr', {
|
|
1141
|
-
context,
|
|
1142
|
-
timeout: DEFAULT_TIMEOUT_MS / 12, // 10 minutes
|
|
1143
|
-
debug: this.options.debug,
|
|
1144
|
-
});
|
|
1145
|
-
|
|
1146
|
-
// Story 12.6: Emit terminal spawn for observability (AC1)
|
|
1147
|
-
if (result.pid) {
|
|
1148
|
-
this._emitTerminalSpawn(agent, result.pid, 'push');
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
return {
|
|
1152
|
-
status: result.success ? PhaseStatus.COMPLETED : PhaseStatus.FAILED,
|
|
1153
|
-
push_result: {
|
|
1154
|
-
commit_hash: '',
|
|
1155
|
-
branch: 'main',
|
|
1156
|
-
},
|
|
1157
|
-
pr_url: '',
|
|
1158
|
-
output: result.output,
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
// Fallback
|
|
1020
|
+
// Honest fallback: the push is handed off (manual) rather than fabricated by a stub.
|
|
1163
1021
|
return {
|
|
1164
1022
|
status: PhaseStatus.COMPLETED,
|
|
1165
1023
|
push_result: {
|
|
@@ -1167,7 +1025,7 @@ class WorkflowExecutor {
|
|
|
1167
1025
|
branch: 'main',
|
|
1168
1026
|
},
|
|
1169
1027
|
pr_url: '',
|
|
1170
|
-
note: '
|
|
1028
|
+
note: 'Manual push required',
|
|
1171
1029
|
};
|
|
1172
1030
|
} catch (error) {
|
|
1173
1031
|
return {
|