chore(opencode): move the typed OpenCode SDK to the 2.1.2 pin

The runtime pin moved to 2.1.2 while @opencode/client stayed at 2.0.15, so
the shared typed contract no longer matched the server.

- @opencode/client and @opencode/plugin move to 2.1.2
- session projection follows the 2.1 event shape (native replaces
  providerState and state, compaction drops recent)
- worktree error stubs carry the _tag discriminator
- the contract test fails when the SDK version drifts from the pin
This commit is contained in:
Chris Scott committed 2026-10-23 15:45:36 -04:00
1 parent 0c4c024dcc
commit 20017d2f7d
8 files changed
+294 -354

No files matched your search

@@ -26,6 +26,10 @@ interface CapturedRequest {
headers: Record<string, string>
}
interface PackageManifest {
dependencies: Record<string, string>
}
function createFetchSpy() {
const calls: CapturedRequest[] = []
const fetchSpy = (async (input: Parameters<typeof fetch>[0], init?: Parameters<typeof fetch>[1]) => {
@@ -145,6 +149,13 @@ describe('OpenCode v2 contract', () => {
expect(dockerfile).toMatch(/^ENV OPENCODE_BUNDLED_VERSION=\$\{OPENCODE_VERSION\}$/m)
})
it('keeps the shared SDK dependency in sync with the pin', () => {
const manifest = JSON.parse(
readFileSync(join(REPO_ROOT, 'shared', 'package.json'), 'utf8'),
) as PackageManifest
expect(manifest.dependencies['@opencode/client']).toBe(OPENCODE_PINNED_VERSION)
})
it('makes the shell scripts derive the pin from the Dockerfile or the bundled version instead of hardcoding it', () => {
const entrypoint = readFileSync(join(REPO_ROOT, 'scripts', 'docker-entrypoint.sh'), 'utf8')
const setupDev = readFileSync(join(REPO_ROOT, 'scripts', 'setup-dev.sh'), 'utf8')