Ir al contenido

Workspace Library

Esta página aún no está disponible en tu idioma.

import { Aside } from ‘@astrojs/starlight/components’;

The Workspace Library lets a paid account publish private, versioned JavaScript modules and import them into artifacts like a CDN library (e.g. plotly) — scoped to the account or workspace. It’s the reusable-code counterpart to the Skill Marketplace, which shares reusable prose for the agent.

ScopeWho can importServes at
Personalthe owner’s own artifacts/lib/@u/<user-handle>/<name>@<semver>.js
Workspaceevery workspace member’s artifacts/lib/<workspace-slug>/<name>@<semver>.js

A module is a .js file published with artifact_type: "library". The README is the entrypoint (rendered with copy-paste import snippets); the module JS serves at the /lib/... URL. Modules are pure — data passed in as arguments, with no ambient SDK, credentials, or network — so a module can’t reach your data unless the host hands it in. Module bytes are public by URL (like any CDN lib); privacy lives in the catalog.

In the app: Library → + New module (name, version, scope, code, README).

Via API (POST /v1/publish):

{
"artifact_type": "library",
"entrypoint": "README.md",
"workspace_id": "wsp_…",
"library": { "version": "1.0.0", "main": "index.js", "exports": ["bar"] },
"files": [
{ "path": "README.md", "content": "# charts", "mime": "text/markdown" },
{ "path": "index.js", "content": "export const bar=(el,rows)=>{};", "mime": "text/javascript" }
]
}

Omit workspace_id for a personal module. Versions are immutable — re-publishing a semver returns 409. Bump the version to ship a change.

const { bar } = await so.lib('charts'); // pinned-or-latest for this artifact

An artifact can pin a module at a chosen version so it stays stable across re-publishes:

MethodEndpointWho
GET/v1/artifacts/{id}/lib/{name}public — resolve to import URL
GET/v1/artifacts/{id}/libsviewer — list pins
POST/v1/artifacts/{id}/libseditor — pin { name, version? }
DELETE/v1/artifacts/{id}/libs/{name}editor — unpin

Catalog: GET /v1/workspaces/{id}/libraries (workspace) and GET /v1/me/libraries (personal). See the SDK reference for so.lib.

Bundling (TS/JSX/npm — pre-bundle and upload the output); modules that call the SDK; private module bytes; semver ranges; eject-to-source.