tavern-harness 0.1.3 → 0.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/vite.config.ts +11 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tavern-harness",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Tavern Harness — 酒馆模式下的本地 AI Agent 助手(MyAgent-Android 的 Web 复刻)",
5
5
  "private": false,
6
6
  "type": "module",
package/vite.config.ts CHANGED
@@ -6,9 +6,12 @@ import net from 'node:net';
6
6
  import { randomBytes } from 'node:crypto';
7
7
  import { spawn, type ChildProcess } from 'node:child_process';
8
8
  import { readFileSync, existsSync } from 'node:fs';
9
- import { join } from 'node:path';
9
+ import { dirname, join } from 'node:path';
10
+ import { fileURLToPath } from 'node:url';
10
11
  import type { IncomingMessage, ServerResponse } from 'node:http';
11
12
 
13
+ const projectRoot = dirname(fileURLToPath(import.meta.url));
14
+
12
15
  /**
13
16
  * CORS 转发中间件:为本地(无 CORS 头)的 OpenAI 兼容服务提供同源代理。
14
17
  * Base URL 填 http://localhost:5173/api/192.168.50.175:8788/ 即可;
@@ -71,8 +74,8 @@ function sandboxProxyPlugin(): Plugin {
71
74
  let childPort: number | null = null;
72
75
  const serviceToken = randomBytes(32).toString('base64url');
73
76
  const approvalToken = randomBytes(32).toString('base64url');
74
- const lockPath = join(process.cwd(), '.sandbox-port');
75
- const SANDBOX_SCRIPT = join(process.cwd(), 'sandbox-server.mjs');
77
+ const lockPath = join(projectRoot, '.sandbox-port');
78
+ const SANDBOX_SCRIPT = join(projectRoot, 'sandbox-server.mjs');
76
79
  const DEFAULT_PORT = 17891;
77
80
 
78
81
  const loadPort = () => {
@@ -160,7 +163,7 @@ function sandboxProxyPlugin(): Plugin {
160
163
  if (availablePort == null) return null;
161
164
  childPort = availablePort;
162
165
  const child = spawn(process.execPath, [SANDBOX_SCRIPT, String(availablePort)], {
163
- cwd: process.cwd(),
166
+ cwd: projectRoot,
164
167
  stdio: 'ignore',
165
168
  windowsHide: true,
166
169
  env: {
@@ -263,6 +266,7 @@ function sandboxProxyPlugin(): Plugin {
263
266
  export default defineConfig({
264
267
  plugins: [react(), corsProxyPlugin(), sandboxProxyPlugin()],
265
268
  optimizeDeps: {
269
+ force: true,
266
270
  include: [
267
271
  '@dnd-kit/core',
268
272
  '@dnd-kit/sortable',
@@ -272,7 +276,10 @@ export default defineConfig({
272
276
  'katex',
273
277
  'marked',
274
278
  'react',
279
+ 'react/jsx-runtime',
280
+ 'react/jsx-dev-runtime',
275
281
  'react-dom',
282
+ 'react-dom/client',
276
283
  'use-sync-external-store/shim/with-selector',
277
284
  'zustand',
278
285
  ],