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 captured HTML or a saved invocation with its installed or captured 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 | HtmlView
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 | HtmlView
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
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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
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.
Captured HTML is read from the owner's stored file. Installed MCP sources must still be owned, enabled, and authorized. Both use a separate sandbox.
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 | HtmlView
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.
Source code in octomate/managers/artifacts.py
octomate.tentacles.codex.html ¶
Keep explicit visualization references out of user-facing Codex reply text.
visualization_text ¶
Remove content references, holding incomplete markers across streamed deltas.