refactor(server): canonicalize service API (#31049)

This commit is contained in:
Dax 2026-06-06 23:27:28 -04:00 committed by GitHub
commit fe0c4f8c74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
388 changed files with 7075 additions and 4064 deletions

View file

@ -0,0 +1,38 @@
const logo = {
left: [" ", "█▀▀█ █▀▀█ █▀▀█ █▀▀▄", "█__█ █__█ █^^^ █__█", "▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀~~▀"],
right: [" ▄ ", "█▀▀▀ █▀▀█ █▀▀█ █▀▀█", "█___ █__█ █__█ █^^^", "▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"],
}
const reset = "\x1b[0m"
const bold = "\x1b[1m"
const dim = "\x1b[90m"
function wordmark(pad = "") {
const draw = (line: string, fg: string, shadow: string, bg: string) =>
[...line]
.map((char) => {
if (char === "_") return `${bg} ${reset}`
if (char === "^") return `${fg}${bg}${reset}`
if (char === "~") return `${shadow}${reset}`
if (char === " ") return " "
return `${fg}${char}${reset}`
})
.join("")
return logo.left.map((line, index) => {
const left = draw(line, dim, "\x1b[38;5;235m", "\x1b[48;5;235m")
const right = draw(logo.right[index] ?? "", reset, "\x1b[38;5;238m", "\x1b[48;5;238m")
return `${pad}${left} ${right}`
})
}
export function sessionExitSummary(input: { title: string; sessionID?: string }) {
const weak = (text: string) => `${dim}${text.padEnd(10, " ")}${reset}`
return [
...wordmark(" "),
"",
` ${weak("Session")}${bold}${input.title}${reset}`,
` ${weak("Continue")}${bold}opencode -s ${input.sessionID}${reset}`,
"",
].join("\n")
}