pi-harness-runtime 1.1.16 → 1.1.18

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 (96) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +76 -18
  3. package/harness/e2e/auto-test-loop.ts +750 -0
  4. package/harness/e2e/tools-detector.test.ts +156 -0
  5. package/harness/e2e/tools-detector.ts +798 -0
  6. package/harness/glm-quota-logger.ts +20 -23
  7. package/harness/index.ts +25 -0
  8. package/package.json +1 -1
  9. package/packages/a2a-adapter/package.json +1 -1
  10. package/packages/architecture-generator/package.json +1 -1
  11. package/packages/auth/package.json +1 -1
  12. package/packages/autonomous-refactor/package.json +1 -1
  13. package/packages/autonomous-runtime/package.json +1 -1
  14. package/packages/cache-strategy/package.json +1 -1
  15. package/packages/capability-registry/package.json +1 -1
  16. package/packages/checkpoint/package.json +1 -1
  17. package/packages/cli-plugin-sdk/package.json +1 -1
  18. package/packages/clipboard/package.json +1 -1
  19. package/packages/clipboard-plugin/package.json +1 -1
  20. package/packages/code-generation/package.json +1 -1
  21. package/packages/code-review/package.json +1 -1
  22. package/packages/codex-adapter/package.json +1 -1
  23. package/packages/config-capture/package.json +1 -1
  24. package/packages/context-compiler/package.json +1 -1
  25. package/packages/context-discovery/package.json +1 -1
  26. package/packages/context-manager/package.json +1 -1
  27. package/packages/cookie-sanitizer/package.json +1 -1
  28. package/packages/cost-optimizer/package.json +1 -1
  29. package/packages/dependency-analyzer/package.json +1 -1
  30. package/packages/django-plugin/package.json +1 -1
  31. package/packages/doc-generator/package.json +1 -1
  32. package/packages/evaluation-engine/package.json +1 -1
  33. package/packages/evaluation-runner/package.json +1 -1
  34. package/packages/event-bus/package.json +1 -1
  35. package/packages/event-store/package.json +1 -1
  36. package/packages/experience-replay/package.json +1 -1
  37. package/packages/feedback-collector/package.json +1 -1
  38. package/packages/file-copy-helper/package.json +1 -1
  39. package/packages/framework-detector/package.json +1 -1
  40. package/packages/framework-plugin-sdk/package.json +1 -1
  41. package/packages/frappe-plugin/package.json +1 -1
  42. package/packages/generic-web-plugin/package.json +1 -1
  43. package/packages/health-monitor/package.json +1 -1
  44. package/packages/intent-analyzer/package.json +1 -1
  45. package/packages/knowledge-graph/package.json +1 -1
  46. package/packages/knowledge-retrieval/package.json +1 -1
  47. package/packages/laravel-plugin/package.json +1 -1
  48. package/packages/learning-engine/package.json +1 -1
  49. package/packages/mcp-adapter/package.json +1 -1
  50. package/packages/memory-engine/package.json +1 -1
  51. package/packages/milestone-manager/package.json +1 -1
  52. package/packages/model-registry/package.json +1 -1
  53. package/packages/nextjs-plugin/package.json +1 -1
  54. package/packages/notification/package.json +1 -1
  55. package/packages/observability/package.json +1 -1
  56. package/packages/okf-indexer/package.json +1 -1
  57. package/packages/performance-optimizer/package.json +1 -1
  58. package/packages/privilege-broker/package.json +1 -1
  59. package/packages/project-analyzer/package.json +1 -1
  60. package/packages/project-bootstrap/package.json +1 -1
  61. package/packages/projection-engine/package.json +1 -1
  62. package/packages/prompt-compiler/package.json +1 -1
  63. package/packages/prompt-versioning/package.json +1 -1
  64. package/packages/provider-adapter-sdk/package.json +1 -1
  65. package/packages/provider-router/package.json +1 -1
  66. package/packages/provider-selector/package.json +1 -1
  67. package/packages/providers/package.json +1 -1
  68. package/packages/quota-manager/package.json +1 -1
  69. package/packages/rate-limiter/package.json +1 -1
  70. package/packages/react-vite-plugin/package.json +1 -1
  71. package/packages/release-manager/package.json +1 -1
  72. package/packages/requirement-compiler/package.json +1 -1
  73. package/packages/runtime/package.json +1 -1
  74. package/packages/scheduler/package.json +1 -1
  75. package/packages/scheduler-adapter/package.json +1 -1
  76. package/packages/session/package.json +1 -1
  77. package/packages/session-api/package.json +1 -1
  78. package/packages/session-export/package.json +1 -1
  79. package/packages/shared-context/package.json +1 -1
  80. package/packages/skill-registry/package.json +1 -1
  81. package/packages/sprint-planner/package.json +1 -1
  82. package/packages/subscription-engine/package.json +1 -1
  83. package/packages/task-compiler/package.json +1 -1
  84. package/packages/tencentdb-memory/package.json +1 -1
  85. package/packages/tencentdb-sync/package.json +1 -1
  86. package/packages/test-data-generator/package.json +1 -1
  87. package/packages/test-generator/package.json +1 -1
  88. package/packages/todo-bd-sync/package.json +1 -1
  89. package/packages/token-estimation/package.json +1 -1
  90. package/packages/token-optimizer/package.json +1 -1
  91. package/packages/tui/package.json +1 -1
  92. package/packages/types/package.json +1 -1
  93. package/packages/workflow-events/package.json +1 -1
  94. package/packages/workspace-scanner/package.json +1 -1
  95. package/packages/worktree/package.json +1 -1
  96. package/packages/write-review/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.18](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.13...v1.1.18) (2026-08-24)
