Skip to content

Static artifact publishing end-to-end#53

Open
obaid wants to merge 1 commit into
feature/artifact-foundationsfrom
feature/artifact-static-publish
Open

Static artifact publishing end-to-end#53
obaid wants to merge 1 commit into
feature/artifact-foundationsfrom
feature/artifact-static-publish

Conversation

@obaid

@obaid obaid commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Feature 1, PR 2 of ~5. Stacked on #52 (foundations) — review/merge that first. This is where artifact publishing first works, for static sites.

What

An agent publishes a static artifact and it's served at {agent.slug}.provisionagents.com/{path}.

Piece Detail
CaddyArtifactService Rebuilds the agent's /etc/caddy/sites/{slug}.caddy from its live artifacts (a file_server handle_path per static artifact) and reloads Caddy over the CommandExecutor (SSH on cloud, Docker locally).
PublishArtifactService Orchestrates publish/unpublish: ensures the Cloudflare DNS record, syncs Caddy, tracks status/public_url, and removes the DNS record once the agent has no artifacts left. Marks the artifact error and rethrows if the sync fails.
ArtifactController (agent-token) POST / GET / DELETE /api/artifacts — same auth channel as tasks. Static-only for now; validates + sanitizes path_slug/source_dir.
Dashboard An Apps tab on the agent page lists published artifacts with their public URL + an unpublish action (session-auth web route, team-admin gated).

Artifact files live under the agent's workspace at /root/.openclaw/agents/{id}/public/{source_dir} — the agent writes them, then publishes to wire up Caddy.

Tests

tests/Feature/Artifacts/ (16 new): Caddy config generation + synced-via-mocked-executor, publish/unpublish orchestration (DNS + Caddy mocked, incl. error path), the agent-token API (publish/list/unpublish/cross-agent 404/bad-slug/no-server), and the dashboard (show props + web unpublish + team scoping). Full suite green (752); type-check + build clean.

Next

  1. running apps (systemd + port allocation + reverse_proxy) · 4) gated access (forward_auth token) · 5) agent publish tool.

Still needs the Forge env vars from #52 to create real DNS; without them publishing still writes Caddy config (useful with a manual/wildcard DNS setup) and just skips the Cloudflare call.

Agents can now publish a static web artifact and have it served at
{agent.slug}.provisionagents.com/{path}.

- CaddyArtifactService: rebuilds the agent's /etc/caddy/sites/{slug}.caddy from
  its live artifacts (file_server per static artifact) and reloads Caddy over
  the CommandExecutor (SSH/Docker).
- PublishArtifactService: orchestrates publish/unpublish — ensures the
  Cloudflare DNS record, syncs Caddy, tracks status/public_url, and drops the
  DNS record when the agent has no artifacts left.
- ArtifactController (agent-token): POST/GET/DELETE /api/artifacts for agents.
- Dashboard: an Apps tab on the agent page lists published artifacts with their
  public URL + an unpublish action (web route).

App (running-process) and gated artifacts are scaffolded but not yet wired —
those are the next stages. Full suite green (752).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant