Repository navigation
Make scripts, artifacts and native Workers one artifact model - #61
Merged
Merged
Conversation
nicosuave
force-pushed
the
unify-artifact-servers
branch
from
November 3, 2026 00:33
5b4a0b9 to
3e5dc40
Compare
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
force-pushed
the
unify-artifact-servers
branch
from
November 3, 2026 15:21
3e5dc40 to
06f7ca6
Compare
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.
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_writewithserverand nocontentscreates an artifact without a UI. Its whole URL (/slug/*) runs the server with slug-relative paths. UI artifacts still serve/slug/api/*. Addingcontentslater gives it a UI;contents: nullremoves 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) }typedExportedHandler<ServerEnv>, withenv.sql,env.storage(kv, transactionSync) andenv.secrets. The compiler wraps it in the existingArtifactServerDurable Object facet, soclass ArtifactServer extends DurableObjectkeeps working and both forms share the same database.ScriptEnvis 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_logstool; 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_listreturns them aslegacy_scripts.artifact_remix(and gallery Remix) andartifact_importof 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 followapp_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_deleteandartifact_undeletealso reach legacy scripts, the hosted catalog has 54 operations, and the discovery integration test exercisesartifact_logs.