3.0 KiB
Source Internals
This document covers application acquisition and the restricted HTTP artifact reader. Configuration owns field/discovery/composition contracts; the PromptKit formats own framework resources and execution semantics.
Application Boundary And Engine Construction
internal/config.Load selects an explicit File or the ordered native SearchConfig
presets, prepares the selected source with native secrets bootstrap, and performs
one layered ConfigKit load with imports, overlay selection, explicit overrides,
and the bundled underlay. It returns the actual Result and bootstrap report.
Definition callbacks supply application defaults, record actual path/address
normalizations through ConfigKit, and validate retry/HTTP-size domains. PromptKit
composes its settings rules into the same typed definition.
engine.go passes the completed result to PromptKit's NewFromConfig along
with the application retry setting and any runtime options. It performs no
second load, projection, or source-list expansion.
Framework imports resolve within the native source context. Message resources are captured from their defining contexts at engine construction. Schema and request-artifact acquisition retain their preparation-time behavior. Independent collection checkouts are discovered by native file import globs, not application traversal. New invocations reload normally; a server retains its single engine until restart.
Both configuration scopes inspect the completed shared document without constructing an engine. The focused view retains native whole-load evidence. The CLI adapter forwards bootstrap reports separately; there is no per-invocation engine/config cache or cross-invocation snapshot guarantee.
Restricted HTTP Artifact Reader
The HTTP adapter implements promptkit.ArtifactReader; server construction
injects it through the public option. Ordinary CLI artifact loading remains
upstream-owned.
The reader accepts inline content without a root. File references need a root; relative paths resolve below it and absolute paths must be lexically contained. Traversal outside is rejected and the configured file byte limit applies, with zero unlimited. Reads preserve native artifact metadata and honor cancellation.
Containment does not resolve symlinks. The OS may follow a symlink inside the root to an outside target; this is not a filesystem sandbox or a defense against privileged concurrent filesystem modification. Reader errors retain identity through upstream artifact-load wrapping, enabling the existing HTTP mapping.
The HTTP API owns outcomes and operations owns safe root/permission selection. Configuration, CLI acquisition/engine, and HTTP reader/handler tests own their respective boundaries; upstream owns exhaustive source traversal, format parsing, ordinary artifacts, and inspection semantics.