Artifact loading¶
octomate.artifacts ¶
Authorized artifact reads, mounted by the host independently of any channel.
GET /api/artifacts/{artifact_id} reads an owned artifact without requiring a
thread. GET /api/trunkline/threads/{thread_id}/artifacts/{message_id} additionally
requires thread access and a visible ledger reference, including fork cutoffs.
Both return the saved invocation, a freshly fetched UI resource, and the configured
sandbox origin with Cache-Control: no-store. No provider credentials are returned;
there is no caller-selected resource URI or tool execution endpoint. HTML stays
untrusted JSON data here. The SPA viewer uses the configured artifact prefix;
GET /api/artifacts/config supplies that public routing configuration. The
isolated runtime is served on its configured origin through the same listener.
The proxy's response CSP bounds the inner document's inherited policy. A second, stricter CSP inside srcdoc removes the proxy's same-origin frame allowance. The inner iframe grants scripts only, so it has an opaque origin and cannot navigate the console, open popups, submit forms, or download files. No browser permissions are granted. The policy URL is public and contains no artifact or invocation data.
PERMISSIONS
module-attribute
¶
PERMISSIONS = "camera=(), microphone=(), geolocation=(), clipboard-read=(), clipboard-write=(), fullscreen=(), display-capture=(), payment=(), usb=()"
artifact_router
module-attribute
¶
ArtifactSandbox ¶
Dispatch the configured sandbox origin before any console or account route.
Reverse proxies must preserve Host and the external scheme. Requests on this origin cannot reach Octomate APIs, OpenAPI, cookies, WebSockets, or SPA assets. The sandbox paths are unavailable on all other origins.
Source code in octomate/artifacts.py
artifact_errors ¶
Translate artifact loading failures into safe, uncached HTTP responses.
Unknown or inaccessible artifacts/installations return 404, missing or same-origin sandbox configuration returns 503, and invalid or failed upstream resource reads return 502. Upstream exception details stay server-side.
Source code in octomate/artifacts.py
artifact_config
async
¶
artifact_config(
manager: Annotated[
ArtifactManager, Depends(artifact_manager)
],
) -> ArtifactConfig
Public viewer routing settings; provider credentials are never exposed.
Source code in octomate/artifacts.py
read_artifact
async
¶
read_artifact(
artifact_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[
ArtifactManager, Depends(artifact_manager)
],
request: Request,
) -> McpAppView
Read owned content independently of whether any thread still references it.
Source code in octomate/artifacts.py
read_thread_artifact
async
¶
read_thread_artifact(
thread_id: UUID7,
message_id: UUID7,
user: Annotated[User, Depends(current_user)],
manager: Annotated[
ArtifactManager, Depends(artifact_manager)
],
request: Request,
) -> McpAppView
Read an owned artifact only through a reference visible in this thread.
Source code in octomate/artifacts.py
sandbox_csp ¶
Construct restrictive source lists; only the outer proxy may frame itself.
Source code in octomate/artifacts.py
sandbox_proxy
async
¶
Validate policy before emitting headers; HTML arrives later via postMessage.
Source code in octomate/artifacts.py
sandbox_script
async
¶
The proxy's bundled script, with no console assets on this origin.
Source code in octomate/artifacts.py
octomate.managers.artifacts ¶
Owned artifact loading, including access through a thread's visible ledger.
ArtifactUnavailable ¶
ArtifactSandboxUnavailable ¶
ArtifactViewerUnavailable ¶
ArtifactManager ¶
Bases: Manager
Authorize artifact ownership and hosting before fetching saved UI resources.
Source code in octomate/managers/artifacts.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
overview
async
¶
Read an owned artifact's card metadata without contacting its provider.
Only the saved title, provider name, identity, and viewer URL leave this method. An overview does not grant access to its recipients or guarantee that the installation is still available; the viewer checks that on open. Missing viewer configuration raises ArtifactViewerUnavailable.
Source code in octomate/managers/artifacts.py
load
async
¶
Read owned content independently of its thread, without executing tools.
The saved installation must still be owned, enabled, and authorized. A separate sandbox origin is required before any UI resource is fetched.
Source code in octomate/managers/artifacts.py
load_from_message
async
¶
load_from_message(
thread_id: UUID7,
message_id: UUID7,
user: User,
*,
console_origin: AnyHttpUrl,
) -> McpAppView
Read an owned artifact through an accessible thread and visible reference.
Inherited references obey the fork's cutoff. Thread participation does not grant content ownership; the standalone load applies that check as well.