pi-harness-runtime 0.10.24 → 0.10.26

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,47 @@
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.26](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.26) (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:** inject rule for import errors - copy missing files, don't fix one-by-one ([03a5b0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03a5b0a1bd899866f76fbd6482b52097c7d27a5b))
18
+ * **file-copy-helper:** strengthen rule - agent must NOT read source files before copying ([5bbf7f7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5bbf7f70f19213f4e08059aa3766301d5966daa8))
19
+ * handle array/object content in pi-usage-status build detection ([68b07a8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/68b07a8e8167a95ab1b519782a07ec3a582eec5a))
20
+ * skip publish-time scripts in release workflow ([b385148](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b38514835dc3f6fd717ca8c71dbb6d131de4887f))
21
+ * suppress noisy stack traces in harness agents ([34bbe98](https://github.com/ManotLuijiu/pi-harness-runtime/commit/34bbe98f59e740fcfcd8622f1dcc09c379f6f3df))
22
+ * **todo-bd-sync:** disable auto-injection completely - was causing noisy output ([699d6de](https://github.com/ManotLuijiu/pi-harness-runtime/commit/699d6de5e7f3b062799a0f791b386d1ecd452b00))
23
+ * **todo-bd-sync:** silence all console output - no startup warnings ([2d29bcf](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2d29bcf51b25fe1b1253aa965e370852f3cae289))
24
+ * update bd install URL to correct repo ([5800f30](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5800f304913912a84c34d3f42a29b01bb2d87b24))
25
+
26
+ ### [0.10.25](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.25) (2026-08-10)
27
+
28
+
29
+ ### Features
30
+
31
+ * **file-copy-helper:** inject cp rule when user asks to mimic/copy files ([f089f0d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f089f0d5e3e933231c99ee38cf18fa208c8eb8b2))
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * align TS formatting with main (remove 3-line logError) ([2515ad5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2515ad54f43f0566123c686d3ec4f92ad363ea13))
37
+ * correct import paths for notification-center dist files ([f248722](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f24872240c07bf115f69530a3bdabedf73e3c858))
38
+ * **file-copy-helper:** strengthen rule - agent must NOT read source files before copying ([5bbf7f7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5bbf7f70f19213f4e08059aa3766301d5966daa8))
39
+ * handle array/object content in pi-usage-status build detection ([68b07a8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/68b07a8e8167a95ab1b519782a07ec3a582eec5a))
40
+ * skip publish-time scripts in release workflow ([b385148](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b38514835dc3f6fd717ca8c71dbb6d131de4887f))
41
+ * suppress noisy stack traces in harness agents ([34bbe98](https://github.com/ManotLuijiu/pi-harness-runtime/commit/34bbe98f59e740fcfcd8622f1dcc09c379f6f3df))
42
+ * **todo-bd-sync:** disable auto-injection completely - was causing noisy output ([699d6de](https://github.com/ManotLuijiu/pi-harness-runtime/commit/699d6de5e7f3b062799a0f791b386d1ecd452b00))
43
+ * **todo-bd-sync:** silence all console output - no startup warnings ([2d29bcf](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2d29bcf51b25fe1b1253aa965e370852f3cae289))
44
+ * update bd install URL to correct repo ([5800f30](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5800f304913912a84c34d3f42a29b01bb2d87b24))
45
+
5
46
  ### [0.10.24](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.24) (2026-08-09)
6
47
 
7
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-harness-runtime",
3
- "version": "0.10.24",
3
+ "version": "0.10.26",
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,149 @@
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 IMPORT_ERROR_TRIGGERS = [
25
+ "import error",
26
+ "import errors",
27
+ "cannot find module",
28
+ "cannot resolve",
29
+ "module not found",
30
+ "missing import",
31
+ "missing file",
32
+ "does not exist",
33
+ "@repo/",
34
+ "error one by one",
35
+ "fix errors one by one",
36
+ "fix imports one by one",
37
+ "roll back"
38
+ ];
39
+ var COPY_RULE = `
40
+ ## COPY FILES DIRECTLY (CRITICAL)
41
+
42
+ When asked to mimic, copy, clone, or replicate files:
43
+
44
+ 1. **DO NOT read the source files** - just copy them directly
45
+ 2. **Run \`sudo cp\` immediately** - no reading needed
46
+ 3. **If files have different owners**, use sudo
47
+
48
+ Examples:
49
+ \`\`\`bash
50
+ # Copy single file
51
+ sudo cp /source/file.ts /dest/file.ts
52
+
53
+ # Copy entire folder
54
+ sudo cp -r /source/folder/ /dest/folder/
55
+
56
+ # Copy matching pattern
57
+ sudo cp /source/*.tsx /dest/
58
+ \`\`\`
59
+
60
+ **STOP**: Do NOT use \`read\`, \`expand\`, or \`cat\` on source files. Just copy.
61
+
62
+ **Why**: Reading wastes time. The source files are complete - copying preserves everything exactly.
63
+ `;
64
+ var READ_WARNING = `
65
+ ## STOP READING - JUST COPY
66
+
67
+ You are about to read a source file. DO NOT read it.
68
+
69
+ Just run: sudo cp /path/to/source /path/to/dest
70
+
71
+ Copying is instant and preserves exact code. Reading is unnecessary.
72
+ `;
73
+ var IMPORT_ERROR_RULE = `
74
+ ## IMPORT ERRORS? COPY THOSE FILES TOO!
75
+
76
+ When you see import/module errors after copying a file:
77
+
78
+ 1. **STOP fixing imports one by one**
79
+ 2. **STOP rolling back**
80
+ 3. **LIST all missing import files** for the user
81
+ 4. **Ask user which to copy**, then copy them via sudo cp
82
+
83
+ Example:
84
+ \`\`\`bash
85
+ # If error shows missing:
86
+ # - @repo/auth/server
87
+ # - @repo/design-system/components/ui/sidebar
88
+ # - ./components/notifications-provider
89
+
90
+ # Then copy these files the same way:
91
+ sudo cp /source/path/@repo/auth/server.ts /dest/path/@repo/auth/server.ts
92
+ sudo cp -r /source/path/@repo/design-system/components/ui/sidebar /dest/path/@repo/design-system/components/ui/sidebar
93
+ sudo cp /source/path/components/notifications-provider.tsx /dest/path/components/notifications-provider.tsx
94
+ \`\`\`
95
+
96
+ **NEVER fix imports one by one** - copy the missing files instead!
97
+ **NEVER roll back** - keep the copied file and copy its dependencies!
98
+ `;
99
+ function shouldInjectCopyRule(text) {
100
+ const lower = text.toLowerCase();
101
+ return COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
102
+ }
103
+ function shouldInjectReadWarning(text) {
104
+ const lower = text.toLowerCase();
105
+ const hasSourcePath = /(source|auto-|from-|orig)/i.test(text);
106
+ const hasReadIntent = READ_SOURCE_TRIGGERS.some((t) => lower.includes(t));
107
+ return hasSourcePath && hasReadIntent;
108
+ }
109
+ function shouldInjectImportErrorRule(text) {
110
+ const lower = text.toLowerCase();
111
+ return IMPORT_ERROR_TRIGGERS.some((t) => lower.includes(t));
112
+ }
113
+ function registerFileCopyHelper(pi) {
114
+ pi.on("input", (event) => {
115
+ if (event.source !== "interactive") {
116
+ return;
117
+ }
118
+ const text = event.text.trim();
119
+ if (!text || text.length < 10) {
120
+ return;
121
+ }
122
+ if (shouldInjectCopyRule(text)) {
123
+ return {
124
+ action: "transform",
125
+ text: text + COPY_RULE
126
+ };
127
+ }
128
+ if (shouldInjectReadWarning(text)) {
129
+ return {
130
+ action: "transform",
131
+ text: text + READ_WARNING
132
+ };
133
+ }
134
+ if (shouldInjectImportErrorRule(text)) {
135
+ return {
136
+ action: "transform",
137
+ text: text + IMPORT_ERROR_RULE
138
+ };
139
+ }
140
+ return;
141
+ });
142
+ }
143
+ function fileCopyHelperExtension(pi) {
144
+ registerFileCopyHelper(pi);
145
+ }
146
+ export {
147
+ registerFileCopyHelper,
148
+ fileCopyHelperExtension as default
149
+ };
@@ -25,35 +25,128 @@ 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
+ // When agent sees import/module errors (needs to copy those files too)
41
+ const IMPORT_ERROR_TRIGGERS = [
42
+ "import error",
43
+ "import errors",
44
+ "cannot find module",
45
+ "cannot resolve",
46
+ "module not found",
47
+ "missing import",
48
+ "missing file",
49
+ "does not exist",
50
+ "@repo/",
51
+ "error one by one",
52
+ "fix errors one by one",
53
+ "fix imports one by one",
54
+ "roll back",
55
+ ];
56
+
57
+ // Extract source and destination from user request
28
58
  const COPY_RULE = `
29
- ## File Copy Rule (CRITICAL)
59
+ ## COPY FILES DIRECTLY (CRITICAL)
30
60
 
31
- When copying files between folders, ALWAYS use \`cp\` or \`sudo cp\` instead of writing from scratch:
61
+ When asked to mimic, copy, clone, or replicate files:
32
62
 
33
- \`\`\`bash
34
- # Direct copy (if you have permission)
35
- cp /path/to/source/file.ts /path/to/dest/file.ts
63
+ 1. **DO NOT read the source files** - just copy them directly
64
+ 2. **Run \`sudo cp\` immediately** - no reading needed
65
+ 3. **If files have different owners**, use sudo
36
66
 
37
- # With sudo (if permission denied)
38
- sudo cp /path/to/source/file.ts /path/to/dest/file.ts
67
+ Examples:
68
+ \`\`\`bash
69
+ # Copy single file
70
+ sudo cp /source/file.ts /dest/file.ts
39
71
 
40
72
  # Copy entire folder
41
- sudo cp -r /path/to/source/folder /path/to/dest/
73
+ sudo cp -r /source/folder/ /dest/folder/
74
+
75
+ # Copy matching pattern
76
+ sudo cp /source/*.tsx /dest/
42
77
  \`\`\`
43
78
 
44
- **NEVER write files from scratch when copying is available** - it causes incomplete/imprecise code.
79
+ **STOP**: Do NOT use \`read\`, \`expand\`, or \`cat\` on source files. Just copy.
80
+
81
+ **Why**: Reading wastes time. The source files are complete - copying preserves everything exactly.
82
+ `;
83
+
84
+ // Lighter reminder when agent starts reading source
85
+ const READ_WARNING = `
86
+ ## STOP READING - JUST COPY
87
+
88
+ You are about to read a source file. DO NOT read it.
89
+
90
+ Just run: sudo cp /path/to/source /path/to/dest
91
+
92
+ Copying is instant and preserves exact code. Reading is unnecessary.
93
+ `;
94
+
95
+ // When agent sees import errors - copy those files too!
96
+ const IMPORT_ERROR_RULE = `
97
+ ## IMPORT ERRORS? COPY THOSE FILES TOO!
98
+
99
+ When you see import/module errors after copying a file:
100
+
101
+ 1. **STOP fixing imports one by one**
102
+ 2. **STOP rolling back**
103
+ 3. **LIST all missing import files** for the user
104
+ 4. **Ask user which to copy**, then copy them via sudo cp
105
+
106
+ Example:
107
+ \`\`\`bash
108
+ # If error shows missing:
109
+ # - @repo/auth/server
110
+ # - @repo/design-system/components/ui/sidebar
111
+ # - ./components/notifications-provider
112
+
113
+ # Then copy these files the same way:
114
+ sudo cp /source/path/@repo/auth/server.ts /dest/path/@repo/auth/server.ts
115
+ sudo cp -r /source/path/@repo/design-system/components/ui/sidebar /dest/path/@repo/design-system/components/ui/sidebar
116
+ sudo cp /source/path/components/notifications-provider.tsx /dest/path/components/notifications-provider.tsx
117
+ \`\`\`
45
118
 
46
- The source files already exist. Just copy them directly.
119
+ **NEVER fix imports one by one** - copy the missing files instead!
120
+ **NEVER roll back** - keep the copied file and copy its dependencies!
47
121
  `;
48
122
 
49
123
  /**
50
124
  * Check if text contains copy-related keywords
51
125
  */
52
- function shouldInject(text: string): boolean {
126
+ function shouldInjectCopyRule(text: string): boolean {
53
127
  const lower = text.toLowerCase();
54
128
  return COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
55
129
  }
56
130
 
131
+ /**
132
+ * Check if text contains source file reading triggers
133
+ */
134
+ function shouldInjectReadWarning(text: string): boolean {
135
+ const lower = text.toLowerCase();
136
+ // Check if this looks like reading source files before copying
137
+ const hasSourcePath = /(source|auto-|from-|orig)/i.test(text);
138
+ const hasReadIntent = READ_SOURCE_TRIGGERS.some((t) => lower.includes(t));
139
+ return hasSourcePath && hasReadIntent;
140
+ }
141
+
142
+ /**
143
+ * Check if text contains import error triggers
144
+ */
145
+ function shouldInjectImportErrorRule(text: string): boolean {
146
+ const lower = text.toLowerCase();
147
+ return IMPORT_ERROR_TRIGGERS.some((t) => lower.includes(t));
148
+ }
149
+
57
150
  /**
58
151
  * Register the file-copy-helper extension
59
152
  */
@@ -70,13 +163,29 @@ export function registerFileCopyHelper(pi: ExtensionAPI): void {
70
163
  }
71
164
 
72
165
  // Check if this is a copy/mimic request
73
- if (shouldInject(text)) {
166
+ if (shouldInjectCopyRule(text)) {
74
167
  return {
75
168
  action: "transform",
76
169
  text: text + COPY_RULE,
77
170
  };
78
171
  }
79
172
 
173
+ // Warn if agent is about to read source files unnecessarily
174
+ if (shouldInjectReadWarning(text)) {
175
+ return {
176
+ action: "transform",
177
+ text: text + READ_WARNING,
178
+ };
179
+ }
180
+
181
+ // Inject import error rule when agent sees missing imports
182
+ if (shouldInjectImportErrorRule(text)) {
183
+ return {
184
+ action: "transform",
185
+ text: text + IMPORT_ERROR_RULE,
186
+ };
187
+ }
188
+
80
189
  return;
81
190
  });
82
191
  }