artifacts.py

A web API route for opening a web page as an artifact tab and managing whether that page is embedded. It checks the page's origin and whether it can be displayed safely.

In plain words
What is it for?
Opening web pages in an artifact viewer, checking whether they can be embedded, and setting or clearing a user's manual embed choice.
Why use it?
It keeps artifact URL handling small and consistent while protecting against unsafe server-side requests and incorrect origin settings.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/netmindai-open/narranexus/artifacts.py
Clone the repo
git clone --depth 1 https://github.com/NetMindAI-Open/NarraNexus
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,167 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02167
Opus 5 $0.00000 $0.01084
Sonnet 5 $0.00000 $0.00433
Haiku 4.5 $0.00000 $0.00217

Measured 2d ago against content hash a84a2890c577, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

artifacts.py scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.mindflow/mirror/backend/routes/agents/artifacts.py.md · 180 lines

How it starts

The opening of the file, as written. The whole thing — 180 lines — stays where its author put it; the contents beside it link to each section on GitHub.

2026-07-22 — URL-tab endpoints

The POST .../artifacts/url handler computes the browser origin via artifacts_public._app_origin(request) and passes it to ArtifactService.open_url as app_origin, so the self-origin guard is robust even if public_base_url is misconfigured (defense in depth for the allow-same-origin URL iframe).

Added POST /{aid}/artifacts/url (open a web page as a URL tab; SSRF-gated, probes embeddability) and POST /{aid}/artifacts/{id}/embed-mode (set/clear the user's manual embed override). Both are thin shells over ArtifactService.open_url / .set_embed_mode — same auth + error-mapping pattern as the rest of this router.

2026-07-21 — thinned to an HTTP shell; heal moved to ArtifactService

Artifact business logic left this file for the new xyz_agent_context/artifact/ package ([[artifact_service.py]]):

  • The whole heal recovery strategy (_KIND_EXTENSIONS, workspace scan, three-step sequence) moved to the service ([[heal.py]]); the endpoint now just maps auth + ArtifactError.code → HTTPException. HealResponse / HealCandidate became the shared schema models HealResult / HealCandidate (same field names — the wire shape is unchanged).
  • Register delegates to ArtifactService.register (the same single implementation the MCP tool and bootstrap use) instead of importing the module-private _common_tools_impl.artifact_runner.
  • PATCH title now goes through ArtifactRepository.update_title instead of a raw db.update("instance_artifacts", ...) inline in the handler.
  • The repeated get+ownership-check pattern collapsed into _get_owned_artifact (still 404 on mismatch — no existence leak).

References to artifact_runner in older entries below are historical; the code lives in xyz_agent_context/artifact/_artifact_impl/registration.py now.

2026-05-20 — stale "quota" wording removed

The per-user artifact quota was removed in v1.7.0 (see [[artifact_runner.py]]). Two leftover mentions of a "validation/quota path" / "same quota" in this doc were factually wrong (no quota is enforced anywhere) and have been corrected to just "validation" / path-confinement.

Read the full file on GitHub · 180 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 180 lines · 0 tokens per session scan A a84a2890c577

Subscribe to this mod's changes

artifacts.py is an agent published in the GitHub repository NetMindAI-Open/NarraNexus (84 stars, last pushed 9d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,167 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

alchemist

Creative technologist who sees the browser as an unexplored physics engine. Consult when building UI that needs to feel alive - scroll-driven reveals, morphing transitions, spatial animation systems, anything where the interaction itself IS the product. Thinks in weight, tension, and breath before thinking in code.…

drobins25/craft · 355 tokens

praman-sap-planner-cli

SAP UI5 test planner via Playwright CLI. Token-efficient alternative to MCP planner. Generates test plan + gold-standard spec using CLI commands.

mrkanitkar/playwright-praman · 36 tokens

FAI Browser Agent

Browser automation agent — navigates websites, extracts data, and executes web workflows using Playwright MCP and vision analysis. Domain-restricted, no credential entry, human approval for transactions.

frootai/frootai · 41 tokens

dogfood-persona

Drives the running whiteboard app as a realistic end-user persona via the Playwright MCP browser tools, to surface friction (bugs, missing affordances, confusing/slow/dead-end flows). Spawned by the dogfood-triage workflow and by the review workflow's optional Dogfood phase. Pass the persona, goal, app URL, and (for…

kamiazya/whiteboard · 86 tokens

e2e-tester

Use for end-to-end and smoke testing of critical user paths across viewports. Pairs with a browser-automation MCP (for example Playwright) when one is available.

mnzralee/claude-multi-agent-architecture · 41 tokens

agent-instructions

You are an AI agent executing a task on behalf of the user. Follow these instructions carefully.

caihongxu/palmier · 0 tokens