@phi-code-admin/phi-code 0.61.5 → 0.61.7

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.
@@ -274,12 +274,8 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
274
274
  }
275
275
  await writeFile(progressPath, progress, "utf-8");
276
276
 
277
- // Send the mega-prompt — LLM handles everything in current session
278
- pi.sendUserMessage(megaPrompt);
279
-
280
- notify(`šŸ“‹ ${totalTasks} tasks sent to LLM. Progress: \`${progressFile}\``, "info");
281
-
282
- return { results, progressFile };
277
+ // Return the mega-prompt as tool result — LLM sees it and executes
278
+ return { results, progressFile, megaPrompt };
283
279
  }
284
280
 
285
281
  // ─── Generate Plan Files ─────────────────────────────────────────
@@ -412,23 +408,19 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
412
408
  p.constraints?.length ? `Constraints: ${p.constraints.join("; ")}` : "",
413
409
  ].filter(Boolean).join("\n");
414
410
 
415
- const { results, progressFile } = await executePlan(
411
+ const { results, progressFile, megaPrompt } = await executePlan(
416
412
  p.tasks, todoFile, notify,
417
413
  { title: p.title, description: p.description, specSummary },
418
414
  );
419
415
 
420
- const summary = `**šŸ Project "${p.title}" — ${p.tasks.length} tasks sent!**
421
-
422
- **Plan:** \`${specFile}\`, \`${todoFile}\`
423
- **Progress:** \`${progressFile}\`
424
-
425
- **Tasks queued:**
426
- ${results.map(r => `šŸ“‹ Task ${r.taskIndex}: ${r.title} [${r.agent}]`).join("\n")}
427
-
428
- The LLM is now executing all tasks in-session.`;
416
+ const header = `**šŸ“‹ Project "${p.title}" — ${p.tasks.length} tasks planned!**\n` +
417
+ `Plan: \`${specFile}\`, \`${todoFile}\` | Progress: \`${progressFile}\`\n\n` +
418
+ `---\n\n`;
429
419
 
420
+ // Return the mega-prompt as tool result
421
+ // The LLM sees this and executes all tasks in its current turn
430
422
  return {
431
- content: [{ type: "text", text: summary }],
423
+ content: [{ type: "text", text: header + megaPrompt }],
432
424
  details: {
433
425
  specFile, todoFile, progressFile,
434
426
  taskCount: p.tasks.length,
@@ -446,67 +438,49 @@ The LLM is now executing all tasks in-session.`;
446
438
  // ─── /plan Command — Full workflow ───────────────────────────────
447
439
 
448
440
  pi.registerCommand("plan", {
449
- description: "Plan AND execute a project: creates spec + todo, then runs each task with isolated sub-agents",
441
+ description: "Plan AND execute a project — describe what to build and the LLM does it all",
450
442
  handler: async (args, ctx) => {
451
443
  const description = args.trim();
452
444
 
453
445
  if (!description) {
454
446
  ctx.ui.notify(`**Usage:** \`/plan <project description>\`
455
447
 
456
- **Full workflow in one command:**
457
- 1. LLM analyzes your description
458
- 2. Creates spec.md + todo.md
459
- 3. Executes each task with an isolated sub-agent
460
- 4. Each agent has its own context, model, and system prompt
461
- 5. Results saved to progress.md
462
-
463
448
  **Examples:**
464
449
  /plan Build a REST API for user authentication with JWT
450
+ /plan Create a cyberpunk Pong browser game
465
451
  /plan Add test coverage to the payment module
466
- /plan Refactor the frontend to use TypeScript
467
452
 
468
453
  **Other commands:**
469
- /run — Re-execute an existing plan
470
- /plans — List all plans and status`, "info");
454
+ /plans — List all plans`, "info");
471
455
  return;
472
456
  }
473
457
 
474
- pi.sendUserMessage(
475
- `Analyze this project and call the orchestrate tool. It will create the plan AND execute all tasks automatically with parallel sub-agents.
458
+ // Create plan files
459
+ await ensurePlansDir();
460
+ const ts = timestamp();
461
+ const specFile = `spec-${ts}.md`;
462
+ const todoFile = `todo-${ts}.md`;
476
463
 
477
- ## Project
478
- ${description}
479
-
480
- ## Instructions
481
-
482
- 1. **Analyze** the project: identify goals, requirements, technical constraints, and architecture decisions.
464
+ const spec = `# Project Plan\n\n**Created:** ${new Date().toLocaleString()}\n\n## Description\n\n${description}\n`;
465
+ await writeFile(join(plansDir, specFile), spec, "utf-8");
466
+ await writeFile(join(plansDir, todoFile), `# Todo\n\n(LLM will execute directly)\n`, "utf-8");
483
467
 
484
- 2. **Decompose** into tasks. Each task will be executed by an isolated sub-agent that has:
485
- - NO access to this conversation
486
- - NO shared memory or context
487
- - Its own model and system prompt
488
- - Full tool access (read, write, edit, bash, grep, find, ls)
468
+ ctx.ui.notify(`šŸ“‹ Plan created: \`${specFile}\`\nšŸš€ Executing project now...`, "info");
489
469
 
490
- 3. **Write self-contained task descriptions** using this pattern:
491
- - CONTEXT: What exists, relevant file paths, current state
492
- - TASK: Exactly what to implement/analyze/test
493
- - FORMAT: Expected output (files created, test results, etc.)
494
- - CONSTRAINTS: Rules, conventions, things to avoid
470
+ // Paste the structured prompt into the editor so the user just presses Enter
471
+ // This avoids sendUserMessage which fails with "Agent is already processing"
472
+ const prompt = `Build this project completely. Create all necessary files, implement all features, test everything.
495
473
 
496
- 4. **Assign agents**: explore (read-only analysis), plan (design), code (implementation), test (write+run tests), review (quality audit)
474
+ ## Project
475
+ ${description}
497
476
 
498
- 5. **Set dependencies** to maximize parallelism:
499
- - Tasks without dependencies → same wave → run simultaneously
500
- - Only add a dependency when a task truly needs another's output
501
- - Typical flow: explore(wave 1) → plan(wave 2) → code(wave 3) → test(wave 4) → review(wave 5)
502
- - But independent code tasks can run in parallel within the same wave
477
+ ## Rules
478
+ - Create ALL files needed for a complete, working project
479
+ - Use best practices and clean code
480
+ - Test that everything works (run the code if possible)
481
+ - Report what you created when done`;
503
482
 
504
- 6. **Call the orchestrate tool** with ALL fields in a SINGLE call:
505
- - title, description, goals, requirements, constraints (project metadata)
506
- - tasks (array of ALL task objects with title, description, agent, dependencies)
507
-
508
- āš ļø CRITICAL: Include the \`tasks\` array in the SAME tool call as the project metadata. Do NOT make separate calls. All data must be in ONE orchestrate() invocation.`
509
- );
483
+ ctx.ui.pasteToEditor(prompt);
510
484
  },
511
485
  });
512
486
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phi-code-admin/phi-code",
3
- "version": "0.61.5",
3
+ "version": "0.61.7",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {