astrocode-workflow 0.1.43 → 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.
@@ -1,2 +1,2 @@
1
- export declare const BASE_ORCH_PROMPT = "You are Astro (Orchestrator) for Astrocode.\n\nMission:\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\nOperating 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- Never delegate from subagents (enforced by permissions).\n- Be discretionary: assess if the user's request requires workflow initiation or just information.\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";
@@ -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
- - Never delegate from subagents (enforced by permissions).
16
- - Be discretionary: assess if the user's request requires workflow initiation or just information.
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
 
@@ -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: "Frame",
14
- plan: "Plan",
15
- spec: "Spec",
16
- implement: "Implement",
17
- review: "Review",
18
- verify: "Verify",
19
- close: "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({ ...queuedInjection, text: prefixedText }));
42
+ setImmediate(() => injectChatPrompt({ ...next, text: prefixedText, agent }));
31
43
  }
32
44
  }
33
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astrocode-workflow",
3
- "version": "0.1.43",
3
+ "version": "0.1.48",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
- - Never delegate from subagents (enforced by permissions).
16
- - Be discretionary: assess if the user's request requires workflow initiation or just information.
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.
@@ -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: "Frame",
18
- plan: "Plan",
19
- spec: "Spec",
20
- implement: "Implement",
21
- review: "Review",
22
- verify: "Verify",
23
- close: "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({ ...queuedInjection, text: prefixedText }));
52
+ setImmediate(() => injectChatPrompt({ ...next, text: prefixedText, agent }));
40
53
  }
41
54
  }
42
55
  }