6
+
7
+
8
+ ### Features
9
+
10
+ * **glm-quota:** add robust GLM quota countdown with auto-resume ([cb78a2b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cb78a2bdf5ecf79fc028030d43e3ce40767253cb))
11
+ * **glm:** add structured logging for GLM quota events ([09e692e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/09e692ec17b9c21a448c72f081d18fb35b8636ae))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **glm:** improve footer status display with specific 5h quota and reset time ([ab991c3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ab991c329bdb4097e77503d3d7f574edc6cdc1c4))
17
+
18
+ ### [1.1.17](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.13...v1.1.17) (2026-08-24)
19
+
20
+
21
+ ### Features
22
+
23
+ * **glm-quota:** add robust GLM quota countdown with auto-resume ([cb78a2b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cb78a2bdf5ecf79fc028030d43e3ce40767253cb))
24
+ * **glm:** add structured logging for GLM quota events ([09e692e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/09e692ec17b9c21a448c72f081d18fb35b8636ae))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **glm:** improve footer status display with specific 5h quota and reset time ([ab991c3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ab991c329bdb4097e77503d3d7f574edc6cdc1c4))
30
+
5
31
  ### [1.1.16](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.13...v1.1.16) (2026-08-24)
6
32
 
7
33
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pi Harness Runtime
2
2
 
