- 品牌替换:OpenCode/opencode → AirCoding/aircoding(16+ 文件) - Logo ASCII art:修复 left/right 行数不匹配导致的启动崩溃 - 启动诊断:添加 OPENCODE_PRINT_TIMING 计时探针 - dev 模式默认 --pure 跳过外部插件加载 - AGENTS.md 模板:追加 AirCoding 多 Agent 专项段落 - architect prompt + plugin:强化 AGENTS.md 产出验证
18 lines
804 B
TypeScript
18 lines
804 B
TypeScript
/**
|
|
* Helpers for building deterministic SSE bodies in tests.
|
|
*
|
|
* Inline template-literal SSE strings are hard to write and review when chunks
|
|
* contain JSON; this helper accepts plain values and serializes them, so test
|
|
* authors only think about the chunk shapes, not the wire format.
|
|
*/
|
|
export const sseEvents = (...chunks: ReadonlyArray<unknown>): string =>
|
|
`${chunks.map(formatChunk).join("")}data: [DONE]\n\n`
|
|
|
|
const formatChunk = (chunk: unknown) => `data: ${typeof chunk === "string" ? chunk : JSON.stringify(chunk)}\n\n`
|
|
|
|
/**
|
|
* Build an SSE body from already-serialized strings (used when the chunk shape
|
|
* itself is part of what's being tested, e.g. malformed chunks).
|
|
*/
|
|
export const sseRaw = (...lines: ReadonlyArray<string>): string => lines.map((line) => `${line}\n\n`).join("")
|