Introducing a new way to review your PRs.

Read the announcement

gotempsh / temps

AI-native open-source alternative to Vercel + Sentry + PostHog + Pingdom + Resend + E2B. 440+ CLI operations with drop-in skills for Claude Code, Codex & OpenCode — deployments, analytics, session replay, error tracking, OpenTelemetry, email, sandboxes & AI gateway in one self-hosted Rust binary.

View on GitHub

25 documents · Updated Oct 21, 2026

docs / ai-agent-runtime

AI agent runtime

The AI agent runtime is the shared execution layer for assisted operations, durable chat, and autonomous work. It turns a user or system trigger into a governed model turn, scoped tool use, persistent workspace activity, or an isolated agent run. It keeps provider choice, user authority, platform API access, memory, and sandbox execution as separate boundaries. It is a child page of AI automation and relates to MCP and plugin integrations.

Runtime model

The runtime has two connected paths. Chat keeps a durable conversation and exposes live progress to a user. Autonomous workflows run a bounded job that can inspect a repository, change files, verify the result, and deliver an outcome. Both paths use the same provider capability model and the same rule that AI work must remain inside an explicit authority and execution scope.

flowchart LR
    Input[User or system trigger] --> Core[AI core]
    Core --> Gateway[Provider gateway]
    Core --> Harness[Development harness]
    Gateway --> Chat[Durable chat]
    Harness --> Chat
    Harness --> Workspace[Persistent workspace]
    Input --> Agent[Autonomous agent run]
    Agent --> Sandbox[Isolated sandbox]
    Sandbox --> Memory[Workflow memory]
    Sandbox --> Terminal[PTY terminal]
    Chat --> Tools[Scoped API and repository tools]

AI core

Provider contract

The AI core is the provider-neutral contract for model availability, model and reasoning choices, plain completions, typed output, streaming, tool calls, cancellation, and user decisions. A caller supplies the prompt or replayed history plus the current turn services. The provider returns text, structured data, tool activity, or a request for human input. The same contract also covers bounded native-session export and process-supervisor actions for an authorized workspace. This keeps chat and workflow code independent from one provider protocol.

The capability view is the shared source for provider selectors and request checks. It records models, reasoning modes, permission modes, authentication source, and live features such as text streaming, tool events, user interaction, and cancellation. A model catalog also records whether its data is live, cached, stale, or only a bootstrap choice.

References: crates/…/lib.rs• L4-22 crates/…/provider.rs• L4-9 crates/…/provider.rs• L19-93 crates/…/service.rs• L76-163 crates/…/service.rs• L201-369

Provider routing

The provider registry sends ordinary requests to the gateway and sends a request to a development harness only when the conversation pins that harness. An omitted provider does not inherit a host harness. This prevents filesystem and sandbox access from becoming an ambient instance-wide inference setting. Server-authored summary work can apply an instance summary preference before routing, while an explicit provider remains authoritative. An explicit provider that is not available fails closed.

Provider routing carries the same turn services to every adapter. Gateway providers use their model tool loop. Harness providers receive only the scoped tool and interaction channels for that turn. Summary workloads may use an instance preference, but an explicit request remains authoritative.

References: crates/…/dispatch.rs• L20-38 crates/…/dispatch.rs• L57-70 crates/…/dispatch.rs• L108-135 crates/…/dispatch.rs• L353-450 crates/…/service.rs• L419-466

Provider gateway

Gateway interface

The gateway is the common HTTP boundary for configured model providers. It accepts chat, streaming chat, model discovery, structured output, and embedding requests. It resolves the provider and credential, applies model policy, sends the request upstream, and records usage. It can also send a managed-model request through the Temps Cloud link and present that result through the same completion and stream shapes. This gives internal services and compatible external clients one governed provider surface.

The gateway supports configured credentials and caller-provided keys where policy allows. It checks provider URLs and model access before sending a request. Streaming keeps a common event shape so chat clients do not need provider-specific transport logic. Model discovery reads the provider's live catalog when an operator refreshes it, while adapter models remain a bounded bootstrap fallback.

References: crates/…/gateway_service.rs• L39-78 crates/…/gateway_service.rs• L80-227 crates/…/gateway_service.rs• L229-404 crates/…/gateway_service.rs• L406-458 crates/…/providers.rs• L125-143

Model policy

Model selection follows the most specific active policy. Project rules can restrict the model set. Instance defaults provide the wider fallback. An internal call uses an explicit model when policy permits it. When no call or policy names a concrete model, the gateway-backed AI service chooses the first concrete allowed model, an operator-pinned model, an enabled live catalog model, a safe provider default, or the managed Temps Cloud model in that order.

The gateway still checks that the selected model belongs to the routed provider and is selectable. A model that is not allowed or cannot be served is rejected rather than silently replaced. Administrators can test provider credentials, set or clear a provider's default model, refresh the provider model catalog, and enable or disable catalog entries. Capability discovery keeps selectors useful while distinguishing authoritative inventories from stale or bootstrap data.

Provider settings also separate host readiness from workspace readiness. A host CLI may be installed and signed in while a persistent workspace still lacks a saved credential and secure relay. The settings API exposes this difference so a user does not mistake host authentication for workspace execution access.

References: crates/…/ai_service.rs• L42-180 crates/…/ai_service.rs• L403-512 crates/…/gateway_service.rs• L80-227 crates/…/gateway_service.rs• L229-332 crates/…/providers.rs• L228-267 crates/…/providers.rs• L351-455 crates/…/providers.rs• L521-575 crates/…/ai_providers.rs• L66-140 crates/…/ai_providers.rs• L584-731

Embedding service

Embedding is the gateway capability that turns text into provider-generated vectors. It uses the same provider and credential checks as other gateway requests, validates input bounds, and records token use. The local embedding crate supplies tokenizer helpers; it is not a second remote model service.

Embeddings are a supporting capability for search and memory-style features. They do not change the provider-neutral chat contract or the sandbox boundary.

References: crates/…/gateway_service.rs• L445-458 crates/…/gateway.rs• L638-769 crates/…/lib.rs• L4-29

Structured output

Structured output is the gateway path for a model response that must match a declared schema. The service validates the requested model and thinking mode against provider capabilities, then streams the result through a common interface. It gives platform features typed data without making each caller parse free-form prose.

References: crates/…/structured_output.rs• L1-46 crates/…/structured_output.rs• L187-211 crates/…/structured_output.rs• L83-196

Interactive chat

Conversation contexts

An AI conversation is a private, resumable thread attached to a context. Context providers seed the thread with the right facts and tools. The main contexts are project assistance, deployment debugging, metric-alert investigation, alert suggestions, global operator work, and multi-project applications.

The context changes the starting frame, not the user's authority. Every platform tool call uses the current authenticated user. Application threads add a durable workspace and linked project topology. Global threads stay projectless until a tool call selects an accessible project.

ContextMain purposeWorking scope
ProjectGeneral project questions and operationsOne project and its telemetry or repository
DeploymentDiagnose a failed deploymentOne project and one deployment's evidence
AlertExplain an active metric alertOne project and one alert rule
Alert suggestionFind useful alert rules from real telemetryOne project
GlobalOperate across the platformUser-owned, projectless thread
ApplicationBuild and operate a multi-project applicationLinked projects and a persistent workspace

References: crates/…/project.rs• L25-73 crates/…/deployment.rs• L54-176 crates/…/alert.rs• L20-97 crates/…/alert_suggest.rs• L29-110 crates/…/global.rs• L8-38 crates/…/application.rs• L41-193

Conversation lifecycle

Conversation state is durable. The service stores the system seed, user turns, assistant turns, provider pin, model choice, reasoning choice, permission mode, and provider session identity. A turn is idempotent when the client repeats its turn id. A browser connection observes the server-owned turn through the conversation WebSocket, so a disconnect does not stop the provider process or create a second turn.

When a turn starts, the service refreshes the context and builds the current tool set. It rechecks authorization before a native harness can act. A later role, session, key, or project-membership change can therefore stop a long-running turn instead of relying on permission state captured at request time.

References: crates/…/service.rs• L66-220 crates/…/service.rs• L144-220 crates/…/handlers.rs• L6483-6689

Tool and approval flow

The model can stream prose and tool activity in one turn. A tool call pauses the model, runs the scoped operation, and returns a result before the model continues. Provider-native harness actions are shown as activity. Platform actions use a separate authenticated tool path.

Some harness actions need a human decision. The runtime normalizes tool approval, a direct question, and plan approval into one permission flow. It stores the pending request against the conversation, sends a live event, and accepts only a matching decision for that conversation and request kind. An abandoned or timed-out interaction is denied or cancelled rather than left blocking a process.

References: crates/…/streaming.rs• L50-72 crates/…/streaming.rs• L270-359 crates/…/handlers.rs• L888-910 crates/…/handlers.rs• L7409-7724 crates/…/service.rs• L361-493

MCP tool bridge

The MCP tool bridge is a short-lived JSON-RPC surface that lets a harness use the platform tools selected for one application turn. Its bearer is tied to the authenticated browser request and expires with the turn. It exposes tool schemas and tool results through the MCP shape while routing native permission requests back to the chat interaction handler.

The bridge accepts protocol notifications without a response and preserves request identity for normal calls. Invalid envelopes, unavailable tools, expired capabilities, and timed-out approvals fail as bounded errors. The bridge cannot widen project scope or become a reusable platform credential.

References: crates/…/mcp.rs• L8-29 crates/…/mcp.rs• L49-80 crates/…/mcp.rs• L173-208 crates/…/service.rs• L1928-2035 crates/…/service.rs• L2402-2420

API and repository tools

Read-only API tool

The read-only API tool gives chat a controlled view of the platform API. It builds a searchable virtual temps CLI from the OpenAPI contract, guides the model through help and operation descriptions, validates parameters, and replays the request through the real router. The router remains the final authorization boundary and receives the user's current authority.

Project selectors are supplied by the chat context when possible. Application and global threads can select an accessible project at the top level. Responses are structured and capped so a large API result cannot flood the model context.

References: crates/…/lib.rs• L4-36 crates/…/index.rs• L285-364 crates/…/caller.rs• L511-620 crates/…/api_tools.rs• L161-249 crates/…/api_tools.rs• L271-356

Write proposals

Mutating API actions use a propose-then-confirm flow. The model can prepare and validate a write from an explicit allow-list, but preparation does not execute it. The runtime stores the protected proposal and presents it to a human. Confirmation rechecks the current authority, claims the proposal once, replays it through the real router, and records success or failure.

Plans are ordered chains of proposals. A later step cannot run until earlier steps succeed. A rejected or failed step stops the remaining chain. Inline approvals use a separate lifecycle so an abandoned interactive action cannot be executed later through a detached confirmation endpoint.

References: crates/…/caller.rs• L109-145 crates/…/caller.rs• L808-891 crates/…/pending_actions.rs• L73-180 crates/…/pending_actions.rs• L380-547 crates/…/pending_actions.rs• L635-720

Repository exploration

Project chat can inspect a connected Git repository without cloning it into the server process. The read-only tools list files, read a file at a branch, tag, or commit, and list branches and tags. The tools appear only when the user has repository-read permission and the project has a Git connection.

Deployment chat passes the deployed commit when it needs exact source evidence. This connects a failure record to the source version that produced it without giving the model broad host filesystem access.

References: crates/…/repo_tools.rs• L4-20 crates/…/repo_tools.rs• L365-507 crates/…/deployment.rs• L99-117

Autonomous agent workflows

Agent triggers

An autonomous run is a durable job created by a manual action, webhook, schedule, deployment event, monitoring event, error event, retry, or autofixer flow. Trigger gates check that the agent is enabled for the event, its cooldown has expired, its daily budget permits the work, and the project has not reached its active-run limit. Scheduled events identify the agent that fired so one schedule cannot start sibling agents by mistake.

The run record connects the trigger to its project and agent. It keeps the active phase, logs, model usage, changed work, and delivery result. The user can watch progress, cancel a run, retry completed context, or inspect the final delivery without losing the original run record.

References: crates/…/plugin.rs• L63-89 crates/…/plugin.rs• L169-307 crates/…/plugin.rs• L309-406 crates/…/trigger.rs• L123-236

Agent providers

The agent provider catalog is the single source for the supported development harnesses and their install, authentication, model, permission, and workspace rules. It also describes how each credential type is seeded inside a sandbox. This keeps provider settings, runtime construction, and installation checks on the same provider identity.

Model choices may come from a live harness catalog or from verified fallback choices. Providers that own an account-aware catalog do not invent model identifiers when discovery fails. Host authentication and workspace execution remain separate: a persistent workspace needs a supported turn-scoped relay and a saved provider credential.

References: crates/…/catalog.rs• L4-11 crates/…/catalog.rs• L13-29 crates/…/catalog.rs• L86-125 crates/…/catalog.rs• L144-317 crates/…/mod.rs• L154-189 crates/…/model_relay.rs• L45-58 crates/…/model_relay.rs• L108-183

Retained runtime transport

Persistent workspace chat uses a retained agent runtime so later turns can reuse the same sandbox-side harness session. Before a turn, the service checks that the workspace image supports the daemon protocol. It then opens an authenticated bidirectional stream through the already-authorized sandbox handle and attaches to or acquires the runtime by its stable identity.

This transport is a private daemon connection rather than a shell or browser PTY. The runtime receives turn-scoped model relay, MCP, environment, attachment, permission, and session data. A missing or incompatible runtime fails the turn instead of silently running an unverified workspace image.

References: crates/…/runtime_transport.rs• L16-51 crates/…/service.rs• L2275-2474 crates/…/mod.rs• L388-495

Agent run delivery

An autonomous run gives the harness a bounded repair or work goal. The harness inspects the repository, makes changes in the run workspace, verifies those changes, and produces the configured deliverable. Run output is durable and can be streamed while the job is active. A retry starts a new run from the old context so the original result remains auditable.

References: crates/…/prompt_builder.rs• L4-61 crates/…/run_service.rs• L15-117 crates/…/runs.rs• L487-570 crates/…/runs.rs• L637-747

Workflow memory

Persistent workflow facts

Workflow memory is a project-and-agent scoped store of facts that can help later autonomous runs. Facts carry confidence, tags, use history, provenance, and optional vector data. The scope prevents one project's workflow knowledge from appearing in another project's prompt.

Memory has two paths. Before a run, the executor loads relevant facts and places them in the prompt. Inside the sandbox, the agent can search, add, or replace facts through the memory command. Memory is best-effort: a missing provider or failed load does not stop the main workflow.

References: crates/…/executor.rs• L121-142 crates/…/executor.rs• L216-277 crates/…/executor.rs• L2092-2120 crates/…/lib.rs• L94-223

Sandbox execution

Sandbox lifecycle

The sandbox service gives compute a clear lifecycle class. An ephemeral sandbox is disposable. A workspace sandbox keeps its files and home data across idle suspension and can resume or rebuild compute on later access. Unknown lifecycle values fail validation rather than silently creating disposable compute.

Application workspaces use a first-class workspace sandbox with a managed runtime image and an owned host work directory. Runtime changes are tested in an isolated probe before replacement. If the candidate image or its network setup fails, the service restores the previous compute and data-network state.

References: crates/…/sandbox_service.rs• L84-193 crates/…/sandbox_service.rs• L219-289 crates/…/sandbox_service.rs• L1960-2109

Isolation boundary

Every autonomous or workspace harness run crosses a sandbox provider boundary. The boundary creates, starts, checks, stops, resumes, executes, reads, writes, and destroys a workspace without exposing a backend to the caller. Docker and Firecracker can serve production isolation. Local execution is a development fallback that requires explicit opt-in because it runs commands on the host.

The routing provider chooses the requested backend when creating a sandbox and uses the backend recorded on the sandbox handle for later operations. This keeps a recovered sandbox on its original backend and prevents a disabled backend from being silently replaced.

References: crates/…/mod.rs• L87-142 crates/…/mod.rs• L341-377 crates/…/routing.rs• L27-95 crates/…/plugin.rs• L92-159

Workspace state

Autonomous runs use an isolated work area. Application threads use a durable, server-owned workspace with one project directory per linked project. The host path is derived from the Temps data root, not supplied by the browser. This lets a later turn see the same files and Git state without granting access to an arbitrary host directory.

The sandbox separates workspace files from private home data. Provider credentials, MCP settings, memory tools, and other turn material stay in the private area. Network-enabled sandboxes use an internal network and a controlled egress path. The egress path permits the capability routes needed by the turn while blocking direct access to private or non-routable destinations.

