taskplane 0.27.0 → 0.28.1

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.
@@ -662,6 +662,27 @@ export function parseWorktreeStatusMd(
662
662
  *
663
663
  * @since TP-070
664
664
  */
665
+
666
+ /**
667
+ * Parse STATUS.md directly from a known absolute path.
668
+ * Unlike parseWorktreeStatusMdAsync, this does NOT re-resolve the path —
669
+ * it reads exactly the file you point it to. Use this when the caller
670
+ * already has the authoritative statusPath (e.g., from buildExecutionUnit).
671
+ *
672
+ * @since TP-501
673
+ */
674
+ export async function parseStatusMdAtPath(
675
+ statusPath: string,
676
+ ): Promise<{ parsed: ParsedWorktreeStatus | null; error: string | null }> {
677
+ return parseStatusMdContent(statusPath);
678
+ }
679
+
680
+ /**
681
+ * Parse STATUS.md by resolving the path from taskFolder + worktree context.
682
+ * Use parseStatusMdAtPath instead when the caller already has the authoritative path.
683
+ *
684
+ * @since TP-070
685
+ */
665
686
  export async function parseWorktreeStatusMdAsync(
666
687
  taskFolder: string,
667
688
  worktreePath: string,
@@ -669,8 +690,13 @@ export async function parseWorktreeStatusMdAsync(
669
690
  isWorkspaceMode?: boolean,
670
691
  ): Promise<{ parsed: ParsedWorktreeStatus | null; error: string | null }> {
671
692
  const resolved = resolveCanonicalTaskPaths(taskFolder, worktreePath, repoRoot, isWorkspaceMode);
672
- const statusPath = resolved.statusPath;
693
+ return parseStatusMdContent(resolved.statusPath);
694
+ }
673
695
 
696
+ /** Shared STATUS.md content parser — reads and parses from a known path. Handles file-not-found. */
697
+ async function parseStatusMdContent(
698
+ statusPath: string,
699
+ ): Promise<{ parsed: ParsedWorktreeStatus | null; error: string | null }> {
674
700
  if (!(await fileExistsAsync(statusPath))) {
675
701
  return { parsed: null, error: `STATUS.md not found at ${statusPath}` };
676
702
  }
@@ -1188,7 +1214,7 @@ export async function monitorLanes(
1188
1214
  const unit = buildExecutionUnit(lane, task, repoRoot, isWorkspaceMode);
1189
1215
  const donePath = unit.packet.donePath;
1190
1216
  const statusPath = unit.packet.statusPath;
1191
- const statusResult = await parseWorktreeStatusMdAsync(dirname(statusPath), lane.worktreePath, repoRoot, false);
1217
+ const statusResult = await parseStatusMdAtPath(statusPath);
1192
1218
 
1193
1219
  const snapshot = await resolveTaskMonitorState(
1194
1220
  task.taskId,
@@ -2516,6 +2542,7 @@ export async function executeLaneV2(
2516
2542
  // rules: checkpoint discipline, STATUS.md resume algorithm, review_step instructions.
2517
2543
  // The local file (.pi/agents/task-worker.md) adds project-specific guidance.
2518
2544
  let workerSystemPrompt = "You are a task execution agent. Read STATUS.md first, find unchecked items, work on them, checkpoint after each.";
2545
+ let workerSegmentPrompt = "";
2519
2546
  try {
2520
2547
  const basePrompt = loadBaseAgentPrompt("task-worker");
2521
2548
  const localPrompt = loadLocalAgentPrompt(stateRoot, "task-worker");
@@ -2526,6 +2553,9 @@ export async function executeLaneV2(
2526
2553
  } else if (localPrompt) {
2527
2554
  workerSystemPrompt = localPrompt;
2528
2555
  }
2556
+ // Load segment-scoped prompt overlay (appended when isSegmentScoped)
2557
+ const segPrompt = loadBaseAgentPrompt("task-worker-segment");
2558
+ if (segPrompt) workerSegmentPrompt = segPrompt;
2529
2559
  } catch { /* use default */ }
2530
2560
 
2531
2561
  execLog(laneId, "LANE", `starting Runtime V2 execution of ${lane.tasks.length} task(s)`, {
@@ -2572,6 +2602,7 @@ export async function executeLaneV2(
2572
2602
  workerTools: "read,write,edit,bash,grep,find,ls",
2573
2603
  workerThinking: "",
2574
2604
  workerSystemPrompt,
2605
+ workerSegmentPrompt,
2575
2606
  reviewerModel: extraEnvVars?.TASKPLANE_REVIEWER_MODEL || "",
2576
2607
  reviewerThinking: extraEnvVars?.TASKPLANE_REVIEWER_THINKING || "",
2577
2608
  reviewerTools: extraEnvVars?.TASKPLANE_REVIEWER_TOOLS || "",