pi-harness-runtime 0.10.23 → 0.10.25

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 (58) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/package.json +1 -1
  3. package/packages/file-copy-helper/src/extension.js +98 -0
  4. package/packages/file-copy-helper/src/extension.ts +60 -12
  5. package/packages/todo-bd-sync/dist/src/detector.js +108 -0
  6. package/packages/todo-bd-sync/src/detector.ts +1 -1
  7. package/packages/auth/src/minimax-browser-auth.js +0 -889
  8. package/packages/capability-registry/src/types.js +0 -10
  9. package/packages/checkpoint/src/checkpoint-manager.js +0 -29
  10. package/packages/clipboard/src/copy-sync.js +0 -169
  11. package/packages/clipboard/src/gist-relay.js +0 -185
  12. package/packages/clipboard/src/github-login.js +0 -68
  13. package/packages/config-capture/src/index.js +0 -268
  14. package/packages/cookie-sanitizer/src/atomic-write.js +0 -66
  15. package/packages/cookie-sanitizer/src/detect-format.js +0 -87
  16. package/packages/cookie-sanitizer/src/index.js +0 -38
  17. package/packages/cookie-sanitizer/src/infer-provider.js +0 -95
  18. package/packages/cookie-sanitizer/src/normalize.js +0 -74
  19. package/packages/cookie-sanitizer/src/parse-json.js +0 -107
  20. package/packages/cookie-sanitizer/src/parse-netscape.js +0 -98
  21. package/packages/cookie-sanitizer/src/sync.js +0 -268
  22. package/packages/cookie-sanitizer/src/types.js +0 -12
  23. package/packages/cookie-sanitizer/src/watcher.js +0 -147
  24. package/packages/evaluation-engine/src/engine.js +0 -343
  25. package/packages/evaluation-engine/src/index.js +0 -7
  26. package/packages/evaluation-engine/src/types.js +0 -14
  27. package/packages/event-store/src/types.js +0 -5
  28. package/packages/experience-replay/src/index.js +0 -6
  29. package/packages/experience-replay/src/replay.js +0 -228
  30. package/packages/experience-replay/src/types.js +0 -6
  31. package/packages/learning-engine/src/engine.js +0 -294
  32. package/packages/learning-engine/src/index.js +0 -7
  33. package/packages/learning-engine/src/types.js +0 -63
  34. package/packages/memory-engine/src/engine.js +0 -507
  35. package/packages/memory-engine/src/index.js +0 -7
  36. package/packages/memory-engine/src/types.js +0 -39
  37. package/packages/model-registry/src/types.js +0 -5
  38. package/packages/performance-optimizer/src/index.js +0 -6
  39. package/packages/performance-optimizer/src/optimizer.js +0 -304
  40. package/packages/performance-optimizer/src/types.js +0 -6
  41. package/packages/projection-engine/src/types.js +0 -5
  42. package/packages/providers/src/provider-id.js +0 -112
  43. package/packages/quota-manager/src/quota-manager.js +0 -259
  44. package/packages/quota-manager/src/tui-usage-monitor.js +0 -267
  45. package/packages/todo-bd-sync/src/detector.js +0 -131
  46. package/packages/todo-bd-sync/src/extension.js +0 -104
  47. package/packages/todo-bd-sync/src/sync.js +0 -289
  48. package/packages/todo-bd-sync/src/task-analyzer.js +0 -239
  49. package/packages/todo-bd-sync/src/types.js +0 -66
  50. package/packages/token-estimation/src/index.js +0 -114
  51. package/packages/workflow-events/src/types.js +0 -5
  52. package/packages/write-review/src/blackboard.js +0 -228
  53. package/packages/write-review/src/gate.js +0 -137
  54. package/packages/write-review/src/index.js +0 -17
  55. package/packages/write-review/src/injection.js +0 -141
  56. package/packages/write-review/src/review.js +0 -153
  57. package/packages/write-review/src/trigger.js +0 -106
  58. package/packages/write-review/src/types.js +0 -25
