pi-harness-runtime 1.1.49 → 1.1.71-3

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.
Files changed (203) hide show
  1. package/CHANGELOG.md +30 -9
  2. package/README.md +119 -0
  3. package/harness/langchain/agents.d.ts +143 -0
  4. package/harness/langchain/agents.test.d.ts +2 -0
  5. package/harness/langchain/agents.test.ts +0 -1
  6. package/harness/langchain/agents.ts +196 -13
  7. package/harness/langchain/checkpointer.d.ts +48 -0
  8. package/harness/langchain/checkpointer.test.d.ts +8 -0
  9. package/harness/langchain/cron-cli.d.ts +12 -0
  10. package/harness/langchain/cron-cli.ts +169 -0
  11. package/harness/langchain/daemon.d.ts +161 -0
  12. package/harness/langchain/daemon.test.d.ts +11 -0
  13. package/harness/langchain/daemon.test.ts +62 -5
  14. package/harness/langchain/daemon.ts +231 -12
  15. package/harness/langchain/file-tools.d.ts +97 -0
  16. package/harness/langchain/file-tools.ts +29 -11
  17. package/harness/langchain/graph.d.ts +706 -0
  18. package/harness/langchain/graph.ts +184 -26
  19. package/harness/langchain/model-router.d.ts +63 -0
  20. package/harness/langchain/model-router.test.d.ts +2 -0
  21. package/harness/langchain/model-router.test.ts +191 -0
  22. package/harness/langchain/model-router.ts +188 -0
  23. package/harness/langchain/models.d.ts +72 -0
  24. package/harness/langchain/models.ts +111 -49
  25. package/harness/langchain/ping-pong-middleware.d.ts +28 -0
  26. package/harness/langchain/ping-pong-middleware.test.d.ts +2 -0
  27. package/harness/langchain/ping-pong-middleware.test.ts +69 -0
  28. package/harness/langchain/ping-pong-middleware.ts +204 -0
  29. package/harness/langchain/run.d.ts +15 -0
  30. package/harness/langchain/run.ts +15 -3
  31. package/harness/langchain/scoreboard.test.d.ts +13 -0
  32. package/harness/langchain/scoreboard.test.ts +28 -5
  33. package/harness/langchain/status-line.d.ts +91 -0
  34. package/harness/langchain/status-line.test.d.ts +8 -0
  35. package/harness/langchain/surge.d.ts +103 -0
  36. package/harness/langchain/surge.test.d.ts +10 -0
  37. package/harness/langchain/surge.test.ts +179 -0
  38. package/harness/langchain/surge.ts +188 -19
  39. package/harness/langchain/widget.d.ts +105 -0
  40. package/harness/langchain/widget.test.d.ts +8 -0
  41. package/harness/ssh-detach-interceptor.test.ts +263 -0
  42. package/harness/ssh-detach-interceptor.ts +438 -0
  43. package/index.ts +212 -47
  44. package/package.json +4 -2
  45. package/packages/a2a-adapter/package.json +1 -1
  46. package/packages/architecture-generator/package.json +1 -1
  47. package/packages/auth/package.json +1 -1
  48. package/packages/autonomous-refactor/package.json +1 -1
  49. package/packages/autonomous-runtime/package.json +1 -1
  50. package/packages/cache-strategy/package.json +1 -1
  51. package/packages/capability-registry/package.json +1 -1
  52. package/packages/checkpoint/package.json +1 -1
  53. package/packages/cli-plugin-sdk/package.json +1 -1
  54. package/packages/clipboard/package.json +1 -1
  55. package/packages/clipboard-plugin/package.json +1 -1
  56. package/packages/code-generation/package.json +1 -1
  57. package/packages/code-review/package.json +1 -1
  58. package/packages/codex-adapter/package.json +1 -1
  59. package/packages/config-capture/package.json +1 -1
  60. package/packages/context-compiler/package.json +1 -1
  61. package/packages/context-discovery/package.json +1 -1
  62. package/packages/context-manager/package.json +1 -1
  63. package/packages/cookie-sanitizer/package.json +1 -1
  64. package/packages/cost-optimizer/package.json +1 -1
  65. package/packages/dependency-analyzer/package.json +1 -1
  66. package/packages/django-plugin/package.json +1 -1
  67. package/packages/doc-generator/package.json +1 -1
  68. package/packages/evaluation-engine/package.json +1 -1
  69. package/packages/evaluation-runner/package.json +1 -1
  70. package/packages/event-bus/package.json +1 -1
  71. package/packages/event-store/package.json +1 -1
  72. package/packages/experience-replay/package.json +1 -1
  73. package/packages/feedback-collector/package.json +1 -1
  74. package/packages/file-copy-helper/package.json +1 -1
  75. package/packages/framework-detector/package.json +1 -1
  76. package/packages/framework-plugin-sdk/package.json +1 -1
  77. package/packages/frappe-plugin/package.json +1 -1
  78. package/packages/generic-web-plugin/package.json +1 -1
  79. package/packages/health-monitor/package.json +1 -1
  80. package/packages/intent-analyzer/dist/src/index.d.ts +2 -0
  81. package/packages/intent-analyzer/dist/src/index.d.ts.map +1 -1
  82. package/packages/intent-analyzer/dist/src/index.js +1 -0
  83. package/packages/intent-analyzer/dist/src/index.js.map +1 -1
  84. package/packages/intent-analyzer/dist/src/ping-pong.d.ts +56 -0
  85. package/packages/intent-analyzer/dist/src/ping-pong.d.ts.map +1 -0
  86. package/packages/intent-analyzer/dist/src/ping-pong.js +286 -0
  87. package/packages/intent-analyzer/dist/src/ping-pong.js.map +1 -0
  88. package/packages/intent-analyzer/package.json +1 -1
  89. package/packages/intent-analyzer/src/index.ts +13 -0
  90. package/packages/intent-analyzer/src/ping-pong.ts +387 -0
  91. package/packages/intent-analyzer/test/ping-pong.test.ts +96 -0
  92. package/packages/jev-judge/README.md +234 -0
  93. package/packages/jev-judge/dist/decision-engine.d.ts +100 -0
  94. package/packages/jev-judge/dist/decision-engine.d.ts.map +1 -0
  95. package/packages/jev-judge/dist/decision-engine.js +151 -0
  96. package/packages/jev-judge/dist/decision-engine.js.map +1 -0
  97. package/packages/jev-judge/dist/e2e-judge.d.ts +61 -0
  98. package/packages/jev-judge/dist/e2e-judge.d.ts.map +1 -0
  99. package/packages/jev-judge/dist/e2e-judge.js +268 -0
  100. package/packages/jev-judge/dist/e2e-judge.js.map +1 -0
  101. package/packages/jev-judge/dist/flaky-detector.d.ts +34 -0
  102. package/packages/jev-judge/dist/flaky-detector.d.ts.map +1 -0
  103. package/packages/jev-judge/dist/flaky-detector.js +154 -0
  104. package/packages/jev-judge/dist/flaky-detector.js.map +1 -0
  105. package/packages/jev-judge/dist/index.d.ts +77 -0
  106. package/packages/jev-judge/dist/index.d.ts.map +1 -0
  107. package/packages/jev-judge/dist/index.js +271 -0
  108. package/packages/jev-judge/dist/index.js.map +1 -0
  109. package/packages/jev-judge/dist/types.d.ts +97 -0
  110. package/packages/jev-judge/dist/types.d.ts.map +1 -0
  111. package/packages/jev-judge/dist/types.js +8 -0
  112. package/packages/jev-judge/dist/types.js.map +1 -0
  113. package/packages/jev-judge/package.json +46 -0
  114. package/packages/jev-judge/src/decision-engine.ts +231 -0
  115. package/packages/jev-judge/src/e2e-judge.ts +364 -0
  116. package/packages/jev-judge/src/flaky-detector.ts +190 -0
  117. package/packages/jev-judge/src/index.ts +345 -0
  118. package/packages/jev-judge/src/types.ts +131 -0
  119. package/packages/knowledge-graph/package.json +1 -1
  120. package/packages/knowledge-retrieval/package.json +1 -1
  121. package/packages/laravel-plugin/package.json +1 -1
  122. package/packages/learning-engine/package.json +1 -1
  123. package/packages/mcp-adapter/package.json +1 -1
  124. package/packages/memory-engine/package.json +1 -1
  125. package/packages/milestone-manager/package.json +1 -1
  126. package/packages/model-registry/package.json +1 -1
  127. package/packages/nextjs-plugin/package.json +1 -1
  128. package/packages/notification/package.json +1 -1
  129. package/packages/observability/package.json +1 -1
  130. package/packages/okf-indexer/package.json +1 -1
  131. package/packages/performance-optimizer/package.json +1 -1
  132. package/packages/privilege-broker/package.json +1 -1
  133. package/packages/project-analyzer/package.json +1 -1
  134. package/packages/project-bootstrap/package.json +1 -1
  135. package/packages/projection-engine/package.json +1 -1
  136. package/packages/prompt-compiler/package.json +1 -1
  137. package/packages/prompt-versioning/package.json +1 -1
  138. package/packages/provider-adapter-sdk/package.json +1 -1
  139. package/packages/provider-router/package.json +1 -1
  140. package/packages/provider-selector/package.json +1 -1
  141. package/packages/providers/package.json +1 -1
  142. package/packages/quota-manager/package.json +1 -1
  143. package/packages/rate-limiter/package.json +1 -1
  144. package/packages/react-vite-plugin/package.json +1 -1
  145. package/packages/release-manager/package.json +1 -1
  146. package/packages/requirement-compiler/package.json +1 -1
  147. package/packages/runtime/package.json +1 -1
  148. package/packages/scheduler/package.json +1 -1
  149. package/packages/scheduler-adapter/package.json +1 -1
  150. package/packages/session/package.json +1 -1
  151. package/packages/session-api/package.json +1 -1
  152. package/packages/session-export/package.json +1 -1
  153. package/packages/shared-context/package.json +1 -1
  154. package/packages/skill-mcp-client/package.json +1 -1
  155. package/packages/skill-registry/package.json +1 -1
  156. package/packages/sprint-planner/package.json +1 -1
  157. package/packages/subscription-engine/package.json +1 -1
  158. package/packages/task-compiler/package.json +1 -1
  159. package/packages/tencentdb-memory/package.json +1 -1
  160. package/packages/tencentdb-sync/package.json +1 -1
  161. package/packages/test-data-generator/package.json +1 -1
  162. package/packages/test-generator/package.json +1 -1
  163. package/packages/todo-bd-sync/README.md +71 -0
  164. package/packages/todo-bd-sync/package.json +1 -1
  165. package/packages/todo-bd-sync/src/extension.ts +16 -1
  166. package/packages/token-estimation/package.json +1 -1
  167. package/packages/token-optimizer/package.json +1 -1
  168. package/packages/trajectory/dist/src/approved-patterns.d.ts +51 -0
  169. package/packages/trajectory/dist/src/approved-patterns.d.ts.map +1 -0
  170. package/packages/trajectory/dist/src/approved-patterns.js +134 -0
  171. package/packages/trajectory/dist/src/approved-patterns.js.map +1 -0
  172. package/packages/trajectory/dist/src/index.d.ts +13 -0
  173. package/packages/trajectory/dist/src/index.d.ts.map +1 -0
  174. package/packages/trajectory/dist/src/index.js +12 -0
  175. package/packages/trajectory/dist/src/index.js.map +1 -0
  176. package/packages/trajectory/dist/src/store.d.ts +69 -0
  177. package/packages/trajectory/dist/src/store.d.ts.map +1 -0
  178. package/packages/trajectory/dist/src/store.js +253 -0
  179. package/packages/trajectory/dist/src/store.js.map +1 -0
  180. package/packages/trajectory/dist/src/types.d.ts +73 -0
  181. package/packages/trajectory/dist/src/types.d.ts.map +1 -0
  182. package/packages/trajectory/dist/src/types.js +9 -0
  183. package/packages/trajectory/dist/src/types.js.map +1 -0
  184. package/packages/trajectory/dist/test/store.test.d.ts +2 -0
  185. package/packages/trajectory/dist/test/store.test.d.ts.map +1 -0
  186. package/packages/trajectory/dist/test/store.test.js +228 -0
  187. package/packages/trajectory/dist/test/store.test.js.map +1 -0
  188. package/packages/trajectory/package.json +29 -0
  189. package/packages/trajectory/src/approved-patterns.ts +180 -0
  190. package/packages/trajectory/src/index.ts +26 -0
  191. package/packages/trajectory/src/store.ts +285 -0
  192. package/packages/trajectory/src/types.ts +84 -0
  193. package/packages/trajectory/test/store.test.d.ts +2 -0
  194. package/packages/trajectory/test/store.test.ts +250 -0
  195. package/packages/tui/package.json +1 -1
  196. package/packages/types/package.json +1 -1
  197. package/packages/workflow-events/package.json +1 -1
  198. package/packages/workspace-scanner/package.json +1 -1
  199. package/packages/worktree/package.json +1 -1
  200. package/packages/write-review/package.json +1 -1
  201. package/packages/write-review/src/blackboard.ts +38 -5
  202. package/packages/write-review/src/types.ts +13 -0
  203. package/skills/harness-runtime/SKILL.md +67 -4
