Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeployAll ¶
DeployAll extracts all embedded skill directories under baseDir. Each skill is deployed to baseDir/<skill-name>/. Files are only written when their content differs from the embedded version.
baseDir is entirely the caller's choice and this package makes no claim about where it lives — which is why the errors below quote the path and say nothing else about it. They used to read "workspace HOME %q ...", from the era when this package had exactly one caller and that caller passed a workspace HOME; PR3 of docs/plans/workspace-home-volume-persistence.md moved the destination to <RuntimesDir>/skills and left the message behind, pointing a reader of a failed job's Output at a directory unrelated to the failure. A general-purpose package naming its caller's layout is the bug, not merely the stale value.
There is no longer a daemon-side production caller at all: the sandbox skill set reaches a job by being baked into the runner image at build time (build/container/Dockerfile copies internal/skills/data to /opt/boid/skills) and symlinked into the workspace home by the init container. What still calls in here is the HOST-skill sibling (DeployHostSkills, deploy_host.go) behind `boid install-skills`.
Every write below goes through the symlink-safe, fd-relative helpers in safe_deploy.go rather than string-path-based os.MkdirAll/os.CreateTemp/ os.Rename. That hardening was originally required because baseDir *was* workspace HOME's `.claude/skills`, rw bind mounted into every sandbox dispatched against the workspace (PR #789 review, 2026-07-17). It is retained rather than unwound now that the default caller's baseDir is out of reach of any job: the same helpers also serve MkdirAllNoSymlink, whose caller DOES write into the job-owned workspace HOME, and nothing about them costs anything on a directory jobs cannot reach. A future caller is therefore free to point baseDir at attacker-writable storage again without re-deriving the threat model.
func DeployHostSkills ¶ added in v0.2.0
DeployHostSkills extracts the embedded host skill directories under baseDir, same idempotent/content-diff-only-write contract as DeployAll (see deploy.go's doc comment) — it shares the same underlying deployAllFrom/deploySkillDir machinery, just pointed at hostSkillsFS's "hostdata" root instead of skillsFS's "data" root.
func EmbeddedSkillNames ¶ added in v0.0.6
func EmbeddedSkillNames() []string
EmbeddedSkillNames returns the slugs of the embedded skill directories in stable lexical order. dispatcher uses it to compute the claude-side ~/.claude/skills/<name> bind targets without hard-coding the list — both the mkdir of those targets inside the workspace HOME and the per-skill read-only mounts homeMounts declares (internal/dispatcher/ skills_overlay.go and sandbox_builder.go).
The caller was the claude/codex/opencode adapters' Bindings() until Phase 4 PR3 (docs/plans/home-workspace-volume.md) retired those to nil and switched to a copy-sync; this function then sat with no callers at all until PR3 of docs/plans/workspace-home-volume-persistence.md moved skill delivery back to bind mounts, declared by the dispatcher rather than by an adapter.
func HostSkillNames ¶ added in v0.2.0
func HostSkillNames() []string
HostSkillNames returns the slugs of the embedded host skill directories in stable lexical order. Used only by `boid install-skills` to report what it installed — unlike EmbeddedSkillNames, nothing in internal/dispatcher consults this.
func MkdirAllNoSymlink ¶ added in v0.1.0
MkdirAllNoSymlink creates dir and every missing component leading to it, using the same symlink-refusing openat2 walk DeployAll writes through (see this file's package comment for the threat model), and reports the uid that owns the resulting directory. dir must be absolute; creating an already-existing directory is a no-op.
It exists for PR3 of docs/plans/workspace-home-volume-persistence.md (論点 e-2 決定 D3): the dispatcher stops copy-syncing skill CONTENT into the workspace HOME and instead bind-mounts each embedded skill in from a host-visible runtime dir, so it has to pre-create the bind TARGETS (<home>/.claude and <home>/.claude/skills/<name>) itself — the directories DeployAll's own walk used to create as a side effect of writing there. A missing bind target would otherwise be auto-created by the container engine as uid 0, which locks the uid 1000 harness out of ~/.claude/.credentials.json (measured; see the plan doc's 論点 b-2).
Those targets sit inside a directory the job owns read-write, which is precisely why this is not an os.MkdirAll: a job that leaves ~/.claude behind as a symlink must not turn the next dispatch's mkdir into a write somewhere else on the daemon's filesystem.
The returned uid answers the question a bare mkdir cannot: "is the directory now at this path one I own, or one somebody else created first?" A caller that pre-creates a bind target inside job-owned storage needs that — an EEXIST is indistinguishable from success otherwise, and a target already created by the engine as uid 0 is not repairable afterwards (see internal/dispatcher/skills_overlay.go, the caller that acts on it, for why that is the outcome worth failing on). It is deliberately a plain uid rather than a bool: this package cannot know which uid its caller considers its own, and hard-coding one (1000) would be wrong on any deploy that runs the daemon as some other user.
It is read with fstat(2) on the descriptor the walk ended on, never a stat by path. A stat by path would re-resolve every component from scratch, so it could report the owner of a directory other than the one just created or entered — exactly the check-then-use gap this file's openat2 design exists to remove. Doing the ownership check through such a gap would make the check itself the race.
No separate "is it a directory" result is returned because there is nothing left to report: every component of the walk is opened with O_DIRECTORY (see openOrCreateDirNoSymlink), so a non-directory at any position — a plain file left at ~/.claude, say — fails the call outright with ENOTDIR rather than reaching this return. internal/dispatcher's TestDispatch_SkillsBindTargetPrepFails_MarksJobFailedAndCallsCleanup pins that end of it.
Types ¶
This section is empty.