@docyrus/docyrus 0.0.33 → 0.0.35
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/README.md +25 -0
- package/agent-loader.js +3 -2
- package/agent-loader.js.map +2 -2
- package/main.js +82252 -46058
- package/main.js.map +4 -4
- package/package.json +12 -3
- package/resources/chrome-tools/browser-content.js +46 -46
- package/resources/chrome-tools/browser-cookies.js +16 -16
- package/resources/chrome-tools/browser-eval.js +27 -27
- package/resources/chrome-tools/browser-hn-scraper.js +1 -1
- package/resources/chrome-tools/browser-nav.js +23 -23
- package/resources/chrome-tools/browser-pick.js +127 -127
- package/resources/chrome-tools/browser-screenshot.js +10 -10
- package/resources/chrome-tools/browser-start.js +38 -38
- package/resources/pi-agent/extensions/answer.ts +392 -384
- package/resources/pi-agent/extensions/context.ts +415 -415
- package/resources/pi-agent/extensions/control.ts +1287 -1287
- package/resources/pi-agent/extensions/diff.ts +171 -171
- package/resources/pi-agent/extensions/files.ts +155 -155
- package/resources/pi-agent/extensions/knowledge.ts +664 -0
- package/resources/pi-agent/extensions/loop.ts +375 -375
- package/resources/pi-agent/extensions/pi-bash-live-view/index.ts +1 -1
- package/resources/pi-agent/extensions/pi-bash-live-view/package.json +22 -22
- package/resources/pi-agent/extensions/pi-bash-live-view/pty-execute.ts +2 -2
- package/resources/pi-agent/extensions/pi-bash-live-view/pty-session.ts +2 -2
- package/resources/pi-agent/extensions/pi-bash-live-view/spawn-helper.ts +2 -2
- package/resources/pi-agent/extensions/pi-bash-live-view/terminal-emulator.ts +18 -18
- package/resources/pi-agent/extensions/pi-bash-live-view/truncate.ts +1 -1
- package/resources/pi-agent/extensions/pi-bash-live-view/widget.ts +4 -4
- package/resources/pi-agent/extensions/pi-custom-compaction/package.json +4 -4
- package/resources/pi-agent/extensions/pi-mcp-adapter/app-bridge.bundle.js +14 -14
- package/resources/pi-agent/extensions/pi-mcp-adapter/commands.ts +6 -6
- package/resources/pi-agent/extensions/pi-mcp-adapter/config.ts +9 -9
- package/resources/pi-agent/extensions/pi-mcp-adapter/consent-manager.ts +4 -4
- package/resources/pi-agent/extensions/pi-mcp-adapter/direct-tools.ts +13 -13
- package/resources/pi-agent/extensions/pi-mcp-adapter/glimpse-ui.ts +5 -5
- package/resources/pi-agent/extensions/pi-mcp-adapter/host-html-template.ts +13 -13
- package/resources/pi-agent/extensions/pi-mcp-adapter/index.ts +14 -14
- package/resources/pi-agent/extensions/pi-mcp-adapter/init.ts +17 -17
- package/resources/pi-agent/extensions/pi-mcp-adapter/lifecycle.ts +2 -2
- package/resources/pi-agent/extensions/pi-mcp-adapter/logger.ts +2 -2
- package/resources/pi-agent/extensions/pi-mcp-adapter/mcp-panel.ts +17 -17
- package/resources/pi-agent/extensions/pi-mcp-adapter/metadata-cache.ts +9 -9
- package/resources/pi-agent/extensions/pi-mcp-adapter/npx-resolver.ts +35 -35
- package/resources/pi-agent/extensions/pi-mcp-adapter/oauth-handler.ts +1 -1
- package/resources/pi-agent/extensions/pi-mcp-adapter/proxy-modes.ts +12 -12
- package/resources/pi-agent/extensions/pi-mcp-adapter/server-manager.ts +6 -6
- package/resources/pi-agent/extensions/pi-mcp-adapter/tool-metadata.ts +4 -4
- package/resources/pi-agent/extensions/pi-mcp-adapter/types.ts +2 -2
- package/resources/pi-agent/extensions/pi-mcp-adapter/ui-resource-handler.ts +6 -6
- package/resources/pi-agent/extensions/pi-mcp-adapter/ui-server.ts +17 -17
- package/resources/pi-agent/extensions/pi-mcp-adapter/ui-session.ts +22 -22
- package/resources/pi-agent/extensions/pi-mcp-adapter/utils.ts +2 -2
- package/resources/pi-agent/extensions/prompt-editor.ts +900 -900
- package/resources/pi-agent/extensions/prompt-url-widget.ts +122 -122
- package/resources/pi-agent/extensions/redraws.ts +14 -14
- package/resources/pi-agent/extensions/review.ts +1533 -1533
- package/resources/pi-agent/extensions/todos.ts +1735 -1735
- package/resources/pi-agent/extensions/tps.ts +40 -40
- package/resources/pi-agent/extensions/whimsical.ts +3 -3
- package/resources/pi-agent/prompts/agent-system.md +2 -0
- package/resources/pi-agent/prompts/coder-system.md +2 -0
- package/resources/pi-agent/skills/officecli/SKILL.md +113 -0
- package/server-loader.js +82 -1
- package/server-loader.js.map +3 -3
- package/tui.mjs +2 -0
- package/tui.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docyrus/docyrus",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docyrus API CLI",
|
|
6
6
|
"main": "./main.js",
|
|
@@ -10,30 +10,39 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@clack/prompts": "^0.11.0",
|
|
12
12
|
"@hono/node-server": "^1.14.1",
|
|
13
|
-
"@
|
|
14
|
-
"@mariozechner/pi-
|
|
13
|
+
"@libsql/client": "^0.17.2",
|
|
14
|
+
"@mariozechner/pi-ai": "0.64.0",
|
|
15
|
+
"@mariozechner/pi-coding-agent": "0.64.0",
|
|
15
16
|
"@modelcontextprotocol/ext-apps": "^1.2.2",
|
|
16
17
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
17
18
|
"@mozilla/readability": "^0.6.0",
|
|
18
19
|
"@opentui/core": "^0.1.85",
|
|
19
20
|
"@opentui/react": "^0.1.85",
|
|
21
|
+
"@repomix/tree-sitter-wasms": "^0.1.16",
|
|
20
22
|
"@sinclair/typebox": "^0.34.48",
|
|
21
23
|
"@xterm/headless": "^5.5.0",
|
|
22
24
|
"cheerio": "^1.1.2",
|
|
23
25
|
"diff": "^8.0.2",
|
|
24
26
|
"hono": "^4.7.10",
|
|
27
|
+
"ignore-walk": "^8.0.0",
|
|
25
28
|
"incur": "^0.1.6",
|
|
26
29
|
"jsdom": "^27.0.1",
|
|
30
|
+
"libsql": "^0.5.28",
|
|
27
31
|
"marked": "^15.0.12",
|
|
28
32
|
"marked-terminal": "^7.3.0",
|
|
29
33
|
"node-pty": "^1.0.0",
|
|
30
34
|
"picocolors": "^1.1.1",
|
|
31
35
|
"puppeteer-core": "^24.31.0",
|
|
32
36
|
"react": "^19.1.1",
|
|
37
|
+
"remark-frontmatter": "^5.0.0",
|
|
38
|
+
"remark-parse": "^11.0.0",
|
|
33
39
|
"strip-ansi": "^7.1.0",
|
|
34
40
|
"turndown": "^7.2.2",
|
|
35
41
|
"turndown-plugin-gfm": "^1.0.2",
|
|
36
42
|
"undici": "^7.16.0",
|
|
43
|
+
"unified": "^11.0.5",
|
|
44
|
+
"unist-util-visit": "^5.1.0",
|
|
45
|
+
"web-tree-sitter": "^0.26.8",
|
|
37
46
|
"zod": "^4.3.6"
|
|
38
47
|
},
|
|
39
48
|
"devDependencies": {
|
|
@@ -9,42 +9,42 @@ import { gfm } from "turndown-plugin-gfm";
|
|
|
9
9
|
// Global timeout - exit if script takes too long
|
|
10
10
|
const TIMEOUT = 30000;
|
|
11
11
|
const timeoutId = setTimeout(() => {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
console.error("✗ Timeout after 30s");
|
|
13
|
+
process.exit(1);
|
|
14
14
|
}, TIMEOUT).unref();
|
|
15
15
|
|
|
16
16
|
const url = process.argv[2];
|
|
17
17
|
|
|
18
18
|
if (!url) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
console.log("Usage: browser-content.js <url>");
|
|
20
|
+
console.log("\nExtracts readable content from a URL as markdown.");
|
|
21
|
+
console.log("\nExamples:");
|
|
22
|
+
console.log(" browser-content.js https://example.com");
|
|
23
|
+
console.log(" browser-content.js https://en.wikipedia.org/wiki/Rust_(programming_language)");
|
|
24
|
+
process.exit(1);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const b = await Promise.race([
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
puppeteer.connect({
|
|
29
|
+
browserURL: "http://localhost:9222",
|
|
30
|
+
defaultViewport: null,
|
|
31
|
+
}),
|
|
32
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 5000)),
|
|
33
33
|
]).catch((e) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
console.error("✗ Could not connect to browser:", e.message);
|
|
35
|
+
console.error(" Run: browser-start.js");
|
|
36
|
+
process.exit(1);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const p = (await b.pages()).at(-1);
|
|
40
40
|
if (!p) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
console.error("✗ No active tab found");
|
|
42
|
+
process.exit(1);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
await Promise.race([
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
p.goto(url, { waitUntil: "networkidle2" }),
|
|
47
|
+
new Promise((r) => setTimeout(r, 10000)),
|
|
48
48
|
]).catch(() => {});
|
|
49
49
|
|
|
50
50
|
// Get HTML via CDP (works even with TrustedScriptURL restrictions)
|
|
@@ -62,41 +62,41 @@ const article = reader.parse();
|
|
|
62
62
|
|
|
63
63
|
// Convert to markdown
|
|
64
64
|
function htmlToMarkdown(html) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
|
|
66
|
+
turndown.use(gfm);
|
|
67
|
+
turndown.addRule("removeEmptyLinks", {
|
|
68
|
+
filter: (node) => node.nodeName === "A" && !node.textContent?.trim(),
|
|
69
|
+
replacement: () => "",
|
|
70
|
+
});
|
|
71
|
+
return turndown
|
|
72
|
+
.turndown(html)
|
|
73
|
+
.replace(/\[\\?\[\s*\\?\]\]\([^)]*\)/g, "")
|
|
74
|
+
.replace(/ +/g, " ")
|
|
75
|
+
.replace(/\s+,/g, ",")
|
|
76
|
+
.replace(/\s+\./g, ".")
|
|
77
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
78
|
+
.trim();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
let content;
|
|
82
82
|
if (article && article.content) {
|
|
83
|
-
|
|
83
|
+
content = htmlToMarkdown(article.content);
|
|
84
84
|
} else {
|
|
85
85
|
// Fallback
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
const fallbackDoc = new JSDOM(outerHTML, { url: finalUrl });
|
|
87
|
+
const fallbackBody = fallbackDoc.window.document;
|
|
88
|
+
fallbackBody.querySelectorAll("script, style, noscript, nav, header, footer, aside").forEach((el) => el.remove());
|
|
89
|
+
const main = fallbackBody.querySelector("main, article, [role='main'], .content, #content") || fallbackBody.body;
|
|
90
|
+
const fallbackHtml = main?.innerHTML || "";
|
|
91
|
+
if (fallbackHtml.trim().length > 100) {
|
|
92
|
+
content = htmlToMarkdown(fallbackHtml);
|
|
93
|
+
} else {
|
|
94
|
+
content = "(Could not extract content)";
|
|
95
|
+
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
console.log(`URL: ${finalUrl}`);
|
|
99
|
-
if (article?.title) console.log(`Title: ${article.title}`);
|
|
99
|
+
if (article?.title) {console.log(`Title: ${article.title}`);}
|
|
100
100
|
console.log("");
|
|
101
101
|
console.log(content);
|
|
102
102
|
|
|
@@ -3,33 +3,33 @@
|
|
|
3
3
|
import puppeteer from "puppeteer-core";
|
|
4
4
|
|
|
5
5
|
const b = await Promise.race([
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
puppeteer.connect({
|
|
7
|
+
browserURL: "http://localhost:9222",
|
|
8
|
+
defaultViewport: null,
|
|
9
|
+
}),
|
|
10
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 5000)),
|
|
11
11
|
]).catch((e) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
console.error("✗ Could not connect to browser:", e.message);
|
|
13
|
+
console.error(" Run: browser-start.js");
|
|
14
|
+
process.exit(1);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
const p = (await b.pages()).at(-1);
|
|
18
18
|
|
|
19
19
|
if (!p) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
console.error("✗ No active tab found");
|
|
21
|
+
process.exit(1);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const cookies = await p.cookies();
|
|
25
25
|
|
|
26
26
|
for (const cookie of cookies) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
console.log(`${cookie.name}: ${cookie.value}`);
|
|
28
|
+
console.log(` domain: ${cookie.domain}`);
|
|
29
|
+
console.log(` path: ${cookie.path}`);
|
|
30
|
+
console.log(` httpOnly: ${cookie.httpOnly}`);
|
|
31
|
+
console.log(` secure: ${cookie.secure}`);
|
|
32
|
+
console.log("");
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
await b.disconnect();
|
|
@@ -4,50 +4,50 @@ import puppeteer from "puppeteer-core";
|
|
|
4
4
|
|
|
5
5
|
const code = process.argv.slice(2).join(" ");
|
|
6
6
|
if (!code) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
console.log("Usage: browser-eval.js 'code'");
|
|
8
|
+
console.log("\nExamples:");
|
|
9
|
+
console.log(' browser-eval.js "document.title"');
|
|
10
|
+
console.log(' browser-eval.js "document.querySelectorAll(\'a\').length"');
|
|
11
|
+
process.exit(1);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const b = await Promise.race([
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
puppeteer.connect({
|
|
16
|
+
browserURL: "http://localhost:9222",
|
|
17
|
+
defaultViewport: null,
|
|
18
|
+
}),
|
|
19
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 5000)),
|
|
20
20
|
]).catch((e) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
console.error("✗ Could not connect to browser:", e.message);
|
|
22
|
+
console.error(" Run: browser-start.js");
|
|
23
|
+
process.exit(1);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
const p = (await b.pages()).at(-1);
|
|
27
27
|
|
|
28
28
|
if (!p) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
console.error("✗ No active tab found");
|
|
30
|
+
process.exit(1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const result = await p.evaluate((c) => {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const AsyncFunction = (async() => {}).constructor;
|
|
35
|
+
return new AsyncFunction(`return (${c})`)();
|
|
36
36
|
}, code);
|
|
37
37
|
|
|
38
38
|
if (Array.isArray(result)) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
for (let i = 0; i < result.length; i++) {
|
|
40
|
+
if (i > 0) {console.log("");}
|
|
41
|
+
for (const [key, value] of Object.entries(result[i])) {
|
|
42
|
+
console.log(`${key}: ${value}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
45
|
} else if (typeof result === "object" && result !== null) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
for (const [key, value] of Object.entries(result)) {
|
|
47
|
+
console.log(`${key}: ${value}`);
|
|
48
|
+
}
|
|
49
49
|
} else {
|
|
50
|
-
|
|
50
|
+
console.log(result);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
await b.disconnect();
|
|
@@ -29,7 +29,7 @@ async function scrapeHackerNews(limit = 30) {
|
|
|
29
29
|
|
|
30
30
|
// Each submission has class 'athing'
|
|
31
31
|
$('.athing').each((index, element) => {
|
|
32
|
-
if (submissions.length >= limit) return false; // Stop when limit reached
|
|
32
|
+
if (submissions.length >= limit) {return false;} // Stop when limit reached
|
|
33
33
|
|
|
34
34
|
const $element = $(element);
|
|
35
35
|
const id = $element.attr('id');
|
|
@@ -8,37 +8,37 @@ const reload = args.includes("--reload");
|
|
|
8
8
|
const url = args.find(a => !a.startsWith("--"));
|
|
9
9
|
|
|
10
10
|
if (!url) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
console.log("Usage: browser-nav.js <url> [--new] [--reload]");
|
|
12
|
+
console.log("\nExamples:");
|
|
13
|
+
console.log(" browser-nav.js https://example.com # Navigate current tab");
|
|
14
|
+
console.log(" browser-nav.js https://example.com --new # Open in new tab");
|
|
15
|
+
console.log(" browser-nav.js https://example.com --reload # Navigate and force reload");
|
|
16
|
+
process.exit(1);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const b = await Promise.race([
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
puppeteer.connect({
|
|
21
|
+
browserURL: "http://localhost:9222",
|
|
22
|
+
defaultViewport: null,
|
|
23
|
+
}),
|
|
24
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 5000)),
|
|
25
25
|
]).catch((e) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
console.error("✗ Could not connect to browser:", e.message);
|
|
27
|
+
console.error(" Run: browser-start.js");
|
|
28
|
+
process.exit(1);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
if (newTab) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const p = await b.newPage();
|
|
33
|
+
await p.goto(url, { waitUntil: "domcontentloaded" });
|
|
34
|
+
console.log("✓ Opened:", url);
|
|
35
35
|
} else {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const p = (await b.pages()).at(-1);
|
|
37
|
+
await p.goto(url, { waitUntil: "domcontentloaded" });
|
|
38
|
+
if (reload) {
|
|
39
|
+
await p.reload({ waitUntil: "domcontentloaded" });
|
|
40
|
+
}
|
|
41
|
+
console.log("✓ Navigated to:", url);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
await b.disconnect();
|