References: crates/…/applications.rs• L132-145 crates/…/applications.rs• L451-510 crates/…/service.rs• L2583-2630 crates/…/mod.rs• L144-200 crates/…/docker.rs• L209-252 crates/…/docker.rs• L567-589

Application workspaces

An application workspace groups several Temps projects under one private user-owned context. The thread can inspect and change local files, use linked data services, and operate authorized platform resources. The workspace is a working boundary, not a replacement for platform authorization. Project membership and role checks are refreshed during the turn.

The application tool can create typed, declarative UI artifacts. The console chooses a trusted renderer from the artifact kind and resource type. The model does not provide executable HTML, JavaScript, arbitrary component names, URLs, or secret values.

References: crates/…/application.rs• L146-217 crates/…/service.rs• L144-220 crates/…/applications.rs• L37-50 crates/…/application.rs• L195-301

Application Git bindings

Application Git bindings connect a linked project to a user-owned Git repository under a named remote. The service offers only repositories from active, usable connections and accepts only canonical HTTPS origins for the provider. Binding and disconnecting require the relevant project and repository permissions and produce audit records.

The binding is durable authorization, not proof that a remote is currently reachable. A project can have several remotes, but each remote name is unique within that project and application. This gives the workspace a stable Git relationship without passing raw credentials through chat or the browser.

References: crates/…/git_bindings.rs• L104-203 crates/…/git_bindings.rs• L206-360 crates/…/git_bindings.rs• L393-464 crates/…/git_bindings_handlers.rs• L142-257

Sandbox network policy

Sandbox networking supports an internal-only mode, a controlled outbound mode, and no network. Docker sandboxes use host-isolated internal bridges and a separate egress proxy. A recovered sandbox must still match the current network policy; an old container on a weaker network is recreated rather than reused.

The same boundary carries the turn-scoped model relay and platform-tool bridge into a network-isolated sandbox. These routes are capability endpoints, not reusable platform credentials.

References: crates/…/docker_network_isolation.rs• L14-91 crates/…/docker.rs• L209-294 crates/…/mod.rs• L368-391 crates/…/routing.rs• L97-115

PTY terminals

Terminal sessions

The PTY component provides interactive shells and AI CLI sessions inside a sandbox. The process and terminal tab belong to the sandbox rather than to one browser connection. A browser can disconnect and reconnect to the same tab. Multiple observers can receive the same output, and recent output can be replayed after attach.

The sandbox provider exposes PTY attachment as a bidirectional framed byte channel. The host or browser transports frames without needing to know whether the sandbox uses Docker or another backend. The retained agent runtime uses a separate authenticated daemon stream and does not depend on this terminal protocol.

References: crates/…/mod.rs• L318-339 crates/…/mod.rs• L482-495 crates/…/mod.rs• L791-811 crates/…/runtime_transport.rs• L28-51 docs/…/008-pty-agent.md• L29-43

Terminal protocol

The PTY agent uses a length-prefixed binary protocol over a Unix socket. Control frames open or list tabs, send input, resize a terminal, detach, kill, and keep the connection alive. Output and exit frames carry terminal bytes and process status without converting ANSI data to text.

References: crates/…/protocol.rs• L4-42 crates/…/server.rs• L39-54 crates/…/server.rs• L159-218 crates/…/server.rs• L279-397

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep normalized provider capabilities aligned with the provider catalog, route selection, saved conversation options, model discovery source, workspace readiness, and UI selectors.
  • Keep the gateway model policy aligned with structured-output validation, embedding routing, credential resolution, provider URL checks, managed-model routing, and usage accounting.
  • Keep provider key creation and updates aligned with credential tests, model catalog refresh, default-model selection, enabled-model state, and capability-cache invalidation.
  • Keep chat WebSocket event names, persisted message parts, provider session ids, turn idempotency, permission request kinds, and reconnect behavior aligned.
  • Keep MCP request and response shapes aligned with the harness bridge, notification handling, dynamic tool schemas, request-id rules, and native permission decisions.
  • Keep the current-user authorization refresh aligned with project and application topology checks. A workspace boundary must never replace live platform RBAC.
  • Keep API OpenAPI operation ids, read and write allow-lists, virtual CLI help, parameter shapes, project selectors, and router permissions aligned.
  • Keep pending-action lifecycle states aligned with inline permission waiters, detached confirm endpoints, plan ordering, encryption, and failure recovery.
  • Keep model relay bearer lifetime, upstream path allow-list, model pinning, request budgets, and sandbox network routes aligned.
  • Keep retained runtime compatibility checks, daemon transport, stable runtime identity, session continuity, and the separate PTY path aligned.
  • Keep sandbox backend identity aligned across create, recovery, routing, runtime-image replacement, network policy, snapshot operations, and workspace reuse.
  • Keep application Git binding ownership, linked-project checks, provider-origin validation, remote-name uniqueness, audit events, and sandbox clone behavior aligned.
  • Keep memory scope, prompt injection, sandbox memory command, embeddings, and best-effort failure behavior aligned.
  • Keep PTY frame formats and tab ownership aligned between the in-sandbox agent, sandbox provider, host bridge, and browser transport.

Important failure modes

TriggerConsequenceGuard
A conversation omits a provider while a host harness is configuredThe request uses the gateway instead of gaining ambient filesystem accessOmitted-provider routing is gateway-only except for explicit server-authored summary defaults (crates/…/dispatch.rs• L108-135)
A pinned provider or model is missing from current capability policyThe turn is rejected instead of silently changing model or authorityCapability validation and fail-closed explicit routing (crates/…/provider.rs• L19-35, crates/…/dispatch.rs• L108-117)
A host CLI is authenticated but no workspace credential or relay is readyApplication chat cannot start in its durable workspaceSeparate host and workspace readiness (crates/…/ai_providers.rs• L109-135, crates/…/ai_providers.rs• L719-731)
A retained workspace image fails the daemon protocol checkThe turn stops instead of using an unverified runtimeCompatibility preflight and explicit update path (crates/…/service.rs• L2275-2293, crates/…/mod.rs• L388-399)
A sandbox MCP bearer expires or does not match the turnPlatform tools are denied and the bridge cannot be reusedExpiry and constant-time capability checks (crates/…/service.rs• L1958-1973)
A malformed MCP envelope or native approval payload arrivesThe request returns a protocol or tool error instead of reaching a platform toolTyped JSON-RPC decoding and native argument validation (crates/…/mcp.rs• L16-47, crates/…/service.rs• L2001-2035)
A model supplies an unknown API parameter or wrong project selectorThe query is rejected rather than returning plausible data for a different scopeStrict parameter validation and project selector checks (crates/…/caller.rs• L235-263, crates/…/caller.rs• L325-385)
A mutating API operation is prepared without confirmationNo platform mutation occursWrite allow-list, encrypted proposal, and separate confirmation (crates/…/caller.rs• L808-891, crates/…/pending_actions.rs• L455-547)
A user role, session, API key, or project link changes during a harness turnThe running turn loses authorization before another tool or filesystem actionAuthorization refresh before native harness work (crates/…/service.rs• L66-220)
A model relay bearer expires, is wrong, or targets a non-allowed pathThe sandbox cannot reach the upstream modelExpiry, constant-time bearer check, path allow-list, request budget, and concurrency cap (crates/…/model_relay.rs• L186-301)
Docker is unavailable and local sandbox execution is not explicitly allowedAgent startup fails instead of running untrusted code on the hostExplicit TEMPS_ALLOW_LOCAL_SANDBOX gate (crates/…/plugin.rs• L92-159)
A workspace runtime replacement fails its image or network preflightThe new runtime is not adopted and the previous workspace is restoredIsolated probe and rollback (crates/…/sandbox_service.rs• L1998-2109)
A recovered sandbox no longer matches the current network policyThe old sandbox is not reused with weaker egress controlsNetwork policy validation during recovery (crates/…/docker.rs• L209-252)
A Git connection is inactive, expired, or outside the provider originThe application cannot create a binding or clone through that connectionOwned usable connections and canonical HTTPS origin checks (crates/…/git_bindings.rs• L123-203, crates/…/git_bindings.rs• L233-282, crates/…/git_bindings.rs• L423-464)
A pending plan step fails or is rejectedLater steps are skippedOrdered step check and stop-on-failure behavior (crates/…/pending_actions.rs• L664-720)
A provider key is saved with an invalid credential, URL, or unavailable default modelThe provider cannot serve requests or the saved model cannot be selectedPre-save provider test, external-URL validation, selectable-model check, and cache invalidation (crates/…/providers.rs• L351-407, crates/…/providers.rs• L529-549, crates/…/gateway_service.rs• L229-317)
A live provider model catalog is unavailable or too largeModel discovery fails without replacing the catalog with untrusted dataBounded catalog fetch, response-shape checks, supported-model filtering, and bootstrap fallback (crates/…/gateway_service.rs• L88-226)
A selected model has no active matching provider key or the managed Cloud link is unavailableThe AI request fails instead of using a different credential or routeProvider-key matching, active-key checks, and managed-model capability checks (crates/…/ai_service.rs• L403-439, crates/…/gateway_service.rs• L229-332, crates/…/gateway_service.rs• L406-443)
A PTY frame is malformed or exceeds its limitThe terminal stream loses safe framing or closesLength and frame-size checks in the PTY protocol (crates/…/protocol.rs• L17-25, crates/…/protocol.rs• L199-242)

