vite-plugin-opencode-assistant 1.0.93 → 1.1.1

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/core/api.mjs CHANGED
@@ -40,8 +40,6 @@ var __async = (__this, __arguments, generator) => {
40
40
  };
41
41
  import http from "http";
42
42
  import {
43
- PerformanceTimer,
44
- createLogger,
45
43
  DEFAULT_RETRIES,
46
44
  RETRY_DELAY,
47
45
  ChromeMcpWarmupErrorType,
@@ -51,6 +49,7 @@ import {
51
49
  base64Encode,
52
50
  extractTextFromResponse
53
51
  } from "@vite-plugin-opencode-assistant/shared";
52
+ import { PerformanceTimer, createLogger } from "@vite-plugin-opencode-assistant/shared/node";
54
53
  import { checkChromeDevToolsAvailable } from "@vite-plugin-opencode-assistant/shared/node";
55
54
  const log = createLogger("API");
56
55
  class OpenCodeAPI {
@@ -21,7 +21,7 @@ import { execa } from "execa";
21
21
  import fs from "fs";
22
22
  import { createRequire } from "module";
23
23
  import path from "path";
24
- import { createLogger, getProcessLogBuffer } from "@vite-plugin-opencode-assistant/shared";
24
+ import { createLogger, getProcessLogBuffer } from "@vite-plugin-opencode-assistant/shared/node";
25
25
  const require2 = createRequire(path.join(process.cwd(), "package.json"));
26
26
  const packageDir = resolvePackageDir();
27
27
  const log = createLogger("OpenCodeWeb");
@@ -115,6 +115,7 @@ function startOpenCodeWeb(options) {
115
115
  (_b = proc.stderr) == null ? void 0 : _b.on("data", (data) => {
116
116
  const output = data.toString().trim();
117
117
  if (output) {
118
+ if (output.includes("MaxListenersExceededWarning")) return;
118
119
  log.warn("[OpenCode stderr]", { output });
119
120
  getProcessLogBuffer().addOpenCodeStderr(output);
120
121
  }
@@ -261,7 +261,11 @@ function generateBridgeScript(options) {
261
261
  flex-direction: column !important;
262
262
  z-index: 600 !important;
263
263
  border-radius: 12px !important;
264
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
264
+ box-shadow:
265
+ 0 0 0 1px rgba(0, 0, 0, 0.04),
266
+ 0 2px 4px rgba(0, 0, 0, 0.04),
267
+ 0 8px 16px rgba(0, 0, 0, 0.08),
268
+ 0 16px 40px rgba(0, 0, 0, 0.12) !important;
265
269
  overflow: hidden !important;
266
270
  transition: none;
267
271
  }
@@ -269,6 +273,11 @@ function generateBridgeScript(options) {
269
273
  max-width: none !important;
270
274
  }
271
275
 
276
+ /* \u4F1A\u8BDD\u6D6E\u7A97\u5185\u5C42\u80CC\u666F\u62AC\u9AD8\uFF0C\u4E0E\u5BA1\u67E5\u9762\u677F\u5E95\u8272\u5F62\u6210\u5C42\u6B21 */
277
+ .opencode-review-panel-overlay [data-ref="session-panel"] [class*="bg-v2-background-bg-base"] {
278
+ background: color-mix(in srgb, var(--v2-background-bg-base, #1e1e1e) 96%, #fff) !important;
279
+ }
280
+
272
281
  /* \u9690\u85CF\u4F1A\u8BDD\u9762\u677F\u5185\u7684\u6807\u9898 */
273
282
  .opencode-review-panel-overlay [data-ref="session-panel"] [data-session-title] {
274
283
  display: none !important;
@@ -390,10 +399,21 @@ function generateBridgeScript(options) {
390
399
  btn.className = 'opencode-chat-toggle-btn';
391
400
  btn.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>';
392
401
  btn.title = '\u5C55\u5F00\u804A\u5929\u9762\u677F';
402
+ // \u4ECE localStorage \u6062\u590D\u4E0A\u6B21\u7684\u5C55\u5F00/\u6536\u8D77\u72B6\u6001\uFF0C\u9ED8\u8BA4\u6536\u8D77
403
+ var chatVisible = localStorage.getItem('opencode-review-chat-visible');
404
+ if (chatVisible === 'true') {
405
+ document.documentElement.classList.remove('hide-chat');
406
+ btn.classList.add('active');
407
+ btn.title = '\u9690\u85CF\u804A\u5929\u9762\u677F';
408
+ } else {
409
+ document.documentElement.classList.add('hide-chat');
410
+ }
393
411
  btn.onclick = function() {
394
412
  document.documentElement.classList.toggle('hide-chat');
395
413
  btn.classList.toggle('active');
396
- btn.title = btn.classList.contains('active') ? '\u9690\u85CF\u804A\u5929\u9762\u677F' : '\u5C55\u5F00\u804A\u5929\u9762\u677F';
414
+ var isVisible = btn.classList.contains('active');
415
+ btn.title = isVisible ? '\u9690\u85CF\u804A\u5929\u9762\u677F' : '\u5C55\u5F00\u804A\u5929\u9762\u677F';
416
+ localStorage.setItem('opencode-review-chat-visible', isVisible ? 'true' : 'false');
397
417
  };
398
418
  document.body.appendChild(btn);
399
419
  }
@@ -419,7 +439,7 @@ function generateBridgeScript(options) {
419
439
  var attempts = 0;
420
440
  function tryApply() {
421
441
  if (ensureReviewPanelRefs()) {
422
- document.documentElement.classList.add('opencode-review-panel-overlay', 'hide-chat');
442
+ document.documentElement.classList.add('opencode-review-panel-overlay');
423
443
  injectChatToggleBtn();
424
444
  return;
425
445
  }
@@ -487,7 +507,7 @@ function generateBridgeScript(options) {
487
507
  function insertFilePart(element) {
488
508
  const promptInput = document.querySelector('[data-component="prompt-input"]');
489
509
  if (!promptInput) {
490
- console.warn('[OpenCode Bridge] Prompt input not found');
510
+ log.warn('Prompt input not found');
491
511
  return;
492
512
  }
493
513
 
@@ -39,10 +39,10 @@ import { prepareOpenCodeRuntime, startOpenCodeWeb } from "./opencode-web.mjs";
39
39
  import {
40
40
  DEFAULT_PROXY_PORT,
41
41
  SERVER_START_TIMEOUT,
42
- createLogger,
43
42
  ChromeMcpWarmupError,
44
43
  ChromeMcpWarmupErrorType
45
44
  } from "@vite-plugin-opencode-assistant/shared";
45
+ import { createLogger } from "@vite-plugin-opencode-assistant/shared/node";
46
46
  import {
47
47
  checkOpenCodeInstalled,
48
48
  findAvailablePort,
@@ -19,7 +19,7 @@ var __async = (__this, __arguments, generator) => {
19
19
  });
20
20
  };
21
21
  import { CONTEXT_API_PATH } from "@vite-plugin-opencode-assistant/shared";
22
- import { RequestContext, createLogger } from "@vite-plugin-opencode-assistant/shared";
22
+ import { RequestContext, createLogger } from "@vite-plugin-opencode-assistant/shared/node";
23
23
  const log = createLogger("Endpoints:Context");
24
24
  function setupContextEndpoint(server, ctx) {
25
25
  server.middlewares.use(CONTEXT_API_PATH, (req, res) => __async(null, null, function* () {
@@ -18,12 +18,12 @@ var __async = (__this, __arguments, generator) => {
18
18
  step((generator = generator.apply(__this, __arguments)).next());
19
19
  });
20
20
  };
21
- import { getProcessLogBuffer } from "@vite-plugin-opencode-assistant/shared";
21
+ import { getProcessLogBuffer } from "@vite-plugin-opencode-assistant/shared/node";
22
22
  import {
23
23
  RequestContext,
24
- createLogger,
25
- LOGS_API_PATH
26
- } from "@vite-plugin-opencode-assistant/shared";
24
+ createLogger
25
+ } from "@vite-plugin-opencode-assistant/shared/node";
26
+ import { LOGS_API_PATH } from "@vite-plugin-opencode-assistant/shared";
27
27
  const log = createLogger("Endpoints:Logs");
28
28
  function setupLogsEndpoint(server) {
29
29
  server.middlewares.use(LOGS_API_PATH, (req, res) => __async(null, null, function* () {
@@ -19,7 +19,7 @@ var __async = (__this, __arguments, generator) => {
19
19
  });
20
20
  };
21
21
  import { SESSIONS_API_PATH } from "@vite-plugin-opencode-assistant/shared";
22
- import { RequestContext, createLogger } from "@vite-plugin-opencode-assistant/shared";
22
+ import { RequestContext, createLogger } from "@vite-plugin-opencode-assistant/shared/node";
23
23
  const log = createLogger("Endpoints:Sessions");
24
24
  function setupSessionsEndpoint(server, ctx) {
25
25
  server.middlewares.use(SESSIONS_API_PATH, (req, res) => __async(null, null, function* () {
@@ -19,7 +19,7 @@ var __async = (__this, __arguments, generator) => {
19
19
  });
20
20
  };
21
21
  import { SSE_EVENTS_PATH } from "@vite-plugin-opencode-assistant/shared";
22
- import { RequestContext, createLogger } from "@vite-plugin-opencode-assistant/shared";
22
+ import { RequestContext, createLogger } from "@vite-plugin-opencode-assistant/shared/node";
23
23
  const log = createLogger("Endpoints:SSE");
24
24
  function setupSseEndpoint(server, ctx) {
25
25
  server.middlewares.use(SSE_EVENTS_PATH, (req, res) => __async(null, null, function* () {
@@ -19,7 +19,7 @@ var __async = (__this, __arguments, generator) => {
19
19
  });
20
20
  };
21
21
  import { START_API_PATH } from "@vite-plugin-opencode-assistant/shared";
22
- import { RequestContext } from "@vite-plugin-opencode-assistant/shared";
22
+ import { RequestContext } from "@vite-plugin-opencode-assistant/shared/node";
23
23
  function setupStartEndpoint(server, ctx) {
24
24
  server.middlewares.use(START_API_PATH, (_req, res) => __async(null, null, function* () {
25
25
  const reqCtx = new RequestContext("GET", START_API_PATH);
@@ -20,7 +20,8 @@ var __async = (__this, __arguments, generator) => {
20
20
  });
21
21
  };
22
22
  var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
23
- import { createLogger, WARMUP_API_PATH } from "@vite-plugin-opencode-assistant/shared";
23
+ import { createLogger } from "@vite-plugin-opencode-assistant/shared/node";
24
+ import { WARMUP_API_PATH } from "@vite-plugin-opencode-assistant/shared";
24
25
  const log = createLogger("Endpoints:Warmup");
25
26
  function setupWarmupEndpoint(server, ctx) {
26
27
  server.middlewares.use(WARMUP_API_PATH, (req, res) => __async(null, null, function* () {
@@ -20,7 +20,7 @@ var __async = (__this, __arguments, generator) => {
20
20
  };
21
21
  import fs from "fs";
22
22
  import { WIDGET_SCRIPT_PATH, WIDGET_STYLE_PATH } from "@vite-plugin-opencode-assistant/shared";
23
- import { RequestContext } from "@vite-plugin-opencode-assistant/shared";
23
+ import { RequestContext } from "@vite-plugin-opencode-assistant/shared/node";
24
24
  function setupWidgetEndpoints(server, ctx) {
25
25
  server.middlewares.use(WIDGET_SCRIPT_PATH, (_req, res) => __async(null, null, function* () {
26
26
  const reqCtx = new RequestContext("GET", WIDGET_SCRIPT_PATH);
package/es/index.mjs CHANGED
@@ -40,10 +40,9 @@ import {
40
40
  CONTEXT_API_PATH,
41
41
  DEFAULT_CONFIG,
42
42
  DEFAULT_PROXY_PORT,
43
- createLogger,
44
- setVerbose,
45
- initProcessLogCapture
43
+ setVerbose
46
44
  } from "@vite-plugin-opencode-assistant/shared";
45
+ import { createLogger, initProcessLogCapture } from "@vite-plugin-opencode-assistant/shared/node";
47
46
  import { setupMiddlewares, LOGS_API_PATH } from "./endpoints/index.mjs";
48
47
  import { injectWidget } from "./core/injector.mjs";
49
48
  import { OpenCodeAPI } from "./core/api.mjs";
@@ -24,7 +24,7 @@ import http from "http";
24
24
  import net from "net";
25
25
  import path from "path";
26
26
  import { MAX_PORT_TRIES, SERVER_CHECK_INTERVAL } from "@vite-plugin-opencode-assistant/shared";
27
- import { PerformanceTimer, createLogger } from "@vite-plugin-opencode-assistant/shared";
27
+ import { PerformanceTimer, createLogger } from "@vite-plugin-opencode-assistant/shared/node";
28
28
  const log = createLogger("Utils");
29
29
  function waitForServer(url, timeout = 1e4, process2) {
30
30
  const timer = new PerformanceTimer("waitForServer", { url, timeout });