@vite-plugin-opencode-assistant/opencode 1.0.27 → 1.0.28

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, 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) => {
2
+ var b = Object.defineProperty, w = Object.defineProperties, E = Object.getOwnPropertyDescriptors, y = Object.getOwnPropertySymbols, C = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable, O = (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) && P(e, r, t[r]);
4
+ C.call(t, r) && O(e, r, t[r]);
5
5
  if (y)
6
6
  for (var r of y(t))
7
- S.call(t, r) && P(e, r, t[r]);
7
+ S.call(t, r) && O(e, r, t[r]);
8
8
  return e;
9
- }, p = (e, t) => w(e, E(t)), O = (e, t, r) => P(e, typeof t != "symbol" ? t + "" : t, r);
9
+ }, p = (e, t) => w(e, E(t)), P = (e, t, r) => O(e, typeof t != "symbol" ? t + "" : t, r);
10
10
  const s = {
11
11
  reset: "\x1B[0m",
12
12
  dim: "\x1B[2m",
@@ -16,28 +16,28 @@ const s = {
16
16
  yellow: "\x1B[33m",
17
17
  magenta: "\x1B[35m",
18
18
  cyan: "\x1B[36m"
19
- }, j = {
19
+ }, T = {
20
20
  0: s.cyan,
21
21
  1: s.green,
22
22
  2: s.yellow,
23
23
  3: s.red,
24
24
  4: s.reset
25
- }, x = {
25
+ }, j = {
26
26
  0: "DEBUG",
27
27
  1: "INFO",
28
28
  2: "WARN",
29
29
  3: "ERROR",
30
30
  4: "NONE"
31
31
  };
32
- let L = {
32
+ let x = {
33
33
  level: 1
34
34
  /* INFO */
35
35
  };
36
- function N() {
36
+ function L() {
37
37
  const e = /* @__PURE__ */ new Date(), t = String(e.getHours()).padStart(2, "0"), r = String(e.getMinutes()).padStart(2, "0"), n = String(e.getSeconds()).padStart(2, "0"), o = String(e.getMilliseconds()).padStart(3, "0");
38
38
  return `${t}:${r}:${n}.${o}`;
39
39
  }
40
- function R(e = 3) {
40
+ function N(e = 3) {
41
41
  const t = new Error().stack;
42
42
  if (!t) return "";
43
43
  const n = t.split(`
@@ -65,7 +65,7 @@ ${e.stack}` : ""}`;
65
65
  }
66
66
  return String(e);
67
67
  }
68
- function T(e) {
68
+ function R(e) {
69
69
  if (!e || Object.keys(e).length === 0) return "";
70
70
  const t = [];
71
71
  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`);
@@ -79,14 +79,14 @@ function T(e) {
79
79
  return t.join(" ");
80
80
  }
81
81
  function h(e, t, r, ...n) {
82
- if (e < L.level) return;
82
+ if (e < x.level) return;
83
83
  const o = [];
84
- o.push(`${s.dim}[${process.pid}]${s.reset}`), o.push(`${s.dim}${N()}${s.reset}`);
85
- const i = j[e], m = x[e].padEnd(5);
84
+ o.push(`${s.dim}[${process.pid}]${s.reset}`), o.push(`${s.dim}${L()}${s.reset}`);
85
+ const i = T[e], m = j[e].padEnd(5);
86
86
  o.push(`${i}${m}${s.reset}`), o.push(`${s.bright}${_}${s.reset}`);
87
- const l = T(r);
87
+ const l = R(r);
88
88
  if (l && o.push(`${s.magenta}${l}${s.reset}`), o.push(t), e >= 2) {
89
- const a = R(4);
89
+ const a = N(4);
90
90
  a && o.push(`${s.dim}(${a})${s.reset}`);
91
91
  }
92
92
  const $ = n.map((a) => f(a)).join(" ");
@@ -117,7 +117,7 @@ const g = {
117
117
  };
118
118
  class A {
119
119
  constructor(t, r) {
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);
120
+ P(this, "startTime"), P(this, "context"), P(this, "operation"), this.operation = t, this.context = r || {}, this.startTime = performance.now(), g.debug(`⏱️ Starting: ${t}`, this.context);
121
121
  }
122
122
  end(t) {
123
123
  const r = Math.round(performance.now() - this.startTime), n = t || `✓ Completed: ${this.operation}`;
@@ -231,6 +231,9 @@ ${o}
231
231
 
232
232
  3. **单页应用(SPA)特性**
233
233
  如果用户开发的是单页应用(SPA),执行任务大部分情况下不需要刷新页面。
234
+
235
+ 4. **HTTP 请求成功判断(强制)**
236
+ 判断请求成功时,不要只看 HTTP 状态码!HTTP 状态码 200 并不代表业务逻辑成功。必须获取接口的详细响应内容,检查响应体中的业务状态码或错误信息。在确认请求成功之前,始终解析并检查响应体的完整内容
234
237
  `.trim();
235
238
  r.system.push(i);
236
239
  }
@@ -141,6 +141,9 @@ ${currentPageSection}
141
141
 
142
142
  3. **\u5355\u9875\u5E94\u7528\uFF08SPA\uFF09\u7279\u6027**
143
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
144
+
145
+ 4. **HTTP \u8BF7\u6C42\u6210\u529F\u5224\u65AD\uFF08\u5F3A\u5236\uFF09**
146
+ \u5224\u65AD\u8BF7\u6C42\u6210\u529F\u65F6\uFF0C\u4E0D\u8981\u53EA\u770B HTTP \u72B6\u6001\u7801\uFF01HTTP \u72B6\u6001\u7801 200 \u5E76\u4E0D\u4EE3\u8868\u4E1A\u52A1\u903B\u8F91\u6210\u529F\u3002\u5FC5\u987B\u83B7\u53D6\u63A5\u53E3\u7684\u8BE6\u7EC6\u54CD\u5E94\u5185\u5BB9\uFF0C\u68C0\u67E5\u54CD\u5E94\u4F53\u4E2D\u7684\u4E1A\u52A1\u72B6\u6001\u7801\u6216\u9519\u8BEF\u4FE1\u606F\u3002\u5728\u786E\u8BA4\u8BF7\u6C42\u6210\u529F\u4E4B\u524D\uFF0C\u59CB\u7EC8\u89E3\u6790\u5E76\u68C0\u67E5\u54CD\u5E94\u4F53\u7684\u5B8C\u6574\u5185\u5BB9
144
147
  `.trim();
145
148
  output.system.push(systemPrompt);
146
149
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-plugin-opencode-assistant/opencode",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
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.27"
25
+ "@vite-plugin-opencode-assistant/shared": "1.0.28"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@opencode-ai/plugin": "^1.3.15",