@phi-code-admin/phi-code 0.61.9 → 0.61.11

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.
@@ -353,9 +353,9 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
353
353
  parameters: Type.Object({
354
354
  title: Type.String({ description: "Concise project title" }),
355
355
  description: Type.String({ description: "Full project description: what to build, why, and any relevant context" }),
356
- goals: Type.Array(Type.String(), { description: "Measurable project goals (what success looks like)" }),
357
- requirements: Type.Array(Type.String(), { description: "Technical and functional requirements" }),
358
- architecture: Type.Optional(Type.Array(Type.String(), { description: "Architecture decisions, tech stack choices, trade-offs" })),
356
+ goals: Type.Union([Type.Array(Type.String()), Type.String()], { description: "Measurable project goals (what success looks like)" }),
357
+ requirements: Type.Union([Type.Array(Type.String()), Type.String()], { description: "Technical and functional requirements" }),
358
+ architecture: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Architecture decisions, tech stack choices, trade-offs" })),
359
359
  tasks: Type.Array(
360
360
  Type.Object({
361
361
  title: Type.String({ description: "Clear, action-oriented task title" }),
@@ -367,14 +367,30 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
367
367
  }),
368
368
  { description: "Ordered list of tasks. Independent tasks run in parallel. Dependent tasks wait for prerequisites." }
369
369
  ),
370
- constraints: Type.Optional(Type.Array(Type.String(), { description: "Hard constraints: frameworks, patterns, rules, things to avoid" })),
371
- successCriteria: Type.Optional(Type.Array(Type.String(), { description: "How to verify the project is complete and correct" })),
370
+ constraints: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "Hard constraints: frameworks, patterns, rules, things to avoid" })),
371
+ successCriteria: Type.Optional(Type.Union([Type.Array(Type.String()), Type.String()], { description: "How to verify the project is complete and correct" })),
372
372
  }),
373
373
 
374
374
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
375
- const p = params as {
376
- title: string; description: string; goals: string[]; requirements: string[];
377
- architecture?: string[]; tasks: TaskDef[]; constraints?: string[]; successCriteria?: string[];
375
+ const raw = params as any;
376
+
377
+ // Normalize string fields to arrays (some models send strings instead of arrays)
378
+ const toArray = (v: any): string[] => {
379
+ if (!v) return [];
380
+ if (Array.isArray(v)) return v;
381
+ if (typeof v === "string") return v.split("\n").map((s: string) => s.replace(/^[-•*]\s*/, "").trim()).filter(Boolean);
382
+ return [];
383
+ };
384
+
385
+ const p = {
386
+ title: raw.title as string,
387
+ description: raw.description as string,
388
+ goals: toArray(raw.goals),
389
+ requirements: toArray(raw.requirements),
390
+ architecture: raw.architecture ? toArray(raw.architecture) : undefined,
391
+ tasks: raw.tasks as TaskDef[],
392
+ constraints: raw.constraints ? toArray(raw.constraints) : undefined,
393
+ successCriteria: raw.successCriteria ? toArray(raw.successCriteria) : undefined,
378
394
  };
379
395
 
380
396
  try {
@@ -473,7 +489,10 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
473
489
  { agent: "review", label: "🔍 Reviewing", instruction: `Review code quality, security, and performance. Fix any issues found.\n\nProject: ${description}` },
474
490
  ];
475
491
 
476
- // Execute each phase sequentially using sendUserMessage + waitForIdle
492
+ // Execute each phase sequentially
493
+ // Wait for idle first (command handler may still be "processing")
494
+ await ctx.waitForIdle();
495
+
477
496
  for (const phase of phases) {
478
497
  const agentDef = agentDefs.get(phase.agent);
479
498
  const systemPromptNote = agentDef?.systemPrompt
@@ -482,7 +501,12 @@ export default function orchestratorExtension(pi: ExtensionAPI) {
482
501
 
483
502
  ctx.ui.notify(`\n${phase.label} (agent: ${phase.agent})...`, "info");
484
503
 
485
- pi.sendUserMessage(phase.instruction + systemPromptNote, { deliverAs: "followUp" });
504
+ // Send message use followUp if agent is still streaming, direct otherwise
505
+ try {
506
+ pi.sendUserMessage(phase.instruction + systemPromptNote);
507
+ } catch {
508
+ pi.sendUserMessage(phase.instruction + systemPromptNote, { deliverAs: "followUp" });
509
+ }
486
510
  await ctx.waitForIdle();
487
511
  }
488
512
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phi-code-admin/phi-code",
3
- "version": "0.61.9",
3
+ "version": "0.61.11",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {