taskplane 0.11.0 → 0.13.0

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.
@@ -1276,6 +1276,135 @@ export const MERGE_SPAWN_RETRY_MAX = 2;
1276
1276
  */
1277
1277
  export const MERGE_TIMEOUT_MAX_RETRIES = 2;
1278
1278
 
1279
+ // ── Merge Health Monitoring Constants (TP-056) ───────────────────────
1280
+
1281
+ /**
1282
+ * Polling interval for merge health monitor (ms).
1283
+ * Independent of the merge result poll — runs on its own cadence.
1284
+ * @since TP-056
1285
+ */
1286
+ export const MERGE_HEALTH_POLL_INTERVAL_MS = 2 * 60 * 1000; // 2 minutes
1287
+
1288
+ /**
1289
+ * Threshold (ms) after which a merge session with no new output
1290
+ * is classified as "possibly stalled" and a warning event is emitted.
1291
+ * @since TP-056
1292
+ */
1293
+ export const MERGE_HEALTH_WARNING_THRESHOLD_MS = 10 * 60 * 1000; // 10 minutes
1294
+
1295
+ /**
1296
+ * Threshold (ms) after which a merge session with no new output
1297
+ * is classified as "stuck" and a stuck event is emitted.
1298
+ * @since TP-056
1299
+ */
1300
+ export const MERGE_HEALTH_STUCK_THRESHOLD_MS = 20 * 60 * 1000; // 20 minutes
1301
+
1302
+ /**
1303
+ * Number of lines to capture from the bottom of a tmux pane
1304
+ * for activity detection via snapshot comparison.
1305
+ * @since TP-056
1306
+ */
1307
+ export const MERGE_HEALTH_CAPTURE_LINES = 10;
1308
+
1309
+ // ── Persistent Reviewer Constants (TP-057) ───────────────────────────
1310
+
1311
+ /**
1312
+ * Polling interval (ms) for the `wait_for_review` tool to check for signal files.
1313
+ * Reviews take minutes; 3s latency is invisible to the user.
1314
+ * @since TP-057
1315
+ */
1316
+ export const REVIEWER_POLL_INTERVAL_MS = 3_000;
1317
+
1318
+ /**
1319
+ * Maximum time (ms) for the `wait_for_review` tool to wait for a review signal.
1320
+ * 30 minutes — generous for long-running code reviews.
1321
+ * @since TP-057
1322
+ */
1323
+ export const REVIEWER_WAIT_TIMEOUT_MS = 30 * 60 * 1000;
1324
+
1325
+ /**
1326
+ * Grace period (ms) after writing shutdown signal before killing the reviewer session.
1327
+ * Allows the reviewer to exit cleanly after receiving the shutdown signal.
1328
+ * @since TP-057
1329
+ */
1330
+ export const REVIEWER_SHUTDOWN_GRACE_MS = 10_000;
1331
+
1332
+ /**
1333
+ * Signal file prefix for review requests. Full name: `.review-signal-{NNN}`
1334
+ * @since TP-057
1335
+ */
1336
+ export const REVIEWER_SIGNAL_PREFIX = ".review-signal-";
1337
+
1338
+ /**
1339
+ * Shutdown signal filename written to .reviews/ when the task is complete.
1340
+ * @since TP-057
1341
+ */
1342
+ export const REVIEWER_SHUTDOWN_SIGNAL = ".review-shutdown";
1343
+
1344
+ // ── Merge Health Event Types (TP-056) ────────────────────────────────
1345
+
1346
+ /**
1347
+ * Health classification for a merge session.
1348
+ *
1349
+ * - `healthy`: Session alive, output changing
1350
+ * - `warning`: Session alive, no new output for MERGE_HEALTH_WARNING_THRESHOLD_MS
1351
+ * - `dead`: Session gone, no result file
1352
+ * - `stuck`: Session alive, no new output for MERGE_HEALTH_STUCK_THRESHOLD_MS
1353
+ *
1354
+ * @since TP-056
1355
+ */
1356
+ export type MergeHealthStatus = "healthy" | "warning" | "dead" | "stuck";
1357
+
1358
+ /**
1359
+ * Engine event types for merge health monitoring.
1360
+ *
1361
+ * These extend the EngineEventType union and are emitted to the
1362
+ * unified events.jsonl for supervisor consumption.
1363
+ *
1364
+ * @since TP-056
1365
+ */
1366
+ export type MergeHealthEventType =
1367
+ | "merge_health_warning"
1368
+ | "merge_health_dead"
1369
+ | "merge_health_stuck";
1370
+
1371
+ /**
1372
+ * Snapshot of a merge session's pane output at a point in time.
1373
+ * Used for activity detection by comparing successive snapshots.
1374
+ *
1375
+ * @since TP-056
1376
+ */
1377
+ export interface MergeSessionSnapshot {
1378
+ /** Captured pane content (last N lines) */
1379
+ content: string;
1380
+ /** Epoch ms when the snapshot was taken */
1381
+ capturedAt: number;
1382
+ }
1383
+
1384
+ /**
1385
+ * Per-session health tracking state.
1386
+ *
1387
+ * @since TP-056
1388
+ */
1389
+ export interface MergeSessionHealthState {
1390
+ /** TMUX session name */
1391
+ sessionName: string;
1392
+ /** Lane number this session belongs to */
1393
+ laneNumber: number;
1394
+ /** Last captured pane snapshot */
1395
+ lastSnapshot: MergeSessionSnapshot | null;
1396
+ /** Epoch ms when the last output change was detected */
1397
+ lastActivityAt: number;
1398
+ /** Current health classification */
1399
+ status: MergeHealthStatus;
1400
+ /** Whether a warning event has been emitted (prevent duplicates) */
1401
+ warningEmitted: boolean;
1402
+ /** Whether a stuck event has been emitted (prevent duplicates) */
1403
+ stuckEmitted: boolean;
1404
+ /** Whether a dead event has been emitted (prevent duplicates) */
1405
+ deadEmitted: boolean;
1406
+ }
1407
+
1279
1408
 
