fix(auth): opencode desktop server unauthorized bugfix on subagent spawn (#1399)

* fix(auth): opencode desktop server unauthorized bugfix on subagent spawn

* refactor(auth): add runtime guard and throw on SDK mismatch

- Add JSDoc with SDK API documentation reference
- Replace silent failure with explicit Error throw when OPENCODE_SERVER_PASSWORD is set but client structure is incompatible
- Add runtime type guard for SDK client structure
- Add tests for error cases (missing _client, missing setConfig)
- Remove unrelated bun.lock changes

Co-authored-by: dan-myles <dan-myles@users.noreply.github.com>

---------

Co-authored-by: YeonGyu-Kim <code.yeon.gyu@gmail.com>
Co-authored-by: dan-myles <dan-myles@users.noreply.github.com>
This commit is contained in:
dan
2026-02-03 20:07:02 -06:00
committed by GitHub
parent 2dc241cbbe
commit a7262000ff
4 changed files with 163 additions and 0 deletions
+2
View File
@@ -98,6 +98,7 @@ import {
getOpenCodeVersion,
isOpenCodeVersionAtLeast,
OPENCODE_NATIVE_AGENTS_INJECTION_VERSION,
injectServerAuthIntoClient,
} from "./shared";
import { loadPluginConfig } from "./plugin-config";
import { createModelCacheState } from "./plugin-state";
@@ -107,6 +108,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
log("[OhMyOpenCodePlugin] ENTRY - plugin loading", {
directory: ctx.directory,
});
injectServerAuthIntoClient(ctx.client);
// Start background tmux check immediately
startTmuxCheck();