3
- [![Beta](https://img.shields.io/badge/version-0.9.13-orange?style=for-the-badge)](https://github.com/ManotLuijiu/pi-harness-runtime)
3
+ [![Beta](https://img.shields.io/badge/version-1.1.16-orange?style=for-the-badge)](https://github.com/ManotLuijiu/pi-harness-runtime)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
5
5
  [![Platform](https://img.shields.io/badge/Platform-macOS%20|Linux-blue?style=for-the-badge)]()
6
6
 
@@ -171,8 +171,13 @@ pi-harness-runtime/
171
171
  | +-- blackboard.ts # Agent coordination
172
172
  | +-- context-window-manager.ts # Context tracking
173
173
  | +-- agent-handoff.ts # Clean agent transitions
174
+ | +-- auto-quota-resume.ts # 5h quota auto-resume scheduler
175
+ | +-- glm-quota-countdown.ts # GLM countdown + notifications
176
+ | +-- glm-quota-logger.ts # Structured GLM quota logging
177
+ | +-- notification-events.ts # LINE/mobile notifications
174
178
  | +-- e2e/
175
179
  | | +-- minimax-quota-scraper.ts # Playwright MiniMax scraper
180
+ | | +-- glm-quota-scraper.ts # GLM API quota scraper
176
181
  | | +-- playwright-runner.ts # Browser automation
177
182
  | +-- project-detector/
178
183
  | +-- detector.ts # Auto-detect project type
@@ -201,12 +206,14 @@ cancelled blocked waiting_human repairing ready_for_client
201
206
 
202
207
  - **Resumable**: Every state change is checkpointed to disk
203
208
  - **Quota-aware**: Detects quota exhaustion, pauses, resumes after reset
204
- - **Provider-agnostic**: MiniMax, OpenAI, Claude adapters
209
+ - **GLM Auto-Resume**: Parses 429 errors, countdown timer, notifications at 15/5/1 min, auto-resume before reset
210
+ - **Provider-agnostic**: MiniMax, OpenAI, GLM, Claude adapters
205
211
  - **Task DAG**: Dependencies tracked, topological execution
206
212
  - **Auto-repair**: Failure classification + retry with exponential backoff
207
213
  - **E2E testing**: Scenario-based Playwright integration (coming soon)
208
214
  - **Project detection**: Auto-detects Frappe, Next.js, React, Django, Laravel
209
215
  - **Per-provider mirror**: Each LLM provider maintains its own quota record
216
+ - **Structured logging**: GLM quota events logged to `~/.pi/harness-logs/glm-quota.log`
210
217
 
211
218
  ## Data Directory
212
219
 
@@ -219,12 +226,15 @@ All data stored locally in `~/.pi/`:
219
226
  | +-- mirror.json # per-provider quota mirror
220
227
  +-- harness/ # /harness data
221
228
  | +-- jobs/
222
- | +-- <job-id>/
223
- | +-- checkpoint.json
224
- | +-- events.jsonl
225
- | +-- task-graph.json
226
- | +-- blackboard/
227
- | +-- repair-tasks.jsonl
229
+ | | +-- <job-id>/
230
+ | | +-- checkpoint.json
231
+ | | +-- events.jsonl
232
+ | | +-- task-graph.json
233
+ | | +-- blackboard/
234
+ | | +-- repair-tasks.jsonl
235
+ | +-- inbox/ # task inbox (RFC-0101)
236
+ +-- harness-logs/ # GLM quota logs
237
+ | +-- glm-quota.log # countdown, auto-resume, notifications
228
238
  +-- okf/ # (optional) Your custom OKF knowledge
229
239
  ```
230
240
 
@@ -269,7 +279,7 @@ See `packages/context-compiler/` for how OKF concepts are loaded.
269
279
  ## Testing
270
280
 
271
281
  ```bash
272
- bun test # 131+ tests passing
282
+ bun test # ~1500+ tests across harness and packages
273
283
  ```
274
284
 
275
285
  ## Automatic Quota Fetching
@@ -277,7 +287,7 @@ bun test # 131+ tests passing
277
287
  Quota data is automatically surfaced per-provider:
278
288
 
279
289
  | Provider | Source | Notes |
280
- |---|---|---|
290
+ | --- | --- | --- |
281
291
  | MiniMax | Live cookie-file watch + Playwright scrape | Drop folder: `~/.pi-harness-runtime/cookies/` |
282
292
  | OpenAI / OpenAI Codex | TUI message capture | Signal on first limit hit |
283
293
  | GLM (Z.ai / Zhipu) | TUI message capture | Signal on first limit hit |
@@ -288,11 +298,59 @@ Quota data is automatically surfaced per-provider:
288
298
  The footer line carries the provider label, so you always know which LLM the data is from:
289
299
 
290
300
  ```
291
- MiniMax: 5h: 92% left · week: 80% left # continuous (cookie scrape)
301
+ MiniMax: 5h: 92% left · week: 80% left # continuous (cookie scrape)
292
302
  OpenAI: 5h: -- · week: -- (no signal yet) # pending first limit hit
293
- GLM: limit hit (tokens), reset 2026-07-23T17:28:00Z # TUI signal observed
294
- MiniMax: cookies not found drop any cookie file into
295
- ~/.pi-harness-runtime/cookies/
303
+ GLM: 5h quota hit, resets Aug 25 01:47 # TUI signal with countdown
304
+ GLM: 4h 32m (5h quota) # active countdown
305
+ ```
306
+
307
+ ### GLM Auto-Resume with Countdown
308
+
309
+ When GLM 5h quota is exhausted (429 error), the runtime:
310
+
311
+ 1. **Parses the reset time** from the error message (e.g., `"reset at 2026-08-25 01:47:16"`)
312
+ 2. **Starts a countdown timer** showing time until reset
313
+ 3. **Sends notifications** at 15min, 5min, and 1min before reset
314
+ 4. **Auto-resumes** the job 10 seconds before reset time
315
+ 5. **Logs all events** to `~/.pi/harness-logs/glm-quota.log`
316
+
317
+ #### Log File Location
318
+
319
+ ```bash
320
+ ~/.pi/harness-logs/glm-quota.log
321
+ ```
322
+
323
+ #### Log Levels
324
+
325
+ | Level | Events |
326
+ | ------- | -------- |
327
+ | `INFO` | Countdown started, ticks, resume triggered, notifications sent |
328
+ | `WARN` | Notification failed, mirror update failed, parse error |
329
+ | `ERROR` | Auto-resume failed, critical errors |
330
+
331
+ #### Log Format
332
+
333
+ ```
334
+ [2026-08-25T01:47:00.000Z] [INFO] [job-001] Countdown started: 4h 32m until 2026-08-25T06:19:00.000Z
335
+ [2026-08-25T01:48:00.000Z] [INFO] [job-001] Notification sent: 15 minutes before reset
336
+ [2026-08-25T06:18:50.000Z] [INFO] [job-001] Countdown complete, triggering auto-resume
337
+ [2026-08-25T06:18:51.000Z] [INFO] [job-001] Auto-resume succeeded, job resumed
338
+ ```
339
+
340
+ #### View Logs
341
+
342
+ ```bash
343
+ # Tail the log in real-time
344
+ tail -f ~/.pi/harness-logs/glm-quota.log
345
+
346
+ # View recent entries
347
+ tail -50 ~/.pi/harness-logs/glm-quota.log
348
+
349
+ # Filter by job
350
+ grep "job-001" ~/.pi/harness-logs/glm-quota.log
351
+
352
+ # Filter by errors only
353
+ grep "\[ERROR\]" ~/.pi/harness-logs/glm-quota.log
296
354
  ```
297
355
 
298
356
  ### MiniMax Setup (one-time)
@@ -368,7 +426,7 @@ Your local machine clipboard
368
426
  ### Files
369
427
 
370
428
  | File | Purpose |
371
- |------|---------|
429
+ | ------ | --------- |
372
430
  | `config.toml.example` | Template for `~/.config/herdr/config.toml` |
373
431
  | `~/.herdr-clipboard` | Bridge file between herdr and clipboard |
374
432
  | `~/.config/herdr/plugins/moocoding.clipboard-bridge/` | herdr plugin |
@@ -427,11 +485,11 @@ Push notification sent to your LINE app
427
485
  #### Supported Events
428
486
 
429
487
  | Event | Emoji | Description |
430
- |-------|-------|-------------|
488
+ | ------- | ------- | ------------- |
431
489
  | `JobStarted` | 🚀 | Job execution started |
432
490
  | `TaskCompleted` | ✅ | Task completed successfully |
433
491
  | `TaskFailed` | ❌ | Task failed with error |
434
- | `QuotaPaused` | ⏸️ | Quota limit reached, paused |
492
+ | `QuotaPaused` | ⏸️ | Quota limit reached, countdown started, auto-resume pending |
435
493
  | `ResumeScheduled` | ▶️ | Resume scheduled |
436
494
  | `ContextCompacted` | 📦 | Context window compacted |
437
495
  | `OutputLimitContinued` | 🔄 | Output limit exceeded, continued |
@@ -489,7 +547,7 @@ MIT © 2026 MooCoding
489
547
  The project tracks 101 design documents:
490
548
 
491
549
  | RFC | Title | Status |
492
- |-----|-------|--------|
550
+ | ----- | ------- | -------- |
493
551
  | 0001–0034 | Loop Runtime, Provider Adapter, Quota Manager, Playwright, Git Worktree, Checkpoint, Scheduler, Provider Router, Shared Context, Context Window Manager, Shared Blackboard, Agent Handoff, E2E Test Engine, Project Detector, Job State Machine, Task Graph, Master Planner, Repair Engine, Auto Compact & Continue, Output Token Limit, Partial Response Recovery, Notification Center, Local Browser Agent, Local Runtime Agent, Command Executor, Workspace Manager, Runtime API, Policy Engine, DeepAgents Adapter, Agent Worker Interface, Provider Adapter SDK, Checkpoint Engine, Session Manager | Proposed |
494
552
  | 0035–0100 | Observability, Roadmap V1, Code Review, Code Generation, Framework Detector, Test Data Generator, Framework Plugin SDK, Prompt Compiler, Context Compiler, Requirement Compiler, Task Compiler, Project Analyzer, Dependency Analyzer, Repo Knowledge Graph, Code Merge Engine, Conflict Resolution, Documentation Generator, Capability Registry, Skill Registry, Model Registry, Cost Optimizer, Performance Optimizer, Evaluation Engine, Learning Engine, Experience Replay, Memory Engine OKF, Frappe/Next.js/React/Django/Laravel/Generic Web Plugins, CLI Plugin SDK, MCP Adapter, A2A Adapter, Codex Adapter, Requirement Intake, Project Bootstrap, Architecture Generator, Sprint Planner, Milestone Manager, Backlog Manager, Human Approval Gate, Release Manager, Version Manager, Deployment Pipeline, Multi-User Runtime, RBAC, Audit Trail, Dashboard, Analytics, Distributed Runtime, Cluster Manager, Runtime Federation, High Availability, Disaster Recovery, + 17 Autonomous Architectures | Proposed |
495
553
  | 0101 | [Autonomous Operations Runtime](RFC/0101_AUTONOMOUS_OPERATIONS_RUNTIME.md) — durable Task Inbox, Background Worker, Task Lease protocol, Privilege Broker, Approval Class policy engine, abstract Scheduler, Notification pipeline, Recovery semantics | Proposed |