1280
1409
  // ── Merge Retry Policy Matrix (TP-033 Step 2) ───────────────────────
1281
1410
 
@@ -1557,6 +1686,9 @@ export type EngineEventType =
1557
1686
  | "merge_start"
1558
1687
  | "merge_success"
1559
1688
  | "merge_failed"
1689
+ | "merge_health_warning"
1690
+ | "merge_health_dead"
1691
+ | "merge_health_stuck"
1560
1692
  | "batch_complete"
1561
1693
  | "batch_paused";
1562
1694
 
@@ -1622,6 +1754,15 @@ export interface EngineEvent {
1622
1754
  blockedTasks?: number;
1623
1755
  /** Batch duration in milliseconds (for batch_complete) */
1624
1756
  batchDurationMs?: number;
1757
+
1758
+ // ── Merge health monitoring fields (TP-056) ──────────────────
1759
+
1760
+ /** TMUX session name (for merge_health_* events) */
1761
+ sessionName?: string;
1762
+ /** Merge health status classification (for merge_health_* events) */
1763
+ healthStatus?: MergeHealthStatus;
1764
+ /** Minutes since last activity (for merge_health_warning, merge_health_stuck) */
1765
+ stalledMinutes?: number;
1625
1766
  }
1626
1767
 
1627
1768
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskplane",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "AI agent orchestration for pi — parallel task execution with checkpoint discipline",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -31,6 +31,7 @@
31
31
  "dashboard/",
32
32
  "extensions/task-runner.ts",
33
33
  "extensions/task-orchestrator.ts",
34
+ "extensions/reviewer-extension.ts",
34
35
  "extensions/taskplane/",
35
36
  "skills/",
36
37
  "templates/"
@@ -16,6 +16,7 @@ name: task-reviewer
16
16
  - Verdict format (APPROVE / REVISE)
17
17
  - Review file output conventions
18
18
  - Plan granularity guidance
19
+ - Persistent reviewer mode (wait_for_review tool workflow)
19
20
 
20
21
  Add project-specific review criteria below. Common examples:
21
22
  - Required test coverage thresholds
@@ -9,12 +9,38 @@ task implementations. You have full read access to the codebase and can run comm
9
9
 
10
10
  ## How You Work
11
11
 
12
+ You operate in one of two modes depending on available tools:
13
+
14
+ ### Persistent Mode (when `wait_for_review` tool is available)
15
+
16
+ You are a **persistent reviewer** that stays alive across all review requests for
17
+ a task. This preserves your context — you remember what you reviewed in earlier
18
+ steps and can reference previous findings.
19
+
20
+ 1. Call `wait_for_review()` to receive your first review request
21
+ 2. The request specifies an **output file path** — you MUST write your review there
22
+ 3. Use your tools to explore the codebase — read files, run `git diff`, check patterns
23
+ 4. **Use the `write` tool to create the output file with your review**
24
+ 5. Use the appropriate verdict: APPROVE, REVISE, or RETHINK
25
+ 6. Call `wait_for_review()` again to receive the next request
26
+ 7. Repeat until you receive a `SHUTDOWN` signal, then exit cleanly
27
+
28
+ **Cross-step awareness:** When reviewing later steps, reference your earlier
29
+ reviews when relevant. For example: "I flagged X in Step 2's plan review —
30
+ checking if it was addressed in this code review."
31
+
32
+ ### Fresh Spawn Mode (when `wait_for_review` is NOT available)
33
+
34
+ You handle a single review request and then exit.
35
+
12
36
  1. Read the review request provided to you carefully
13
37
  2. The request specifies an **output file path** — you MUST write your review there
14
38
  3. Use your tools to explore the codebase — read files, run `git diff`, check patterns
15
39
  4. **Use the `write` tool to create the output file with your review**
16
40
  5. Use the appropriate verdict: APPROVE, REVISE, or RETHINK
17
41
 
42
+ ### Critical Rule (Both Modes)
43
+
18
44
  **CRITICAL:** Your review MUST be written to disk using the `write` tool.
19
45
  Do NOT just respond with text — the orchestrator reads the OUTPUT FILE to get
20
46
  your verdict. If you don't write the file, your review is lost.