xforce 0.1.2 → 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/cli/index.js CHANGED
@@ -892,22 +892,31 @@ Fix the code to make the ${kind} pass. Do not commit \u2014 the pipeline handles
892
892
  // src/agents/prompts/planner-system.ts
893
893
  var PLANNER_SYSTEM_PROMPT = `You are a senior software architect analyzing a codebase to create an implementation plan.
894
894
 
895
- You have access to read-only tools: Read, Glob, and Grep. Use them to:
896
- 1. Explore the repository structure (Glob for file patterns, Read for file contents)
897
- 2. Understand existing patterns, conventions, and architecture
898
- 3. Identify the exact files that need to be modified or created
899
- 4. Analyze dependencies and potential ripple effects
895
+ You have access to read-only tools: Read, Glob, and Grep. Use them to explore the repository before planning.
900
896
 
901
- RULES:
902
- - Start by quickly checking the project structure (Glob for key file patterns). If the repo is empty or has very few files, skip deep exploration and produce your plan immediately.
903
- - Be specific about file paths \u2014 use actual paths you found in the codebase, or specify paths to create for greenfield projects.
897
+ ## TURN BUDGET \u2014 CRITICAL
898
+ You have a LIMITED number of turns. You MUST produce your JSON plan well before you run out.
899
+
900
+ - **Small/empty repos** (< 20 files): Spend 1-3 turns exploring, then output your plan.
901
+ - **Medium repos** (20-100 files): Spend 3-8 turns exploring, then output your plan.
902
+ - **Large repos** (100+ files): Spend at most 10-15 turns exploring, then output your plan.
903
+
904
+ If you are unsure whether you've explored enough, STOP EXPLORING AND OUTPUT YOUR PLAN. An incomplete plan is infinitely better than no plan at all. The coder agent will adapt.
905
+
906
+ ## EXPLORATION STRATEGY
907
+ 1. Start with a broad Glob (e.g. \`**/*.{ts,tsx,js,jsx,py}\`) to understand project size and structure.
908
+ 2. Read key files: package.json, config files, entry points.
909
+ 3. Grep for patterns relevant to the task.
910
+ 4. Stop exploring once you understand the project structure and relevant patterns.
911
+
912
+ ## PLAN QUALITY
913
+ - Be specific about file paths \u2014 use actual paths from the codebase, or specify paths to create.
904
914
  - Consider test files and their patterns.
905
915
  - Identify potential risks (breaking changes, missing test coverage, security).
906
916
  - Estimate complexity honestly.
907
917
  - Your plan should be actionable and concrete, not vague.
908
- - Do NOT spend more than a few turns exploring. Produce your JSON plan as quickly as possible.
909
918
 
910
- You MUST respond with valid JSON matching the required schema.`;
919
+ You MUST respond with valid JSON matching the required schema. Do NOT wrap it in markdown fences.`;
911
920
  function buildPlannerPrompt(taskSpec) {
912
921
  return `## Task: ${taskSpec.title}
913
922
 
@@ -1115,39 +1124,6 @@ var ImplementationPlanSchema = z2.object({
1115
1124
  implementationSteps: z2.array(ImplementationStepSchema),
1116
1125
  estimatedTurns: z2.number().int().positive()
1117
1126
  });
1118
- var PLAN_JSON_SCHEMA = {
1119
- type: "object",
1120
- properties: {
1121
- approach: { type: "string" },
1122
- filesToModify: { type: "array", items: { type: "string" } },
1123
- filesToCreate: { type: "array", items: { type: "string" } },
1124
- estimatedComplexity: { type: "string", enum: ["low", "medium", "high"] },
1125
- risks: { type: "array", items: { type: "string" } },
1126
- implementationSteps: {
1127
- type: "array",
1128
- items: {
1129
- type: "object",
1130
- properties: {
1131
- order: { type: "number" },
1132
- description: { type: "string" },
1133
- files: { type: "array", items: { type: "string" } },
1134
- rationale: { type: "string" }
1135
- },
1136
- required: ["order", "description", "files", "rationale"]
1137
- }
1138
- },
1139
- estimatedTurns: { type: "number" }
1140
- },
1141
- required: [
1142
- "approach",
1143
- "filesToModify",
1144
- "filesToCreate",
1145
- "estimatedComplexity",
1146
- "risks",
1147
- "implementationSteps",
1148
- "estimatedTurns"
1149
- ]
1150
- };
1151
1127
  function extractJSON(text) {
1152
1128
  const jsonMatch = text.match(/\{[\s\S]*\}/);
1153
1129
  if (jsonMatch) return jsonMatch[0];
@@ -1181,10 +1157,6 @@ async function runPlanningAgent(params) {
1181
1157
  permissionMode: "bypassPermissions",
1182
1158
  allowDangerouslySkipPermissions: true,
1183
1159
  systemPrompt: PLANNER_SYSTEM_PROMPT,
1184
- outputFormat: {
1185
- type: "json_schema",
1186
- schema: PLAN_JSON_SCHEMA
1187
- },
1188
1160
  stderr: (data) => {
1189
1161
  stderrOutput += data;
1190
1162
  log6.debug({ stderr: data.trimEnd() }, "Agent SDK stderr");
@@ -1229,7 +1201,8 @@ ${stderrOutput.slice(0, 2e3)}` : "";
1229
1201
  log6.debug(
1230
1202
  {
1231
1203
  subtype: resultMessage.subtype,
1232
- hasStructuredOutput: "structured_output" in resultMessage && !!resultMessage.structured_output,
1204
+ numTurns: resultMessage.num_turns,
1205
+ costUsd: resultMessage.total_cost_usd,
1233
1206
  hasResult: "result" in resultMessage && !!resultMessage.result,
1234
1207
  hasLastAssistant: !!lastAssistantText,
1235
1208
  lastAssistantLength: lastAssistantText.length