2026-07-28 00:45:50 +00:00
# Internal Component Overview
## Purpose
2026-07-28 02:13:48 +00:00
This document inventories Promptkit's implemented components for contributors.
The [architecture policy ](../policy/architecture.md ) owns durable boundary and
dependency rules. See the [development guide ](../development.md ) for
contributor workflow and validation.
2026-07-28 00:45:50 +00:00
2026-07-28 02:13:48 +00:00
## Implemented Components
2026-07-28 00:45:50 +00:00
| Component | Implemented responsibility | References |
| --- | --- | --- |
2026-09-23 17:11:09 +00:00
| Root `promptkit` package | Provides the supported engine facade, source, backend-registration, and injection options, public request, result, prompt-inspection, profile-inspection, and ordinary-run observation values, opaque prepared-execution handles, profile construction, extension interfaces, value conversion, redacted formatting, and typed capacity and generation error mapping. | [Package GoDoc ](../../doc.go ), [observations ](../../observations.go ), [prepared execution ](../../prepared_execution.go ), [backend API ](../../backends.go ), [engine facade ](../../engine.go ) |
2026-07-28 04:53:51 +00:00
| `examples/go-library/prepare` | Demonstrates an offline downstream consumer using a prompt file, in-memory profile, inline input, and `Prepare` . It is not a public library package. | [Example program ](../../examples/go-library/prepare/main.go ) |
2026-07-29 14:13:52 +00:00
| `examples/go-library/run` | Demonstrates an offline downstream consumer using a prompt file, in-memory profile, inline input, an injected deterministic model client, and `Run` . It is not a public library package. | [Example program ](../../examples/go-library/run/main.go ) |
2026-08-26 15:04:50 +00:00
| `internal/backend` | Constructs each engine's immutable registry from maintained definitions and consumer additions, validates and defensively copies definitions through the shared JSON-value package, and consumes the LLM-owned OpenAI-compatible reserved request-field rule. | [Backend registry ](../../internal/backend/registry.go ) |
2026-08-26 16:51:31 +00:00
| `internal/catalog` | Strictly validates imported immutable maintained backend and profile catalog assets before engine assembly uses them. | [Catalog adapter ](../../internal/catalog/catalog.go ), [internal sources ](sources.md#profiles-and-built-ins ) |
2026-07-30 18:27:03 +00:00
| `internal/capacity` | Owns engine-local bounded execution admission and FIFO model-generation permits for limited backend IDs, including cancellation-safe waiter removal and client wrapping. | [Internal capacity management ](capacity.md ) |
2026-08-11 23:38:45 +00:00
| `internal/domain` | Defines internal framework values for requests, artifacts, prompt definitions, profiles, execution targets, rendering, generation, and validation, and owns source-neutral invariants for shared execution settings, OpenAI-compatible base endpoints, session identifiers, and output contracts. Source parsing, required fields, other source-specific normalization, defaulting, and boundary-specific error classification remain with their callers. | [Domain declarations ](../../internal/domain/domain.go ), [endpoint invariant ](../../internal/domain/endpoint.go ) |
2026-09-22 12:23:07 +00:00
| `internal/engine` | Assembles external catalogs, Promptkit-owned profiles, repositories, registry, capacity, collaborators, repairer, and the one use-case runner for each engine instance. | [Engine assembly ](../../internal/engine/engine.go ), [internal sources ](sources.md#profiles-and-built-ins ), [internal runner ](runner.md ) |
2026-09-23 16:56:20 +00:00
| `internal/generation` | Coordinates frozen built-in HTTP attempts and one-shot injected calls through active backend permits, including bounded status retries and cancellable backoff. | [Internal generation coordination ](generation.md ) |
2026-07-28 04:14:28 +00:00
| `internal/defaults` | Defines application-neutral framework constants and constructs the default execution target. It contains no CLI, server, or inbound HTTP limits. | [Framework defaults ](../../internal/defaults/defaults.go ) |
| `internal/filecatalog` | Provides deterministic YAML discovery and path helpers for operating-system filesystems and `fs.FS` sources. | [File catalog ](../../internal/filecatalog/catalog.go ) |
2026-08-11 21:32:24 +00:00
| `internal/jsonvalue` | Validates and deeply copies bounded JSON-compatible extra-parameter and prepared-schema trees while preserving supported concrete value types and rejecting cycles or excessive depth and work. | [JSON values ](../../internal/jsonvalue/jsonvalue.go ) |
2026-07-28 04:53:51 +00:00
| `internal/promptdef` | Loads strictly decoded, validated prompt definitions from filesystem and `fs.FS` sources, including version selection and contained file-backed message content. | [Framework formats ](../formats.md ), [prompt-definition repository ](../../internal/promptdef/filesystem_repository.go ) |
2026-09-22 04:30:02 +00:00
| `internal/profile` | Owns immutable in-memory and filesystem profile repositories, local profile validation, raw-source overlays with error-preserving fallback, and inherited-profile resolution. | [Framework formats ](../formats.md ), [profile repositories ](../../internal/profile/filesystem_repository.go ), [internal sources ](sources.md#profiles-and-built-ins ) |
2026-07-28 04:18:09 +00:00
| `internal/prompt` | Renders prompt messages from Go templates with artifact, variable, session, and cache-control data. | [Go-template renderer ](../../internal/prompt/go_renderer.go ) |
2026-07-28 04:23:50 +00:00
| `internal/artifact` | Resolves ordinary inline and unrestricted caller-selected file references into copied artifacts with metadata and hashes. | [Internal sources and validation ](sources.md ) |
2026-08-11 23:05:11 +00:00
| `internal/validate` | Validates basic, JSON, and JSON Schema output using operating-system filesystem or `fs.FS` schema sources and creates operation-local validation plans with canonical contained schema resources. | [Framework formats ](../formats.md#schemas ), [internal sources and validation ](sources.md ) |
2026-08-23 19:04:00 +00:00
| `internal/llm` | Defines the internal generation boundary and implements outbound OpenAI-compatible chat requests from resolved execution targets, including bounded structured non-success response decoding, successful-response decoding, authentication, deadline handling, and ownership of the OpenAI-compatible reserved request-field policy. | [Internal model client ](llm.md ) |
2026-09-23 17:11:09 +00:00
| `internal/observation` | Owns invocation-local run IDs, presence-aware usage and phase accounting, and synchronous metadata event delivery for ordinary runs and generation attempts. | [Internal execution observation ](observation.md ) |
2026-08-25 09:58:10 +00:00
| `internal/usecase` | Resolves prompt definitions and hashes, profiles, backends, and targets for exact inspection and request settings for preparation, and coordinates ordinary execution and one-attempt prepared execution across internal sources, rendering, artifact loading, operation-local validation plans, generation, capacity, and bounded repair. | [Internal runner ](runner.md ), [prepared-execution implementation ](../../internal/usecase/prepared_execution.go ) |
2026-07-28 02:13:48 +00:00
2026-09-22 04:44:41 +00:00
The internal engine assembles these internal components without exposing their
2026-07-28 04:43:19 +00:00
representations. Consumers depend only on the root facade.
2026-07-28 02:13:48 +00:00
## Maintenance
2026-07-28 04:53:51 +00:00
Update this inventory as implementation adds packages or changes component
responsibilities. List only implemented components; proposed package
2026-07-28 02:13:48 +00:00
boundaries belong in temporary planning documents until their implementation
lands.