返回 DeepSeek-Reasonix
doc.go
1 // Package extension is the unified extension kernel: every capability the
2 // runtime exposes — tools, skills, commands, prompts, hooks, MCP servers,
3 // providers, themes, interceptors, and replacement slots — is modeled as a
4 // Contribution with explicit provenance, assembled by a deterministic Builder
5 // into an immutable RuntimeSnapshot.
6 //
7 // The kernel exists so that shadowing, conflicts, and ordering stop being
8 // emergent side effects of whichever discovery path ran last. Discovery still
9 // lives in the existing packages (internal/skill, internal/command,
10 // internal/hook, internal/tool, internal/plugin, internal/provider); the
11 // adapters in adapters.go only wrap that discovery in the Contributor
12 // interface. Winner rules are resolved here, once, identically for every
13 // caller: a higher-tier scope shadows a lower one for the same canonical ID,
14 // same-tier duplicates from different sources are hard conflicts instead of
15 // silent overrides, and hooks/interceptors stay additive. Callers assembling
16 // pre-kernel legacy resources (boot) can opt into ConflictCollect, which
17 // records such conflicts on the snapshot's Diagnostics and keeps the
18 // deterministic winner instead of failing the build; v1 extensions keep the
19 // default ConflictFail.
20 //
21 // A RuntimeSnapshot is immutable after Freeze: every accessor returns
22 // defensive copies, so a snapshot can be shared across turns, subagents, and
23 // frontends without locking. CacheHash fingerprints exactly the
24 // provider-visible prefix state (system prompt + canonical tool schemas), so
25 // a snapshot rebuild that changes nothing observable reuses the same hash and
26 // preserves provider-side prompt caching.
27 package extension
28
28 lines GO