Skip to main content

Deployment Webview Protocol

View as Markdown

Deployment webview protocol

The deploy surfaces (the file view's DEPLOY page and the team-deployment record drawer) are rendered by shared UI components inside the Project webview; the extension host owns the SDK connection and does ALL SDK-to-view-model mapping before anything crosses postMessage. The contract lives in src/providers/types/deployTypes.ts — this page mirrors its exported surface. (One exception: shell:connectionChange is deliberately not declared in deployTypes.ts; it comes from ShellHostToWebview, composed into the per-view unions in types.ts.)

Conventions shared by both protocols:

  • View-model DTOs (DeployTeamRefDTO, DeployVersionCardDTO, TeamDeploymentRowDTO, TeamDeploymentScheduleDTO, DeployHistoryRowDTO, DeployScheduleRowDTO, DeploymentInfoDTO, SchedulePreviewResultDTO) mirror apps/shared/src/components/deploy-panel/types.ts — the contract of record — field-for-field, so the webview hands them to the shared DeployPanel / DeploymentView components unchanged.
  • Two correlation styles: MUTATION and RPC-style requests (deploy:artifact/deploy:publish/deploy:deploy, every deployment:* mutation, deployment:preview, deployment:validate) carry a requestId. Pure mutations' …actionResult reply echoes it with only an optional error string; the RPC-style reads' replies also carry their payload alongside the same echo — deploy:artifactResult carries pipeline?, deployment:previewResult carries result (+ optional error), and deployment:validateResult carries result. FETCH messages (deploy:fetch, deployment:fetch) carry NO requestId: their answer is a scoped push (deploy:data; deployment:load / deployment:error stamped with teamId + optional sourceId) that the host also re-sends after mutations, so it cannot be request-correlated by design.
  • Push-driven refresh: nothing on these surfaces polls. The host relays apaevt_deploy invalidation events and live apaevt_task folds; the WEBVIEW then drives its own re-fetch.
  • Personal-deployment id mapping: a personal deployment's RECORD id is the owner key user~{uid}; the wire id for API calls is @me. The HOST performs that mapping — API calls go out addressed @me, while every push (deployment:load / deployment:error) is stamped with the raw user~{uid} the webview opened with, so the record guard matches its own pushes.

Deploy lifecycle (the file view's DEPLOY page)

DeployLifecycleWebviewToHost / DeployLifecycleHostToWebview:

DirectionMessagePayloadPurpose
webview to hostdeploy:fetchprojectIdRequest the lifecycle snapshot for this project.
host to webviewdeploy:dataversions, deployments, teamsThe full snapshot: registry versions (newest first), this project's team deployments (the where-live rows), and the caller-visible teams with control rights. Pushed on fetch and after mutations.
webview to hostdeploy:artifactrequestId, projectId, versionFetch one immutable artifact's pipeline for the version cards' readonly-canvas record drawer.
host to webviewdeploy:artifactResultrequestId, pipeline?, error?The sha-verified pipeline JSON, or the failure reason.
webview to hostdeploy:publishrequestId, comment, deployTo?Publish the SAVED document as the next registry version (deployTo = one-step publish+deploy).
webview to hostdeploy:deployrequestId, projectId, version, teamIdPoint a team at a version — promotion and rollback alike.
host to webviewdeploy:actionResultrequestId, error?Completion ack for publish/deploy requests.

Deployment record drawer (rides the Project webview channel)

The drawer lives INSIDE the Project webview, so every webview-to-host message carries the TEAM identity (the project identity is the panel's own). The scoped pushes (deployment:load, deployment:error) stamp it back so a switched drawer ignores stale ones; the requestId-correlated replies (deployment:actionResult, deployment:previewResult, deployment:validateResult) and shell:connectionChange carry no teamId — correlation or broadcast semantics make it unnecessary.

DeploymentWebviewToHost / DeploymentHostToWebview:

DirectionMessagePayloadPurpose
webview to hostdeployment:fetchteamId, sourceId?(Re-)fetch the deployment snapshot — on drawer open, on an apaevt_deploy invalidation, and after every mutation. sourceId absent = the TEAM record.
host to webviewdeployment:loadteamId + DeploymentLoadPayloadThe full host-mapped state of one team deployment: header info, the immutable artifact pipeline (readonly DESIGN), per-source schedule rows, versions, history, next-run previews, runningSources, and the caller's control rights.
host to webviewdeployment:errorteamId, sourceId?, errorThe record could not be loaded; the record guard (teamId + sourceId) drops errors from a stale fetch after switching records.
webview to hostdeployment:setDisabledteamId, requestId, disabledThe whole-deployment kill switch.
webview to hostdeployment:deployVersionteamId, requestId, versionPoint this team at a version (Deploy version… / Rollback alike).
webview to hostdeployment:removeteamId, requestIdSoft-remove the deployment (history and artifacts survive).
webview to hostdeployment:runSourceteamId, requestId, sourceIdStart one source NOW (the manual smoke-test dispatch).
webview to hostdeployment:stopSourceteamId, requestId, sourceIdStop one source's live run.
webview to hostdeployment:setSourceConfigteamId, requestId, sourceId, traceLevel, debugOutPersist one source's execution settings.
webview to hostdeployment:setSchedulePausedteamId, requestId, sourceId, pausedPause/resume one source's schedule — cron/ttl preserved.
webview to hostdeployment:setScheduleteamId, requestId, sourceId, cron, ttl?Set (cron string) or clear (null) one source's schedule.
host to webviewdeployment:actionResultrequestId, error?Completion ack for any deployment:* mutation.
webview to hostdeployment:previewteamId, requestId, cron, countCron preview via the server's single evaluator — clients never parse cron.
host to webviewdeployment:previewResultrequestId, result, error?Validity + next occurrences.
webview to hostdeployment:validateteamId, requestId, pipelinePipeline validation passthrough for the readonly canvas.
host to webviewdeployment:validateResultrequestId, resultValidation errors/warnings.
host to webviewshell:connectionChangeisConnectedDeploy-connection state for the drawer's connection indicator.