pi-harness-runtime 0.10.22 → 0.10.23

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,24 @@
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.23](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.23) (2026-08-09)
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
+ * handle array/object content in pi-usage-status build detection ([68b07a8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/68b07a8e8167a95ab1b519782a07ec3a582eec5a))
18
+ * skip publish-time scripts in release workflow ([b385148](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b38514835dc3f6fd717ca8c71dbb6d131de4887f))
19
+ * suppress noisy stack traces in harness agents ([34bbe98](https://github.com/ManotLuijiu/pi-harness-runtime/commit/34bbe98f59e740fcfcd8622f1dcc09c379f6f3df))
20
+ * **todo-bd-sync:** disable auto-injection completely - was causing noisy output ([699d6de](https://github.com/ManotLuijiu/pi-harness-runtime/commit/699d6de5e7f3b062799a0f791b386d1ecd452b00))
21
+ * **todo-bd-sync:** silence all console output - no startup warnings ([2d29bcf](https://github.com/ManotLuijiu/pi-harness-runtime/commit/2d29bcf51b25fe1b1253aa965e370852f3cae289))
22
+
5
23
  ### [0.10.22](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v0.10.14...v0.10.22) (2026-08-09)
6
24
 
7
25
 
package/index.ts CHANGED
@@ -73,7 +73,7 @@ import { scheduleAutoResume, cancelAutoResume } from "./harness/index.js";
73
73
  async function initTodoBdSync(pi: ExtensionAPI): Promise<void> {
74
74
  try {
75
75
  const mod = await import("./packages/todo-bd-sync/src/extension.js");
76
- mod.registerTodoBdSync(pi, { debug: false });
76
+ mod.registerTodoBdSync(pi);
77
77
  } catch {
78
78
  // todo-bd-sync not available
79
79
  }
@@ -100,6 +100,17 @@ async function initWriteReview(pi: ExtensionAPI): Promise<void> {
100
100
  // write-review not available
101
101
  }
102
102
  }
103
+
104
+ // --- file-copy-helper: Inject cp rule when mimicking files --------------------
105
+ // Lazy import - only loads when packages/file-copy-helper exists
106
+ async function initFileCopyHelper(pi: ExtensionAPI): Promise<void> {
107
+ try {
108
+ const mod = await import("./packages/file-copy-helper/src/extension.js");
109
+ mod.registerFileCopyHelper(pi);
110
+ } catch {
111
+ // file-copy-helper not available
112
+ }
113
+ }
103
114
  import { homedir } from "node:os";
104
115
  import { appendFileSync, existsSync, mkdirSync } from "node:fs";
105
116
  import { join } from "node:path";
@@ -257,6 +268,9 @@ export default function (pi: ExtensionAPI) {
257
268
  // --- write-review: Two-agent write with review loop ----------------------
258
269
  void initWriteReview(pi);
259
270
 
271
+ // --- file-copy-helper: Inject cp rule when mimicking files -------------
272
+ void initFileCopyHelper(pi);
273
+
260
274
  // --- Auto-Invoke rpiv-todo via System Prompt ------------------------
261
275
  // This makes the todo overlay ALWAYS activate at session start
262
276
  const AUTO_TODO_INVOKE_HINT = `
@@ -354,17 +368,23 @@ Run \`bd ready\` to see current tasks.
354
368
  if (typeof rawContent === "string") {
355
369
  content = rawContent;
356
370
  } else if (Array.isArray(rawContent)) {
357
- content = rawContent.map((c) => typeof c === "string" ? c : JSON.stringify(c)).join("\n");
371
+ content = rawContent
372
+ .map((c) => (typeof c === "string" ? c : JSON.stringify(c)))
373
+ .join("\n");
358
374
  } else {
359
375
  content = JSON.stringify(rawContent ?? "");
360
376
  }
361
377
 
362
378
  // Check if this is a build command
363
- const isBuildCommand = BUILD_COMMANDS.some(
364
- (cmd) => content.toLowerCase().includes(cmd.toLowerCase()),
379
+ const isBuildCommand = BUILD_COMMANDS.some((cmd) =>
380
+ content.toLowerCase().includes(cmd.toLowerCase()),
365
381
  );
366
382
 
367
- if (isBuildCommand && !content.includes("bd ready") && !content.includes("TODO UPDATE")) {
383
+ if (
384
+ isBuildCommand &&
385
+ !content.includes("bd ready") &&
386
+ !content.includes("TODO UPDATE")
387
+ ) {
368
388
  // Append todo reminder to build output
369
389
  result.content = content + TODO_BUILD_REMINDER;
370
390
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-harness-runtime",
3
- "version": "0.10.22",
3
+ "version": "0.10.23",
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": {
@@ -75,7 +75,7 @@
75
75
  "devDependencies": {
76
76
  "@biomejs/biome": "^2.4.7",
77
77
  "@commitlint/cli": "^20.3.1",
78
- "@commitlint/config-conventional": "^20.3.1",
78
+ "@commitlint/config-conventional": "^21.2.0",
79
79
  "@types/node": "^26.1.0",
80
80
  "@types/ws": "^8.18.1",
81
81
  "husky": "^9.1.7",
@@ -0,0 +1,62 @@
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 COPY_RULE = `
15
+ ## File Copy Rule (CRITICAL)
16
+
17
+ When copying files between folders, ALWAYS use \`cp\` or \`sudo cp\` instead of writing from scratch:
18
+
19
+ \`\`\`bash
20
+ # Direct copy (if you have permission)
21
+ cp /path/to/source/file.ts /path/to/dest/file.ts
22
+
23
+ # With sudo (if permission denied)
24
+ sudo cp /path/to/source/file.ts /path/to/dest/file.ts
25
+
26
+ # Copy entire folder
27
+ sudo cp -r /path/to/source/folder /path/to/dest/
28
+ \`\`\`
29
+
30
+ **NEVER write files from scratch when copying is available** - it causes incomplete/imprecise code.
31
+
32
+ The source files already exist. Just copy them directly.
33
+ `;
34
+ function shouldInject(text) {
35
+ const lower = text.toLowerCase();
36
+ return COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
37
+ }
38
+ function registerFileCopyHelper(pi) {
39
+ pi.on("input", (event) => {
40
+ if (event.source !== "interactive") {
41
+ return;
42
+ }
43
+ const text = event.text.trim();
44
+ if (!text || text.length < 10) {
45
+ return;
46
+ }
47
+ if (shouldInject(text)) {
48
+ return {
49
+ action: "transform",
50
+ text: text + COPY_RULE
51
+ };
52
+ }
53
+ return;
54
+ });
55
+ }
56
+ function fileCopyHelperExtension(pi) {
57
+ registerFileCopyHelper(pi);
58
+ }
59
+ export {
60
+ registerFileCopyHelper,
61
+ fileCopyHelperExtension as default
62
+ };
@@ -0,0 +1,87 @@
1
+ /**
2
+ * file-copy-helper extension
3
+ *
4
+ * Injects "use cp instead of writing from scratch" reminder when user
5
+ * asks to mimic, copy, clone, or replicate files/folders between locations.
6
+ */
7
+
8
+ import type {
9
+ ExtensionAPI,
10
+ InputEvent,
11
+ InputEventResult,
12
+ } from "@earendil-works/pi-coding-agent";
13
+
14
+ // Keywords that trigger the copy rule injection
15
+ const COPY_KEYWORDS = [
16
+ "mimic",
17
+ "copy from",
18
+ "copy to",
19
+ "clone from",
20
+ "clone to",
21
+ "replicate",
22
+ "port from",
23
+ "migrate from",
24
+ "bring from",
25
+ "move from",
26
+ ];
27
+
28
+ const COPY_RULE = `
29
+ ## File Copy Rule (CRITICAL)
30
+
31
+ When copying files between folders, ALWAYS use \`cp\` or \`sudo cp\` instead of writing from scratch:
32
+
33
+ \`\`\`bash
34
+ # Direct copy (if you have permission)
35
+ cp /path/to/source/file.ts /path/to/dest/file.ts
36
+
37
+ # With sudo (if permission denied)
38
+ sudo cp /path/to/source/file.ts /path/to/dest/file.ts
39
+
40
+ # Copy entire folder
41
+ sudo cp -r /path/to/source/folder /path/to/dest/
42
+ \`\`\`
43
+
44
+ **NEVER write files from scratch when copying is available** - it causes incomplete/imprecise code.
45
+
46
+ The source files already exist. Just copy them directly.
47
+ `;
48
+
49
+ /**
50
+ * Check if text contains copy-related keywords
51
+ */
52
+ function shouldInject(text: string): boolean {
53
+ const lower = text.toLowerCase();
54
+ return COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
55
+ }
56
+
57
+ /**
58
+ * Register the file-copy-helper extension
59
+ */
60
+ export function registerFileCopyHelper(pi: ExtensionAPI): void {
61
+ pi.on("input", (event: InputEvent): InputEventResult | undefined => {
62
+ // Only process user input (not from extensions or RPC)
63
+ if (event.source !== "interactive") {
64
+ return;
65
+ }
66
+
67
+ const text = event.text.trim();
68
+ if (!text || text.length < 10) {
69
+ return;
70
+ }
71
+
72
+ // Check if this is a copy/mimic request
73
+ if (shouldInject(text)) {
74
+ return {
75
+ action: "transform",
76
+ text: text + COPY_RULE,
77
+ };
78
+ }
79
+
80
+ return;
81
+ });
82
+ }
83
+
84
+ // Default export for pi extension loading
85
+ export default function fileCopyHelperExtension(pi: ExtensionAPI): void {
86
+ registerFileCopyHelper(pi);
87
+ }
@@ -0,0 +1 @@
1
+ export { registerFileCopyHelper, default } from "./extension.js";