Skip to content

Commit 7464e55

Browse files
committed
refactor(opencode): remove experimental telemetry
- Remove experimental_telemetry from agent config - Remove telemetry from LSP initialization - Remove openTelemetry from Config type - Clean up unused imports in TUI components
1 parent 34d103e commit 7464e55

12 files changed

Lines changed: 40 additions & 48 deletions

File tree

packages/opencode/src/agent/agent.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,6 @@ export namespace Agent {
291291
const existing = await list()
292292

293293
const params = {
294-
experimental_telemetry: {
295-
isEnabled: cfg.experimental?.openTelemetry,
296-
metadata: {
297-
userId: cfg.username ?? "unknown",
298-
},
299-
},
300294
temperature: 0.3,
301295
messages: [
302296
...system.map(

packages/opencode/src/cli/cmd/tui/app.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,6 @@ function App() {
257257
}
258258
const [terminalTitleEnabled, setTerminalTitleEnabled] = createSignal(kv.get("terminal_title_enabled", true))
259259

260-
createEffect(() => {
261-
console.log(JSON.stringify(route.data))
262-
})
263-
264260
// Update terminal window title based on current route and session
265261
createEffect(() => {
266262
if (!terminalTitleEnabled() || Flag.OPENCODE_DISABLE_TERMINAL_TITLE) return

packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@ import type { BoxRenderable, TextareaRenderable, KeyEvent, ScrollBoxRenderable }
22
import { pathToFileURL } from "bun"
33
import fuzzysort from "fuzzysort"
44
import { firstBy } from "remeda"
5-
import { createMemo, createResource, createEffect, onMount, onCleanup, Index, Show, createSignal } from "solid-js"
5+
import {
6+
createMemo,
7+
createResource,
8+
createEffect,
9+
onMount,
10+
onCleanup,
11+
Index,
12+
Show,
13+
createSignal,
14+
batch,
15+
} from "solid-js"
616
import { createStore } from "solid-js/store"
717
import { useSDK } from "@tui/context/sdk"
818
import { useSync } from "@tui/context/sync"
@@ -100,7 +110,7 @@ export function Autocomplete(props: {
100110
lastPos = { x: anchor.x, y: anchor.y, width: anchor.width }
101111
setPositionTick((t) => t + 1)
102112
}
103-
}, 50)
113+
}, 250)
104114

105115
onCleanup(() => clearInterval(interval))
106116
}

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import { BoxRenderable, TextareaRenderable, MouseEvent, PasteEvent, t, dim, fg } from "@opentui/core"
2-
import { createEffect, createMemo, type JSX, onMount, createSignal, onCleanup, on, Show, Switch, Match } from "solid-js"
2+
import {
3+
createEffect,
4+
createMemo,
5+
type JSX,
6+
onMount,
7+
createSignal,
8+
onCleanup,
9+
on,
10+
Show,
11+
Switch,
12+
Match,
13+
batch,
14+
} from "solid-js"
315
import "opentui-spinner/solid"
416
import path from "path"
517
import { Filesystem } from "@/util/filesystem"
@@ -62,6 +74,7 @@ export function Prompt(props: PromptProps) {
6274
let input: TextareaRenderable
6375
let anchor: BoxRenderable
6476
let autocomplete: AutocompleteRef
77+
let contentChangeTimeout: ReturnType<typeof setTimeout> | undefined
6578

6679
const keybind = useKeybind()
6780
const local = useLocal()
@@ -78,6 +91,12 @@ export function Prompt(props: PromptProps) {
7891
const { theme, syntax } = useTheme()
7992
const kv = useKV()
8093

94+
onMount(() => {
95+
onCleanup(() => {
96+
if (contentChangeTimeout) clearTimeout(contentChangeTimeout)
97+
})
98+
})
99+
81100
function promptModelWarning() {
82101
toast.show({
83102
variant: "warning",
@@ -827,8 +846,11 @@ export function Prompt(props: PromptProps) {
827846
onContentChange={() => {
828847
const value = input.plainText
829848
setStore("prompt", "input", value)
830-
autocomplete.onInput(value)
831-
syncExtmarksWithPromptParts()
849+
if (contentChangeTimeout) clearTimeout(contentChangeTimeout)
850+
contentChangeTimeout = setTimeout(() => {
851+
autocomplete.onInput(value)
852+
syncExtmarksWithPromptParts()
853+
}, 250)
832854
}}
833855
keyBindings={textareaKeybindings()}
834856
onKeyDown={async (e) => {

packages/opencode/src/cli/cmd/tui/context/route.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const { use: useRoute, provider: RouteProvider } = createSimpleContext({
3131
return store
3232
},
3333
navigate(route: Route) {
34-
console.log("navigate", route)
3534
setStore(route)
3635
},
3736
}

packages/opencode/src/cli/cmd/tui/context/sdk.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ export const { use: useSDK, provider: SDKProvider } = createSimpleContext({
5252
const elapsed = Date.now() - last
5353

5454
if (timer) return
55-
// If we just flushed recently (within 16ms), batch this with future events
55+
// If we just flushed recently (within 100ms), batch this with future events
5656
// Otherwise, process immediately to avoid latency
57-
if (elapsed < 16) {
58-
timer = setTimeout(flush, 16)
57+
if (elapsed < 100) {
58+
timer = setTimeout(flush, 100)
5959
return
6060
}
6161
flush()

packages/opencode/src/cli/cmd/tui/context/theme.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,11 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
317317
onMount(init)
318318

319319
function resolveSystemTheme() {
320-
console.log("resolveSystemTheme")
321320
renderer
322321
.getPalette({
323322
size: 16,
324323
})
325324
.then((colors) => {
326-
console.log(colors.palette)
327325
if (!colors.palette[0]) {
328326
if (store.active === "system") {
329327
setStore(

packages/opencode/src/cli/cmd/tui/util/clipboard.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export namespace Clipboard {
7777
const os = platform()
7878

7979
if (os === "darwin" && Bun.which("osascript")) {
80-
console.log("clipboard: using osascript")
8180
return async (text: string) => {
8281
const escaped = text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')
8382
await $`osascript -e 'set the clipboard to "${escaped}"'`.nothrow().quiet()
@@ -86,7 +85,6 @@ export namespace Clipboard {
8685

8786
if (os === "linux") {
8887
if (process.env["WAYLAND_DISPLAY"] && Bun.which("wl-copy")) {
89-
console.log("clipboard: using wl-copy")
9088
return async (text: string) => {
9189
const proc = Process.spawn(["wl-copy"], { stdin: "pipe", stdout: "ignore", stderr: "ignore" })
9290
if (!proc.stdin) return
@@ -96,7 +94,6 @@ export namespace Clipboard {
9694
}
9795
}
9896
if (Bun.which("xclip")) {
99-
console.log("clipboard: using xclip")
10097
return async (text: string) => {
10198
const proc = Process.spawn(["xclip", "-selection", "clipboard"], {
10299
stdin: "pipe",
@@ -110,7 +107,6 @@ export namespace Clipboard {
110107
}
111108
}
112109
if (Bun.which("xsel")) {
113-
console.log("clipboard: using xsel")
114110
return async (text: string) => {
115111
const proc = Process.spawn(["xsel", "--clipboard", "--input"], {
116112
stdin: "pipe",
@@ -126,9 +122,7 @@ export namespace Clipboard {
126122
}
127123

128124
if (os === "win32") {
129-
console.log("clipboard: using powershell")
130125
return async (text: string) => {
131-
// Pipe via stdin to avoid PowerShell string interpolation ($env:FOO, $(), etc.)
132126
const proc = Process.spawn(
133127
[
134128
"powershell.exe",
@@ -151,7 +145,6 @@ export namespace Clipboard {
151145
}
152146
}
153147

154-
console.log("clipboard: no native support")
155148
return async (text: string) => {
156149
await clipboardy.write(text).catch(() => {})
157150
}

packages/opencode/src/config/config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,10 +1150,6 @@ export namespace Config {
11501150
.object({
11511151
disable_paste_summary: z.boolean().optional(),
11521152
batch_tool: z.boolean().optional().describe("Enable the batch tool"),
1153-
openTelemetry: z
1154-
.boolean()
1155-
.optional()
1156-
.describe("Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)"),
11571153
primary_tools: z
11581154
.array(z.string())
11591155
.optional()

packages/opencode/src/lsp/server.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,11 +1542,6 @@ export namespace LSPServer {
15421542
})
15431543
return {
15441544
process: proc,
1545-
initialization: {
1546-
telemetry: {
1547-
enabled: false,
1548-
},
1549-
},
15501545
}
15511546
},
15521547
}

0 commit comments

Comments
 (0)