@cydm/pie 1.0.6 → 1.0.7

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 (59) hide show
  1. package/README.md +151 -9
  2. package/dist/builtin/extensions/ask-user/index.js +2 -3
  3. package/dist/builtin/extensions/kimi-attachments/index.js +3 -3
  4. package/dist/builtin/extensions/plan-mode/index.js +85 -87
  5. package/dist/builtin/extensions/subagent/index.js +73 -8
  6. package/dist/builtin/extensions/todo/index.js +51 -22
  7. package/dist/builtin/skills/browser-tools/CHANGELOG.md +2 -44
  8. package/dist/builtin/skills/browser-tools/README.md +10 -99
  9. package/dist/builtin/skills/browser-tools/SKILL.md +21 -174
  10. package/dist/builtin/skills/browser-tools/package.json +6 -13
  11. package/dist/builtin/skills/browser-tools/playwright-cli.js +24 -0
  12. package/dist/builtin/skills/pie-unity-rpc/SKILL.md +121 -0
  13. package/dist/builtin/skills/pie-unity-rpc/pie-unity-rpc.js +417 -0
  14. package/dist/builtin/skills/skill-creator/SKILL.md +17 -17
  15. package/dist/builtin/skills/skill-creator/eval-viewer/generate_review.mjs +285 -0
  16. package/dist/builtin/skills/skill-creator/eval-viewer/viewer.html +1 -1
  17. package/dist/builtin/skills/skill-creator/scripts/aggregate_benchmark.mjs +271 -0
  18. package/dist/builtin/skills/skill-creator/scripts/claude_cli.mjs +115 -0
  19. package/dist/builtin/skills/skill-creator/scripts/generate_report.mjs +224 -0
  20. package/dist/builtin/skills/skill-creator/scripts/improve_description.mjs +198 -0
  21. package/dist/builtin/skills/skill-creator/scripts/package_skill.mjs +132 -0
  22. package/dist/builtin/skills/skill-creator/scripts/pie_runner.mjs +115 -0
  23. package/dist/builtin/skills/skill-creator/scripts/quick_validate.mjs +44 -0
  24. package/dist/builtin/skills/skill-creator/scripts/run_eval.mjs +169 -0
  25. package/dist/builtin/skills/skill-creator/scripts/run_loop.mjs +297 -0
  26. package/dist/builtin/skills/skill-creator/scripts/skill_metadata.mjs +134 -0
  27. package/dist/chunks/{chunk-MWFBYJOI.js → chunk-A5JSJAPK.js} +3973 -1313
  28. package/dist/chunks/chunk-BHNULR7U.js +7991 -0
  29. package/dist/chunks/chunk-GDTN4UPJ.js +701 -0
  30. package/dist/chunks/{src-EGWRDMLB.js → src-3X3HBT2G.js} +1 -2
  31. package/dist/chunks/typescript-GSKWJIO4.js +210747 -0
  32. package/dist/cli.js +14664 -11973
  33. package/models.schema.json +238 -0
  34. package/package.json +34 -8
  35. package/dist/builtin/skills/browser-tools/browser-content.js +0 -103
  36. package/dist/builtin/skills/browser-tools/browser-cookies.js +0 -35
  37. package/dist/builtin/skills/browser-tools/browser-eval.js +0 -49
  38. package/dist/builtin/skills/browser-tools/browser-hn-scraper.js +0 -108
  39. package/dist/builtin/skills/browser-tools/browser-nav.js +0 -44
  40. package/dist/builtin/skills/browser-tools/browser-pick.js +0 -162
  41. package/dist/builtin/skills/browser-tools/browser-screenshot.js +0 -34
  42. package/dist/builtin/skills/browser-tools/browser-start.js +0 -86
  43. package/dist/builtin/skills/skill-creator/eval-viewer/generate_review.py +0 -471
  44. package/dist/builtin/skills/skill-creator/scripts/__init__.py +0 -0
  45. package/dist/builtin/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
  46. package/dist/builtin/skills/skill-creator/scripts/generate_report.py +0 -326
  47. package/dist/builtin/skills/skill-creator/scripts/improve_description.py +0 -247
  48. package/dist/builtin/skills/skill-creator/scripts/package_skill.py +0 -136
  49. package/dist/builtin/skills/skill-creator/scripts/quick_validate.py +0 -103
  50. package/dist/builtin/skills/skill-creator/scripts/run_eval.py +0 -310
  51. package/dist/builtin/skills/skill-creator/scripts/run_loop.py +0 -328
  52. package/dist/builtin/skills/skill-creator/scripts/utils.py +0 -47
  53. package/dist/chunks/capabilities-FENCOHVA.js +0 -9
  54. package/dist/chunks/chunk-JYBXCEJJ.js +0 -315
  55. package/dist/chunks/chunk-RID3574D.js +0 -2718
  56. package/dist/chunks/chunk-TBJ25UWB.js +0 -3657
  57. package/dist/chunks/chunk-XZXLO7YB.js +0 -322
  58. package/dist/chunks/file-logger-AL5VVZHH.js +0 -22
  59. package/dist/chunks/src-WRUACRN2.js +0 -132
