core/

directory
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT

README

Core service

services/core is Core: one Go service that serves the Agents API (/v1), the Core API (/core/v1) and the machine connection routes (/api/v1), owns its PostgreSQL schema, and runs the execution Worker that dispatches Turns to Runtimes. Architecture describes its role, and the API index its namespaces and credentials. This guide is for contributors who build, run and test Core from source; operators install it with the installer. The implementation constraints hold the code-level rules.

Commands

Package Executable Purpose
cmd/server oac-core The HTTP service and execution Worker. It applies the embedded database migrations before serving
cmd/device oac-core-device Provisions or revokes an operator device profile for environment: none engine hosts
cmd/environment-key oac-core-environment-key The break-glass executor credential command
cmd/sandbox-node oac-node The sandbox node program; see the nodes guide
cmd/specification-contract None Regenerates the installer's node specification projection

make build-core builds the four executables into ~/.oac/build/oac-core; Standalone Core builds describes the build and its options. make build-daemon builds oac-daemon.

Database

Core uses its own PostgreSQL database and account and shares no tables with an application. Its migrations are embedded goose migrations in migrations/, tracked in agents_api_schema_version; a migration is never edited after it lands. Queries live in internal/db/queries and generate typed code with sqlc: run make sqlc-generate after changing a query and commit the generated files, which make check-sqlc compares.

Run from source

  1. Create a development database. Core applies the migrations when it starts.

  2. Create a Core key of at least 32 characters and a digest file holding its SHA-256, which Core uses to authenticate /core/v1:

    umask 077; mkdir -p ~/.oac/dev
    openssl rand -hex 32 > ~/.oac/dev/core.key
    printf '["%s"]\n' "$(tr -d '\n' < ~/.oac/dev/core.key | sha256sum | cut -d' ' -f1)" > ~/.oac/dev/core-key-digests.json
    
  3. Start Core. OAC_PUBLIC_URL enables the Runtime gateway and the Worker; without it Core executes nothing. The Core environment table lists every variable.

    OAC_DATABASE_URL='postgres://oac:…@127.0.0.1:5432/oac_dev' \
    OAC_CORE_KEY_DIGESTS_FILE="$HOME/.oac/dev/core-key-digests.json" \
    OAC_PUBLIC_URL=http://127.0.0.1:8091 \
    go run ./services/core/cmd/server
    
  4. Create a Project and an API key with the Core key, as in Script the Core API, and call /v1 with the key as in the quickstart.

  5. To run environment: none Sessions, provision an operator device profile for the Project's tenant and start oac-daemon connect --profile default on a host with a Harness installed. Self-hosted Sessions use the self-hosted guide instead.

Tests

make check-core builds Core and runs the Go tests of services/core and packages/agents-client. Point OAC_TEST_DATABASE_URL at a dedicated database named oac_*_tests that holds no other tables; the tests apply only Core's migrations and use fresh tenants without truncating anything. Without it, database tests skip locally; CI provides its own PostgreSQL. Set OAC_TEST_OFFICIAL_SDK_PYTHON to the interpreter with the pinned SDK for the store's client fixtures. Validate a change lists the focused checks for other areas.

Official client verification

The official-client suite runs the built server against the pinned OpenAI SDK from upstream.json, with the same test database, temporary keys and fresh tenants, and needs no model provider:

python -m pip install -r services/core/tests/requirements.txt
make build-core
OAC_TEST_DATABASE_URL='postgres://…/oac_local_tests' \
OAC_TEST_SERVER_BIN="${OAC_DEV_HOME:-$HOME/.oac}/build/oac-core/oac-core" \
  python services/core/tests/official_client.py

It checks the upstream and generated response schemas, retries, ordering, tenant isolation, unsupported options and reads after a restart. It also runs the official Go client against two fresh tenants and validates the Sessions it created through the Python SDK.

Generated contracts

Handler annotations generate the OpenAPI documents. Run make openapi after changing them: it runs the pinned swaggo generator and splits the result by namespace into openapi.yaml (/v1), core.openapi.yaml (/core/v1) and runtime.openapi.yaml (/api/v1), each with only the security schemes its operations use. Review and commit the three diffs. Contract tests hold openapi.yaml to the pinned routes and fields, and hold all three to exactly the routes the server registers.

