@downcity/plugins 1.0.246 → 1.0.252

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 (76) hide show
  1. package/bin/image/ImagePlugin.d.ts +1 -1
  2. package/bin/image/ImagePlugin.d.ts.map +1 -1
  3. package/bin/image/ImagePlugin.js +26 -10
  4. package/bin/image/ImagePlugin.js.map +1 -1
  5. package/bin/image/runtime/ImageResultStorage.d.ts +14 -0
  6. package/bin/image/runtime/ImageResultStorage.d.ts.map +1 -0
  7. package/bin/image/runtime/ImageResultStorage.js +167 -0
  8. package/bin/image/runtime/ImageResultStorage.js.map +1 -0
  9. package/bin/image/types/ImagePlugin.d.ts +22 -0
  10. package/bin/image/types/ImagePlugin.d.ts.map +1 -1
  11. package/bin/web/Plugin.d.ts +25 -30
  12. package/bin/web/Plugin.d.ts.map +1 -1
  13. package/bin/web/Plugin.js +254 -110
  14. package/bin/web/Plugin.js.map +1 -1
  15. package/bin/web/providers/ComputerUseBrowserProviderAdapter.d.ts +35 -0
  16. package/bin/web/providers/ComputerUseBrowserProviderAdapter.d.ts.map +1 -0
  17. package/bin/web/providers/ComputerUseBrowserProviderAdapter.js +62 -0
  18. package/bin/web/providers/ComputerUseBrowserProviderAdapter.js.map +1 -0
  19. package/bin/web/providers/PlaywrightBrowserProvider.d.ts +43 -0
  20. package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -0
  21. package/bin/web/providers/PlaywrightBrowserProvider.js +184 -0
  22. package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -0
  23. package/bin/web/providers/SemanticBrowserProviderAdapter.d.ts +39 -0
  24. package/bin/web/providers/SemanticBrowserProviderAdapter.d.ts.map +1 -0
  25. package/bin/web/providers/SemanticBrowserProviderAdapter.js +61 -0
  26. package/bin/web/providers/SemanticBrowserProviderAdapter.js.map +1 -0
  27. package/bin/web/types/ComputerUseBrowserProviderAdapter.d.ts +43 -0
  28. package/bin/web/types/ComputerUseBrowserProviderAdapter.d.ts.map +1 -0
  29. package/bin/web/types/ComputerUseBrowserProviderAdapter.js +8 -0
  30. package/bin/web/types/ComputerUseBrowserProviderAdapter.js.map +1 -0
  31. package/bin/web/types/PlaywrightBrowserProvider.d.ts +17 -0
  32. package/bin/web/types/PlaywrightBrowserProvider.d.ts.map +1 -0
  33. package/bin/web/types/PlaywrightBrowserProvider.js +7 -0
  34. package/bin/web/types/PlaywrightBrowserProvider.js.map +1 -0
  35. package/bin/web/types/SemanticBrowserProviderAdapter.d.ts +19 -0
  36. package/bin/web/types/SemanticBrowserProviderAdapter.d.ts.map +1 -0
  37. package/bin/web/types/SemanticBrowserProviderAdapter.js +8 -0
  38. package/bin/web/types/SemanticBrowserProviderAdapter.js.map +1 -0
  39. package/bin/web/types/WebPlugin.d.ts +213 -63
  40. package/bin/web/types/WebPlugin.d.ts.map +1 -1
  41. package/bin/web/types/WebPlugin.js +23 -11
  42. package/bin/web/types/WebPlugin.js.map +1 -1
  43. package/bin/web.d.ts +9 -3
  44. package/bin/web.d.ts.map +1 -1
  45. package/bin/web.js +5 -2
  46. package/bin/web.js.map +1 -1
  47. package/package.json +4 -3
  48. package/scripts/web-plugin.test.mjs +195 -57
  49. package/src/image/ImagePlugin.ts +25 -12
  50. package/src/image/runtime/ImageResultStorage.ts +198 -0
  51. package/src/image/types/ImagePlugin.ts +24 -0
  52. package/src/web/Plugin.ts +289 -125
  53. package/src/web/providers/ComputerUseBrowserProviderAdapter.ts +93 -0
  54. package/src/web/providers/PlaywrightBrowserProvider.ts +239 -0
  55. package/src/web/providers/SemanticBrowserProviderAdapter.ts +92 -0
  56. package/src/web/types/ComputerUseBrowserProviderAdapter.ts +58 -0
  57. package/src/web/types/PlaywrightBrowserProvider.ts +17 -0
  58. package/src/web/types/SemanticBrowserProviderAdapter.ts +30 -0
  59. package/src/web/types/WebPlugin.ts +236 -63
  60. package/src/web.ts +30 -8
  61. package/bin/web/PROMPT.d.ts +0 -7
  62. package/bin/web/PROMPT.d.ts.map +0 -1
  63. package/bin/web/PROMPT.js +0 -8
  64. package/bin/web/PROMPT.js.map +0 -1
  65. package/bin/web/WebPromptAssets.d.ts +0 -12
  66. package/bin/web/WebPromptAssets.d.ts.map +0 -1
  67. package/bin/web/WebPromptAssets.js +0 -13
  68. package/bin/web/WebPromptAssets.js.map +0 -1
  69. package/bin/web/runtime/Prompt.d.ts +0 -14
  70. package/bin/web/runtime/Prompt.d.ts.map +0 -1
  71. package/bin/web/runtime/Prompt.js +0 -77
  72. package/bin/web/runtime/Prompt.js.map +0 -1
  73. package/src/web/PROMPT.ts +0 -9
  74. package/src/web/PROMPT.ts.txt +0 -61
  75. package/src/web/WebPromptAssets.ts +0 -14
  76. package/src/web/runtime/Prompt.ts +0 -99
