@vite-plugin-opencode-assistant/opencode 1.0.26 → 1.0.27
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,12 +1,12 @@
|
|
|
1
1
|
const _ = "[vite-plugin-opencode]";
|
|
2
|
-
var b = Object.defineProperty, w = Object.defineProperties, E = Object.getOwnPropertyDescriptors,
|
|
2
|
+
var b = Object.defineProperty, w = Object.defineProperties, E = Object.getOwnPropertyDescriptors, y = Object.getOwnPropertySymbols, C = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable, P = (e, t, r) => t in e ? b(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, u = (e, t) => {
|
|
3
3
|
for (var r in t || (t = {}))
|
|
4
|
-
C.call(t, r) &&
|
|
5
|
-
if (
|
|
6
|
-
for (var r of
|
|
7
|
-
S.call(t, r) &&
|
|
4
|
+
C.call(t, r) && P(e, r, t[r]);
|
|
5
|
+
if (y)
|
|
6
|
+
for (var r of y(t))
|
|
7
|
+
S.call(t, r) && P(e, r, t[r]);
|
|
8
8
|
return e;
|
|
9
|
-
}, p = (e, t) => w(e, E(t)), O = (e, t, r) =>
|
|
9
|
+
}, p = (e, t) => w(e, E(t)), O = (e, t, r) => P(e, typeof t != "symbol" ? t + "" : t, r);
|
|
10
10
|
const s = {
|
|
11
11
|
reset: "\x1B[0m",
|
|
12
12
|
dim: "\x1B[2m",
|
|
@@ -115,7 +115,7 @@ const g = {
|
|
|
115
115
|
groupEnd() {
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
class
|
|
118
|
+
class A {
|
|
119
119
|
constructor(t, r) {
|
|
120
120
|
O(this, "startTime"), O(this, "context"), O(this, "operation"), this.operation = t, this.context = r || {}, this.startTime = performance.now(), g.debug(`⏱️ Starting: ${t}`, this.context);
|
|
121
121
|
}
|
|
@@ -128,7 +128,7 @@ class I {
|
|
|
128
128
|
return g.debug(` ↳ ${t}`, p(u({}, this.context), { duration: r })), r;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function I(e) {
|
|
132
132
|
return {
|
|
133
133
|
debug(t, r, ...n) {
|
|
134
134
|
g.debug(t, p(u({}, r), { module: e }), ...n);
|
|
@@ -143,12 +143,12 @@ function B(e) {
|
|
|
143
143
|
g.error(t, p(u({}, r), { module: e }), ...n);
|
|
144
144
|
},
|
|
145
145
|
timer(t, r) {
|
|
146
|
-
return new
|
|
146
|
+
return new A(t, p(u({}, r), { module: e }));
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
const c =
|
|
151
|
-
async function
|
|
150
|
+
const c = I("OpenCodePluginPageContext");
|
|
151
|
+
async function B(e) {
|
|
152
152
|
try {
|
|
153
153
|
const t = await fetch(e, {
|
|
154
154
|
method: "GET",
|
|
@@ -159,13 +159,13 @@ async function D(e) {
|
|
|
159
159
|
return c.debug("Error fetching page context", { error: t }), null;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const D = async () => {
|
|
163
163
|
c.info("PageContextPlugin loading...");
|
|
164
164
|
const e = process.env.OPENCODE_CONTEXT_API_URL;
|
|
165
165
|
return c.debug("Context API URL:", { contextApiUrl: e }), e ? (c.info("Plugin initialized successfully"), {
|
|
166
166
|
"experimental.chat.system.transform": async (t, r) => {
|
|
167
167
|
c.debug("System transform hook called");
|
|
168
|
-
const n = await
|
|
168
|
+
const n = await B(e);
|
|
169
169
|
c.debug("Page context fetched", { pageContext: n });
|
|
170
170
|
let o = "";
|
|
171
171
|
n && (o = `
|
|
@@ -228,12 +228,15 @@ ${o}
|
|
|
228
228
|
|
|
229
229
|
2. **快照获取**
|
|
230
230
|
在没有获取到需要的节点信息时,使用 verbose 参数来获取更详细的节点信息。如果设置了 verbose 参数还是没有获取到节点信息,再尝试考虑其他方案。
|
|
231
|
+
|
|
232
|
+
3. **单页应用(SPA)特性**
|
|
233
|
+
如果用户开发的是单页应用(SPA),执行任务大部分情况下不需要刷新页面。
|
|
231
234
|
`.trim();
|
|
232
235
|
r.system.push(i);
|
|
233
236
|
}
|
|
234
237
|
}) : (c.warn("OPENCODE_CONTEXT_API_URL is not set, page context plugin will not work"), {});
|
|
235
238
|
};
|
|
236
239
|
export {
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
D as PageContextPlugin,
|
|
241
|
+
D as default
|
|
239
242
|
};
|
|
@@ -138,6 +138,9 @@ ${currentPageSection}
|
|
|
138
138
|
|
|
139
139
|
2. **\u5FEB\u7167\u83B7\u53D6**
|
|
140
140
|
\u5728\u6CA1\u6709\u83B7\u53D6\u5230\u9700\u8981\u7684\u8282\u70B9\u4FE1\u606F\u65F6\uFF0C\u4F7F\u7528 verbose \u53C2\u6570\u6765\u83B7\u53D6\u66F4\u8BE6\u7EC6\u7684\u8282\u70B9\u4FE1\u606F\u3002\u5982\u679C\u8BBE\u7F6E\u4E86 verbose \u53C2\u6570\u8FD8\u662F\u6CA1\u6709\u83B7\u53D6\u5230\u8282\u70B9\u4FE1\u606F\uFF0C\u518D\u5C1D\u8BD5\u8003\u8651\u5176\u4ED6\u65B9\u6848\u3002
|
|
141
|
+
|
|
142
|
+
3. **\u5355\u9875\u5E94\u7528\uFF08SPA\uFF09\u7279\u6027**
|
|
143
|
+
\u5982\u679C\u7528\u6237\u5F00\u53D1\u7684\u662F\u5355\u9875\u5E94\u7528\uFF08SPA\uFF09\uFF0C\u6267\u884C\u4EFB\u52A1\u5927\u90E8\u5206\u60C5\u51B5\u4E0B\u4E0D\u9700\u8981\u5237\u65B0\u9875\u9762\u3002
|
|
141
144
|
`.trim();
|
|
142
145
|
output.system.push(systemPrompt);
|
|
143
146
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-plugin-opencode-assistant/opencode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
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.
|
|
25
|
+
"@vite-plugin-opencode-assistant/shared": "1.0.27"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@opencode-ai/plugin": "^1.3.15",
|