astrocode-workflow 0.1.42 → 0.1.48
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/agents/prompts.d.ts +1 -1
- package/dist/agents/prompts.js +14 -13
- package/dist/hooks/continuation-enforcer.js +2 -2
- package/dist/tools/workflow.js +7 -7
- package/dist/ui/inject.js +13 -1
- package/package.json +1 -1
- package/src/agents/prompts.ts +14 -13
- package/src/hooks/continuation-enforcer.ts +2 -2
- package/src/tools/workflow.ts +7 -7
- package/src/ui/inject.ts +14 -1
package/dist/agents/prompts.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const BASE_ORCH_PROMPT = "You are Astro (Orchestrator) for Astrocode.\n\
|
|
1
|
+
export declare const BASE_ORCH_PROMPT = "You are Astro (Orchestrator) for Astrocode.\n\n Mission:\n - Advance a deterministic pipeline: frame \u2192 plan \u2192 spec \u2192 implement \u2192 review \u2192 verify \u2192 close.\n - The SQLite DB is the source of truth. Prefer tools over prose.\n - Never narrate what prompts you received.\n - Keep outputs short; store large outputs as artifacts and reference paths.\n\n Operating rules:\n - Only start new runs when the user explicitly requests implementation, workflow management, or story processing.\n - Answer questions directly when possible without starting workflows.\n - Prefer calling astro_workflow_proceed (step/loop) and astro_status only when actively managing a workflow.\n - Delegate stage work only to the stage subagent matching the current stage.\n - If a stage subagent returns status=blocked, inject the BLOCKED directive and stop.\n - Follow [SYSTEM DIRECTIVE: ASTROCODE \u2014 CONTINUE] by calling astro_workflow_proceed(mode=\"step\", max_steps=1).\n - Never delegate from subagents (enforced by permissions).\n - Be discretionary: assess if the user's request requires workflow initiation or just information.\n";
|
|
2
2
|
export declare const BASE_STAGE_PROMPT = "You are an Astro stage subagent.\n\n***CRITICAL: Follow the latest [SYSTEM DIRECTIVE: ASTROCODE \u2014 STAGE_*] you receive EXACTLY.***\n\nYour output MUST be in this EXACT format:\n\n1) First, a short summary paragraph (1-3 sentences).\n\n2) Then, immediately after, the ASTRO JSON between markers:\n\n<!-- ASTRO_JSON_BEGIN -->\n{\n \"stage_key\": \"CURRENT_STAGE\",\n \"status\": \"ok\",\n \"summary\": \"Brief summary of work done\",\n \"tasks\": [],\n \"files\": [],\n \"questions\": []\n}\n<!-- ASTRO_JSON_END -->\n\nMANDATORY:\n- stage_key must be \"CURRENT_STAGE\"\n- status must be \"ok\", \"blocked\", or \"failed\"\n- summary must be a non-empty string\n- tasks, files, questions must be ARRAYS (use [] for empty)\n- JSON must be valid syntax\n- Use exact markers shown above\n\nARRAY FORMAT EXAMPLES:\n- tasks: [{\"title\": \"Task name\", \"complexity\": 3}]\n- files: [{\"path\": \"file.js\", \"kind\": \"file\"}]\n- questions: [\"What framework to use?\"]\n\nEXAMPLE OUTPUT:\nI analyzed the requirements and identified key components for implementation.\n\n<!-- ASTRO_JSON_BEGIN -->\n{\n \"stage_key\": \"plan\",\n \"status\": \"ok\",\n \"summary\": \"Created implementation plan with 5 main tasks\",\n \"tasks\": [\n {\"title\": \"Setup database\", \"complexity\": 3},\n {\"title\": \"Build API endpoints\", \"complexity\": 5}\n ],\n \"files\": [\n {\"path\": \"schema.prisma\", \"kind\": \"file\"}\n ],\n \"questions\": []\n}\n<!-- ASTRO_JSON_END -->\n\nIf blocked, set status=\"blocked\" and add ONE question to questions array. Do not deviate from this format.\n";
|
package/dist/agents/prompts.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export const BASE_ORCH_PROMPT = `You are Astro (Orchestrator) for Astrocode.
|
|
2
2
|
|
|
3
|
-
Mission:
|
|
4
|
-
- Advance a deterministic pipeline: frame → plan → spec → implement → review → verify → close.
|
|
5
|
-
- The SQLite DB is the source of truth. Prefer tools over prose.
|
|
6
|
-
- Never narrate what prompts you received.
|
|
7
|
-
- Keep outputs short; store large outputs as artifacts and reference paths.
|
|
3
|
+
Mission:
|
|
4
|
+
- Advance a deterministic pipeline: frame → plan → spec → implement → review → verify → close.
|
|
5
|
+
- The SQLite DB is the source of truth. Prefer tools over prose.
|
|
6
|
+
- Never narrate what prompts you received.
|
|
7
|
+
- Keep outputs short; store large outputs as artifacts and reference paths.
|
|
8
8
|
|
|
9
|
-
Operating rules:
|
|
10
|
-
- Only start new runs when the user explicitly requests implementation, workflow management, or story processing.
|
|
11
|
-
- Answer questions directly when possible without starting workflows.
|
|
12
|
-
- Prefer calling astro_workflow_proceed (step/loop) and astro_status only when actively managing a workflow.
|
|
13
|
-
- Delegate stage work only to the stage subagent matching the current stage.
|
|
14
|
-
- If a stage subagent returns status=blocked, inject the BLOCKED directive and stop.
|
|
15
|
-
-
|
|
16
|
-
-
|
|
9
|
+
Operating rules:
|
|
10
|
+
- Only start new runs when the user explicitly requests implementation, workflow management, or story processing.
|
|
11
|
+
- Answer questions directly when possible without starting workflows.
|
|
12
|
+
- Prefer calling astro_workflow_proceed (step/loop) and astro_status only when actively managing a workflow.
|
|
13
|
+
- Delegate stage work only to the stage subagent matching the current stage.
|
|
14
|
+
- If a stage subagent returns status=blocked, inject the BLOCKED directive and stop.
|
|
15
|
+
- Follow [SYSTEM DIRECTIVE: ASTROCODE — CONTINUE] by calling astro_workflow_proceed(mode="step", max_steps=1).
|
|
16
|
+
- Never delegate from subagents (enforced by permissions).
|
|
17
|
+
- Be discretionary: assess if the user's request requires workflow initiation or just information.
|
|
17
18
|
`;
|
|
18
19
|
export const BASE_STAGE_PROMPT = `You are an Astro stage subagent.
|
|
19
20
|
|
|
@@ -51,8 +51,8 @@ export function createContinuationEnforcer(opts) {
|
|
|
51
51
|
clearPeriodicTimer(sessionId);
|
|
52
52
|
if (!config.continuation.enabled)
|
|
53
53
|
return;
|
|
54
|
-
// Inject every
|
|
55
|
-
const interval =
|
|
54
|
+
// Inject every 3 minutes (180,000 ms)
|
|
55
|
+
const interval = 3 * 60 * 1000;
|
|
56
56
|
const s = getState(sessionId);
|
|
57
57
|
s.periodicTimer = setInterval(() => {
|
|
58
58
|
// Fire and forget
|
package/dist/tools/workflow.js
CHANGED
|
@@ -10,13 +10,13 @@ import { debug } from "../shared/log";
|
|
|
10
10
|
import { createToastManager } from "../ui/toasts";
|
|
11
11
|
// Agent name mapping for case-sensitive resolution
|
|
12
12
|
const STAGE_TO_AGENT_MAP = {
|
|
13
|
-
frame: "
|
|
14
|
-
plan: "
|
|
15
|
-
spec: "
|
|
16
|
-
implement: "
|
|
17
|
-
review: "
|
|
18
|
-
verify: "
|
|
19
|
-
close: "
|
|
13
|
+
frame: "explore", // Research and analysis for requirements
|
|
14
|
+
plan: "general", // General planning and decomposition
|
|
15
|
+
spec: "Librarian", // Documentation and specification
|
|
16
|
+
implement: "general", // General implementation
|
|
17
|
+
review: "general", // General review
|
|
18
|
+
verify: "general", // General verification
|
|
19
|
+
close: "general" // General closure
|
|
20
20
|
};
|
|
21
21
|
function resolveAgentName(stageKey, config) {
|
|
22
22
|
// Use configurable agent names from config, fallback to hardcoded map, then General
|
package/dist/ui/inject.js
CHANGED
|
@@ -11,6 +11,15 @@ export async function injectChatPrompt(opts) {
|
|
|
11
11
|
}
|
|
12
12
|
isInjecting = true;
|
|
13
13
|
try {
|
|
14
|
+
// Basic validation
|
|
15
|
+
if (!sessionId) {
|
|
16
|
+
console.warn("[Astrocode] Skipping injection: No sessionId provided");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!ctx?.client?.session?.prompt) {
|
|
20
|
+
console.warn("[Astrocode] Skipping injection: API not available (ctx.client.session.prompt)");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
14
23
|
await ctx.client.session.prompt({
|
|
15
24
|
path: { id: sessionId },
|
|
16
25
|
body: {
|
|
@@ -20,6 +29,9 @@ export async function injectChatPrompt(opts) {
|
|
|
20
29
|
},
|
|
21
30
|
});
|
|
22
31
|
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.warn(`[Astrocode] Injection failed: ${error}`);
|
|
34
|
+
}
|
|
23
35
|
finally {
|
|
24
36
|
isInjecting = false;
|
|
25
37
|
// Process queued injection if any
|
|
@@ -27,7 +39,7 @@ export async function injectChatPrompt(opts) {
|
|
|
27
39
|
const next = queuedInjection;
|
|
28
40
|
queuedInjection = null;
|
|
29
41
|
// Schedule next injection asynchronously to prevent recursion
|
|
30
|
-
setImmediate(() => injectChatPrompt({ ...
|
|
42
|
+
setImmediate(() => injectChatPrompt({ ...next, text: prefixedText, agent }));
|
|
31
43
|
}
|
|
32
44
|
}
|
|
33
45
|
}
|
package/package.json
CHANGED
package/src/agents/prompts.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export const BASE_ORCH_PROMPT = `You are Astro (Orchestrator) for Astrocode.
|
|
2
2
|
|
|
3
|
-
Mission:
|
|
4
|
-
- Advance a deterministic pipeline: frame → plan → spec → implement → review → verify → close.
|
|
5
|
-
- The SQLite DB is the source of truth. Prefer tools over prose.
|
|
6
|
-
- Never narrate what prompts you received.
|
|
7
|
-
- Keep outputs short; store large outputs as artifacts and reference paths.
|
|
3
|
+
Mission:
|
|
4
|
+
- Advance a deterministic pipeline: frame → plan → spec → implement → review → verify → close.
|
|
5
|
+
- The SQLite DB is the source of truth. Prefer tools over prose.
|
|
6
|
+
- Never narrate what prompts you received.
|
|
7
|
+
- Keep outputs short; store large outputs as artifacts and reference paths.
|
|
8
8
|
|
|
9
|
-
Operating rules:
|
|
10
|
-
- Only start new runs when the user explicitly requests implementation, workflow management, or story processing.
|
|
11
|
-
- Answer questions directly when possible without starting workflows.
|
|
12
|
-
- Prefer calling astro_workflow_proceed (step/loop) and astro_status only when actively managing a workflow.
|
|
13
|
-
- Delegate stage work only to the stage subagent matching the current stage.
|
|
14
|
-
- If a stage subagent returns status=blocked, inject the BLOCKED directive and stop.
|
|
15
|
-
-
|
|
16
|
-
-
|
|
9
|
+
Operating rules:
|
|
10
|
+
- Only start new runs when the user explicitly requests implementation, workflow management, or story processing.
|
|
11
|
+
- Answer questions directly when possible without starting workflows.
|
|
12
|
+
- Prefer calling astro_workflow_proceed (step/loop) and astro_status only when actively managing a workflow.
|
|
13
|
+
- Delegate stage work only to the stage subagent matching the current stage.
|
|
14
|
+
- If a stage subagent returns status=blocked, inject the BLOCKED directive and stop.
|
|
15
|
+
- Follow [SYSTEM DIRECTIVE: ASTROCODE — CONTINUE] by calling astro_workflow_proceed(mode="step", max_steps=1).
|
|
16
|
+
- Never delegate from subagents (enforced by permissions).
|
|
17
|
+
- Be discretionary: assess if the user's request requires workflow initiation or just information.
|
|
17
18
|
`;
|
|
18
19
|
|
|
19
20
|
export const BASE_STAGE_PROMPT = `You are an Astro stage subagent.
|
|
@@ -88,8 +88,8 @@ export function createContinuationEnforcer(opts: {
|
|
|
88
88
|
clearPeriodicTimer(sessionId);
|
|
89
89
|
if (!config.continuation.enabled) return;
|
|
90
90
|
|
|
91
|
-
// Inject every
|
|
92
|
-
const interval =
|
|
91
|
+
// Inject every 3 minutes (180,000 ms)
|
|
92
|
+
const interval = 3 * 60 * 1000;
|
|
93
93
|
|
|
94
94
|
const s = getState(sessionId);
|
|
95
95
|
s.periodicTimer = setInterval(() => {
|
package/src/tools/workflow.ts
CHANGED
|
@@ -14,13 +14,13 @@ import { createToastManager } from "../ui/toasts";
|
|
|
14
14
|
|
|
15
15
|
// Agent name mapping for case-sensitive resolution
|
|
16
16
|
const STAGE_TO_AGENT_MAP: Record<string, string> = {
|
|
17
|
-
frame: "
|
|
18
|
-
plan: "
|
|
19
|
-
spec: "
|
|
20
|
-
implement: "
|
|
21
|
-
review: "
|
|
22
|
-
verify: "
|
|
23
|
-
close: "
|
|
17
|
+
frame: "explore", // Research and analysis for requirements
|
|
18
|
+
plan: "general", // General planning and decomposition
|
|
19
|
+
spec: "Librarian", // Documentation and specification
|
|
20
|
+
implement: "general", // General implementation
|
|
21
|
+
review: "general", // General review
|
|
22
|
+
verify: "general", // General verification
|
|
23
|
+
close: "general" // General closure
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
function resolveAgentName(stageKey: StageKey, config: AstrocodeConfig): string {
|
package/src/ui/inject.ts
CHANGED
|
@@ -21,6 +21,17 @@ export async function injectChatPrompt(opts: {
|
|
|
21
21
|
isInjecting = true;
|
|
22
22
|
|
|
23
23
|
try {
|
|
24
|
+
// Basic validation
|
|
25
|
+
if (!sessionId) {
|
|
26
|
+
console.warn("[Astrocode] Skipping injection: No sessionId provided");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!ctx?.client?.session?.prompt) {
|
|
31
|
+
console.warn("[Astrocode] Skipping injection: API not available (ctx.client.session.prompt)");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
24
35
|
await ctx.client.session.prompt({
|
|
25
36
|
path: { id: sessionId },
|
|
26
37
|
body: {
|
|
@@ -29,6 +40,8 @@ export async function injectChatPrompt(opts: {
|
|
|
29
40
|
agent: agent,
|
|
30
41
|
},
|
|
31
42
|
});
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.warn(`[Astrocode] Injection failed: ${error}`);
|
|
32
45
|
} finally {
|
|
33
46
|
isInjecting = false;
|
|
34
47
|
// Process queued injection if any
|
|
@@ -36,7 +49,7 @@ export async function injectChatPrompt(opts: {
|
|
|
36
49
|
const next = queuedInjection;
|
|
37
50
|
queuedInjection = null;
|
|
38
51
|
// Schedule next injection asynchronously to prevent recursion
|
|
39
|
-
setImmediate(() => injectChatPrompt({ ...
|
|
52
|
+
setImmediate(() => injectChatPrompt({ ...next, text: prefixedText, agent }));
|
|
40
53
|
}
|
|
41
54
|
}
|
|
42
55
|
}
|