Feature 1 (Stage 5): agent artifact-publish tool + teardown cleanup#56
Open
obaid wants to merge 1 commit into
Open
Feature 1 (Stage 5): agent artifact-publish tool + teardown cleanup#56obaid wants to merge 1 commit into
obaid wants to merge 1 commit into
Conversation
…n cleanup
Add the core-owned provision-artifacts OpenClaw skill so agents can publish
web artifacts (static sites or running apps) to their public subdomain from the
box, and clean up all artifact server-side state when an agent is deleted.
- resources/skills/provision-artifacts/{SKILL.md,skill.json,tool.js}: publish/
list/unpublish via the /api/artifacts agent-token API
- Wire deploy + enable into AgentInstallScriptService, AgentUpdateScriptService,
and OpenClawDriver (mirrors provision-publish; creds hardcoded at install)
- PublishArtifactService::teardownAgent() stops app systemd units, removes the
Caddy site, and drops the Cloudflare DNS record; called from AgentController
::destroy (guarded, best-effort) before the agent row is deleted
- Tests: install-script hardcoding, teardown (with/without Cloudflare)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final stage of Feature 1 (Artifact Publishing). Gives agents the tool to publish web artifacts themselves, and cleans up all server-side state on agent deletion.
Stacked on #55 (base
feature/artifact-gated).What's here
provision-artifactsOpenClaw skill (core-owned)resources/skills/provision-artifacts/{SKILL.md, skill.json, provision_artifacts_tool.js}— an agent tool with three commands hitting the/api/artifactsagent-token API:publish— static site or running app, public or gatedlist— the agent's published artifacts + public URLsunpublish— take one offlineMirrors the
provision-publishskill pattern exactly (env-reading tool JS;apiUrl/token hardcoded at install time via str_replace).Deploy wiring
Deployed + enabled on every agent (always-on core skill), in all three paths:
AgentInstallScriptService::buildProvisionArtifactsSkillLines()(install)AgentUpdateScriptService(update +skills.entries.provision-artifacts.enabled)OpenClawDriver::deployArtifactsSkill()+ config enableLifecycle cleanup on teardown
PublishArtifactService::teardownAgent(Agent):Called from
AgentController::destroybefore$agent->delete(), guarded (try/catch+ log) and short-circuited when the agent never published anything — so it never adds SSH work to deletions of non-publishing agents.Tests
process.envplaceholder shipped)teardownAgentstops apps, removes Caddy site, drops DNS — and skips DNS when Cloudflare unconfiguredFeature 1 is now complete across the stack (#52 → #56)
agent_artifactstable, Cloudflare DNS service, Caddy on-demand-TLSaskendpoint, server setupTo go live in prod: set
CLOUDFLARE_API_TOKEN,CLOUDFLARE_ZONE_ID, andARTIFACT_DOMAIN(e.g.provisionagents.com) on Forge, and point the*.provisionagents.comwildcard (or per-agent records — the service creates them) at Cloudflare. Without those env vars the feature stays dormant (DNS steps no-op).