Key files

FileWhy to read it
crates/…/service.rsDefines the provider-neutral completion, chat, streaming, tool, interaction, native-session, and process-supervisor contract.
crates/…/lib.rsShows the public AI foundation and the shared capability, streaming, and runtime types.
crates/…/provider.rsDefines normalized provider capabilities and model-catalog provenance.
crates/…/mcp.rsDefines the typed JSON-RPC and native permission contract for turn-scoped harness tools.
crates/…/streaming.rsDefines turn history, scoped services, tool events, sessions, and permission decisions.
crates/…/dispatch.rsShows gateway-versus-harness routing, summary defaults, and explicit provider pin behavior.
crates/…/runtime_transport.rsShows how an authorized sandbox carries the retained daemon runtime stream.
crates/…/model_relay.rsDefines the short-lived model capability used by sandboxed development harnesses.
crates/…/gateway_service.rsShows provider routing, credential resolution, live model discovery, managed-model access, streaming, URL checks, and embedding boundaries.
crates/…/ai_service.rsShows model policy resolution, provider capabilities, route metadata, and the gateway-backed implementation of the common AI contract.
crates/…/providers.rsShows provider credential administration, model catalog controls, and pre-save provider checks.
crates/…/structured_output.rsShows the typed streaming output path and capability checks.
crates/…/service.rsCoordinates durable turns, live authorization, tools, workspaces, MCP bridges, and provider sessions.
crates/…/handlers.rsShows conversation creation, message acceptance, WebSocket streaming, and permission endpoints.
crates/…/application.rsShows the multi-project application context and safe typed UI artifact tool.
crates/…/git_bindings.rsShows durable application Git authorization and repository-origin checks.
crates/…/api_tools.rsShows how the read-only virtual temps tool is added to chat.
crates/…/pending_actions.rsShows encrypted write proposals, inline approval, plan ordering, and execution state.
crates/…/caller.rsShows OpenAPI indexing, parameter checks, project scoping, router replay, and propose-then-confirm writes.
crates/…/catalog.rsDefines the single provider catalog for harness metadata, authentication, credential seeding, and workspace support.
crates/…/mod.rsDefines provider output, session metadata, model discovery, status, and secret scrubbing.
crates/…/executor.rsShows autonomous run preparation, memory injection, sandbox setup, and execution.
crates/…/mod.rsDefines the backend-independent sandbox, runtime, relay, and PTY boundaries.
crates/…/routing.rsShows backend selection and handle-based dispatch.
crates/…/docker_network_isolation.rsDefines the host-isolated Docker network policy.
crates/…/sandbox_service.rsShows workspace lifecycle, managed runtime replacement, source import, ownership, and rollback behavior.
crates/…/lib.rsDefines workflow memory facts and the sandbox memory client.
crates/…/server.rsShows PTY tab ownership, attach, replay, output fan-out, and process exit handling.
crates/…/protocol.rsDefines the host-to-agent terminal frame contract.