Directories

Path Synopsis
cmd
device command
Command device provisions or revokes an execution device using operator DB access.
Command device provisions or revokes an execution device using operator DB access.
environment-key command
Command environment-key manages executor principal credentials using operator DB authority.
Command environment-key manages executor principal credentials using operator DB authority.
oac command
provider-artifacts command
provider-artifacts generates distribution declarations from registered adapters.
provider-artifacts generates distribution declarations from registered adapters.
sandbox-node command
sandbox-node hosts the selected local Provider and dials its owning Core.
sandbox-node hosts the selected local Provider and dials its owning Core.
server command
Package main runs the standalone Agents API service.
Package main runs the standalone Agents API service.
specification-contract command
specification-contract maintains the generated node installer projection.
specification-contract maintains the generated node installer projection.
internal
adminaudit
Package adminaudit carries non-secret administrator provenance into business transactions, and owns the rules for recording it and the audit log's read models.
Package adminaudit carries non-secret administrator provenance into business transactions, and owns the rules for recording it and the audit log's read models.
agents
Package agents owns saved Agents: reusable configuration a tenant keeps independently of Sessions, with the optional model provider bundle that its x_agents_core.model_provider describes.
Package agents owns saved Agents: reusable configuration a tenant keeps independently of Sessions, with the optional model provider bundle that its x_agents_core.model_provider describes.
api
coremetrics
Package coremetrics collects bounded operational measurements for administrators.
Package coremetrics collects bounded operational measurements for administrators.
credentialcrypto
Package credentialcrypto encrypts execution-service credentials at rest.
Package credentialcrypto encrypts execution-service credentials at rest.
databaseurl
Package databaseurl reads Core's PostgreSQL connection settings, shared by the server and its maintenance commands.
Package databaseurl reads Core's PostgreSQL connection settings, shared by the server and its maintenance commands.
deployment
Package deployment owns the managed sandbox deployment: the provider, specification and configuration an administrator selects, its generations, and the sandbox nodes that enroll with it, authenticate, report their readiness and serve its generations.
Package deployment owns the managed sandbox deployment: the provider, specification and configuration an administrator selects, its generations, and the sandbox nodes that enroll with it, authenticate, report their readiness and serve its generations.
deployment/placement
Package placement decides whether the sandbox deployment admits new hosted work and which node receives it.
Package placement decides whether the sandbox deployment admits new hosted work and which node receives it.
echotext
Package echotext decides whether an error message may repeat a caller-supplied value.
Package echotext decides whether an error message may repeat a caller-supplied value.
engine
Code generated by scripts/generate-harness-catalog.py; DO NOT EDIT.
Code generated by scripts/generate-harness-catalog.py; DO NOT EDIT.
engine/enginetest
Package enginetest supplies explicit declarations for admission fixtures.
Package enginetest supplies explicit declarations for admission fixtures.
environmentconfig
Package environmentconfig owns the Environment configuration vocabulary: setup (env, setup commands, packages and capability directories), Skills, Plugins and initial files, with their validation and public metadata projections.
Package environmentconfig owns the Environment configuration vocabulary: setup (env, setup commands, packages and capability directories), Skills, Plugins and initial files, with their validation and public metadata projections.
environmenttemplates
Package environmenttemplates owns Environment Templates: saved, tenant-owned hosted Environment configuration that Sessions reference at creation.
Package environmenttemplates owns Environment Templates: saved, tenant-owned hosted Environment configuration that Sessions reference at creation.
execution
Package execution delivers durable Turns through the existing daemon protocol.
Package execution delivers durable Turns through the existing daemon protocol.
files
Package files owns source Files: Project-owned uploaded bytes with immutable metadata, independent of Sessions and of the workspace copies made from them.
Package files owns source Files: Project-owned uploaded bytes with immutable metadata, independent of Sessions and of the workspace copies made from them.
identity
Package identity defines execution-service principals independently of product users.
Package identity defines execution-service principals independently of product users.
items
Package items owns public Items: it projects execution observations to the supported Item variants, merges them into stored Items and builds the ordered public events that report each Item change.
Package items owns public Items: it projects execution observations to the supported Item variants, merges them into stored Items and builds the ordered public events that report each Item change.
jsonobject
Package jsonobject normalizes stored JSON object documents.
Package jsonobject normalizes stored JSON object documents.
metadata
Package metadata owns the rules for resource metadata: string key and value pairs that Agents, Sessions and Vaults carry for their applications.
Package metadata owns the rules for resource metadata: string key and value pairs that Agents, Sessions and Vaults carry for their applications.
modelconfiguration
Package modelconfiguration owns each Harness's deployment default model configuration: its safe view, the encrypted complete bundle that Session creation freezes, the private revision that pairs with it, and the rules for replacing, removing and resolving it.
Package modelconfiguration owns each Harness's deployment default model configuration: its safe view, the encrypted complete bundle that Session creation freezes, the private revision that pairs with it, and the rules for replacing, removing and resolving it.
nativeinstaller
Package nativeinstaller serves qualified native distributions.
Package nativeinstaller serves qualified native distributions.
oauthrefresh
Package oauthrefresh exchanges a stored OAuth refresh grant for an access token.
Package oauthrefresh exchanges a stored OAuth refresh grant for an access token.
persistence/postgres/agentpg
Package agentpg stores saved Agents in PostgreSQL.
Package agentpg stores saved Agents in PostgreSQL.
persistence/postgres/auditpg
Package auditpg stores write and administrator audit records in PostgreSQL.
Package auditpg stores write and administrator audit records in PostgreSQL.
persistence/postgres/deploymentpg
Package deploymentpg stores the sandbox deployment, its retained generations and its nodes in PostgreSQL.
Package deploymentpg stores the sandbox deployment, its retained generations and its nodes in PostgreSQL.
persistence/postgres/filepg
Package filepg stores Files in PostgreSQL: metadata in source_files and content in large objects.
Package filepg stores Files in PostgreSQL: metadata in source_files and content in large objects.
persistence/postgres/modelconfigurationpg
Package modelconfigurationpg stores deployment default model configurations in PostgreSQL.
Package modelconfigurationpg stores deployment default model configurations in PostgreSQL.
persistence/postgres/pgtest
Package pgtest opens PostgreSQL databases for Core tests.
Package pgtest opens PostgreSQL databases for Core tests.
persistence/postgres/pgunit
Package pgunit runs Core's PostgreSQL transactions: pooled transactions for public and administrative work, and the execution owner's transactions on the connection that holds the database's execution lease.
Package pgunit runs Core's PostgreSQL transactions: pooled transactions for public and administrative work, and the execution owner's transactions on the connection that holds the database's execution lease.
persistence/postgres/placementpg
Package placementpg loads the placement facts of the sandbox deployment and applies the placements package placement decides, on the caller's transaction-bound queries.
Package placementpg loads the placement facts of the sandbox deployment and applies the placements package placement decides, on the caller's transaction-bound queries.
persistence/postgres/projectpg
Package projectpg stores Projects and their API keys in PostgreSQL.
Package projectpg stores Projects and their API keys in PostgreSQL.
persistence/postgres/sessionpg
Package sessionpg stores Sessions in PostgreSQL and decides nothing.
Package sessionpg stores Sessions in PostgreSQL and decides nothing.
persistence/postgres/skillpg
Package skillpg stores Skills and their versions in PostgreSQL.
Package skillpg stores Skills and their versions in PostgreSQL.
persistence/postgres/templatepg
Package templatepg stores Environment Templates in PostgreSQL.
Package templatepg stores Environment Templates in PostgreSQL.
persistence/postgres/vaultpg
Package vaultpg stores Vaults and Credentials in PostgreSQL.
Package vaultpg stores Vaults and Credentials in PostgreSQL.
processconfig
Package processconfig is the process settings Core loads from its environment.
Package processconfig is the process settings Core loads from its environment.
projects
Package projects owns Core Projects and their API keys.
Package projects owns Core Projects and their API keys.
providercontract
Package providercontract describes explicit resource-provider operations.
Package providercontract describes explicit resource-provider operations.
runtime
Package runtime connects execution devices without product dependencies.
Package runtime connects execution devices without product dependencies.
runtimedevice
Package device defines persistence data shared by daemon gateways and their stores.
Package device defines persistence data shared by daemon gateways and their stores.
runtimegateway
Package gateway is the server-side hub of the agent_daemon connector.
Package gateway is the server-side hub of the agent_daemon connector.
runtimehistory/postgresreader
Package postgresreader stores and reads bounded periodic Runtime telemetry.
Package postgresreader stores and reads bounded periodic Runtime telemetry.
runtimeobs
Package runtimeobs resolves durable Session identity to provider-owned Runtime observations.
Package runtimeobs resolves durable Session identity to provider-owned Runtime observations.
runtimeobs/otlpexporter
Package otlpexporter sends sanitized Runtime observation records to an operator-configured OTLP/HTTP metrics endpoint.
Package otlpexporter sends sanitized Runtime observation records to an operator-configured OTLP/HTTP metrics endpoint.
sandbox
Package sandbox defines the Sandbox Provider contract for authorized compute.
Package sandbox defines the Sandbox Provider contract for authorized compute.
sandbox/contracttest
Package contracttest runs shared lifecycle assertions against real adapters backed by controlled native transports.
Package contracttest runs shared lifecycle assertions against real adapters backed by controlled native transports.
sandbox/docker
Package docker is a thin SDK adapter for the dedicated, colocated Runtime.
Package docker is a thin SDK adapter for the dedicated, colocated Runtime.
sandbox/e2b
Code generated by contractgen; DO NOT EDIT.
Code generated by contractgen; DO NOT EDIT.
sandbox/e2b/internal/contractgen command
Command contractgen projects the adapter's Go declarations into its Python artifacts.
Command contractgen projects the adapter's Go declarations into its Python artifacts.
sandbox/microsandbox
Package microsandbox is the pure-Go client for the colocated SDK helper.
Package microsandbox is the pure-Go client for the colocated SDK helper.
sandbox/node
Package node transports the finite sandbox Provider contract.
Package node transports the finite sandbox Provider contract.
sandbox/providers
Node-local adapter configuration and construction.
Node-local adapter configuration and construction.
sessions
Package sessions owns the Session vocabulary: Sessions, Turns and their statuses, inputs, Environments and their provisioning failures, function calls, Item and Artifact reads, executor credentials, and the errors Session operations return.
Package sessions owns the Session vocabulary: Sessions, Turns and their statuses, inputs, Environments and their provisioning failures, function calls, Item and Artifact reads, executor credentials, and the errors Session operations return.
skills
Package skills owns Skills: tenant-owned bundles with immutable, numbered versions and a default version.
Package skills owns Skills: tenant-owned bundles with immutable, numbered versions and a default version.
store
Package store persists execution state independently of the Parsar product.
Package store persists execution state independently of the Parsar product.
textvalue
Package textvalue holds the one error shared by every domain for request text that Core cannot store.
Package textvalue holds the one error shared by every domain for request text that Core cannot store.
vaults
Package vaults owns Vaults and their Credentials: the resources, OAuth access-token refresh, and the MCP credential selection that Session creation freezes and execution resolves into a bearer token.
Package vaults owns Vaults and their Credentials: the resources, OAuth access-token refresh, and the MCP credential selection that Session creation freezes and execution resolves into a bearer token.
writeaudit
Package writeaudit carries authenticated, non-secret request provenance to business transactions, and owns the rules for recording it and its read models.
Package writeaudit carries authenticated, non-secret request provenance to business transactions, and owns the rules for recording it and its read models.
Package migrations owns only the Agents API database schema.
Package migrations owns only the Agents API database schema.
tests
fixtures command
Command fixtures prepares internal records for official-client recovery tests.
Command fixtures prepares internal records for official-client recovery tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL