diff --git a/packages/gpt-runner-cli/src/cli-start.ts b/packages/gpt-runner-cli/src/cli-start.ts index 93635b09..b9a0b595 100644 --- a/packages/gpt-runner-cli/src/cli-start.ts +++ b/packages/gpt-runner-cli/src/cli-start.ts @@ -56,17 +56,19 @@ export async function startCli(cwd = PathUtils.resolve(process.cwd()), argv = pr autoFreePort: true, }) - const startServerProcessPromise = execa('node', [startServerJsPath, '--port', String(finalPort)], { - env: { - ...process.env, - ...getRunServerEnv(), - GPTR_ONLY_LOAD_CONFIG_PATH: options.config || '', - }, - }) - - startServerProcessPromise.on('error', (error) => { + try { + await execa('node', [startServerJsPath, '--port', String(finalPort)], { + env: { + ...process.env, + ...getRunServerEnv(), + GPTR_ONLY_LOAD_CONFIG_PATH: options.config || '', + }, + stdio: 'inherit', + })?.pipeStdout?.(process.stdout)?.pipeStderr?.(process.stderr) + } + catch (error) { consola.error(error) - }) + } const afterServerStartSuccess = async () => { const getUrl = (isLocalIp = false) => { @@ -101,12 +103,17 @@ export async function startCli(cwd = PathUtils.resolve(process.cwd()), argv = pr } } - waitPort({ - port: finalPort, - output: 'silent', - }).then(afterServerStartSuccess).catch(consola.error) + try { + await waitPort({ + port: finalPort, + output: 'silent', + }) - await startServerProcessPromise + afterServerStartSuccess() + } + catch (error) { + consola.error(error) + } }) cli.help() diff --git a/packages/gpt-runner-shared/package.json b/packages/gpt-runner-shared/package.json index 12920c0e..c7f513f4 100644 --- a/packages/gpt-runner-shared/package.json +++ b/packages/gpt-runner-shared/package.json @@ -111,8 +111,8 @@ "socket.io": "^4.7.2", "socket.io-client": "^4.7.2", "undici": "^5.23.0", - "web-streams-polyfill": "^3.2.1", - "zod": "^3.21.4", + "web-streams-polyfill": "^4.0.0-beta.3", + "zod": "^3.22.0", "zod-to-json-schema": "^3.21.4" }, "devDependencies": { diff --git a/packages/gpt-runner-shared/src/node/helpers/polyfill.ts b/packages/gpt-runner-shared/src/node/helpers/polyfill.ts index b4d81d32..2fd5b94f 100644 --- a/packages/gpt-runner-shared/src/node/helpers/polyfill.ts +++ b/packages/gpt-runner-shared/src/node/helpers/polyfill.ts @@ -1,5 +1,5 @@ import { Headers, Request, Response, fetch } from 'undici' -import { ReadableStream } from 'web-streams-polyfill' +import 'web-streams-polyfill/polyfill' import { canUseNodeFetchWithoutCliFlag } from './check-node-version' export function addNodejsPolyfill() { @@ -10,6 +10,5 @@ export function addNodejsPolyfill() { globalThis.Headers = Headers as any globalThis.Request = Request as any globalThis.Response = Response as any - globalThis.ReadableStream = ReadableStream as any } } diff --git a/packages/gpt-runner-web/package.json b/packages/gpt-runner-web/package.json index 2227bb81..0809fe74 100644 --- a/packages/gpt-runner-web/package.json +++ b/packages/gpt-runner-web/package.json @@ -101,7 +101,7 @@ "cross-env": "^7.0.3", "eventemitter": "^0.3.3", "express": "^4.18.2", - "framer-motion": "^10.15.1", + "framer-motion": "^10.15.2", "fs-extra": "^11.1.1", "global-agent": "^3.0.0", "i18next": "^23.4.4", @@ -130,7 +130,7 @@ "vite": "^4.4.9", "vite-plugin-monaco-editor": "^1.1.0", "vite-plugin-svgr": "^3.2.0", - "web-streams-polyfill": "^3.2.1", + "web-streams-polyfill": "^4.0.0-beta.3", "zustand": "^4.4.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89662088..ae2d8fcf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -235,14 +235,14 @@ importers: specifier: ^5.23.0 version: 5.23.0 web-streams-polyfill: - specifier: ^3.2.1 - version: 3.2.1 + specifier: ^4.0.0-beta.3 + version: 4.0.0-beta.3 zod: - specifier: ^3.21.4 - version: 3.21.4 + specifier: ^3.22.0 + version: 3.22.0 zod-to-json-schema: specifier: ^3.21.4 - version: 3.21.4(zod@3.21.4) + version: 3.21.4(zod@3.22.0) devDependencies: '@types/express': specifier: ^4.17.17 @@ -377,8 +377,8 @@ importers: specifier: ^4.18.2 version: 4.18.2 framer-motion: - specifier: ^10.15.1 - version: 10.15.1(react-dom@18.2.0)(react@18.2.0) + specifier: ^10.15.2 + version: 10.15.2(react-dom@18.2.0)(react@18.2.0) fs-extra: specifier: ^11.1.1 version: 11.1.1 @@ -464,8 +464,8 @@ importers: specifier: ^3.2.0 version: 3.2.0(rollup@3.28.0)(vite@4.4.9) web-streams-polyfill: - specifier: ^3.2.1 - version: 3.2.1 + specifier: ^4.0.0-beta.3 + version: 4.0.0-beta.3 zustand: specifier: ^4.4.1 version: 4.4.1(@types/react@18.2.20)(react@18.2.0) @@ -12321,8 +12321,8 @@ packages: resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==} dev: false - /framer-motion@10.15.1(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-6avJj/Uftblw0fMmo6jDHkKRH4TBdkMX/FiyR3G/hFe3hQHE4BUNJCqlMPKg9EzfI5jyqDOwO5oDnU+bW5y0eg==} + /framer-motion@10.15.2(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-z14GYH4WQXnuTgggwf0qyX0vo98PDE+dw21F7aLzUqEcrsmfLovy4jPiA82Cp/X0juWuEHte7rJGOjds9GAQFA==} peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 @@ -20452,10 +20452,6 @@ packages: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} dev: false - /web-streams-polyfill@3.2.1: - resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} - engines: {node: '>= 8'} - /web-streams-polyfill@4.0.0-beta.3: resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==} engines: {node: '>= 14'} @@ -21132,10 +21128,22 @@ packages: zod: 3.21.4 dev: false + /zod-to-json-schema@3.21.4(zod@3.22.0): + resolution: {integrity: sha512-fjUZh4nQ1s6HMccgIeE0VP4QG/YRGPmyjO9sAh890aQKPEk3nqbfUXhMFaC+Dr5KvYBm8BCyvfpZf2jY9aGSsw==} + peerDependencies: + zod: ^3.21.4 + dependencies: + zod: 3.22.0 + dev: false + /zod@3.21.4: resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==} dev: false + /zod@3.22.0: + resolution: {integrity: sha512-y5KZY/ssf5n7hCGDGGtcJO/EBJEm5Pa+QQvFBeyMOtnFYOSflalxIFFvdaYevPhePcmcKC4aTbFkCcXN7D0O8Q==} + dev: false + /zustand@4.4.1(@types/react@18.2.20)(react@18.2.0): resolution: {integrity: sha512-QCPfstAS4EBiTQzlaGP1gmorkh/UL1Leaj2tdj+zZCZ/9bm0WS7sI2wnfD5lpOszFqWJ1DcPnGoY8RDL61uokw==} engines: {node: '>=12.7.0'}