Declare the Claude agent-host view and share the view loader - #355
Merged
Merged
Conversation
The Claude SDK adapter declares its agent-host View from the probed install: node, the bridge bundle and the SDK's native claude as the closure, with their shared ELF loader and library directory when they are dynamic. The view Executor builds the workspace profile per Session from the request, lays out {config,home,tmp,xdg} in the Session home through one os.Root, sets a closed environment pointed at the gateway, takes MCP only from the Session and launches through ViewSession.Launch.
The runtime check reports the native binary's bundle-relative path, and the bridge requires capability_root only for skills. Provider credentials render as ANTHROPIC_API_KEY on every path.
viewloader.For reads the closure binaries' ELF headers and returns what a view adds for them: the interpreter's host directory as the lib closure mount, the interpreter overlay, empty masks over /etc/ld.so.preload and /etc/ld.so.cache, and the LD_LIBRARY_PATH value. Layouts it cannot present, and hosts other than Linux, return ErrUnsupportedOperation. The Claude SDK view now uses it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Claude Code adapter (
claudesdk) declares its agent-host view. This is lane L5-claude, built on the Runtime–HarnessViewdeclaration merged in #350. The PR also adds the sharedviewloaderpackage that every dynamic Harness binary uses. No view is launched yet: the agent-host library (L5a) and the end-to-end qualification (L7) follow.Shared loader (
apps/daemon/internal/agent/viewloader)viewloader.For(binaries...)reads the binaries' ELF headers and returns the view fragment that loads them only from the closure:libclosure mount;Execoverlay at itsPT_INTERPpath;/etc/ld.so.preloadand/etc/ld.so.cache;LD_LIBRARY_PATHvalue.If the binaries need different interpreters, or a library outside the interpreter's directory,
ForreturnsErrUnsupportedOperation, and the adapter declares no view. The Harness onboarding Executables rule names it. The MiniMax lane adopts it next.Claude view declaration
node(Node's directory),claude-sdk(the bundle root) and, for dynamic binaries, theviewloaderfragment.node, and the SDK's nativeclaude. The bridge's runtime check now reports the native path relative to the bundle (native_path), so the daemon does not repeat Node's module resolution.bash,rgandgit, with nops./etc/claude-code.CLAUDECODEandGIT_EDITOR.ViewProxyEnv.If building the view fails, discovery logs one line and leaves
Viewnil.Executor in a view
ViewSession.Launchin the request's workspace.PATHis the shim directory.HOME,TMPDIR,CLAUDE_CONFIG_DIRandXDG_RUNTIME_DIRare in the Session home.LD_LIBRARY_PATH, both cases of the proxy variables, andNO_PROXY=127.0.0.1,localhost.ANTHROPIC_API_KEYon every path. In a view that is the gateway placeholder.ANTHROPIC_AUTH_TOKENis never rendered.ViewSession.MCP, as gateway HTTP endpoints without a bearer token. A stdio binding returnsErrUnsupportedOperation. The bridge requirescapability_rootonly for skills, so HTTP MCP works without it.config,home,tmpandxdg, through oneos.Root. A link planted in the home fails preparation without being followed.Checks
TestViewExecutorLaunchesAClosedGatewayEnvironmentresolves the view through the registry. It checks the closed environment, the key variables and the planted-link refusal.TestForPresentsTheHostLoadercoversviewloader.go test ./apps/daemon/internal/agent/...;-raceonclaudesdkandviewloader;go vet ./apps/daemon/...;gofmt;pnpm run typecheckandpnpm test(170 passed).L7 qualification items are recorded separately. Among them: dlopen'd NSS, locale and gconv modules;
/bin/shfrom Node spawns; and presenting an empty/etc/ld.so.preloadwhen the sandbox has none.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.