Skip to content

API Reference parrot_formdesigner.core.snippets

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.core.snippets

View source

Snippet, manifest, and sandbox-boundary models for FEAT-459.

Defines the data every other formbuilder-custom-code module (loaders, resolver, sandbox pools, router, broker) shares. Mirrors the model_config = ConfigDict(extra="forbid") convention of core/events.py — no new model in this feature accepts unknown fields.

Class AbortSignal

Serialisable form of FormEventAbort — verified: core/events.py:201.

Fields:

Field Type Default Description
reason str
user_message str
status_code int 403

Class BrokerAllowlist

Explicit outbound permissions for tier BROKERED / TOOLKIT.

Fields:

Field Type Default Description
http_hosts tuple[str, ...] ()
query_tables tuple[str, ...] ()
notifications tuple[str, ...] ()
toolkits tuple[str, ...] ()

Class CapabilityDenied

Raised by the host broker when a request is outside the manifest allowlist.

Class CapabilityManifest

What a snippet declares it needs.

The security contract, and the unit services/snippets/conformance.py (M15) checks the source against. timeout_ms/max_memory_mb bounds mirror the OQ-6 pool sizing defaults documented in spec §7.

Fields:

Field Type Default Description
tier CapabilityTier
auth_claims tuple[str, ...] ()
stdlib_modules tuple[str, ...] ()
allowlist BrokerAllowlist
timeout_ms int 5000
max_memory_mb int 128

Class CapabilityTier

Declared power level of a snippet; selects its executor (spec §2).

Alias EventResolution

Re-exported from parrot_formdesigner.core.events.EventResolution.

Alias FormEventName

Re-exported from parrot_formdesigner.core.events.FormEventName.

Class SandboxContext

Serialisable projection of FormEventContext that crosses the boundary.

Deliberately NOT FormEventContext: auth_context on that model is a live object typed Any (core/events.py:128) and must never be handed to a worker. This model has no token/headers field by construction (OQ-5) — there is no field to accidentally populate.

Fields:

Field Type Default Description
event FormEventName
form_id str
tenant str | None
claims Mapping[str, Any]
payload Mapping[str, Any] | None None
schema_dump Mapping[str, Any] | None None
user_message str | None None
extra Mapping[str, Any]

Class SandboxOutcome

What a worker returns. Exactly one of resolution/abort is set.

Fields:

Field Type Default Description
resolution EventResolution | None None
abort AbortSignal | None None
duration_ms float
broker_calls int 0

Class SnippetBundle

One snippet from either source: manifest + Python half + optional TS half.

Fields:

Field Type Default Description
source SnippetSource
status SnippetStatus SnippetStatus.PUBLISHED
version int 1
approved_by str | None None
approved_at datetime | None None
handler_ref str
event FormEventName
tenant str | None None
manifest CapabilityManifest
python_source str
python_sha256 str
client_source str | None None
client_sha256 str | None None

Class SnippetIntegrityError

Raised when a snippet's source hash does not match its manifest.

Class SnippetNotApprovedError

Raised when execution is attempted against a DRAFT or REVOKED bundle.

Class SnippetSource

Where a bundle came from. Determines its approval gate and tier cap.

Class SnippetStatus

Lifecycle of a DB-sourced tenant snippet.

GIT bundles are always PUBLISHED by construction — an unmerged snippet does not exist on disk, so there is no DRAFT/REVOKED state for it.

Class SnippetTierUnavailableError

Raised when a bundle declares tier 3/4 but gVisor is unavailable (OQ-4).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally