pi-harness-runtime 1.1.28 → 1.1.30

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 (92) hide show
  1. package/package.json +1 -1
  2. package/packages/a2a-adapter/package.json +1 -1
  3. package/packages/architecture-generator/package.json +1 -1
  4. package/packages/auth/package.json +1 -1
  5. package/packages/autonomous-refactor/package.json +1 -1
  6. package/packages/autonomous-runtime/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/clipboard/package.json +1 -1
  12. package/packages/clipboard-plugin/package.json +1 -1
  13. package/packages/code-generation/package.json +1 -1
  14. package/packages/code-review/package.json +1 -1
  15. package/packages/codex-adapter/package.json +1 -1
  16. package/packages/config-capture/package.json +1 -1
  17. package/packages/context-compiler/package.json +1 -1
  18. package/packages/context-discovery/package.json +1 -1
  19. package/packages/context-manager/package.json +1 -1
  20. package/packages/cookie-sanitizer/package.json +1 -1
  21. package/packages/cost-optimizer/package.json +1 -1
  22. package/packages/dependency-analyzer/package.json +1 -1
  23. package/packages/django-plugin/package.json +1 -1
  24. package/packages/doc-generator/package.json +1 -1
  25. package/packages/evaluation-engine/package.json +1 -1
  26. package/packages/evaluation-runner/package.json +1 -1
  27. package/packages/event-bus/package.json +1 -1
  28. package/packages/event-store/package.json +1 -1
  29. package/packages/experience-replay/package.json +1 -1
  30. package/packages/feedback-collector/package.json +1 -1
  31. package/packages/file-copy-helper/package.json +1 -1
  32. package/packages/file-copy-helper/src/extension.debug.ts +67 -26
  33. package/packages/file-copy-helper/src/extension.ts +72 -27
  34. package/packages/framework-detector/package.json +1 -1
  35. package/packages/framework-plugin-sdk/package.json +1 -1
  36. package/packages/frappe-plugin/package.json +1 -1
  37. package/packages/generic-web-plugin/package.json +1 -1
  38. package/packages/health-monitor/package.json +1 -1
  39. package/packages/intent-analyzer/package.json +1 -1
  40. package/packages/knowledge-graph/package.json +1 -1
  41. package/packages/knowledge-retrieval/package.json +1 -1
  42. package/packages/laravel-plugin/package.json +1 -1
  43. package/packages/learning-engine/package.json +1 -1
  44. package/packages/mcp-adapter/package.json +1 -1
  45. package/packages/memory-engine/package.json +1 -1
  46. package/packages/milestone-manager/package.json +1 -1
  47. package/packages/model-registry/package.json +1 -1
  48. package/packages/nextjs-plugin/package.json +1 -1
  49. package/packages/notification/package.json +1 -1
  50. package/packages/observability/package.json +1 -1
  51. package/packages/okf-indexer/package.json +1 -1
  52. package/packages/performance-optimizer/package.json +1 -1
  53. package/packages/privilege-broker/package.json +1 -1
  54. package/packages/project-analyzer/package.json +1 -1
  55. package/packages/project-bootstrap/package.json +1 -1
  56. package/packages/projection-engine/package.json +1 -1
  57. package/packages/prompt-compiler/package.json +1 -1
  58. package/packages/prompt-versioning/package.json +1 -1
  59. package/packages/provider-adapter-sdk/package.json +1 -1
  60. package/packages/provider-router/package.json +1 -1
  61. package/packages/provider-selector/package.json +1 -1
  62. package/packages/providers/package.json +1 -1
  63. package/packages/quota-manager/package.json +1 -1
  64. package/packages/rate-limiter/package.json +1 -1
  65. package/packages/react-vite-plugin/package.json +1 -1
  66. package/packages/release-manager/package.json +1 -1
  67. package/packages/requirement-compiler/package.json +1 -1
  68. package/packages/runtime/package.json +1 -1
  69. package/packages/scheduler/package.json +1 -1
  70. package/packages/scheduler-adapter/package.json +1 -1
  71. package/packages/session/package.json +1 -1
  72. package/packages/session-api/package.json +1 -1
  73. package/packages/session-export/package.json +1 -1
  74. package/packages/shared-context/package.json +1 -1
  75. package/packages/skill-mcp-client/package.json +1 -1
  76. package/packages/skill-registry/package.json +1 -1
  77. package/packages/sprint-planner/package.json +1 -1
  78. package/packages/subscription-engine/package.json +1 -1
  79. package/packages/task-compiler/package.json +1 -1
  80. package/packages/tencentdb-memory/package.json +1 -1
  81. package/packages/tencentdb-sync/package.json +1 -1
  82. package/packages/test-data-generator/package.json +1 -1
  83. package/packages/test-generator/package.json +1 -1
  84. package/packages/todo-bd-sync/package.json +1 -1
  85. package/packages/token-estimation/package.json +1 -1
  86. package/packages/token-optimizer/package.json +1 -1
  87. package/packages/tui/package.json +1 -1
  88. package/packages/types/package.json +1 -1
  89. package/packages/workflow-events/package.json +1 -1
  90. package/packages/workspace-scanner/package.json +1 -1
  91. package/packages/worktree/package.json +1 -1
  92. package/packages/write-review/package.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-harness-runtime",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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/architecture-generator",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "Generate ADR and Mermaid diagrams from project analysis",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/auth",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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/autonomous-runtime",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "Autonomous Operations Runtime — task inbox, lease management, and worker lifecycle (RFC-0101)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/cache-strategy",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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/clipboard",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/clipboard-plugin",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/code-generation",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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": "@moocoding/config-capture",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "Auto-capture API-fetched configuration values to AGENTS.md",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/context-compiler",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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/context-discovery",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/context-manager",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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/cookie-sanitizer",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "pi-harness-runtime — cookie sanitizer (provider-quota cookie file normaliser)",
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": "1.1.28",
3
+ "version": "1.1.30",
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/dependency-analyzer",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/django-plugin",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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/event-bus",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/event-store",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/experience-replay",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
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": "@moocoding/file-copy-helper",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "Injects cp/sudo cp rule when user asks to mimic/copy files",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Injects "use cp instead of writing from scratch" reminder when user
5
5
  * asks to mimic, copy, clone, or replicate files/folders between locations.
