Skip to content

feat(sdk): configure external workspace providers - #42142

Merged
kitlangton merged 1 commit into
v2from
workspace-provider-sdk
Aug 12, 2026
Merged

kitlangton merged 1 commit into
v2from
workspace-provider-sdk

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Allow SDK Next embedders to supply provider-wide workspace infrastructure at host construction time:

const openCodeLayer = OpenCodeWorkerd.layer({
  storage,
  workspaceProviders: {
    modal: WorkerdModalWorkspace.make({ namespace: env.WORKSPACE_DO }),
  },
})

The typed SDK facade now exposes explicit workspace lifecycle operations:

const opencode = yield* OpenCode.Service
const workspace = yield* opencode.workspace.create({ provider: "modal" })
yield* opencode.workspace.destroy({ workspaceID: workspace.id })

How

  • Adds workspaceProviders to normal and Workerd SDK Next create/layer options.
  • Installs supplied drivers through the existing WorkspaceDriver.registryNode replacement seam only when providers are supplied.
  • Retains Workspace.Service in embedded route graphs and projects only create and destroy onto the typed OpenCode.Service facade.
  • Keeps standard server composition on the existing empty workspace registry.
  • Re-exports the canonical Schema Workspace namespace from SDK Next.
  • Removes the built-in Node Modal workspace/environment implementation and its tests. Concrete providers now come from the embedder.
  • Removes the now-unused modal server dependency and lockfile entries.

Scope

  • No arbitrary Core service exposure.
  • No workspace connect facade; Location boot remains responsible for connecting placement.
  • No provider-specific per-workspace options.
  • No atomic workspace plus session API.
  • No SDK plugin changes; tools, personas, agents, and hooks remain per-Location plugins.
  • No Protocol or Server HttpApi changes, so generated clients are unchanged.

Testing

  • cd packages/sdk-next && bun typecheck && bun run test (15 passed)
  • cd packages/server && bun typecheck && bun run test (22 passed)
  • cd packages/core && bun run test test/workspace.test.ts && bun typecheck (2 focused workspace tests passed)
  • cd packages/workerd-spike && bun run test (6 passed in the real Workerd runtime)
  • Commit hook: bun turbo typecheck --concurrency=3 (32 package tasks passed)
  • bunx prettier --check ... for all changed text files
  • git diff --check

The SDK tests verify externally supplied fake driver creation, persisted provider binding, session placement at the returned workspace ID, delegated destruction and durable removal, and preservation of the typed WorkspaceDriver.ProviderNotFound error outside HTTP.

@kitlangton
kitlangton merged commit bc2251d into v2 Aug 12, 2026
10 checks passed
@kitlangton
kitlangton deleted the workspace-provider-sdk branch August 12, 2026 20:47
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant