@downcity/plugins 1.0.248 → 1.0.253
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/bin/image/ImagePlugin.d.ts +1 -1
- package/bin/image/ImagePlugin.d.ts.map +1 -1
- package/bin/image/ImagePlugin.js +23 -8
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/image/runtime/ImageResultStorage.d.ts +14 -0
- package/bin/image/runtime/ImageResultStorage.d.ts.map +1 -0
- package/bin/image/runtime/ImageResultStorage.js +167 -0
- package/bin/image/runtime/ImageResultStorage.js.map +1 -0
- package/bin/image/types/ImagePlugin.d.ts +22 -0
- package/bin/image/types/ImagePlugin.d.ts.map +1 -1
- package/bin/web/Plugin.d.ts +25 -30
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +254 -110
- package/bin/web/Plugin.js.map +1 -1
- package/bin/web/providers/ComputerUseBrowserProviderAdapter.d.ts +35 -0
- package/bin/web/providers/ComputerUseBrowserProviderAdapter.d.ts.map +1 -0
- package/bin/web/providers/ComputerUseBrowserProviderAdapter.js +62 -0
- package/bin/web/providers/ComputerUseBrowserProviderAdapter.js.map +1 -0
- package/bin/web/providers/PlaywrightBrowserProvider.d.ts +43 -0
- package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -0
- package/bin/web/providers/PlaywrightBrowserProvider.js +184 -0
- package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -0
- package/bin/web/providers/SemanticBrowserProviderAdapter.d.ts +39 -0
- package/bin/web/providers/SemanticBrowserProviderAdapter.d.ts.map +1 -0
- package/bin/web/providers/SemanticBrowserProviderAdapter.js +61 -0
- package/bin/web/providers/SemanticBrowserProviderAdapter.js.map +1 -0
- package/bin/web/types/ComputerUseBrowserProviderAdapter.d.ts +43 -0
- package/bin/web/types/ComputerUseBrowserProviderAdapter.d.ts.map +1 -0
- package/bin/web/types/ComputerUseBrowserProviderAdapter.js +8 -0
- package/bin/web/types/ComputerUseBrowserProviderAdapter.js.map +1 -0
- package/bin/web/types/PlaywrightBrowserProvider.d.ts +17 -0
- package/bin/web/types/PlaywrightBrowserProvider.d.ts.map +1 -0
- package/bin/web/types/PlaywrightBrowserProvider.js +7 -0
- package/bin/web/types/PlaywrightBrowserProvider.js.map +1 -0
- package/bin/web/types/SemanticBrowserProviderAdapter.d.ts +19 -0
- package/bin/web/types/SemanticBrowserProviderAdapter.d.ts.map +1 -0
- package/bin/web/types/SemanticBrowserProviderAdapter.js +8 -0
- package/bin/web/types/SemanticBrowserProviderAdapter.js.map +1 -0
- package/bin/web/types/WebPlugin.d.ts +213 -63
- package/bin/web/types/WebPlugin.d.ts.map +1 -1
- package/bin/web/types/WebPlugin.js +23 -11
- package/bin/web/types/WebPlugin.js.map +1 -1
- package/bin/web.d.ts +9 -3
- package/bin/web.d.ts.map +1 -1
- package/bin/web.js +5 -2
- package/bin/web.js.map +1 -1
- package/package.json +4 -3
- package/scripts/web-plugin.test.mjs +195 -57
- package/src/image/ImagePlugin.ts +23 -8
- package/src/image/runtime/ImageResultStorage.ts +198 -0
- package/src/image/types/ImagePlugin.ts +24 -0
- package/src/web/Plugin.ts +289 -125
- package/src/web/providers/ComputerUseBrowserProviderAdapter.ts +93 -0
- package/src/web/providers/PlaywrightBrowserProvider.ts +239 -0
- package/src/web/providers/SemanticBrowserProviderAdapter.ts +92 -0
- package/src/web/types/ComputerUseBrowserProviderAdapter.ts +58 -0
- package/src/web/types/PlaywrightBrowserProvider.ts +17 -0
- package/src/web/types/SemanticBrowserProviderAdapter.ts +30 -0
- package/src/web/types/WebPlugin.ts +236 -63
- package/src/web.ts +30 -8
- package/bin/web/PROMPT.d.ts +0 -7
- package/bin/web/PROMPT.d.ts.map +0 -1
- package/bin/web/PROMPT.js +0 -8
- package/bin/web/PROMPT.js.map +0 -1
- package/bin/web/WebPromptAssets.d.ts +0 -12
- package/bin/web/WebPromptAssets.d.ts.map +0 -1
- package/bin/web/WebPromptAssets.js +0 -13
- package/bin/web/WebPromptAssets.js.map +0 -1
- package/bin/web/runtime/Prompt.d.ts +0 -14
- package/bin/web/runtime/Prompt.d.ts.map +0 -1
- package/bin/web/runtime/Prompt.js +0 -77
- package/bin/web/runtime/Prompt.js.map +0 -1
- package/src/web/PROMPT.ts +0 -9
- package/src/web/PROMPT.ts.txt +0 -61
- package/src/web/WebPromptAssets.ts +0 -14
- package/src/web/runtime/Prompt.ts +0 -99
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebPlugin 安装提示词渲染器。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 只生成 Agent 可执行的操作说明,不执行命令、访问网络或修改文件。
|
|
6
|
-
* - Skill 安装委托给 SkillPlugin,避免重复维护扫描根与安装位置规则。
|
|
7
|
-
* - agent-browser CLI 仅根据请求的作用域提供 Shell 命令候选。
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type {
|
|
11
|
-
WebPluginInstallInstructions,
|
|
12
|
-
WebPluginInstallPayload,
|
|
13
|
-
WebPluginInstallScope,
|
|
14
|
-
WebPluginInstallTarget,
|
|
15
|
-
} from "@/web/types/WebPlugin.js";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 归一化联网能力目标。
|
|
19
|
-
*/
|
|
20
|
-
function resolve_install_target(
|
|
21
|
-
target: WebPluginInstallPayload["target"],
|
|
22
|
-
): WebPluginInstallTarget {
|
|
23
|
-
return target === "agent-browser" || target === "all"
|
|
24
|
-
? target
|
|
25
|
-
: "web-access";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 归一化 CLI 安装作用域。
|
|
30
|
-
*/
|
|
31
|
-
function resolve_install_scope(
|
|
32
|
-
scope: WebPluginInstallPayload["scope"],
|
|
33
|
-
): WebPluginInstallScope {
|
|
34
|
-
return scope === "project" ? "project" : "user";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 渲染单个 Skill 的安装工作流。
|
|
39
|
-
*/
|
|
40
|
-
function render_skill_install_step(skill_name: string): string {
|
|
41
|
-
return [
|
|
42
|
-
`- Call \`plugin_call({ plugin: "skill", action: "install", payload: { spec: "${skill_name}" } })\`.`,
|
|
43
|
-
" Follow the returned scan-aware Shell instructions. The WebPlugin has not installed this Skill.",
|
|
44
|
-
].join("\n");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 渲染 agent-browser CLI 的安装提示。
|
|
49
|
-
*/
|
|
50
|
-
function render_agent_browser_cli_step(scope: WebPluginInstallScope): string {
|
|
51
|
-
if (scope === "project") {
|
|
52
|
-
return [
|
|
53
|
-
"- Inspect the project lockfile and use its existing package manager to install `agent-browser` as a devDependency:",
|
|
54
|
-
" - pnpm: `pnpm add -D agent-browser`",
|
|
55
|
-
" - npm: `npm install -D agent-browser`",
|
|
56
|
-
" - yarn: `yarn add -D agent-browser`",
|
|
57
|
-
"- Verify the project-local CLI with the matching package-manager command, for example `pnpm exec agent-browser --help`.",
|
|
58
|
-
].join("\n");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return [
|
|
62
|
-
"- Install the CLI globally with `npm install -g agent-browser`.",
|
|
63
|
-
"- Verify it with `agent-browser --help`.",
|
|
64
|
-
].join("\n");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 生成 web install action 返回的纯提示词。
|
|
69
|
-
*/
|
|
70
|
-
export function render_web_install_prompt(
|
|
71
|
-
payload: WebPluginInstallPayload | null | undefined,
|
|
72
|
-
): WebPluginInstallInstructions {
|
|
73
|
-
const target = resolve_install_target(payload?.target);
|
|
74
|
-
const scope = resolve_install_scope(payload?.scope);
|
|
75
|
-
const skill_names =
|
|
76
|
-
target === "all" ? ["web-access", "agent-browser"] : [target];
|
|
77
|
-
const skill_steps = skill_names.map(render_skill_install_step).join("\n");
|
|
78
|
-
const cli_steps =
|
|
79
|
-
target === "agent-browser" || target === "all"
|
|
80
|
-
? ["", "## agent-browser CLI", render_agent_browser_cli_step(scope)]
|
|
81
|
-
: [];
|
|
82
|
-
|
|
83
|
-
const prompt = [
|
|
84
|
-
"# Install Web Capabilities Instructions",
|
|
85
|
-
"",
|
|
86
|
-
"This action only returns instructions. It has not executed commands, accessed the network, installed dependencies, or changed files.",
|
|
87
|
-
"",
|
|
88
|
-
"## Skills",
|
|
89
|
-
skill_steps,
|
|
90
|
-
...cli_steps,
|
|
91
|
-
"",
|
|
92
|
-
"## Verification",
|
|
93
|
-
"After completing the Shell steps, call `plugin_call({ plugin: \"skill\", action: \"list\", payload: {} })` and confirm every requested Skill is discoverable.",
|
|
94
|
-
"Call `skill.lookup` for each installed Skill before using it.",
|
|
95
|
-
"If the `skill` plugin is unavailable, configure it before installing a Skill; do not guess an unscanned destination.",
|
|
96
|
-
].join("\n");
|
|
97
|
-
|
|
98
|
-
return { kind: "instructions", target, scope, prompt };
|
|
99
|
-
}
|