Documentation
¶
Overview ¶
Package orjanda provides the central Site composition root and Application registration.
Index ¶
- type Site
- func (s *Site) Compile() error
- func (s *Site) HTTPHandler() http.Handler
- func (s *Site) InitAuditLog() error
- func (s *Site) Install(appDef app.Definition)
- func (s *Site) InstalledApps() []app.Definition
- func (s *Site) RegisterPage(p ui.Page)
- func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Site ¶
type Site struct {
Config config.Config
Registry schema.Registry
DB dal.Database
Permissions perm.Engine
EventBus event.Bus
AuditLog audit.Log
Cache cache.Store
Auth auth.Provider
DocEngine *document.Engine
Workflows workflow.Engine
Tools tools.ToolRegistry
Pages ui.Registry
Router *chi.Mux
// contains filtered or unexported fields
}
Site is the central composition root wiring database, schema registry, permission engine, event bus, audit log, cache, auth provider, document engine, workflow engine, agent tool registry, admin UI page registry, and HTTP router. See TAD §12.4.
func (*Site) HTTPHandler ¶
HTTPHandler returns the composed request handler: API routes plus the embedded Admin UI single-page application (PRD §17.4). It is the handler the server package serves; ServeHTTP delegates to it.
func (*Site) InitAuditLog ¶
InitAuditLog upgrades the site's audit log to a DB-backed log when the configured database supports it: it creates the audit table (TAD §13) and registers the table's docType mapping so Engine writes commit inside the same dal.Tx. Without a supporting database the in-memory log is kept, so a nil DB or an embedding that can't reach the raw connection degrades safely. Called by Compile; exported for harnesses that wire engines by hand.
func (*Site) Install ¶
func (s *Site) Install(appDef app.Definition)
Install registers an Application definition into the site before compilation.
func (*Site) InstalledApps ¶
func (s *Site) InstalledApps() []app.Definition
InstalledApps returns the Application definitions registered via Install. Used by the CLI's install/uninstall commands (TAD §16).
func (*Site) RegisterPage ¶
RegisterPage adds a custom Admin UI page (TAD §9.1 / PRD §18.3).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent is the embedded AI Agent Runtime package (PRD §23).
|
Package agent is the embedded AI Agent Runtime package (PRD §23). |
|
llm
Package llm defines the llm.Provider interface and implements the OpenAI, openai_compatible, and Anthropic adapters with streaming, tool-calling, structured-output support, failover, circuit-breaking, and token tracking.
|
Package llm defines the llm.Provider interface and implements the OpenAI, openai_compatible, and Anthropic adapters with streaming, tool-calling, structured-output support, failover, circuit-breaking, and token tracking. |
|
planner
Package planner defines the Plan/PlanStep structured-output contract and the whole-plan pre-execution validation logic used in Plan-and-Execute mode.
|
Package planner defines the Plan/PlanStep structured-output contract and the whole-plan pre-execution validation logic used in Plan-and-Execute mode. |
|
runtime
Package runtime implements the agent execution loop (Runtime.Execute), Session Manager, and Context Manager with the discovery/operation tool split (TAD §11.1) and ReAct/Plan-and-Execute mode switching (TAD §11.2).
|
Package runtime implements the agent execution loop (Runtime.Execute), Session Manager, and Context Manager with the discovery/operation tool split (TAD §11.1) and ReAct/Plan-and-Execute mode switching (TAD §11.2). |
|
safety
Package safety implements SafetyPolicy and SafetyLayer: the five-step approval-evaluation order (Always → Bulk → RoleOverride → RequireApproval → AutoApprove), rate limiting, token budgets, and tool allowlists.
|
Package safety implements SafetyPolicy and SafetyLayer: the five-step approval-evaluation order (Always → Bulk → RoleOverride → RequireApproval → AutoApprove), rate limiting, token budgets, and tool allowlists. |
|
tools
Package tools implements the ToolRegistry: Compile (run once after Registry.Compile) and ForIdentity (run per agent turn) following the deterministic O(len(CompiledDocs)) generation algorithm in TAD §10.
|
Package tools implements the ToolRegistry: Compile (run once after Registry.Compile) and ForIdentity (run per agent turn) following the deterministic O(len(CompiledDocs)) generation algorithm in TAD §10. |
|
Package api implements the HTTP API surface on Chi: REST CRUD handlers, RPC method dispatch, the Metadata API, and the middleware chain (CORS → Auth → RateLimit → Permission → Handler).
|
Package api implements the HTTP API surface on Chi: REST CRUD handlers, RPC method dispatch, the Metadata API, and the middleware chain (CORS → Auth → RateLimit → Permission → Handler). |
|
middleware
Package middleware contains the Chi middleware stack applied to every incoming HTTP request: CORS, Auth (JWT extraction), Rate Limit, and Permission (perm.Engine.CheckAction).
|
Package middleware contains the Chi middleware stack applied to every incoming HTTP request: CORS, Auth (JWT extraction), Rate Limit, and Permission (perm.Engine.CheckAction). |
|
render
Package render provides HTTP response serialization and standardized error formatting.
|
Package render provides HTTP response serialization and standardized error formatting. |
|
rest
Package rest contains the REST handler implementations for the six standard Document operations (list, get, create, update, delete, submit).
|
Package rest contains the REST handler implementations for the six standard Document operations (list, get, create, update, delete, submit). |
|
rpc
Package rpc dispatches POST /api/v1/method/{app}.{module}.{method} requests to registered api.MethodHandler implementations, enforcing AllowedRoles through the shared perm.Engine path (TAD §9.2).
|
Package rpc dispatches POST /api/v1/method/{app}.{module}.{method} requests to registered api.MethodHandler implementations, enforcing AllowedRoles through the shared perm.Engine path (TAD §9.2). |
|
Package app defines the Application and Module system: app.Definition, app.Module, app.Dependency, dependency-DAG resolution, and the Installable/ Upgradable/Uninstallable lifecycle interfaces resolved via Definition.Hooks (the TAD §7 "associated init type").
|
Package app defines the Application and Module system: app.Definition, app.Module, app.Dependency, dependency-DAG resolution, and the Installable/ Upgradable/Uninstallable lifecycle interfaces resolved via Definition.Hooks (the TAD §7 "associated init type"). |
|
Package audit provides the immutable audit log: Entry, FieldChange, and Log.Write/Query.
|
Package audit provides the immutable audit log: Entry, FieldChange, and Log.Write/Query. |
|
Package auth defines the Identity and UserInfo types, the auth.Provider interface, and the default JWT-based implementation (bcrypt passwords, 15-minute access tokens, 7-day rotating refresh tokens).
|
Package auth defines the Identity and UserInfo types, the auth.Provider interface, and the default JWT-based implementation (bcrypt passwords, 15-minute access tokens, 7-day rotating refresh tokens). |
|
Package background defines the background.Job and background.Queue interfaces plus an in-memory, non-durable stub Queue for the MVP.
|
Package background defines the background.Job and background.Queue interfaces plus an in-memory, non-durable stub Queue for the MVP. |
|
Package cache exposes the cache.Store interface and an in-process LRU default implementation used for Registry metadata caching and per-request permission-check caching.
|
Package cache exposes the cache.Store interface and an in-process LRU default implementation used for Registry metadata caching and per-request permission-check caching. |
|
Package cli contains the Cobra command implementations backing the orjanda binary: serve, migrate, new, init, console, agent, registry, install, uninstall, and test.
|
Package cli contains the Cobra command implementations backing the orjanda binary: serve, migrate, new, init, console, agent, registry, install, uninstall, and test. |
|
cmd
|
|
|
orjanda
command
Command orjanda is the Orjanda framework CLI binary (TAD §16, PRD §21).
|
Command orjanda is the Orjanda framework CLI binary (TAD §16, PRD §21). |
|
Package config implements the Viper-backed configuration loader for Orjanda.
|
Package config implements the Viper-backed configuration loader for Orjanda. |
|
Package dal implements the Data Access Layer: Database/Tx/Dialect interfaces, query builder, transaction management, and Migrator (TAD §2.3, §14, PRD §13).
|
Package dal implements the Data Access Layer: Database/Tx/Dialect interfaces, query builder, transaction management, and Migrator (TAD §2.3, §14, PRD §13). |
|
dialect/postgres
Package postgres provides the PostgreSQL dialect for Orjanda's DAL.
|
Package postgres provides the PostgreSQL dialect for Orjanda's DAL. |
|
dialect/sqlite
Package sqlite provides the SQLite dialect for Orjanda's DAL.
|
Package sqlite provides the SQLite dialect for Orjanda's DAL. |
|
Package document implements the Document Engine: Create, Read, Update, Delete, and List operations driven by the compiled Registry schema, with field validation, lifecycle hooks, permission enforcement, and audit logging.
|
Package document implements the Document Engine: Create, Read, Update, Delete, and List operations driven by the compiled Registry schema, with field validation, lifecycle hooks, permission enforcement, and audit logging. |
|
Package errors defines the framework-wide error model: ErrorCode enum, the Error interface, constructor helpers, and HTTP status mapping.
|
Package errors defines the framework-wide error model: ErrorCode enum, the Error interface, constructor helpers, and HTTP status mapping. |
|
Package event provides the synchronous, in-process event bus used for Document lifecycle hooks (before_save, after_insert, etc.).
|
Package event provides the synchronous, in-process event bus used for Document lifecycle hooks (before_save, after_insert, etc.). |
|
internal
|
|
|
version
Package version reads version metadata from the running binary's build info.
|
Package version reads version metadata from the running binary's build info. |
|
Package core defines the bootstrapped core application for identity, roles, and permissions.
|
Package core defines the bootstrapped core application for identity, roles, and permissions. |
|
Package perm implements the permission engine: RBAC document-level checks from DocPermission metadata, ABAC via registered perm.Rules, and field-level filtering via FilterRead/FilterWrite.
|
Package perm implements the permission engine: RBAC document-level checks from DocPermission metadata, ABAC via registered perm.Rules, and field-level filtering via FilterRead/FilterWrite. |
|
Package schema contains the Document contract, BaseDocument/BaseChild embed types, the CompiledDoc/Field metadata types, the oj struct-tag parser, and the Registry that stores every registered Document after compilation.
|
Package schema contains the Document contract, BaseDocument/BaseChild embed types, the CompiledDoc/Field metadata types, the oj struct-tag parser, and the Registry that stores every registered Document after compilation. |
|
Package search exposes the search.Backend interface and a default adapter that delegates to the active dal.Dialect's FullTextSearch — no external search process is required for the MVP.
|
Package search exposes the search.Backend interface and a default adapter that delegates to the active dal.Dialect's FullTextSearch — no external search process is required for the MVP. |
|
Package server is the HTTP assembly root: it wires the Registry, Database, permission engine, event bus, cache, and Admin UI into the orjanda.Site composition root and starts the Chi HTTP server.
|
Package server is the HTTP assembly root: it wires the Registry, Database, permission engine, event bus, cache, and Admin UI into the orjanda.Site composition root and starts the Chi HTTP server. |
|
Package testing (imported as orjanda/testing) provides the first-class test harness: NewTestSite, WithApps, WithDialect, CreateUser, WithUser, SeedFixtures, MockLLM, ToolCall, TextResponse, and ApprovalPrompt.
|
Package testing (imported as orjanda/testing) provides the first-class test harness: NewTestSite, WithApps, WithDialect, CreateUser, WithUser, SeedFixtures, MockLLM, ToolCall, TextResponse, and ApprovalPrompt. |
|
Package ui provides the admin UI page registry (TAD §9.1) and the codegen input contract consumed by the @orjanda/codegen pass (TAD §6.3).
|
Package ui provides the admin UI page registry (TAD §9.1) and the codegen input contract consumed by the @orjanda/codegen pass (TAD §6.3). |
|
Package workflow implements the state-machine workflow engine: Definition, State, Transition, GuardFunc, and Engine.Execute — all enforced through the shared perm.Engine (no bespoke permission path).
|
Package workflow implements the state-machine workflow engine: Definition, State, Transition, GuardFunc, and Engine.Execute — all enforced through the shared perm.Engine (no bespoke permission path). |