mirror of
https://fastgit.cc/https://github.com/anomalyco/opencode
synced 2026-04-20 21:00:29 +08:00
feat: enable type-aware no-floating-promises rule, fix all 177 violations (#22741)
This commit is contained in:
@@ -30,7 +30,13 @@
|
|||||||
// postMessage target origin not relevant for this codebase
|
// postMessage target origin not relevant for this codebase
|
||||||
"unicorn/require-post-message-target-origin": "off",
|
"unicorn/require-post-message-target-origin": "off",
|
||||||
// Side-effectful constructors are intentional in some places
|
// Side-effectful constructors are intentional in some places
|
||||||
"no-new": "off"
|
"no-new": "off",
|
||||||
|
|
||||||
|
// Type-aware: catch unhandled promises
|
||||||
|
"typescript/no-floating-promises": "warn"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"typeAware": true
|
||||||
},
|
},
|
||||||
"ignorePatterns": ["**/node_modules", "**/dist", "**/.build", "**/.sst", "**/*.d.ts"]
|
"ignorePatterns": ["**/node_modules", "**/dist", "**/.build", "**/.sst", "**/*.d.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
15
bun.lock
15
bun.lock
@@ -20,6 +20,7 @@
|
|||||||
"glob": "13.0.5",
|
"glob": "13.0.5",
|
||||||
"husky": "9.1.7",
|
"husky": "9.1.7",
|
||||||
"oxlint": "1.60.0",
|
"oxlint": "1.60.0",
|
||||||
|
"oxlint-tsgolint": "0.21.0",
|
||||||
"prettier": "3.6.2",
|
"prettier": "3.6.2",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
"sst": "3.18.10",
|
"sst": "3.18.10",
|
||||||
@@ -1680,6 +1681,18 @@
|
|||||||
|
|
||||||
"@oxc-transform/binding-win32-x64-msvc": ["@oxc-transform/binding-win32-x64-msvc@0.96.0", "", { "os": "win32", "cpu": "x64" }, "sha512-0fI0P0W7bSO/GCP/N5dkmtB9vBqCA4ggo1WmXTnxNJVmFFOtcA1vYm1I9jl8fxo+sucW2WnlpnI4fjKdo3JKxA=="],
|
"@oxc-transform/binding-win32-x64-msvc": ["@oxc-transform/binding-win32-x64-msvc@0.96.0", "", { "os": "win32", "cpu": "x64" }, "sha512-0fI0P0W7bSO/GCP/N5dkmtB9vBqCA4ggo1WmXTnxNJVmFFOtcA1vYm1I9jl8fxo+sucW2WnlpnI4fjKdo3JKxA=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/darwin-arm64": ["@oxlint-tsgolint/darwin-arm64@0.21.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-P20j3MLqfwIT+94qGU3htC7dWp4pXGZW1p1p7FRUzu1aopq7c9nPCgf0W/WjktqQ57+iuTq9mbSlwWinl6+H1A=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/darwin-x64": ["@oxlint-tsgolint/darwin-x64@0.21.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-81TmmuBcPedEA0MwRmObuQuXnCprS1UiHQWGe7pseqNAJzUWXeAPrayqKTACX92VpruJI+yvY0XJrFp11PpcTA=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/linux-arm64": ["@oxlint-tsgolint/linux-arm64@0.21.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-sbjBr6zDduX8rNO0PTjhf7VYLCPWqdijWiMPp8e10qu6Tam1GdaVLaLlX8QrNupTgglO1GvqqgY/jcacWL8a6g=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/linux-x64": ["@oxlint-tsgolint/linux-x64@0.21.0", "", { "os": "linux", "cpu": "x64" }, "sha512-jNrOcy53R5TJQfrK444Cm60bW9437xDoxPbm3AdvFSo/fhdFMllawc7uZC2Wzr+EAjTkW13K8R4QHzsUdBG9fQ=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/win32-arm64": ["@oxlint-tsgolint/win32-arm64@0.21.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-xWeRxJJILDE4b9UqHEWGBxcBc1TUS6zWHhxcyxTZMwf4q3wdKeu0OHYAcwLGJzoSjEIf6FTjyfPiRNil2oqsdg=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/win32-x64": ["@oxlint-tsgolint/win32-x64@0.21.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Ob9AA9teI8ckPo1whV1smLr5NrqwgBv/8boDbK0YZG+fKgNGRwr1hBj1ORgFWOQaUBv+5njp5A0RAfJJjQ95QQ=="],
|
||||||
|
|
||||||
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.60.0", "", { "os": "android", "cpu": "arm" }, "sha512-YdeJKaZckDQL1qa62a1aKq/goyq48aX3yOxaaWqWb4sau4Ee4IiLbamftNLU3zbePky6QsDj6thnSSzHRBjDfA=="],
|
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.60.0", "", { "os": "android", "cpu": "arm" }, "sha512-YdeJKaZckDQL1qa62a1aKq/goyq48aX3yOxaaWqWb4sau4Ee4IiLbamftNLU3zbePky6QsDj6thnSSzHRBjDfA=="],
|
||||||
|
|
||||||
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.60.0", "", { "os": "android", "cpu": "arm64" }, "sha512-7ANS7PpXCfq84xZQ8E5WPs14gwcuPcl+/8TFNXfpSu0CQBXz3cUo2fDpHT8v8HJN+Ut02eacvMAzTnc9s6X4tw=="],
|
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.60.0", "", { "os": "android", "cpu": "arm64" }, "sha512-7ANS7PpXCfq84xZQ8E5WPs14gwcuPcl+/8TFNXfpSu0CQBXz3cUo2fDpHT8v8HJN+Ut02eacvMAzTnc9s6X4tw=="],
|
||||||
@@ -4100,6 +4113,8 @@
|
|||||||
|
|
||||||
"oxlint": ["oxlint@1.60.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.60.0", "@oxlint/binding-android-arm64": "1.60.0", "@oxlint/binding-darwin-arm64": "1.60.0", "@oxlint/binding-darwin-x64": "1.60.0", "@oxlint/binding-freebsd-x64": "1.60.0", "@oxlint/binding-linux-arm-gnueabihf": "1.60.0", "@oxlint/binding-linux-arm-musleabihf": "1.60.0", "@oxlint/binding-linux-arm64-gnu": "1.60.0", "@oxlint/binding-linux-arm64-musl": "1.60.0", "@oxlint/binding-linux-ppc64-gnu": "1.60.0", "@oxlint/binding-linux-riscv64-gnu": "1.60.0", "@oxlint/binding-linux-riscv64-musl": "1.60.0", "@oxlint/binding-linux-s390x-gnu": "1.60.0", "@oxlint/binding-linux-x64-gnu": "1.60.0", "@oxlint/binding-linux-x64-musl": "1.60.0", "@oxlint/binding-openharmony-arm64": "1.60.0", "@oxlint/binding-win32-arm64-msvc": "1.60.0", "@oxlint/binding-win32-ia32-msvc": "1.60.0", "@oxlint/binding-win32-x64-msvc": "1.60.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.18.0" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-tnRzTWiWJ9pg3ftRWnD0+Oqh78L6ZSwcEudvCZaER0PIqiAnNyXj5N1dPwjmNpDalkKS9m/WMLN1CTPUBPmsgw=="],
|
"oxlint": ["oxlint@1.60.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.60.0", "@oxlint/binding-android-arm64": "1.60.0", "@oxlint/binding-darwin-arm64": "1.60.0", "@oxlint/binding-darwin-x64": "1.60.0", "@oxlint/binding-freebsd-x64": "1.60.0", "@oxlint/binding-linux-arm-gnueabihf": "1.60.0", "@oxlint/binding-linux-arm-musleabihf": "1.60.0", "@oxlint/binding-linux-arm64-gnu": "1.60.0", "@oxlint/binding-linux-arm64-musl": "1.60.0", "@oxlint/binding-linux-ppc64-gnu": "1.60.0", "@oxlint/binding-linux-riscv64-gnu": "1.60.0", "@oxlint/binding-linux-riscv64-musl": "1.60.0", "@oxlint/binding-linux-s390x-gnu": "1.60.0", "@oxlint/binding-linux-x64-gnu": "1.60.0", "@oxlint/binding-linux-x64-musl": "1.60.0", "@oxlint/binding-openharmony-arm64": "1.60.0", "@oxlint/binding-win32-arm64-msvc": "1.60.0", "@oxlint/binding-win32-ia32-msvc": "1.60.0", "@oxlint/binding-win32-x64-msvc": "1.60.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.18.0" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-tnRzTWiWJ9pg3ftRWnD0+Oqh78L6ZSwcEudvCZaER0PIqiAnNyXj5N1dPwjmNpDalkKS9m/WMLN1CTPUBPmsgw=="],
|
||||||
|
|
||||||
|
"oxlint-tsgolint": ["oxlint-tsgolint@0.21.0", "", { "optionalDependencies": { "@oxlint-tsgolint/darwin-arm64": "0.21.0", "@oxlint-tsgolint/darwin-x64": "0.21.0", "@oxlint-tsgolint/linux-arm64": "0.21.0", "@oxlint-tsgolint/linux-x64": "0.21.0", "@oxlint-tsgolint/win32-arm64": "0.21.0", "@oxlint-tsgolint/win32-x64": "0.21.0" }, "bin": { "tsgolint": "bin/tsgolint.js" } }, "sha512-HiWPhANwRnN1pZJQ2SgNB3WRR+1etLJHmRzQ/MJhyINsEIaOUCjxhlXJKbEaVUwdnyXwRWqo/P9Fx21lz0/mSg=="],
|
||||||
|
|
||||||
"p-cancelable": ["p-cancelable@2.1.1", "", {}, "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg=="],
|
"p-cancelable": ["p-cancelable@2.1.1", "", {}, "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg=="],
|
||||||
|
|
||||||
"p-defer": ["p-defer@3.0.0", "", {}, "sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw=="],
|
"p-defer": ["p-defer@3.0.0", "", {}, "sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw=="],
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ async function subscribeSessionEvents() {
|
|||||||
const decoder = new TextDecoder()
|
const decoder = new TextDecoder()
|
||||||
|
|
||||||
let text = ""
|
let text = ""
|
||||||
;(async () => {
|
void (async () => {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
const { done, value } = await reader.read()
|
const { done, value } = await reader.read()
|
||||||
|
|||||||
@@ -87,6 +87,7 @@
|
|||||||
"glob": "13.0.5",
|
"glob": "13.0.5",
|
||||||
"husky": "9.1.7",
|
"husky": "9.1.7",
|
||||||
"oxlint": "1.60.0",
|
"oxlint": "1.60.0",
|
||||||
|
"oxlint-tsgolint": "0.21.0",
|
||||||
"prettier": "3.6.2",
|
"prettier": "3.6.2",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
"sst": "3.18.10",
|
"sst": "3.18.10",
|
||||||
|
|||||||
@@ -197,12 +197,12 @@ function ConnectionGate(props: ParentProps<{ disableHealthCheck?: boolean }>) {
|
|||||||
fallback={
|
fallback={
|
||||||
<ConnectionError
|
<ConnectionError
|
||||||
onRetry={() => {
|
onRetry={() => {
|
||||||
if (checkMode() === "background") healthCheckActions.refetch()
|
if (checkMode() === "background") void healthCheckActions.refetch()
|
||||||
}}
|
}}
|
||||||
onServerSelected={(key) => {
|
onServerSelected={(key) => {
|
||||||
setCheckMode("blocking")
|
setCheckMode("blocking")
|
||||||
server.setActive(key)
|
server.setActive(key)
|
||||||
healthCheckActions.refetch()
|
void healthCheckActions.refetch()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ export function DialogConnectProvider(props: { provider: string }) {
|
|||||||
if (loading()) return
|
if (loading()) return
|
||||||
if (methods().length === 1) {
|
if (methods().length === 1) {
|
||||||
auto = true
|
auto = true
|
||||||
selectMethod(0)
|
void selectMethod(0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ export function DialogConnectProvider(props: { provider: string }) {
|
|||||||
key={(m) => m?.label}
|
key={(m) => m?.label}
|
||||||
onSelect={async (selected, index) => {
|
onSelect={async (selected, index) => {
|
||||||
if (!selected) return
|
if (!selected) return
|
||||||
selectMethod(index)
|
void selectMethod(index)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(i) => (
|
{(i) => (
|
||||||
|
|||||||
@@ -348,8 +348,8 @@ export function DialogSelectFile(props: { mode?: DialogSelectFileMode; onOpenFil
|
|||||||
|
|
||||||
const open = (path: string) => {
|
const open = (path: string) => {
|
||||||
const value = file.tab(path)
|
const value = file.tab(path)
|
||||||
tabs().open(value)
|
void tabs().open(value)
|
||||||
file.load(path)
|
void file.load(path)
|
||||||
if (!view().reviewPanel.opened()) view().reviewPanel.open()
|
if (!view().reviewPanel.opened()) view().reviewPanel.open()
|
||||||
layout.fileTree.setTab("all")
|
layout.fileTree.setTab("all")
|
||||||
props.onOpenFile?.(path)
|
props.onOpenFile?.(path)
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ export function DialogSelectServer() {
|
|||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
items()
|
items()
|
||||||
refreshHealth()
|
void refreshHealth()
|
||||||
const interval = setInterval(refreshHealth, 10_000)
|
const interval = setInterval(refreshHealth, 10_000)
|
||||||
onCleanup(() => clearInterval(interval))
|
onCleanup(() => clearInterval(interval))
|
||||||
})
|
})
|
||||||
@@ -498,7 +498,7 @@ export function DialogSelectServer() {
|
|||||||
async function handleRemove(url: ServerConnection.Key) {
|
async function handleRemove(url: ServerConnection.Key) {
|
||||||
server.remove(url)
|
server.remove(url)
|
||||||
if ((await platform.getDefaultServer?.()) === url) {
|
if ((await platform.getDefaultServer?.()) === url) {
|
||||||
platform.setDefaultServer?.(null)
|
void platform.setDefaultServer?.(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,7 +536,7 @@ export function DialogSelectServer() {
|
|||||||
items={sortedItems}
|
items={sortedItems}
|
||||||
key={(x) => x.http.url}
|
key={(x) => x.http.url}
|
||||||
onSelect={(x) => {
|
onSelect={(x) => {
|
||||||
if (x) select(x)
|
if (x) void select(x)
|
||||||
}}
|
}}
|
||||||
divider={true}
|
divider={true}
|
||||||
class="px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]h-[300px] [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent"
|
class="px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]h-[300px] [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent"
|
||||||
|
|||||||
@@ -212,9 +212,9 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
if (!view().reviewPanel.opened()) view().reviewPanel.open()
|
if (!view().reviewPanel.opened()) view().reviewPanel.open()
|
||||||
layout.fileTree.setTab("all")
|
layout.fileTree.setTab("all")
|
||||||
const tab = files.tab(item.path)
|
const tab = files.tab(item.path)
|
||||||
tabs().open(tab)
|
void tabs().open(tab)
|
||||||
tabs().setActive(tab)
|
tabs().setActive(tab)
|
||||||
Promise.resolve(files.load(item.path)).finally(() => queueCommentFocus())
|
void Promise.resolve(files.load(item.path)).finally(() => queueCommentFocus())
|
||||||
}
|
}
|
||||||
|
|
||||||
const recent = createMemo(() => {
|
const recent = createMemo(() => {
|
||||||
@@ -1139,7 +1139,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (working()) {
|
if (working()) {
|
||||||
abort()
|
void abort()
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
return
|
return
|
||||||
@@ -1205,7 +1205,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (working()) {
|
if (working()) {
|
||||||
abort()
|
void abort()
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -1245,7 +1245,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
) {
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
handleSubmit(event)
|
void handleSubmit(event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ export function createPromptSubmit(input: PromptSubmitInput) {
|
|||||||
const mode = input.mode()
|
const mode = input.mode()
|
||||||
|
|
||||||
if (text.trim().length === 0 && images.length === 0 && input.commentCount() === 0) {
|
if (text.trim().length === 0 && images.length === 0 && input.commentCount() === 0) {
|
||||||
if (input.working()) abort()
|
if (input.working()) void abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function openSessionContext(args: {
|
|||||||
}) {
|
}) {
|
||||||
if (!args.view.reviewPanel.opened()) args.view.reviewPanel.open()
|
if (!args.view.reviewPanel.opened()) args.view.reviewPanel.open()
|
||||||
if (args.layout.fileTree.opened() && args.layout.fileTree.tab() !== "all") args.layout.fileTree.setTab("all")
|
if (args.layout.fileTree.opened() && args.layout.fileTree.tab() !== "all") args.layout.fileTree.setTab("all")
|
||||||
args.tabs.open("context")
|
void args.tabs.open("context")
|
||||||
args.tabs.setActive("context")
|
args.tabs.setActive("context")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () =>
|
|||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
const count = terminal.all().length
|
const count = terminal.all().length
|
||||||
terminal.close(props.terminal.id)
|
void terminal.close(props.terminal.id)
|
||||||
if (count === 1) {
|
if (count === 1) {
|
||||||
props.onClose?.()
|
props.onClose?.()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ export const Terminal = (props: TerminalProps) => {
|
|||||||
if (local.autoFocus !== false) focusTerminal()
|
if (local.autoFocus !== false) focusTerminal()
|
||||||
|
|
||||||
if (typeof document !== "undefined" && document.fonts) {
|
if (typeof document !== "undefined" && document.fonts) {
|
||||||
document.fonts.ready.then(scheduleFit)
|
void document.fonts.ready.then(scheduleFit)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onResize = t.onResize((size) => {
|
const onResize = t.onResize((size) => {
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ function createGlobalSync() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
sessionLoads.set(directory, promise)
|
sessionLoads.set(directory, promise)
|
||||||
promise.finally(() => {
|
void promise.finally(() => {
|
||||||
sessionLoads.delete(directory)
|
sessionLoads.delete(directory)
|
||||||
children.unpin(directory)
|
children.unpin(directory)
|
||||||
})
|
})
|
||||||
@@ -273,7 +273,7 @@ function createGlobalSync() {
|
|||||||
})()
|
})()
|
||||||
|
|
||||||
booting.set(directory, promise)
|
booting.set(directory, promise)
|
||||||
promise.finally(() => {
|
void promise.finally(() => {
|
||||||
booting.delete(directory)
|
booting.delete(directory)
|
||||||
children.unpin(directory)
|
children.unpin(directory)
|
||||||
})
|
})
|
||||||
@@ -317,7 +317,7 @@ function createGlobalSync() {
|
|||||||
setSessionTodo,
|
setSessionTodo,
|
||||||
vcsCache: children.vcsCache.get(directory),
|
vcsCache: children.vcsCache.get(directory),
|
||||||
loadLsp: () => {
|
loadLsp: () => {
|
||||||
sdkFor(directory)
|
void sdkFor(directory)
|
||||||
.lsp.status()
|
.lsp.status()
|
||||||
.then((x) => {
|
.then((x) => {
|
||||||
setStore("lsp", x.data ?? [])
|
setStore("lsp", x.data ?? [])
|
||||||
@@ -359,13 +359,13 @@ function createGlobalSync() {
|
|||||||
eventFrame = undefined
|
eventFrame = undefined
|
||||||
eventTimer = setTimeout(() => {
|
eventTimer = setTimeout(() => {
|
||||||
eventTimer = undefined
|
eventTimer = undefined
|
||||||
globalSDK.event.start()
|
void globalSDK.event.start()
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
eventTimer = setTimeout(() => {
|
eventTimer = setTimeout(() => {
|
||||||
eventTimer = undefined
|
eventTimer = undefined
|
||||||
globalSDK.event.start()
|
void globalSDK.event.start()
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
void bootstrap()
|
void bootstrap()
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
|
|||||||
open(directory: string) {
|
open(directory: string) {
|
||||||
const root = rootFor(directory)
|
const root = rootFor(directory)
|
||||||
if (server.projects.list().find((x) => x.worktree === root)) return
|
if (server.projects.list().find((x) => x.worktree === root)) return
|
||||||
globalSync.project.loadSessions(root)
|
void globalSync.project.loadSessions(root)
|
||||||
server.projects.open(root)
|
server.projects.open(root)
|
||||||
},
|
},
|
||||||
close(directory: string) {
|
close(directory: string) {
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export function clearWorkspaceTerminals(dir: string, sessionIDs?: string[], plat
|
|||||||
entry?.value.clear()
|
entry?.value.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
removePersisted(Persist.workspace(dir, "terminal"), platform)
|
void removePersisted(Persist.workspace(dir, "terminal"), platform)
|
||||||
|
|
||||||
const legacy = new Set(getLegacyTerminalStorageKeys(dir))
|
const legacy = new Set(getLegacyTerminalStorageKeys(dir))
|
||||||
for (const id of sessionIDs ?? []) {
|
for (const id of sessionIDs ?? []) {
|
||||||
@@ -126,7 +126,7 @@ export function clearWorkspaceTerminals(dir: string, sessionIDs?: string[], plat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const key of legacy) {
|
for (const key of legacy) {
|
||||||
removePersisted({ key }, platform)
|
void removePersisted({ key }, platform)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ export default function Layout(props: ParentProps) {
|
|||||||
|
|
||||||
// warm up child store to prevent flicker
|
// warm up child store to prevent flicker
|
||||||
globalSync.child(target.worktree)
|
globalSync.child(target.worktree)
|
||||||
openProject(target.worktree)
|
void openProject(target.worktree)
|
||||||
}
|
}
|
||||||
|
|
||||||
function navigateSessionByUnseen(offset: number) {
|
function navigateSessionByUnseen(offset: number) {
|
||||||
@@ -1094,7 +1094,7 @@ export default function Layout(props: ParentProps) {
|
|||||||
disabled: !params.dir || !params.id,
|
disabled: !params.dir || !params.id,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
const session = currentSessions().find((s) => s.id === params.id)
|
const session = currentSessions().find((s) => s.id === params.id)
|
||||||
if (session) archiveSession(session)
|
if (session) void archiveSession(session)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1360,11 +1360,11 @@ export default function Layout(props: ParentProps) {
|
|||||||
if (!server.isLocal()) return
|
if (!server.isLocal()) return
|
||||||
|
|
||||||
for (const directory of collectOpenProjectDeepLinks(urls)) {
|
for (const directory of collectOpenProjectDeepLinks(urls)) {
|
||||||
openProject(directory)
|
void openProject(directory)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const link of collectNewSessionDeepLinks(urls)) {
|
for (const link of collectNewSessionDeepLinks(urls)) {
|
||||||
openProject(link.directory, false)
|
void openProject(link.directory, false)
|
||||||
const slug = base64Encode(link.directory)
|
const slug = base64Encode(link.directory)
|
||||||
if (link.prompt) {
|
if (link.prompt) {
|
||||||
setSessionHandoff(slug, { prompt: link.prompt })
|
setSessionHandoff(slug, { prompt: link.prompt })
|
||||||
@@ -1453,11 +1453,11 @@ export default function Layout(props: ParentProps) {
|
|||||||
function resolve(result: string | string[] | null) {
|
function resolve(result: string | string[] | null) {
|
||||||
if (Array.isArray(result)) {
|
if (Array.isArray(result)) {
|
||||||
for (const directory of result) {
|
for (const directory of result) {
|
||||||
openProject(directory, false)
|
void openProject(directory, false)
|
||||||
}
|
}
|
||||||
navigateToProject(result[0])
|
void navigateToProject(result[0])
|
||||||
} else if (result) {
|
} else if (result) {
|
||||||
openProject(result)
|
void openProject(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1825,7 +1825,7 @@ export default function Layout(props: ParentProps) {
|
|||||||
const next = new Set(dirs)
|
const next = new Set(dirs)
|
||||||
for (const directory of next) {
|
for (const directory of next) {
|
||||||
if (loadedSessionDirs.has(directory)) continue
|
if (loadedSessionDirs.has(directory)) continue
|
||||||
globalSync.project.loadSessions(directory)
|
void globalSync.project.loadSessions(directory)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadedSessionDirs.clear()
|
loadedSessionDirs.clear()
|
||||||
@@ -2110,7 +2110,7 @@ export default function Layout(props: ParentProps) {
|
|||||||
onSave={(next) => {
|
onSave={(next) => {
|
||||||
const item = project()
|
const item = project()
|
||||||
if (!item) return
|
if (!item) return
|
||||||
renameProject(item, next)
|
void renameProject(item, next)
|
||||||
}}
|
}}
|
||||||
class="text-14-medium text-text-strong truncate"
|
class="text-14-medium text-text-strong truncate"
|
||||||
displayClass="text-14-medium text-text-strong truncate"
|
displayClass="text-14-medium text-text-strong truncate"
|
||||||
@@ -2242,7 +2242,7 @@ export default function Layout(props: ParentProps) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
const item = project()
|
const item = project()
|
||||||
if (!item) return
|
if (!item) return
|
||||||
createWorkspace(item)
|
void createWorkspace(item)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{language.t("workspace.new")}
|
{language.t("workspace.new")}
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ const WorkspaceSessionList = (props: {
|
|||||||
class="flex w-full text-left justify-start text-14-regular text-text-weak pl-2 pr-10"
|
class="flex w-full text-left justify-start text-14-regular text-text-weak pl-2 pr-10"
|
||||||
size="large"
|
size="large"
|
||||||
onClick={(e: MouseEvent) => {
|
onClick={(e: MouseEvent) => {
|
||||||
props.loadMore()
|
void props.loadMore()
|
||||||
;(e.currentTarget as HTMLButtonElement).blur()
|
;(e.currentTarget as HTMLButtonElement).blur()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ export default function Page() {
|
|||||||
if (!tab) return
|
if (!tab) return
|
||||||
|
|
||||||
const path = file.pathFromTab(tab)
|
const path = file.pathFromTab(tab)
|
||||||
if (path) file.load(path)
|
if (path) void file.load(path)
|
||||||
})
|
})
|
||||||
|
|
||||||
createEffect(
|
createEffect(
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export const createOpenReviewFile = (input: {
|
|||||||
input.openTab(tab)
|
input.openTab(tab)
|
||||||
input.setActive(tab)
|
input.setActive(tab)
|
||||||
}
|
}
|
||||||
if (maybePromise instanceof Promise) maybePromise.then(open)
|
if (maybePromise instanceof Promise) void maybePromise.then(open)
|
||||||
else open()
|
else open()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,4 +105,4 @@ async function main() {
|
|||||||
console.log(`✓ Sitemap generated at ${outputPath}`)
|
console.log(`✓ Sitemap generated at ${outputPath}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
void main()
|
||||||
|
|||||||
@@ -766,7 +766,7 @@ export default function Spotlight(props: SpotlightProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeWebGPU()
|
void initializeWebGPU()
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
if (cleanupFunctionRef) {
|
if (cleanupFunctionRef) {
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ export default function BlackSubscribe() {
|
|||||||
|
|
||||||
// Resolve stripe promise once
|
// Resolve stripe promise once
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
stripePromise.then((s) => {
|
void stripePromise.then((s) => {
|
||||||
if (s) setStripe(s)
|
if (s) setStripe(s)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export default function Download() {
|
|||||||
|
|
||||||
const handleCopyClick = (command: string) => (event: Event) => {
|
const handleCopyClick = (command: string) => (event: Event) => {
|
||||||
const button = event.currentTarget as HTMLButtonElement
|
const button = event.currentTarget as HTMLButtonElement
|
||||||
navigator.clipboard.writeText(command)
|
void navigator.clipboard.writeText(command)
|
||||||
button.setAttribute("data-copied", "")
|
button.setAttribute("data-copied", "")
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
button.removeAttribute("data-copied")
|
button.removeAttribute("data-copied")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function Home() {
|
|||||||
const button = event.currentTarget as HTMLButtonElement
|
const button = event.currentTarget as HTMLButtonElement
|
||||||
const text = button.textContent
|
const text = button.textContent
|
||||||
if (text) {
|
if (text) {
|
||||||
navigator.clipboard.writeText(text)
|
void navigator.clipboard.writeText(text)
|
||||||
button.setAttribute("data-copied", "")
|
button.setAttribute("data-copied", "")
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
button.removeAttribute("data-copied")
|
button.removeAttribute("data-copied")
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function Home() {
|
|||||||
const callback = () => {
|
const callback = () => {
|
||||||
const text = button.textContent
|
const text = button.textContent
|
||||||
if (text) {
|
if (text) {
|
||||||
navigator.clipboard.writeText(text)
|
void navigator.clipboard.writeText(text)
|
||||||
button.setAttribute("data-copied", "")
|
button.setAttribute("data-copied", "")
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
button.removeAttribute("data-copied")
|
button.removeAttribute("data-copied")
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ export function createDataDumper(sessionId: string, requestId: string, projectId
|
|||||||
const minute = timestamp.substring(10, 12)
|
const minute = timestamp.substring(10, 12)
|
||||||
const second = timestamp.substring(12, 14)
|
const second = timestamp.substring(12, 14)
|
||||||
|
|
||||||
waitUntil(
|
void waitUntil(
|
||||||
Resource.ZenDataNew.put(
|
Resource.ZenDataNew.put(
|
||||||
`data/${data.modelName}/${year}/${month}/${day}/${hour}/${minute}/${second}/${requestId}.json`,
|
`data/${data.modelName}/${year}/${month}/${day}/${hour}/${minute}/${second}/${requestId}.json`,
|
||||||
JSON.stringify({ timestamp, ...data }),
|
JSON.stringify({ timestamp, ...data }),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
waitUntil(
|
void waitUntil(
|
||||||
Resource.ZenDataNew.put(
|
Resource.ZenDataNew.put(
|
||||||
`meta/${data.modelName}/${sessionId}/${requestId}.json`,
|
`meta/${data.modelName}/${sessionId}/${requestId}.json`,
|
||||||
JSON.stringify({ timestamp, ...metadata }),
|
JSON.stringify({ timestamp, ...metadata }),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if (location.pathname === "/loading") {
|
if (location.pathname === "/loading") {
|
||||||
import("./loading")
|
void import("./loading")
|
||||||
} else {
|
} else {
|
||||||
import("./")
|
void import("./")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ const createPlatform = (): Platform => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let menuTrigger = null as null | ((id: string) => void)
|
let menuTrigger = null as null | ((id: string) => void)
|
||||||
createMenu((id) => {
|
void createMenu((id) => {
|
||||||
menuTrigger?.(id)
|
menuTrigger?.(id)
|
||||||
})
|
})
|
||||||
void listenForDeepLinks()
|
void listenForDeepLinks()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ render(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
listener.then((cb) => cb())
|
void listener.then((cb) => cb())
|
||||||
timers.forEach(clearTimeout)
|
timers.forEach(clearTimeout)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -186,5 +186,5 @@ export async function createMenu(trigger: (id: string) => void) {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
menu.setAsAppMenu()
|
void menu.setAsAppMenu()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const clamp = (value: number) => Math.min(Math.max(value, MIN_ZOOM_LEVEL), MAX_Z
|
|||||||
|
|
||||||
const applyZoom = (next: number) => {
|
const applyZoom = (next: number) => {
|
||||||
setWebviewZoom(next)
|
setWebviewZoom(next)
|
||||||
invoke("plugin:webview|set_webview_zoom", {
|
void invoke("plugin:webview|set_webview_zoom", {
|
||||||
value: next,
|
value: next,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,4 @@ async function test() {
|
|||||||
await Share.remove({ id: shareInfo.id, secret: shareInfo.secret })
|
await Share.remove({ id: shareInfo.id, secret: shareInfo.secret })
|
||||||
}
|
}
|
||||||
|
|
||||||
test()
|
void test()
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
main()
|
void main()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Postinstall script error:", error.message)
|
console.error("Postinstall script error:", error.message)
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ export namespace ACP {
|
|||||||
const newContent = getNewContent(content, diff)
|
const newContent = getNewContent(content, diff)
|
||||||
|
|
||||||
if (newContent) {
|
if (newContent) {
|
||||||
this.connection.writeTextFile({
|
void this.connection.writeTextFile({
|
||||||
sessionId: session.id,
|
sessionId: session.id,
|
||||||
path: filepath,
|
path: filepath,
|
||||||
content: newContent,
|
content: newContent,
|
||||||
@@ -1253,7 +1253,7 @@ export namespace ACP {
|
|||||||
)
|
)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.connection.sessionUpdate({
|
void this.connection.sessionUpdate({
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: "available_commands_update",
|
sessionUpdate: "available_commands_update",
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
|||||||
if (match) {
|
if (match) {
|
||||||
continued = true
|
continued = true
|
||||||
if (args.fork) {
|
if (args.fork) {
|
||||||
sdk.client.session.fork({ sessionID: match }).then((result) => {
|
void sdk.client.session.fork({ sessionID: match }).then((result) => {
|
||||||
if (result.data?.id) {
|
if (result.data?.id) {
|
||||||
route.navigate({ type: "session", sessionID: result.data.id })
|
route.navigate({ type: "session", sessionID: result.data.id })
|
||||||
} else {
|
} else {
|
||||||
@@ -370,7 +370,7 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
|||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (forked || sync.status !== "complete" || !args.sessionID || !args.fork) return
|
if (forked || sync.status !== "complete" || !args.sessionID || !args.fork) return
|
||||||
forked = true
|
forked = true
|
||||||
sdk.client.session.fork({ sessionID: args.sessionID }).then((result) => {
|
void sdk.client.session.fork({ sessionID: args.sessionID }).then((result) => {
|
||||||
if (result.data?.id) {
|
if (result.data?.id) {
|
||||||
route.navigate({ type: "session", sessionID: result.data.id })
|
route.navigate({ type: "session", sessionID: result.data.id })
|
||||||
} else {
|
} else {
|
||||||
@@ -818,7 +818,7 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
|||||||
`Successfully updated to OpenCode v${result.data.version}. Please restart the application.`,
|
`Successfully updated to OpenCode v${result.data.version}. Please restart the application.`,
|
||||||
)
|
)
|
||||||
|
|
||||||
exit()
|
void exit()
|
||||||
})
|
})
|
||||||
|
|
||||||
const plugin = createMemo(() => {
|
const plugin = createMemo(() => {
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ export function DialogSessionList() {
|
|||||||
title: "delete",
|
title: "delete",
|
||||||
onTrigger: async (option) => {
|
onTrigger: async (option) => {
|
||||||
if (toDelete() === option.value) {
|
if (toDelete() === option.value) {
|
||||||
sdk.client.session.delete({
|
void sdk.client.session.delete({
|
||||||
sessionID: option.value,
|
sessionID: option.value,
|
||||||
})
|
})
|
||||||
setToDelete(undefined)
|
setToDelete(undefined)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export function DialogSessionRename(props: DialogSessionRenameProps) {
|
|||||||
title="Rename Session"
|
title="Rename Session"
|
||||||
value={session()?.title}
|
value={session()?.title}
|
||||||
onConfirm={(value) => {
|
onConfirm={(value) => {
|
||||||
sdk.client.session.update({
|
void sdk.client.session.update({
|
||||||
sessionID: props.session,
|
sessionID: props.session,
|
||||||
title: value,
|
title: value,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export function ErrorComponent(props: {
|
|||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (evt.ctrl && evt.name === "c") {
|
if (evt.ctrl && evt.name === "c") {
|
||||||
handleExit()
|
void handleExit()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const [copied, setCopied] = createSignal(false)
|
const [copied, setCopied] = createSignal(false)
|
||||||
@@ -56,7 +56,7 @@ export function ErrorComponent(props: {
|
|||||||
issueURL.searchParams.set("opencode-version", Installation.VERSION)
|
issueURL.searchParams.set("opencode-version", Installation.VERSION)
|
||||||
|
|
||||||
const copyIssueURL = () => {
|
const copyIssueURL = () => {
|
||||||
Clipboard.copy(issueURL.toString()).then(() => {
|
void Clipboard.copy(issueURL.toString()).then(() => {
|
||||||
setCopied(true)
|
setCopied(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
hidden: true,
|
hidden: true,
|
||||||
onSelect: (dialog) => {
|
onSelect: (dialog) => {
|
||||||
if (!input.focused) return
|
if (!input.focused) return
|
||||||
submit()
|
void submit()
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -280,7 +280,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
}, 5000)
|
}, 5000)
|
||||||
|
|
||||||
if (store.interrupt >= 2) {
|
if (store.interrupt >= 2) {
|
||||||
sdk.client.session.abort({
|
void sdk.client.session.abort({
|
||||||
sessionID: props.sessionID,
|
sessionID: props.sessionID,
|
||||||
})
|
})
|
||||||
setStore("interrupt", 0)
|
setStore("interrupt", 0)
|
||||||
@@ -429,7 +429,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
setStore("extmarkToPartIndex", new Map())
|
setStore("extmarkToPartIndex", new Map())
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
submit()
|
void submit()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,12 +604,12 @@ export function Prompt(props: PromptProps) {
|
|||||||
if (!store.prompt.input) return
|
if (!store.prompt.input) return
|
||||||
const trimmed = store.prompt.input.trim()
|
const trimmed = store.prompt.input.trim()
|
||||||
if (trimmed === "exit" || trimmed === "quit" || trimmed === ":q") {
|
if (trimmed === "exit" || trimmed === "quit" || trimmed === ":q") {
|
||||||
exit()
|
void exit()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const selectedModel = local.model.current()
|
const selectedModel = local.model.current()
|
||||||
if (!selectedModel) {
|
if (!selectedModel) {
|
||||||
promptModelWarning()
|
void promptModelWarning()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,7 +660,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
const variant = local.model.variant.current()
|
const variant = local.model.variant.current()
|
||||||
|
|
||||||
if (store.mode === "shell") {
|
if (store.mode === "shell") {
|
||||||
sdk.client.session.shell({
|
void sdk.client.session.shell({
|
||||||
sessionID,
|
sessionID,
|
||||||
agent: local.agent.current().name,
|
agent: local.agent.current().name,
|
||||||
model: {
|
model: {
|
||||||
@@ -685,7 +685,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
const restOfInput = firstLineEnd === -1 ? "" : inputText.slice(firstLineEnd + 1)
|
const restOfInput = firstLineEnd === -1 ? "" : inputText.slice(firstLineEnd + 1)
|
||||||
const args = firstLineArgs.join(" ") + (restOfInput ? "\n" + restOfInput : "")
|
const args = firstLineArgs.join(" ") + (restOfInput ? "\n" + restOfInput : "")
|
||||||
|
|
||||||
sdk.client.session.command({
|
void sdk.client.session.command({
|
||||||
sessionID,
|
sessionID,
|
||||||
command: command.slice(1),
|
command: command.slice(1),
|
||||||
arguments: args,
|
arguments: args,
|
||||||
@@ -1208,7 +1208,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
const r = retry()
|
const r = retry()
|
||||||
if (!r) return
|
if (!r) return
|
||||||
if (isTruncated()) {
|
if (isTruncated()) {
|
||||||
DialogAlert.show(dialog, "Retry Error", r.message)
|
void DialogAlert.show(dialog, "Retry Error", r.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const { use: useKV, provider: KVProvider } = createSimpleContext({
|
|||||||
},
|
},
|
||||||
set(key: string, value: any) {
|
set(key: string, value: any) {
|
||||||
setStore(key, value)
|
setStore(key, value)
|
||||||
Filesystem.writeJson(filePath, store)
|
void Filesystem.writeJson(filePath, store)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
state.pending = false
|
state.pending = false
|
||||||
Filesystem.writeJson(filePath, {
|
void Filesystem.writeJson(filePath, {
|
||||||
recent: modelStore.recent,
|
recent: modelStore.recent,
|
||||||
favorite: modelStore.favorite,
|
favorite: modelStore.favorite,
|
||||||
variant: modelStore.variant,
|
variant: modelStore.variant,
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
|
|||||||
event.subscribe((event) => {
|
event.subscribe((event) => {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "server.instance.disposed":
|
case "server.instance.disposed":
|
||||||
bootstrap()
|
void bootstrap()
|
||||||
break
|
break
|
||||||
case "permission.replied": {
|
case "permission.replied": {
|
||||||
const requests = store.permission[event.properties.sessionID]
|
const requests = store.permission[event.properties.sessionID]
|
||||||
@@ -336,7 +336,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
|
|||||||
|
|
||||||
case "lsp.updated": {
|
case "lsp.updated": {
|
||||||
const workspace = project.workspace.current()
|
const workspace = project.workspace.current()
|
||||||
sdk.client.lsp.status({ workspace }).then((x) => setStore("lsp", x.data ?? []))
|
void sdk.client.lsp.status({ workspace }).then((x) => setStore("lsp", x.data ?? []))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,7 +415,7 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
if (store.status !== "complete") setStore("status", "partial")
|
if (store.status !== "complete") setStore("status", "partial")
|
||||||
// non-blocking
|
// non-blocking
|
||||||
Promise.all([
|
void Promise.all([
|
||||||
...(args.continue ? [] : [sessionListPromise.then((sessions) => setStore("session", reconcile(sessions)))]),
|
...(args.continue ? [] : [sessionListPromise.then((sessions) => setStore("session", reconcile(sessions)))]),
|
||||||
consoleStatePromise.then((consoleState) => setStore("console_state", reconcile(consoleState))),
|
consoleStatePromise.then((consoleState) => setStore("console_state", reconcile(consoleState))),
|
||||||
sdk.client.command.list({ workspace }).then((x) => setStore("command", reconcile(x.data ?? []))),
|
sdk.client.command.list({ workspace }).then((x) => setStore("command", reconcile(x.data ?? []))),
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
|
|||||||
})
|
})
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
Promise.allSettled([
|
void Promise.allSettled([
|
||||||
resolveSystemTheme(store.mode),
|
resolveSystemTheme(store.mode),
|
||||||
getCustomThemes()
|
getCustomThemes()
|
||||||
.then((custom) => {
|
.then((custom) => {
|
||||||
@@ -377,7 +377,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
|
|||||||
if (store.mode === mode) return
|
if (store.mode === mode) return
|
||||||
setStore("mode", mode)
|
setStore("mode", mode)
|
||||||
renderer.clearPaletteCache()
|
renderer.clearPaletteCache()
|
||||||
resolveSystemTheme(mode)
|
void resolveSystemTheme(mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
function pin(mode: "dark" | "light" = store.mode) {
|
function pin(mode: "dark" | "light" = store.mode) {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ function Install(props: { api: TuiPluginApi }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setBusy(true)
|
setBusy(true)
|
||||||
props.api.plugins
|
void props.api.plugins
|
||||||
.install(mod, { global: global() })
|
.install(mod, { global: global() })
|
||||||
.then((out) => {
|
.then((out) => {
|
||||||
if (!out.ok) {
|
if (!out.ok) {
|
||||||
@@ -188,7 +188,7 @@ function View(props: { api: TuiPluginApi }) {
|
|||||||
if (!item) return
|
if (!item) return
|
||||||
setLock(true)
|
setLock(true)
|
||||||
const task = item.active ? props.api.plugins.deactivate(x) : props.api.plugins.activate(x)
|
const task = item.active ? props.api.plugins.deactivate(x) : props.api.plugins.activate(x)
|
||||||
task
|
void task
|
||||||
.then((ok) => {
|
.then((ok) => {
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
props.api.ui.toast({
|
props.api.ui.toast({
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function DialogMessage(props: {
|
|||||||
const msg = message()
|
const msg = message()
|
||||||
if (!msg) return
|
if (!msg) return
|
||||||
|
|
||||||
sdk.client.session.revert({
|
void sdk.client.session.revert({
|
||||||
sessionID: props.sessionID,
|
sessionID: props.sessionID,
|
||||||
messageID: msg.id,
|
messageID: msg.id,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ export function Session() {
|
|||||||
|
|
||||||
if (kv.get(GO_UPSELL_DONT_SHOW)) return
|
if (kv.get(GO_UPSELL_DONT_SHOW)) return
|
||||||
|
|
||||||
DialogGoUpsell.show(dialog).then((dontShowAgain) => {
|
void DialogGoUpsell.show(dialog).then((dontShowAgain) => {
|
||||||
if (dontShowAgain) kv.set(GO_UPSELL_DONT_SHOW, true)
|
if (dontShowAgain) kv.set(GO_UPSELL_DONT_SHOW, true)
|
||||||
kv.set(GO_UPSELL_LAST_SEEN_AT, Date.now())
|
kv.set(GO_UPSELL_LAST_SEEN_AT, Date.now())
|
||||||
})
|
})
|
||||||
@@ -272,7 +272,7 @@ export function Session() {
|
|||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (!session()?.parentID) return
|
if (!session()?.parentID) return
|
||||||
if (keybind.match("app_exit", evt)) {
|
if (keybind.match("app_exit", evt)) {
|
||||||
exit()
|
void exit()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ export function Session() {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sdk.client.session.summarize({
|
void sdk.client.session.summarize({
|
||||||
sessionID: route.sessionID,
|
sessionID: route.sessionID,
|
||||||
modelID: selectedModel.modelID,
|
modelID: selectedModel.modelID,
|
||||||
providerID: selectedModel.providerID,
|
providerID: selectedModel.providerID,
|
||||||
@@ -529,7 +529,7 @@ export function Session() {
|
|||||||
const revert = session()?.revert?.messageID
|
const revert = session()?.revert?.messageID
|
||||||
const message = messages().findLast((x) => (!revert || x.id < revert) && x.role === "user")
|
const message = messages().findLast((x) => (!revert || x.id < revert) && x.role === "user")
|
||||||
if (!message) return
|
if (!message) return
|
||||||
sdk.client.session
|
void sdk.client.session
|
||||||
.revert({
|
.revert({
|
||||||
sessionID: route.sessionID,
|
sessionID: route.sessionID,
|
||||||
messageID: message.id,
|
messageID: message.id,
|
||||||
@@ -568,13 +568,13 @@ export function Session() {
|
|||||||
if (!messageID) return
|
if (!messageID) return
|
||||||
const message = messages().find((x) => x.role === "user" && x.id > messageID)
|
const message = messages().find((x) => x.role === "user" && x.id > messageID)
|
||||||
if (!message) {
|
if (!message) {
|
||||||
sdk.client.session.unrevert({
|
void sdk.client.session.unrevert({
|
||||||
sessionID: route.sessionID,
|
sessionID: route.sessionID,
|
||||||
})
|
})
|
||||||
prompt?.set({ input: "", parts: [] })
|
prompt?.set({ input: "", parts: [] })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sdk.client.session.revert({
|
void sdk.client.session.revert({
|
||||||
sessionID: route.sessionID,
|
sessionID: route.sessionID,
|
||||||
messageID: message.id,
|
messageID: message.id,
|
||||||
})
|
})
|
||||||
@@ -1966,7 +1966,7 @@ function Task(props: ToolProps<typeof TaskTool>) {
|
|||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (props.metadata.sessionId && !sync.data.message[props.metadata.sessionId]?.length)
|
if (props.metadata.sessionId && !sync.data.message[props.metadata.sessionId]?.length)
|
||||||
sync.session.sync(props.metadata.sessionId)
|
void sync.session.sync(props.metadata.sessionId)
|
||||||
})
|
})
|
||||||
|
|
||||||
const messages = createMemo(() => sync.data.message[props.metadata.sessionId ?? ""] ?? [])
|
const messages = createMemo(() => sync.data.message[props.metadata.sessionId ?? ""] ?? [])
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ export function PermissionPrompt(props: { request: PermissionRequest }) {
|
|||||||
onSelect={(option) => {
|
onSelect={(option) => {
|
||||||
setStore("stage", "permission")
|
setStore("stage", "permission")
|
||||||
if (option === "cancel") return
|
if (option === "cancel") return
|
||||||
sdk.client.permission.reply({
|
void sdk.client.permission.reply({
|
||||||
reply: "always",
|
reply: "always",
|
||||||
requestID: props.request.id,
|
requestID: props.request.id,
|
||||||
})
|
})
|
||||||
@@ -194,7 +194,7 @@ export function PermissionPrompt(props: { request: PermissionRequest }) {
|
|||||||
<Match when={store.stage === "reject"}>
|
<Match when={store.stage === "reject"}>
|
||||||
<RejectPrompt
|
<RejectPrompt
|
||||||
onConfirm={(message) => {
|
onConfirm={(message) => {
|
||||||
sdk.client.permission.reply({
|
void sdk.client.permission.reply({
|
||||||
reply: "reject",
|
reply: "reject",
|
||||||
requestID: props.request.id,
|
requestID: props.request.id,
|
||||||
message: message || undefined,
|
message: message || undefined,
|
||||||
@@ -447,13 +447,13 @@ export function PermissionPrompt(props: { request: PermissionRequest }) {
|
|||||||
setStore("stage", "reject")
|
setStore("stage", "reject")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sdk.client.permission.reply({
|
void sdk.client.permission.reply({
|
||||||
reply: "reject",
|
reply: "reject",
|
||||||
requestID: props.request.id,
|
requestID: props.request.id,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sdk.client.permission.reply({
|
void sdk.client.permission.reply({
|
||||||
reply: "once",
|
reply: "once",
|
||||||
requestID: props.request.id,
|
requestID: props.request.id,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -45,14 +45,14 @@ export function QuestionPrompt(props: { request: QuestionRequest }) {
|
|||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
const answers = questions().map((_, i) => store.answers[i] ?? [])
|
const answers = questions().map((_, i) => store.answers[i] ?? [])
|
||||||
sdk.client.question.reply({
|
void sdk.client.question.reply({
|
||||||
requestID: props.request.id,
|
requestID: props.request.id,
|
||||||
answers,
|
answers,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function reject() {
|
function reject() {
|
||||||
sdk.client.question.reject({
|
void sdk.client.question.reject({
|
||||||
requestID: props.request.id,
|
requestID: props.request.id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ export function QuestionPrompt(props: { request: QuestionRequest }) {
|
|||||||
setStore("custom", inputs)
|
setStore("custom", inputs)
|
||||||
}
|
}
|
||||||
if (single()) {
|
if (single()) {
|
||||||
sdk.client.question.reply({
|
void sdk.client.question.reply({
|
||||||
requestID: props.request.id,
|
requestID: props.request.id,
|
||||||
answers: [[answer]],
|
answers: [[answer]],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ async function loadCommand(dir: string) {
|
|||||||
? err.data.message
|
? err.data.message
|
||||||
: `Failed to parse command ${item}`
|
: `Failed to parse command ${item}`
|
||||||
const { Session } = await import("@/session")
|
const { Session } = await import("@/session")
|
||||||
Bus.publish(Session.Event.Error, { error: new NamedError.Unknown({ message }).toObject() })
|
void Bus.publish(Session.Event.Error, { error: new NamedError.Unknown({ message }).toObject() })
|
||||||
log.error("failed to load command", { command: item, err })
|
log.error("failed to load command", { command: item, err })
|
||||||
return undefined
|
return undefined
|
||||||
})
|
})
|
||||||
@@ -210,7 +210,7 @@ async function loadAgent(dir: string) {
|
|||||||
? err.data.message
|
? err.data.message
|
||||||
: `Failed to parse agent ${item}`
|
: `Failed to parse agent ${item}`
|
||||||
const { Session } = await import("@/session")
|
const { Session } = await import("@/session")
|
||||||
Bus.publish(Session.Event.Error, { error: new NamedError.Unknown({ message }).toObject() })
|
void Bus.publish(Session.Event.Error, { error: new NamedError.Unknown({ message }).toObject() })
|
||||||
log.error("failed to load agent", { agent: item, err })
|
log.error("failed to load agent", { agent: item, err })
|
||||||
return undefined
|
return undefined
|
||||||
})
|
})
|
||||||
@@ -248,7 +248,7 @@ async function loadMode(dir: string) {
|
|||||||
? err.data.message
|
? err.data.message
|
||||||
: `Failed to parse mode ${item}`
|
: `Failed to parse mode ${item}`
|
||||||
const { Session } = await import("@/session")
|
const { Session } = await import("@/session")
|
||||||
Bus.publish(Session.Event.Error, { error: new NamedError.Unknown({ message }).toObject() })
|
void Bus.publish(Session.Event.Error, { error: new NamedError.Unknown({ message }).toObject() })
|
||||||
log.error("failed to load mode", { mode: item, err })
|
log.error("failed to load mode", { mode: item, err })
|
||||||
return undefined
|
return undefined
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export namespace Workspace {
|
|||||||
|
|
||||||
await adaptor.create(config)
|
await adaptor.create(config)
|
||||||
|
|
||||||
startSync(info)
|
void startSync(info)
|
||||||
|
|
||||||
await waitEvent({
|
await waitEvent({
|
||||||
timeout: TIMEOUT,
|
timeout: TIMEOUT,
|
||||||
@@ -294,7 +294,7 @@ export namespace Workspace {
|
|||||||
)
|
)
|
||||||
const spaces = rows.map(fromRow).sort((a, b) => a.id.localeCompare(b.id))
|
const spaces = rows.map(fromRow).sort((a, b) => a.id.localeCompare(b.id))
|
||||||
|
|
||||||
for (const space of spaces) startSync(space)
|
for (const space of spaces) void startSync(space)
|
||||||
return spaces
|
return spaces
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ export namespace Workspace {
|
|||||||
export const get = fn(WorkspaceID.zod, async (id) => {
|
export const get = fn(WorkspaceID.zod, async (id) => {
|
||||||
const space = lookup(id)
|
const space = lookup(id)
|
||||||
if (!space) return
|
if (!space) return
|
||||||
startSync(space)
|
void startSync(space)
|
||||||
return space
|
return space
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ export namespace FileWatcher {
|
|||||||
const cb: ParcelWatcher.SubscribeCallback = Instance.bind((err, evts) => {
|
const cb: ParcelWatcher.SubscribeCallback = Instance.bind((err, evts) => {
|
||||||
if (err) return
|
if (err) return
|
||||||
for (const evt of evts) {
|
for (const evt of evts) {
|
||||||
if (evt.type === "create") Bus.publish(Event.Updated, { file: evt.path, event: "add" })
|
if (evt.type === "create") void Bus.publish(Event.Updated, { file: evt.path, event: "add" })
|
||||||
if (evt.type === "update") Bus.publish(Event.Updated, { file: evt.path, event: "change" })
|
if (evt.type === "update") void Bus.publish(Event.Updated, { file: evt.path, event: "change" })
|
||||||
if (evt.type === "delete") Bus.publish(Event.Updated, { file: evt.path, event: "unlink" })
|
if (evt.type === "delete") void Bus.publish(Event.Updated, { file: evt.path, event: "unlink" })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export namespace LSPClient {
|
|||||||
const exists = diagnostics.has(filePath)
|
const exists = diagnostics.has(filePath)
|
||||||
diagnostics.set(filePath, params.diagnostics)
|
diagnostics.set(filePath, params.diagnostics)
|
||||||
if (!exists && input.serverID === "typescript") return
|
if (!exists && input.serverID === "typescript") return
|
||||||
Bus.publish(Event.Diagnostics, { path: filePath, serverID: input.serverID })
|
void Bus.publish(Event.Diagnostics, { path: filePath, serverID: input.serverID })
|
||||||
})
|
})
|
||||||
connection.onRequest("window/workDoneProgress/create", (params) => {
|
connection.onRequest("window/workDoneProgress/create", (params) => {
|
||||||
l.info("window/workDoneProgress/create", params)
|
l.info("window/workDoneProgress/create", params)
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ export namespace LSP {
|
|||||||
const task = schedule(server, root, root + server.id)
|
const task = schedule(server, root, root + server.id)
|
||||||
s.spawning.set(root + server.id, task)
|
s.spawning.set(root + server.id, task)
|
||||||
|
|
||||||
task.finally(() => {
|
void task.finally(() => {
|
||||||
if (s.spawning.get(root + server.id) === task) {
|
if (s.spawning.get(root + server.id) === task) {
|
||||||
s.spawning.delete(root + server.id)
|
s.spawning.delete(root + server.id)
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ export namespace LSP {
|
|||||||
if (!client) continue
|
if (!client) continue
|
||||||
|
|
||||||
result.push(client)
|
result.push(client)
|
||||||
Bus.publish(Event.Updated, {})
|
void Bus.publish(Event.Updated, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ export const layer = Layer.effect(
|
|||||||
Stream.runForEach((input) =>
|
Stream.runForEach((input) =>
|
||||||
Effect.sync(() => {
|
Effect.sync(() => {
|
||||||
for (const hook of hooks) {
|
for (const hook of hooks) {
|
||||||
hook["event"]?.({ event: input as any })
|
void hook["event"]?.({ event: input as any })
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export namespace ModelsDev {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Flag.OPENCODE_DISABLE_MODELS_FETCH && !process.argv.includes("--get-yargs-completions")) {
|
if (!Flag.OPENCODE_DISABLE_MODELS_FETCH && !process.argv.includes("--get-yargs-completions")) {
|
||||||
ModelsDev.refresh()
|
void ModelsDev.refresh()
|
||||||
setInterval(
|
setInterval(
|
||||||
async () => {
|
async () => {
|
||||||
await ModelsDev.refresh()
|
await ModelsDev.refresh()
|
||||||
|
|||||||
@@ -898,7 +898,7 @@ export const SessionRoutes = lazy(() =>
|
|||||||
const msg = await AppRuntime.runPromise(
|
const msg = await AppRuntime.runPromise(
|
||||||
SessionPrompt.Service.use((svc) => svc.prompt({ ...body, sessionID })),
|
SessionPrompt.Service.use((svc) => svc.prompt({ ...body, sessionID })),
|
||||||
)
|
)
|
||||||
stream.write(JSON.stringify(msg))
|
void stream.write(JSON.stringify(msg))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -926,13 +926,15 @@ export const SessionRoutes = lazy(() =>
|
|||||||
async (c) => {
|
async (c) => {
|
||||||
const sessionID = c.req.valid("param").sessionID
|
const sessionID = c.req.valid("param").sessionID
|
||||||
const body = c.req.valid("json")
|
const body = c.req.valid("json")
|
||||||
AppRuntime.runPromise(SessionPrompt.Service.use((svc) => svc.prompt({ ...body, sessionID }))).catch((err) => {
|
void AppRuntime.runPromise(SessionPrompt.Service.use((svc) => svc.prompt({ ...body, sessionID }))).catch(
|
||||||
log.error("prompt_async failed", { sessionID, error: err })
|
(err) => {
|
||||||
Bus.publish(Session.Event.Error, {
|
log.error("prompt_async failed", { sessionID, error: err })
|
||||||
sessionID,
|
void Bus.publish(Session.Event.Error, {
|
||||||
error: new NamedError.Unknown({ message: err instanceof Error ? err.message : String(err) }).toObject(),
|
sessionID,
|
||||||
})
|
error: new NamedError.Unknown({ message: err instanceof Error ? err.message : String(err) }).toObject(),
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
return c.body(null, 204)
|
return c.body(null, 204)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ const app = (upgrade: UpgradeWebSocket) =>
|
|||||||
queue.length = 0
|
queue.length = 0
|
||||||
}
|
}
|
||||||
remote.onmessage = (event) => {
|
remote.onmessage = (event) => {
|
||||||
send(ws, event.data)
|
void send(ws, event.data)
|
||||||
}
|
}
|
||||||
remote.onerror = () => {
|
remote.onerror = () => {
|
||||||
ws.close(1011, "proxy error")
|
ws.close(1011, "proxy error")
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ export namespace Database {
|
|||||||
if (err instanceof LocalContext.NotFound) {
|
if (err instanceof LocalContext.NotFound) {
|
||||||
const effects: (() => void | Promise<void>)[] = []
|
const effects: (() => void | Promise<void>)[] = []
|
||||||
const result = ctx.provide({ effects, tx: Client() }, () => callback(Client()))
|
const result = ctx.provide({ effects, tx: Client() }, () => callback(Client()))
|
||||||
for (const effect of effects) effect()
|
for (const effect of effects) void effect()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
throw err
|
throw err
|
||||||
@@ -146,7 +146,7 @@ export namespace Database {
|
|||||||
try {
|
try {
|
||||||
ctx.use().effects.push(bound)
|
ctx.use().effects.push(bound)
|
||||||
} catch {
|
} catch {
|
||||||
bound()
|
void bound()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ export namespace Database {
|
|||||||
const effects: (() => void | Promise<void>)[] = []
|
const effects: (() => void | Promise<void>)[] = []
|
||||||
const txCallback = InstanceState.bind((tx: TxOrDb) => ctx.provide({ tx, effects }, () => callback(tx)))
|
const txCallback = InstanceState.bind((tx: TxOrDb) => ctx.provide({ tx, effects }, () => callback(tx)))
|
||||||
const result = Client().transaction(txCallback, { behavior: options?.behavior })
|
const result = Client().transaction(txCallback, { behavior: options?.behavior })
|
||||||
for (const effect of effects) effect()
|
for (const effect of effects) void effect()
|
||||||
return result as NotPromise<T>
|
return result as NotPromise<T>
|
||||||
}
|
}
|
||||||
throw err
|
throw err
|
||||||
|
|||||||
@@ -142,11 +142,11 @@ function process<Def extends Definition>(def: Def, event: Event<Def>, options: {
|
|||||||
if (options?.publish) {
|
if (options?.publish) {
|
||||||
const result = convertEvent(def.type, event.data)
|
const result = convertEvent(def.type, event.data)
|
||||||
if (result instanceof Promise) {
|
if (result instanceof Promise) {
|
||||||
result.then((data) => {
|
void result.then((data) => {
|
||||||
ProjectBus.publish({ type: def.type, properties: def.schema }, data)
|
void ProjectBus.publish({ type: def.type, properties: def.schema }, data)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ProjectBus.publish({ type: def.type, properties: def.schema }, result)
|
void ProjectBus.publish({ type: def.type, properties: def.schema }, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalBus.emit("event", {
|
GlobalBus.emit("event", {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export function defer<T extends () => void | Promise<void>>(
|
|||||||
): T extends () => Promise<void> ? { [Symbol.asyncDispose]: () => Promise<void> } : { [Symbol.dispose]: () => void } {
|
): T extends () => Promise<void> ? { [Symbol.asyncDispose]: () => Promise<void> } : { [Symbol.dispose]: () => void } {
|
||||||
return {
|
return {
|
||||||
[Symbol.dispose]() {
|
[Symbol.dispose]() {
|
||||||
fn()
|
void fn()
|
||||||
},
|
},
|
||||||
[Symbol.asyncDispose]() {
|
[Symbol.asyncDispose]() {
|
||||||
return Promise.resolve(fn())
|
return Promise.resolve(fn())
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ let write = (msg: any) => {
|
|||||||
|
|
||||||
export async function init(options: Options) {
|
export async function init(options: Options) {
|
||||||
if (options.level) level = options.level
|
if (options.level) level = options.level
|
||||||
cleanup(Global.Path.log)
|
void cleanup(Global.Path.log)
|
||||||
if (options.print) return
|
if (options.print) return
|
||||||
logpath = path.join(
|
logpath = path.join(
|
||||||
Global.Path.log,
|
Global.Path.log,
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ test(
|
|||||||
|
|
||||||
const done = await new Promise<string>((resolve) => {
|
const done = await new Promise<string>((resolve) => {
|
||||||
const timer = setTimeout(() => resolve("timeout"), 7000)
|
const timer = setTimeout(() => resolve("timeout"), 7000)
|
||||||
TuiPluginRuntime.dispose().then(() => {
|
void TuiPluginRuntime.dispose().then(() => {
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
resolve("done")
|
resolve("done")
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const transportCalls: Array<{
|
|||||||
}> = []
|
}> = []
|
||||||
|
|
||||||
// Mock the transport constructors to capture their arguments
|
// Mock the transport constructors to capture their arguments
|
||||||
mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
||||||
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
||||||
constructor(url: URL, options?: { authProvider?: unknown; requestInit?: RequestInit }) {
|
constructor(url: URL, options?: { authProvider?: unknown; requestInit?: RequestInit }) {
|
||||||
transportCalls.push({
|
transportCalls.push({
|
||||||
@@ -25,7 +25,7 @@ mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
||||||
SSEClientTransport: class MockSSE {
|
SSEClientTransport: class MockSSE {
|
||||||
constructor(url: URL, options?: { authProvider?: unknown; requestInit?: RequestInit }) {
|
constructor(url: URL, options?: { authProvider?: unknown; requestInit?: RequestInit }) {
|
||||||
transportCalls.push({
|
transportCalls.push({
|
||||||
|
|||||||
@@ -89,19 +89,19 @@ class MockSSE {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mock.module("@modelcontextprotocol/sdk/client/stdio.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/stdio.js", () => ({
|
||||||
StdioClientTransport: MockStdioTransport,
|
StdioClientTransport: MockStdioTransport,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
||||||
StreamableHTTPClientTransport: MockStreamableHTTP,
|
StreamableHTTPClientTransport: MockStreamableHTTP,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
||||||
SSEClientTransport: MockSSE,
|
SSEClientTransport: MockSSE,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mock.module("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
||||||
UnauthorizedError: class extends Error {
|
UnauthorizedError: class extends Error {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("Unauthorized")
|
super("Unauthorized")
|
||||||
@@ -110,7 +110,7 @@ mock.module("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Mock Client that delegates to per-name MockClientState
|
// Mock Client that delegates to per-name MockClientState
|
||||||
mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
||||||
Client: class MockClient {
|
Client: class MockClient {
|
||||||
_state!: MockClientState
|
_state!: MockClientState
|
||||||
transport: any
|
transport: any
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ let simulateAuthFlow = true
|
|||||||
let connectSucceedsImmediately = false
|
let connectSucceedsImmediately = false
|
||||||
|
|
||||||
// Mock the transport constructors to simulate OAuth auto-auth on 401
|
// Mock the transport constructors to simulate OAuth auto-auth on 401
|
||||||
mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
||||||
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
||||||
authProvider:
|
authProvider:
|
||||||
| {
|
| {
|
||||||
@@ -66,7 +66,7 @@ mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
||||||
SSEClientTransport: class MockSSE {
|
SSEClientTransport: class MockSSE {
|
||||||
constructor(url: URL, options?: { authProvider?: unknown }) {
|
constructor(url: URL, options?: { authProvider?: unknown }) {
|
||||||
transportCalls.push({
|
transportCalls.push({
|
||||||
@@ -82,7 +82,7 @@ mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Mock the MCP SDK Client
|
// Mock the MCP SDK Client
|
||||||
mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
||||||
Client: class MockClient {
|
Client: class MockClient {
|
||||||
async connect(transport: { start: () => Promise<void> }) {
|
async connect(transport: { start: () => Promise<void> }) {
|
||||||
await transport.start()
|
await transport.start()
|
||||||
@@ -99,7 +99,7 @@ mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Mock UnauthorizedError in the auth module so instanceof checks work
|
// Mock UnauthorizedError in the auth module so instanceof checks work
|
||||||
mock.module("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
||||||
UnauthorizedError: MockUnauthorizedError,
|
UnauthorizedError: MockUnauthorizedError,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type { MCP as MCPNS } from "../../src/mcp/index"
|
|||||||
let openShouldFail = false
|
let openShouldFail = false
|
||||||
let openCalledWith: string | undefined
|
let openCalledWith: string | undefined
|
||||||
|
|
||||||
mock.module("open", () => ({
|
void mock.module("open", () => ({
|
||||||
default: async (url: string) => {
|
default: async (url: string) => {
|
||||||
openCalledWith = url
|
openCalledWith = url
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ const transportCalls: Array<{
|
|||||||
}> = []
|
}> = []
|
||||||
|
|
||||||
// Mock the transport constructors
|
// Mock the transport constructors
|
||||||
mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
||||||
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
||||||
url: string
|
url: string
|
||||||
authProvider: { redirectToAuthorization?: (url: URL) => Promise<void> } | undefined
|
authProvider: { redirectToAuthorization?: (url: URL) => Promise<void> } | undefined
|
||||||
@@ -65,7 +65,7 @@ mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
||||||
SSEClientTransport: class MockSSE {
|
SSEClientTransport: class MockSSE {
|
||||||
constructor(url: URL) {
|
constructor(url: URL) {
|
||||||
transportCalls.push({
|
transportCalls.push({
|
||||||
@@ -81,7 +81,7 @@ mock.module("@modelcontextprotocol/sdk/client/sse.js", () => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Mock the MCP SDK Client to trigger OAuth flow
|
// Mock the MCP SDK Client to trigger OAuth flow
|
||||||
mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
||||||
Client: class MockClient {
|
Client: class MockClient {
|
||||||
async connect(transport: { start: () => Promise<void> }) {
|
async connect(transport: { start: () => Promise<void> }) {
|
||||||
await transport.start()
|
await transport.start()
|
||||||
@@ -90,7 +90,7 @@ mock.module("@modelcontextprotocol/sdk/client/index.js", () => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Mock UnauthorizedError in the auth module
|
// Mock UnauthorizedError in the auth module
|
||||||
mock.module("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
void mock.module("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
||||||
UnauthorizedError: MockUnauthorizedError,
|
UnauthorizedError: MockUnauthorizedError,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,6 @@ try {
|
|||||||
const after = heap()
|
const after = heap()
|
||||||
process.stdout.write(JSON.stringify({ baseline, after, growth: after - baseline }))
|
process.stdout.write(JSON.stringify({ baseline, after, growth: after - baseline }))
|
||||||
} finally {
|
} finally {
|
||||||
server.stop(true)
|
void server.stop(true)
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -954,7 +954,7 @@ it.live("pending permission rejects on instance dispose", () =>
|
|||||||
}).pipe(run, Effect.forkScoped)
|
}).pipe(run, Effect.forkScoped)
|
||||||
|
|
||||||
expect(yield* waitForPending(1).pipe(run)).toHaveLength(1)
|
expect(yield* waitForPending(1).pipe(run)).toHaveLength(1)
|
||||||
yield* Effect.promise(() => Instance.provide({ directory: dir, fn: () => Instance.dispose() }))
|
yield* Effect.promise(() => Instance.provide({ directory: dir, fn: () => void Instance.dispose() }))
|
||||||
|
|
||||||
const exit = yield* Fiber.await(fiber)
|
const exit = yield* Fiber.await(fiber)
|
||||||
expect(Exit.isFailure(exit)).toBe(true)
|
expect(Exit.isFailure(exit)).toBe(true)
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ process.env["OPENCODE_DB"] = ":memory:"
|
|||||||
const { Log } = await import("../src/util")
|
const { Log } = await import("../src/util")
|
||||||
const { initProjectors } = await import("../src/server/projectors")
|
const { initProjectors } = await import("../src/server/projectors")
|
||||||
|
|
||||||
Log.init({
|
void Log.init({
|
||||||
print: false,
|
print: false,
|
||||||
dev: true,
|
dev: true,
|
||||||
level: "DEBUG",
|
level: "DEBUG",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { $ } from "bun"
|
|||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
import { Effect } from "effect"
|
import { Effect } from "effect"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A>(fn: (svc: Project.Interface) => Effect.Effect<A>) {
|
function run<A>(fn: (svc: Project.Interface) => Effect.Effect<A>) {
|
||||||
return Effect.runPromise(
|
return Effect.runPromise(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { NodePath } from "@effect/platform-node"
|
|||||||
import { AppFileSystem } from "@opencode-ai/shared/filesystem"
|
import { AppFileSystem } from "@opencode-ai/shared/filesystem"
|
||||||
import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"
|
import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
const encoder = new TextEncoder()
|
const encoder = new TextEncoder()
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Session as SessionNs } from "../../src/session"
|
|||||||
import { Log } from "../../src/util"
|
import { Log } from "../../src/util"
|
||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
||||||
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Log } from "../../src/util"
|
|||||||
import { resetDatabase } from "../fixture/db"
|
import { resetDatabase } from "../fixture/db"
|
||||||
import { provideInstance, tmpdir } from "../fixture/fixture"
|
import { provideInstance, tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
await resetDatabase()
|
await resetDatabase()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type { SessionID } from "../../src/session/schema"
|
|||||||
import { Log } from "../../src/util"
|
import { Log } from "../../src/util"
|
||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
||||||
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Session as SessionNs } from "../../src/session"
|
|||||||
import { Log } from "../../src/util"
|
import { Log } from "../../src/util"
|
||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
||||||
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { MessageID, PartID, type SessionID } from "../../src/session/schema"
|
|||||||
import { Log } from "../../src/util"
|
import { Log } from "../../src/util"
|
||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
||||||
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Instance } from "../../src/project/instance"
|
|||||||
import { Server } from "../../src/server/server"
|
import { Server } from "../../src/server/server"
|
||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
||||||
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { ProviderTest } from "../fake/provider"
|
|||||||
import { testEffect } from "../lib/effect"
|
import { testEffect } from "../lib/effect"
|
||||||
import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"
|
import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
||||||
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ beforeEach(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
state.server?.stop()
|
void state.server?.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
function createChatStream(text: string) {
|
function createChatStream(text: string) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { ModelID, ProviderID } from "../../src/provider/schema"
|
|||||||
import { Log } from "../../src/util"
|
import { Log } from "../../src/util"
|
||||||
|
|
||||||
const root = path.join(__dirname, "../..")
|
const root = path.join(__dirname, "../..")
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionNs.Service>) {
|
||||||
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
return Effect.runPromise(fx.pipe(Effect.provide(SessionNs.defaultLayer)))
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { provideTmpdirServer } from "../fixture/fixture"
|
|||||||
import { testEffect } from "../lib/effect"
|
import { testEffect } from "../lib/effect"
|
||||||
import { raw, reply, TestLLMServer } from "../lib/llm-server"
|
import { raw, reply, TestLLMServer } from "../lib/llm-server"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
const summary = Layer.succeed(
|
const summary = Layer.succeed(
|
||||||
SessionSummary.Service,
|
SessionSummary.Service,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import { provideTmpdirInstance, provideTmpdirServer } from "../fixture/fixture"
|
|||||||
import { testEffect } from "../lib/effect"
|
import { testEffect } from "../lib/effect"
|
||||||
import { reply, TestLLMServer } from "../lib/llm-server"
|
import { reply, TestLLMServer } from "../lib/llm-server"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
const summary = Layer.succeed(
|
const summary = Layer.succeed(
|
||||||
SessionSummary.Service,
|
SessionSummary.Service,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { SessionPrompt } from "../../src/session/prompt"
|
|||||||
import { Log } from "../../src/util"
|
import { Log } from "../../src/util"
|
||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function run<A, E>(fx: Effect.Effect<A, E, SessionPrompt.Service | Session.Service>) {
|
function run<A, E>(fx: Effect.Effect<A, E, SessionPrompt.Service | Session.Service>) {
|
||||||
return Effect.runPromise(
|
return Effect.runPromise(
|
||||||
@@ -316,7 +316,7 @@ describe("session.prompt regression", () => {
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
server.stop(true)
|
void server.stop(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ describe("session.prompt regression", () => {
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
server.stop(true)
|
void server.stop(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"
|
|||||||
import { provideTmpdirInstance } from "../fixture/fixture"
|
import { provideTmpdirInstance } from "../fixture/fixture"
|
||||||
import { testEffect } from "../lib/effect"
|
import { testEffect } from "../lib/effect"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
const env = Layer.mergeAll(
|
const env = Layer.mergeAll(
|
||||||
Session.defaultLayer,
|
Session.defaultLayer,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { AppRuntime } from "../../src/effect/app-runtime"
|
|||||||
import { tmpdir } from "../fixture/fixture"
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
const projectRoot = path.join(__dirname, "../..")
|
const projectRoot = path.join(__dirname, "../..")
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
function create(input?: SessionNs.CreateInput) {
|
function create(input?: SessionNs.CreateInput) {
|
||||||
return AppRuntime.runPromise(SessionNs.Service.use((svc) => svc.create(input)))
|
return AppRuntime.runPromise(SessionNs.Service.use((svc) => svc.create(input)))
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import * as CrossSpawnSpawner from "../../src/effect/cross-spawn-spawner"
|
|||||||
import { Ripgrep } from "../../src/file/ripgrep"
|
import { Ripgrep } from "../../src/file/ripgrep"
|
||||||
import { Format } from "../../src/format"
|
import { Format } from "../../src/format"
|
||||||
|
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
const mcp = Layer.succeed(
|
const mcp = Layer.succeed(
|
||||||
MCP.Service,
|
MCP.Service,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Instance } from "../../src/project/instance"
|
|||||||
import { MessageV2 } from "../../src/session/message-v2"
|
import { MessageV2 } from "../../src/session/message-v2"
|
||||||
|
|
||||||
const projectRoot = path.join(__dirname, "../..")
|
const projectRoot = path.join(__dirname, "../..")
|
||||||
Log.init({ print: false })
|
void Log.init({ print: false })
|
||||||
|
|
||||||
// Skip tests if no API key is available
|
// Skip tests if no API key is available
|
||||||
const hasApiKey = !!process.env.ANTHROPIC_API_KEY
|
const hasApiKey = !!process.env.ANTHROPIC_API_KEY
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ beforeAll(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
server?.stop()
|
void server?.stop()
|
||||||
await rm(cacheDir, { recursive: true, force: true })
|
await rm(cacheDir, { recursive: true, force: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export const createSseClient = <TData = unknown>({
|
|||||||
|
|
||||||
const abortHandler = () => {
|
const abortHandler = () => {
|
||||||
try {
|
try {
|
||||||
reader.cancel()
|
void reader.cancel()
|
||||||
} catch {
|
} catch {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export const createSseClient = <TData = unknown>({
|
|||||||
|
|
||||||
const abortHandler = () => {
|
const abortHandler = () => {
|
||||||
try {
|
try {
|
||||||
reader.cancel()
|
void reader.cancel()
|
||||||
} catch {
|
} catch {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const opencode = await createOpencode({
|
|||||||
console.log("✅ Opencode server ready")
|
console.log("✅ Opencode server ready")
|
||||||
|
|
||||||
const sessions = new Map<string, { client: any; server: any; sessionId: string; channel: string; thread: string }>()
|
const sessions = new Map<string, { client: any; server: any; sessionId: string; channel: string; thread: string }>()
|
||||||
;(async () => {
|
void (async () => {
|
||||||
const events = await opencode.client.event.subscribe()
|
const events = await opencode.client.event.subscribe()
|
||||||
for await (const event of events.stream) {
|
for await (const event of events.stream) {
|
||||||
if (event.type === "message.part.updated") {
|
if (event.type === "message.part.updated") {
|
||||||
@@ -29,7 +29,7 @@ const sessions = new Map<string, { client: any; server: any; sessionId: string;
|
|||||||
// Find the session for this tool update
|
// Find the session for this tool update
|
||||||
for (const [_sessionKey, session] of sessions.entries()) {
|
for (const [_sessionKey, session] of sessions.entries()) {
|
||||||
if (session.sessionId === part.sessionID) {
|
if (session.sessionId === part.sessionID) {
|
||||||
handleToolUpdate(part, session.channel, session.thread)
|
void handleToolUpdate(part, session.channel, session.thread)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export function BasicTool(props: BasicToolProps) {
|
|||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
contentRef.style.overflow = "hidden"
|
contentRef.style.overflow = "hidden"
|
||||||
heightAnim = animate(contentRef, { height: "auto" }, SPRING)
|
heightAnim = animate(contentRef, { height: "auto" }, SPRING)
|
||||||
heightAnim.finished.then(() => {
|
void heightAnim.finished.then(() => {
|
||||||
if (!contentRef || !open()) return
|
if (!contentRef || !open()) return
|
||||||
contentRef.style.overflow = "visible"
|
contentRef.style.overflow = "visible"
|
||||||
contentRef.style.height = "auto"
|
contentRef.style.height = "auto"
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
|
|||||||
// Force a refetch even if the value is unchanged.
|
// Force a refetch even if the value is unchanged.
|
||||||
// This is important for programmatic changes like Tab completion.
|
// This is important for programmatic changes like Tab completion.
|
||||||
if (prev === value) {
|
if (prev === value) {
|
||||||
refetch()
|
void refetch()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
queueMicrotask(() => refetch())
|
queueMicrotask(() => refetch())
|
||||||
|
|||||||
@@ -1158,7 +1158,7 @@ export function UserMessageDisplay(props: { message: UserMessage; parts: PartTyp
|
|||||||
onMouseDown={(e) => e.preventDefault()}
|
onMouseDown={(e) => e.preventDefault()}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
handleCopy()
|
void handleCopy()
|
||||||
}}
|
}}
|
||||||
aria-label={copied() ? i18n.t("ui.message.copied") : i18n.t("ui.message.copyMessage")}
|
aria-label={copied() ? i18n.t("ui.message.copied") : i18n.t("ui.message.copyMessage")}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import { IconButton } from "./icon-button"
|
|||||||
import { Tooltip } from "./tooltip"
|
import { Tooltip } from "./tooltip"
|
||||||
|
|
||||||
export interface TextFieldProps
|
export interface TextFieldProps
|
||||||
extends ComponentProps<typeof Kobalte.Input>,
|
extends
|
||||||
|
ComponentProps<typeof Kobalte.Input>,
|
||||||
Partial<
|
Partial<
|
||||||
Pick<
|
Pick<
|
||||||
ComponentProps<typeof Kobalte>,
|
ComponentProps<typeof Kobalte>,
|
||||||
@@ -75,7 +76,7 @@ export function TextField(props: TextFieldProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleClick() {
|
function handleClick() {
|
||||||
if (local.copyable) handleCopy()
|
if (local.copyable) void handleCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export function TextReveal(props: {
|
|||||||
requestAnimationFrame(() => setState("ready", true))
|
requestAnimationFrame(() => setState("ready", true))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fonts.ready.finally(() => {
|
void fonts.ready.finally(() => {
|
||||||
widen(win())
|
widen(win())
|
||||||
requestAnimationFrame(() => setState("ready", true))
|
requestAnimationFrame(() => setState("ready", true))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ function AnimatedHeading(props) {
|
|||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
measure()
|
measure()
|
||||||
document.fonts?.ready.finally(() => {
|
void document.fonts?.ready.finally(() => {
|
||||||
measure()
|
measure()
|
||||||
requestAnimationFrame(() => setState("ready", true))
|
requestAnimationFrame(() => setState("ready", true))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export function ToolErrorCard(props: ToolErrorCardProps) {
|
|||||||
onMouseDown={(e) => e.preventDefault()}
|
onMouseDown={(e) => e.preventDefault()}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
copy()
|
void copy()
|
||||||
}}
|
}}
|
||||||
aria-label={copied() ? i18n.t("ui.message.copied") : i18n.t("ui.toolErrorCard.copyError")}
|
aria-label={copied() ? i18n.t("ui.message.copied") : i18n.t("ui.toolErrorCard.copyError")}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export function ToolStatusTitle(props: {
|
|||||||
finish()
|
finish()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fonts.ready.finally(() => {
|
void fonts.ready.finally(() => {
|
||||||
measure()
|
measure()
|
||||||
finish()
|
finish()
|
||||||
})
|
})
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user