astrocode-workflow 0.1.27 → 0.1.29
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/index.js
CHANGED
|
@@ -7,7 +7,6 @@ import { createContinuationEnforcer } from "./hooks/continuation-enforcer";
|
|
|
7
7
|
import { createToolOutputTruncatorHook } from "./hooks/tool-output-truncator";
|
|
8
8
|
import { createToastManager } from "./ui/toasts";
|
|
9
9
|
import { createAstroAgents } from "./agents/registry";
|
|
10
|
-
console.log("Astrocode plugin loading...");
|
|
11
10
|
const Astrocode = async (ctx) => {
|
|
12
11
|
const repoRoot = ctx.directory;
|
|
13
12
|
// Always load config first - this provides defaults even in limited mode
|
package/dist/tools/workflow.js
CHANGED
|
@@ -154,23 +154,18 @@ export function createAstroWorkflowProceedTool(opts) {
|
|
|
154
154
|
const story = db.prepare("SELECT * FROM stories WHERE story_key=?").get(run.story_key);
|
|
155
155
|
// Mark stage started + set subagent_type to the stage agent.
|
|
156
156
|
let agentName = resolveAgentName(next.stage_key, config);
|
|
157
|
-
console.log(`[Astrocode] Resolving agent for ${next.stage_key}: ${agentName}`);
|
|
158
|
-
console.log(`[Astrocode] Available agents:`, Object.keys(config.agent || {}));
|
|
159
157
|
// Validate agent availability with fallback chain
|
|
160
158
|
const systemConfig = config;
|
|
161
159
|
// Check both the system config agent map (if present) OR the local agents map passed to the tool
|
|
162
160
|
const agentExists = (name) => {
|
|
163
161
|
// Check local agents map first (populated from src/index.ts)
|
|
164
162
|
if (agents && agents[name]) {
|
|
165
|
-
console.log(`[Astrocode] Found agent ${name} in local agents map`);
|
|
166
163
|
return true;
|
|
167
164
|
}
|
|
168
165
|
// Check system config agent map
|
|
169
166
|
if (systemConfig.agent && systemConfig.agent[name]) {
|
|
170
|
-
console.log(`[Astrocode] Found agent ${name} in systemConfig.agent`);
|
|
171
167
|
return true;
|
|
172
168
|
}
|
|
173
|
-
console.log(`[Astrocode] Agent ${name} NOT found in local map (keys: ${Object.keys(agents || {}).join(",")}) or systemConfig`);
|
|
174
169
|
return false;
|
|
175
170
|
};
|
|
176
171
|
if (!agentExists(agentName)) {
|
|
@@ -182,7 +177,6 @@ export function createAstroWorkflowProceedTool(opts) {
|
|
|
182
177
|
throw new Error(`Critical: No agents available for delegation. Primary: ${resolveAgentName(next.stage_key, config)}, Orchestrator: ${agentName}`);
|
|
183
178
|
}
|
|
184
179
|
}
|
|
185
|
-
console.log(`[Astrocode] Delegating stage ${next.stage_key} to agent: ${agentName}`);
|
|
186
180
|
withTx(db, () => {
|
|
187
181
|
startStage(db, active.run_id, next.stage_key, { subagent_type: agentName });
|
|
188
182
|
});
|
|
@@ -48,7 +48,7 @@ export function decideNextAction(db, config) {
|
|
|
48
48
|
}
|
|
49
49
|
function isInitialStory(db, storyKey) {
|
|
50
50
|
// Check if this story has no parent relations (is top-level)
|
|
51
|
-
const relations = db.prepare("SELECT COUNT(*) as count FROM story_relations WHERE
|
|
51
|
+
const relations = db.prepare("SELECT COUNT(*) as count FROM story_relations WHERE child_story_key=?").get(storyKey);
|
|
52
52
|
return relations.count === 0;
|
|
53
53
|
}
|
|
54
54
|
export function createRunForStory(db, config, storyKey) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,8 +10,6 @@ import { createToastManager } from "./ui/toasts";
|
|
|
10
10
|
import { createAstroAgents } from "./agents/registry";
|
|
11
11
|
import { info, warn } from "./shared/log";
|
|
12
12
|
|
|
13
|
-
console.log("Astrocode plugin loading...");
|
|
14
|
-
|
|
15
13
|
const Astrocode: Plugin = async (ctx) => {
|
|
16
14
|
const repoRoot = ctx.directory as string;
|
|
17
15
|
|
package/src/tools/workflow.ts
CHANGED
|
@@ -192,24 +192,18 @@ export function createAstroWorkflowProceedTool(opts: { ctx: any; config: Astroco
|
|
|
192
192
|
// Mark stage started + set subagent_type to the stage agent.
|
|
193
193
|
let agentName = resolveAgentName(next.stage_key, config);
|
|
194
194
|
|
|
195
|
-
console.log(`[Astrocode] Resolving agent for ${next.stage_key}: ${agentName}`);
|
|
196
|
-
console.log(`[Astrocode] Available agents:`, Object.keys((config as any).agent || {}));
|
|
197
|
-
|
|
198
195
|
// Validate agent availability with fallback chain
|
|
199
196
|
const systemConfig = config as any;
|
|
200
197
|
// Check both the system config agent map (if present) OR the local agents map passed to the tool
|
|
201
198
|
const agentExists = (name: string) => {
|
|
202
199
|
// Check local agents map first (populated from src/index.ts)
|
|
203
200
|
if (agents && agents[name]) {
|
|
204
|
-
console.log(`[Astrocode] Found agent ${name} in local agents map`);
|
|
205
201
|
return true;
|
|
206
202
|
}
|
|
207
203
|
// Check system config agent map
|
|
208
204
|
if (systemConfig.agent && systemConfig.agent[name]) {
|
|
209
|
-
console.log(`[Astrocode] Found agent ${name} in systemConfig.agent`);
|
|
210
205
|
return true;
|
|
211
206
|
}
|
|
212
|
-
console.log(`[Astrocode] Agent ${name} NOT found in local map (keys: ${Object.keys(agents || {}).join(",")}) or systemConfig`);
|
|
213
207
|
return false;
|
|
214
208
|
};
|
|
215
209
|
|
|
@@ -223,8 +217,6 @@ export function createAstroWorkflowProceedTool(opts: { ctx: any; config: Astroco
|
|
|
223
217
|
}
|
|
224
218
|
}
|
|
225
219
|
|
|
226
|
-
console.log(`[Astrocode] Delegating stage ${next.stage_key} to agent: ${agentName}`);
|
|
227
|
-
|
|
228
220
|
withTx(db, () => {
|
|
229
221
|
startStage(db, active.run_id, next.stage_key, { subagent_type: agentName });
|
|
230
222
|
});
|
|
@@ -76,7 +76,7 @@ export function decideNextAction(db: SqliteDb, config: AstrocodeConfig): NextAct
|
|
|
76
76
|
|
|
77
77
|
function isInitialStory(db: SqliteDb, storyKey: string): boolean {
|
|
78
78
|
// Check if this story has no parent relations (is top-level)
|
|
79
|
-
const relations = db.prepare("SELECT COUNT(*) as count FROM story_relations WHERE
|
|
79
|
+
const relations = db.prepare("SELECT COUNT(*) as count FROM story_relations WHERE child_story_key=?").get(storyKey) as { count: number };
|
|
80
80
|
return relations.count === 0;
|
|
81
81
|
}
|
|
82
82
|
|