@@ -1,78 +1,251 @@
1
1
  /**
2
- * WebPlugin 协议类型。
2
+ * WebPlugin 的公开协议类型。
3
3
  *
4
4
  * 关键点(中文)
5
- * - web plugin 只注入联网方法论,不维护 provider 运行态。
6
- * - install action 只返回安装提示,不执行命令或修改文件。
7
- * - target 表示需要安装说明的联网能力,不表示 agent 运行时默认选择。
5
+ * - WebPlugin 只定义联网能力的稳定边界,不绑定搜索服务、浏览器云厂商或模型。
6
+ * - 浏览器 provider 负责 session 的创建、观察、动作执行和关闭。
7
+ * - 所有 action 返回值都保持 JSON 可序列化,避免把 Playwright 对象泄漏到 Agent 内核。
8
8
  */
9
9
 
10
10
  import type { JsonObject } from "@downcity/agent";
11
11
 
12
- /**
13
- * WebPlugin action 名称常量。
14
- */
12
+ /** WebPlugin 对外 action 名称。 */
15
13
  export const WEB_PLUGIN_ACTIONS = {
16
- /**
17
- * 返回联网能力的安装操作提示。
18
- */
19
- install: "install",
14
+ /** 搜索公开网页或索引。 */
15
+ search: "search",
16
+ /** 打开已知 URL 并读取文档。 */
17
+ open: "open",
18
+ /** 创建浏览器 session。 */
19
+ browser_create_session: "browser_create_session",
20
+ /** 读取浏览器当前状态。 */
21
+ browser_observe: "browser_observe",
22
+ /** 执行一个确定性的浏览器动作。 */
23
+ browser_act: "browser_act",
24
+ /** 执行一个由语义 provider 解释的自然语言动作。 */
25
+ browser_semantic_act: "browser_semantic_act",
26
+ /** 从当前浏览器页面抽取文本。 */
27
+ browser_extract: "browser_extract",
28
+ /** 使用语义 provider 抽取页面内容。 */
29
+ browser_semantic_extract: "browser_semantic_extract",
30
+ /** 关闭浏览器 session。 */
31
+ browser_close_session: "browser_close_session",
20
32
  } as const;
21
33
 
22
- /**
23
- * WebPlugin 安装提示目标。
24
- */
25
- export type WebPluginInstallTarget = "web-access" | "agent-browser" | "all";
34
+ /** WebPlugin action 名称联合类型。 */
35
+ export type WebPluginActionName =
36
+ (typeof WEB_PLUGIN_ACTIONS)[keyof typeof WEB_PLUGIN_ACTIONS];
26
37
 
27
- /**
28
- * agent-browser CLI 安装作用域。
29
- */
30
- export type WebPluginInstallScope = "user" | "project";
38
+ /** 搜索 action 输入。 */
39
+ export interface WebSearchInput {
40
+ /** 用户要检索的自然语言查询。 */
41
+ query: string;
42
+ /** 最多返回的结果数量,provider 可自行设置上限。 */
43
+ limit?: number;
44
+ /** 只搜索这些域名;不传时由 provider 决定搜索范围。 */
45
+ domains?: string[];
46
+ }
31
47
 
32
- /**
33
- * WebPlugin install 提示 action 输入。
34
- */
35
- export interface WebPluginInstallPayload {
36
- /**
37
- * 需要获取安装说明的联网能力。
38
- *
39
- * 说明(中文)
40
- * - `web-access`:返回 web-access Skill 的安装工作流。
41
- * - `agent-browser`:返回 agent-browser Skill 与 CLI 的安装工作流。
42
- * - `all`:返回以上全部能力的安装工作流。
43
- * - 默认值为 `web-access`。
44
- */
45
- target?: WebPluginInstallTarget;
46
- /**
47
- * agent-browser CLI 的安装作用域。
48
- *
49
- * 说明(中文)
50
- * - `user`:提示 Agent 将 CLI 安装到 npm 全局环境。
51
- * - `project`:提示 Agent 使用项目已有的包管理器安装 devDependency。
52
- * - Skill 安装位置由 SkillPlugin 的扫描配置决定,不受此字段控制。
53
- * - 默认值为 `user`。
54
- */
55
- scope?: WebPluginInstallScope;
48
+ /** 单条搜索结果。 */
49
+ export interface WebSearchItem extends JsonObject {
50
+ /** 结果页面的规范 URL。 */
51
+ url: string;
52
+ /** 页面标题。 */
53
+ title: string | null;
54
+ /** 搜索 provider 返回的摘要。 */
55
+ snippet: string | null;
56
+ /** provider 给出的相关性分数。 */
57
+ score: number | null;
56
58
  }
57
59
 
58
- /**
59
- * WebPlugin install action 返回的安装提示数据。
60
- */
61
- export interface WebPluginInstallInstructions extends JsonObject {
62
- /**
63
- * 标识当前结果只包含操作说明。
64
- */
65
- kind: "instructions";
66
- /**
67
- * 已归一化的联网能力目标。
68
- */
69
- target: WebPluginInstallTarget;
70
- /**
71
- * 已归一化的 agent-browser CLI 安装作用域。
72
- */
73
- scope: WebPluginInstallScope;
74
- /**
75
- * 提供给 Agent 执行的完整安装说明。
76
- */
77
- prompt: string;
60
+ /** 搜索 action 返回值。 */
61
+ export interface WebSearchResult extends JsonObject {
62
+ /** 实际使用的 provider 名称。 */
63
+ provider: string;
64
+ /** 搜索结果列表。 */
65
+ items: WebSearchItem[];
66
+ }
67
+
68
+ /** 已知 URL 打开输入。 */
69
+ export interface WebOpenInput {
70
+ /** 要读取的 HTTP(S) URL。 */
71
+ url: string;
72
+ /** 返回正文的最大字符数。 */
73
+ max_chars?: number;
74
+ }
75
+
76
+ /** 已知 URL 打开返回值。 */
77
+ export interface WebOpenResult extends JsonObject {
78
+ /** 实际使用的 provider 名称。 */
79
+ provider: string;
80
+ /** 最终读取到的 URL。 */
81
+ url: string;
82
+ /** 页面标题。 */
83
+ title: string | null;
84
+ /** 页面正文或 provider 生成的 Markdown。 */
85
+ content: string;
86
+ }
87
+
88
+ /** 浏览器 session 创建输入。 */
89
+ export interface BrowserCreateSessionInput {
90
+ /** 创建后立即打开的 URL。 */
91
+ url?: string;
92
+ /** 是否在首次观察时返回 PNG data URL。 */
93
+ include_screenshot?: boolean;
94
+ }
95
+
96
+ /** 浏览器页面的可序列化观察结果。 */
97
+ export interface BrowserObservation extends JsonObject {
98
+ /** 实际使用的 provider 名称。 */
99
+ provider: string;
100
+ /** 浏览器 session 标识。 */
101
+ session_id: string;
102
+ /** 当前页面 URL。 */
103
+ url: string;
104
+ /** 当前页面标题。 */
105
+ title: string;
106
+ /** 当前页面的可见文本快照。 */
107
+ text: string;
108
+ /** 可选的 PNG data URL,供视觉模型使用。 */
109
+ screenshot_data_url: string | null;
110
+ }
111
+
112
+ /** 浏览器动作输入。 */
113
+ export type BrowserAction =
114
+ | { /** 导航到目标地址。 */ type: "goto"; /** 目标 URL。 */ url: string }
115
+ | { /** 点击元素。 */ type: "click"; /** CSS selector。 */ selector: string }
116
+ | {
117
+ /** 填充表单元素。 */
118
+ type: "fill";
119
+ /** CSS selector。 */
120
+ selector: string;
121
+ /** 要填充的文本。 */
122
+ value: string;
123
+ }
124
+ | {
125
+ /** 在元素上按键。 */
126
+ type: "press";
127
+ /** CSS selector。 */
128
+ selector: string;
129
+ /** Playwright 支持的键名。 */
130
+ key: string;
131
+ }
132
+ | {
133
+ /** 滚动页面。 */
134
+ type: "scroll";
135
+ /** 垂直滚动像素,正数向下。 */
136
+ y?: number;
137
+ /** 水平滚动像素,正数向右。 */
138
+ x?: number;
139
+ }
140
+ | {
141
+ /** 等待页面稳定。 */
142
+ type: "wait";
143
+ /** 等待毫秒数,provider 可限制最大值。 */
144
+ milliseconds?: number;
145
+ };
146
+
147
+ /** 浏览器动作输入 payload。 */
148
+ export interface BrowserActInput {
149
+ /** 目标浏览器 session 标识。 */
150
+ session_id: string;
151
+ /** 要执行的确定性动作。 */
152
+ action: BrowserAction;
153
+ /** 动作完成后是否附带截图。 */
154
+ include_screenshot?: boolean;
155
+ }
156
+
157
+ /** 语义浏览器动作输入。 */
158
+ export interface BrowserSemanticActInput {
159
+ /** 目标浏览器 session 标识。 */
160
+ session_id: string;
161
+ /** 给语义 provider 的自然语言动作,例如“点击登录按钮”。 */
162
+ instruction: string;
163
+ /** 动作完成后是否附带截图。 */
164
+ include_screenshot?: boolean;
165
+ }
166
+
167
+ /** 浏览器观察输入 payload。 */
168
+ export interface BrowserObserveInput {
169
+ /** 目标浏览器 session 标识。 */
170
+ session_id: string;
171
+ /** 是否返回 PNG data URL。 */
172
+ include_screenshot?: boolean;
173
+ }
174
+
175
+ /** 浏览器抽取输入 payload。 */
176
+ export interface BrowserExtractInput {
177
+ /** 目标浏览器 session 标识。 */
178
+ session_id: string;
179
+ /** 可选 CSS selector;不传时读取 body 文本。 */
180
+ selector?: string;
181
+ /** 返回的最大字符数。 */
182
+ max_chars?: number;
183
+ }
184
+
185
+ /** 语义浏览器抽取输入。 */
186
+ export interface BrowserSemanticExtractInput {
187
+ /** 目标浏览器 session 标识。 */
188
+ session_id: string;
189
+ /** 给语义 provider 的抽取要求。 */
190
+ instruction: string;
191
+ /** 返回内容的最大字符数。 */
192
+ max_chars?: number;
193
+ }
194
+
195
+ /** 浏览器抽取返回值。 */
196
+ export interface BrowserExtractResult extends JsonObject {
197
+ /** 实际使用的 provider 名称。 */
198
+ provider: string;
199
+ /** 浏览器 session 标识。 */
200
+ session_id: string;
201
+ /** 当前页面 URL。 */
202
+ url: string;
203
+ /** 抽取到的文本。 */
204
+ content: string;
205
+ }
206
+
207
+ /** 浏览器 session 关闭输入。 */
208
+ export interface BrowserCloseSessionInput {
209
+ /** 要关闭的浏览器 session 标识。 */
210
+ session_id: string;
211
+ }
212
+
213
+ /** 浏览器 provider 的能力协议。 */
214
+ export interface BrowserProvider {
215
+ /** provider 稳定名称,用于结果和诊断。 */
216
+ readonly name: string;
217
+ /** 创建浏览器 session 并返回初始观察结果。 */
218
+ create_session(
219
+ input: BrowserCreateSessionInput,
220
+ ): Promise<BrowserObservation>;
221
+ /** 读取指定 session 当前状态。 */
222
+ observe(input: BrowserObserveInput): Promise<BrowserObservation>;
223
+ /** 执行确定性动作并返回动作后的状态。 */
224
+ act(input: BrowserActInput): Promise<BrowserObservation>;
225
+ /** 可选的自然语言动作能力,由 Stagehand 或 Computer Use adapter 实现。 */
226
+ semantic_act?(input: BrowserSemanticActInput): Promise<BrowserObservation>;
227
+ /** 从指定 session 抽取文本。 */
228
+ extract(input: BrowserExtractInput): Promise<BrowserExtractResult>;
229
+ /** 可选的自然语言结构化抽取能力。 */
230
+ semantic_extract?(
231
+ input: BrowserSemanticExtractInput,
232
+ ): Promise<BrowserExtractResult>;
233
+ /** 关闭指定 session。 */
234
+ close_session(input: BrowserCloseSessionInput): Promise<void>;
235
+ /** 释放 provider 持有的浏览器连接和剩余 session。 */
236
+ dispose(): Promise<void>;
237
+ }
238
+
239
+ /** WebPlugin 构造参数。 */
240
+ export interface WebPluginOptions {
241
+ /** 搜索 provider;未配置时 search action 返回能力不可用。 */
242
+ search?: (
243
+ input: WebSearchInput,
244
+ ) => Promise<WebSearchResult> | WebSearchResult;
245
+ /** 已知 URL 文档 provider;未配置时 open action 返回能力不可用。 */
246
+ open?: (
247
+ input: WebOpenInput,
248
+ ) => Promise<WebOpenResult> | WebOpenResult;
249
+ /** 浏览器 provider;未配置时 browser actions 返回能力不可用。 */
250
+ browser?: BrowserProvider;
78
251
  }
package/src/web.ts CHANGED
@@ -1,16 +1,38 @@
1
1
  /**
2
2
  * `@downcity/plugins/web` 独立公开入口。
3
3
  *
4
- * 关键点(中文):只汇总 WebPlugin 及其安装指引 action 协议。
4
+ * 关键点(中文):汇总 provider-neutral WebPlugin Playwright/CDP provider。
5
5
  */
6
6
 
7
7
  export { WebPlugin } from "./web/Plugin.js";
8
- export {
9
- WEB_PLUGIN_ACTIONS,
10
- } from "./web/types/WebPlugin.js";
8
+ export { PlaywrightBrowserProvider } from "./web/providers/PlaywrightBrowserProvider.js";
9
+ export { SemanticBrowserProviderAdapter } from "./web/providers/SemanticBrowserProviderAdapter.js";
10
+ export { ComputerUseBrowserProviderAdapter } from "./web/providers/ComputerUseBrowserProviderAdapter.js";
11
+ export { WEB_PLUGIN_ACTIONS } from "./web/types/WebPlugin.js";
11
12
  export type {
12
- WebPluginInstallInstructions,
13
- WebPluginInstallPayload,
14
- WebPluginInstallScope,
15
- WebPluginInstallTarget,
13
+ BrowserActInput,
14
+ BrowserAction,
15
+ BrowserCloseSessionInput,
16
+ BrowserCreateSessionInput,
17
+ BrowserExtractInput,
18
+ BrowserExtractResult,
19
+ BrowserObservation,
20
+ BrowserObserveInput,
21
+ BrowserProvider,
22
+ BrowserSemanticActInput,
23
+ BrowserSemanticExtractInput,
24
+ WebOpenInput,
25
+ WebOpenResult,
26
+ WebPluginActionName,
27
+ WebPluginOptions,
28
+ WebSearchInput,
29
+ WebSearchItem,
30
+ WebSearchResult,
16
31
  } from "./web/types/WebPlugin.js";
32
+ export type { PlaywrightBrowserProviderOptions } from "./web/types/PlaywrightBrowserProvider.js";
33
+ export type { SemanticBrowserProviderAdapterOptions } from "./web/types/SemanticBrowserProviderAdapter.js";
34
+ export type {
35
+ ComputerUseBrowserProviderAdapterOptions,
36
+ ComputerUseBrowserProviderMethods,
37
+ ComputerUseBrowserRunInput,
38
+ } from "./web/types/ComputerUseBrowserProviderAdapter.js";
@@ -1,7 +0,0 @@
1
- /**
2
- * 自动生成文件,请勿手改。
3
- * 源文件:由同路径 `*.ts.txt` 生成。
4
- */
5
- declare const TEXT_MODULE_CONTENT = "# Web Plugin\n\nThis plugin injects general web-access methodology. It does not choose a provider and does not guarantee that any specific web tool exists.\n\nIf web-related dependencies are needed, use the `web` plugin's `install` action to receive instructions for capabilities such as `web-access` and `agent-browser`. The action never executes commands, accesses the network, installs dependencies, or changes files. Follow the returned prompt with the available plugin and Shell capabilities.\n\nWhen a task needs internet access, verification, webpage reading, webpage interaction, or browser use, choose the path based on the currently available tools, skills, and user goal.\n\n## General Principles\n\n- Goal-driven: think like a human. Define the success criteria first, then choose the starting point most likely to reach them directly.\n- Evidence at every step: each result is evidence. When a path stops making progress, switch methods instead of repeatedly retrying the wrong approach.\n- Prefer primary sources: search engines are for discovery. Conclusions should usually trace back to official sites, official platforms, original pages, official docs, or source code.\n- Stop when done: once the goal is reached, do not spend extra steps just to look more complete.\n- Capability self-check: do not assume that a web skill or tool exists. Prefer capabilities explicitly available in the current system/tool list or in already looked-up skills.\n\n## Tool Selection\n\n- To discover sources or map keyword context: prefer currently available search tools or web-access-style skills.\n- For a known URL where you need page text or a direct answer: prefer currently available fetch/read tools.\n- For a known URL where you need raw HTML, meta tags, JSON-LD, or similar structured content: prefer currently available HTTP/curl/shell capabilities.\n- For logged-in state, dynamic rendering, site navigation, complex interactions, or anti-bot pages: prefer currently available browser, Chrome, agent-browser, or computer-use capabilities.\n- Jina-style markdown preprocessing may help for article-like pages and save tokens, but do not blindly trust it for dashboards, product pages, or complex layouts.\n\n## Browser Strategy\n\n- Once in the browser layer, understand the page structure before choosing the next action.\n- Programmatic methods are faster but more likely to trigger anti-bot behavior. GUI interaction is slower but more deterministic. If programmatic access is blocked, fall back to GUI.\n- Prefer links generated by the page itself. Do not manually guess or trim internal URL parameters.\n- Operate only tabs you created. Do not disturb the user's existing tabs. Close tabs you created when the task is done.\n- When encountering a login wall, first decide whether it actually blocks the goal. Ask the user to log in only when the target cannot be reached otherwise.\n\n## Parallelism And Verification\n\n- Independent research targets may be split and run in parallel. Targets with dependencies should not be parallelized blindly.\n- Verification tasks should return to primary sources. Do not use multiple secondary reports to circularly confirm each other.\n\n## Relationship To Skills And Tools\n\n- If the current environment has a `web-access` skill, web search, scraping, and verification tasks may prefer its instructions.\n- If the current environment has `agent-browser`, browser, or Chrome capabilities, dynamic pages and logged-in tasks may prefer them.\n- If necessary web capability is missing, state that directly. Do not pretend you have accessed the web.\n\n## Available Action\n\n- `install`: return installation instructions for web-related Skills and CLIs without executing them.\n\nExample:\n\n```ts\nplugin_call({\n plugin: \"web\",\n action: \"install\",\n payload: {\n target: \"agent-browser\",\n scope: \"user\",\n },\n});\n```\n\nAfter calling `install`, follow `data.prompt`. Skill installation is delegated to the `skill.install` instruction action so that the active SkillPlugin scan roots remain the source of truth. After running the instructed Shell commands, verify Skills with `skill.list` and read them with `skill.lookup`.\n";
6
- export default TEXT_MODULE_CONTENT;
7
- //# sourceMappingURL=PROMPT.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PROMPT.d.ts","sourceRoot":"","sources":["../../src/web/PROMPT.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,QAAA,MAAM,mBAAmB,+mIAA+mI,CAAC;AAEzoI,eAAe,mBAAmB,CAAC"}
package/bin/web/PROMPT.js DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * 自动生成文件,请勿手改。
3
- * 源文件:由同路径 `*.ts.txt` 生成。
4
- */
5
- // Source: src/web/PROMPT.ts
6
- const TEXT_MODULE_CONTENT = "# Web Plugin\n\nThis plugin injects general web-access methodology. It does not choose a provider and does not guarantee that any specific web tool exists.\n\nIf web-related dependencies are needed, use the `web` plugin's `install` action to receive instructions for capabilities such as `web-access` and `agent-browser`. The action never executes commands, accesses the network, installs dependencies, or changes files. Follow the returned prompt with the available plugin and Shell capabilities.\n\nWhen a task needs internet access, verification, webpage reading, webpage interaction, or browser use, choose the path based on the currently available tools, skills, and user goal.\n\n## General Principles\n\n- Goal-driven: think like a human. Define the success criteria first, then choose the starting point most likely to reach them directly.\n- Evidence at every step: each result is evidence. When a path stops making progress, switch methods instead of repeatedly retrying the wrong approach.\n- Prefer primary sources: search engines are for discovery. Conclusions should usually trace back to official sites, official platforms, original pages, official docs, or source code.\n- Stop when done: once the goal is reached, do not spend extra steps just to look more complete.\n- Capability self-check: do not assume that a web skill or tool exists. Prefer capabilities explicitly available in the current system/tool list or in already looked-up skills.\n\n## Tool Selection\n\n- To discover sources or map keyword context: prefer currently available search tools or web-access-style skills.\n- For a known URL where you need page text or a direct answer: prefer currently available fetch/read tools.\n- For a known URL where you need raw HTML, meta tags, JSON-LD, or similar structured content: prefer currently available HTTP/curl/shell capabilities.\n- For logged-in state, dynamic rendering, site navigation, complex interactions, or anti-bot pages: prefer currently available browser, Chrome, agent-browser, or computer-use capabilities.\n- Jina-style markdown preprocessing may help for article-like pages and save tokens, but do not blindly trust it for dashboards, product pages, or complex layouts.\n\n## Browser Strategy\n\n- Once in the browser layer, understand the page structure before choosing the next action.\n- Programmatic methods are faster but more likely to trigger anti-bot behavior. GUI interaction is slower but more deterministic. If programmatic access is blocked, fall back to GUI.\n- Prefer links generated by the page itself. Do not manually guess or trim internal URL parameters.\n- Operate only tabs you created. Do not disturb the user's existing tabs. Close tabs you created when the task is done.\n- When encountering a login wall, first decide whether it actually blocks the goal. Ask the user to log in only when the target cannot be reached otherwise.\n\n## Parallelism And Verification\n\n- Independent research targets may be split and run in parallel. Targets with dependencies should not be parallelized blindly.\n- Verification tasks should return to primary sources. Do not use multiple secondary reports to circularly confirm each other.\n\n## Relationship To Skills And Tools\n\n- If the current environment has a `web-access` skill, web search, scraping, and verification tasks may prefer its instructions.\n- If the current environment has `agent-browser`, browser, or Chrome capabilities, dynamic pages and logged-in tasks may prefer them.\n- If necessary web capability is missing, state that directly. Do not pretend you have accessed the web.\n\n## Available Action\n\n- `install`: return installation instructions for web-related Skills and CLIs without executing them.\n\nExample:\n\n```ts\nplugin_call({\n plugin: \"web\",\n action: \"install\",\n payload: {\n target: \"agent-browser\",\n scope: \"user\",\n },\n});\n```\n\nAfter calling `install`, follow `data.prompt`. Skill installation is delegated to the `skill.install` instruction action so that the active SkillPlugin scan roots remain the source of truth. After running the instructed Shell commands, verify Skills with `skill.list` and read them with `skill.lookup`.\n";
7
- export default TEXT_MODULE_CONTENT;
8
- //# sourceMappingURL=PROMPT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PROMPT.js","sourceRoot":"","sources":["../../src/web/PROMPT.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4BAA4B;AAC5B,MAAM,mBAAmB,GAAG,4mIAA4mI,CAAC;AAEzoI,eAAe,mBAAmB,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * WebPromptAssets:web plugin 静态提示词资产。
3
- *
4
- * 关键点(中文)
5
- * - prompt 文本真实来源是 `*.ts.txt` 文本文件。
6
- * - web plugin 只保留通用联网方法论,不再维护 provider 专属提示词。
7
- */
8
- /**
9
- * web plugin 基础 prompt。
10
- */
11
- export declare const WEB_PLUGIN_PROMPT: string;
12
- //# sourceMappingURL=WebPromptAssets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebPromptAssets.d.ts","sourceRoot":"","sources":["../../src/web/WebPromptAssets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAA6B,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * WebPromptAssets:web plugin 静态提示词资产。
3
- *
4
- * 关键点(中文)
5
- * - prompt 文本真实来源是 `*.ts.txt` 文本文件。
6
- * - web plugin 只保留通用联网方法论,不再维护 provider 专属提示词。
7
- */
8
- import webPluginPromptText from "../web/PROMPT.js";
9
- /**
10
- * web plugin 基础 prompt。
11
- */
12
- export const WEB_PLUGIN_PROMPT = webPluginPromptText.trim();
13
- //# sourceMappingURL=WebPromptAssets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebPromptAssets.js","sourceRoot":"","sources":["../../src/web/WebPromptAssets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,mBAAmB,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,IAAI,EAAE,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * WebPlugin 安装提示词渲染器。
3
- *
4
- * 关键点(中文)
5
- * - 只生成 Agent 可执行的操作说明,不执行命令、访问网络或修改文件。
6
- * - Skill 安装委托给 SkillPlugin,避免重复维护扫描根与安装位置规则。
7
- * - agent-browser CLI 仅根据请求的作用域提供 Shell 命令候选。
8
- */
9
- import type { WebPluginInstallInstructions, WebPluginInstallPayload } from "../../web/types/WebPlugin.js";
10
- /**
11
- * 生成 web install action 返回的纯提示词。
12
- */
13
- export declare function render_web_install_prompt(payload: WebPluginInstallPayload | null | undefined): WebPluginInstallInstructions;
14
- //# sourceMappingURL=Prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../src/web/runtime/Prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EAGxB,MAAM,0BAA0B,CAAC;AAoDlC;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,uBAAuB,GAAG,IAAI,GAAG,SAAS,GAClD,4BAA4B,CA2B9B"}
@@ -1,77 +0,0 @@
1
- /**
2
- * WebPlugin 安装提示词渲染器。
3
- *
4
- * 关键点(中文)
5
- * - 只生成 Agent 可执行的操作说明,不执行命令、访问网络或修改文件。
6
- * - Skill 安装委托给 SkillPlugin,避免重复维护扫描根与安装位置规则。
7
- * - agent-browser CLI 仅根据请求的作用域提供 Shell 命令候选。
8
- */
9
- /**
10
- * 归一化联网能力目标。
11
- */
12
- function resolve_install_target(target) {
13
- return target === "agent-browser" || target === "all"
14
- ? target
15
- : "web-access";
16
- }
17
- /**
18
- * 归一化 CLI 安装作用域。
19
- */
20
- function resolve_install_scope(scope) {
21
- return scope === "project" ? "project" : "user";
22
- }
23
- /**
24
- * 渲染单个 Skill 的安装工作流。
25
- */
26
- function render_skill_install_step(skill_name) {
27
- return [
28
- `- Call \`plugin_call({ plugin: "skill", action: "install", payload: { spec: "${skill_name}" } })\`.`,
29
- " Follow the returned scan-aware Shell instructions. The WebPlugin has not installed this Skill.",
30
- ].join("\n");
31
- }
32
- /**
33
- * 渲染 agent-browser CLI 的安装提示。
34
- */
35
- function render_agent_browser_cli_step(scope) {
36
- if (scope === "project") {
37
- return [
38
- "- Inspect the project lockfile and use its existing package manager to install `agent-browser` as a devDependency:",
39
- " - pnpm: `pnpm add -D agent-browser`",
40
- " - npm: `npm install -D agent-browser`",
41
- " - yarn: `yarn add -D agent-browser`",
42
- "- Verify the project-local CLI with the matching package-manager command, for example `pnpm exec agent-browser --help`.",
43
- ].join("\n");
44
- }
45
- return [
46
- "- Install the CLI globally with `npm install -g agent-browser`.",
47
- "- Verify it with `agent-browser --help`.",
48
- ].join("\n");
49
- }
50
- /**
51
- * 生成 web install action 返回的纯提示词。
52
- */
53
- export function render_web_install_prompt(payload) {
54
- const target = resolve_install_target(payload?.target);
55
- const scope = resolve_install_scope(payload?.scope);
56
- const skill_names = target === "all" ? ["web-access", "agent-browser"] : [target];
57
- const skill_steps = skill_names.map(render_skill_install_step).join("\n");
58
- const cli_steps = target === "agent-browser" || target === "all"
59
- ? ["", "## agent-browser CLI", render_agent_browser_cli_step(scope)]
60
- : [];
61
- const prompt = [
62
- "# Install Web Capabilities Instructions",
63
- "",
64
- "This action only returns instructions. It has not executed commands, accessed the network, installed dependencies, or changed files.",
65
- "",
66
- "## Skills",
67
- skill_steps,
68
- ...cli_steps,
69
- "",
70
- "## Verification",
71
- "After completing the Shell steps, call `plugin_call({ plugin: \"skill\", action: \"list\", payload: {} })` and confirm every requested Skill is discoverable.",
72
- "Call `skill.lookup` for each installed Skill before using it.",
73
- "If the `skill` plugin is unavailable, configure it before installing a Skill; do not guess an unscanned destination.",
74
- ].join("\n");
75
- return { kind: "instructions", target, scope, prompt };
76
- }
77
- //# sourceMappingURL=Prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../../src/web/runtime/Prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH;;GAEG;AACH,SAAS,sBAAsB,CAC7B,MAAyC;IAEzC,OAAO,MAAM,KAAK,eAAe,IAAI,MAAM,KAAK,KAAK;QACnD,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,YAAY,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAC5B,KAAuC;IAEvC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,SAAS,yBAAyB,CAAC,UAAkB;IACnD,OAAO;QACL,gFAAgF,UAAU,WAAW;QACrG,kGAAkG;KACnG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,6BAA6B,CAAC,KAA4B;IACjE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;YACL,oHAAoH;YACpH,uCAAuC;YACvC,yCAAyC;YACzC,uCAAuC;YACvC,yHAAyH;SAC1H,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,OAAO;QACL,iEAAiE;QACjE,0CAA0C;KAC3C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAmD;IAEnD,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,MAAM,WAAW,GACf,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAChE,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,SAAS,GACb,MAAM,KAAK,eAAe,IAAI,MAAM,KAAK,KAAK;QAC5C,CAAC,CAAC,CAAC,EAAE,EAAE,sBAAsB,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC;QACpE,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,MAAM,GAAG;QACb,yCAAyC;QACzC,EAAE;QACF,sIAAsI;QACtI,EAAE;QACF,WAAW;QACX,WAAW;QACX,GAAG,SAAS;QACZ,EAAE;QACF,iBAAiB;QACjB,+JAA+J;QAC/J,+DAA+D;QAC/D,sHAAsH;KACvH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACzD,CAAC"}
package/src/web/PROMPT.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * 自动生成文件,请勿手改。
3
- * 源文件:由同路径 `*.ts.txt` 生成。
4
- */
5
-
6
- // Source: src/web/PROMPT.ts
7
- const TEXT_MODULE_CONTENT = "# Web Plugin\n\nThis plugin injects general web-access methodology. It does not choose a provider and does not guarantee that any specific web tool exists.\n\nIf web-related dependencies are needed, use the `web` plugin's `install` action to receive instructions for capabilities such as `web-access` and `agent-browser`. The action never executes commands, accesses the network, installs dependencies, or changes files. Follow the returned prompt with the available plugin and Shell capabilities.\n\nWhen a task needs internet access, verification, webpage reading, webpage interaction, or browser use, choose the path based on the currently available tools, skills, and user goal.\n\n## General Principles\n\n- Goal-driven: think like a human. Define the success criteria first, then choose the starting point most likely to reach them directly.\n- Evidence at every step: each result is evidence. When a path stops making progress, switch methods instead of repeatedly retrying the wrong approach.\n- Prefer primary sources: search engines are for discovery. Conclusions should usually trace back to official sites, official platforms, original pages, official docs, or source code.\n- Stop when done: once the goal is reached, do not spend extra steps just to look more complete.\n- Capability self-check: do not assume that a web skill or tool exists. Prefer capabilities explicitly available in the current system/tool list or in already looked-up skills.\n\n## Tool Selection\n\n- To discover sources or map keyword context: prefer currently available search tools or web-access-style skills.\n- For a known URL where you need page text or a direct answer: prefer currently available fetch/read tools.\n- For a known URL where you need raw HTML, meta tags, JSON-LD, or similar structured content: prefer currently available HTTP/curl/shell capabilities.\n- For logged-in state, dynamic rendering, site navigation, complex interactions, or anti-bot pages: prefer currently available browser, Chrome, agent-browser, or computer-use capabilities.\n- Jina-style markdown preprocessing may help for article-like pages and save tokens, but do not blindly trust it for dashboards, product pages, or complex layouts.\n\n## Browser Strategy\n\n- Once in the browser layer, understand the page structure before choosing the next action.\n- Programmatic methods are faster but more likely to trigger anti-bot behavior. GUI interaction is slower but more deterministic. If programmatic access is blocked, fall back to GUI.\n- Prefer links generated by the page itself. Do not manually guess or trim internal URL parameters.\n- Operate only tabs you created. Do not disturb the user's existing tabs. Close tabs you created when the task is done.\n- When encountering a login wall, first decide whether it actually blocks the goal. Ask the user to log in only when the target cannot be reached otherwise.\n\n## Parallelism And Verification\n\n- Independent research targets may be split and run in parallel. Targets with dependencies should not be parallelized blindly.\n- Verification tasks should return to primary sources. Do not use multiple secondary reports to circularly confirm each other.\n\n## Relationship To Skills And Tools\n\n- If the current environment has a `web-access` skill, web search, scraping, and verification tasks may prefer its instructions.\n- If the current environment has `agent-browser`, browser, or Chrome capabilities, dynamic pages and logged-in tasks may prefer them.\n- If necessary web capability is missing, state that directly. Do not pretend you have accessed the web.\n\n## Available Action\n\n- `install`: return installation instructions for web-related Skills and CLIs without executing them.\n\nExample:\n\n```ts\nplugin_call({\n plugin: \"web\",\n action: \"install\",\n payload: {\n target: \"agent-browser\",\n scope: \"user\",\n },\n});\n```\n\nAfter calling `install`, follow `data.prompt`. Skill installation is delegated to the `skill.install` instruction action so that the active SkillPlugin scan roots remain the source of truth. After running the instructed Shell commands, verify Skills with `skill.list` and read them with `skill.lookup`.\n";
8
-
9
- export default TEXT_MODULE_CONTENT;
@@ -1,61 +0,0 @@
1
- # Web Plugin
2
-
3
- This plugin injects general web-access methodology. It does not choose a provider and does not guarantee that any specific web tool exists.
4
-
5
- If web-related dependencies are needed, use the `web` plugin's `install` action to receive instructions for capabilities such as `web-access` and `agent-browser`. The action never executes commands, accesses the network, installs dependencies, or changes files. Follow the returned prompt with the available plugin and Shell capabilities.
6
-
7
- When a task needs internet access, verification, webpage reading, webpage interaction, or browser use, choose the path based on the currently available tools, skills, and user goal.
8
-
9
- ## General Principles
10
-
11
- - Goal-driven: think like a human. Define the success criteria first, then choose the starting point most likely to reach them directly.
12
- - Evidence at every step: each result is evidence. When a path stops making progress, switch methods instead of repeatedly retrying the wrong approach.
13
- - Prefer primary sources: search engines are for discovery. Conclusions should usually trace back to official sites, official platforms, original pages, official docs, or source code.
14
- - Stop when done: once the goal is reached, do not spend extra steps just to look more complete.
15
- - Capability self-check: do not assume that a web skill or tool exists. Prefer capabilities explicitly available in the current system/tool list or in already looked-up skills.
16
-
17
- ## Tool Selection
18
-
19
- - To discover sources or map keyword context: prefer currently available search tools or web-access-style skills.
20
- - For a known URL where you need page text or a direct answer: prefer currently available fetch/read tools.
21
- - For a known URL where you need raw HTML, meta tags, JSON-LD, or similar structured content: prefer currently available HTTP/curl/shell capabilities.
22
- - For logged-in state, dynamic rendering, site navigation, complex interactions, or anti-bot pages: prefer currently available browser, Chrome, agent-browser, or computer-use capabilities.
23
- - Jina-style markdown preprocessing may help for article-like pages and save tokens, but do not blindly trust it for dashboards, product pages, or complex layouts.
24
-
25
- ## Browser Strategy
26
-
27
- - Once in the browser layer, understand the page structure before choosing the next action.
28
- - Programmatic methods are faster but more likely to trigger anti-bot behavior. GUI interaction is slower but more deterministic. If programmatic access is blocked, fall back to GUI.
29
- - Prefer links generated by the page itself. Do not manually guess or trim internal URL parameters.
30
- - Operate only tabs you created. Do not disturb the user's existing tabs. Close tabs you created when the task is done.
31
- - When encountering a login wall, first decide whether it actually blocks the goal. Ask the user to log in only when the target cannot be reached otherwise.
32
-
33
- ## Parallelism And Verification
34
-
35
- - Independent research targets may be split and run in parallel. Targets with dependencies should not be parallelized blindly.
36
- - Verification tasks should return to primary sources. Do not use multiple secondary reports to circularly confirm each other.
37
-
38
- ## Relationship To Skills And Tools
39
-
40
- - If the current environment has a `web-access` skill, web search, scraping, and verification tasks may prefer its instructions.
41
- - If the current environment has `agent-browser`, browser, or Chrome capabilities, dynamic pages and logged-in tasks may prefer them.
42
- - If necessary web capability is missing, state that directly. Do not pretend you have accessed the web.
43
-
44
- ## Available Action
45
-
46
- - `install`: return installation instructions for web-related Skills and CLIs without executing them.
47
-
48
- Example:
49
-
50
- ```ts
51
- plugin_call({
52
- plugin: "web",
53
- action: "install",
54
- payload: {
55
- target: "agent-browser",
56
- scope: "user",
57
- },
58
- });
59
- ```
60
-
61
- After calling `install`, follow `data.prompt`. Skill installation is delegated to the `skill.install` instruction action so that the active SkillPlugin scan roots remain the source of truth. After running the instructed Shell commands, verify Skills with `skill.list` and read them with `skill.lookup`.
@@ -1,14 +0,0 @@
1
- /**
2
- * WebPromptAssets:web plugin 静态提示词资产。
3
- *
4
- * 关键点(中文)
5
- * - prompt 文本真实来源是 `*.ts.txt` 文本文件。
6
- * - web plugin 只保留通用联网方法论,不再维护 provider 专属提示词。
7
- */
8
-
9
- import webPluginPromptText from "@/web/PROMPT.js";
10
-
11
- /**
12
- * web plugin 基础 prompt。
13
- */
14
- export const WEB_PLUGIN_PROMPT = webPluginPromptText.trim();