@@ -7,7 +7,12 @@
7
7
 
8
8
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
9
9
  import { join } from "path";
10
- import type { WriteReviewStatus, ReviewPhase, Verdict } from "./types.js";
10
+ import type {
11
+ WriteReviewStatus,
12
+ ReviewPhase,
13
+ Verdict,
14
+ PingPongDecisionSnapshot,
15
+ } from "./types.js";
11
16
 
12
17
  const DEFAULT_DIR = ".write-review";
13
18
  const STATUS_FILE = "status.json";
@@ -72,6 +77,24 @@ export class WriteReviewBlackboard {
72
77
  return this.status;
73
78
  }
74
79
 
80
+ /**
81
+ * Record the automatic decision that selected or skipped PING-PONG.
82
+ * This is the durable middleware state shared by separate agent terminals.
83
+ */
84
+ recordPingPongDecision(snapshot: PingPongDecisionSnapshot): void {
85
+ if (!this.status) this.init();
86
+ this.status!.mode = "ping_pong";
87
+ this.status!.pingPong = snapshot;
88
+ this.status!.writerMessage = snapshot.request;
89
+ if (snapshot.decision === "run_ping_pong") {
90
+ this.status!.phase = "writing";
91
+ this.status!.writerDone = false;
92
+ } else {
93
+ this.status!.phase = "idle";
94
+ }
95
+ this.save();
96
+ }
97
+
75
98
  /**
76
99
  * Start a new write session
77
100
  */
