@cydm/pie 4.8.0 → 4.9.0

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 (49) hide show
  1. package/README.md +51 -27
  2. package/dist/builtin/extensions/ask-user/index.js +4 -4
  3. package/dist/builtin/extensions/cron/index.js +906 -158
  4. package/dist/builtin/extensions/im-forward/README.md +4 -2
  5. package/dist/builtin/extensions/im-forward/index.js +6822 -3951
  6. package/dist/builtin/extensions/memory/index.js +76 -28
  7. package/dist/builtin/extensions/pie-ipc/README.md +2 -2
  8. package/dist/builtin/extensions/pie-ipc/index.js +282 -58
  9. package/dist/builtin/extensions/pie-proc/README.md +7 -7
  10. package/dist/builtin/extensions/pie-proc/index.js +227 -75
  11. package/dist/builtin/extensions/plan-mode/index.js +5 -5
  12. package/dist/builtin/extensions/subagent/index.js +8 -8
  13. package/dist/builtin/extensions/todo/index.js +4 -4
  14. package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +26 -24
  15. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +199 -121
  16. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
  17. package/dist/builtin/skills/chrome-devtools-axi/chunk-HAUDUMDO.js +795 -0
  18. package/dist/builtin/skills/chrome-devtools-axi/{cli-ZE754CTH.js → cli-K7ESY3XD.js} +433 -255
  19. package/dist/builtin/skills/computer-use-axi/SKILL.md +25 -8
  20. package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +293 -64
  21. package/dist/builtin/skills/computer-use-axi/computer-use-axi-runtime.js +2 -2
  22. package/dist/builtin/skills/tui-use/tui-use-daemon.cjs +451 -43
  23. package/dist/chunks/{chunk-3W3SXVPB.js → chunk-4UIUMTHG.js} +993 -371
  24. package/dist/chunks/chunk-6WKBQZWM.js +19 -0
  25. package/dist/chunks/{chunk-5KI4Y4LA.js → chunk-BA4Z27XT.js} +4 -3
  26. package/dist/chunks/{chunk-BLDI2GRF.js → chunk-DBDU3RRN.js} +1364 -446
  27. package/dist/chunks/{chunk-LAJXWOKS.js → chunk-EEC5PJTC.js} +11 -9
  28. package/dist/chunks/chunk-IZKHSUNQ.js +30 -0
  29. package/dist/chunks/{chunk-Y3I2UV5Y.js → chunk-LRHNAG4V.js} +349 -288
  30. package/dist/chunks/chunk-OU33ROFD.js +717 -0
  31. package/dist/chunks/{chunk-Z2FKA2ZH.js → chunk-PN6B54VT.js} +104 -22
  32. package/dist/chunks/{chunk-NHV2CALB.js → chunk-WYXUF4MP.js} +388 -32
  33. package/dist/chunks/{chunk-4PR34UZF.js → chunk-Z5KL6AO2.js} +159 -145
  34. package/dist/chunks/{host-image-fallback-N7RHNPYN.js → host-image-fallback-RASJSVZY.js} +1 -1
  35. package/dist/chunks/{manager-cli-NEZA46M5.js → manager-cli-Y6HM3MHA.js} +5 -5
  36. package/dist/chunks/{model-registry-3XAHXXTA.js → model-registry-5TLYILYR.js} +2 -2
  37. package/dist/chunks/{read-file-understanding-FMPXR6EJ.js → read-file-understanding-VPKDBV23.js} +5 -5
  38. package/dist/chunks/{src-B44QWSGM.js → src-2XI5P62J.js} +2 -2
  39. package/dist/chunks/{src-EGXFJ3WA.js → src-6QGGDHIW.js} +3 -3
  40. package/dist/chunks/{src-Q7LU27C2.js → src-CCEENRKC.js} +31 -1
  41. package/dist/chunks/{src-CLE5ILN4.js → src-DI4MCAGT.js} +20 -4
  42. package/dist/chunks/{test-stream-OR3EJBNF.js → test-stream-SYVWIPPW.js} +2 -2
  43. package/dist/cli.js +1890 -1489
  44. package/models.schema.json +271 -0
  45. package/package.json +2 -2
  46. package/dist/builtin/skills/chrome-devtools-axi/chunk-Z2A5LA5A.js +0 -407
  47. package/dist/chunks/chunk-EGZ5TZRM.js +0 -1444
  48. package/dist/chunks/{chunk-CGSFBWOM.js → chunk-WBL73KRI.js} +3 -3
  49. package/dist/chunks/{manager-upgrade-CTU3ISCW.js → manager-upgrade-LSTOHBUV.js} +3 -3