6
- *
6
+ *
7
7
  * DEBUG: All events and rule evaluations logged to /tmp/file-copy-helper-debug.log
8
8
  */
9
9
 
@@ -34,20 +34,24 @@ const COPY_DEST_CONTEXT = ["to ", "into ", "/dest/", "/target/", "over to"];
34
34
  const COPY_SOURCE_CONTEXT = ["from ", "source", "/source/", "orig"];
35
35
 
36
36
  // When agent sees import/module errors (needs to copy those files too)
37
+ // MUST have: import/module error context + copy/deploy context
37
38
  const IMPORT_ERROR_TRIGGERS = [
38
- "import error",
39
- "import errors",
39
+ // Import error indicators (must have these)
40
40
  "cannot find module",
41
- "cannot resolve",
41
+ "cannot resolve module",
42
42
  "module not found",
43
43
  "missing import",
44
- "missing file",
45
- "does not exist",
46
- "@repo/",
47
- "error one by one",
48
- "fix errors one by one",
49
- "fix imports one by one",
50
- "roll back",
44
+ ];
45
+
46
+ // Copy/deploy context indicators (must have at least one)
47
+ const COPY_CONTEXT = [
48
+ "sudo cp",
49
+ "copy.*to",
50
+ "deploy",
51
+ "sync",
52
+ "after copying",
53
+ "after deploy",
54
+ "after sync",
51
55
  ];
52
56
 
53
57
  // Extract source and destination from user request
@@ -109,42 +113,65 @@ sudo cp /source/path/components/notifications-provider.tsx /dest/path/components
109
113
  * Check if text contains copy-related keywords
110
114
  * Requires: explicit intent (mimic/copy/clone/replicate) AND destination context
111
115
  */
