vite-plugin-opencode-assistant 1.0.90 → 1.0.92
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.
- package/es/endpoints/context.mjs +5 -2
- package/lib/client.js +2079 -2060
- package/lib/endpoints/context.cjs +5 -2
- package/package.json +5 -5
package/es/endpoints/context.mjs
CHANGED
|
@@ -67,18 +67,21 @@ function setupContextEndpoint(server, ctx) {
|
|
|
67
67
|
let body = "";
|
|
68
68
|
req.on("data", (chunk) => body += chunk);
|
|
69
69
|
req.on("end", () => {
|
|
70
|
-
var _a;
|
|
70
|
+
var _a, _b, _c;
|
|
71
71
|
try {
|
|
72
72
|
const data = JSON.parse(body);
|
|
73
73
|
ctx.pageContext = {
|
|
74
74
|
url: data.url || "",
|
|
75
75
|
title: data.title || "",
|
|
76
|
+
// 保留已有的 tabId/tabIndex(避免页内 widget 覆盖 Side Panel 写入的值)
|
|
77
|
+
tabId: (_a = data.tabId) != null ? _a : ctx.pageContext.tabId,
|
|
78
|
+
tabIndex: (_b = data.tabIndex) != null ? _b : ctx.pageContext.tabIndex,
|
|
76
79
|
selectedElements: data.selectedElements || []
|
|
77
80
|
};
|
|
78
81
|
log.debug("Context updated", {
|
|
79
82
|
url: ctx.pageContext.url,
|
|
80
83
|
title: ctx.pageContext.title,
|
|
81
|
-
selectedElementsCount: ((
|
|
84
|
+
selectedElementsCount: ((_c = ctx.pageContext.selectedElements) == null ? void 0 : _c.length) || 0
|
|
82
85
|
});
|
|
83
86
|
if (ctx.pageContext.selectedElements && ctx.pageContext.selectedElements.length > 0) {
|
|
84
87
|
log.debug("Selected elements details", {
|