pi-harness-runtime 0.9.5 → 0.9.6

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 (63) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/index.ts +45 -6
  3. package/package.json +1 -1
  4. package/packages/a2a-adapter/package.json +1 -1
  5. package/packages/auth/package.json +1 -1
  6. package/packages/autonomous-refactor/package.json +1 -1
  7. package/packages/cache-strategy/package.json +1 -1
  8. package/packages/capability-registry/package.json +1 -1
  9. package/packages/checkpoint/package.json +1 -1
  10. package/packages/cli-plugin-sdk/package.json +1 -1
  11. package/packages/code-generation/package.json +1 -1
  12. package/packages/code-review/package.json +1 -1
  13. package/packages/codex-adapter/package.json +1 -1
  14. package/packages/context-compiler/package.json +1 -1
  15. package/packages/context-manager/package.json +1 -1
  16. package/packages/cost-optimizer/package.json +1 -1
  17. package/packages/django-plugin/package.json +1 -1
  18. package/packages/doc-generator/package.json +1 -1
  19. package/packages/evaluation-engine/package.json +1 -1
  20. package/packages/evaluation-runner/package.json +1 -1
  21. package/packages/experience-replay/package.json +1 -1
  22. package/packages/feedback-collector/package.json +1 -1
  23. package/packages/framework-detector/package.json +1 -1
  24. package/packages/framework-plugin-sdk/package.json +1 -1
  25. package/packages/frappe-plugin/package.json +1 -1
  26. package/packages/generic-web-plugin/package.json +1 -1
  27. package/packages/health-monitor/package.json +1 -1
  28. package/packages/laravel-plugin/package.json +1 -1
  29. package/packages/learning-engine/package.json +1 -1
  30. package/packages/mcp-adapter/package.json +1 -1
  31. package/packages/memory-engine/package.json +1 -1
  32. package/packages/model-registry/package.json +1 -1
  33. package/packages/nextjs-plugin/package.json +1 -1
  34. package/packages/notification/package.json +1 -1
  35. package/packages/observability/package.json +1 -1
  36. package/packages/performance-optimizer/package.json +1 -1
  37. package/packages/project-analyzer/package.json +1 -1
  38. package/packages/prompt-compiler/package.json +1 -1
  39. package/packages/prompt-versioning/package.json +1 -1
  40. package/packages/provider-adapter-sdk/package.json +1 -1
  41. package/packages/provider-router/package.json +1 -1
  42. package/packages/provider-selector/package.json +1 -1
  43. package/packages/providers/package.json +1 -1
  44. package/packages/quota-manager/package.json +1 -1
  45. package/packages/rate-limiter/package.json +1 -1
  46. package/packages/react-vite-plugin/package.json +1 -1
  47. package/packages/release-manager/package.json +1 -1
  48. package/packages/requirement-compiler/package.json +1 -1
  49. package/packages/runtime/package.json +1 -1
  50. package/packages/scheduler/package.json +1 -1
  51. package/packages/session/package.json +1 -1
  52. package/packages/shared-context/package.json +1 -1
  53. package/packages/skill-registry/package.json +1 -1
  54. package/packages/sprint-planner/package.json +1 -1
  55. package/packages/task-compiler/package.json +1 -1
  56. package/packages/test-data-generator/package.json +1 -1
  57. package/packages/test-generator/package.json +1 -1
  58. package/packages/token-estimation/package.json +1 -1
  59. package/packages/token-optimizer/package.json +1 -1
  60. package/packages/tui/package.json +1 -1
  61. package/packages/types/package.json +1 -1
  62. package/packages/worktree/package.json +1 -1
  63. package/proactive-compact.ts +28 -6
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
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
+ ### [0.9.6](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.9.5...v0.9.6) (2026-07-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * harden auto-resume after compaction ([13378e8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/13378e852c984ead0e66f0adeffc073ff58af50c))
11
+
12
+ ### [0.9.3](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.5.0-beta.1...v0.9.3) (2026-07-14)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * auto-resume pi dev with literal resume ([#51](https://github.com/ManotLuijiu/pi-harness-runtime/issues/51)) ([fd98762](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fd987629f6062a4a7ff7a28d9dfb607962f5a4a9))
18
+
5
19
  ### [0.9.5](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.9.4...v0.9.5) (2026-07-15)
