scai 0.1.125 → 0.1.126

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.
@@ -18,44 +18,38 @@ export const finalPlanGenStep = {
18
18
  context.analysis || (context.analysis = {});
19
19
  (_a = context.analysis).planSuggestion || (_a.planSuggestion = {});
20
20
  (_b = context.analysis.planSuggestion).plan || (_b.plan = { steps: [] });
21
- // Restrict actions to FINALIZE group only
21
+ // Only allow actions in the FINALIZE group
22
22
  const effectiveActions = PLAN_ACTIONS.filter(a => a.groups?.includes('finalize'));
23
23
  const actionsJson = JSON.stringify(effectiveActions, null, 2);
24
24
  const intentText = context.analysis.intent?.normalizedQuery ?? '';
25
25
  const intentCategory = context.analysis.intent?.intentCategory ?? '';
26
+ // Simplified prompt — focus purely on allowed finalization actions
26
27
  const prompt = `
27
28
  You are an autonomous coding agent.
28
- Your task is to produce a structured plan describing finalization steps
29
- to wrap up work, commit changes, or produce outputs safely.
29
+
30
+ Your task is to produce a JSON plan for the FINALIZATION phase only.
31
+ Each step should describe a module to run to finalize the workflow and produce a response to the user.
30
32
 
31
33
  Intent / task description:
32
34
  ${intentText}
33
35
 
34
- If the intent indicates that no finalization is required, return an empty plan object with an empty "steps" array:
35
- { "steps": [] }
36
-
37
- Allowed actions (finalize only):
38
- ${actionsJson}
39
-
40
36
  Task category:
41
37
  ${intentCategory}
42
38
 
43
- Folder structure:
44
- ${context.analysis.folderCapsulesHuman ?? ''}
45
-
46
- Existing relevant files:
47
- ${JSON.stringify(context.analysis.focus?.relevantFiles ?? {}, null, 2)}
48
-
49
- ⚡ Phase guidance:
50
- - Actions are grouped into phases: info, transform, finalize.
51
- - Only include finalize steps in this phase.
52
- - Each step must include: "action", "targetFile" (optional), "description", "metadata"
39
+ Allowed actions (finalize only):
40
+ ${actionsJson}
53
41
 
54
- Return a strictly valid JSON plan:
42
+ Important instructions:
43
+ - Only use actions listed in the allowed actions.
44
+ - Every plan must produce a user-facing response.
45
+ - Each step must include: "action", "targetFile" (optional), "description", "metadata".
46
+ - Do NOT invent new actions.
47
+ - Return strictly valid JSON.
55
48
 
49
+ Example format:
56
50
  {
57
51
  "steps": [
58
- { "action": "stepName", "targetFile": "optional/path.ts", "description": "explanation", "metadata": {} }
52
+ { "action": "finalAnswer", "targetFile": null, "description": "Generate final user-facing response.", "metadata": {} }
59
53
  ]
60
54
  }
61
55
  `.trim();
@@ -86,11 +80,11 @@ Return a strictly valid JSON plan:
86
80
  groups: actionDef?.groups ?? ['finalize']
87
81
  };
88
82
  });
89
- // Ensure at least one summary step if plan is empty
90
- if (plan.steps.length === 0) {
83
+ // Ensure at least one finalAnswer step if plan is empty
84
+ if (!plan.steps.some(s => s.action === 'finalAnswer')) {
91
85
  plan.steps.push({
92
- action: 'finalizeSummary',
93
- description: 'Summarize what actions were taken and provide a response to the user.',
86
+ action: 'finalAnswer',
87
+ description: 'Generate final user-facing response summarizing results.',
94
88
  metadata: {
95
89
  routingConfidence: context.analysis?.routingDecision?.confidence ?? 0
96
90
  },
@@ -106,10 +100,11 @@ Return a strictly valid JSON plan:
106
100
  }
107
101
  catch (err) {
108
102
  console.warn('⚠️ Failed to generate final plan:', err);
103
+ // Fallback: always include finalAnswer
109
104
  context.analysis.planSuggestion.plan.steps = [
110
105
  {
111
- action: 'finalizeSummary',
112
- description: 'Summarize what actions were taken and provide a response to the user.',
106
+ action: 'finalAnswer',
107
+ description: 'Generate final user-facing response summarizing results.',
113
108
  metadata: {
114
109
  routingConfidence: context.analysis?.routingDecision?.confidence ?? 0
115
110
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scai",
3
- "version": "0.1.125",
3
+ "version": "0.1.126",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "scai": "./dist/index.js"