UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) • 16.4 kB
import{U as A}from"./url-slug-CII_0B7H.js";import{T as I}from"./session-runtime-DBl1Hlcw.js";import{aJ as a,bF as t,aK as e,bn as r,ct as o,cs as s,dH as d,dD as p,eQ as k,dJ as R,dB as w}from"./index-ztdGKvBm.js";const v=a({connection_id:e().describe("Connection ID"),selected_tools:t(e()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:t(e()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:t(e()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),h=500,y=200,_=200,E=20,U=50,P=100,T=20,C=100,N=300,V=100,O=8192,S=v.extend({selected_tools:t(e()).max(h).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:t(e()).max(h).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:t(e()).max(h).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),D=a({connectionId:e(),toolName:e(),label:e(),icon:e().nullable().optional()}),L=a({id:e().describe("Stable id; used as React key and ?tab= value"),title:e().describe("Tab label"),icon:e().optional().describe("Optional lucide icon name"),view:a({type:d("ext-app"),appId:e(),args:p(e(),w()).optional()})}),l=s(["overview","context","monitor","plan","reports","board","site-editor","calendar","experiments","blog","assets","releases","hosting","e2e","analytics","cdn","automations"]),pe=s(["on","off"]),B=new Map([["manual","on"],["auto","on"]]),X=s(["on","off","manual","auto"]);function F(n){if(!n)return null;const i=B.get(n);return i||(n==="on"||n==="off"?n:null)}const j=a({defaultMainView:a({type:e(),id:e().optional(),toolName:e().optional()}).nullable().optional(),chatDefaultOpen:o().nullable().optional(),cmsDefaultOpen:o().nullable().optional(),cms:X.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:t(l).max(l.options.length).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:t(L).max(T).optional()});function be(n){return F(n?.cms)??"on"}function ue(n,i){const c=i==="off"&&n?.defaultMainView?.type==="content";return{...n,cms:i,cmsDefaultOpen:null,...c?{defaultMainView:{type:"site-editor"}}:{}}}const f=a({tileId:e().optional(),connectionId:e().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:e().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:e().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:p(e(),w()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:r().int().positive().optional(),maxHeight:r().int().positive().optional()}),H=a({banner:e().nullable().optional(),bannerColor:e().nullable().optional(),icon:e().nullable().optional(),themeColor:e().nullable().optional(),pinnedViews:t(D).max(P).nullable().optional(),layout:j.nullable().optional(),homeTile:f.nullable().optional(),homeTiles:t(f).max(E).nullable().optional(),homePrompts:t(e()).max(U).nullable().optional()}),z=/^[A-Za-z_][A-Za-z0-9_]*$/,g=e().min(1).regex(z,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),K=R("kind",[a({key:g,kind:d("literal"),value:e().max(O)}),a({key:g,kind:d("secret"),secretId:e().min(1)})]),q=2,G=a({path:e().trim().min(1).max(256).describe("Path (relative to repo root) to the app's package.json directory.")}),W=a({selected:e().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:e().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:e().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),apps:t(G).max(q).nullable().optional().describe("Additional monorepo apps previewed beside the one at `path`, each run by its own dev server on the main app's install. Started only when the organization's `multi_app_preview` flag is on."),env:t(K).max(V).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config.")}),J=a({url:e().describe("Repository URL, including its provider host"),owner:e().describe("Repository owner"),name:e().describe("Repository name"),installationId:r().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:e().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:e().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),Y=s(["agent-sandbox","local-api"]),Z={sandboxHandle:e().describe("Provider-specific handle"),previewUrl:e().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:e().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:r().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:a({packageManager:e().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:e().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:e().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START"),apps:t(e()).nullable().optional().describe("Extra app paths the sandbox was given at SANDBOX_START; null when none were sent.")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path/apps) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},x=a(Z);function he(n){if(!n||typeof n!="object"||Array.isArray(n))return{};const i=n,c={};for(const[b,u]of Object.entries(i))if(!(!u||typeof u!="object")&&!(b!=="agent-sandbox"&&b!=="local-api"))try{c[b]=x.parse(u)}catch{}return c}const Q=p(e().describe("userId"),p(e().describe("branch"),k(Y,x))),$=a({id:e().describe("Stable identifier for this knowledge file"),name:e().describe("File name shown in the UI"),kind:s(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:e().describe("Org filesystem (Library) volume the file lives in"),path:e().describe("Path within the volume"),url:e().describe("Same-origin URL to read the file (display/download)"),contentType:e().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:r().nullable().optional().describe("File size in bytes"),addedAt:e().describe("ISO timestamp when the file was attached")}),ee=t($).max(C).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),te=s(["smart","code-review","open"]),ae=te.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),ne=o().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),ie=o().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),oe=e().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),se=a({branch:e().describe("Git branch backing this release"),name:e().describe('User-facing name, e.g. "Black Friday 2026"'),color:e().describe("Dot color token shown in the version switcher"),createdBy:e().optional().describe("User ID who created the release"),createdAt:e().optional().describe("ISO 8601 creation timestamp"),runtime:s(I).optional().describe("Session runtime the release was created in. Picking a 'sandbox' release opens a coding session on its branch, since a CMS session renders production's code and would hide the branch's code changes. Absent ⇒ the project's default.")}),le=t(se).max(N).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),m={instructions:e().nullable().optional().describe("Instructions also used as system prompt"),subAgents:t(e()).max(_).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),ui:H.nullable().optional().describe("UI customization settings"),sidebarViews:t(l).max(l.options.length).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:d(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),sidebarViewsSeen:t(l).max(l.options.length).nullable().optional().describe("Views Studio offered this project once on top of an exact sidebarViews list (the top rows and Blog, plus Experiments and Calendar on a Blocks site and Hosting beside a hosted site's Site Editor). A view listed here shows only when sidebarViews selects it, so hiding it sticks."),repository:J.nullable().optional().describe("Linked repository"),runtime:W.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:ee,siteSlug:e().nullable().optional().describe("The project's site id (asset tenancy, CDN paths, site tokens). Set once when the site is created or imported; any write that would change it is refused."),assetStorageConfigId:e().trim().min(1).nullable().optional().describe("Organization file configuration used for this project’s assets. null/absent uses automatic site matching."),publishPolicy:ae,previewServerUrl:oe,productionUrl:e().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:o().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),legacyBlogPostFormat:o().nullable().optional().describe("Blog: edit a post's body as one HTML document in `post.content` (the format sites built before `sections` read), instead of blocks in `post.sections`."),fastPreview:ne,releases:le,fastPreviewInPlace:ie},me=a({id:e().describe("Unique identifier"),title:e().describe("Human-readable name"),url_slug:e().nullable().optional().describe("Name of the project in Studio URLs, unique in the organization"),description:e().nullable().describe("Description"),icon:e().nullable().describe("Icon URL"),created_at:e().describe("Creation timestamp"),updated_at:e().describe("Last update timestamp"),created_by:e().describe("User ID who created this item"),updated_by:e().optional().describe("User ID who last updated this item"),organization_id:e().describe("Organization ID this item belongs to"),status:s(["active","inactive"]).describe("Current status"),pinned:o().describe("Whether this space is pinned to the sidebar"),metadata:a(m).extend({instructions:e().nullable().describe("Instructions also used as system prompt"),sandboxMap:Q.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:t(v).describe("Connections with their selected tools, resources, and prompts")}),M=a({title:e().min(1).max(120).describe("Short label shown on the chip"),description:e().max(280).optional().describe("One-line subtitle shown under the title"),text:e().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});a({title:e().min(1).max(255).describe("Name for the virtual MCP"),description:e().max(500).nullable().optional().describe("Optional description"),icon:e().nullish().describe("Optional icon URL"),status:s(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:o().optional().default(!1).describe("Pin to sidebar"),metadata:a(m).loose().superRefine((n,i)=>{"sandboxMap"in n&&i.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:t(S).max(y).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:t(M).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});a({title:e().min(1).max(255).optional().describe("New name"),url_slug:A.nullish().describe("New URL slug. The old one keeps redirecting. Renaming does not change it. null keeps the current slug."),description:e().max(500).nullable().optional().describe("New description (null to clear)"),icon:e().nullish().describe("New icon URL"),status:s(["active","inactive"]).optional().describe("New status"),pinned:o().optional().describe("Pin/unpin from sidebar"),blocksV8:o().optional().describe('Org owners and admins only: turn the project\'s "Blocks v8 site" switch on or off (`metadata.blocksV8`). On, Studio edits the site with the Blocks v8 editor and the hosted CMS, and `deco schema push` is accepted; off, it is a v7 site. Never set through `metadata`.'),metadata:a(m).loose().superRefine((n,i)=>{"sandboxMap"in n&&i.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:t(S).max(y).optional().describe("New connections (replaces existing)"),prompts:t(M).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});export{pe as C,z as E,q as R,me as V,N as a,he as p,be as r,ue as w};