astrocode-workflow 0.1.3 → 0.1.4
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/tools/workflow.js +22 -1
- package/package.json +2 -2
- package/src/tools/workflow.ts +28 -2
package/dist/tools/workflow.js
CHANGED
|
@@ -7,6 +7,19 @@ import { injectChatPrompt } from "../ui/inject";
|
|
|
7
7
|
import { nowISO } from "../shared/time";
|
|
8
8
|
import { newEventId } from "../state/ids";
|
|
9
9
|
import { createToastManager } from "../ui/toasts";
|
|
10
|
+
// Agent name mapping for case-sensitive resolution
|
|
11
|
+
const STAGE_TO_AGENT_MAP = {
|
|
12
|
+
frame: "Frame",
|
|
13
|
+
plan: "Plan",
|
|
14
|
+
spec: "Spec",
|
|
15
|
+
implement: "Implement",
|
|
16
|
+
review: "Review",
|
|
17
|
+
verify: "Verify",
|
|
18
|
+
close: "Close"
|
|
19
|
+
};
|
|
20
|
+
function resolveAgentName(stageKey) {
|
|
21
|
+
return STAGE_TO_AGENT_MAP[stageKey] || "General";
|
|
22
|
+
}
|
|
10
23
|
function stageGoal(stage, cfg) {
|
|
11
24
|
switch (stage) {
|
|
12
25
|
case "frame":
|
|
@@ -111,7 +124,15 @@ export function createAstroWorkflowProceedTool(opts) {
|
|
|
111
124
|
const run = db.prepare("SELECT * FROM runs WHERE run_id=?").get(active.run_id);
|
|
112
125
|
const story = db.prepare("SELECT * FROM stories WHERE story_key=?").get(run.story_key);
|
|
113
126
|
// Mark stage started + set subagent_type to the stage agent.
|
|
114
|
-
|
|
127
|
+
let agentName = resolveAgentName(next.stage_key);
|
|
128
|
+
// Validate agent availability (check system config for registered agents)
|
|
129
|
+
const systemConfig = ctx.config; // OpenCode's system config
|
|
130
|
+
if (!systemConfig.agent || !systemConfig.agent[agentName]) {
|
|
131
|
+
console.warn(`Agent ${agentName} not found in system config. Available agents:`, Object.keys(systemConfig.agent || {}));
|
|
132
|
+
// Fallback to General
|
|
133
|
+
agentName = "General";
|
|
134
|
+
}
|
|
135
|
+
console.log(`Delegating stage ${next.stage_key} to agent: ${agentName}`);
|
|
115
136
|
withTx(db, () => {
|
|
116
137
|
startStage(db, active.run_id, next.stage_key, { subagent_type: agentName });
|
|
117
138
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astrocode-workflow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@opencode-ai/plugin": "^1.1.19",
|
|
20
20
|
"@opencode-ai/sdk": "^1.1.19",
|
|
21
|
-
"astrocode-workflow": "^0.1.
|
|
21
|
+
"astrocode-workflow": "^0.1.2",
|
|
22
22
|
"jsonc-parser": "^3.2.0",
|
|
23
23
|
"zod": "4.1.8"
|
|
24
24
|
},
|
package/src/tools/workflow.ts
CHANGED
|
@@ -11,6 +11,21 @@ import { nowISO } from "../shared/time";
|
|
|
11
11
|
import { newEventId } from "../state/ids";
|
|
12
12
|
import { createToastManager } from "../ui/toasts";
|
|
13
13
|
|
|
14
|
+
// Agent name mapping for case-sensitive resolution
|
|
15
|
+
const STAGE_TO_AGENT_MAP: Record<string, string> = {
|
|
16
|
+
frame: "Frame",
|
|
17
|
+
plan: "Plan",
|
|
18
|
+
spec: "Spec",
|
|
19
|
+
implement: "Implement",
|
|
20
|
+
review: "Review",
|
|
21
|
+
verify: "Verify",
|
|
22
|
+
close: "Close"
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function resolveAgentName(stageKey: string): string {
|
|
26
|
+
return STAGE_TO_AGENT_MAP[stageKey] || "General";
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
function stageGoal(stage: StageKey, cfg: AstrocodeConfig): string {
|
|
15
30
|
switch (stage) {
|
|
16
31
|
case "frame":
|
|
@@ -135,8 +150,19 @@ export function createAstroWorkflowProceedTool(opts: { ctx: any; config: Astroco
|
|
|
135
150
|
const run = db.prepare("SELECT * FROM runs WHERE run_id=?").get(active.run_id) as any;
|
|
136
151
|
const story = db.prepare("SELECT * FROM stories WHERE story_key=?").get(run.story_key) as any;
|
|
137
152
|
|
|
138
|
-
|
|
139
|
-
|
|
153
|
+
// Mark stage started + set subagent_type to the stage agent.
|
|
154
|
+
let agentName = resolveAgentName(next.stage_key);
|
|
155
|
+
|
|
156
|
+
// Validate agent availability (check system config for registered agents)
|
|
157
|
+
const systemConfig = ctx.config; // OpenCode's system config
|
|
158
|
+
if (!systemConfig.agent || !systemConfig.agent[agentName]) {
|
|
159
|
+
console.warn(`Agent ${agentName} not found in system config. Available agents:`, Object.keys(systemConfig.agent || {}));
|
|
160
|
+
// Fallback to General
|
|
161
|
+
agentName = "General";
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
console.log(`Delegating stage ${next.stage_key} to agent: ${agentName}`);
|
|
165
|
+
|
|
140
166
|
withTx(db, () => {
|
|
141
167
|
startStage(db, active.run_id, next.stage_key, { subagent_type: agentName });
|
|
142
168
|
});
|