@@ -1,322 +0,0 @@
1
- import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
-
3
- // src/debug/file-logger.ts
4
- import * as fs from "fs";
5
- import * as path from "path";
6
- var FileLogger = class {
7
- config = {
8
- enabled: false,
9
- filePath: this.getDefaultLogPath(),
10
- maxBufferSize: 1e3
11
- };
12
- currentSessionId = null;
13
- /**
14
- * Get default log path - next to sessions directory for consistency
15
- * ~/.pie/debug.log (Linux/macOS) or %USERPROFILE%\.pie\debug.log (Windows)
16
- */
17
- getDefaultLogPath() {
18
- const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
19
- return path.join(homeDir, ".pie", "debug.log");
20
- }
21
- /**
22
- * Get log path for a specific session
23
- * ~/.pie/sessions/{sessionId}.log
24
- */
25
- getSessionLogPath(sessionId) {
26
- const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
27
- return path.join(homeDir, ".pie", "sessions", `${sessionId}.log`);
28
- }
29
- buffer = [];
30
- // Ring buffer for tail command
31
- bufferIndex = 0;
32
- totalLines = 0;
33
- /**
34
- * Check if logging is enabled
35
- */
36
- isEnabled() {
37
- return this.config.enabled;
38
- }
39
- /**
40
- * Get current configuration
41
- */
42
- getConfig() {
43
- return { ...this.config };
44
- }
45
- /**
46
- * Enable file logging
47
- */
48
- enable(filePath) {
49
- this.config.enabled = true;
50
- _LOG_ENABLED = true;
51
- if (filePath) {
52
- this.config.filePath = filePath;
53
- }
54
- const dir = path.dirname(this.config.filePath);
55
- if (!fs.existsSync(dir)) {
56
- fs.mkdirSync(dir, { recursive: true });
57
- }
58
- this.log("file-logger", `File logging enabled: ${this.config.filePath}`);
59
- }
60
- /**
61
- * Disable file logging
62
- */
63
- disable() {
64
- this.log("file-logger", "File logging disabled");
65
- this.config.enabled = false;
66
- _LOG_ENABLED = false;
67
- this.currentSessionId = null;
68
- }
69
- /**
70
- * Set session ID and update log path accordingly
71
- * Log file will be: ~/.pie/sessions/{sessionId}.log
72
- */
73
- setSessionId(sessionId) {
74
- const wasEnabled = this.config.enabled;
75
- if (wasEnabled && this.currentSessionId && this.currentSessionId !== sessionId) {
76
- this.log("file-logger", `Switching log from session ${this.currentSessionId} to ${sessionId}`);
77
- this.config.enabled = false;
78
- }
79
- this.currentSessionId = sessionId;
80
- if (sessionId) {
81
- this.config.filePath = this.getSessionLogPath(sessionId);
82
- if (wasEnabled) {
83
- this.config.enabled = true;
84
- const dir = path.dirname(this.config.filePath);
85
- if (!fs.existsSync(dir)) {
86
- fs.mkdirSync(dir, { recursive: true });
87
- }
88
- this.log("file-logger", `File logging enabled for session ${sessionId}: ${this.config.filePath}`);
89
- }
90
- } else {
91
- this.config.filePath = this.getDefaultLogPath();
92
- }
93
- }
94
- /**
95
- * Get current session ID
96
- */
97
- getSessionId() {
98
- return this.currentSessionId;
99
- }
100
- /**
101
- * Clear log file and buffer
102
- */
103
- clear() {
104
- this.buffer = [];
105
- this.bufferIndex = 0;
106
- this.totalLines = 0;
107
- if (fs.existsSync(this.config.filePath)) {
108
- fs.writeFileSync(this.config.filePath, "");
109
- }
110
- }
111
- /**
112
- * Set module filter (undefined = all modules)
113
- */
114
- setModules(modules) {
115
- this.config.modules = modules;
116
- }
117
- /**
118
- * Main log method
119
- */
120
- log(module, message, data) {
121
- if (!this.config.enabled) return;
122
- if (this.config.modules && !this.config.modules.includes(module)) {
123
- return;
124
- }
125
- const entry = this.formatEntry(module, message, data);
126
- try {
127
- fs.appendFileSync(this.config.filePath, entry + "\n");
128
- } catch (err) {
129
- return;
130
- }
131
- this.buffer[this.bufferIndex] = entry;
132
- this.bufferIndex = (this.bufferIndex + 1) % this.config.maxBufferSize;
133
- this.totalLines++;
134
- }
135
- /**
136
- * Get recent log entries (for tail command)
137
- */
138
- tail(count = 20) {
139
- const result = [];
140
- const size = Math.min(count, this.buffer.length);
141
- for (let i = 0; i < size; i++) {
142
- const idx = (this.bufferIndex - size + i + this.config.maxBufferSize) % this.config.maxBufferSize;
143
- if (this.buffer[idx]) {
144
- result.push(this.buffer[idx]);
145
- }
146
- }
147
- return result;
148
- }
149
- /**
150
- * Get log file stats
151
- */
152
- getStats() {
153
- let size = 0;
154
- if (fs.existsSync(this.config.filePath)) {
155
- const stats = fs.statSync(this.config.filePath);
156
- size = stats.size;
157
- }
158
- return {
159
- path: this.config.filePath,
160
- size,
161
- lines: this.totalLines,
162
- enabled: this.config.enabled
163
- };
164
- }
165
- /**
166
- * Read last N lines from file (fallback when buffer is not enough)
167
- */
168
- readLastLines(count) {
169
- if (!fs.existsSync(this.config.filePath)) {
170
- return [];
171
- }
172
- try {
173
- const content = fs.readFileSync(this.config.filePath, "utf-8");
174
- const lines = content.split("\n").filter(Boolean);
175
- return lines.slice(-count);
176
- } catch {
177
- return [];
178
- }
179
- }
180
- formatEntry(module, message, data) {
181
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
182
- let entry = `[${timestamp}] [${module}] ${message}`;
183
- if (data !== void 0) {
184
- try {
185
- entry += ` ${JSON.stringify(data)}`;
186
- } catch {
187
- entry += ` [Object]`;
188
- }
189
- }
190
- return entry;
191
- }
192
- };
193
- var fileLogger = new FileLogger();
194
- var _LOG_ENABLED = false;
195
- function isLogEnabled() {
196
- return _LOG_ENABLED;
197
- }
198
- function debugLog(module, message, data) {
199
- if (!_LOG_ENABLED) return;
200
- fileLogger.log(module, message, data);
201
- }
202
- function withErrorLog(fn, context) {
203
- if (!_LOG_ENABLED) return fn;
204
- return ((...args) => {
205
- try {
206
- const result = fn(...args);
207
- if (result && typeof result.then === "function" && typeof result.catch === "function") {
208
- return result.catch((err) => {
209
- if (_LOG_ENABLED) {
210
- fileLogger.log("ERROR", `${context} FAILED`, {
211
- error: err instanceof Error ? err.message : String(err),
212
- stack: err instanceof Error ? err.stack : void 0
213
- });
214
- }
215
- throw err;
216
- });
217
- }
218
- return result;
219
- } catch (err) {
220
- if (_LOG_ENABLED) {
221
- fileLogger.log("ERROR", `${context} FAILED`, {
222
- error: err instanceof Error ? err.message : String(err),
223
- stack: err instanceof Error ? err.stack : void 0
224
- });
225
- }
226
- throw err;
227
- }
228
- });
229
- }
230
- function setupGlobalErrorHandlers(fallbackWriter) {
231
- process.on("uncaughtException", (err) => {
232
- const entry = `[${(/* @__PURE__ */ new Date()).toISOString()}] [ERROR] UNCAUGHT EXCEPTION ${JSON.stringify({
233
- name: err.name,
234
- message: err.message,
235
- type: "uncaughtException"
236
- })}
237
- `;
238
- try {
239
- const logPath = fileLogger.getConfig().filePath;
240
- const dir = path.dirname(logPath);
241
- if (!fs.existsSync(dir)) {
242
- fs.mkdirSync(dir, { recursive: true });
243
- }
244
- fs.appendFileSync(logPath, entry);
245
- } catch {
246
- console.error("UNCAUGHT EXCEPTION:", err);
247
- }
248
- try {
249
- fallbackWriter?.("Uncaught Exception", err);
250
- } catch {
251
- }
252
- setTimeout(() => process.exit(1), 100);
253
- });
254
- process.on("unhandledRejection", (reason, _promise) => {
255
- try {
256
- fallbackWriter?.("Unhandled Rejection", reason instanceof Error ? reason : new Error(String(reason)));
257
- } catch {
258
- }
259
- if (_LOG_ENABLED) {
260
- fileLogger.log("ERROR", "UNHANDLED REJECTION", {
261
- reason: reason instanceof Error ? { name: reason.name, message: reason.message, stack: reason.stack } : String(reason),
262
- type: "unhandledRejection"
263
- });
264
- }
265
- });
266
- process.on("warning", (warning) => {
267
- if (_LOG_ENABLED) {
268
- fileLogger.log("WARN", "NODE WARNING", {
269
- name: warning.name,
270
- message: warning.message,
271
- stack: warning.stack,
272
- type: "warning"
273
- });
274
- }
275
- });
276
- }
277
- var _earlyLogs = [];
278
- var _earlyLogEnabled = false;
279
- function debugLogLazy(module, message, data) {
280
- if (_LOG_ENABLED) {
281
- fileLogger.log(module, message, data);
282
- return;
283
- }
284
- if (_earlyLogEnabled) {
285
- _earlyLogs.push({ module, message, data });
286
- if (_earlyLogs.length > 100) {
287
- _earlyLogs.shift();
288
- }
289
- }
290
- }
291
- function enableEarlyLogBuffer() {
292
- _earlyLogEnabled = true;
293
- if (process.env.PIE_DEBUG) {
294
- fileLogger.enable();
295
- }
296
- }
297
- function flushEarlyLogs() {
298
- if (_earlyLogs.length === 0) return;
299
- if (!_LOG_ENABLED) {
300
- if (process.env.PIE_DEBUG) {
301
- fileLogger.enable();
302
- } else {
303
- _earlyLogs = [];
304
- return;
305
- }
306
- }
307
- for (const log of _earlyLogs) {
308
- fileLogger.log(log.module, log.message, log.data);
309
- }
310
- _earlyLogs = [];
311
- }
312
-
313
- export {
314
- fileLogger,
315
- isLogEnabled,
316
- debugLog,
317
- withErrorLog,
318
- setupGlobalErrorHandlers,
319
- debugLogLazy,
320
- enableEarlyLogBuffer,
321
- flushEarlyLogs
322
- };
@@ -1,22 +0,0 @@
1
- import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import {
3
- debugLog,
4
- debugLogLazy,
5
- enableEarlyLogBuffer,
6
- fileLogger,
7
- flushEarlyLogs,
8
- isLogEnabled,
9
- setupGlobalErrorHandlers,
10
- withErrorLog
11
- } from "./chunk-XZXLO7YB.js";
12
- import "./chunk-TG2EQLX2.js";
13
- export {
14
- debugLog,
15
- debugLogLazy,
16
- enableEarlyLogBuffer,
17
- fileLogger,
18
- flushEarlyLogs,
19
- isLogEnabled,
20
- setupGlobalErrorHandlers,
21
- withErrorLog
22
- };
@@ -1,132 +0,0 @@
1
- import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import {
3
- AskUserMultiParamsSchema,
4
- AskUserParamsSchema,
5
- DEFAULT_MAX_BYTES,
6
- DEFAULT_MAX_LINES,
7
- GREP_MAX_LINE_LENGTH,
8
- ManageTodoListParamsSchema,
9
- PLAN_MODE_TOOL_NAMES,
10
- ReadSkillParamsSchema,
11
- TodoItemSchema,
12
- buildPathResolutionDescription,
13
- buildRootParameterSchema,
14
- buildTodoSuccessMessage,
15
- cloneTodos,
16
- collectLastAssistantText,
17
- collectSharedCapabilityPromptAdditions,
18
- createAskUserCapability,
19
- createEditTool,
20
- createFileSystemTools,
21
- createFindTool,
22
- createGrepTool,
23
- createLsTool,
24
- createManageTodoCapability,
25
- createPlanCapability,
26
- createReadOnlyTools,
27
- createReadSkillCapability,
28
- createReadTool,
29
- createSharedFileSystemTools,
30
- createSharedReadOnlyTools,
31
- createSubagentCapability,
32
- createTodoStore,
33
- createWriteTool,
34
- defineSharedCapability,
35
- detectLineEnding,
36
- executeManageTodoList,
37
- extractDoneSteps,
38
- extractPlanTodoItems,
39
- formatSize,
40
- formatSkillsForPrompt,
41
- fuzzyFindText,
42
- generateDiffString,
43
- getAvailableRoots,
44
- getDefaultRootName,
45
- getSharedCapabilityPromptAdditionsForToolNames,
46
- getTodoStats,
47
- getTodoValidation,
48
- isPlanModeSafeCommand,
49
- markCompletedPlanSteps,
50
- normalizeForFuzzyMatch,
51
- normalizeStatus,
52
- normalizeToLF,
53
- normalizeTodos,
54
- resolveInSandbox,
55
- resolveReadPath,
56
- resolveToCwd,
57
- restoreLineEndings,
58
- restoreTodoState,
59
- restoreTodosFromMessages,
60
- stripBom,
61
- truncateHead,
62
- truncateLine,
63
- truncateTail,
64
- validateTodos
65
- } from "./chunk-TBJ25UWB.js";
66
- import "./chunk-MWFBYJOI.js";
67
- import "./chunk-RID3574D.js";
68
- import "./chunk-TG2EQLX2.js";
69
- export {
70
- AskUserMultiParamsSchema,
71
- AskUserParamsSchema,
72
- DEFAULT_MAX_BYTES,
73
- DEFAULT_MAX_LINES,
74
- GREP_MAX_LINE_LENGTH,
75
- ManageTodoListParamsSchema,
76
- PLAN_MODE_TOOL_NAMES,
77
- ReadSkillParamsSchema,
78
- TodoItemSchema,
79
- buildPathResolutionDescription,
80
- buildRootParameterSchema,
81
- buildTodoSuccessMessage,
82
- cloneTodos,
83
- collectLastAssistantText,
84
- collectSharedCapabilityPromptAdditions,
85
- createAskUserCapability,
86
- createEditTool,
87
- createFileSystemTools,
88
- createFindTool,
89
- createGrepTool,
90
- createLsTool,
91
- createManageTodoCapability,
92
- createPlanCapability,
93
- createReadOnlyTools,
94
- createReadSkillCapability,
95
- createReadTool,
96
- createSharedFileSystemTools,
97
- createSharedReadOnlyTools,
98
- createSubagentCapability,
99
- createTodoStore,
100
- createWriteTool,
101
- defineSharedCapability,
102
- detectLineEnding,
103
- executeManageTodoList,
104
- extractDoneSteps,
105
- extractPlanTodoItems,
106
- formatSize,
107
- formatSkillsForPrompt,
108
- fuzzyFindText,
109
- generateDiffString,
110
- getAvailableRoots,
111
- getDefaultRootName,
112
- getSharedCapabilityPromptAdditionsForToolNames,
113
- getTodoStats,
114
- getTodoValidation,
115
- isPlanModeSafeCommand,
116
- markCompletedPlanSteps,
117
- normalizeForFuzzyMatch,
118
- normalizeStatus,
119
- normalizeToLF,
120
- normalizeTodos,
121
- resolveInSandbox,
122
- resolveReadPath,
123
- resolveToCwd,
124
- restoreLineEndings,
125
- restoreTodoState,
126
- restoreTodosFromMessages,
127
- stripBom,
128
- truncateHead,
129
- truncateLine,
130
- truncateTail,
131
- validateTodos
132
- };