package/CHANGELOG.md CHANGED
@@ -2,6 +2,45 @@
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.10.25](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.25) (2026-08-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * **file-copy-helper:** inject cp rule when user asks to mimic/copy files ([f089f0d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f089f0d5e3e933231c99ee38cf18fa208c8eb8b2))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * align TS formatting with main (remove 3-line logError) ([2515ad5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2515ad54f43f0566123c686d3ec4f92ad363ea13))
16
+ * correct import paths for notification-center dist files ([f248722](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f24872240c07bf115f69530a3bdabedf73e3c858))
17
+ * **file-copy-helper:** strengthen rule - agent must NOT read source files before copying ([5bbf7f7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5bbf7f70f19213f4e08059aa3766301d5966daa8))
18
+ * handle array/object content in pi-usage-status build detection ([68b07a8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/68b07a8e8167a95ab1b519782a07ec3a582eec5a))
19
+ * skip publish-time scripts in release workflow ([b385148](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b38514835dc3f6fd717ca8c71dbb6d131de4887f))
20
+ * suppress noisy stack traces in harness agents ([34bbe98](https://github.com/ManotLuijiu/pi-harness-runtime/commit/34bbe98f59e740fcfcd8622f1dcc09c379f6f3df))
21
+ * **todo-bd-sync:** disable auto-injection completely - was causing noisy output ([699d6de](https://github.com/ManotLuijiu/pi-harness-runtime/commit/699d6de5e7f3b062799a0f791b386d1ecd452b00))
22
+ * **todo-bd-sync:** silence all console output - no startup warnings ([2d29bcf](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2d29bcf51b25fe1b1253aa965e370852f3cae289))
23
+ * update bd install URL to correct repo ([5800f30](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5800f304913912a84c34d3f42a29b01bb2d87b24))
24
+
25
+ ### [0.10.24](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.24) (2026-08-09)
26
+
27
+
28
+ ### Features
29
+
30
+ * **file-copy-helper:** inject cp rule when user asks to mimic/copy files ([f089f0d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f089f0d5e3e933231c99ee38cf18fa208c8eb8b2))
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * align TS formatting with main (remove 3-line logError) ([2515ad5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2515ad54f43f0566123c686d3ec4f92ad363ea13))
36
+ * correct import paths for notification-center dist files ([f248722](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f24872240c07bf115f69530a3bdabedf73e3c858))
37
+ * handle array/object content in pi-usage-status build detection ([68b07a8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/68b07a8e8167a95ab1b519782a07ec3a582eec5a))
38
+ * skip publish-time scripts in release workflow ([b385148](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b38514835dc3f6fd717ca8c71dbb6d131de4887f))
39
+ * suppress noisy stack traces in harness agents ([34bbe98](https://github.com/ManotLuijiu/pi-harness-runtime/commit/34bbe98f59e740fcfcd8622f1dcc09c379f6f3df))
40
+ * **todo-bd-sync:** disable auto-injection completely - was causing noisy output ([699d6de](https://github.com/ManotLuijiu/pi-harness-runtime/commit/699d6de5e7f3b062799a0f791b386d1ecd452b00))
41
+ * **todo-bd-sync:** silence all console output - no startup warnings ([2d29bcf](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2d29bcf51b25fe1b1253aa965e370852f3cae289))
42
+ * update bd install URL to correct repo ([5800f30](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5800f304913912a84c34d3f42a29b01bb2d87b24))
43
+
5
44
  ### [0.10.23](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.23) (2026-08-09)
6
45
 
7
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-harness-runtime",
3
- "version": "0.10.23",
3
+ "version": "0.10.25",
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": {
@@ -0,0 +1,98 @@
1
+ // packages/file-copy-helper/src/extension.ts
2
+ var COPY_KEYWORDS = [
3
+ "mimic",
4
+ "copy from",
5
+ "copy to",
6
+ "clone from",
7
+ "clone to",
8
+ "replicate",
9
+ "port from",
10
+ "migrate from",
11
+ "bring from",
12
+ "move from"
13
+ ];
14
+ var READ_SOURCE_TRIGGERS = [
15
+ "expand",
16
+ "read ",
17
+ "view ",
18
+ "cat ",
19
+ "catting",
20
+ "reading the file",
21
+ "reading file",
22
+ "lets read"
23
+ ];
24
+ var COPY_RULE = `
25
+ ## COPY FILES DIRECTLY (CRITICAL)
26
+
27
+ When asked to mimic, copy, clone, or replicate files:
28
+
29
+ 1. **DO NOT read the source files** - just copy them directly
30
+ 2. **Run \`sudo cp\` immediately** - no reading needed
31
+ 3. **If files have different owners**, use sudo
32
+
33
+ Examples:
34
+ \`\`\`bash
35
+ # Copy single file
36
+ sudo cp /source/file.ts /dest/file.ts
37
+
38
+ # Copy entire folder
39
+ sudo cp -r /source/folder/ /dest/folder/
40
+
41
+ # Copy matching pattern
42
+ sudo cp /source/*.tsx /dest/
43
+ \`\`\`
44
+
45
+ **STOP**: Do NOT use \`read\`, \`expand\`, or \`cat\` on source files. Just copy.
46
+
47
+ **Why**: Reading wastes time. The source files are complete - copying preserves everything exactly.
48
+ `;
49
+ var READ_WARNING = `
50
+ ## STOP READING - JUST COPY
51
+
52
+ You are about to read a source file. DO NOT read it.
53
+
54
+ Just run: sudo cp /path/to/source /path/to/dest
55
+
56
+ Copying is instant and preserves exact code. Reading is unnecessary.
57
+ `;
58
+ function shouldInjectCopyRule(text) {
59
+ const lower = text.toLowerCase();
60
+ return COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
61
+ }
62
+ function shouldInjectReadWarning(text) {
63
+ const lower = text.toLowerCase();
64
+ const hasSourcePath = /(source|auto-|from-|orig)/i.test(text);
65
+ const hasReadIntent = READ_SOURCE_TRIGGERS.some((t) => lower.includes(t));
66
+ return hasSourcePath && hasReadIntent;
67
+ }
68
+ function registerFileCopyHelper(pi) {
69
+ pi.on("input", (event) => {
70
+ if (event.source !== "interactive") {
71
+ return;
72
+ }
73
+ const text = event.text.trim();
74
+ if (!text || text.length < 10) {
75
+ return;
76
+ }
77
+ if (shouldInjectCopyRule(text)) {
78
+ return {
79
+ action: "transform",
80
+ text: text + COPY_RULE
81
+ };
82
+ }
83
+ if (shouldInjectReadWarning(text)) {
84
+ return {
85
+ action: "transform",
86
+ text: text + READ_WARNING
87
+ };
88
+ }
89
+ return;
90
+ });
91
+ }
92
+ function fileCopyHelperExtension(pi) {
93
+ registerFileCopyHelper(pi);
94
+ }
95
+ export {
96
+ registerFileCopyHelper,
97
+ fileCopyHelperExtension as default
98
+ };
@@ -25,35 +25,75 @@ const COPY_KEYWORDS = [
25
25
  "move from",
26
26
  ];
27
27
 
28
+ // When agent starts reading source files (bad behavior to break)
29
+ const READ_SOURCE_TRIGGERS = [
30
+ "expand",
31
+ "read ",
32
+ "view ",
33
+ "cat ",
34
+ "catting",
35
+ "reading the file",
36
+ "reading file",
37
+ "lets read",
38
+ ];
39
+
40
+ // Extract source and destination from user request
28
41
  const COPY_RULE = `
29
- ## File Copy Rule (CRITICAL)
42
+ ## COPY FILES DIRECTLY (CRITICAL)
30
43
 
31
- When copying files between folders, ALWAYS use \`cp\` or \`sudo cp\` instead of writing from scratch:
44
+ When asked to mimic, copy, clone, or replicate files:
32
45
 
33
- \`\`\`bash
34
- # Direct copy (if you have permission)
35
- cp /path/to/source/file.ts /path/to/dest/file.ts
46
+ 1. **DO NOT read the source files** - just copy them directly
47
+ 2. **Run \`sudo cp\` immediately** - no reading needed
48
+ 3. **If files have different owners**, use sudo
36
49
 
37
- # With sudo (if permission denied)
38
- sudo cp /path/to/source/file.ts /path/to/dest/file.ts
50
+ Examples:
51
+ \`\`\`bash
52
+ # Copy single file
53
+ sudo cp /source/file.ts /dest/file.ts
39
54
 
40
55
  # Copy entire folder
41
- sudo cp -r /path/to/source/folder /path/to/dest/
56
+ sudo cp -r /source/folder/ /dest/folder/
57
+
58
+ # Copy matching pattern
59
+ sudo cp /source/*.tsx /dest/
42
60
  \`\`\`
43
61
 
44
- **NEVER write files from scratch when copying is available** - it causes incomplete/imprecise code.
62
+ **STOP**: Do NOT use \`read\`, \`expand\`, or \`cat\` on source files. Just copy.
63
+
64
+ **Why**: Reading wastes time. The source files are complete - copying preserves everything exactly.
65
+ `;
66
+
67
+ // Lighter reminder when agent starts reading source
68
+ const READ_WARNING = `
69
+ ## STOP READING - JUST COPY
70
+
71
+ You are about to read a source file. DO NOT read it.
72
+
73
+ Just run: sudo cp /path/to/source /path/to/dest
45
74
 
46
- The source files already exist. Just copy them directly.
75
+ Copying is instant and preserves exact code. Reading is unnecessary.
47
76
  `;
48
77
 
49
78
  /**
50
79
  * Check if text contains copy-related keywords
51
80
  */
52
- function shouldInject(text: string): boolean {
81
+ function shouldInjectCopyRule(text: string): boolean {
53
82
  const lower = text.toLowerCase();
54
83
  return COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
55
84
  }
56
85
 
86
+ /**
87
+ * Check if text contains source file reading triggers
88
+ */
89
+ function shouldInjectReadWarning(text: string): boolean {
90
+ const lower = text.toLowerCase();
91
+ // Check if this looks like reading source files before copying
92
+ const hasSourcePath = /(source|auto-|from-|orig)/i.test(text);
93
+ const hasReadIntent = READ_SOURCE_TRIGGERS.some((t) => lower.includes(t));
94
+ return hasSourcePath && hasReadIntent;
95
+ }
96
+
57
97
  /**
58
98
  * Register the file-copy-helper extension
59
99
  */
@@ -70,13 +110,21 @@ export function registerFileCopyHelper(pi: ExtensionAPI): void {
70
110
  }
71
111
 
72
112
  // Check if this is a copy/mimic request
73
- if (shouldInject(text)) {
113
+ if (shouldInjectCopyRule(text)) {
74
114
  return {
75
115
  action: "transform",
76
116
  text: text + COPY_RULE,
77
117
  };
78
118
  }
79
119
 
120
+ // Warn if agent is about to read source files unnecessarily
121
+ if (shouldInjectReadWarning(text)) {
122
+ return {
123
+ action: "transform",
124
+ text: text + READ_WARNING,
125
+ };
126
+ }
127
+
80
128
  return;
81
129
  });
82
130
  }
@@ -0,0 +1,108 @@
1
+ import { createRequire } from "node:module";
2
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
+
4
+ // packages/todo-bd-sync/src/detector.ts
5
+ import { execSync } from "node:child_process";
6
+ import { existsSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { homedir } from "node:os";
9
+ function isRpivTodoInstalled() {
10
+ try {
11
+ const output = execSync("npm list -g @juicesharp/rpiv-todo 2>/dev/null || echo 'NOT_FOUND'", {
12
+ encoding: "utf8",
13
+ timeout: 5000
14
+ });
15
+ return output.includes("@juicesharp/rpiv-todo") && !output.includes("NOT_FOUND");
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+ function isRpivTodoLoaded() {
21
+ const extensionsDir = join(homedir(), ".pi", "agent", "extensions");
22
+ const possiblePaths = [
23
+ join(extensionsDir, "rpiv-todo"),
24
+ join(extensionsDir, "@juicesharp", "rpiv-todo"),
25
+ join(extensionsDir, "node_modules", "@juicesharp", "rpiv-todo")
26
+ ];
27
+ for (const path of possiblePaths) {
28
+ if (existsSync(path)) {
29
+ return true;
30
+ }
31
+ }
32
+ try {
33
+ __require.resolve("@juicesharp/rpiv-todo");
34
+ return true;
35
+ } catch {}
36
+ return false;
37
+ }
38
+ function getRpivTodoVersion() {
39
+ try {
40
+ const output = execSync(`npm list -g @juicesharp/rpiv-todo --json 2>/dev/null | grep '"version"' | head -1`, { encoding: "utf8", timeout: 5000 });
41
+ const match = output.match(/"version":\s*"([^"]+)"/);
42
+ return match ? match[1] : null;
43
+ } catch {
44
+ return null;
45
+ }
46
+ }
47
+ function isBdInstalled() {
48
+ try {
49
+ const output = execSync("which bd 2>/dev/null || echo 'NOT_FOUND'", {
50
+ encoding: "utf8",
51
+ timeout: 5000
52
+ });
53
+ return output.includes("bd") && !output.includes("NOT_FOUND");
54
+ } catch {
55
+ return false;
56
+ }
57
+ }
58
+ function isBdInitialized(cwd) {
59
+ const projectDir = cwd || process.cwd();
60
+ const beadsDir = join(projectDir, ".beads");
61
+ return existsSync(beadsDir);
62
+ }
63
+ function getBdVersion() {
64
+ try {
65
+ const output = execSync("bd --version 2>/dev/null || echo 'unknown'", {
66
+ encoding: "utf8",
67
+ timeout: 5000
68
+ });
69
+ return output.trim().replace("bd version ", "");
70
+ } catch {
71
+ return null;
72
+ }
73
+ }
74
+ function getDependencyStatus(cwd) {
75
+ const installed = isBdInstalled();
76
+ return {
77
+ rpivTodo: {
78
+ installed: isRpivTodoInstalled(),
79
+ version: getRpivTodoVersion(),
80
+ loaded: isRpivTodoLoaded()
81
+ },
82
+ bd: {
83
+ installed,
84
+ version: installed ? getBdVersion() : null,
85
+ initialized: installed ? isBdInitialized(cwd) : false,
86
+ installUrl: "https://github.com/beads/bd#installation"
87
+ }
88
+ };
89
+ }
90
+ function logDependencyStatus() {
91
+ const status = getDependencyStatus();
92
+ console.log("[DEBUG todo-bd-sync] Dependency check:");
93
+ console.log(` rpiv-todo: installed=${status.rpivTodo.installed}, version=${status.rpivTodo.version}, loaded=${status.rpivTodo.loaded}`);
94
+ console.log(` bd: installed=${status.bd.installed}, version=${status.bd.version}, initialized=${status.bd.initialized}`);
95
+ if (!status.bd.installed) {
96
+ console.log(` bd install: ${status.bd.installUrl}`);
97
+ }
98
+ }
99
+ export {
100
+ logDependencyStatus,
101
+ isRpivTodoLoaded,
102
+ isRpivTodoInstalled,
103
+ isBdInstalled,
104
+ isBdInitialized,
105
+ getRpivTodoVersion,
106
+ getDependencyStatus,
107
+ getBdVersion
108
+ };
@@ -148,7 +148,7 @@ export function getDependencyStatus(cwd?: string): DependencyStatus {
148
148
  installed,
149
149
  version: installed ? getBdVersion() : null,
150
150
  initialized: installed ? isBdInitialized(cwd) : false,
151
- installUrl: "https://github.com/gastownhall/beads",
151
+ installUrl: "https://github.com/beads/bd#installation",
152
152
  },
153
153
  };
154
154
  }