feat: 重构 WebSocket Keep-Alive 客户端,添加连接和消息处理功能,更新依赖版本,增加 keep.ts 文件

This commit is contained in:
2026-01-30 21:16:06 +08:00
parent 1d4a27d1b2
commit d7a4bcf58f
6 changed files with 270 additions and 37 deletions

View File

@@ -1,19 +1,23 @@
import { resolvePath } from '@kevisual/use-config';
import { execSync } from 'node:child_process';
const entry = 'agent/opencode.ts';
const naming = 'opencode';
const external: string[] = ["bun"];
await Bun.build({
target: 'node',
format: 'esm',
entrypoints: [resolvePath(entry, { meta: import.meta })],
outdir: resolvePath('./dist', { meta: import.meta }),
naming: {
entry: `${naming}.js`,
},
external,
});
const buildFn = async (opts: { entry?: string, naming?: string }) => {
const entry = opts.entry || 'agent/opencode.ts';
const naming = opts.naming || 'opencode';
const external: string[] = ["bun"];
await Bun.build({
target: 'node',
format: 'esm',
entrypoints: [resolvePath(entry, { meta: import.meta })],
outdir: resolvePath('./dist', { meta: import.meta }),
naming: {
entry: `${naming}.js`,
},
external,
});
const cmd = `dts -i ${entry} -o ${naming}.d.ts`;
execSync(cmd);
};
const cmd = 'dts -i agent/opencode.ts -o opencode.d.ts';
execSync(cmd);
await buildFn({ naming: 'opencode', entry: 'agent/opencode.ts' });
await buildFn({ naming: 'keep', entry: 'src/keep.ts' });