@@ -1,407 +0,0 @@
1
- import { createRequire as __axiRequire } from "node:module"; const require = __axiRequire(import.meta.url);
2
-
3
- // vendor/chrome-devtools-axi/src/pages.ts
4
- var PAGE_SCOPED_TOOLS = /* @__PURE__ */ new Set([
5
- "click",
6
- "drag",
7
- "emulate",
8
- "evaluate_script",
9
- "fill",
10
- "fill_form",
11
- "get_console_message",
12
- "get_network_request",
13
- "handle_dialog",
14
- "hover",
15
- "lighthouse_audit",
16
- "list_console_messages",
17
- "list_network_requests",
18
- "navigate_page",
19
- "performance_analyze_insight",
20
- "performance_start_trace",
21
- "performance_stop_trace",
22
- "press_key",
23
- "resize_page",
24
- "take_heapsnapshot",
25
- "take_screenshot",
26
- "take_snapshot",
27
- "type_text",
28
- "upload_file",
29
- "wait_for"
30
- ]);
31
- function needsPageId(name, args = {}) {
32
- if (typeof args.pageId === "number") return false;
33
- if (name === "evaluate_script" && typeof args.serviceWorkerId === "string" && args.serviceWorkerId.length > 0) {
34
- return false;
35
- }
36
- return PAGE_SCOPED_TOOLS.has(name);
37
- }
38
- var GENERIC_SCHEME_SLASH_URL = /^[a-z][a-z0-9+.-]*:\/\//i;
39
- var COLON_ONLY_SCHEME_URL = /^(?:about:|data:|view-source:|blob:)/i;
40
- function isPageSchemeUrl(label) {
41
- return GENERIC_SCHEME_SLASH_URL.test(label) || COLON_ONLY_SCHEME_URL.test(label);
42
- }
43
- var MCP_SECTION_HEADER = /^##\s+(Pages|Extension Pages|Extension Service Workers|Third-party developer tools|WebMCP tools)$/;
44
- var PAGE_ID_LINE = /^\d+:(?:\s+|$)/;
45
- var OPEN_DIALOG_HEADER = /^# Open dialog$/;
46
- var HANDLE_DIALOG_FOOTER = /^Call handle_dialog to handle it before continuing\.$/;
47
- function stripTrailingIsolatedContext(label) {
48
- const match = label.match(/^(.*)\s+isolatedContext=.*$/);
49
- if (!match) return label;
50
- const before = match[1];
51
- const withoutSelected = before.replace(/\s*\[selected\]\s*$/, "").trimEnd();
52
- if (matchTrailingUrl(withoutSelected) !== null) return before;
53
- if (isPageSchemeUrl(withoutSelected)) return before;
54
- return label;
55
- }
56
- function stripPageSuffixes(rest) {
57
- let label = stripTrailingIsolatedContext(rest);
58
- if (/(?:^|\s)\[selected\]\s*$/.test(label)) {
59
- label = label.replace(/\s*\[selected\]\s*$/, "").trimEnd();
60
- }
61
- return label;
62
- }
63
- function matchTrailingUrl(label) {
64
- const trimmed = label.trimEnd();
65
- if (!trimmed.endsWith(")")) return null;
66
- const close = trimmed.length - 1;
67
- let from = close;
68
- while (from > 0) {
69
- const open = trimmed.lastIndexOf(" (", from - 1);
70
- if (open === -1) return null;
71
- const url = trimmed.slice(open + 2, close);
72
- if (isPageSchemeUrl(url)) {
73
- return { title: trimmed.slice(0, open), url };
74
- }
75
- from = open;
76
- }
77
- return null;
78
- }
79
- function hasSchemeUrl(label) {
80
- const rest = stripPageSuffixes(label);
81
- return matchTrailingUrl(rest) !== null || isPageSchemeUrl(rest);
82
- }
83
- function isCompletePageRow(row) {
84
- return hasSchemeUrl(row.replace(/^\d+:\s*/, ""));
85
- }
86
- function isTitleContinuationLine(line) {
87
- const m = line.match(/^(\d+):\s+(.+)$/);
88
- if (!m) return false;
89
- const rest = stripPageSuffixes(m[2]);
90
- if (matchTrailingUrl(rest) !== null) return false;
91
- if (isPageSchemeUrl(rest)) return false;
92
- return /(?:^|\s)\[selected\]\s*$/.test(stripTrailingIsolatedContext(m[2]));
93
- }
94
- function extractPageUrl(label) {
95
- const match = matchTrailingUrl(label);
96
- return match ? match.url : label.trim();
97
- }
98
- function pageRowRest(row) {
99
- return stripPageSuffixes(row.replace(/^\d+:\s*/, ""));
100
- }
101
- function stripDialogPreamble(text) {
102
- const lines = text.split(/\r?\n/);
103
- const kept = [];
104
- for (let i = 0; i < lines.length; ) {
105
- if (OPEN_DIALOG_HEADER.test(lines[i].trim())) {
106
- let end = -1;
107
- for (let idx = i + 1; idx < lines.length; idx++) {
108
- if (HANDLE_DIALOG_FOOTER.test(lines[idx].trim())) end = idx;
109
- }
110
- if (end !== -1) {
111
- i = end + 1;
112
- continue;
113
- }
114
- }
115
- kept.push(lines[i]);
116
- i++;
117
- }
118
- return kept.join("\n");
119
- }
120
- function followingLinesCompleteTitle(rawLines, headerIndex, currentRow) {
121
- let acc = `${currentRow} ## Pages`;
122
- for (let i = headerIndex + 1; i < rawLines.length; i++) {
123
- const next = rawLines[i].trim();
124
- if (next.length === 0) continue;
125
- if (next.match(MCP_SECTION_HEADER) !== null) return false;
126
- if (PAGE_ID_LINE.test(next)) {
127
- const rest = stripPageSuffixes(next.replace(/^\d+:\s*/, ""));
128
- if (isPageSchemeUrl(rest) && matchTrailingUrl(rest) === null) {
129
- return false;
130
- }
131
- }
132
- acc += ` ${next}`;
133
- if (matchTrailingUrl(pageRowRest(acc)) !== null) return true;
134
- }
135
- return false;
136
- }
137
- function collapsePageRows(text) {
138
- const rows = [];
139
- let inPageBlock = false;
140
- const rawLines = stripDialogPreamble(text).split(/\r?\n/);
141
- for (let index = 0; index < rawLines.length; index++) {
142
- const line = rawLines[index].trim();
143
- if (line.length === 0) continue;
144
- const section = line.match(MCP_SECTION_HEADER)?.[1];
145
- if (section !== void 0) {
146
- const prev = rows[rows.length - 1];
147
- if (section === "Pages" && inPageBlock && prev !== void 0 && !isCompletePageRow(prev) && followingLinesCompleteTitle(rawLines, index, prev)) {
148
- rows[rows.length - 1] += ` ${line}`;
149
- continue;
150
- }
151
- if (section === "Pages") {
152
- rows.length = 0;
153
- inPageBlock = true;
154
- } else if (section === "Extension Pages") {
155
- inPageBlock = true;
156
- } else {
157
- inPageBlock = false;
158
- }
159
- continue;
160
- }
161
- if (!inPageBlock) continue;
162
- if (PAGE_ID_LINE.test(line)) {
163
- const prev = rows[rows.length - 1];
164
- if (prev !== void 0 && (!isCompletePageRow(prev) || isTitleContinuationLine(line))) {
165
- rows[rows.length - 1] += ` ${line}`;
166
- } else {
167
- rows.push(line);
168
- }
169
- continue;
170
- }
171
- if (rows.length > 0) {
172
- rows[rows.length - 1] += ` ${line}`;
173
- }
174
- }
175
- return rows.map((row) => row.replace(/\s+/g, " "));
176
- }
177
- function parsePagesList(text) {
178
- const pages = [];
179
- for (const line of collapsePageRows(text)) {
180
- const m = line.match(/^(\d+):\s+(.+)$/);
181
- if (!m) continue;
182
- const id = Number.parseInt(m[1], 10);
183
- let rest = stripTrailingIsolatedContext(m[2]);
184
- const selected = /(?:^|\s)\[selected\]\s*$/.test(rest);
185
- if (selected) {
186
- rest = rest.replace(/\s*\[selected\]\s*$/, "").trimEnd();
187
- }
188
- const url = extractPageUrl(rest);
189
- pages.push({ id, url, selected });
190
- }
191
- return pages;
192
- }
193
-
194
- // vendor/chrome-devtools-axi/src/selected-page.ts
195
- import {
196
- existsSync,
197
- mkdirSync,
198
- readFileSync,
199
- unlinkSync,
200
- writeFileSync
201
- } from "node:fs";
202
- import { dirname, join as join2 } from "node:path";
203
-
204
- // vendor/chrome-devtools-axi/src/sessions.ts
205
- import { join } from "node:path";
206
- import { homedir } from "node:os";
207
- var DEFAULT_SESSION_NAME = "default";
208
- var DEFAULT_BASE_PORT = 9224;
209
- var SESSION_PORT_RANGE = 1e3;
210
- var STATE_DIR_NAME = ".chrome-devtools-axi";
211
- function resolveSessionName() {
212
- const raw = process.env.CHROME_DEVTOOLS_AXI_SESSION?.trim();
213
- const name = raw && raw.length > 0 ? raw : DEFAULT_SESSION_NAME;
214
- validateSessionName(name);
215
- return name;
216
- }
217
- function validateSessionName(name) {
218
- if (name === DEFAULT_SESSION_NAME) return;
219
- if (!/^[A-Za-z0-9._-]{1,64}$/.test(name)) {
220
- throw new Error(
221
- `Invalid CHROME_DEVTOOLS_AXI_SESSION "${name}": use 1-64 chars from [A-Za-z0-9._-]`
222
- );
223
- }
224
- if (/^\.+$/.test(name)) {
225
- throw new Error(
226
- `Invalid CHROME_DEVTOOLS_AXI_SESSION "${name}": a name made only of dots would collapse onto the default session's state directory`
227
- );
228
- }
229
- }
230
- function defaultPortForSession(name) {
231
- if (name === DEFAULT_SESSION_NAME) return DEFAULT_BASE_PORT;
232
- let hash = 2166136261;
233
- for (let i = 0; i < name.length; i++) {
234
- hash ^= name.charCodeAt(i);
235
- hash = Math.imul(hash, 16777619);
236
- }
237
- return DEFAULT_BASE_PORT + Math.abs(hash) % SESSION_PORT_RANGE + 1;
238
- }
239
- function resolveSessionPort(name = resolveSessionName()) {
240
- const explicit = process.env.CHROME_DEVTOOLS_AXI_PORT;
241
- if (explicit) {
242
- const parsed = Number.parseInt(explicit, 10);
243
- if (!Number.isNaN(parsed) && parsed > 0) return parsed;
244
- }
245
- return defaultPortForSession(name);
246
- }
247
- function resolveSessionStateDir(name = resolveSessionName()) {
248
- const base = join(homedir(), STATE_DIR_NAME);
249
- return name === DEFAULT_SESSION_NAME ? base : join(base, "sessions", name);
250
- }
251
- function resolveSessionPidFile(name = resolveSessionName()) {
252
- return join(resolveSessionStateDir(name), "bridge.pid");
253
- }
254
- function resolveSessionLogFile(name = resolveSessionName()) {
255
- return join(resolveSessionStateDir(name), "bridge.log");
256
- }
257
- function resolveSessionStartLockFile(name = resolveSessionName()) {
258
- return join(resolveSessionStateDir(name), "bridge.start.lock");
259
- }
260
-
261
- // vendor/chrome-devtools-axi/src/selected-page.ts
262
- function selectedPageFile() {
263
- return join2(resolveSessionStateDir(), "selected-page-id");
264
- }
265
- function getSelectedPageId() {
266
- const file = selectedPageFile();
267
- try {
268
- if (!existsSync(file)) return null;
269
- const parsed = Number.parseInt(readFileSync(file, "utf-8").trim(), 10);
270
- return Number.isInteger(parsed) && parsed >= 0 ? parsed : null;
271
- } catch {
272
- return null;
273
- }
274
- }
275
- function setSelectedPageId(pageId) {
276
- const file = selectedPageFile();
277
- try {
278
- mkdirSync(dirname(file), { recursive: true });
279
- writeFileSync(file, String(pageId));
280
- } catch {
281
- }
282
- }
283
- function clearSelectedPageId() {
284
- const hadSelection = getSelectedPageId() !== null;
285
- const file = selectedPageFile();
286
- try {
287
- if (existsSync(file)) unlinkSync(file);
288
- } catch {
289
- }
290
- return hadSelection && getSelectedPageId() === null;
291
- }
292
- function overlaySessionSelected(pages, selectedId = getSelectedPageId()) {
293
- return pages.map((page) => ({
294
- ...page,
295
- selected: selectedId !== null && page.id === selectedId
296
- }));
297
- }
298
- function rememberToolRouting(name, args) {
299
- if (name === "select_page" && typeof args.pageId === "number") {
300
- setSelectedPageId(args.pageId);
301
- return;
302
- }
303
- if (name === "close_page" && typeof args.pageId === "number") {
304
- if (getSelectedPageId() === args.pageId) clearSelectedPageId();
305
- }
306
- }
307
- function createdPageIdFromPageLists(beforeText, afterText) {
308
- const beforeIds = new Set(parsePagesList(beforeText).map((page) => page.id));
309
- const createdIds = parsePagesList(afterText).filter((page) => !beforeIds.has(page.id)).map((page) => page.id);
310
- return createdIds.length === 1 ? createdIds[0] : null;
311
- }
312
-
313
- // vendor/chrome-devtools-axi/src/bridge-script.ts
314
- import { existsSync as existsSync2 } from "node:fs";
315
- import { resolve } from "node:path";
316
- function resolveBridgeScript(importMetaDir) {
317
- const bundled = resolve(importMetaDir, "chrome-devtools-axi-bridge.js");
318
- if (existsSync2(bundled)) return bundled;
319
- const builtScript = resolve(
320
- importMetaDir,
321
- "../bin/chrome-devtools-axi-bridge.js"
322
- );
323
- const sourceScript = builtScript.replace(/\.js$/, ".ts");
324
- return existsSync2(sourceScript) ? sourceScript : builtScript;
325
- }
326
- var BRIDGE_PORT_IN_USE_EXIT_CODE = 48;
327
- var PAGE_IDENTITY_CHANGED_ERROR = "The browser reconnected and every page id changed, so this call did not target the page you selected";
328
-
329
- // vendor/chrome-devtools-axi/src/process-identity.ts
330
- import { execFileSync } from "node:child_process";
331
- function inspectProcessIdentity(pid) {
332
- if (!Number.isInteger(pid) || pid <= 0) return {};
333
- if (process.platform === "win32") {
334
- try {
335
- const output = execFileSync(
336
- "powershell",
337
- [
338
- "-NoProfile",
339
- "-NonInteractive",
340
- "-Command",
341
- `$p = Get-CimInstance Win32_Process -Filter "ProcessId=<pid>"; if ($p) { $p.CommandLine; $p.CreationDate.ToString('o') }`.replace("<pid>", String(pid))
342
- ],
343
- { encoding: "utf-8", timeout: 4e3, windowsHide: true }
344
- );
345
- const lines = output.split(/\r?\n/).filter((line) => line.length > 0);
346
- if (lines.length === 0) return {};
347
- const startTime = lines.length >= 2 ? lines[lines.length - 1] : void 0;
348
- return { command: lines.slice(0, lines.length - 1).join("\n"), startTime };
349
- } catch {
350
- return {};
351
- }
352
- }
353
- try {
354
- const psEnv = { ...process.env, LC_ALL: "C", LANG: "C", TZ: "UTC0" };
355
- const output = execFileSync(
356
- "ps",
357
- ["-p", String(pid), "-o", "lstart=", "-o", "command="],
358
- { encoding: "utf-8", timeout: 1e3, env: psEnv }
359
- );
360
- const firstNewline = output.indexOf("\n");
361
- const firstLine = firstNewline === -1 ? output : output.slice(0, firstNewline);
362
- const lstart = /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{1,2}\s+\d{1,2}:\d{2}:\d{2}\s+\d{4}\s+/.exec(firstLine);
363
- if (lstart) {
364
- return { startTime: lstart[0].trimEnd(), command: output.slice(lstart[0].length) };
365
- }
366
- try {
367
- const command = execFileSync("ps", ["-p", String(pid), "-o", "command="], {
368
- encoding: "utf-8",
369
- timeout: 1e3,
370
- env: psEnv
371
- });
372
- return { command };
373
- } catch {
374
- return {};
375
- }
376
- } catch {
377
- return {};
378
- }
379
- }
380
- function readProcessStartTime(pid) {
381
- return inspectProcessIdentity(pid).startTime;
382
- }
383
- function readSelfStartTime() {
384
- return readProcessStartTime(process.pid);
385
- }
386
-
387
- export {
388
- resolveBridgeScript,
389
- BRIDGE_PORT_IN_USE_EXIT_CODE,
390
- PAGE_IDENTITY_CHANGED_ERROR,
391
- needsPageId,
392
- parsePagesList,
393
- inspectProcessIdentity,
394
- readSelfStartTime,
395
- resolveSessionName,
396
- resolveSessionPort,
397
- resolveSessionStateDir,
398
- resolveSessionPidFile,
399
- resolveSessionLogFile,
400
- resolveSessionStartLockFile,
401
- getSelectedPageId,
402
- setSelectedPageId,
403
- clearSelectedPageId,
404
- overlaySessionSelected,
405
- rememberToolRouting,
406
- createdPageIdFromPageLists
407
- };