6
20
 
7
21
 
package/index.ts CHANGED
@@ -25,6 +25,7 @@ import { MiniMaxQuotaScraper } from "./harness/e2e/minimax-quota-scraper.js";
25
25
  import { parseMiniMaxQuotaText } from "./harness/e2e/minimax-quota-parser.js";
26
26
  import { buildFooterStatusValue } from "./footer-status.ts";
27
27
  import {
28
+ MAX_PROACTIVE_COMPACT_FAILURES,
28
29
  OUTPUT_LIMIT_RESUME_PROMPT,
29
30
  PROACTIVE_COMPACT_COOLDOWN_MS,
30
31
  shouldQueueOutputLimitResume,
@@ -109,7 +110,8 @@ export default function (pi: ExtensionAPI) {
109
110
  )
110
111
  ) {
111
112
  outputLimitResumeAttempts += 1;
112
- queueAutoResume("output-limit", OUTPUT_LIMIT_RESUME_PROMPT);
113
+ pendingOutputLimitResumeAfterCompact = true;
114
+ queueAutoResume("output-limit", OUTPUT_LIMIT_RESUME_PROMPT, "steer");
113
115
  } else if (m.stopReason === "stop") {
114
116
  outputLimitResumeAttempts = 0;
115
117
  }
@@ -141,7 +143,10 @@ export default function (pi: ExtensionAPI) {
141
143
  let quotaAutoFetchInFlight = false;
142
144
  let proactiveCompactInFlight = false;
143
145
  let lastProactiveCompactAt = 0;
146
+ let consecutiveCompactFailures = 0;
147
+ let proactiveCompactCircuitReported = false;
144
148
  let outputLimitResumeAttempts = 0;
149
+ let pendingOutputLimitResumeAfterCompact = false;
145
150
 
146
151
  function writeMirrorRecord(record: MirrorRecord): void {
147
152
  mirrorStore.write(record);
@@ -682,20 +687,42 @@ export default function (pi: ExtensionAPI) {
682
687
  footerStatusCtx = ctx;
683
688
  proactiveCompactInFlight = false;
684
689
  lastProactiveCompactAt = Date.now();
685
- outputLimitResumeAttempts = 0;
690
+ consecutiveCompactFailures = 0;
691
+ proactiveCompactCircuitReported = false;
686
692
  refreshFooterStatus(ctx, tracker, mirrorStore);
687
693
 
688
- if (!shouldQueuePostCompactionResume(event, ctx.hasPendingMessages())) {
694
+ const forceOutputLimitResume = pendingOutputLimitResumeAfterCompact;
695
+ pendingOutputLimitResumeAfterCompact = false;
696
+
697
+ if (
698
+ !shouldQueuePostCompactionResume(event, ctx.hasPendingMessages(), {
699
+ force: forceOutputLimitResume,
700
+ })
701
+ ) {
702
+ return;
703
+ }
704
+
705
+ if (forceOutputLimitResume) {
706
+ queueAutoResume(
707
+ "post-compact-output-limit",
708
+ OUTPUT_LIMIT_RESUME_PROMPT,
709
+ event.willRetry ? "steer" : "followUp",
710
+ );
689
711
  return;
690
712
  }
691
713
 
714
+ outputLimitResumeAttempts = 0;
692
715
  // pi.dev expects the literal "resume" command to continue after compaction.
693
- queueAutoResume("post-compact", "resume");
716
+ queueAutoResume("post-compact", "resume", "followUp");
694
717
  });
695
718
 
696
- function queueAutoResume(reason: string, content: string): void {
719
+ function queueAutoResume(
720
+ reason: string,
721
+ content: string,
722
+ deliverAs: "steer" | "followUp",
723
+ ): void {
697
724
  try {
698
- pi.sendUserMessage(content, { deliverAs: "followUp" });
725
+ pi.sendUserMessage(content, { deliverAs });
699
726
  } catch (error) {
700
727
  console.error(
701
728
  `[pi-harness] Failed to queue ${reason} auto-resume:`,
@@ -708,6 +735,15 @@ export default function (pi: ExtensionAPI) {
708
735
  if (proactiveCompactInFlight) {
709
736
  return;
710
737
  }
738
+ if (consecutiveCompactFailures >= MAX_PROACTIVE_COMPACT_FAILURES) {
739
+ if (!proactiveCompactCircuitReported) {
740
+ proactiveCompactCircuitReported = true;
741
+ console.error(
742
+ `[pi-harness] Proactive compact disabled after ${consecutiveCompactFailures} consecutive failures`,
743
+ );
744
+ }
745
+ return;
746
+ }
711
747
  if (!ctx.isIdle() || ctx.hasPendingMessages()) {
712
748
  return;
713
749
  }
@@ -728,9 +764,12 @@ export default function (pi: ExtensionAPI) {
728
764
  onComplete: () => {
729
765
  proactiveCompactInFlight = false;
730
766
  lastProactiveCompactAt = Date.now();
767
+ consecutiveCompactFailures = 0;
768
+ proactiveCompactCircuitReported = false;
731
769
  },
732
770
  onError: (error) => {
733
771
  proactiveCompactInFlight = false;
772
+ consecutiveCompactFailures += 1;
734
773
  console.error("[pi-harness] Proactive compact failed:", error.message);
735
774
  },
736
775
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-harness-runtime",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "[BETA] Codex-style /usage status + autonomous coding harness for pi. Not production ready — expect breaking changes.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/a2a-adapter",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Google Agent-to-Agent (A2A) protocol adapter for pi-harness",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/auth",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — auth",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/autonomous-refactor",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Autonomous refactoring engine",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/cache-strategy",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Smart caching with TTL and invalidation strategies (RFC-0022)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/capability-registry",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Capability Registry for pi-harness-runtime — tracks model capabilities and enables capability-based routing",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/checkpoint",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Enhanced checkpoint system with incremental snapshots, diff-based storage, and recovery strategies",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/cli-plugin-sdk",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "CLI Plugin SDK for pi-harness — install, list, remove, update, invoke plugins",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/code-generation",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Code generation pipeline for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/code-review",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Automated code review engine for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/codex-adapter",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "OpenAI Codex provider adapter for pi-harness",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/context-compiler",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Bounded context selection engine for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/context-manager",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Context Window Manager — prevents model context overflow via compaction and resume prompts (RFC-0010)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/cost-optimizer",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Cost Optimizer for pi-harness-runtime — budget tracking, forecasting, and model selection optimization",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/django-plugin",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Django framework analysis — models, management commands, settings",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/doc-generator",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Auto-Doc Generator — generate documentation from source code (RFC-0014)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/evaluation-engine",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Evaluation engine for pi-harness runtime (RFC-0057)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/evaluation-runner",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Framework-agnostic evaluation framework for AI outputs (RFC-0020)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/experience-replay",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Experience replay for debugging and reproducibility (RFC-0059)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/feedback-collector",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Collect and aggregate human/automated feedback (RFC-0021)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/framework-detector",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Framework detection system for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/framework-plugin-sdk",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Framework plugin SDK for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/frappe-plugin",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Frappe/ERPNext framework analysis — DocTypes, hooks, bench sites, site config",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/generic-web-plugin",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Generic web framework analysis — REST/GraphQL endpoints, OpenAPI, auth",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/health-monitor",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Health monitoring and auto-healing",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/laravel-plugin",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Laravel framework analysis — artisan commands, Eloquent models, Blade",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/learning-engine",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Learning engine for extracting lessons from runtime execution (RFC-0058)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/mcp-adapter",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "MCP server adapter for pi-harness — exposes harness capabilities as MCP tools/resources/prompts (RFC-0068)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/memory-engine",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Memory engine with OKF integration for durable knowledge management (RFC-0060)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/model-registry",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Model Registry for pi-harness-runtime — centralized model metadata with pricing",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/nextjs-plugin",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Next.js framework detection and analysis for pi-harness-runtime (RFC-0062)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/notification",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — notification",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/observability",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Comprehensive observability system with structured logging, tracing, metrics, and alerting",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/performance-optimizer",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Performance optimization analyzer for pi-harness runtime (RFC-0056)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/project-analyzer",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Project analysis system for pi-harness-runtime - detects frameworks, rules, and project structure",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/prompt-compiler",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Deterministic prompt compiler for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/prompt-versioning",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Version control for prompts with rollback support (RFC-0019)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/provider-adapter-sdk",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "SDK for building, testing, and registering AI provider adapters",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/provider-router",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Enhanced Provider Router for pi-harness-runtime — intelligent routing with capabilities, costs, and quotas",
5
5
  "type": "module",
6
6
  "main": "./dist/provider-router.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/provider-selector",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Multi-Provider Selector — route requests by cost, quality, and latency (RFC-0012)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/providers",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — providers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/quota-manager",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — quota-manager",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/rate-limiter",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Rate limiting with token bucket algorithm (RFC-0023)",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/react-vite-plugin",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "React/Vite framework analysis — components, config, TypeScript setup",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/release-manager",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Release management for pi-harness",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/requirement-compiler",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Compiles raw requirements into validated CompiledRequirement with ambiguity detection and risk tagging",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/runtime",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/scheduler",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — scheduler",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/session",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Session management system for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/shared-context",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — shared-context",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/skill-registry",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Skill Registry for pi-harness-runtime — dynamic skill discovery and invocation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/sprint-planner",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "description": "Sprint planning engine for pi-harness",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/task-compiler",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Task Compiler for pi-harness-runtime — produces deterministic task DAG from CompiledRequirement",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/test-data-generator",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Test data generation for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/test-generator",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Auto-Test Generator — generate unit and E2E tests from source code (RFC-0013)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-estimation",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — token-estimation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-optimizer",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Token Budget Optimizer — maximize prompt value within token limits (RFC-0011)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/tui",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — tui",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/types",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Shared TypeScript types for pi-harness-runtime packages",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/worktree",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "pi-harness-runtime — worktree",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,20 +1,32 @@
1
1
  import type { ContextUsage } from "@earendil-works/pi-coding-agent";
2
2
 
3
3
  export const PROACTIVE_COMPACT_THRESHOLD = 0.9;
4
+ export const PROACTIVE_COMPACT_HEADROOM_TOKENS = 15_000;
4
5
  export const PROACTIVE_COMPACT_COOLDOWN_MS = 10 * 60 * 1000;
6
+ export const MAX_PROACTIVE_COMPACT_FAILURES = 3;
5
7
  export const OUTPUT_LIMIT_AUTO_RESUME_LIMIT = 3;
6
8
  export const OUTPUT_LIMIT_RESUME_PROMPT =
7
9
  "Output token limit hit. Resume directly — no apology, no recap. Pick up mid-thought if the cut happened there. Break remaining work into smaller pieces.";
8
10
 
9
11
  export function shouldTriggerProactiveCompact(
10
12
  usage: ContextUsage | undefined,
11
- options?: { threshold?: number },
13
+ options?: { threshold?: number; headroomTokens?: number },
12
14
  ): boolean {
13
- const threshold = options?.threshold ?? PROACTIVE_COMPACT_THRESHOLD;
14
- if (!usage || usage.percent === null) {
15
+ if (!usage) {
15
16
  return false;
16
17
  }
17
- return usage.percent >= threshold;
18
+
19
+ const headroomTokens =
20
+ options?.headroomTokens ?? PROACTIVE_COMPACT_HEADROOM_TOKENS;
21
+ if (
22
+ usage.tokens !== null &&
23
+ usage.contextWindow - usage.tokens <= headroomTokens
24
+ ) {
25
+ return true;
26
+ }
27
+
28
+ const threshold = options?.threshold ?? PROACTIVE_COMPACT_THRESHOLD;
29
+ return usage.percent !== null && usage.percent >= threshold;
18
30
  }
19
31
 
20
32
  export type AssistantStopLike = {
@@ -61,8 +73,18 @@ export function shouldQueueOutputLimitResume(
61
73
  }
62
74
 
63
75
  export function shouldQueuePostCompactionResume(
64
- event: { willRetry?: boolean },
76
+ event: {
77
+ willRetry?: boolean;
78
+ reason?: "manual" | "threshold" | "overflow" | string;
79
+ },
65
80
  hasPendingMessages: boolean,
81
+ options?: { force?: boolean },
66
82
  ): boolean {
67
- return event.willRetry !== true && !hasPendingMessages;
83
+ if (event.reason === "manual" && options?.force !== true) {
84
+ return false;
85
+ }
86
+
87
+ return (
88
+ (options?.force === true || event.willRetry !== true) && !hasPendingMessages
89
+ );
68
90
  }