pi-harness-runtime 1.1.280 → 1.1.281

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 (105) hide show
  1. package/package.json +1 -1
  2. package/packages/a2a-adapter/package.json +1 -1
  3. package/packages/agent-policy/package.json +1 -1
  4. package/packages/architecture-generator/package.json +1 -1
  5. package/packages/auth/package.json +1 -1
  6. package/packages/autonomous-refactor/package.json +1 -1
  7. package/packages/autonomous-runtime/package.json +1 -1
  8. package/packages/cache-strategy/package.json +1 -1
  9. package/packages/capability-registry/package.json +1 -1
  10. package/packages/checkpoint/package.json +1 -1
  11. package/packages/cli-plugin-sdk/package.json +1 -1
  12. package/packages/clipboard/package.json +1 -1
  13. package/packages/clipboard-plugin/package.json +1 -1
  14. package/packages/code-generation/package.json +1 -1
  15. package/packages/code-review/package.json +1 -1
  16. package/packages/codex-adapter/package.json +1 -1
  17. package/packages/codex-watcher/package.json +1 -1
  18. package/packages/config-capture/package.json +1 -1
  19. package/packages/context-compiler/package.json +1 -1
  20. package/packages/context-discovery/package.json +1 -1
  21. package/packages/context-manager/package.json +1 -1
  22. package/packages/cookie-sanitizer/package.json +1 -1
  23. package/packages/cost-optimizer/package.json +1 -1
  24. package/packages/dependency-analyzer/package.json +1 -1
  25. package/packages/django-plugin/package.json +1 -1
  26. package/packages/doc-generator/package.json +1 -1
  27. package/packages/e2e-tester/package.json +1 -1
  28. package/packages/evaluation-engine/package.json +1 -1
  29. package/packages/evaluation-runner/package.json +1 -1
  30. package/packages/event-bus/package.json +1 -1
  31. package/packages/event-store/package.json +1 -1
  32. package/packages/experience-replay/package.json +1 -1
  33. package/packages/feedback-collector/package.json +1 -1
  34. package/packages/file-copy-helper/package.json +1 -1
  35. package/packages/framework-detector/package.json +1 -1
  36. package/packages/framework-plugin-sdk/package.json +1 -1
  37. package/packages/frappe-plugin/package.json +1 -1
  38. package/packages/generic-web-plugin/package.json +1 -1
  39. package/packages/health-monitor/package.json +1 -1
  40. package/packages/intent-analyzer/package.json +1 -1
  41. package/packages/jev-judge/package.json +1 -1
  42. package/packages/knowledge-graph/package.json +1 -1
  43. package/packages/knowledge-retrieval/package.json +1 -1
  44. package/packages/laravel-plugin/package.json +1 -1
  45. package/packages/learning-engine/package.json +1 -1
  46. package/packages/mcp-adapter/package.json +1 -1
  47. package/packages/memory-engine/package.json +1 -1
  48. package/packages/milestone-manager/package.json +1 -1
  49. package/packages/model-registry/package.json +1 -1
  50. package/packages/nextjs-plugin/package.json +1 -1
  51. package/packages/notification/package.json +1 -1
  52. package/packages/observability/package.json +1 -1
  53. package/packages/okf-indexer/package.json +1 -1
  54. package/packages/paperclip-integration/package.json +1 -1
  55. package/packages/performance-optimizer/package.json +1 -1
  56. package/packages/privilege-broker/package.json +1 -1
  57. package/packages/project-analyzer/package.json +1 -1
  58. package/packages/project-bootstrap/package.json +1 -1
  59. package/packages/projection-engine/package.json +1 -1
  60. package/packages/prompt-compiler/package.json +1 -1
  61. package/packages/prompt-versioning/package.json +1 -1
  62. package/packages/provider-adapter-sdk/package.json +1 -1
  63. package/packages/provider-router/package.json +1 -1
  64. package/packages/provider-selector/package.json +1 -1
  65. package/packages/providers/package.json +1 -1
  66. package/packages/qdrant-skills/package.json +1 -1
  67. package/packages/quota-manager/package.json +1 -1
  68. package/packages/rate-limiter/package.json +1 -1
  69. package/packages/react-vite-plugin/package.json +1 -1
  70. package/packages/release-manager/package.json +1 -1
  71. package/packages/requirement-compiler/package.json +1 -1
  72. package/packages/runtime/package.json +1 -1
  73. package/packages/scheduler/package.json +1 -1
  74. package/packages/scheduler-adapter/package.json +1 -1
  75. package/packages/session/package.json +1 -1
  76. package/packages/session-api/package.json +1 -1
  77. package/packages/session-export/package.json +1 -1
  78. package/packages/shared-context/package.json +1 -1
  79. package/packages/skill-mcp-client/package.json +1 -1
  80. package/packages/skill-registry/package.json +1 -1
  81. package/packages/skills/package.json +1 -1
  82. package/packages/sprint-planner/package.json +1 -1
  83. package/packages/subscription-engine/package.json +1 -1
  84. package/packages/task-compiler/package.json +1 -1
  85. package/packages/telegram/package.json +1 -1
  86. package/packages/tencentdb-memory/package.json +1 -1
  87. package/packages/tencentdb-sync/package.json +1 -1
  88. package/packages/test-data-generator/package.json +1 -1
  89. package/packages/test-generator/package.json +1 -1
  90. package/packages/todo-bd-sync/package.json +1 -1
  91. package/packages/token-estimation/package.json +1 -1
  92. package/packages/token-optimizer/package.json +1 -1
  93. package/packages/trajectory/dist/src/memory-curator.d.ts +65 -0
  94. package/packages/trajectory/dist/src/memory-curator.d.ts.map +1 -0
  95. package/packages/trajectory/dist/src/memory-curator.js +157 -0
  96. package/packages/trajectory/dist/src/memory-curator.js.map +1 -0
  97. package/packages/trajectory/package.json +1 -1
  98. package/packages/trajectory/src/memory-curator.ts +223 -0
  99. package/packages/tui/package.json +1 -1
  100. package/packages/types/package.json +1 -1
  101. package/packages/webmcp-tester/package.json +1 -1
  102. package/packages/workflow-events/package.json +1 -1
  103. package/packages/workspace-scanner/package.json +1 -1
  104. package/packages/worktree/package.json +1 -1
  105. package/packages/write-review/package.json +1 -1
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Memory Curator - Autonomous self-improvement for MEMORY.md
3
+ *
4
+ * Uses Jev to judge:
5
+ * 1. Is this a stable fact worth adding to MEMORY.md?
6
+ * 2. Is anything in MEMORY.md stale/outdated?
7
+ *
8
+ * Based on Hermes Agent's self-improvement pattern.
9
+ */
10
+
11
+ import { existsSync, readFileSync } from "node:fs";
12
+ import { join } from "node:path";
13
+ import { homedir } from "node:os";
14
+
15
+ /**
16
+ * Configuration for autonomous curation
17
+ */
18
+ export interface MemoryCuratorConfig {
19
+ /** Jev API key */
20
+ apiKey: string;
21
+ /** Jev confidence threshold for auto-add (default: 0.85) */
22
+ autoAddThreshold?: number;
23
+ /** Jev confidence threshold for auto-remove (default: 0.7) */
24
+ autoRemoveThreshold?: number;
25
+ /** Minimum entries before pruning (default: 5) */
26
+ minEntriesForPrune?: number;
27
+ /** Check interval in ms (default: 30 minutes) */
28
+ checkIntervalMs?: number;
29
+ /** Max facts to propose per check (default: 2) */
30
+ maxProposalsPerCheck?: number;
31
+ }
32
+
33
+ const DEFAULT_CONFIG = {
34
+ autoAddThreshold: 0.85,
35
+ autoRemoveThreshold: 0.7,
36
+ minEntriesForPrune: 5,
37
+ checkIntervalMs: 30 * 60 * 1000,
38
+ maxProposalsPerCheck: 2,
39
+ };
40
+
41
+ /**
42
+ * Result of a curation check
43
+ */
44
+ export interface CurationResult {
45
+ added: string[];
46
+ removed: number;
47
+ errors: string[];
48
+ timestamp: number;
49
+ }
50
+
51
+ /**
52
+ * Jev decision response
53
+ */
54
+ interface JevDecision {
55
+ noul?: number;
56
+ choice?: string;
57
+ action?: string;
58
+ }
59
+
60
+ /**
61
+ * Simple OpenAI-compatible API call for Jev decisions
62
+ */
63
+ async function callJev(
64
+ apiKey: string,
65
+ prompt: string
66
+ ): Promise<JevDecision> {
67
+ const systemPrompt = "You are a memory curator. Evaluate facts and respond with confidence scores. Reply with JSON: {\"noul\": 0.0-1.0, \"action\": \"keep\" or \"remove\"}";
68
+
69
+ const response = await fetch("https://api.typesafe.ai/v1/chat/completions", {
70
+ method: "POST",
71
+ headers: {
72
+ "Content-Type": "application/json",
73
+ "Authorization": `Bearer ${apiKey}`,
74
+ },
75
+ body: JSON.stringify({
76
+ model: "system-one",
77
+ messages: [
78
+ { role: "system", content: systemPrompt },
79
+ { role: "user", content: prompt },
80
+ ],
81
+ temperature: 0.1,
82
+ }),
83
+ });
84
+
85
+ if (!response.ok) {
86
+ throw new Error(`Jev API error: ${response.status}`);
87
+ }
88
+
89
+ const data = await response.json() as { choices?: Array<{ message?: { content?: string } }> };
90
+ const text = data.choices?.[0]?.message?.content ?? "";
91
+
92
+ try {
93
+ return JSON.parse(text) as JevDecision;
94
+ } catch {
95
+ return { noul: 0, action: "keep" };
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Memory Curator - Autonomous curation using Jev
101
+ */
102
+ export class MemoryCurator {
103
+ private config: Required<MemoryCuratorConfig>;
104
+ private timer: ReturnType<typeof setInterval> | null = null;
105
+ private lastCheck = 0;
106
+ private _disposed = false;
107
+ private memoryFile: string;
108
+
109
+ constructor(config: MemoryCuratorConfig) {
110
+ this.config = { ...DEFAULT_CONFIG, ...config };
111
+ const memDir = join(homedir(), ".pi-harness", "memory");
112
+ this.memoryFile = join(memDir, "MEMORY.md");
113
+ }
114
+
115
+ /**
116
+ * Start autonomous curation cycle
117
+ */
118
+ start(): void {
119
+ if (this._disposed) return;
120
+
121
+ void this.runCuration();
122
+
123
+ this.timer = setInterval(() => {
124
+ void this.runCuration();
125
+ }, this.config.checkIntervalMs);
126
+ }
127
+
128
+ /**
129
+ * Stop autonomous curation
130
+ */
131
+ stop(): void {
132
+ if (this.timer) {
133
+ clearInterval(this.timer);
134
+ this.timer = null;
135
+ }
136
+ this._disposed = true;
137
+ }
138
+
139
+ /**
140
+ * Run one curation cycle
141
+ */
142
+ async runCuration(): Promise<CurationResult> {
143
+ const result: CurationResult = {
144
+ added: [],
145
+ removed: 0,
146
+ errors: [],
147
+ timestamp: Date.now(),
148
+ };
149
+
150
+ if (this._disposed) {
151
+ return result;
152
+ }
153
+
154
+ try {
155
+ if (Date.now() - this.lastCheck < this.config.checkIntervalMs / 2) {
156
+ return result;
157
+ }
158
+ this.lastCheck = Date.now();
159
+
160
+ if (!existsSync(this.memoryFile)) {
161
+ return result;
162
+ }
163
+
164
+ const content = readFileSync(this.memoryFile, "utf-8");
165
+ const entries = this.parseEntries(content);
166
+
167
+ for (const entry of entries) {
168
+ try {
169
+ const decision = await callJev(
170
+ this.config.apiKey,
171
+ `Memory Entry: "${entry}"
172
+
173
+ Is this memory entry still relevant and accurate for future sessions?
174
+ Consider:
175
+ - Has the project/tool changed since this was added?
176
+ - Is this a preference that may have changed?
177
+
178
+ Respond with JSON: {"noul": 0.0-1.0, "action": "keep" or "remove"}`
179
+ );
180
+
181
+ const staleConf = decision.noul ?? 0;
182
+
183
+ if (staleConf >= this.config.autoRemoveThreshold && decision.action === "remove") {
184
+ result.removed++;
185
+ }
186
+ } catch (err) {
187
+ result.errors.push(`Eval error: ${err}`);
188
+ }
189
+ }
190
+
191
+ } catch (err) {
192
+ result.errors.push(String(err));
193
+ }
194
+
195
+ return result;
196
+ }
197
+
198
+ /**
199
+ * Parse entries from MEMORY.md
200
+ */
201
+ private parseEntries(content: string): string[] {
202
+ const entries: string[] = [];
203
+ const lines = content.split("\n");
204
+
205
+ for (const line of lines) {
206
+ const trimmed = line.trim();
207
+ const match = trimmed.match(/^[-*]\s+(?:\[.+\]\s+)?(.+)/);
208
+ if (match) {
209
+ entries.push(match[1]);
210
+ }
211
+ }
212
+
213
+ return entries;
214
+ }
215
+
216
+ isRunning(): boolean {
217
+ return this.timer !== null && !this._disposed;
218
+ }
219
+
220
+ getLastCheck(): number {
221
+ return this.lastCheck;
222
+ }
223
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/tui",
3
- "version": "1.1.280",
3
+ "version": "1.1.281",
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": "1.1.280",
3
+ "version": "1.1.281",
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/webmcp-tester",
3
- "version": "1.1.280",
3
+ "version": "1.1.281",
4
4
  "description": "WebMCP-powered E2E testing for pi-harness - natural language test scenarios",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/workflow-events",
3
- "version": "1.1.280",
3
+ "version": "1.1.281",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/workspace-scanner",
3
- "version": "1.1.280",
3
+ "version": "1.1.281",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/worktree",
3
- "version": "1.1.280",
3
+ "version": "1.1.281",
4
4
  "description": "pi-harness-runtime — worktree",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/write-review",
3
- "version": "1.1.280",
3
+ "version": "1.1.281",
4
4
  "description": "Two-agent write-review loop with blackboard coordination",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",