@docyrus/docyrus 0.0.19 → 0.0.21
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/agent-loader.js +37 -3
- package/agent-loader.js.map +2 -2
- package/main.js +498 -93
- package/main.js.map +4 -4
- package/package.json +14 -4
- package/resources/chrome-tools/browser-content.js +103 -0
- package/resources/chrome-tools/browser-cookies.js +35 -0
- package/resources/chrome-tools/browser-eval.js +53 -0
- package/resources/chrome-tools/browser-hn-scraper.js +108 -0
- package/resources/chrome-tools/browser-nav.js +44 -0
- package/resources/chrome-tools/browser-pick.js +162 -0
- package/resources/chrome-tools/browser-screenshot.js +34 -0
- package/resources/chrome-tools/browser-start.js +86 -0
- package/resources/pi-agent/extensions/answer.ts +532 -0
- package/resources/pi-agent/extensions/context.ts +578 -0
- package/resources/pi-agent/extensions/control.ts +1779 -0
- package/resources/pi-agent/extensions/diff.ts +218 -0
- package/resources/pi-agent/extensions/files.ts +199 -0
- package/resources/pi-agent/extensions/loop.ts +446 -0
- package/resources/pi-agent/extensions/multi-edit.ts +835 -0
- package/resources/pi-agent/extensions/notify.ts +88 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/CHANGELOG.md +192 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/LICENSE +21 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/README.md +296 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/app-bridge.bundle.js +67 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/cli.js +108 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/commands.ts +211 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/config.ts +227 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/consent-manager.ts +64 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/direct-tools.ts +301 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/errors.ts +219 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/glimpse-ui.ts +80 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/host-html-template.ts +427 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/index.ts +232 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/init.ts +319 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/lifecycle.ts +93 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/logger.ts +169 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/mcp-panel.ts +713 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/metadata-cache.ts +191 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/npx-resolver.ts +419 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/oauth-handler.ts +56 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/package.json +85 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/paths.ts +29 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/proxy-modes.ts +635 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/resource-tools.ts +17 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/server-manager.ts +330 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/state.ts +41 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/tool-metadata.ts +144 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/tool-registrar.ts +46 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/types.ts +367 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/ui-resource-handler.ts +145 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/ui-server.ts +623 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/ui-session.ts +384 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/ui-stream-types.ts +89 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/utils.ts +75 -0
- package/resources/pi-agent/extensions/prompt-editor.ts +1315 -0
- package/resources/pi-agent/extensions/prompt-url-widget.ts +158 -0
- package/resources/pi-agent/extensions/redraws.ts +24 -0
- package/resources/pi-agent/extensions/review.ts +2160 -0
- package/resources/pi-agent/extensions/todos.ts +2076 -0
- package/resources/pi-agent/extensions/tps.ts +47 -0
- package/resources/pi-agent/extensions/whimsical.ts +474 -0
- package/resources/pi-agent/prompts/coder-system.md +106 -0
- package/resources/pi-agent/skills/changelog-generator/SKILL.md +425 -0
- package/resources/pi-agent/skills/docyrus-chrome-devtools-cli/SKILL.md +80 -0
- package/resources/pi-agent/skills/docyrus-platform/SKILL.md +71 -0
- package/resources/pi-agent/skills/docyrus-platform/references/ai-capabilities.md +43 -0
- package/resources/pi-agent/skills/docyrus-platform/references/auth-and-multi-tenancy.md +35 -0
- package/resources/pi-agent/skills/docyrus-platform/references/automation-and-workflows.md +30 -0
- package/resources/pi-agent/skills/docyrus-platform/references/core-building-blocks.md +53 -0
- package/resources/pi-agent/skills/{docyrus-api-dev → docyrus-platform}/references/data-source-query-guide.md +32 -28
- package/resources/pi-agent/skills/docyrus-platform/references/developer-tools.md +28 -0
- package/resources/pi-agent/skills/docyrus-platform/references/docyrus-cli-usage.md +554 -0
- package/resources/pi-agent/skills/{docyrus-api-dev → docyrus-platform}/references/formula-design-guide-llm.md +15 -23
- package/resources/pi-agent/skills/docyrus-platform/references/integrations-and-events.md +60 -0
- package/resources/pi-agent/skills/docyrus-platform/references/platform-services.md +58 -0
- package/resources/pi-agent/skills/docyrus-platform/references/querying-and-data-operations.md +27 -0
- package/resources/pi-agent/prompts/coder-append-system.md +0 -19
- package/resources/pi-agent/skills/docyrus-ai/SKILL.md +0 -28
- package/resources/pi-agent/skills/docyrus-api-dev/SKILL.md +0 -161
- package/resources/pi-agent/skills/docyrus-api-dev/references/api-client.md +0 -349
- package/resources/pi-agent/skills/docyrus-api-dev/references/authentication.md +0 -238
- package/resources/pi-agent/skills/docyrus-api-dev/references/query-and-formulas.md +0 -592
- package/resources/pi-agent/skills/docyrus-api-doctor/SKILL.md +0 -70
- package/resources/pi-agent/skills/docyrus-api-doctor/references/checklist-details.md +0 -588
- package/resources/pi-agent/skills/docyrus-app-dev/SKILL.md +0 -159
- package/resources/pi-agent/skills/docyrus-app-dev/references/api-client-and-auth.md +0 -275
- package/resources/pi-agent/skills/docyrus-app-dev/references/collections-and-patterns.md +0 -352
- package/resources/pi-agent/skills/docyrus-app-dev/references/data-source-query-guide.md +0 -2059
- package/resources/pi-agent/skills/docyrus-app-dev/references/formula-design-guide-llm.md +0 -320
- package/resources/pi-agent/skills/docyrus-app-dev/references/query-guide.md +0 -525
- package/resources/pi-agent/skills/docyrus-app-ui-design/SKILL.md +0 -466
- package/resources/pi-agent/skills/docyrus-app-ui-design/references/component-selection-guide.md +0 -602
- package/resources/pi-agent/skills/docyrus-app-ui-design/references/icon-usage-guide.md +0 -463
- package/resources/pi-agent/skills/docyrus-app-ui-design/references/preferred-components-catalog.md +0 -242
- package/resources/pi-agent/skills/docyrus-apps/SKILL.md +0 -54
- package/resources/pi-agent/skills/docyrus-architect/SKILL.md +0 -174
- package/resources/pi-agent/skills/docyrus-architect/references/custom-query-guide.md +0 -410
- package/resources/pi-agent/skills/docyrus-architect/references/data-source-query-guide.md +0 -2059
- package/resources/pi-agent/skills/docyrus-architect/references/formula-design-guide-llm.md +0 -320
- package/resources/pi-agent/skills/docyrus-architect/references/formula-reference.md +0 -145
- package/resources/pi-agent/skills/docyrus-auth/SKILL.md +0 -100
- package/resources/pi-agent/skills/docyrus-cli-app/SKILL.md +0 -279
- package/resources/pi-agent/skills/docyrus-cli-app/references/cli-manifest.md +0 -532
- package/resources/pi-agent/skills/docyrus-cli-app/references/list-query-examples.md +0 -248
- package/resources/pi-agent/skills/docyrus-curl/SKILL.md +0 -32
- package/resources/pi-agent/skills/docyrus-discover/SKILL.md +0 -63
- package/resources/pi-agent/skills/docyrus-ds/SKILL.md +0 -95
- package/resources/pi-agent/skills/docyrus-env/SKILL.md +0 -21
- package/resources/pi-agent/skills/docyrus-studio/SKILL.md +0 -369
- package/resources/pi-agent/skills/docyrus-tui/SKILL.md +0 -15
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { DynamicBorder, type ExtensionAPI, type ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
import { Container, Text } from "@mariozechner/pi-tui";
|
|
3
|
+
|
|
4
|
+
const PR_PROMPT_PATTERN = /^\s*You are given one or more GitHub PR URLs:\s*(\S+)/im;
|
|
5
|
+
const ISSUE_PROMPT_PATTERN = /^\s*Analyze GitHub issue\(s\):\s*(\S+)/im;
|
|
6
|
+
|
|
7
|
+
type PromptMatch = {
|
|
8
|
+
kind: "pr" | "issue";
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type GhMetadata = {
|
|
13
|
+
title?: string;
|
|
14
|
+
author?: {
|
|
15
|
+
login?: string;
|
|
16
|
+
name?: string | null;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function extractPromptMatch(prompt: string): PromptMatch | undefined {
|
|
21
|
+
const prMatch = prompt.match(PR_PROMPT_PATTERN);
|
|
22
|
+
if (prMatch?.[1]) {
|
|
23
|
+
return { kind: "pr", url: prMatch[1].trim() };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const issueMatch = prompt.match(ISSUE_PROMPT_PATTERN);
|
|
27
|
+
if (issueMatch?.[1]) {
|
|
28
|
+
return { kind: "issue", url: issueMatch[1].trim() };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function fetchGhMetadata(
|
|
35
|
+
pi: ExtensionAPI,
|
|
36
|
+
kind: PromptMatch["kind"],
|
|
37
|
+
url: string,
|
|
38
|
+
): Promise<GhMetadata | undefined> {
|
|
39
|
+
const args =
|
|
40
|
+
kind === "pr" ? ["pr", "view", url, "--json", "title,author"] : ["issue", "view", url, "--json", "title,author"];
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const result = await pi.exec("gh", args);
|
|
44
|
+
if (result.code !== 0 || !result.stdout) return undefined;
|
|
45
|
+
return JSON.parse(result.stdout) as GhMetadata;
|
|
46
|
+
} catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function formatAuthor(author?: GhMetadata["author"]): string | undefined {
|
|
52
|
+
if (!author) return undefined;
|
|
53
|
+
const name = author.name?.trim();
|
|
54
|
+
const login = author.login?.trim();
|
|
55
|
+
if (name && login) return `${name} (@${login})`;
|
|
56
|
+
if (login) return `@${login}`;
|
|
57
|
+
if (name) return name;
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default function promptUrlWidgetExtension(pi: ExtensionAPI) {
|
|
62
|
+
const setWidget = (ctx: ExtensionContext, match: PromptMatch, title?: string, authorText?: string) => {
|
|
63
|
+
ctx.ui.setWidget("prompt-url", (_tui, thm) => {
|
|
64
|
+
const titleText = title ? thm.fg("accent", title) : thm.fg("accent", match.url);
|
|
65
|
+
const authorLine = authorText ? thm.fg("muted", authorText) : undefined;
|
|
66
|
+
const urlLine = thm.fg("dim", match.url);
|
|
67
|
+
|
|
68
|
+
const lines = [titleText];
|
|
69
|
+
if (authorLine) lines.push(authorLine);
|
|
70
|
+
lines.push(urlLine);
|
|
71
|
+
|
|
72
|
+
const container = new Container();
|
|
73
|
+
container.addChild(new DynamicBorder((s: string) => thm.fg("muted", s)));
|
|
74
|
+
container.addChild(new Text(lines.join("\n"), 1, 0));
|
|
75
|
+
return container;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const applySessionName = (ctx: ExtensionContext, match: PromptMatch, title?: string) => {
|
|
80
|
+
const label = match.kind === "pr" ? "PR" : "Issue";
|
|
81
|
+
const trimmedTitle = title?.trim();
|
|
82
|
+
const fallbackName = `${label}: ${match.url}`;
|
|
83
|
+
const desiredName = trimmedTitle ? `${label}: ${trimmedTitle} (${match.url})` : fallbackName;
|
|
84
|
+
const currentName = pi.getSessionName()?.trim();
|
|
85
|
+
if (!currentName) {
|
|
86
|
+
pi.setSessionName(desiredName);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (currentName === match.url || currentName === fallbackName) {
|
|
90
|
+
pi.setSessionName(desiredName);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
pi.on("before_agent_start", async (event, ctx) => {
|
|
95
|
+
if (!ctx.hasUI) return;
|
|
96
|
+
const match = extractPromptMatch(event.prompt);
|
|
97
|
+
if (!match) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
setWidget(ctx, match);
|
|
102
|
+
applySessionName(ctx, match);
|
|
103
|
+
void fetchGhMetadata(pi, match.kind, match.url).then((meta) => {
|
|
104
|
+
const title = meta?.title?.trim();
|
|
105
|
+
const authorText = formatAuthor(meta?.author);
|
|
106
|
+
setWidget(ctx, match, title, authorText);
|
|
107
|
+
applySessionName(ctx, match, title);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
pi.on("session_switch", async (_event, ctx) => {
|
|
112
|
+
rebuildFromSession(ctx);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const getUserText = (content: string | { type: string; text?: string }[] | undefined): string => {
|
|
116
|
+
if (!content) return "";
|
|
117
|
+
if (typeof content === "string") return content;
|
|
118
|
+
return (
|
|
119
|
+
content
|
|
120
|
+
.filter((block): block is { type: "text"; text: string } => block.type === "text")
|
|
121
|
+
.map((block) => block.text)
|
|
122
|
+
.join("\n") ?? ""
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const rebuildFromSession = (ctx: ExtensionContext) => {
|
|
127
|
+
if (!ctx.hasUI) return;
|
|
128
|
+
|
|
129
|
+
const entries = ctx.sessionManager.getEntries();
|
|
130
|
+
const lastMatch = [...entries].reverse().find((entry) => {
|
|
131
|
+
if (entry.type !== "message" || entry.message.role !== "user") return false;
|
|
132
|
+
const text = getUserText(entry.message.content);
|
|
133
|
+
return !!extractPromptMatch(text);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const content =
|
|
137
|
+
lastMatch?.type === "message" && lastMatch.message.role === "user" ? lastMatch.message.content : undefined;
|
|
138
|
+
const text = getUserText(content);
|
|
139
|
+
const match = text ? extractPromptMatch(text) : undefined;
|
|
140
|
+
if (!match) {
|
|
141
|
+
ctx.ui.setWidget("prompt-url", undefined);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
setWidget(ctx, match);
|
|
146
|
+
applySessionName(ctx, match);
|
|
147
|
+
void fetchGhMetadata(pi, match.kind, match.url).then((meta) => {
|
|
148
|
+
const title = meta?.title?.trim();
|
|
149
|
+
const authorText = formatAuthor(meta?.author);
|
|
150
|
+
setWidget(ctx, match, title, authorText);
|
|
151
|
+
applySessionName(ctx, match, title);
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
156
|
+
rebuildFromSession(ctx);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redraws Extension
|
|
3
|
+
*
|
|
4
|
+
* Exposes /tui to show TUI redraw stats.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
8
|
+
import { Text } from "@mariozechner/pi-tui";
|
|
9
|
+
|
|
10
|
+
export default function (pi: ExtensionAPI) {
|
|
11
|
+
pi.registerCommand("tui", {
|
|
12
|
+
description: "Show TUI stats",
|
|
13
|
+
handler: async (_args, ctx) => {
|
|
14
|
+
if (!ctx.hasUI) return;
|
|
15
|
+
let redraws = 0;
|
|
16
|
+
await ctx.ui.custom<void>((tui, _theme, _keybindings, done) => {
|
|
17
|
+
redraws = tui.fullRedraws;
|
|
18
|
+
done(undefined);
|
|
19
|
+
return new Text("", 0, 0);
|
|
20
|
+
});
|
|
21
|
+
ctx.ui.notify(`TUI full redraws: ${redraws}`, "info");
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|