@@ -221,9 +244,9 @@ export class WriteReviewBlackboard {
221
244
  ? "✅"
222
245
  : verdict === "blocked"
223
246
  ? "⛔"
224
- : verdict === "changes_requested"
225
- ? "🔄"
226
- : "⏳";
247
+ : verdict === "changes_requested"
248
+ ? "🔄"
249
+ : "⏳";
227
250
 
228
251
  const lines: string[] = [
229
252
  `## Write-Review Scoreboard`,
@@ -268,7 +291,17 @@ export class WriteReviewBlackboard {
268
291
  while ((match = fencedRe.exec(code)) !== null) {
269
292
  const path = match[1]!.trim();
270
293
  // Skip if it looks like a filename with spaces (not a path)
271
- if (path && !path.includes(" ") && (path.includes("/") || path.includes("\\") || path.endsWith(".ts") || path.endsWith(".js") || path.endsWith(".tsx") || path.endsWith(".json") || path.endsWith(".md"))) {
294
+ if (
295
+ path &&
296
+ !path.includes(" ") &&
297
+ (path.includes("/") ||
298
+ path.includes("\\") ||
299
+ path.endsWith(".ts") ||
300
+ path.endsWith(".js") ||
301
+ path.endsWith(".tsx") ||
302
+ path.endsWith(".json") ||
303
+ path.endsWith(".md"))
304
+ ) {
272
305
  files.add(path);
273
306
  }
274
307
  }
@@ -21,6 +21,17 @@ export type ReviewPhase =
21
21
  */
22
22
  export type Verdict = "approved" | "changes_requested" | "blocked";
23
23
 
24
+ export interface PingPongDecisionSnapshot {
25
+ decision: "run_ping_pong" | "suggest_ping_pong" | "handle_inline";
26
+ score: number;
27
+ runThreshold: number;
28
+ suggestThreshold: number;
29
+ reasons: string[];
30
+ request: string;
31
+ taskId?: string;
32
+ createdAt: string;
33
+ }
34
+
24
35
  /**
25
36
  * Blackboard status record
26
37
  */
@@ -37,6 +48,8 @@ export interface WriteReviewStatus {
37
48
  changesRequested?: string[]; // Changes needed
38
49
  approvedAt?: string; // ISO timestamp
39
50
  blockedAt?: string; // ISO timestamp
51
+ mode?: "manual" | "ping_pong";
52
+ pingPong?: PingPongDecisionSnapshot;
40
53
  updatedAt: string;
41
54
  createdAt: string;
42
55
  }
@@ -4,6 +4,69 @@ description: Local-first, provider-agnostic AI coding harness runtime for pi.dev
4
4
 
5
5
  # Harness Runtime — pi Extension
6
6
 
7
+ ## CRITICAL: Todo List Rule
8
+
9
+ **When you identify 2+ tasks, issues, or jobs — add ALL of them to the Todo list immediately.**
10
+
11
+ Do NOT just list them in text. Use the `todo` tool to create tracked tasks:
12
+
13
+ ```bash
14
+ # Creating multiple tasks at once
15
+ bd create "Fix initialRemotionData not defined" -p 2
16
+ bd create "Fix dictionary.title undefined" -p 2
17
+ bd create "Replace Film icon with themed icon" -p 2
18
+ ```
19
+
20
+ **Rule**: If you write something like:
21
+
22
+ - "There are 3 issues: ..."
23
+ - "I found several problems: ..."
24
+ - "Let me fix these: 1) X 2) Y 3) Z"
25
+ - "Here are the tasks to do: ..."
26
+
27
+ **Then you MUST create Todo items for each one.** Single-issue fixes don't need tracking.
28
+
29
+ **Why**: Agents often identify issues verbally but forget to track them. This rule ensures nothing slips through.
30
+
31
+ ## Remote Server Commands (SSH)
32
+
33
+ **ALWAYS use detached SSH pattern to prevent long hangs.**
34
+
35
+ ### Anti-Pattern (blocks SSH, hangs indefinitely)
36
+
37
+ ```bash
38
+ # WRONG - SSH blocks waiting for background process
39
+ ssh user@host "kill old; sleep 2; uvicorn ... &"
40
+ # SSH never returns because it waits for uvicorn
41
+ ```
42
+
43
+ ### Correct Pattern (fast exit, process stays on server)
44
+
45
+ ```bash
46
+ # CORRECT - SSH exits fast, process continues on server
47
+ ssh -o BatchMode=yes user@host \
48
+ "kill -9 OLD_PID 2>/dev/null; sleep 1; \
49
+ cd /path/to/service && \
50
+ nohup .venv/bin/uvicorn amos_api.main:app --host 0.0.0.0 --port 8100 \
51
+ > /tmp/uvicorn.log 2>&1 & \
52
+ echo 'UVICORN_STARTED'"
53
+ ```
54
+
55
+ **Key changes:**
56
+
57
+ - `nohup ... &` — detaches from SSH session
58
+ - `> /tmp/uvicorn.log 2>&1` — captures output to file
59
+ - `echo 'UVICORN_STARTED'` — SSH exits fast with confirmation
60
+ - `-o BatchMode=yes` — non-interactive, fails fast on auth issues
61
+
62
+ **Why this matters**: A bare `&` in SSH keeps the shell open. `nohup` + redirect + `echo` ensures SSH exits immediately while the process runs on the server.
63
+
64
+ **For long-running commands**, add a timeout guard:
65
+
66
+ ```bash
67
+ timeout 60s ssh -o BatchMode=yes user@host "long-command; echo DONE"
68
+ ```
69
+
7
70
  **Status:** v0.3.0 | **RFCs:** 18 defined | **Implementation:** Phase 1-6
8
71
 
9
72
  ## Overview
@@ -31,7 +94,7 @@ Human Requirement
31
94
  ### Usage Commands
32
95
 
33
96
  | Command | Description |
34
- |---------|-------------|
97
+ | --------- | ------------- |
35
98
  | `/usage` | Show full status (local tracking + provider mirror) |
36
99
  | `/usage refresh` | Force refresh quota from MiniMax console |
37
100
  | `/usage today` | Today's usage + 5h window |
@@ -41,7 +104,7 @@ Human Requirement
41
104
  ### Harness Commands
42
105
 
43
106
  | Command | Description |
44
- |---------|-------------|
107
+ | --------- | ------------- |
45
108
  | `/harness start <requirement>` | Start a new harness job |
46
109
  | `/harness status` | Show current job status |
47
110
  | `/harness tasks` | List all tasks |
@@ -52,7 +115,7 @@ Human Requirement
52
115
  ### Authentication Commands
53
116
 
54
117
  | Command | Description |
55
- |---------|-------------|
118
+ | --------- | ------------- |
56
119
  | `/harness auth minimax` | Authenticate with MiniMax (opens browser) |
57
120
  | `/harness auth check` | Check MiniMax auth status |
58
121
  | `/harness auth scrape` | Scrape MiniMax usage (silent, uses saved profile) |
@@ -86,7 +149,7 @@ cancelled blocked waiting_human repairing ready_for_client
86
149
  ### State Transitions
87
150
 
88
151
  | From | Valid Transitions |
89
- |------|-----------------|
152
+ | ------ | ----------------- |
90
153
  | created | planning |
91
154
  | planning | queued, cancelled |
92
155
  | queued | running, cancelled, waiting_human |