Skip to content

Make scripts, artifacts and native Workers one artifact model - #61

Merged
nicosuave merged 3 commits into
mainfrom
unify-artifact-servers
Nov 3, 2026
Merged

nicosuave merged 3 commits into
mainfrom
unify-artifact-servers

Conversation

@nicosuave

@nicosuave nicosuave commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Artifacts, scripts and native Worker apps were three separate kinds with overlapping storage, tools and docs. This makes them one artifact with two settings: whether it has a UI, and whether it runs on the managed runtime or as a native Worker. Everything that exists today keeps working without data migration.

Server-only artifacts (endpoints). artifact_write with server and no contents creates an artifact without a UI. Its whole URL (/slug/*) runs the server with slug-relative paths. UI artifacts still serve /slug/api/*. Adding contents later gives it a UI; contents: null removes it. The gallery's New script is now New endpoint.

One server contract. Server source may be a standard Workers handler, export default { fetch(request, env, ctx) } typed ExportedHandler<ServerEnv>, with env.sql, env.storage (kv, transactionSync) and env.secrets. The compiler wraps it in the existing ArtifactServer Durable Object facet, so class ArtifactServer extends DurableObject keeps working and both forms share the same database. ScriptEnv is accepted as an alias. The counter example now uses the handler form.

Logs for artifact servers. Backends capture console output, request summaries and errors with secret redaction, using the same logging module as scripts. New artifact_logs tool; run history links to per-run logs.

Legacy scripts. Existing scripts keep their storage, URLs, secrets, schedules and run history, and every script_* tool keeps its contract. When no artifact has the requested name, artifact_* read/edit/write (server only)/history/version/restore/export/request/runs/logs/schedule/secrets operate on the legacy script. artifact_list returns them as legacy_scripts. artifact_remix (and gallery Remix) and artifact_import of a script archive create a server-only artifact with fresh storage. Behavior changes: a new artifact can no longer take a legacy script's name, and the gallery labels them Legacy script.

Native Workers. The UI now says "native Worker" (filters: All / With UI / Endpoints / Native). artifact_link({kind: "app"}) gives a native Worker a root slug, private or public, keyed by the app's permanent ID so links follow app_move; the controller resolves the current owner. app_* tools and /apps/<name> management URLs are unchanged.

Docs, the artifact guide's backend topic, the script guide and skills are updated to the new model.

Validation on the stacked branch: typecheck, typecheck:cloudflare, test, test:cloudflare, test:mcp-ui, test:mcp-discovery and test:celld (against pinned celld 0.6.1) all pass. New integration tests cover server-only artifacts, module servers, logs, legacy-script fallback, remix/import upgrade and native links. The private native link owner check and live Cloudflare deployment were not exercised.

Stacked on #60 (Trash and library scope). artifact_delete and artifact_undelete also reach legacy scripts, the hosted catalog has 54 operations, and the discovery integration test exercises artifact_logs.

@nicosuave
nicosuave force-pushed the unify-artifact-servers branch from 5b4a0b9 to 3e5dc40 Compare November 3, 2026 00:33
@nicosuave
nicosuave changed the base branch from main to library-actions November 3, 2026 00:33
@nicosuave
nicosuave added this pull request to stack #62 November 3, 2026 00:33
Base automatically changed from library-actions to main November 3, 2026 15:21
An artifact now has a UI, a server, or both. A server-only artifact is an
endpoint: its whole URL runs the server with slug-relative paths. Servers
can be a standard Workers fetch handler with env.sql, env.storage and
env.secrets; the ArtifactServer Durable Object class remains supported and
shares the same database. Artifact servers now capture console logs,
readable through artifact_logs and run history.

Existing scripts stay on their own storage with unchanged script_* tools.
artifact_* tools fall back to a legacy script of the same name,
artifact_list reports them as legacy_scripts, and artifact_remix or
artifact_import turns one into a server-only artifact.

Native Worker apps are presented as native Workers and can get root
slugs, private or public, through artifact_link kind app. Links name the
app's permanent ID so they follow library moves.
@nicosuave
nicosuave force-pushed the unify-artifact-servers branch from 3e5dc40 to 06f7ca6 Compare November 3, 2026 15:21
@nicosuave
nicosuave merged commit 43ca521 into main Nov 3, 2026
14 checks passed
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