@vite-plugin-opencode-assistant/opencode 1.0.12 → 1.0.14

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.
@@ -1,13 +1,14 @@
1
1
  const T = "[vite-plugin-opencode]";
2
- var S = Object.defineProperty, N = Object.defineProperties, L = Object.getOwnPropertyDescriptors, b = Object.getOwnPropertySymbols, j = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable, y = (e, t, r) => t in e ? S(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, m = (e, t) => {
2
+ const w = "[元素上下文]";
3
+ var C = Object.defineProperty, S = Object.defineProperties, N = Object.getOwnPropertyDescriptors, x = Object.getOwnPropertySymbols, L = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable, b = (e, t, r) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, g = (e, t) => {
3
4
  for (var r in t || (t = {}))
4
- j.call(t, r) && y(e, r, t[r]);
5
- if (b)
6
- for (var r of b(t))
7
- R.call(t, r) && y(e, r, t[r]);
5
+ L.call(t, r) && b(e, r, t[r]);
6
+ if (x)
7
+ for (var r of x(t))
8
+ M.call(t, r) && b(e, r, t[r]);
8
9
  return e;
9
- }, g = (e, t) => N(e, L(t)), O = (e, t, r) => y(e, typeof t != "symbol" ? t + "" : t, r);
10
- const u = {
10
+ }, m = (e, t) => S(e, N(t)), O = (e, t, r) => b(e, typeof t != "symbol" ? t + "" : t, r);
11
+ const c = {
11
12
  reset: "\x1B[0m",
12
13
  dim: "\x1B[2m",
13
14
  bright: "\x1B[1m",
@@ -16,28 +17,28 @@ const u = {
16
17
  yellow: "\x1B[33m",
17
18
  magenta: "\x1B[35m",
18
19
  cyan: "\x1B[36m"
20
+ }, j = {
21
+ 0: c.cyan,
22
+ 1: c.green,
23
+ 2: c.yellow,
24
+ 3: c.red,
25
+ 4: c.reset
19
26
  }, A = {
20
- 0: u.cyan,
21
- 1: u.green,
22
- 2: u.yellow,
23
- 3: u.red,
24
- 4: u.reset
25
- }, I = {
26
27
  0: "DEBUG",
27
28
  1: "INFO",
28
29
  2: "WARN",
29
30
  3: "ERROR",
30
31
  4: "NONE"
31
32
  };
32
- let x = {
33
- level: 1,
34
- showTrace: !1
33
+ let R = {
34
+ level: 1
35
+ /* INFO */
35
36
  };
36
- function U() {
37
+ function B() {
37
38
  const e = /* @__PURE__ */ new Date(), t = String(e.getHours()).padStart(2, "0"), r = String(e.getMinutes()).padStart(2, "0"), o = String(e.getSeconds()).padStart(2, "0"), i = String(e.getMilliseconds()).padStart(3, "0");
38
39
  return `${t}:${r}:${o}.${i}`;
39
40
  }
40
- function B(e = 3) {
41
+ function I(e = 3) {
41
42
  const t = new Error().stack;
42
43
  if (!t) return "";
43
44
  const o = t.split(`
@@ -65,7 +66,7 @@ ${e.stack}` : ""}`;
65
66
  }
66
67
  return String(e);
67
68
  }
68
- function M(e) {
69
+ function U(e) {
69
70
  if (!e || Object.keys(e).length === 0) return "";
70
71
  const t = [];
71
72
  e.module && t.push(`[${e.module}]`), e.operation && t.push(`(${e.operation})`), e.traceId && t.push(`trace:${e.traceId}`), e.duration !== void 0 && t.push(`${e.duration}ms`);
@@ -78,73 +79,76 @@ function M(e) {
78
79
  }
79
80
  return t.join(" ");
80
81
  }
81
- function E(e, t, r, ...o) {
82
- if (e < x.level) return;
82
+ function P(e, t, r, ...o) {
83
+ if (e < R.level) return;
83
84
  const i = [];
84
- i.push(`${u.dim}[${process.pid}]${u.reset}`), i.push(`${u.dim}${U()}${u.reset}`);
85
- const p = A[e], n = I[e].padEnd(5);
86
- i.push(`${p}${n}${u.reset}`), i.push(`${u.bright}${T}${u.reset}`);
87
- const a = M(r);
88
- if (a && i.push(`${u.magenta}${a}${u.reset}`), i.push(t), e >= 2) {
89
- const c = B(4);
90
- c && i.push(`${u.dim}(${c})${u.reset}`);
85
+ i.push(`${c.dim}[${process.pid}]${c.reset}`), i.push(`${c.dim}${B()}${c.reset}`);
86
+ const p = j[e], n = A[e].padEnd(5);
87
+ i.push(`${p}${n}${c.reset}`), i.push(`${c.bright}${T}${c.reset}`);
88
+ const a = U(r);
89
+ if (a && i.push(`${c.magenta}${a}${c.reset}`), i.push(t), e >= 2) {
90
+ const u = I(4);
91
+ u && i.push(`${c.dim}(${u})${c.reset}`);
92
+ }
93
+ const s = o.map((u) => h(u)).join(" ");
94
+ if (s && i.push(s), r != null && r.error) {
95
+ const u = r.error;
96
+ u instanceof Error ? i.push(`${c.red}Error: ${u.message}${c.reset}`) : i.push(`${c.red}Error: ${h(u)}${c.reset}`);
91
97
  }
92
- const s = o.map((c) => h(c)).join(" ");
93
- s && i.push(s);
94
98
  const f = i.join(" ");
95
- e >= 3 ? console.error(f) : e === 2 ? console.warn(f) : console.log(f), r != null && r.error && e >= 3 && x.showTrace;
99
+ e >= 3 ? console.error(f) : e === 2 ? console.warn(f) : console.log(f);
96
100
  }
97
- const d = {
101
+ const $ = {
98
102
  debug(e, t, ...r) {
99
- E(0, e, t, ...r);
103
+ P(0, e, t, ...r);
100
104
  },
101
105
  info(e, t, ...r) {
102
- E(1, e, t, ...r);
106
+ P(1, e, t, ...r);
103
107
  },
104
108
  warn(e, t, ...r) {
105
- E(2, e, t, ...r);
109
+ P(2, e, t, ...r);
106
110
  },
107
111
  error(e, t, ...r) {
108
- E(3, e, t, ...r);
112
+ P(3, e, t, ...r);
109
113
  },
110
114
  group(e, t) {
111
115
  },
112
116
  groupEnd() {
113
117
  }
114
118
  };
115
- class k {
119
+ class D {
116
120
  constructor(t, r) {
117
- O(this, "startTime"), O(this, "context"), O(this, "operation"), this.operation = t, this.context = r || {}, this.startTime = performance.now(), d.debug(`⏱️ Starting: ${t}`, this.context);
121
+ O(this, "startTime"), O(this, "context"), O(this, "operation"), this.operation = t, this.context = r || {}, this.startTime = performance.now(), $.debug(`⏱️ Starting: ${t}`, this.context);
118
122
  }
119
123
  end(t) {
120
124
  const r = Math.round(performance.now() - this.startTime), o = t || `✓ Completed: ${this.operation}`;
121
- return d.debug(o, g(m({}, this.context), { duration: r })), r;
125
+ return $.debug(o, m(g({}, this.context), { duration: r })), r;
122
126
  }
123
127
  checkpoint(t) {
124
128
  const r = Math.round(performance.now() - this.startTime);
125
- return d.debug(` ↳ ${t}`, g(m({}, this.context), { duration: r })), r;
129
+ return $.debug(` ↳ ${t}`, m(g({}, this.context), { duration: r })), r;
126
130
  }
127
131
  }
128
- function D(e) {
132
+ function k(e) {
129
133
  return {
130
134
  debug(t, r, ...o) {
131
- d.debug(t, g(m({}, r), { module: e }), ...o);
135
+ $.debug(t, m(g({}, r), { module: e }), ...o);
132
136
  },
133
137
  info(t, r, ...o) {
134
- d.info(t, g(m({}, r), { module: e }), ...o);
138
+ $.info(t, m(g({}, r), { module: e }), ...o);
135
139
  },
136
140
  warn(t, r, ...o) {
137
- d.warn(t, g(m({}, r), { module: e }), ...o);
141
+ $.warn(t, m(g({}, r), { module: e }), ...o);
138
142
  },
139
143
  error(t, r, ...o) {
140
- d.error(t, g(m({}, r), { module: e }), ...o);
144
+ $.error(t, m(g({}, r), { module: e }), ...o);
141
145
  },
142
146
  timer(t, r) {
143
- return new k(t, g(m({}, r), { module: e }));
147
+ return new D(t, m(g({}, r), { module: e }));
144
148
  }
145
149
  };
146
150
  }
147
- const C = 1e4, F = "__OPENCODE_CONTEXT__", l = D("OpenCodePluginPageContext"), V = async () => {
151
+ const l = k("OpenCodePluginPageContext"), X = async () => {
148
152
  l.info("PageContextPlugin loading...");
149
153
  const e = process.env.OPENCODE_CONTEXT_API_URL;
150
154
  if (l.debug("Context API URL:", { contextApiUrl: e }), !e)
@@ -191,20 +195,28 @@ const C = 1e4, F = "__OPENCODE_CONTEXT__", l = D("OpenCodePluginPageContext"), V
191
195
  }
192
196
  }
193
197
  function i(n, a) {
194
- var f;
198
+ var f, u;
195
199
  const s = [];
196
- if (s.push(`### 选中节点 ${a + 1}`), n.filePath) {
197
- let c = n.filePath;
198
- n.line && (c += `:${n.line}`, n.column && (c += `:${n.column}`)), s.push(`- **文件位置**: \`${c}\``);
199
- }
200
- if ((f = n.innerText) != null && f.trim()) {
201
- const c = n.innerText.trim().substring(0, C), $ = n.innerText.length > C ? `
200
+ if (s.push(`### 选中节点 ${a + 1}`), n.filePath)
201
+ if (n.filePath.includes("node_modules")) {
202
+ if (s.push(`- **元素描述**: \`${n.description}\``), (f = n.innerText) != null && f.trim()) {
203
+ const d = n.innerText.trim().substring(0, 100);
204
+ s.push(`- **节点文本**: \`${d}${n.innerText.length > 100 ? "..." : ""}\``);
205
+ }
206
+ s.push(
207
+ `- **分析建议**: 请使用 Chrome DevTools MCP 获取当前页面快照,结合 CSS 选择器 \`${n.description}\` 来获取更多的页面上下文`
208
+ );
209
+ } else {
210
+ let d = n.filePath;
211
+ if (n.line && (d += `:${n.line}`, n.column && (d += `:${n.column}`)), s.push(`- **文件位置**: \`${d}\``), (u = n.innerText) != null && u.trim()) {
212
+ const y = n.innerText.trim().substring(0, 100), E = n.innerText.length > 100 ? `
202
213
  ... (已省略部分内容)` : "";
203
- s.push(`- **节点文本**:
214
+ s.push(`- **节点文本**:
204
215
  \`\`\`text
205
- ${c}${$}
216
+ ${y}${E}
206
217
  \`\`\``);
207
- }
218
+ }
219
+ }
208
220
  return s.join(`
209
221
  `) + `
210
222
  `;
@@ -219,8 +231,8 @@ ${c}${$}
219
231
 
220
232
  `, (f = n.selectedElements) != null && f.length && (s += `用户选中了以下节点:
221
233
 
222
- `, n.selectedElements.forEach((c, $) => {
223
- s += i(c, $) + `
234
+ `, n.selectedElements.forEach((u, _) => {
235
+ s += i(u, _) + `
224
236
  `;
225
237
  })), s += `---
226
238
  **用户的请求**:
@@ -247,7 +259,7 @@ ${c}${$}
247
259
  │ │ │ │
248
260
  │ │ ┌─────────────────────────────┐ │ │
249
261
  │ │ │ OpenCode iframe (你的界面) │ ← 浮动聊天窗口 │ │
250
- │ │ │ 用户在这里与你对话 │ (Ctrl+K 打开) │ │
262
+ │ │ │ 用户在这里与你对话 │ │ │
251
263
  │ │ └─────────────────────────────┘ │ │
252
264
  │ └───────────────────────────────────────────────────────┘ │
253
265
  └─────────────────────────────────────────────────────────────┘
@@ -280,32 +292,36 @@ ${c}${$}
280
292
 
281
293
  请遵循以下规则:
282
294
 
283
- 1. **理解上下文**:将页面 URL、标题和选中节点信息作为用户请求的背景,帮助理解用户的真实意图。
284
- 2. **利用文件路径**:\`文件位置\` 中的路径对应项目源码文件,格式为 \`文件路径:行号:列号\`。你可以直接读取、分析或修改这些文件。
285
- 3. **精准定位**:结合 \`节点文本\` 和 \`文件位置\`,快速定位用户关注的具体代码位置,提供针对性的建议。
286
- 4. **直接行动**:针对用户的实际请求,直接给出清晰、可执行的方案。如果需要修改代码,主动提出修改方案并询问是否需要你直接修改。
287
- 5. **善用工具**:充分利用你的能力(读取文件、修改代码、运行命令、浏览器调试)来帮助用户解决问题。
295
+ 1. **前置要求:定位节点位置**(强制)
296
+ 当用户选中了页面节点时,**在处理用户请求之前**,你必须先找到这些节点在当前项目上下文中的位置。
297
+ - 利用提供的文件路径、CSS 选择器、元素文本等信息
298
+ - 通过文件搜索、DOM 分析等方式定位到具体代码位置
299
+ - 明确知道节点在哪里被定义/使用后,再处理用户请求
300
+
301
+ 2. **理解上下文**:将页面 URL、标题和选中节点信息作为用户请求的背景,帮助理解用户的真实意图。
302
+
303
+ 3. **直接行动**:在明确节点位置后,针对用户的实际请求给出清晰、可执行的方案。
288
304
  `.trim();
289
305
  a.system.push(s);
290
306
  },
291
307
  "experimental.chat.messages.transform": async (n, a) => {
292
- var P, w;
308
+ var d, y;
293
309
  l.debug("Message transform hook called");
294
310
  const s = await r();
295
311
  if (l.debug("Context data", {
296
312
  hasUrl: !!(s != null && s.url),
297
- hasElements: !!((P = s == null ? void 0 : s.selectedElements) != null && P.length)
313
+ hasElements: !!((d = s == null ? void 0 : s.selectedElements) != null && d.length)
298
314
  }), !(s != null && s.url)) return;
299
- const f = [...a.messages].reverse().find((_) => _.info.role === "user");
315
+ const f = [...a.messages].reverse().find((E) => E.info.role === "user");
300
316
  if (!f) return;
301
- const c = f.parts.find((_) => _.type === "text");
302
- if (!c || !("text" in c) || c.text.includes(F)) return;
303
- const $ = p(s);
304
- c.text = $ + c.text, (w = s.selectedElements) != null && w.length && (l.debug("Selected elements found, clearing..."), await o());
317
+ const u = f.parts.find((E) => E.type === "text");
318
+ if (!u || !("text" in u) || u.text.includes(w)) return;
319
+ const _ = p(s);
320
+ u.text = _ + u.text, (y = s.selectedElements) != null && y.length && (l.debug("Selected elements found, clearing..."), await o());
305
321
  }
306
322
  };
307
323
  };
308
324
  export {
309
- V as PageContextPlugin,
310
- V as default
325
+ X as PageContextPlugin,
326
+ X as default
311
327
  };
@@ -42,8 +42,6 @@ __export(page_context_exports, {
42
42
  });
43
43
  module.exports = __toCommonJS(page_context_exports);
44
44
  var import_shared = require("@vite-plugin-opencode-assistant/shared");
45
- const MAX_TEXT_LENGTH = 1e4;
46
- const CONTEXT_MARKER = "__OPENCODE_CONTEXT__";
47
45
  const log = (0, import_shared.createLogger)("OpenCodePluginPageContext");
48
46
  const PageContextPlugin = () => __async(null, null, function* () {
49
47
  log.info("PageContextPlugin loading...");
@@ -105,26 +103,38 @@ const PageContextPlugin = () => __async(null, null, function* () {
105
103
  });
106
104
  }
107
105
  function formatSelectedElement(element, index) {
108
- var _a;
106
+ var _a, _b;
109
107
  const parts = [];
110
108
  parts.push(`### \u9009\u4E2D\u8282\u70B9 ${index + 1}`);
111
109
  if (element.filePath) {
112
- let location = element.filePath;
113
- if (element.line) {
114
- location += `:${element.line}`;
115
- if (element.column) {
116
- location += `:${element.column}`;
110
+ const isNodeModule = element.filePath.includes("node_modules");
111
+ if (isNodeModule) {
112
+ parts.push(`- **\u5143\u7D20\u63CF\u8FF0**: \`${element.description}\``);
113
+ if ((_a = element.innerText) == null ? void 0 : _a.trim()) {
114
+ const text = element.innerText.trim().substring(0, 100);
115
+ parts.push(`- **\u8282\u70B9\u6587\u672C**: \`${text}${element.innerText.length > 100 ? "..." : ""}\``);
117
116
  }
118
- }
119
- parts.push(`- **\u6587\u4EF6\u4F4D\u7F6E**: \`${location}\``);
120
- }
121
- if ((_a = element.innerText) == null ? void 0 : _a.trim()) {
122
- const text = element.innerText.trim().substring(0, MAX_TEXT_LENGTH);
123
- const suffix = element.innerText.length > MAX_TEXT_LENGTH ? "\n... (\u5DF2\u7701\u7565\u90E8\u5206\u5185\u5BB9)" : "";
124
- parts.push(`- **\u8282\u70B9\u6587\u672C**:
117
+ parts.push(
118
+ `- **\u5206\u6790\u5EFA\u8BAE**: \u8BF7\u4F7F\u7528 Chrome DevTools MCP \u83B7\u53D6\u5F53\u524D\u9875\u9762\u5FEB\u7167\uFF0C\u7ED3\u5408 CSS \u9009\u62E9\u5668 \`${element.description}\` \u6765\u83B7\u53D6\u66F4\u591A\u7684\u9875\u9762\u4E0A\u4E0B\u6587`
119
+ );
120
+ } else {
121
+ let location = element.filePath;
122
+ if (element.line) {
123
+ location += `:${element.line}`;
124
+ if (element.column) {
125
+ location += `:${element.column}`;
126
+ }
127
+ }
128
+ parts.push(`- **\u6587\u4EF6\u4F4D\u7F6E**: \`${location}\``);
129
+ if ((_b = element.innerText) == null ? void 0 : _b.trim()) {
130
+ const text = element.innerText.trim().substring(0, import_shared.MAX_TEXT_LENGTH);
131
+ const suffix = element.innerText.length > import_shared.MAX_TEXT_LENGTH ? "\n... (\u5DF2\u7701\u7565\u90E8\u5206\u5185\u5BB9)" : "";
132
+ parts.push(`- **\u8282\u70B9\u6587\u672C**:
125
133
  \`\`\`text
126
134
  ${text}${suffix}
127
135
  \`\`\``);
136
+ }
137
+ }
128
138
  }
129
139
  return parts.join("\n") + "\n";
130
140
  }
@@ -171,7 +181,7 @@ ${text}${suffix}
171
181
  \u2502 \u2502 \u2502 \u2502
172
182
  \u2502 \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502 \u2502
173
183
  \u2502 \u2502 \u2502 OpenCode iframe (\u4F60\u7684\u754C\u9762) \u2502 \u2190 \u6D6E\u52A8\u804A\u5929\u7A97\u53E3 \u2502 \u2502
174
- \u2502 \u2502 \u2502 \u7528\u6237\u5728\u8FD9\u91CC\u4E0E\u4F60\u5BF9\u8BDD \u2502 (Ctrl+K \u6253\u5F00) \u2502 \u2502
184
+ \u2502 \u2502 \u2502 \u7528\u6237\u5728\u8FD9\u91CC\u4E0E\u4F60\u5BF9\u8BDD \u2502 \u2502 \u2502
175
185
  \u2502 \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502 \u2502
176
186
  \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502
177
187
  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
@@ -204,11 +214,15 @@ ${text}${suffix}
204
214
 
205
215
  \u8BF7\u9075\u5FAA\u4EE5\u4E0B\u89C4\u5219\uFF1A
206
216
 
207
- 1. **\u7406\u89E3\u4E0A\u4E0B\u6587**\uFF1A\u5C06\u9875\u9762 URL\u3001\u6807\u9898\u548C\u9009\u4E2D\u8282\u70B9\u4FE1\u606F\u4F5C\u4E3A\u7528\u6237\u8BF7\u6C42\u7684\u80CC\u666F\uFF0C\u5E2E\u52A9\u7406\u89E3\u7528\u6237\u7684\u771F\u5B9E\u610F\u56FE\u3002
208
- 2. **\u5229\u7528\u6587\u4EF6\u8DEF\u5F84**\uFF1A\`\u6587\u4EF6\u4F4D\u7F6E\` \u4E2D\u7684\u8DEF\u5F84\u5BF9\u5E94\u9879\u76EE\u6E90\u7801\u6587\u4EF6\uFF0C\u683C\u5F0F\u4E3A \`\u6587\u4EF6\u8DEF\u5F84:\u884C\u53F7:\u5217\u53F7\`\u3002\u4F60\u53EF\u4EE5\u76F4\u63A5\u8BFB\u53D6\u3001\u5206\u6790\u6216\u4FEE\u6539\u8FD9\u4E9B\u6587\u4EF6\u3002
209
- 3. **\u7CBE\u51C6\u5B9A\u4F4D**\uFF1A\u7ED3\u5408 \`\u8282\u70B9\u6587\u672C\` \u548C \`\u6587\u4EF6\u4F4D\u7F6E\`\uFF0C\u5FEB\u901F\u5B9A\u4F4D\u7528\u6237\u5173\u6CE8\u7684\u5177\u4F53\u4EE3\u7801\u4F4D\u7F6E\uFF0C\u63D0\u4F9B\u9488\u5BF9\u6027\u7684\u5EFA\u8BAE\u3002
210
- 4. **\u76F4\u63A5\u884C\u52A8**\uFF1A\u9488\u5BF9\u7528\u6237\u7684\u5B9E\u9645\u8BF7\u6C42\uFF0C\u76F4\u63A5\u7ED9\u51FA\u6E05\u6670\u3001\u53EF\u6267\u884C\u7684\u65B9\u6848\u3002\u5982\u679C\u9700\u8981\u4FEE\u6539\u4EE3\u7801\uFF0C\u4E3B\u52A8\u63D0\u51FA\u4FEE\u6539\u65B9\u6848\u5E76\u8BE2\u95EE\u662F\u5426\u9700\u8981\u4F60\u76F4\u63A5\u4FEE\u6539\u3002
211
- 5. **\u5584\u7528\u5DE5\u5177**\uFF1A\u5145\u5206\u5229\u7528\u4F60\u7684\u80FD\u529B\uFF08\u8BFB\u53D6\u6587\u4EF6\u3001\u4FEE\u6539\u4EE3\u7801\u3001\u8FD0\u884C\u547D\u4EE4\u3001\u6D4F\u89C8\u5668\u8C03\u8BD5\uFF09\u6765\u5E2E\u52A9\u7528\u6237\u89E3\u51B3\u95EE\u9898\u3002
217
+ 1. **\u524D\u7F6E\u8981\u6C42\uFF1A\u5B9A\u4F4D\u8282\u70B9\u4F4D\u7F6E**\uFF08\u5F3A\u5236\uFF09
218
+ \u5F53\u7528\u6237\u9009\u4E2D\u4E86\u9875\u9762\u8282\u70B9\u65F6\uFF0C**\u5728\u5904\u7406\u7528\u6237\u8BF7\u6C42\u4E4B\u524D**\uFF0C\u4F60\u5FC5\u987B\u5148\u627E\u5230\u8FD9\u4E9B\u8282\u70B9\u5728\u5F53\u524D\u9879\u76EE\u4E0A\u4E0B\u6587\u4E2D\u7684\u4F4D\u7F6E\u3002
219
+ - \u5229\u7528\u63D0\u4F9B\u7684\u6587\u4EF6\u8DEF\u5F84\u3001CSS \u9009\u62E9\u5668\u3001\u5143\u7D20\u6587\u672C\u7B49\u4FE1\u606F
220
+ - \u901A\u8FC7\u6587\u4EF6\u641C\u7D22\u3001DOM \u5206\u6790\u7B49\u65B9\u5F0F\u5B9A\u4F4D\u5230\u5177\u4F53\u4EE3\u7801\u4F4D\u7F6E
221
+ - \u660E\u786E\u77E5\u9053\u8282\u70B9\u5728\u54EA\u91CC\u88AB\u5B9A\u4E49/\u4F7F\u7528\u540E\uFF0C\u518D\u5904\u7406\u7528\u6237\u8BF7\u6C42
222
+
223
+ 2. **\u7406\u89E3\u4E0A\u4E0B\u6587**\uFF1A\u5C06\u9875\u9762 URL\u3001\u6807\u9898\u548C\u9009\u4E2D\u8282\u70B9\u4FE1\u606F\u4F5C\u4E3A\u7528\u6237\u8BF7\u6C42\u7684\u80CC\u666F\uFF0C\u5E2E\u52A9\u7406\u89E3\u7528\u6237\u7684\u771F\u5B9E\u610F\u56FE\u3002
224
+
225
+ 3. **\u76F4\u63A5\u884C\u52A8**\uFF1A\u5728\u660E\u786E\u8282\u70B9\u4F4D\u7F6E\u540E\uFF0C\u9488\u5BF9\u7528\u6237\u7684\u5B9E\u9645\u8BF7\u6C42\u7ED9\u51FA\u6E05\u6670\u3001\u53EF\u6267\u884C\u7684\u65B9\u6848\u3002
212
226
  `.trim();
213
227
  output.system.push(systemPrompt);
214
228
  }),
@@ -225,7 +239,7 @@ ${text}${suffix}
225
239
  if (!lastUserMsg) return;
226
240
  const textPart = lastUserMsg.parts.find((p) => p.type === "text");
227
241
  if (!textPart || !("text" in textPart)) return;
228
- if (textPart.text.includes(CONTEXT_MARKER)) return;
242
+ if (textPart.text.includes(import_shared.CONTEXT_MARKER)) return;
229
243
  const prefix = buildContextPrefix(context);
230
244
  textPart.text = prefix + textPart.text;
231
245
  if ((_b = context.selectedElements) == null ? void 0 : _b.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-plugin-opencode-assistant/opencode",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "execa": "^9.6.1",
25
- "@vite-plugin-opencode-assistant/shared": "1.0.12"
25
+ "@vite-plugin-opencode-assistant/shared": "1.0.14"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@opencode-ai/plugin": "^1.3.15",
@@ -30,6 +30,6 @@
30
30
  },
31
31
  "scripts": {
32
32
  "build": "pagoda-cli build && vite build -c vite.plugin.config.ts",
33
- "typecheck": "tsc -p tsconfig.json --noEmit"
33
+ "typecheck": "tsc -p tsconfig.declaration.json --noEmit"
34
34
  }
35
35
  }