112
- function shouldInjectCopyRule(text: string): { triggered: boolean; reason: string } {
116
+ function shouldInjectCopyRule(text: string): {
117
+ triggered: boolean;
118
+ reason: string;
119
+ } {
113
120
  const lower = text.toLowerCase();
114
121
 
115
122
  // Must have explicit mimic/copy/clone/replicate intent
116
123
  const hasIntent = COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
117
124
  if (!hasIntent) {
118
- return { triggered: false, reason: `No intent keyword found. Keywords: ${COPY_KEYWORDS.join(", ")}` };
125
+ return {
126
+ triggered: false,
127
+ reason: `No intent keyword found. Keywords: ${COPY_KEYWORDS.join(", ")}`,
128
+ };
119
129
  }
120
130
 
121
131
  // Must have destination context (avoids false positives on "copy this code" etc)
122
132
  const hasDest = COPY_DEST_CONTEXT.some((ctx) => lower.includes(ctx));
123
133
  if (!hasDest) {
124
- return { triggered: false, reason: `No destination context found. Dest contexts: ${COPY_DEST_CONTEXT.join(", ")}` };
134
+ return {
135
+ triggered: false,
136
+ reason: `No destination context found. Dest contexts: ${COPY_DEST_CONTEXT.join(", ")}`,
137
+ };
125
138
  }
126
139
 
127
140
  // Should have source context for full mimic behavior
128
141
  const hasSource = COPY_SOURCE_CONTEXT.some((ctx) => lower.includes(ctx));
129
142
  if (!hasSource) {
130
- return { triggered: false, reason: `No source context found. Source contexts: ${COPY_SOURCE_CONTEXT.join(", ")}` };
143
+ return {
144
+ triggered: false,
145
+ reason: `No source context found. Source contexts: ${COPY_SOURCE_CONTEXT.join(", ")}`,
146
+ };
131
147
  }
132
148
 
133
- return { triggered: true, reason: `All conditions met: hasIntent=${hasIntent}, hasDest=${hasDest}, hasSource=${hasSource}` };
149
+ return {
150
+ triggered: true,
151
+ reason: `All conditions met: hasIntent=${hasIntent}, hasDest=${hasDest}, hasSource=${hasSource}`,
152
+ };
134
153
  }
135
154
 
136
155
  /**
137
156
  * Check if text contains import error triggers
138
157
  */
139
- function shouldInjectImportErrorRule(text: string): { triggered: boolean; reason: string } {
158
+ function shouldInjectImportErrorRule(text: string): {
159
+ triggered: boolean;
160
+ reason: string;
161
+ } {
140
162
  const lower = text.toLowerCase();
141
- const matchingTriggers = IMPORT_ERROR_TRIGGERS.filter((t) => lower.includes(t));
142
-
163
+ const matchingTriggers = IMPORT_ERROR_TRIGGERS.filter((t) =>
164
+ lower.includes(t),
165
+ );
166
+
143
167
  if (matchingTriggers.length === 0) {
144
168
  return { triggered: false, reason: "No import error triggers found" };
145
169
  }
146
170
 
147
- return { triggered: true, reason: `Matched triggers: ${matchingTriggers.join(", ")}` };
171
+ return {
172
+ triggered: true,
173
+ reason: `Matched triggers: ${matchingTriggers.join(", ")}`,
174
+ };
148
175
  }
149
176
 
150
177
  /**
@@ -152,7 +179,10 @@ function shouldInjectImportErrorRule(text: string): { triggered: boolean; reason
152
179
  */
153
180
  export function registerFileCopyHelper(pi: ExtensionAPI): void {
154
181
  // Clear debug log on startup
155
- fs.writeFileSync(DEBUG_LOG, `[${new Date().toISOString()}] === DEBUG SESSION STARTED ===\n`);
182
+ fs.writeFileSync(
183
+ DEBUG_LOG,
184
+ `[${new Date().toISOString()}] === DEBUG SESSION STARTED ===\n`,
185
+ );
156
186
 
157
187
  pi.on("input", (event: InputEvent): InputEventResult | undefined => {
158
188
  // DEBUG: Log what we receive
@@ -186,9 +216,15 @@ export function registerFileCopyHelper(pi: ExtensionAPI): void {
186
216
  debugLog("COPY_RULE_CHECK", {
187
217
  triggered: copyCheck.triggered,
188
218
  reason: copyCheck.reason,
189
- matchingKeywords: COPY_KEYWORDS.filter(k => text.toLowerCase().includes(k)),
190
- matchingDest: COPY_DEST_CONTEXT.filter(ctx => text.toLowerCase().includes(ctx)),
191
- matchingSource: COPY_SOURCE_CONTEXT.filter(ctx => text.toLowerCase().includes(ctx)),
219
+ matchingKeywords: COPY_KEYWORDS.filter((k) =>
220
+ text.toLowerCase().includes(k),
221
+ ),
222
+ matchingDest: COPY_DEST_CONTEXT.filter((ctx) =>
223
+ text.toLowerCase().includes(ctx),
224
+ ),
225
+ matchingSource: COPY_SOURCE_CONTEXT.filter((ctx) =>
226
+ text.toLowerCase().includes(ctx),
227
+ ),
192
228
  });
193
229
 
194
230
  if (copyCheck.triggered) {
@@ -204,11 +240,16 @@ export function registerFileCopyHelper(pi: ExtensionAPI): void {
204
240
  debugLog("IMPORT_ERROR_CHECK", {
205
241
  triggered: importCheck.triggered,
206
242
  reason: importCheck.reason,
207
- matchingTriggers: IMPORT_ERROR_TRIGGERS.filter(t => text.toLowerCase().includes(t)),
243
+ matchingTriggers: IMPORT_ERROR_TRIGGERS.filter((t) =>
244
+ text.toLowerCase().includes(t),
245
+ ),
208
246
  });
209
247
 
210
248
  if (importCheck.triggered) {
211
- debugLog("INJECT", { rule: "IMPORT_ERROR_RULE", reason: importCheck.reason });
249
+ debugLog("INJECT", {
250
+ rule: "IMPORT_ERROR_RULE",
251
+ reason: importCheck.reason,
252
+ });
212
253
  return {
213
254
  action: "transform",
214
255
  text: text + IMPORT_ERROR_RULE,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Injects "use cp instead of writing from scratch" reminder when user
5
5
  * asks to mimic, copy, clone, or replicate files/folders between locations.
6
- *
6
+ *
7
7
  * DEBUG: All events and rule evaluations logged to /tmp/file-copy-helper-debug.log
8
8
  */
9
9
 
@@ -34,20 +34,24 @@ const COPY_DEST_CONTEXT = ["to ", "into ", "/dest/", "/target/", "over to"];
34
34
  const COPY_SOURCE_CONTEXT = ["from ", "source", "/source/", "orig"];
35
35
 
36
36
  // When agent sees import/module errors (needs to copy those files too)
37
+ // MUST have: import/module error context + copy/deploy context
37
38
  const IMPORT_ERROR_TRIGGERS = [
38
- "import error",
39
- "import errors",
39
+ // Import error indicators (must have these)
40
40
  "cannot find module",
41
- "cannot resolve",
41
+ "cannot resolve module",
42
42
  "module not found",
43
43
  "missing import",
44
- "missing file",
45
- "does not exist",
46
- "@repo/",
47
- "error one by one",
48
- "fix errors one by one",
49
- "fix imports one by one",
50
- "roll back",
44
+ ];
45
+
46
+ // Copy/deploy context indicators (must have at least one)
47
+ const COPY_CONTEXT = [
48
+ "sudo cp",
49
+ "copy.*to",
50
+ "deploy",
51
+ "sync",
52
+ "after copying",
53
+ "after deploy",
54
+ "after sync",
51
55
  ];
52
56
 
53
57
  // Extract source and destination from user request
@@ -109,42 +113,68 @@ sudo cp /source/path/components/notifications-provider.tsx /dest/path/components
109
113
  * Check if text contains copy-related keywords
110
114
  * Requires: explicit intent (mimic/copy/clone/replicate) AND destination context
111
115
  */
112
- function shouldInjectCopyRule(text: string): { triggered: boolean; reason: string } {
116
+ function shouldInjectCopyRule(text: string): {
117
+ triggered: boolean;
118
+ reason: string;
119
+ } {
113
120
  const lower = text.toLowerCase();
114
121
 
115
122
  // Must have explicit mimic/copy/clone/replicate intent
116
123
  const hasIntent = COPY_KEYWORDS.some((keyword) => lower.includes(keyword));
117
124
  if (!hasIntent) {
118
- return { triggered: false, reason: `No intent keyword found. Keywords: ${COPY_KEYWORDS.join(", ")}` };
125
+ return {
126
+ triggered: false,
127
+ reason: `No intent keyword found. Keywords: ${COPY_KEYWORDS.join(", ")}`,
128
+ };
119
129
  }
120
130
 
121
131
  // Must have destination context (avoids false positives on "copy this code" etc)
122
132
  const hasDest = COPY_DEST_CONTEXT.some((ctx) => lower.includes(ctx));
123
133
  if (!hasDest) {
124
- return { triggered: false, reason: `No destination context found. Dest contexts: ${COPY_DEST_CONTEXT.join(", ")}` };
134
+ return {
135
+ triggered: false,
136
+ reason: `No destination context found. Dest contexts: ${COPY_DEST_CONTEXT.join(", ")}`,
137
+ };
125
138
  }
126
139
 
127
140
  // Should have source context for full mimic behavior
128
141
  const hasSource = COPY_SOURCE_CONTEXT.some((ctx) => lower.includes(ctx));
129
142
  if (!hasSource) {
130
- return { triggered: false, reason: `No source context found. Source contexts: ${COPY_SOURCE_CONTEXT.join(", ")}` };
143
+ return {
144
+ triggered: false,
145
+ reason: `No source context found. Source contexts: ${COPY_SOURCE_CONTEXT.join(", ")}`,
146
+ };
131
147
  }
132
148
 
133
- return { triggered: true, reason: `All conditions met: hasIntent=${hasIntent}, hasDest=${hasDest}, hasSource=${hasSource}` };
149
+ return {
150
+ triggered: true,
151
+ reason: `All conditions met: hasIntent=${hasIntent}, hasDest=${hasDest}, hasSource=${hasSource}`,
152
+ };
134
153
  }
135
154
 
136
155
  /**
137
156
  * Check if text contains import error triggers
157
+ * Requires BOTH: import error context + copy/deploy context
138
158
  */
139
- function shouldInjectImportErrorRule(text: string): { triggered: boolean; reason: string } {
159
+ function shouldInjectImportErrorRule(text: string): {
160
+ triggered: boolean;
161
+ reason: string;
162
+ } {
140
163
  const lower = text.toLowerCase();
141
- const matchingTriggers = IMPORT_ERROR_TRIGGERS.filter((t) => lower.includes(t));
142
-
143
- if (matchingTriggers.length === 0) {
164
+
165
+ // Must have import error context
166
+ const hasImportError = IMPORT_ERROR_TRIGGERS.some((t) => lower.includes(t));
167
+ if (!hasImportError) {
144
168
  return { triggered: false, reason: "No import error triggers found" };
145
169
  }
146
170
 
147
- return { triggered: true, reason: `Matched triggers: ${matchingTriggers.join(", ")}` };
171
+ // Must have copy/deploy context
172
+ const hasCopyContext = COPY_CONTEXT.some((ctx) => lower.includes(ctx));
173
+ if (!hasCopyContext) {
174
+ return { triggered: false, reason: "No copy/deploy context found" };
175
+ }
176
+
177
+ return { triggered: true, reason: "Has import error + copy context" };
148
178
  }
149
179
 
150
180
  /**
@@ -152,7 +182,10 @@ function shouldInjectImportErrorRule(text: string): { triggered: boolean; reason
152
182
  */
153
183
  export function registerFileCopyHelper(pi: ExtensionAPI): void {
154
184
  // Clear debug log on startup
155
- fs.writeFileSync(DEBUG_LOG, `[${new Date().toISOString()}] === DEBUG SESSION STARTED ===\n`);
185
+ fs.writeFileSync(
186
+ DEBUG_LOG,
187
+ `[${new Date().toISOString()}] === DEBUG SESSION STARTED ===\n`,
188
+ );
156
189
 
157
190
  pi.on("input", (event: InputEvent): InputEventResult | undefined => {
158
191
  // DEBUG: Log what we receive
@@ -186,9 +219,15 @@ export function registerFileCopyHelper(pi: ExtensionAPI): void {
186
219
  debugLog("COPY_RULE_CHECK", {
187
220
  triggered: copyCheck.triggered,
188
221
  reason: copyCheck.reason,
189
- matchingKeywords: COPY_KEYWORDS.filter(k => text.toLowerCase().includes(k)),
190
- matchingDest: COPY_DEST_CONTEXT.filter(ctx => text.toLowerCase().includes(ctx)),
191
- matchingSource: COPY_SOURCE_CONTEXT.filter(ctx => text.toLowerCase().includes(ctx)),
222
+ matchingKeywords: COPY_KEYWORDS.filter((k) =>
223
+ text.toLowerCase().includes(k),
224
+ ),
225
+ matchingDest: COPY_DEST_CONTEXT.filter((ctx) =>
226
+ text.toLowerCase().includes(ctx),
227
+ ),
228
+ matchingSource: COPY_SOURCE_CONTEXT.filter((ctx) =>
229
+ text.toLowerCase().includes(ctx),
230
+ ),
192
231
  });
193
232
 
194
233
  if (copyCheck.triggered) {
@@ -204,11 +243,17 @@ export function registerFileCopyHelper(pi: ExtensionAPI): void {
204
243
  debugLog("IMPORT_ERROR_CHECK", {
205
244
  triggered: importCheck.triggered,
206
245
  reason: importCheck.reason,
207
- matchingTriggers: IMPORT_ERROR_TRIGGERS.filter(t => text.toLowerCase().includes(t)),
246
+ hasImportError: IMPORT_ERROR_TRIGGERS.some((t) =>
247
+ text.toLowerCase().includes(t),
248
+ ),
249
+ hasCopyContext: COPY_CONTEXT.some((ctx) => text.toLowerCase().includes(ctx)),
208
250
  });
209
251
 
210
252
  if (importCheck.triggered) {
211
- debugLog("INJECT", { rule: "IMPORT_ERROR_RULE", reason: importCheck.reason });
253
+ debugLog("INJECT", {
254
+ rule: "IMPORT_ERROR_RULE",
255
+ reason: importCheck.reason,
256
+ });
212
257
  return {
213
258
  action: "transform",
214
259
  text: text + IMPORT_ERROR_RULE,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi/framework-detector",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
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": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "Framework plugin SDK for pi-harness-runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",