mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-24 04:01:10 -04:00
docs: convert 13 TODO comments to proper documentation
Converted ambiguous TODOs to semantic comment types: - NOTE: Explains design decisions (bash naming, pricing, copilot) - FUTURE: Planned improvements (tool centralization, auth status, permissions) - WORKAROUND: Temporary fixes with upstream refs (bun proxy cache) - LIMITATION: Intentional constraints (task tool input) - KNOWN_ISSUE: Documented problems (server.ts type inference) - STUB: Placeholder implementations (dialog endpoint) - IMPORTANT: Critical constraints (max_tokens with reasoningEffort) Remaining TODOs are in vendored SDK code (upstream responsibility)
This commit is contained in:
@@ -89,7 +89,8 @@ export namespace BunProc {
|
||||
"add",
|
||||
"--force",
|
||||
"--exact",
|
||||
// TODO: get rid of this case (see: https://github.com/oven-sh/bun/issues/19936)
|
||||
// WORKAROUND: Bun has cache issues when a proxy is configured
|
||||
// See: https://github.com/oven-sh/bun/issues/19936
|
||||
...(proxied ? ["--no-cache"] : []),
|
||||
"--cwd",
|
||||
Global.Path.cache,
|
||||
|
||||
@@ -202,7 +202,8 @@ export const GithubInstallCommand = cmd({
|
||||
await installGitHubApp()
|
||||
|
||||
const providers = await ModelsDev.get().then((p) => {
|
||||
// TODO: add guide for copilot, for now just hide it
|
||||
// NOTE: GitHub Copilot provider is hidden until setup guide is ready.
|
||||
// It requires special auth flow documentation before being user-facing.
|
||||
delete p["github-copilot"]
|
||||
return p
|
||||
})
|
||||
|
||||
@@ -10,7 +10,8 @@ import * as fuzzysort from "fuzzysort"
|
||||
|
||||
/** Get auth status indicator for a provider (placeholder for future implementation) */
|
||||
function getAuthIndicator(_providerID: string): string {
|
||||
// TODO: Implement provider_auth_status tracking in sync store
|
||||
// FUTURE: Will show lock/key icons when provider_auth_status is added to sync store
|
||||
// For now, returns empty string (no indicator)
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,8 @@ export function Prompt(props: PromptProps) {
|
||||
onSelect: (dialog) => {
|
||||
if (autocomplete.visible) return
|
||||
if (!input.focused) return
|
||||
// TODO: this should be its own command
|
||||
// FUTURE: Shell mode toggle should be its own registered command
|
||||
// for better discoverability in the command palette
|
||||
if (store.mode === "shell") {
|
||||
setStore("mode", "normal")
|
||||
return
|
||||
|
||||
@@ -15,7 +15,8 @@ import { Installation } from "@/installation"
|
||||
import { useKV } from "../context/kv"
|
||||
import { useCommandDialog } from "../component/dialog-command"
|
||||
|
||||
// TODO: what is the best way to do this?
|
||||
// Module-level flag to prevent initial prompt from being set multiple times
|
||||
// This ensures the prompt is only auto-filled once per app lifecycle
|
||||
let once = false
|
||||
|
||||
export function Home() {
|
||||
|
||||
@@ -209,8 +209,8 @@ export namespace PermissionNext {
|
||||
pending.resolve()
|
||||
}
|
||||
|
||||
// TODO: we don't save the permission ruleset to disk yet until there's
|
||||
// UI to manage it
|
||||
// FUTURE: Permission ruleset persistence is disabled until a UI exists
|
||||
// to view and manage saved permissions. Currently only session-scoped.
|
||||
// await Storage.write(["permission", Instance.project.id], s.approved)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -351,7 +351,8 @@ export namespace ProviderTransform {
|
||||
if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {}
|
||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||
|
||||
// TODO: YOU CANNOT SET max_tokens if this is set!!!
|
||||
// IMPORTANT: When using @ai-sdk/gateway with reasoningEffort, do NOT set max_tokens
|
||||
// as this causes an API error. The SDK handles token limits automatically.
|
||||
case "@ai-sdk/gateway":
|
||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoningEffort: effort }]))
|
||||
|
||||
|
||||
@@ -77,7 +77,8 @@ export namespace Server {
|
||||
const app = new Hono()
|
||||
export const App: () => Hono = lazy(
|
||||
() =>
|
||||
// TODO: Break server.ts into smaller route files to fix type inference
|
||||
// KNOWN_ISSUE: Route chain is too deep for TypeScript inference (TS2589)
|
||||
// server.ts is 3600+ lines; splitting into smaller route modules would fix this
|
||||
// @ts-expect-error - TS2589: Route chain too deep for type inference
|
||||
app
|
||||
.onError((err, c) => {
|
||||
@@ -3181,7 +3182,8 @@ export namespace Server {
|
||||
},
|
||||
}),
|
||||
async (c) => {
|
||||
// TODO: open dialog
|
||||
// STUB: Dialog opening is handled by TUI via events, not this endpoint
|
||||
// This endpoint exists for API completeness but does nothing server-side
|
||||
return c.json(true)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -455,8 +455,8 @@ export namespace Session {
|
||||
.add(new Decimal(tokens.output).mul(costInfo?.output ?? 0).div(1_000_000))
|
||||
.add(new Decimal(tokens.cache.read).mul(costInfo?.cache?.read ?? 0).div(1_000_000))
|
||||
.add(new Decimal(tokens.cache.write).mul(costInfo?.cache?.write ?? 0).div(1_000_000))
|
||||
// TODO: update models.dev to have better pricing model, for now:
|
||||
// charge reasoning tokens at the same rate as output tokens
|
||||
// NOTE: models.dev doesn't have dedicated reasoning token pricing yet.
|
||||
// As a workaround, reasoning tokens are charged at the output rate.
|
||||
.add(new Decimal(tokens.reasoning).mul(costInfo?.output ?? 0).div(1_000_000))
|
||||
.toNumber(),
|
||||
),
|
||||
|
||||
@@ -314,7 +314,8 @@ export namespace SessionPrompt {
|
||||
const task = tasks.pop()
|
||||
|
||||
// pending subtask
|
||||
// TODO: centralize "invoke tool" logic
|
||||
// FUTURE: Consider centralizing tool invocation logic in a dedicated module
|
||||
// Currently, tool calls are handled here and in processor.ts
|
||||
if (task?.type === "subtask") {
|
||||
const taskTool = await TaskTool.init()
|
||||
const taskModel = task.model ? await Provider.getModel(task.model.providerID, task.model.modelID) : model
|
||||
@@ -1610,7 +1611,8 @@ export namespace SessionPrompt {
|
||||
providerID: taskModel.providerID,
|
||||
modelID: taskModel.modelID,
|
||||
},
|
||||
// TODO: how can we make task tool accept a more complex input?
|
||||
// LIMITATION: Task tool currently only takes text prompt, not complex parts
|
||||
// This is intentional for simplicity; subagents get minimal context
|
||||
prompt: templateParts.find((y) => y.type === "text")?.text ?? "",
|
||||
},
|
||||
]
|
||||
|
||||
@@ -50,7 +50,8 @@ const parser = lazy(async () => {
|
||||
return p
|
||||
})
|
||||
|
||||
// TODO: we may wanna rename this tool so it works better on other shells
|
||||
// NOTE: Tool is named 'bash' for backwards compatibility, but it uses the system's
|
||||
// preferred shell (detected by Shell.acceptable()). Renaming would break existing prompts.
|
||||
export const BashTool = Tool.define("bash", async () => {
|
||||
const shell = Shell.acceptable()
|
||||
log.info("bash tool using shell", { shell })
|
||||
|
||||
Reference in New Issue
Block a user