Skip to main content
ArtifactsRuntimeCapability exposes ArtifactsApi under platform.artifacts. It manages durable deliverables generated by plugins and Agents, including HTML, Markdown, PDF, PowerPoint, images, files, Sites, and presentations. Ordinary generated files can live in Workspace Files. Protected definitions use Artifact-owned content storage, described below. The Artifact service adds stable business identity, immutable version history, governed access links, lifecycle state, and access counters.

Data model

An Artifact flow has three layers:
  1. Artifact container — stable plugin-owned identity defined by pluginName, resourceType, and resourceId.
  2. Artifact version — immutable content described by a WorkspacePortableFileReference, MIME type, checksums, and metadata.
  3. Artifact link — an open/share/download entrypoint with a version policy, access mode, expiration, and presentation policy.
Supported Artifact kinds are html, markdown, pdf, pptx, image, file, site, and presentation.

Container and version methods

listArtifacts supports a literal resourceIdPrefix and optional includeCurrentVersion metadata without loading content. ensureArtifactVersion.expectedCurrentVersionId adds compare-and-set protection; null expects no current version. An idempotent retry must not restore an old save over a newer version. Container status is active, archived, or deleted. Version status is active or deleted. Link status is active, revoked, or expired. versionMode: 'latest' follows the current Artifact version; versionMode: 'version' pins an immutable version. Access modes are:
  • owner_only
  • workspace_all
  • organization_all
  • custom_principals
  • public_link
  • signed_preview
Presentation can use inline or attachment, can allow or disallow download, and can apply the strict or interactive safe-HTML profile.

Publish a generated file

For an ordinary generated file, resolve capabilities from the authorized Agent runtime, write bytes to Workspace Files, then create or reuse the Artifact version and share. The following is a server-side integration excerpt; identifiers and bytes come from the authorized operation:
Use a deterministic version idempotencyKey that represents the same immutable content. ensureArtifactVersion() reports created or reused; ensureArtifactShare() reports created, reused, or replaced.

Drafts and explicit publication

ArtifactDraftsRuntimeCapability (platform.artifact-drafts) exposes mutable working copies independently of formal versions: Use revision 0 for a new draft and null for an expected absent formal version. Conflicts require reloading and reconciling; never silently rebase a stale edit. A retry of the same publication returns the same formal version. Saving a draft does not update an existing published link. Expose publish only through a trusted application action after explicit human confirmation, never as an Agent tool. A type may require versioning: { mode: 'draft-only' }, with authorizeDraft and assertDraftPublication enforcing additional policy. The latter runs again under the publication lock. Generic version uploads cannot bypass that workflow. Recycling revokes links; restoring does not reactivate them. Leave get’s includeArchived unset for ordinary editors; it is intended for catalog/recycle-bin reads.

Type providers and protected content

Register a provider with @ArtifactTypeProvider(resourceType) and implement IArtifactTypeProvider. Include it in the plugin module. Its definition declares allowed kinds, MIME types, byte limits, sharing rules and presentation mode. authorize enforces business restrictions; validateContent validates bytes. Optional publication/link hooks can narrow policy further. type is a business type, kind a format family and mimeType a byte format. An explicit { pluginName, resourceType } type must match the source. The loader binds installation provenance; a missing required provider denies access. Omitting type selects ordinary built-in file behavior, but cannot bypass a registered custom source type. Previously untyped experimental records need authorized republishing. Presentation modes are:
  • file: serve the authorized immutable file.
  • snapshot: render deliberately published snapshot data through a packaged isolated entry, without query operations.
  • authenticated: render as the current viewer through an ArtifactPresentationProvider from the same installation.
Use ArtifactContentRuntimeCapability (platform.artifact-content) for Artifact-owned definitions that ordinary Project/Assistant file listings and tools must not expose. write({ artifactId, buffer }) returns a portable reference; read(reference) authorizes the exact owning draft or formal version. The host checks canonical references, integrity and the 50 MB limit. Do not fall back to raw file access on denial.

Ownership and source authorization

The canonical source is pluginName + resourceType + resourceId. Optional authorizationProviderKey selects the content resource provider that authorizes that same resource; it does not replace the owner or share audience. Omit scope.userId for current-user ownership. Explicit scope: { projectId, userId: null } selects shared Project ownership while preserving the authenticated creator. Project read/edit/manage policy still applies. Lists and source lookup return only currently authorized Artifacts. By default, Project membership and share audience are cumulative restrictions. A type may explicitly use sharing.projectAccess: 'link-audience' only for authenticated presentations with organization/workspace audiences. This permits a manager’s share of the published definition outside Project membership, while retaining provider/resource ACLs. It never extends to drafts, edits, library references, generic file APIs, data queries or anonymous sharing.

Authenticated presentations

Register @ArtifactPresentationProvider({ pluginName, resourceType }) and implement IArtifactPresentationProvider for an authenticated type. getEntry() returns packaged HTML, read(context) supplies initial data, operations declares read-only operation names and query(context, request) runs them as context.actor. The context contains the authorized formal version and bytes. Never substitute the creator for the current viewer. Validate input and keep saves, draft edits and publishing outside this interface. The host rechecks link status, permissions and the target version before returning query results. A follow-latest link must be reopened when its target changes. Use the platform-returned ArtifactLinkRecord.presentationUrl (/artifacts/view/:slug). An authoring Remote View declares and invokes artifact.presentation.open with { url: presentationUrl }; handle missing command support or popup blocking. Do not relax the iframe sandbox. The standalone presentation requires normal authenticated login and exposes only declared read operations, without authoring, navigation or file channels. An outer Artifact presentation remains an isolated no-network host. If its renderer embeds an HTML Artifact Document, that inner document’s explicit policy is a separate integration contract, not permission to relax the outer host.

Project library references and copies

ArtifactLibraryRuntimeCapability (platform.artifact-library) exposes add, open, selectVersion, share and revoke. Adding a pinned reference does not publish a link or grant source access. Opening requires both Project membership and current source authorization. Renaming, moving or removing the reference does not mutate the original Artifact; selecting another reference version does not change a published link. readArtifactVersion({ artifactId, artifactVersionId, purpose }) reads authorized formal bytes with content and checksum validation. purpose: 'copy' also requires definition.collection.allowCopy: true. Custom types deny copying by default; ordinary built-in files permit it. Copies have an independent lifecycle and the destination Project’s ACL: explain and confirm that boundary in the collecting UI. Conversation snapshots remain reference-only.

Security and lifecycle rules

  • Do not store content bytes in Artifact metadata. Use Workspace Files for ordinary output or Artifact Content for protected definitions, and pass the portable reference.
  • Require explicit user confirmation before requesting public_link; set userConfirmedPublicLink in the access input.
  • Use createSignedPreviewLink() only for short-lived previews. Store a shareKey and use ensureArtifactShare() for a durable share policy.
  • Pin a version for review, approval, audit, and reproducible delivery. Use latest only when readers should always see the current version.
  • Choose strict HTML unless the deliverable needs the platform’s interactive HTML allowance.
  • Revoke links or share slots when access should end. Archiving the business object should also drive the plugin’s Artifact lifecycle policy.