vite-plugin-opencode-assistant 1.0.9 → 1.0.11

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.
@@ -134,9 +134,14 @@ const App = {
134
134
  try {
135
135
  const response = yield fetch("/__opencode_sessions__", { method: "POST" });
136
136
  const newSession = yield response.json();
137
- yield loadSessions();
137
+ sessions.value.unshift({
138
+ id: newSession.id,
139
+ title: "\u65B0\u4F1A\u8BDD",
140
+ updatedAt: Date.now()
141
+ });
138
142
  currentSessionId.value = newSession.id;
139
143
  iframeSrc.value = `${webUrl}/${utf8ToBase64(cwd)}/session/${newSession.id}`;
144
+ loadSessions();
140
145
  } catch (e) {
141
146
  showNotification("\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25");
142
147
  }
@@ -134,9 +134,14 @@ const App = {
134
134
  try {
135
135
  const response = yield fetch("/__opencode_sessions__", { method: "POST" });
136
136
  const newSession = yield response.json();
137
- yield loadSessions();
137
+ sessions.value.unshift({
138
+ id: newSession.id,
139
+ title: "\u65B0\u4F1A\u8BDD",
140
+ updatedAt: Date.now()
141
+ });
138
142
  currentSessionId.value = newSession.id;
139
143
  iframeSrc.value = `${webUrl}/${utf8ToBase64(cwd)}/session/${newSession.id}`;
144
+ loadSessions();
140
145
  } catch (e) {
141
146
  showNotification("\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25");
142
147
  }
package/lib/client.js CHANGED
@@ -14,7 +14,7 @@ const X = {}, xt = [], Xe = () => {
14
14
  (e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), _s = (e) => e.startsWith("onUpdate:"), pe = Object.assign, sn = (e, t) => {
15
15
  const s = e.indexOf(t);
16
16
  s > -1 && e.splice(s, 1);
17
- }, Ci = Object.prototype.hasOwnProperty, q = (e, t) => Ci.call(e, t), F = Array.isArray, wt = (e) => Yt(e) === "[object Map]", oo = (e) => Yt(e) === "[object Set]", Cn = (e) => Yt(e) === "[object Date]", R = (e) => typeof e == "function", ce = (e) => typeof e == "string", De = (e) => typeof e == "symbol", G = (e) => e !== null && typeof e == "object", io = (e) => (G(e) || R(e)) && R(e.then) && R(e.catch), lo = Object.prototype.toString, Yt = (e) => lo.call(e), Ei = (e) => Yt(e).slice(8, -1), ro = (e) => Yt(e) === "[object Object]", ms = (e) => ce(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, Nt = /* @__PURE__ */ tn(
17
+ }, Ci = Object.prototype.hasOwnProperty, q = (e, t) => Ci.call(e, t), $ = Array.isArray, wt = (e) => Yt(e) === "[object Map]", oo = (e) => Yt(e) === "[object Set]", Cn = (e) => Yt(e) === "[object Date]", R = (e) => typeof e == "function", ce = (e) => typeof e == "string", De = (e) => typeof e == "symbol", G = (e) => e !== null && typeof e == "object", io = (e) => (G(e) || R(e)) && R(e.then) && R(e.catch), lo = Object.prototype.toString, Yt = (e) => lo.call(e), Ei = (e) => Yt(e).slice(8, -1), ro = (e) => Yt(e) === "[object Object]", ms = (e) => ce(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, Nt = /* @__PURE__ */ tn(
18
18
  // the leading comma is intentional so empty string "" is also included
19
19
  ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
20
20
  ), vs = (e) => {
@@ -43,7 +43,7 @@ const X = {}, xt = [], Xe = () => {
43
43
  let En;
44
44
  const bs = () => En || (En = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
45
45
  function Vt(e) {
46
- if (F(e)) {
46
+ if ($(e)) {
47
47
  const t = {};
48
48
  for (let s = 0; s < e.length; s++) {
49
49
  const n = e[s], o = ce(n) ? Ii(n) : Vt(n);
@@ -69,7 +69,7 @@ function Te(e) {
69
69
  let t = "";
70
70
  if (ce(e))
71
71
  t = e;
72
- else if (F(e))
72
+ else if ($(e))
73
73
  for (let s = 0; s < e.length; s++) {
74
74
  const n = Te(e[s]);
75
75
  n && (t += n + " ");
@@ -97,7 +97,7 @@ function nn(e, t) {
97
97
  return s && n ? e.getTime() === t.getTime() : !1;
98
98
  if (s = De(e), n = De(t), s || n)
99
99
  return e === t;
100
- if (s = F(e), n = F(t), s || n)
100
+ if (s = $(e), n = $(t), s || n)
101
101
  return s && n ? Ni(e, t) : !1;
102
102
  if (s = G(e), n = G(t), s || n) {
103
103
  if (!s || !n)
@@ -113,14 +113,14 @@ function nn(e, t) {
113
113
  }
114
114
  return String(e) === String(t);
115
115
  }
116
- const fo = (e) => !!(e && e.__v_isRef === !0), we = (e) => ce(e) ? e : e == null ? "" : F(e) || G(e) && (e.toString === lo || !R(e.toString)) ? fo(e) ? we(e.value) : JSON.stringify(e, ho, 2) : String(e), ho = (e, t) => fo(t) ? ho(e, t.value) : wt(t) ? {
116
+ const fo = (e) => !!(e && e.__v_isRef === !0), we = (e) => ce(e) ? e : e == null ? "" : $(e) || G(e) && (e.toString === lo || !R(e.toString)) ? fo(e) ? we(e.value) : JSON.stringify(e, ho, 2) : String(e), ho = (e, t) => fo(t) ? ho(e, t.value) : wt(t) ? {
117
117
  [`Map(${t.size})`]: [...t.entries()].reduce(
118
118
  (s, [n, o], i) => (s[Ds(n, i) + " =>"] = o, s),
119
119
  {}
120
120
  )
121
121
  } : oo(t) ? {
122
122
  [`Set(${t.size})`]: [...t.values()].map((s) => Ds(s))
123
- } : De(t) ? Ds(t) : G(t) && !F(t) && !ro(t) ? String(t) : t, Ds = (e, t = "") => {
123
+ } : De(t) ? Ds(t) : G(t) && !$(t) && !ro(t) ? String(t) : t, Ds = (e, t = "") => {
124
124
  var s;
125
125
  return (
126
126
  // Symbol.description in es2019+ so we need to cast here to pass
@@ -447,7 +447,7 @@ function nt(e, t, s, n, o, i) {
447
447
  if (on(), t === "clear")
448
448
  l.forEach(r);
449
449
  else {
450
- const c = F(e), d = c && ms(s);
450
+ const c = $(e), d = c && ms(s);
451
451
  if (c && s === "length") {
452
452
  const a = Number(n);
453
453
  l.forEach((h, b) => {
@@ -489,7 +489,7 @@ const Hi = {
489
489
  },
490
490
  concat(...e) {
491
491
  return yt(this).concat(
492
- ...e.map((t) => F(t) ? yt(t) : t)
492
+ ...e.map((t) => $(t) ? yt(t) : t)
493
493
  );
494
494
  },
495
495
  entries() {
@@ -662,7 +662,7 @@ class wo {
662
662
  return n === (o ? i ? el : Ao : i ? To : Eo).get(t) || // receiver is not the reactive proxy, but has the same prototype
663
663
  // this means the receiver is a user proxy of the reactive proxy
664
664
  Object.getPrototypeOf(t) === Object.getPrototypeOf(n) ? t : void 0;
665
- const l = F(t);
665
+ const l = $(t);
666
666
  if (!o) {
667
667
  let c;
668
668
  if (l && (c = Hi[s]))
@@ -693,7 +693,7 @@ class Co extends wo {
693
693
  }
694
694
  set(t, s, n, o) {
695
695
  let i = t[s];
696
- const l = F(t) && ms(s);
696
+ const l = $(t) && ms(s);
697
697
  if (!this._isShallow) {
698
698
  const d = /* @__PURE__ */ rt(i);
699
699
  if (!/* @__PURE__ */ Pe(n) && !/* @__PURE__ */ rt(n) && (i = /* @__PURE__ */ U(i), n = /* @__PURE__ */ U(n)), !l && /* @__PURE__ */ ae(i) && !/* @__PURE__ */ ae(n))
@@ -721,7 +721,7 @@ class Co extends wo {
721
721
  return _e(
722
722
  t,
723
723
  "iterate",
724
- F(t) ? "length" : gt
724
+ $(t) ? "length" : gt
725
725
  ), Reflect.ownKeys(t);
726
726
  }
727
727
  }
@@ -980,7 +980,7 @@ class cl {
980
980
  constructor(t, s, n) {
981
981
  this._object = t, this._defaultValue = n, this.__v_isRef = !0, this._value = void 0, this._key = De(s) ? s : String(s), this._raw = /* @__PURE__ */ U(t);
982
982
  let o = !0, i = t;
983
- if (!F(t) || De(this._key) || !ms(this._key))
983
+ if (!$(t) || De(this._key) || !ms(this._key))
984
984
  do
985
985
  o = !/* @__PURE__ */ Ss(i) || /* @__PURE__ */ Pe(i);
986
986
  while (o && (i = i.__v_raw));
@@ -1055,7 +1055,7 @@ function hl(e, t = !1, s = pt) {
1055
1055
  function pl(e, t, s = X) {
1056
1056
  const { immediate: n, deep: o, once: i, scheduler: l, augmentJob: r, call: c } = s, d = (A) => o ? A : /* @__PURE__ */ Pe(A) || o === !1 || o === 0 ? ot(A, 1) : ot(A);
1057
1057
  let a, h, b, x, O = !1, T = !1;
1058
- if (/* @__PURE__ */ ae(e) ? (h = () => e.value, O = /* @__PURE__ */ Pe(e)) : /* @__PURE__ */ _t(e) ? (h = () => d(e), O = !0) : F(e) ? (T = !0, O = e.some((A) => /* @__PURE__ */ _t(A) || /* @__PURE__ */ Pe(A)), h = () => e.map((A) => {
1058
+ if (/* @__PURE__ */ ae(e) ? (h = () => e.value, O = /* @__PURE__ */ Pe(e)) : /* @__PURE__ */ _t(e) ? (h = () => d(e), O = !0) : $(e) ? (T = !0, O = e.some((A) => /* @__PURE__ */ _t(A) || /* @__PURE__ */ Pe(A)), h = () => e.map((A) => {
1059
1059
  if (/* @__PURE__ */ ae(A))
1060
1060
  return A.value;
1061
1061
  if (/* @__PURE__ */ _t(A))
@@ -1134,7 +1134,7 @@ function ot(e, t = 1 / 0, s) {
1134
1134
  return e;
1135
1135
  if (s.set(e, t), t--, /* @__PURE__ */ ae(e))
1136
1136
  ot(e.value, t, s);
1137
- else if (F(e))
1137
+ else if ($(e))
1138
1138
  for (let n = 0; n < e.length; n++)
1139
1139
  ot(e[n], t, s);
1140
1140
  else if (oo(e) || wt(e))
@@ -1168,7 +1168,7 @@ function Ze(e, t, s, n) {
1168
1168
  xs(i, t, s);
1169
1169
  }), o;
1170
1170
  }
1171
- if (F(e)) {
1171
+ if ($(e)) {
1172
1172
  const o = [];
1173
1173
  for (let i = 0; i < e.length; i++)
1174
1174
  o.push(Ze(e[i], t, s, n));
@@ -1234,7 +1234,7 @@ function Do() {
1234
1234
  ls || (ls = Po.then(Fo));
1235
1235
  }
1236
1236
  function vl(e) {
1237
- F(e) ? Ct.push(...e) : at && e.id === -1 ? at.splice(St + 1, 0, e) : e.flags & 1 || (Ct.push(e), e.flags |= 1), Do();
1237
+ $(e) ? Ct.push(...e) : at && e.id === -1 ? at.splice(St + 1, 0, e) : e.flags & 1 || (Ct.push(e), e.flags |= 1), Do();
1238
1238
  }
1239
1239
  function Mn(e, t, s = Je + 1) {
1240
1240
  for (; s < Se.length; s++) {
@@ -1420,11 +1420,11 @@ function On(e, t) {
1420
1420
  }
1421
1421
  const cs = /* @__PURE__ */ new WeakMap();
1422
1422
  function Bt(e, t, s, n, o = !1) {
1423
- if (F(e)) {
1423
+ if ($(e)) {
1424
1424
  e.forEach(
1425
1425
  (T, B) => Bt(
1426
1426
  T,
1427
- t && (F(t) ? t[B] : t),
1427
+ t && ($(t) ? t[B] : t),
1428
1428
  s,
1429
1429
  n,
1430
1430
  o
@@ -1454,8 +1454,8 @@ function Bt(e, t, s, n, o = !1) {
1454
1454
  if (e.f) {
1455
1455
  const I = T ? x(c) ? h[c] : a[c] : O() || !e.k ? c.value : a[e.k];
1456
1456
  if (o)
1457
- F(I) && sn(I, i);
1458
- else if (F(I))
1457
+ $(I) && sn(I, i);
1458
+ else if ($(I))
1459
1459
  I.includes(i) || I.push(i);
1460
1460
  else if (T)
1461
1461
  a[c] = [i], x(c) && (h[c] = a[c]);
@@ -1541,7 +1541,7 @@ function Nl(e, t = xe) {
1541
1541
  const Rl = /* @__PURE__ */ Symbol.for("v-ndc");
1542
1542
  function us(e, t, s, n) {
1543
1543
  let o;
1544
- const i = s, l = F(e);
1544
+ const i = s, l = $(e);
1545
1545
  if (l || ce(e)) {
1546
1546
  const r = l && /* @__PURE__ */ _t(e);
1547
1547
  let c = !1, d = !1;
@@ -1578,7 +1578,7 @@ function us(e, t, s, n) {
1578
1578
  function Rs(e, t) {
1579
1579
  for (let s = 0; s < t.length; s++) {
1580
1580
  const n = t[s];
1581
- if (F(n))
1581
+ if ($(n))
1582
1582
  for (let o = 0; o < n.length; o++)
1583
1583
  e[n[o].name] = n[o].fn;
1584
1584
  else n && (e[n.name] = n.key ? (...o) => {
@@ -1707,7 +1707,7 @@ function Bl(e) {
1707
1707
  return t.setupContext || (t.setupContext = ai(t));
1708
1708
  }
1709
1709
  function Dn(e) {
1710
- return F(e) ? e.reduce(
1710
+ return $(e) ? e.reduce(
1711
1711
  (t, s) => (t[s] = null, t),
1712
1712
  {}
1713
1713
  ) : e;
@@ -1760,15 +1760,15 @@ function jl(e) {
1760
1760
  }
1761
1761
  if (Ys = !0, i)
1762
1762
  for (const Y in i) {
1763
- const K = i[Y], Fe = R(K) ? K.bind(s, s) : R(K.get) ? K.get.bind(s, s) : Xe, D = !R(K) && R(K.set) ? K.set.bind(s) : Xe, $ = Re({
1763
+ const K = i[Y], Fe = R(K) ? K.bind(s, s) : R(K.get) ? K.get.bind(s, s) : Xe, D = !R(K) && R(K.set) ? K.set.bind(s) : Xe, F = Re({
1764
1764
  get: Fe,
1765
1765
  set: D
1766
1766
  });
1767
1767
  Object.defineProperty(n, Y, {
1768
1768
  enumerable: !0,
1769
1769
  configurable: !0,
1770
- get: () => $.value,
1771
- set: (W) => $.value = W
1770
+ get: () => F.value,
1771
+ set: (W) => F.value = W
1772
1772
  });
1773
1773
  }
1774
1774
  if (r)
@@ -1782,9 +1782,9 @@ function jl(e) {
1782
1782
  }
1783
1783
  a && In(a, e, "c");
1784
1784
  function ie(Y, K) {
1785
- F(K) ? K.forEach((Fe) => Y(Fe.bind(s))) : K && Y(K.bind(s));
1785
+ $(K) ? K.forEach((Fe) => Y(Fe.bind(s))) : K && Y(K.bind(s));
1786
1786
  }
1787
- if (ie(Ml, h), ie(pn, b), ie(Ol, x), ie(Pl, O), ie(El, T), ie(Tl, B), ie(Nl, fe), ie($l, ne), ie(Fl, oe), ie(Dl, I), ie(gn, A), ie(Il, Ae), F(ve))
1787
+ if (ie(Ml, h), ie(pn, b), ie(Ol, x), ie(Pl, O), ie(El, T), ie(Tl, B), ie(Nl, fe), ie($l, ne), ie(Fl, oe), ie(Dl, I), ie(gn, A), ie(Il, Ae), $(ve))
1788
1788
  if (ve.length) {
1789
1789
  const Y = e.exposed || (e.exposed = {});
1790
1790
  ve.forEach((K) => {
@@ -1798,7 +1798,7 @@ function jl(e) {
1798
1798
  H && e.render === Xe && (e.render = H), Ie != null && (e.inheritAttrs = Ie), je && (e.components = je), He && (e.directives = He), Ae && ko(e);
1799
1799
  }
1800
1800
  function Hl(e, t, s = Xe) {
1801
- F(e) && (e = zs(e));
1801
+ $(e) && (e = zs(e));
1802
1802
  for (const n in e) {
1803
1803
  const o = e[n];
1804
1804
  let i;
@@ -1816,7 +1816,7 @@ function Hl(e, t, s = Xe) {
1816
1816
  }
1817
1817
  function In(e, t, s) {
1818
1818
  Ze(
1819
- F(e) ? e.map((n) => n.bind(t.proxy)) : e.bind(t.proxy),
1819
+ $(e) ? e.map((n) => n.bind(t.proxy)) : e.bind(t.proxy),
1820
1820
  t,
1821
1821
  s
1822
1822
  );
@@ -1829,7 +1829,7 @@ function Vo(e, t, s, n) {
1829
1829
  } else if (R(e))
1830
1830
  mt(o, e.bind(s));
1831
1831
  else if (G(e))
1832
- if (F(e))
1832
+ if ($(e))
1833
1833
  e.forEach((i) => Vo(i, t, s, n));
1834
1834
  else {
1835
1835
  const i = R(e.handler) ? e.handler.bind(s) : t[e.handler];
@@ -1902,7 +1902,7 @@ function Kl(e, t) {
1902
1902
  return $t(zs(e), zs(t));
1903
1903
  }
1904
1904
  function zs(e) {
1905
- if (F(e)) {
1905
+ if ($(e)) {
1906
1906
  const t = {};
1907
1907
  for (let s = 0; s < e.length; s++)
1908
1908
  t[e[s]] = e[s];
@@ -1917,7 +1917,7 @@ function $t(e, t) {
1917
1917
  return e ? pe(/* @__PURE__ */ Object.create(null), e, t) : t;
1918
1918
  }
1919
1919
  function $n(e, t) {
1920
- return e ? F(e) && F(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : pe(
1920
+ return e ? $(e) && $(t) ? [.../* @__PURE__ */ new Set([...e, ...t])] : pe(
1921
1921
  /* @__PURE__ */ Object.create(null),
1922
1922
  Dn(e),
1923
1923
  Dn(t ?? {})
@@ -2059,7 +2059,7 @@ function Wo(e, t, s = !1) {
2059
2059
  };
2060
2060
  !s && t.mixins.length && t.mixins.forEach(c), e.extends && c(e.extends), e.mixins && e.mixins.forEach(c);
2061
2061
  }
2062
- return !i && !r ? (G(e) && n.set(e, null), null) : (F(i) ? i.forEach((c) => l[c] = null) : pe(l, i), G(e) && n.set(e, l), l);
2062
+ return !i && !r ? (G(e) && n.set(e, null), null) : ($(i) ? i.forEach((c) => l[c] = null) : pe(l, i), G(e) && n.set(e, l), l);
2063
2063
  }
2064
2064
  function Cs(e, t) {
2065
2065
  return !e || !gs(t) ? !1 : (t = t.slice(2).replace(/Once$/, ""), q(e, t[0].toLowerCase() + t.slice(1)) || q(e, vt(t)) || q(e, t));
@@ -2323,7 +2323,7 @@ function Xo(e, t, s = !1) {
2323
2323
  }
2324
2324
  if (!i && !c)
2325
2325
  return G(e) && n.set(e, xt), xt;
2326
- if (F(i))
2326
+ if ($(i))
2327
2327
  for (let a = 0; a < i.length; a++) {
2328
2328
  const h = Le(i[a]);
2329
2329
  Ln(h) && (l[h] = X);
@@ -2332,9 +2332,9 @@ function Xo(e, t, s = !1) {
2332
2332
  for (const a in i) {
2333
2333
  const h = Le(a);
2334
2334
  if (Ln(h)) {
2335
- const b = i[a], x = l[h] = F(b) || R(b) ? { type: b } : pe({}, b), O = x.type;
2335
+ const b = i[a], x = l[h] = $(b) || R(b) ? { type: b } : pe({}, b), O = x.type;
2336
2336
  let T = !1, B = !0;
2337
- if (F(O))
2337
+ if ($(O))
2338
2338
  for (let k = 0; k < O.length; ++k) {
2339
2339
  const I = O[k], j = R(I) && I.name;
2340
2340
  if (j === "Boolean") {
@@ -2359,7 +2359,7 @@ function Xo(e, t, s = !1) {
2359
2359
  function Ln(e) {
2360
2360
  return e[0] !== "$" && !Nt(e);
2361
2361
  }
2362
- const _n = (e) => e === "_" || e === "_ctx" || e === "$stable", mn = (e) => F(e) ? e.map(Ye) : [Ye(e)], nr = (e, t, s) => {
2362
+ const _n = (e) => e === "_" || e === "_ctx" || e === "$stable", mn = (e) => $(e) ? e.map(Ye) : [Ye(e)], nr = (e, t, s) => {
2363
2363
  if (t._n)
2364
2364
  return t;
2365
2365
  const n = et((...o) => mn(t(...o)), s);
@@ -3057,13 +3057,13 @@ function rr(e, t) {
3057
3057
  w,
3058
3058
  S,
3059
3059
  y
3060
- ) : Ke && (Z < 0 || m !== Sn[Z] ? $(We, p, wn, 2) : Z--);
3060
+ ) : Ke && (Z < 0 || m !== Sn[Z] ? F(We, p, wn, 2) : Z--);
3061
3061
  }
3062
3062
  }
3063
- }, $ = (u, f, p, v, g = null) => {
3063
+ }, F = (u, f, p, v, g = null) => {
3064
3064
  const { el: _, type: w, transition: S, children: y, shapeFlag: m } = u;
3065
3065
  if (m & 6) {
3066
- $(u.component.subTree, f, p, v);
3066
+ F(u.component.subTree, f, p, v);
3067
3067
  return;
3068
3068
  }
3069
3069
  if (m & 128) {
@@ -3077,7 +3077,7 @@ function rr(e, t) {
3077
3077
  if (w === ue) {
3078
3078
  n(_, f, p);
3079
3079
  for (let C = 0; C < y.length; C++)
3080
- $(y[C], f, p, v);
3080
+ F(y[C], f, p, v);
3081
3081
  n(u.anchor, f, p);
3082
3082
  return;
3083
3083
  }
@@ -3207,7 +3207,7 @@ function rr(e, t) {
3207
3207
  }, Ot = {
3208
3208
  p: T,
3209
3209
  um: W,
3210
- m: $,
3210
+ m: F,
3211
3211
  r: $e,
3212
3212
  mt: Ve,
3213
3213
  mc: fe,
@@ -3233,7 +3233,7 @@ function cr(e, t) {
3233
3233
  }
3234
3234
  function ti(e, t, s = !1) {
3235
3235
  const n = e.children, o = t.children;
3236
- if (F(n) && F(o))
3236
+ if ($(n) && $(o))
3237
3237
  for (let i = 0; i < n.length; i++) {
3238
3238
  const l = n[i];
3239
3239
  let r = o[i];
@@ -3278,7 +3278,7 @@ function ni(e) {
3278
3278
  }
3279
3279
  const oi = (e) => e.__isSuspense;
3280
3280
  function ar(e, t) {
3281
- t && t.pendingBranch ? F(e) ? t.effects.push(...e) : t.effects.push(e) : vl(e);
3281
+ t && t.pendingBranch ? $(e) ? t.effects.push(...e) : t.effects.push(e) : vl(e);
3282
3282
  }
3283
3283
  const ue = /* @__PURE__ */ Symbol.for("v-fgt"), Es = /* @__PURE__ */ Symbol.for("v-txt"), ct = /* @__PURE__ */ Symbol.for("v-cmt"), Bs = /* @__PURE__ */ Symbol.for("v-stc"), Ht = [];
3284
3284
  let Oe = null;
@@ -3385,7 +3385,7 @@ function dr(e, t = null, s = null, n = 0, o = null, i = !1) {
3385
3385
  if (xr(e) && (e = e.__vccOpts), t) {
3386
3386
  t = hr(t);
3387
3387
  let { class: r, style: c } = t;
3388
- r && !ce(r) && (t.class = Te(r)), G(c) && (/* @__PURE__ */ Ss(c) && !F(c) && (c = pe({}, c)), t.style = Vt(c));
3388
+ r && !ce(r) && (t.class = Te(r)), G(c) && (/* @__PURE__ */ Ss(c) && !$(c) && (c = pe({}, c)), t.style = Vt(c));
3389
3389
  }
3390
3390
  const l = ce(e) ? 1 : oi(e) ? 128 : wl(e) ? 64 : G(e) ? 4 : R(e) ? 2 : 0;
3391
3391
  return E(
@@ -3413,7 +3413,7 @@ function Mt(e, t, s = !1, n = !1) {
3413
3413
  // #2078 in the case of <component :is="vnode" ref="extra"/>
3414
3414
  // if the vnode itself already has a ref, cloneVNode will need to merge
3415
3415
  // the refs so the single vnode can be set on multiple refs
3416
- s && i ? F(i) ? i.concat(ss(t)) : [i, ss(t)] : ss(t)
3416
+ s && i ? $(i) ? i.concat(ss(t)) : [i, ss(t)] : ss(t)
3417
3417
  ) : i,
3418
3418
  scopeId: e.scopeId,
3419
3419
  slotScopeIds: e.slotScopeIds,
@@ -3459,7 +3459,7 @@ function ye(e = "", t = !1) {
3459
3459
  return t ? (J(), ds(ct, null, e)) : re(ct, null, e);
3460
3460
  }
3461
3461
  function Ye(e) {
3462
- return e == null || typeof e == "boolean" ? re(ct) : F(e) ? re(
3462
+ return e == null || typeof e == "boolean" ? re(ct) : $(e) ? re(
3463
3463
  ue,
3464
3464
  null,
3465
3465
  // #3666, avoid reference pollution when reusing vnode
@@ -3474,7 +3474,7 @@ function vn(e, t) {
3474
3474
  const { shapeFlag: n } = e;
3475
3475
  if (t == null)
3476
3476
  t = null;
3477
- else if (F(t))
3477
+ else if ($(t))
3478
3478
  s = 16;
3479
3479
  else if (typeof t == "object")
3480
3480
  if (n & 65) {
@@ -3500,7 +3500,7 @@ function gr(...e) {
3500
3500
  t.style = Vt([t.style, n.style]);
3501
3501
  else if (gs(o)) {
3502
3502
  const i = t[o], l = n[o];
3503
- l && i !== l && !(F(i) && i.includes(l)) ? t[o] = i ? [].concat(i, l) : l : l == null && i == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
3503
+ l && i !== l && !($(i) && i.includes(l)) ? t[o] = i ? [].concat(i, l) : l : l == null && i == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
3504
3504
  // the model listener.
3505
3505
  !_s(o) && (t[o] = l);
3506
3506
  } else o !== "" && (t[o] = n[o]);
@@ -3712,7 +3712,7 @@ function wr(e, t, s) {
3712
3712
  try {
3713
3713
  fs(-1);
3714
3714
  const n = arguments.length;
3715
- return n === 2 ? G(t) && !F(t) ? Jt(t) ? re(e, null, [t]) : re(e, t) : re(e, null, t) : (n > 3 ? s = Array.prototype.slice.call(arguments, 2) : n === 3 && Jt(s) && (s = [s]), re(e, t, s));
3715
+ return n === 2 ? G(t) && !$(t) ? Jt(t) ? re(e, null, [t]) : re(e, t) : re(e, null, t) : (n > 3 ? s = Array.prototype.slice.call(arguments, 2) : n === 3 && Jt(s) && (s = [s]), re(e, t, s));
3716
3716
  } finally {
3717
3717
  fs(1);
3718
3718
  }
@@ -3839,7 +3839,7 @@ function Ir(e, t, s) {
3839
3839
  }
3840
3840
  const Kn = /\s*!important$/;
3841
3841
  function ns(e, t, s) {
3842
- if (F(s))
3842
+ if ($(s))
3843
3843
  s.forEach((n) => ns(e, t, n));
3844
3844
  else if (s == null && (s = ""), t.startsWith("--"))
3845
3845
  e.setProperty(t, s);
@@ -3953,7 +3953,7 @@ function jr(e, t) {
3953
3953
  return s.value = e, s.attached = Br(), s;
3954
3954
  }
3955
3955
  function Hr(e, t) {
3956
- if (F(t)) {
3956
+ if ($(t)) {
3957
3957
  const s = e.stopImmediatePropagation;
3958
3958
  return e.stopImmediatePropagation = () => {
3959
3959
  s.call(e), e._stopped = !0;
@@ -5138,7 +5138,7 @@ const Si = /* @__PURE__ */ ft(cu(en({}, {
5138
5138
  o("clear-selected-nodes"), o("update:selectedElements", []);
5139
5139
  },
5140
5140
  showConfirmDialog: x
5141
- }), { highlightVisible: D, highlightStyle: $, tooltipVisible: W, tooltipStyle: $e, tooltipContent: As } = su({
5141
+ }), { highlightVisible: D, highlightStyle: F, tooltipVisible: W, tooltipStyle: $e, tooltipContent: As } = su({
5142
5142
  selectMode: /* @__PURE__ */ te(n, "selectMode"),
5143
5143
  onAddSelectedNode: (L) => {
5144
5144
  o("click-selected-node", L);
@@ -5190,7 +5190,7 @@ const Si = /* @__PURE__ */ ft(cu(en({}, {
5190
5190
  return b;
5191
5191
  }, set dialogResolve(L) {
5192
5192
  b = L;
5193
- }, showConfirmDialog: x, handleDialogConfirm: O, handleDialogCancel: T, localSessionListCollapsed: B, buttonActive: k, containerClasses: I, iframeSource: j, sessionListTitle: A, handleClose: H, handleEmptyAction: ne, handleToggle: oe, handleToggleSessionList: fe, sessionItems: Ae, handleCreateSession: ve, handleDeleteSession: Ie, handleSelectSession: je, bubbleVisible: He, hasSelectedElements: Ve, selectedElementItems: de, handleClearSelectedNodes: ie, handleClickSelectedNode: Y, handleRemoveSelectedNode: K, handleToggleSelectMode: Fe, highlightVisible: D, highlightStyle: $, tooltipVisible: W, tooltipStyle: $e, tooltipContent: As, Frame: nc, Header: fc, SelectHint: pc, SelectedBubbles: Sc, SelectedNodes: Oc, SessionList: jc, Trigger: Kc };
5193
+ }, showConfirmDialog: x, handleDialogConfirm: O, handleDialogCancel: T, localSessionListCollapsed: B, buttonActive: k, containerClasses: I, iframeSource: j, sessionListTitle: A, handleClose: H, handleEmptyAction: ne, handleToggle: oe, handleToggleSessionList: fe, sessionItems: Ae, handleCreateSession: ve, handleDeleteSession: Ie, handleSelectSession: je, bubbleVisible: He, hasSelectedElements: Ve, selectedElementItems: de, handleClearSelectedNodes: ie, handleClickSelectedNode: Y, handleRemoveSelectedNode: K, handleToggleSelectMode: Fe, highlightVisible: D, highlightStyle: F, tooltipVisible: W, tooltipStyle: $e, tooltipContent: As, Frame: nc, Header: fc, SelectHint: pc, SelectedBubbles: Sc, SelectedNodes: Oc, SessionList: jc, Trigger: Kc };
5194
5194
  return Object.defineProperty(Zt, "__isScriptSetup", { enumerable: !1, value: !0 }), Zt;
5195
5195
  }
5196
5196
  })), uu = {
@@ -5444,8 +5444,8 @@ const yu = {
5444
5444
  let A = !T;
5445
5445
  const H = (D) => {
5446
5446
  if (!D) return null;
5447
- const $ = D.match(/\/session\/([^/?]+)/);
5448
- return $ ? $[1] : null;
5447
+ const F = D.match(/\/session\/([^/?]+)/);
5448
+ return F ? F[1] : null;
5449
5449
  };
5450
5450
  l.value = H(O), A && O && (i.value = O);
5451
5451
  try {
@@ -5461,13 +5461,13 @@ const yu = {
5461
5461
  { deep: !0 }
5462
5462
  );
5463
5463
  const ne = (D) => {
5464
- var $, W;
5465
- (W = ($ = d.value) == null ? void 0 : $.showNotification) == null || W.call($, D);
5464
+ var F, W;
5465
+ (W = (F = d.value) == null ? void 0 : F.showNotification) == null || W.call(F, D);
5466
5466
  }, oe = async () => {
5467
5467
  o.value = !0;
5468
5468
  try {
5469
- const $ = await (await fetch("/__opencode_sessions__")).json();
5470
- r.value = $.filter((W) => W.directory === k && W.title !== "__chrome_mcp_warmup__").map((W) => {
5469
+ const F = await (await fetch("/__opencode_sessions__")).json();
5470
+ r.value = F.filter((W) => W.directory === k && W.title !== "__chrome_mcp_warmup__").map((W) => {
5471
5471
  var $e;
5472
5472
  return {
5473
5473
  ...W,
@@ -5481,8 +5481,12 @@ const yu = {
5481
5481
  }
5482
5482
  }, fe = async () => {
5483
5483
  try {
5484
- const $ = await (await fetch("/__opencode_sessions__", { method: "POST" })).json();
5485
- await oe(), l.value = $.id, i.value = `${a}/${Ks(k)}/session/${$.id}`;
5484
+ const F = await (await fetch("/__opencode_sessions__", { method: "POST" })).json();
5485
+ r.value.unshift({
5486
+ id: F.id,
5487
+ title: "新会话",
5488
+ updatedAt: Date.now()
5489
+ }), l.value = F.id, i.value = `${a}/${Ks(k)}/session/${F.id}`, oe();
5486
5490
  } catch {
5487
5491
  ne("创建会话失败");
5488
5492
  }
@@ -5490,8 +5494,8 @@ const yu = {
5490
5494
  try {
5491
5495
  if (await fetch(`/__opencode_sessions__?id=${D.id}`, { method: "DELETE" }), await oe(), ne("会话已删除"), l.value === D.id)
5492
5496
  if (r.value.length > 0) {
5493
- const $ = r.value[0];
5494
- l.value = $.id, i.value = `${a}/${Ks(k)}/session/${$.id}`;
5497
+ const F = r.value[0];
5498
+ l.value = F.id, i.value = `${a}/${Ks(k)}/session/${F.id}`;
5495
5499
  } else
5496
5500
  l.value = null, i.value = "";
5497
5501
  } catch {
@@ -5506,8 +5510,8 @@ const yu = {
5506
5510
  const je = () => {
5507
5511
  !A || Ie || (Ie = new EventSource("/__opencode_events__"), Ie.onmessage = (D) => {
5508
5512
  try {
5509
- const $ = JSON.parse(D.data);
5510
- $.type === "CONNECTED" ? de(!0) : $.type === "SESSION_READY" ? ($.sessionUrl && !i.value && (i.value = $.sessionUrl, l.value = H($.sessionUrl)), I.value = !1) : $.type === "CLEAR_ELEMENTS" && (c.value = []);
5513
+ const F = JSON.parse(D.data);
5514
+ F.type === "CONNECTED" ? de(!0) : F.type === "SESSION_READY" ? (F.sessionUrl && !i.value && (i.value = F.sessionUrl, l.value = H(F.sessionUrl)), I.value = !1) : F.type === "CLEAR_ELEMENTS" && (c.value = []);
5511
5515
  } catch {
5512
5516
  }
5513
5517
  });
@@ -5515,12 +5519,12 @@ const yu = {
5515
5519
  let He = "", Ve = "";
5516
5520
  const de = (D = !1) => {
5517
5521
  if (!A) return;
5518
- const $ = window.location.href, W = document.title;
5519
- (D || $ !== He || W !== Ve) && (He = $, Ve = W, fetch("/__opencode_context__", {
5522
+ const F = window.location.href, W = document.title;
5523
+ (D || F !== He || W !== Ve) && (He = F, Ve = W, fetch("/__opencode_context__", {
5520
5524
  method: "POST",
5521
5525
  headers: { "Content-Type": "application/json" },
5522
5526
  body: JSON.stringify({
5523
- url: $,
5527
+ url: F,
5524
5528
  title: W,
5525
5529
  selectedElements: c.value
5526
5530
  })
@@ -5529,9 +5533,9 @@ const yu = {
5529
5533
  }, ie = async () => {
5530
5534
  if (A) return !0;
5531
5535
  try {
5532
- const $ = await (await fetch("/__opencode_start__")).json();
5533
- if ($.success)
5534
- return A = !0, $.sessionUrl && (i.value = $.sessionUrl, l.value = H($.sessionUrl), I.value = !1), je(), !0;
5536
+ const F = await (await fetch("/__opencode_start__")).json();
5537
+ if (F.success)
5538
+ return A = !0, F.sessionUrl && (i.value = F.sessionUrl, l.value = H(F.sessionUrl), I.value = !1), je(), !0;
5535
5539
  } catch {
5536
5540
  }
5537
5541
  return !1;
@@ -5540,11 +5544,11 @@ const yu = {
5540
5544
  A && (oe(), je(), de(!0)), x && A && setTimeout(() => {
5541
5545
  e.value = !0;
5542
5546
  }, 1e3);
5543
- const D = history.pushState, $ = history.replaceState;
5547
+ const D = history.pushState, F = history.replaceState;
5544
5548
  history.pushState = function(...$e) {
5545
5549
  D.apply(this, $e), setTimeout(de, 0);
5546
5550
  }, history.replaceState = function(...$e) {
5547
- $.apply(this, $e), setTimeout(de, 0);
5551
+ F.apply(this, $e), setTimeout(de, 0);
5548
5552
  }, window.addEventListener("popstate", () => setTimeout(de, 0)), window.addEventListener("hashchange", () => setTimeout(de, 0));
5549
5553
  const W = new MutationObserver(() => {
5550
5554
  document.title !== Ve && de();
@@ -5554,8 +5558,8 @@ const yu = {
5554
5558
  const Y = async (D) => {
5555
5559
  if (T && !A && D) {
5556
5560
  n.value = !0;
5557
- const $ = await ie();
5558
- if (n.value = !1, !$) {
5561
+ const F = await ie();
5562
+ if (n.value = !1, !F) {
5559
5563
  ne("服务启动失败");
5560
5564
  return;
5561
5565
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-opencode-assistant",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Embed OpenCode Web UI in your Vite dev server for real-time code modification and preview",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -36,9 +36,9 @@
36
36
  "license": "MIT",
37
37
  "dependencies": {
38
38
  "unplugin-vue-inspector": "^2.4.0",
39
- "@vite-plugin-opencode-assistant/opencode": "1.0.9",
40
- "@vite-plugin-opencode-assistant/components": "1.0.9",
41
- "@vite-plugin-opencode-assistant/shared": "1.0.9"
39
+ "@vite-plugin-opencode-assistant/components": "1.0.11",
40
+ "@vite-plugin-opencode-assistant/opencode": "1.0.11",
41
+ "@vite-plugin-opencode-assistant/shared": "1.0.11"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "vite": ">=4.0.0"