@helpra/design 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +106 -2
- package/README.ru.md +23 -0
- package/bin/helpra-design.mjs +12 -0
- package/design-system/helpra/tokens.json +1593 -0
- package/dist/embed/index.d.ts +9 -0
- package/dist/embed/index.js +94 -0
- package/dist/embed/types.d.ts +113 -0
- package/dist/embed/types.js +1 -0
- package/dist/ui/assets/browserHost-DO0VE7SS.js +1 -0
- package/dist/ui/assets/index-B0caw0Dc.js +82 -0
- package/dist/ui/assets/index-BpwlDiXE.css +1 -0
- package/dist/ui/assets/inter-cyrillic-wght-normal-BmJJXa8e.woff2 +0 -0
- package/dist/ui/assets/inter-latin-wght-normal-BgVq2Tq4.woff2 +0 -0
- package/dist/ui/assets/session.schemas-o3W88yfn.js +352 -0
- package/dist/ui/fonts/OFL.txt +93 -0
- package/dist/ui/index.html +14 -0
- package/docs/agent-workflow.md +28 -0
- package/docs/orca-integration.md +66 -0
- package/package.json +88 -4
- package/skills/README.md +25 -0
- package/skills/helpra-design/SKILL.md +23 -0
- package/skills/helpra-design/agents/openai.yaml +4 -0
- package/skills/helpra-design/references/button-change.md +14 -0
- package/skills/helpra-design/references/canvases-and-artboards.md +15 -0
- package/skills/helpra-design/references/capture-and-export.md +20 -0
- package/skills/helpra-design/references/comments-and-anchors.md +31 -0
- package/skills/helpra-design/references/designing-screens.md +79 -0
- package/skills/helpra-design/references/mcp-workflow.md +121 -0
- package/skills/helpra-design/references/project-format.md +17 -0
- package/skills/helpra-design/scripts/find_elements.py +77 -0
- package/skills/helpra-design/templates/artboard.json +23 -0
- package/skills/helpra-design/templates/canvas.json +9 -0
- package/skills/helpra-design/templates/page.json +11 -0
- package/skills/helpra-design-system/SKILL.md +35 -0
- package/skills/helpra-design-system/agents/openai.yaml +4 -0
- package/skills/helpra-design-system/references/component-contract.md +11 -0
- package/skills/helpra-design-system/references/coverage.md +19 -0
- package/skills/helpra-design-system/references/tokens-and-rules.md +13 -0
- package/skills/helpra-design-system/references/validation.md +11 -0
- package/skills/helpra-design-system/templates/component.json +38 -0
- package/skills/helpra-design-system/templates/system.json +70 -0
- package/skills/helpra-screen-composition/SKILL.md +69 -0
- package/src/brief/authoring-brief.ts +97 -0
- package/src/brief/bound.ts +80 -0
- package/src/brief/component-props.ts +53 -0
- package/src/brief/project-brief.ts +80 -0
- package/src/brief/reference-excerpt.ts +61 -0
- package/src/brief/references.ts +66 -0
- package/src/brief/screen-composition.ts +68 -0
- package/src/brief/shell.ts +84 -0
- package/src/brief/system.ts +74 -0
- package/src/brief/theme-css.ts +57 -0
- package/src/brief/tokens.ts +74 -0
- package/src/brief/trajectory.ts +64 -0
- package/src/contracts/agent-targets.ts +42 -0
- package/src/contracts/annotations.ts +44 -0
- package/src/contracts/artboard-appearance.ts +67 -0
- package/src/contracts/artboard-approval.ts +109 -0
- package/src/contracts/artboard-topology.ts +45 -0
- package/src/contracts/assets.ts +20 -0
- package/src/contracts/canvas-name.ts +19 -0
- package/src/contracts/common.schemas.ts +32 -0
- package/src/contracts/common.ts +3 -0
- package/src/contracts/common.types.ts +10 -0
- package/src/contracts/context-navigation.types.ts +6 -0
- package/src/contracts/context-read.schemas.ts +34 -0
- package/src/contracts/context-read.types.ts +20 -0
- package/src/contracts/design-error.ts +3 -0
- package/src/contracts/design-system-lifecycle.ts +107 -0
- package/src/contracts/design-system-themes.ts +36 -0
- package/src/contracts/design-system-tokens.ts +167 -0
- package/src/contracts/find-elements.ts +63 -0
- package/src/contracts/git-commit.ts +17 -0
- package/src/contracts/graph.schemas.ts +18 -0
- package/src/contracts/graph.types.ts +11 -0
- package/src/contracts/guide.types.ts +4 -0
- package/src/contracts/helpra-mark.ts +2 -0
- package/src/contracts/index.ts +13 -0
- package/src/contracts/input-errors.ts +48 -0
- package/src/contracts/legacy-component.ts +23 -0
- package/src/contracts/local-directory-picker.ts +9 -0
- package/src/contracts/managed-project.ts +22 -0
- package/src/contracts/operations.ts +315 -0
- package/src/contracts/origins.ts +25 -0
- package/src/contracts/portable.ts +72 -0
- package/src/contracts/project-brief-screen-pool.ts +78 -0
- package/src/contracts/project-brief.ts +99 -0
- package/src/contracts/project-component-dirs.ts +18 -0
- package/src/contracts/project-files.ts +17 -0
- package/src/contracts/project-read.types.ts +41 -0
- package/src/contracts/project.schemas.ts +72 -0
- package/src/contracts/project.ts +2 -0
- package/src/contracts/project.types.ts +70 -0
- package/src/contracts/publication-publish.schemas.ts +33 -0
- package/src/contracts/publication-publish.types.ts +6 -0
- package/src/contracts/publication-status.schemas.ts +17 -0
- package/src/contracts/publication-status.types.ts +5 -0
- package/src/contracts/publication.schemas.ts +9 -0
- package/src/contracts/publication.types.ts +25 -0
- package/src/contracts/recents.ts +59 -0
- package/src/contracts/render-inspection.schemas.ts +75 -0
- package/src/contracts/render-tree.schemas.ts +58 -0
- package/src/contracts/render.ts +182 -0
- package/src/contracts/review-geometry.ts +55 -0
- package/src/contracts/review-image.ts +26 -0
- package/src/contracts/review.ts +227 -0
- package/src/contracts/screen-constants.ts +93 -0
- package/src/contracts/screen-layout.ts +31 -0
- package/src/contracts/screen-palette-constants.ts +99 -0
- package/src/contracts/screen-palette-domain.styles.ts +160 -0
- package/src/contracts/screen-palette-domain.ts +134 -0
- package/src/contracts/screen-palette-fallbacks.ts +57 -0
- package/src/contracts/screen-palette-seed.ts +6 -0
- package/src/contracts/screen-palette-styles.ts +96 -0
- package/src/contracts/screen-palette.ts +88 -0
- package/src/contracts/screen-recipe.ts +118 -0
- package/src/contracts/screen-transition.ts +166 -0
- package/src/contracts/screen-workspace-palette.ts +62 -0
- package/src/contracts/screen-workspace-styles.ts +143 -0
- package/src/contracts/screen-workspace-template.ts +65 -0
- package/src/contracts/service.types.ts +16 -0
- package/src/contracts/source-export.schemas.ts +19 -0
- package/src/contracts/source-export.types.ts +6 -0
- package/src/contracts/source-mime.ts +5 -0
- package/src/contracts/system-browser.schemas.ts +15 -0
- package/src/contracts/system-browser.types.ts +7 -0
- package/src/contracts/system.constants.ts +2 -0
- package/src/contracts/system.schemas.ts +36 -0
- package/src/contracts/system.ts +3 -0
- package/src/contracts/system.types.ts +42 -0
- package/src/contracts/ui-session.ts +11 -0
- package/src/contracts/visual-replay.ts +21 -0
- package/src/embed/index.ts +94 -0
- package/src/embed/types.ts +61 -0
- package/src/graph/evidence.ts +47 -0
- package/src/graph/projection.ts +52 -0
- package/src/graph/query-snapshot.ts +42 -0
- package/src/graph/query.ts +60 -0
- package/src/graph/relations.ts +40 -0
- package/src/graph/validate.ts +20 -0
- package/src/guide/bundle.ts +26 -0
- package/src/guide/guide.constants.ts +3 -0
- package/src/guide/views.ts +22 -0
- package/src/project/annotations.ts +55 -0
- package/src/project/appearance-transaction.ts +240 -0
- package/src/project/approval-state.ts +125 -0
- package/src/project/artboard-approvals.ts +152 -0
- package/src/project/artboard-operations.ts +66 -0
- package/src/project/artboard-placement.ts +58 -0
- package/src/project/artboard-properties.ts +31 -0
- package/src/project/artboard-source.ts +124 -0
- package/src/project/artboard-topology-transaction.ts +249 -0
- package/src/project/assets.ts +217 -0
- package/src/project/catalog-summary.ts +169 -0
- package/src/project/change-impact.ts +96 -0
- package/src/project/component-aliases.ts +16 -0
- package/src/project/component-library.ts +54 -0
- package/src/project/css-impact.ts +151 -0
- package/src/project/demo-assets/fonts/LICENSE +93 -0
- package/src/project/demo-assets/fonts/README.md +5 -0
- package/src/project/demo-assets/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
- package/src/project/demo-assets/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/src/project/demo-assets/fonts/provenance.json +22 -0
- package/src/project/demo-design.ts +35 -0
- package/src/project/demo-fonts.ts +8 -0
- package/src/project/demo-sources.ts +19 -0
- package/src/project/demo.ts +64 -0
- package/src/project/dependencies.ts +124 -0
- package/src/project/derived-snapshot.ts +78 -0
- package/src/project/design-system-components.ts +178 -0
- package/src/project/design-system-documents.ts +128 -0
- package/src/project/design-system-journal.ts +52 -0
- package/src/project/design-system-lifecycle.ts +161 -0
- package/src/project/design-system-seed.ts +165 -0
- package/src/project/design-system-theme-edits.ts +124 -0
- package/src/project/design-system-token-patches.ts +278 -0
- package/src/project/design-system-tokens.ts +157 -0
- package/src/project/design-system-transaction.ts +164 -0
- package/src/project/design-systems.ts +266 -0
- package/src/project/design-workspace.ts +50 -0
- package/src/project/export-files.ts +34 -0
- package/src/project/extract-html-component.ts +83 -0
- package/src/project/file-cache.ts +61 -0
- package/src/project/file-lease.ts +44 -0
- package/src/project/format.ts +104 -0
- package/src/project/git-commit.ts +80 -0
- package/src/project/git.ts +140 -0
- package/src/project/html-fragments.ts +60 -0
- package/src/project/import-screen-mapper.ts +150 -0
- package/src/project/imports.ts +354 -0
- package/src/project/index.ts +12 -0
- package/src/project/initial-canvas.ts +31 -0
- package/src/project/live-topology.ts +17 -0
- package/src/project/locks.ts +36 -0
- package/src/project/managed-projects.ts +265 -0
- package/src/project/module-resolution.ts +21 -0
- package/src/project/parse-script.ts +53 -0
- package/src/project/paths.ts +230 -0
- package/src/project/project-component-dirs.ts +125 -0
- package/src/project/project-files.ts +117 -0
- package/src/project/project-metadata.ts +142 -0
- package/src/project/public-git.ts +39 -0
- package/src/project/recents.ts +111 -0
- package/src/project/registered-snapshot.ts +18 -0
- package/src/project/registry.ts +141 -0
- package/src/project/revisions.ts +200 -0
- package/src/project/screen-authoring.ts +153 -0
- package/src/project/screen-definitions.ts +47 -0
- package/src/project/screen-fonts.ts +18 -0
- package/src/project/screen-policy.ts +76 -0
- package/src/project/screen-pool.ts +91 -0
- package/src/project/screen-project-seed.ts +40 -0
- package/src/project/screen-styles.ts +33 -0
- package/src/project/screen-transitions.ts +317 -0
- package/src/project/snapshot-reader.ts +63 -0
- package/src/project/snapshot-selection.ts +41 -0
- package/src/project/snapshot-topology.ts +99 -0
- package/src/project/source-view.ts +42 -0
- package/src/project/stage-component-dirs.ts +37 -0
- package/src/project/topology-source-inventory.ts +92 -0
- package/src/project/topology.ts +394 -0
- package/src/project/transactions.ts +213 -0
- package/src/project/transition-transaction.ts +377 -0
- package/src/project/ui-sessions.ts +66 -0
- package/src/project/watch.ts +217 -0
- package/src/project/workspace.ts +746 -0
- package/src/project/workspace.types.ts +4 -0
- package/src/publication/cli.ts +51 -0
- package/src/publication/cutover.schemas.ts +25 -0
- package/src/publication/cutover.ts +82 -0
- package/src/publication/cutover.types.ts +5 -0
- package/src/publication/digests.ts +44 -0
- package/src/publication/durable.ts +21 -0
- package/src/publication/live-reader.ts +16 -0
- package/src/publication/navigation.ts +26 -0
- package/src/publication/navigation.types.ts +3 -0
- package/src/publication/publish-files.ts +39 -0
- package/src/publication/publish-gateway.ts +48 -0
- package/src/publication/publish-identity.ts +107 -0
- package/src/publication/publish-identity.types.ts +5 -0
- package/src/publication/publish-status.ts +88 -0
- package/src/publication/publish-status.types.ts +14 -0
- package/src/publication/publish.ts +132 -0
- package/src/publication/schemas.ts +10 -0
- package/src/publication/store.constants.ts +8 -0
- package/src/publication/store.ts +131 -0
- package/src/publication/validate-store.ts +23 -0
- package/src/publication/validate.ts +99 -0
- package/src/render/annotations.ts +149 -0
- package/src/render/archive-workspace.ts +31 -0
- package/src/render/asset-safety.ts +19 -0
- package/src/render/bridge-client.ts +41 -0
- package/src/render/budgets.ts +8 -0
- package/src/render/build.schemas.ts +13 -0
- package/src/render/build.ts +125 -0
- package/src/render/build.types.ts +6 -0
- package/src/render/capture.ts +105 -0
- package/src/render/comment-cursor.constants.ts +23 -0
- package/src/render/design-system-screenshot.ts +148 -0
- package/src/render/export.ts +144 -0
- package/src/render/html-head.ts +33 -0
- package/src/render/index.ts +324 -0
- package/src/render/input-references.ts +116 -0
- package/src/render/input-references.types.ts +1 -0
- package/src/render/inputs.ts +161 -0
- package/src/render/inputs.types.ts +4 -0
- package/src/render/interactive-capture.ts +49 -0
- package/src/render/module-policy.constants.ts +5 -0
- package/src/render/offline.ts +87 -0
- package/src/render/preview-headers.ts +8 -0
- package/src/render/preview.ts +64 -0
- package/src/render/provenance.ts +28 -0
- package/src/render/renderer.types.ts +17 -0
- package/src/render/replay.ts +131 -0
- package/src/render/resources.ts +97 -0
- package/src/render/runtime-archive-workspace.ts +116 -0
- package/src/render/runtime-cascade.ts +255 -0
- package/src/render/runtime-css-values.ts +20 -0
- package/src/render/runtime-cssom.ts +238 -0
- package/src/render/runtime-dom.ts +74 -0
- package/src/render/runtime-lazy.ts +108 -0
- package/src/render/runtime-lengths.ts +58 -0
- package/src/render/runtime-spacing.ts +40 -0
- package/src/render/runtime-styles.ts +187 -0
- package/src/render/runtime-transitions.ts +378 -0
- package/src/render/runtime.ts +490 -0
- package/src/render/source-map.ts +39 -0
- package/src/render/static-build.ts +115 -0
- package/src/render/static-public-screen.ts +27 -0
- package/src/render/static-svg.ts +71 -0
- package/src/render/system-artifacts.ts +108 -0
- package/src/render/system-chromium.ts +31 -0
- package/src/render/system-preview.ts +46 -0
- package/src/render/vite-build.ts +113 -0
- package/src/render/vite-pool.ts +125 -0
- package/src/render/vite-worker.ts +31 -0
- package/src/review/anchors.ts +85 -0
- package/src/review/attachments.ts +119 -0
- package/src/review/comparison.ts +57 -0
- package/src/review/creation-topology.ts +71 -0
- package/src/review/drawing-observation.ts +93 -0
- package/src/review/evidence.ts +77 -0
- package/src/review/image-bytes.ts +9 -0
- package/src/review/index.ts +1 -0
- package/src/review/original-captures.ts +60 -0
- package/src/review/placement.ts +49 -0
- package/src/review/project.ts +18 -0
- package/src/review/removed-target.ts +39 -0
- package/src/review/review-images.ts +79 -0
- package/src/review/service.ts +477 -0
- package/src/review/storage.ts +257 -0
- package/src/sandbox/HomeIdePreview.tsx +27 -0
- package/src/sandbox/SandboxClient.ts +106 -0
- package/src/sandbox/SandboxState.ts +56 -0
- package/src/sandbox/SketchPreview.tsx +54 -0
- package/src/sandbox/artboardBackground.ts +8 -0
- package/src/sandbox/canvasOperations.ts +148 -0
- package/src/sandbox/commentOperations.ts +85 -0
- package/src/sandbox/main.tsx +56 -0
- package/src/sandbox/overview.en.md +27 -0
- package/src/sandbox/overview.ru.md +27 -0
- package/src/sandbox/pngExports.ts +79 -0
- package/src/sandbox/previewLocation.ts +40 -0
- package/src/sandbox/project.ts +69 -0
- package/src/sandbox/sandbox.css +100 -0
- package/src/sandbox/system.ts +69 -0
- package/src/search/budget.ts +80 -0
- package/src/search/find-elements.ts +128 -0
- package/src/search/html.ts +56 -0
- package/src/search/jsx.ts +124 -0
- package/src/search/query.ts +74 -0
- package/src/search/source.ts +57 -0
- package/src/service/agent/dispatch.ts +326 -0
- package/src/service/agent/http.ts +76 -0
- package/src/service/agent/orca-bridge.ts +126 -0
- package/src/service/agent/orca.ts +261 -0
- package/src/service/agent/payload.ts +125 -0
- package/src/service/agent/receipts.ts +44 -0
- package/src/service/cli.ts +196 -0
- package/src/service/client.ts +77 -0
- package/src/service/comment-evidence.ts +91 -0
- package/src/service/comment-inspection.ts +33 -0
- package/src/service/comment-scenes.ts +22 -0
- package/src/service/context-cursor.ts +59 -0
- package/src/service/context-pinned.ts +82 -0
- package/src/service/context-selection.ts +62 -0
- package/src/service/context-source.ts +56 -0
- package/src/service/context.ts +119 -0
- package/src/service/daemon-entry.ts +16 -0
- package/src/service/daemon.ts +121 -0
- package/src/service/export-config.ts +21 -0
- package/src/service/http.ts +491 -0
- package/src/service/index.ts +190 -0
- package/src/service/inspect-page.ts +49 -0
- package/src/service/inspect.ts +38 -0
- package/src/service/lifecycle.ts +29 -0
- package/src/service/local-cli.ts +65 -0
- package/src/service/local-directory-picker.ts +29 -0
- package/src/service/loopback-http.ts +35 -0
- package/src/service/mcp-artboard-review.ts +91 -0
- package/src/service/mcp-auth.ts +24 -0
- package/src/service/mcp-content.ts +47 -0
- package/src/service/mcp-http.ts +26 -0
- package/src/service/mcp.ts +124 -0
- package/src/service/mutation-gate.ts +107 -0
- package/src/service/native-directory-picker.ts +70 -0
- package/src/service/operation-policy.ts +45 -0
- package/src/service/operations.ts +447 -0
- package/src/service/publication-gateway-server.ts +34 -0
- package/src/service/publication-gateway.ts +139 -0
- package/src/service/publication-gateway.types.ts +9 -0
- package/src/service/remote-agent-tokens.ts +49 -0
- package/src/service/remote-config.ts +43 -0
- package/src/service/remote-mcp.ts +76 -0
- package/src/service/remote-results.ts +39 -0
- package/src/service/remote-session.ts +65 -0
- package/src/service/remote.ts +33 -0
- package/src/service/results.ts +33 -0
- package/src/service/review-payloads.ts +72 -0
- package/src/service/review-resource-links.ts +41 -0
- package/src/service/security.ts +117 -0
- package/src/service/server-config.ts +44 -0
- package/src/service/server-config.types.ts +13 -0
- package/src/service/server.ts +16 -0
- package/src/service/status-capacity.ts +59 -0
- package/src/service/status-current.ts +30 -0
- package/src/service/stdio.ts +34 -0
- package/src/service/ui-asset-cache.ts +51 -0
- package/src/service/usecases.ts +155 -0
- package/src/service/work-budget.ts +37 -0
- package/src/service/workspace-http.ts +57 -0
- package/src/source-export/archive.ts +78 -0
- package/src/source-export/capacity.ts +44 -0
- package/src/source-export/checkpoint.ts +58 -0
- package/src/source-export/cleanup.ts +46 -0
- package/src/source-export/download.ts +74 -0
- package/src/source-export/downloads.ts +29 -0
- package/src/source-export/history.ts +50 -0
- package/src/source-export/inventory.types.ts +12 -0
- package/src/source-export/job-store.ts +125 -0
- package/src/source-export/kernel-lease.ts +13 -0
- package/src/source-export/lease.ts +72 -0
- package/src/source-export/legacy.ts +46 -0
- package/src/source-export/manager.ts +189 -0
- package/src/source-export/manifest.ts +23 -0
- package/src/source-export/member-reader.ts +24 -0
- package/src/source-export/result.ts +12 -0
- package/src/source-export/review-checkpoint.ts +169 -0
- package/src/source-export/snapshot-space.ts +35 -0
- package/src/source-export/space.ts +79 -0
- package/src/source-export/tickets.ts +24 -0
- package/src/system/browser-source.ts +87 -0
- package/src/system/browser.ts +39 -0
- package/src/system/change-policy.ts +82 -0
- package/src/system/component-metadata.ts +36 -0
- package/src/system/components.ts +58 -0
- package/src/system/css-token-blocks.ts +346 -0
- package/src/system/index.ts +9 -0
- package/src/system/inspection.ts +20 -0
- package/src/system/library-namespace.ts +108 -0
- package/src/system/published-metadata.ts +38 -0
- package/src/system/report-store.ts +41 -0
- package/src/system/rules.ts +47 -0
- package/src/system/scope-policy.ts +61 -0
- package/src/system/service.ts +129 -0
- package/src/system/service.types.ts +6 -0
- package/src/system/snapshot.ts +101 -0
- package/src/system/source-analysis.ts +273 -0
- package/src/system/source-exports.ts +38 -0
- package/src/system/theme-layers.ts +17 -0
- package/src/system/token-parser.ts +63 -0
- package/src/system/token-values.constants.ts +1 -0
- package/src/system/token-values.ts +62 -0
- package/src/system/token-values.types.ts +4 -0
- package/src/system/tokens.ts +111 -0
- package/src/system/usage-index.ts +148 -0
- package/src/system/validation.ts +101 -0
- package/src/system/validation.types.ts +2 -0
- package/src/ui/AgentDeliveryControl.tsx +106 -0
- package/src/ui/AnnotationDetails.tsx +23 -0
- package/src/ui/AnnotationProperties.tsx +218 -0
- package/src/ui/ApiError.ts +31 -0
- package/src/ui/App.tsx +340 -0
- package/src/ui/ArtboardBackgroundField.tsx +122 -0
- package/src/ui/ArtboardDragGuides.tsx +25 -0
- package/src/ui/ArtboardFrame.tsx +230 -0
- package/src/ui/ArtboardPropertiesSection.tsx +286 -0
- package/src/ui/Brand.tsx +42 -0
- package/src/ui/CanvasAnnotationObject.tsx +358 -0
- package/src/ui/CanvasAnnotations.tsx +168 -0
- package/src/ui/CanvasNavPanel.tsx +421 -0
- package/src/ui/CanvasNavSwitcher.tsx +148 -0
- package/src/ui/CommentComposer.tsx +202 -0
- package/src/ui/CommentDeliveryStatus.tsx +80 -0
- package/src/ui/CommentEvidence.tsx +280 -0
- package/src/ui/CommentLayer.tsx +279 -0
- package/src/ui/CommentTextarea.tsx +47 -0
- package/src/ui/ContextMenu.tsx +373 -0
- package/src/ui/CustomSelect.tsx +364 -0
- package/src/ui/DesignSystemsCatalog.tsx +275 -0
- package/src/ui/DiscussionsPanel.tsx +240 -0
- package/src/ui/ElementProperties.tsx +117 -0
- package/src/ui/Entry.tsx +392 -0
- package/src/ui/ExportMenu.tsx +218 -0
- package/src/ui/FolderPathField.tsx +62 -0
- package/src/ui/FrameExportPopover.tsx +187 -0
- package/src/ui/FullscreenPlayOverlay.tsx +177 -0
- package/src/ui/GhostPlacementOverlay.tsx +48 -0
- package/src/ui/HomeModals.tsx +294 -0
- package/src/ui/HomeProjectDetails.tsx +295 -0
- package/src/ui/HomeProjectList.tsx +327 -0
- package/src/ui/HomeRecents.tsx +249 -0
- package/src/ui/IdeStatusControl.tsx +49 -0
- package/src/ui/InlineNameInput.tsx +51 -0
- package/src/ui/InspectionViews.tsx +133 -0
- package/src/ui/LanguageDropdown.tsx +62 -0
- package/src/ui/McpSettingsDialog.tsx +169 -0
- package/src/ui/MinimalInspector.tsx +112 -0
- package/src/ui/Preview.tsx +68 -0
- package/src/ui/ProjectDialog.tsx +237 -0
- package/src/ui/ProjectHeader.tsx +213 -0
- package/src/ui/RegionSelector.tsx +106 -0
- package/src/ui/ReviewAttachments.tsx +331 -0
- package/src/ui/SandboxHeaderControls.tsx +30 -0
- package/src/ui/ScopeEditor.tsx +109 -0
- package/src/ui/Session.tsx +499 -0
- package/src/ui/SmartGuidesOverlay.tsx +86 -0
- package/src/ui/SpacingOverlay.tsx +33 -0
- package/src/ui/StandaloneSystemReader.tsx +322 -0
- package/src/ui/SystemView.tsx +56 -0
- package/src/ui/ThreadDetail.tsx +426 -0
- package/src/ui/Toolbar.tsx +195 -0
- package/src/ui/TooltipLayer.tsx +132 -0
- package/src/ui/Workbench.tsx +1081 -0
- package/src/ui/Workspace.tsx +497 -0
- package/src/ui/ZoomControls.tsx +131 -0
- package/src/ui/agent-delivery.css +88 -0
- package/src/ui/agentDelivery.ts +138 -0
- package/src/ui/annotations.css +146 -0
- package/src/ui/api.ts +340 -0
- package/src/ui/approvals/ApprovalActions.tsx +121 -0
- package/src/ui/approvals/ApprovalNoteComposer.tsx +69 -0
- package/src/ui/approvals/ApprovalStatusGlyph.tsx +39 -0
- package/src/ui/approvals/ApprovalsPanel.tsx +295 -0
- package/src/ui/approvals/ArtboardApprovalChip.tsx +61 -0
- package/src/ui/approvals/InlineApprovalPopover.tsx +180 -0
- package/src/ui/approvals/QuickReworkPopover.tsx +67 -0
- package/src/ui/approvals/approvalOrder.ts +36 -0
- package/src/ui/approvals/approvalUtils.ts +249 -0
- package/src/ui/approvals/approvals.css +476 -0
- package/src/ui/approvals/inline-approvals.css +125 -0
- package/src/ui/approvals/useApprovalsPanel.ts +257 -0
- package/src/ui/approvals/useInlineApproval.ts +22 -0
- package/src/ui/artboardBackground.ts +29 -0
- package/src/ui/artboardClipboard.ts +54 -0
- package/src/ui/artboardId.ts +5 -0
- package/src/ui/artboardPropertyEdits.ts +58 -0
- package/src/ui/assets/helpra-mark.svg +3 -0
- package/src/ui/authStorage.ts +184 -0
- package/src/ui/browserHost.ts +87 -0
- package/src/ui/browserUiSession.ts +30 -0
- package/src/ui/camera.ts +22 -0
- package/src/ui/cameraAnimation.ts +82 -0
- package/src/ui/canvas-placement.css +160 -0
- package/src/ui/canvas-render-priority.ts +26 -0
- package/src/ui/canvas-render-state.ts +60 -0
- package/src/ui/canvas.css +463 -0
- package/src/ui/canvasFit.ts +96 -0
- package/src/ui/canvasNavigation.ts +52 -0
- package/src/ui/canvasPlacementOps.ts +146 -0
- package/src/ui/catalog.css +119 -0
- package/src/ui/comment-layer.css +108 -0
- package/src/ui/comment-textarea.css +30 -0
- package/src/ui/commentDeliveryFailures.ts +40 -0
- package/src/ui/commentGeometry.ts +339 -0
- package/src/ui/commentLabels.ts +12 -0
- package/src/ui/commentPresentation.ts +32 -0
- package/src/ui/commentState.ts +90 -0
- package/src/ui/comments.css +419 -0
- package/src/ui/componentLibrary.ts +18 -0
- package/src/ui/context-menu.css +93 -0
- package/src/ui/contextMenuEditable.ts +215 -0
- package/src/ui/controls.css +186 -0
- package/src/ui/custom-select.css +131 -0
- package/src/ui/dialogs.css +137 -0
- package/src/ui/drawing/DrawingSnapshot.tsx +46 -0
- package/src/ui/drawing/PencilLayer.tsx +401 -0
- package/src/ui/drawing/drawingUtils.ts +294 -0
- package/src/ui/editorStyles.ts +28 -0
- package/src/ui/entry.css +210 -0
- package/src/ui/entry.types.ts +1 -0
- package/src/ui/fonts/README.md +5 -0
- package/src/ui/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
- package/src/ui/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/src/ui/fonts.css +21 -0
- package/src/ui/frameMounting.ts +88 -0
- package/src/ui/helpra-tokens.css +361 -0
- package/src/ui/home-oss.css +191 -0
- package/src/ui/home-project-list.css +457 -0
- package/src/ui/home.css +374 -0
- package/src/ui/identifyBrowserClient.ts +28 -0
- package/src/ui/index.html +13 -0
- package/src/ui/inspector.css +556 -0
- package/src/ui/keyboardTarget.ts +5 -0
- package/src/ui/language-dropdown.css +30 -0
- package/src/ui/lazyTreeSession.ts +139 -0
- package/src/ui/library.css +212 -0
- package/src/ui/loadTopology.ts +74 -0
- package/src/ui/localizedCopy.ts +10 -0
- package/src/ui/localizedCopyEditor.ts +293 -0
- package/src/ui/localizedCopySystem.ts +177 -0
- package/src/ui/main.tsx +10 -0
- package/src/ui/markupExport.ts +166 -0
- package/src/ui/mobile.css +191 -0
- package/src/ui/models.ts +336 -0
- package/src/ui/navigation.css +373 -0
- package/src/ui/pointerCanvasPoint.ts +6 -0
- package/src/ui/previewInspection.ts +124 -0
- package/src/ui/previewProps.ts +76 -0
- package/src/ui/previewRecord.ts +61 -0
- package/src/ui/previewTreeDemand.ts +14 -0
- package/src/ui/primitives.tsx +207 -0
- package/src/ui/projectArtboardEdits.ts +21 -0
- package/src/ui/projectNames.ts +24 -0
- package/src/ui/projectRefresh.ts +48 -0
- package/src/ui/projectSelection.ts +41 -0
- package/src/ui/projectSourceEvents.ts +39 -0
- package/src/ui/public/fonts/OFL.txt +93 -0
- package/src/ui/publicSandbox.ts +2 -0
- package/src/ui/publicationPresentation.ts +35 -0
- package/src/ui/review-attachments.css +151 -0
- package/src/ui/scene.ts +133 -0
- package/src/ui/session.schemas.ts +35 -0
- package/src/ui/shell.css +294 -0
- package/src/ui/smartGuides.ts +239 -0
- package/src/ui/spacingGeometry.ts +84 -0
- package/src/ui/structuralRepeats.ts +226 -0
- package/src/ui/styles.css +146 -0
- package/src/ui/submitCommentOnEnter.ts +10 -0
- package/src/ui/system/ScreenConstantSample.tsx +84 -0
- package/src/ui/system/ScreenConstantsSection.tsx +184 -0
- package/src/ui/system/SystemAssets.tsx +95 -0
- package/src/ui/system/SystemComponents.tsx +94 -0
- package/src/ui/system/SystemDocument.tsx +74 -0
- package/src/ui/system/SystemFiles.tsx +136 -0
- package/src/ui/system/SystemMarkdown.tsx +236 -0
- package/src/ui/system/SystemNativeLibrary.tsx +37 -0
- package/src/ui/system/SystemNavigation.tsx +107 -0
- package/src/ui/system/SystemOverview.tsx +52 -0
- package/src/ui/system/SystemPreviewFrame.tsx +96 -0
- package/src/ui/system/SystemTokenSection.tsx +190 -0
- package/src/ui/system/SystemTypography.tsx +146 -0
- package/src/ui/system/SystemValue.tsx +52 -0
- package/src/ui/system/open-ds/OpenDsComponentsShowcase.tsx +224 -0
- package/src/ui/system/open-ds/OpenDsIcons.tsx +161 -0
- package/src/ui/system/open-ds/OpenDsSections.tsx +362 -0
- package/src/ui/system/open-ds/OpenDsTokenEditors.tsx +246 -0
- package/src/ui/system/open-ds/OverviewDocuments.tsx +146 -0
- package/src/ui/system/open-ds/SlidingNavigation.tsx +44 -0
- package/src/ui/system/open-ds/open-ds-components.css +109 -0
- package/src/ui/system/open-ds/open-ds-sections.css +356 -0
- package/src/ui/system/open-ds/openDsCatalogData.ts +294 -0
- package/src/ui/system/open-ds/openDsTokenSpecs.ts +192 -0
- package/src/ui/system/open-ds/useOpenDsPersistence.ts +213 -0
- package/src/ui/system/screen-constants.css +143 -0
- package/src/ui/system/screenConstants.ts +193 -0
- package/src/ui/system/standalone-reader.css +404 -0
- package/src/ui/system/system-browser.css +383 -0
- package/src/ui/system/system-content.css +220 -0
- package/src/ui/system/system-library.css +272 -0
- package/src/ui/system/system-markdown.css +99 -0
- package/src/ui/system/system-typography.css +83 -0
- package/src/ui/system/systemBrowser.types.ts +76 -0
- package/src/ui/system/systemBrowserSource.ts +203 -0
- package/src/ui/system/systemCatalog.ts +198 -0
- package/src/ui/system/systemPreviewUrl.ts +38 -0
- package/src/ui/system/systemReadQueue.ts +41 -0
- package/src/ui/system/systemTokens.ts +169 -0
- package/src/ui/system/systemValueStyle.ts +13 -0
- package/src/ui/system/useScreenConstants.ts +32 -0
- package/src/ui/system/useSystemAnchors.ts +85 -0
- package/src/ui/system/useSystemBrowser.ts +167 -0
- package/src/ui/system/useSystemFonts.ts +67 -0
- package/src/ui/system/useSystemVisibility.ts +23 -0
- package/src/ui/tooltip.css +36 -0
- package/src/ui/transfers.css +93 -0
- package/src/ui/transitions/TransitionBackPill.tsx +54 -0
- package/src/ui/transitions/TransitionControl.tsx +257 -0
- package/src/ui/transitions/TransitionPickerPopover.tsx +176 -0
- package/src/ui/transitions/transitionUtils.ts +223 -0
- package/src/ui/transitions/transitions.css +406 -0
- package/src/ui/transitions/useScreenTransitions.ts +308 -0
- package/src/ui/uiTheme.ts +51 -0
- package/src/ui/useArtboardCommands.ts +162 -0
- package/src/ui/useArtboardDrag.ts +83 -0
- package/src/ui/useArtboardPropertyEdits.ts +72 -0
- package/src/ui/useCamera.ts +291 -0
- package/src/ui/useCameraFlight.ts +84 -0
- package/src/ui/useCanvasAnnotations.ts +452 -0
- package/src/ui/useCanvasPlacement.ts +374 -0
- package/src/ui/useCanvasRenders.ts +314 -0
- package/src/ui/useCommentSubmissions.ts +47 -0
- package/src/ui/useInspection.ts +62 -0
- package/src/ui/useLiveInspection.ts +69 -0
- package/src/ui/useMountedFrames.ts +90 -0
- package/src/ui/usePopover.ts +58 -0
- package/src/ui/usePreviewChannel.ts +389 -0
- package/src/ui/usePreviewPanOwner.ts +41 -0
- package/src/ui/useProject.ts +498 -0
- package/src/ui/useProjectComments.ts +152 -0
- package/src/ui/useProjectSourceWatch.ts +89 -0
- package/src/ui/useProjectTopology.ts +16 -0
- package/src/ui/useUsages.ts +102 -0
- package/src/ui/useVisibleCanvasFrames.ts +37 -0
- package/src/ui/useWorkbench.ts +440 -0
- package/src/ui/useWorkbenchContextMenus.ts +456 -0
- package/src/ui/validation.constants.ts +12 -0
- package/src/ui/validationModel.ts +22 -0
- package/src/ui/workbenchI18n.ts +377 -0
- package/src/ui/workingCopyMutations.ts +43 -0
- package/templates/native-components/README.md +62 -0
- package/templates/native-components/components/app-shell/AppShell.tsx +392 -0
- package/templates/native-components/components/app-shell/README.md +5 -0
- package/templates/native-components/components/app-shell/StageScrollbar.tsx +185 -0
- package/templates/native-components/components/app-shell/component.json +34 -0
- package/templates/native-components/components/app-shell/examples/default.tsx +14 -0
- package/templates/native-components/components/app-state/AppState.tsx +151 -0
- package/templates/native-components/components/app-state/README.md +5 -0
- package/templates/native-components/components/app-state/component.json +73 -0
- package/templates/native-components/components/app-state/examples/form.tsx +7 -0
- package/templates/native-components/components/app-state/examples/list.tsx +7 -0
- package/templates/native-components/components/app-state/examples/panel.tsx +7 -0
- package/templates/native-components/components/app-state/examples/screen.tsx +7 -0
- package/templates/native-components/components/badge/Badge.tsx +18 -0
- package/templates/native-components/components/badge/README.md +5 -0
- package/templates/native-components/components/badge/component.json +87 -0
- package/templates/native-components/components/badge/examples/accent.tsx +7 -0
- package/templates/native-components/components/badge/examples/danger.tsx +7 -0
- package/templates/native-components/components/badge/examples/neutral.tsx +7 -0
- package/templates/native-components/components/badge/examples/success.tsx +7 -0
- package/templates/native-components/components/badge/examples/warning.tsx +7 -0
- package/templates/native-components/components/button/Button.tsx +15 -0
- package/templates/native-components/components/button/README.md +5 -0
- package/templates/native-components/components/button/component.json +73 -0
- package/templates/native-components/components/button/examples/add.tsx +7 -0
- package/templates/native-components/components/button/examples/ghost.tsx +7 -0
- package/templates/native-components/components/button/examples/primary.tsx +7 -0
- package/templates/native-components/components/button/examples/secondary.tsx +7 -0
- package/templates/native-components/components/card/Card.tsx +19 -0
- package/templates/native-components/components/card/README.md +5 -0
- package/templates/native-components/components/card/component.json +45 -0
- package/templates/native-components/components/card/examples/md.tsx +7 -0
- package/templates/native-components/components/card/examples/sm.tsx +7 -0
- package/templates/native-components/components/class-names.ts +9 -0
- package/templates/native-components/components/composer/Composer.tsx +61 -0
- package/templates/native-components/components/composer/README.md +5 -0
- package/templates/native-components/components/composer/component.json +43 -0
- package/templates/native-components/components/composer/examples/compact.tsx +12 -0
- package/templates/native-components/components/composer/examples/default.tsx +12 -0
- package/templates/native-components/components/field-message.tsx +16 -0
- package/templates/native-components/components/focus-layer.ts +146 -0
- package/templates/native-components/components/form-field.ts +27 -0
- package/templates/native-components/components/helpra-logo/HelpraLogo.tsx +27 -0
- package/templates/native-components/components/helpra-logo/README.md +5 -0
- package/templates/native-components/components/helpra-logo/component.json +43 -0
- package/templates/native-components/components/helpra-logo/examples/compact.tsx +7 -0
- package/templates/native-components/components/helpra-logo/examples/default.tsx +7 -0
- package/templates/native-components/components/helpra-mark-path.ts +2 -0
- package/templates/native-components/components/helpra-mascot/HelpraMascot.tsx +45 -0
- package/templates/native-components/components/helpra-mascot/README.md +5 -0
- package/templates/native-components/components/helpra-mascot/component.json +57 -0
- package/templates/native-components/components/helpra-mascot/examples/default.tsx +7 -0
- package/templates/native-components/components/helpra-mascot/examples/loading.tsx +7 -0
- package/templates/native-components/components/helpra-mascot/examples/thinking.tsx +7 -0
- package/templates/native-components/components/index.ts +47 -0
- package/templates/native-components/components/input/Input.tsx +59 -0
- package/templates/native-components/components/input/README.md +5 -0
- package/templates/native-components/components/input/component.json +43 -0
- package/templates/native-components/components/input/examples/default.tsx +7 -0
- package/templates/native-components/components/input/examples/invalid.tsx +7 -0
- package/templates/native-components/components/metric-grid/MetricGrid.tsx +40 -0
- package/templates/native-components/components/metric-grid/README.md +5 -0
- package/templates/native-components/components/metric-grid/component.json +29 -0
- package/templates/native-components/components/metric-grid/examples/default.tsx +7 -0
- package/templates/native-components/components/modal/Modal.tsx +75 -0
- package/templates/native-components/components/modal/README.md +5 -0
- package/templates/native-components/components/modal/component.json +31 -0
- package/templates/native-components/components/modal/examples/default.tsx +13 -0
- package/templates/native-components/components/panel-resize-handle/PanelResizeHandle.tsx +52 -0
- package/templates/native-components/components/panel-resize-handle/README.md +5 -0
- package/templates/native-components/components/panel-resize-handle/component.json +29 -0
- package/templates/native-components/components/panel-resize-handle/examples/default.tsx +13 -0
- package/templates/native-components/components/profile-avatar/ProfileAvatar.tsx +37 -0
- package/templates/native-components/components/profile-avatar/README.md +5 -0
- package/templates/native-components/components/profile-avatar/component.json +45 -0
- package/templates/native-components/components/profile-avatar/examples/md.tsx +7 -0
- package/templates/native-components/components/profile-avatar/examples/sm.tsx +7 -0
- package/templates/native-components/components/row-card/README.md +5 -0
- package/templates/native-components/components/row-card/RowCard.tsx +33 -0
- package/templates/native-components/components/row-card/component.json +43 -0
- package/templates/native-components/components/row-card/examples/current.tsx +7 -0
- package/templates/native-components/components/row-card/examples/default.tsx +7 -0
- package/templates/native-components/components/select/README.md +5 -0
- package/templates/native-components/components/select/Select.tsx +66 -0
- package/templates/native-components/components/select/component.json +29 -0
- package/templates/native-components/components/select/examples/default.tsx +7 -0
- package/templates/native-components/components/shell-nav-icon-graphic/README.md +5 -0
- package/templates/native-components/components/shell-nav-icon-graphic/ShellNavIconGraphic.tsx +148 -0
- package/templates/native-components/components/shell-nav-icon-graphic/component.json +45 -0
- package/templates/native-components/components/shell-nav-icon-graphic/examples/home.tsx +7 -0
- package/templates/native-components/components/shell-nav-icon-graphic/examples/settings.tsx +7 -0
- package/templates/native-components/components/shell-resizer.ts +304 -0
- package/templates/native-components/components/skeleton/README.md +5 -0
- package/templates/native-components/components/skeleton/Skeleton.tsx +20 -0
- package/templates/native-components/components/skeleton/component.json +87 -0
- package/templates/native-components/components/skeleton/examples/block.tsx +7 -0
- package/templates/native-components/components/skeleton/examples/card.tsx +7 -0
- package/templates/native-components/components/skeleton/examples/circle.tsx +7 -0
- package/templates/native-components/components/skeleton/examples/text.tsx +7 -0
- package/templates/native-components/components/skeleton/examples/title.tsx +7 -0
- package/templates/native-components/components/status-badge/README.md +5 -0
- package/templates/native-components/components/status-badge/StatusBadge.tsx +18 -0
- package/templates/native-components/components/status-badge/component.json +75 -0
- package/templates/native-components/components/status-badge/examples/danger.tsx +7 -0
- package/templates/native-components/components/status-badge/examples/neutral.tsx +7 -0
- package/templates/native-components/components/status-badge/examples/success.tsx +7 -0
- package/templates/native-components/components/status-badge/examples/warning.tsx +7 -0
- package/templates/native-components/components/step-indicator/README.md +5 -0
- package/templates/native-components/components/step-indicator/StepIndicator.tsx +30 -0
- package/templates/native-components/components/step-indicator/component.json +29 -0
- package/templates/native-components/components/step-indicator/examples/default.tsx +7 -0
- package/templates/native-components/components/styles.css +2 -0
- package/templates/native-components/components/table/README.md +5 -0
- package/templates/native-components/components/table/Table.tsx +95 -0
- package/templates/native-components/components/table/component.json +45 -0
- package/templates/native-components/components/table/examples/scroll.tsx +10 -0
- package/templates/native-components/components/table/examples/stack.tsx +10 -0
- package/templates/native-components/components/tabs/README.md +5 -0
- package/templates/native-components/components/tabs/Tabs.tsx +217 -0
- package/templates/native-components/components/tabs/component.json +29 -0
- package/templates/native-components/components/tabs/examples/default.tsx +10 -0
- package/templates/native-components/components/textarea/README.md +5 -0
- package/templates/native-components/components/textarea/Textarea.tsx +60 -0
- package/templates/native-components/components/textarea/component.json +29 -0
- package/templates/native-components/components/textarea/examples/default.tsx +7 -0
- package/templates/native-components/components/window/README.md +5 -0
- package/templates/native-components/components/window/Window.tsx +25 -0
- package/templates/native-components/components/window/component.json +43 -0
- package/templates/native-components/components/window/examples/default.tsx +8 -0
- package/templates/native-components/components/window/examples/detached.tsx +8 -0
- package/templates/native-components/tsconfig.json +7 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { getAuthoringBrief } from '../brief/authoring-brief.js';
|
|
2
|
+
import { commitDesignPaths } from '../project/git-commit.js';
|
|
3
|
+
import { extractHtmlComponent } from '../project/extract-html-component.js';
|
|
4
|
+
import { createDesignSystem } from '../project/design-system-seed.js';
|
|
5
|
+
import { manageDesignSystemThemes } from '../project/design-system-theme-edits.js';
|
|
6
|
+
import { deleteDesignSystemDoc, getDesignSystemDoc, listDesignSystemDocs, upsertDesignSystemDoc } from '../project/design-system-documents.js';
|
|
7
|
+
import { deleteDesignSystemComponent, upsertDesignSystemComponent } from '../project/design-system-components.js';
|
|
8
|
+
import { applyDesignSystemFiles, archiveDesignSystem, purgeDesignSystem, validateDesignSystem } from '../project/design-system-lifecycle.js';
|
|
9
|
+
import { screenshotDesignSystem } from '../render/design-system-screenshot.js';
|
|
10
|
+
import type { ReviewResourceLinks } from './review-resource-links.js';
|
|
11
|
+
import { createArtboard, duplicateArtboard, referenceArtboards, setArtboardReference } from '../project/artboard-operations.js';
|
|
12
|
+
import { ManagedProjects } from '../project/managed-projects.js';
|
|
13
|
+
import { ProjectAssets } from '../project/assets.js';
|
|
14
|
+
import { createImporter } from '../project/imports.js';
|
|
15
|
+
import { manageProjectComponentDirs, projectComponentDirs } from '../project/project-component-dirs.js';
|
|
16
|
+
import { applyProjectFiles, layoutPage, patchFiles } from '../project/project-files.js';
|
|
17
|
+
import { mutateTopologyBatch } from '../project/topology.js';
|
|
18
|
+
import { readDescriptor, readSnapshotTopology } from '../project/snapshot-topology.js';
|
|
19
|
+
import { approvalImages, approvalImageIds, captureOverlay, openSketchThreadCounts } from './review-payloads.js';
|
|
20
|
+
import { randomBytes } from 'node:crypto';
|
|
21
|
+
import { getProjectBrief } from '../brief/project-brief.js';
|
|
22
|
+
import { findElements } from '../search/find-elements.js';
|
|
23
|
+
import type { PublicationPublisher } from '../publication/publish.js';
|
|
24
|
+
import { browseStandaloneDesignSystem, browseSystem } from '../system/browser.js';
|
|
25
|
+
import type { SystemArtifacts } from '../render/system-artifacts.js';
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
import { manifestSchema } from '../contracts/project.js';
|
|
28
|
+
import { DesignError, type OperationResult } from '../contracts/common.js';
|
|
29
|
+
import { operationSchemas, type OperationActor, type OperationDispatcher, type OperationInput, type OperationName, type OperationOutput } from '../contracts/operations.js';
|
|
30
|
+
import { guideView } from '../guide/views.js';
|
|
31
|
+
import type { ProjectWorkspace } from '../project/index.js';
|
|
32
|
+
import type { RendererService } from '../contracts/render.js';
|
|
33
|
+
import type { ReviewService } from '../contracts/review.js';
|
|
34
|
+
import type { DesignService } from '../system/index.js';
|
|
35
|
+
import { getContext } from './context.js';
|
|
36
|
+
import { inputFailure } from '../contracts/input-errors.js';
|
|
37
|
+
import { createMcpArtboardReview } from './mcp-artboard-review.js';
|
|
38
|
+
import { failure, portable } from './results.js';
|
|
39
|
+
import { originalUnavailable } from '../review/original-captures.js';
|
|
40
|
+
import { captureComment, handoff, validate } from './usecases.js';
|
|
41
|
+
import { inspectCommentBoard } from './comment-inspection.js';
|
|
42
|
+
import { inspect } from './inspect.js';
|
|
43
|
+
import { getCommentEvidence } from './comment-evidence.js';
|
|
44
|
+
import type { ServiceMode } from '../contracts/service.types.js';
|
|
45
|
+
import type { PublicationStore } from '../publication/store.js';
|
|
46
|
+
import { operationAllowed } from './operation-policy.js';
|
|
47
|
+
import { queryGraph } from '../graph/query.js';
|
|
48
|
+
import { WorkBudget } from './work-budget.js';
|
|
49
|
+
import { externalResult } from './remote-results.js';
|
|
50
|
+
import { listAnnotations, mutateAnnotation } from '../project/annotations.js';
|
|
51
|
+
import { listArtboardApprovals, setArtboardApproval } from '../project/artboard-approvals.js';
|
|
52
|
+
import { listScreenTransitions, setScreenTransitions } from '../project/screen-transitions.js';
|
|
53
|
+
import { setDesignSystemTokens } from '../project/design-system-tokens.js';
|
|
54
|
+
import type { SourceExportManager } from '../source-export/manager.js';
|
|
55
|
+
import type { SourceExportTickets } from '../source-export/tickets.js';
|
|
56
|
+
import type { SourceExportDownloads } from '../source-export/downloads.js';
|
|
57
|
+
import { sourceExportResult } from '../source-export/result.js';
|
|
58
|
+
import { legacyExportIdSchema } from '../contracts/source-export.schemas.js';
|
|
59
|
+
|
|
60
|
+
export interface OperationServices { workspace: ProjectWorkspace; design: DesignService; review: ReviewService; renderer: RendererService & { warmBuildWorker?(): void }; mode?: ServiceMode; publication?: PublicationStore; publisher?: PublicationPublisher; systemArtifacts?: SystemArtifacts; previewOrigin?: () => string; budget?: WorkBudget; searchCursorKey?: Uint8Array; reviewResourceLinks?: ReviewResourceLinks; sourceExport?: { manager?: SourceExportManager; downloads: SourceExportDownloads; tickets: SourceExportTickets; origin: () => string } }
|
|
61
|
+
type ParsedInput<N extends OperationName> = z.output<(typeof operationSchemas)[N]>;
|
|
62
|
+
export type OperationHandlers = { [N in OperationName]: (input: ParsedInput<N>, actor: OperationActor) => Promise<OperationOutput<N>> };
|
|
63
|
+
const reviewImageResults = new Set<OperationName>([
|
|
64
|
+
'design_list_comments', 'design_get_comment_evidence', 'design_create_comment', 'design_reply_comment',
|
|
65
|
+
'design_set_comment_status', 'design_mark_addressed', 'design_prepare_handoff',
|
|
66
|
+
'design_list_artboard_approvals', 'design_set_artboard_approval', 'design_upload_review_attachment',
|
|
67
|
+
]);
|
|
68
|
+
const expensive = new Set<OperationName>(['design_validate', 'design_get_system_catalog', 'design_get_project_brief', 'design_find_elements', 'design_list_comments', 'design_prepare_handoff', 'design_render', 'design_inspect', 'design_screenshot_artboard', 'design_screenshot_region', 'design_screenshot_comment', 'design_export', 'design_list_assets']);
|
|
69
|
+
|
|
70
|
+
export function createOperations({ workspace, design, review, renderer, mode = 'local', publication, publisher, systemArtifacts, previewOrigin, budget = new WorkBudget(), searchCursorKey = randomBytes(32), reviewResourceLinks, sourceExport }: OperationServices): OperationDispatcher {
|
|
71
|
+
const pendingRenders = new Map<string, Promise<unknown>>();
|
|
72
|
+
const managedProjects = new ManagedProjects(workspace);
|
|
73
|
+
const assets = new ProjectAssets(workspace);
|
|
74
|
+
const importer = createImporter(workspace, id => assets.stagedArchive(id));
|
|
75
|
+
const referencePreviews = new Map<string, string>();
|
|
76
|
+
const runWithReview = createMcpArtboardReview(workspace);
|
|
77
|
+
const handlers: OperationHandlers = {
|
|
78
|
+
design_create_design_system: input => createDesignSystem(workspace, input),
|
|
79
|
+
design_manage_design_system_themes: input => manageDesignSystemThemes(workspace, input),
|
|
80
|
+
design_list_ds_docs: input => listDesignSystemDocs(workspace, input.systemId),
|
|
81
|
+
design_get_ds_doc: input => getDesignSystemDoc(workspace, input),
|
|
82
|
+
design_upsert_ds_doc: input => upsertDesignSystemDoc(workspace, input),
|
|
83
|
+
design_delete_ds_doc: input => deleteDesignSystemDoc(workspace, input),
|
|
84
|
+
design_upsert_design_system_component: input => upsertDesignSystemComponent(workspace, input),
|
|
85
|
+
design_delete_design_system_component: input => deleteDesignSystemComponent(workspace, input),
|
|
86
|
+
design_apply_design_system_files: input => applyDesignSystemFiles(workspace, input),
|
|
87
|
+
design_validate_design_system: input => validateDesignSystem(workspace, input.systemId),
|
|
88
|
+
design_screenshot_design_system: input => budget.run(() => screenshotDesignSystem(workspace, input)),
|
|
89
|
+
design_archive_design_system: input => archiveDesignSystem(workspace, input),
|
|
90
|
+
design_purge_design_system: input => purgeDesignSystem(workspace, input),
|
|
91
|
+
design_list_projects: async (_, actor) => {
|
|
92
|
+
const metadata = publication ? await publication.metadata() : [];
|
|
93
|
+
return {
|
|
94
|
+
projects: await Promise.all((await workspace.listWorkingCopies(actor.uiSession)).map(async entry => {
|
|
95
|
+
const publishedRevision = metadata.find(item => item.projectId === entry.projectId)?.contentRevision;
|
|
96
|
+
if (mode === 'server') {
|
|
97
|
+
const manifest = await workspace.readManifest(entry.workingCopyId, publishedRevision);
|
|
98
|
+
const summary = publication && publishedRevision
|
|
99
|
+
? await publication.catalogSummary(entry.workingCopyId, publishedRevision)
|
|
100
|
+
: undefined;
|
|
101
|
+
return {
|
|
102
|
+
...entry,
|
|
103
|
+
name: manifest.name,
|
|
104
|
+
...(manifest.description ? { description: manifest.description } : {}),
|
|
105
|
+
...(manifest.designSystemRef ? { designSystemRef: manifest.designSystemRef } : {}),
|
|
106
|
+
...(manifest.componentDirs ? { componentDirs: manifest.componentDirs } : {}),
|
|
107
|
+
...(summary ? { pendingApprovalCount: summary.pendingApprovalCount, canvases: summary.canvases } : {}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const summary = await workspace.summarizeProjectCatalog(entry.workingCopyId, publishedRevision);
|
|
111
|
+
return {
|
|
112
|
+
...entry,
|
|
113
|
+
name: summary.manifest.name,
|
|
114
|
+
...(summary.manifest.description ? { description: summary.manifest.description } : {}),
|
|
115
|
+
...(summary.manifest.designSystemRef ? { designSystemRef: summary.manifest.designSystemRef } : {}),
|
|
116
|
+
...(summary.manifest.componentDirs ? { componentDirs: summary.manifest.componentDirs } : {}),
|
|
117
|
+
pendingApprovalCount: summary.pendingApprovalCount,
|
|
118
|
+
canvases: summary.canvases,
|
|
119
|
+
};
|
|
120
|
+
})),
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
design_publish_changes: async input => {
|
|
124
|
+
if (!publisher || !publication) throw new DesignError('service_unavailable', 'Publication is not configured');
|
|
125
|
+
const job = await publisher.request(input);
|
|
126
|
+
return { job, currentPublication: await publication.metadata() };
|
|
127
|
+
},
|
|
128
|
+
design_get_publication_status: async input => {
|
|
129
|
+
if (!publisher) throw new DesignError('service_unavailable', 'Publication status is not configured');
|
|
130
|
+
return publisher.status(input.operationId);
|
|
131
|
+
},
|
|
132
|
+
design_prepare_source_export: async input => {
|
|
133
|
+
if (!sourceExport?.manager) throw new DesignError('export_not_configured', 'Source export is not configured');
|
|
134
|
+
return sourceExportResult(await sourceExport.manager.prepare(input), sourceExport.tickets, sourceExport.origin());
|
|
135
|
+
},
|
|
136
|
+
design_get_source_export: async input => {
|
|
137
|
+
if (!sourceExport) throw new DesignError('service_unavailable', 'Source export is not configured');
|
|
138
|
+
if (legacyExportIdSchema.safeParse(input.exportId).success) {
|
|
139
|
+
const legacy = await sourceExport.downloads.registerLegacy(input.workingCopyId, input.exportId);
|
|
140
|
+
return { kind: 'legacy', state: 'ready', exportId: input.exportId, workingCopyId: input.workingCopyId, contentRevision: legacy.contentRevision, size: legacy.size, sha256: legacy.sha256, expiresAt: legacy.expiresAt, download: sourceExport.tickets.issue(sourceExport.origin(), legacy.ticketId, legacy.sha256, Date.now(), Date.parse(legacy.expiresAt)) };
|
|
141
|
+
}
|
|
142
|
+
if (!sourceExport.manager) throw new DesignError('service_unavailable', 'Source export is not configured');
|
|
143
|
+
return sourceExportResult(await sourceExport.manager.get(input.workingCopyId, input.exportId), sourceExport.tickets, sourceExport.origin());
|
|
144
|
+
},
|
|
145
|
+
design_get_guide: async input => guideView(await design.getGuide(), input),
|
|
146
|
+
design_open_project: async (input) => {
|
|
147
|
+
const project = await workspace.openProject(input);
|
|
148
|
+
renderer.warmBuildWorker?.();
|
|
149
|
+
return project;
|
|
150
|
+
},
|
|
151
|
+
design_ensure_project_canvas: input => workspace.ensureEditableTopology(input.workingCopyId),
|
|
152
|
+
design_create_project: input => managedProjects.create(input),
|
|
153
|
+
design_clone_project: (input, actor) => {
|
|
154
|
+
if ('destination' in input) {
|
|
155
|
+
if (actor.kind !== 'human' || !actor.trustedLocal) throw new DesignError('forbidden', 'Host destinations require a trusted local owner');
|
|
156
|
+
return workspace.cloneProject(input);
|
|
157
|
+
}
|
|
158
|
+
return managedProjects.clone(input);
|
|
159
|
+
},
|
|
160
|
+
design_archive_project: input => managedProjects.archive(input, () => review.acquireMutationLease(input.workingCopyId)),
|
|
161
|
+
design_restore_archived_project: input => managedProjects.restore(input),
|
|
162
|
+
design_purge_project: input => managedProjects.purge(input.trashId),
|
|
163
|
+
design_list_project_component_dirs: async input => {
|
|
164
|
+
const pinned = publication ? (await publication.metadata(input.workingCopyId))[0]?.contentRevision : undefined;
|
|
165
|
+
const reader = await workspace.openSnapshot(input.workingCopyId, input.contentRevision ?? pinned, { readOnly: true, requireSaved: !!pinned });
|
|
166
|
+
const manifest = await readDescriptor(reader, 'design.manifest.json', manifestSchema);
|
|
167
|
+
return projectComponentDirs(reader, manifest);
|
|
168
|
+
},
|
|
169
|
+
design_manage_project_component_dirs: input => manageProjectComponentDirs(workspace, input),
|
|
170
|
+
design_edit_project_metadata: async input => (await workspace.updateMetadata(input)).metadata,
|
|
171
|
+
design_update_project: (input) => workspace.updateProject(input),
|
|
172
|
+
design_rename_canvas: input => workspace.renameCanvas(input),
|
|
173
|
+
design_remove_project: (input) => workspace.removeProject(input.workingCopyId),
|
|
174
|
+
design_list_recents: async (input) => ({ items: await workspace.listRecents(input.limit) }),
|
|
175
|
+
design_touch_recent: async (input) => ({ item: await workspace.touchRecent(input) }),
|
|
176
|
+
design_list_design_systems: async () => ({ systems: await workspace.listDesignSystems() }),
|
|
177
|
+
design_register_design_system: (input) => workspace.registerDesignSystem(input),
|
|
178
|
+
design_clone_design_system: (input) => workspace.cloneDesignSystem(input),
|
|
179
|
+
design_update_design_system: (input) => workspace.updateDesignSystem(input),
|
|
180
|
+
design_remove_design_system: (input) => workspace.removeDesignSystem(input.systemId),
|
|
181
|
+
design_browse_design_system: async (input) => {
|
|
182
|
+
if (!systemArtifacts || !previewOrigin) throw new DesignError('service_unavailable', 'System browser is unavailable');
|
|
183
|
+
return browseStandaloneDesignSystem(workspace, systemArtifacts, input, previewOrigin());
|
|
184
|
+
},
|
|
185
|
+
design_set_design_system_tokens: async (input) => {
|
|
186
|
+
const result = await setDesignSystemTokens(workspace, input);
|
|
187
|
+
if (result.previousRevision !== result.contentRevision) {
|
|
188
|
+
await systemArtifacts?.invalidateDigest(result.previousRevision);
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
191
|
+
},
|
|
192
|
+
design_set_project_design_system: (input) => workspace.setProjectDesignSystem(input),
|
|
193
|
+
design_query_graph: async input => {
|
|
194
|
+
const result = await queryGraph(workspace, input, publication ? (await publication.metadata(input.workingCopyId))[0]?.contentRevision : undefined, publication ? (workingCopyId, revision) => publication.graphQueryNodes(workingCopyId, revision) : undefined);
|
|
195
|
+
if (result.items.some(item => item.type === 'node' && item.node.artboard?.isEmptySketch)) {
|
|
196
|
+
const counts = await openSketchThreadCounts(review, input.workingCopyId);
|
|
197
|
+
for (const item of result.items) if (item.type === 'node' && item.node.artboard?.isEmptySketch) {
|
|
198
|
+
item.node.artboard.openSketchThreadCount = counts.get(item.node.id) ?? 0;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
},
|
|
203
|
+
design_get_context: async input => {
|
|
204
|
+
if (input.detail === 'topology') renderer.warmBuildWorker?.();
|
|
205
|
+
const result = await getContext(workspace, design, input, renderer, publication && (input.detail === 'implementation' || input.detail === 'topology' || ((!input.detail || input.detail === 'summary') && !input.cursor) || input.read) ? (await publication.metadata(input.workingCopyId))[0] : undefined);
|
|
206
|
+
if (result.sketchArtboards?.length) {
|
|
207
|
+
const counts = await openSketchThreadCounts(review, input.workingCopyId);
|
|
208
|
+
for (const board of result.sketchArtboards) board.openSketchThreadCount = counts.get(board.artboardId) ?? 0;
|
|
209
|
+
}
|
|
210
|
+
if (!publication || input.topologyView !== 'compact' || !input.navigationArtboardId || result.navigationSelection) return result;
|
|
211
|
+
const navigationSelection = await publication.navigationSelection(input.workingCopyId, input.navigationArtboardId, result.contentRevision);
|
|
212
|
+
return { ...result, ...(navigationSelection ? { navigationSelection } : {}) };
|
|
213
|
+
},
|
|
214
|
+
design_get_system: async (input) => {
|
|
215
|
+
if (!input.browser) {
|
|
216
|
+
const result = await design.getSystem(input.workingCopyId, input.contentRevision, input.detail);
|
|
217
|
+
const reader = await workspace.openSnapshot(input.workingCopyId, result.contentRevision, { readOnly: true });
|
|
218
|
+
const { topology } = await readSnapshotTopology(reader);
|
|
219
|
+
return { ...result, referenceArtboards: referenceArtboards(topology.artboards) };
|
|
220
|
+
}
|
|
221
|
+
if (input.detail) throw new DesignError('invalid_input', 'detail cannot be combined with browser');
|
|
222
|
+
if (!systemArtifacts || !previewOrigin) throw new DesignError('service_unavailable', 'System browser is unavailable');
|
|
223
|
+
const revision = input.contentRevision ?? (publication ? (await publication.metadata(input.workingCopyId))[0]?.contentRevision : undefined);
|
|
224
|
+
return browseSystem(workspace, systemArtifacts, { ...input, browser: input.browser, contentRevision: revision }, previewOrigin());
|
|
225
|
+
},
|
|
226
|
+
design_get_system_catalog: async input => {
|
|
227
|
+
const revision = input.contentRevision ?? (publication ? (await publication.metadata(input.workingCopyId))[0]?.contentRevision : undefined);
|
|
228
|
+
if (input.view === 'summary') {
|
|
229
|
+
const { system, components, tokenSummary, contentRevision, coverage } = await design.getSystem(input.workingCopyId, revision, 'metadata');
|
|
230
|
+
return { view: 'summary', system: { id: system.id, name: system.name }, componentCount: components.length,
|
|
231
|
+
ruleCount: Object.keys(system.rules).length, tokenSummary, contentRevision,
|
|
232
|
+
coverage: { ...coverage, warnings: coverage.warnings.slice(0, 3) } };
|
|
233
|
+
}
|
|
234
|
+
if (!systemArtifacts || !previewOrigin) throw new DesignError('service_unavailable', 'System browser is unavailable');
|
|
235
|
+
return browseSystem(workspace, systemArtifacts, { workingCopyId: input.workingCopyId, contentRevision: revision, browser: { kind: 'catalog' } }, previewOrigin());
|
|
236
|
+
},
|
|
237
|
+
design_get_project_brief: async input => {
|
|
238
|
+
const published = publication && (await publication.metadata(input.workingCopyId))[0]?.contentRevision;
|
|
239
|
+
if (mode === 'server' && !published) throw new DesignError('publication_invalid', 'Verified publication is unavailable');
|
|
240
|
+
if (input.view === 'authoring') return getAuthoringBrief(workspace, renderer, input, input.contentRevision ?? published);
|
|
241
|
+
return getProjectBrief(workspace, input, input.contentRevision ?? published,
|
|
242
|
+
(artboardId, revision) => referencePreviews.get(JSON.stringify([input.workingCopyId, artboardId, revision])));
|
|
243
|
+
},
|
|
244
|
+
design_find_elements: async input => findElements(workspace, input, searchCursorKey, publication ? (await publication.metadata(input.workingCopyId))[0]?.contentRevision : undefined),
|
|
245
|
+
design_find_usages: (input) => design.findUsages(input),
|
|
246
|
+
design_inspect: (input) => inspect(design, renderer, input, async render => {
|
|
247
|
+
const { workingCopyId, artboardId, contentRevision } = render;
|
|
248
|
+
const location = publication ? await publication.selectionLocation(workingCopyId, artboardId, contentRevision) : workspace.selectionLocation(workingCopyId, artboardId, contentRevision);
|
|
249
|
+
return inspectCommentBoard(workspace, render, location);
|
|
250
|
+
}),
|
|
251
|
+
design_apply_changes: input => applyProjectFiles(workspace, input),
|
|
252
|
+
design_extract_html_component: input => extractHtmlComponent(workspace, input),
|
|
253
|
+
design_git_commit: input => commitDesignPaths(workspace, input),
|
|
254
|
+
design_patch_files: input => patchFiles(workspace, input),
|
|
255
|
+
design_batch_topology: (input, actor) => mutateTopologyBatch(workspace, input, actor.kind === 'agent' ? async ids => {
|
|
256
|
+
await assertNoDeletedThreads(review, input.workingCopyId, ids);
|
|
257
|
+
} : undefined),
|
|
258
|
+
design_layout_page: input => layoutPage(workspace, input),
|
|
259
|
+
design_create_artboard: async (input, actor) => {
|
|
260
|
+
if (actor.kind === 'human' && input.mode === 'empty_sketch' && input.composition === undefined && !input.cloneFromArtboardId) {
|
|
261
|
+
const result = await workspace.applyCanvasEdit({ kind: 'create', input });
|
|
262
|
+
if (result?.artboardPatch) return { ...result, artboardId: result.artboardPatch.artboardId };
|
|
263
|
+
}
|
|
264
|
+
return createArtboard(workspace, input);
|
|
265
|
+
},
|
|
266
|
+
design_delete_artboard: async input => {
|
|
267
|
+
const result = await workspace.applyCanvasEdit({ kind: 'delete', input });
|
|
268
|
+
if (!result) throw new DesignError('service_unavailable', 'Artboard deletion returned no receipt');
|
|
269
|
+
return result;
|
|
270
|
+
},
|
|
271
|
+
design_restore_artboard: async input => {
|
|
272
|
+
const result = await workspace.applyCanvasEdit({ kind: 'restore', input });
|
|
273
|
+
if (!result) throw new DesignError('service_unavailable', 'Artboard restoration returned no receipt');
|
|
274
|
+
return result;
|
|
275
|
+
},
|
|
276
|
+
design_duplicate_artboard: input => duplicateArtboard(workspace, input),
|
|
277
|
+
design_set_artboard_reference: (input, actor) => setArtboardReference(workspace, input, actor.kind),
|
|
278
|
+
design_upload_asset: input => assets.upload(input),
|
|
279
|
+
design_list_assets: async input => {
|
|
280
|
+
if (!publication) return assets.list(input);
|
|
281
|
+
if (input.target.kind !== 'project') throw new DesignError('forbidden', 'Published asset inventory requires a published project');
|
|
282
|
+
return assets.list({ ...input, contentRevision: input.contentRevision ?? (await publication.metadata(input.target.workingCopyId))[0]?.contentRevision });
|
|
283
|
+
},
|
|
284
|
+
design_delete_asset: input => assets.delete(input),
|
|
285
|
+
design_upload_review_attachment: input => {
|
|
286
|
+
if (!review.uploadReviewImage) throw new DesignError('service_unavailable', 'Review images are unavailable');
|
|
287
|
+
return review.uploadReviewImage(input);
|
|
288
|
+
},
|
|
289
|
+
design_validate: (input) => validate(design, renderer, review, input),
|
|
290
|
+
design_mutate_topology: async (input, actor) => {
|
|
291
|
+
const checkAgentDelete =
|
|
292
|
+
actor.kind !== 'human' &&
|
|
293
|
+
input.kind === 'delete' &&
|
|
294
|
+
(input.entity === 'page' || input.entity === 'canvas') &&
|
|
295
|
+
Boolean(input.id)
|
|
296
|
+
? (deletedArtboardIds: readonly string[]) => assertNoDeletedThreads(review, input.workingCopyId, deletedArtboardIds)
|
|
297
|
+
: undefined;
|
|
298
|
+
const result = await workspace.mutateTopology(input, checkAgentDelete);
|
|
299
|
+
if (actor.kind === 'human' && input.kind === 'delete' && (input.entity === 'page' || input.entity === 'canvas')) {
|
|
300
|
+
const { readSnapshotTopology } = await import('../project/snapshot-topology.js');
|
|
301
|
+
const beforeReader = await workspace.openSnapshot(input.workingCopyId, result.beforeSnapshot);
|
|
302
|
+
const afterReader = await workspace.openSnapshot(input.workingCopyId, result.afterSnapshot);
|
|
303
|
+
const [beforeTopo, afterTopo] = await Promise.all([
|
|
304
|
+
readSnapshotTopology(beforeReader),
|
|
305
|
+
readSnapshotTopology(afterReader),
|
|
306
|
+
]);
|
|
307
|
+
const remaining = new Set(afterTopo.topology.artboards.map((a) => a.value.id));
|
|
308
|
+
const deletedArtboardIds = beforeTopo.topology.artboards
|
|
309
|
+
.map((a) => a.value.id)
|
|
310
|
+
.filter((id) => !remaining.has(id));
|
|
311
|
+
if (deletedArtboardIds.length) {
|
|
312
|
+
await review.purgeArtboardThreads(input.workingCopyId, deletedArtboardIds, actor.kind);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return result;
|
|
316
|
+
},
|
|
317
|
+
design_list_annotations: (input) => listAnnotations(workspace, input),
|
|
318
|
+
design_mutate_annotation: (input) => mutateAnnotation(workspace, input),
|
|
319
|
+
design_list_artboard_approvals: async input => {
|
|
320
|
+
const result = await listArtboardApprovals(workspace, input, publication ? (await publication.metadata(input.workingCopyId))[0]?.contentRevision : undefined);
|
|
321
|
+
return { ...result, artboards: await approvalImages(review, input.workingCopyId, result.artboards) };
|
|
322
|
+
},
|
|
323
|
+
design_set_artboard_approval: async (input, actor) => {
|
|
324
|
+
const result = await setArtboardApproval(workspace, await approvalImageIds(review, input), actor);
|
|
325
|
+
return { ...result, updated: await approvalImages(review, input.workingCopyId, result.updated) };
|
|
326
|
+
},
|
|
327
|
+
design_set_artboard_appearance: (input, actor) => workspace.applyArtboardAppearance(input, actor.kind),
|
|
328
|
+
design_list_screen_transitions: async (input) => listScreenTransitions(
|
|
329
|
+
workspace,
|
|
330
|
+
input,
|
|
331
|
+
publication ? (await publication.metadata(input.workingCopyId))[0]?.contentRevision : undefined,
|
|
332
|
+
),
|
|
333
|
+
design_set_screen_transitions: (input, actor) => setScreenTransitions(workspace, input, actor),
|
|
334
|
+
design_list_comments: async (input) => {
|
|
335
|
+
const list = await review.listComments(input);
|
|
336
|
+
const attachments = [...new Map(list.threads.flatMap(({ thread }) =>
|
|
337
|
+
thread.messages.flatMap(message => message.attachments ?? [])).map(image => [image.id, image])).values()];
|
|
338
|
+
if (attachments.length) list.attachments = attachments;
|
|
339
|
+
if (input.waitForOriginals === false) return list;
|
|
340
|
+
for (const item of list.threads) {
|
|
341
|
+
if (item.thread.originalCapturePending) {
|
|
342
|
+
try { item.thread = await review.ensureOriginal(input.workingCopyId, item.thread); }
|
|
343
|
+
catch (error) {
|
|
344
|
+
if (!originalUnavailable(error)) throw error;
|
|
345
|
+
list.warnings.push({ code: 'original_capture_unavailable', severity: 'warning', targetId: item.thread.id, message: 'The requested original is unavailable; it can be retried.' });
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return list;
|
|
350
|
+
},
|
|
351
|
+
design_get_comment_evidence: (input) => getCommentEvidence(workspace, design, review, input),
|
|
352
|
+
design_create_comment: (input, actor) => review.createThread(input, actor.kind),
|
|
353
|
+
design_reply_comment: (input, actor) => review.replyThread(input, actor.kind),
|
|
354
|
+
design_set_comment_status: (input, actor) => review.setThreadStatus(input, actor.kind),
|
|
355
|
+
design_delete_comment: (input, actor) => review.deleteThread(input, actor.kind),
|
|
356
|
+
design_mark_addressed: (input, actor) => review.markAddressed(input, actor.kind),
|
|
357
|
+
design_prepare_handoff: (input) => handoff(workspace, design, review, input),
|
|
358
|
+
design_render: (input) => renderer.render(input),
|
|
359
|
+
design_screenshot_artboard: async input => {
|
|
360
|
+
const overlay = await captureOverlay(review, input.workingCopyId, input.artboardId, input.includePencilOverlay, input.includeCommentPins);
|
|
361
|
+
const capture = await renderer.captureArtboard(input, overlay);
|
|
362
|
+
if (!overlay && !input.annotations && !input.interactions) {
|
|
363
|
+
const key = JSON.stringify([input.workingCopyId, input.artboardId, capture.contentRevision]);
|
|
364
|
+
referencePreviews.set(key, `helpra-design://resources/${capture.resource.id}`);
|
|
365
|
+
if (referencePreviews.size > 256) referencePreviews.delete(referencePreviews.keys().next().value ?? '');
|
|
366
|
+
}
|
|
367
|
+
return capture;
|
|
368
|
+
},
|
|
369
|
+
design_screenshot_region: (input) => renderer.captureRegion(input),
|
|
370
|
+
design_screenshot_comment: (input) => captureComment(review, renderer, input),
|
|
371
|
+
design_export: async input => {
|
|
372
|
+
if (input.format !== 'source') return renderer.exportProject(input);
|
|
373
|
+
const release = await review.acquireMutationLease(input.workingCopyId, { checkDeadline() {} });
|
|
374
|
+
try { return await renderer.exportProject(input); } finally { await release(); }
|
|
375
|
+
},
|
|
376
|
+
design_import: (input, actor) => importer.importProject(input, actor.kind === 'human' && actor.trustedLocal),
|
|
377
|
+
design_restore_snapshot: (input) => workspace.restore(input),
|
|
378
|
+
design_save_ui_state: (input, actor) => {
|
|
379
|
+
if (mode === 'remote' && !actor.uiSession) throw new DesignError('invalid_input', 'A browser session is required to save remote UI state');
|
|
380
|
+
return workspace.saveUiState(input, actor.uiSession);
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
async function invoke<N extends OperationName>(name: N, value: unknown, actor: OperationActor): Promise<unknown> {
|
|
384
|
+
if (!operationAllowed(name, actor, mode)) throw new DesignError('forbidden', 'This operation is not available for this connection.');
|
|
385
|
+
const input = operationSchemas[name].parse(value) as ParsedInput<N>;
|
|
386
|
+
if (publication && name !== 'design_publish_changes' && name !== 'design_get_publication_status') await publication.metadata();
|
|
387
|
+
return runWithReview(name, input, actor, () => handlers[name](input, actor));
|
|
388
|
+
}
|
|
389
|
+
function execute<N extends OperationName>(name: N, input: OperationInput<N>, actor: OperationActor): Promise<OperationResult<OperationOutput<N>>>;
|
|
390
|
+
function execute(name: string, input: unknown, actor: OperationActor): Promise<OperationResult<unknown>>;
|
|
391
|
+
async function execute(name: string, input: unknown, actor: OperationActor): Promise<OperationResult<unknown>> {
|
|
392
|
+
try {
|
|
393
|
+
if (!Object.hasOwn(operationSchemas, name)) throw new DesignError('invalid_input', 'Unknown design operation.', { field: 'name', expected: 'a tool returned by tools/list' });
|
|
394
|
+
const operation = name as OperationName;
|
|
395
|
+
const run = async (requestInput: unknown = input) => {
|
|
396
|
+
const raw = await invoke(operation, requestInput, actor);
|
|
397
|
+
const value = reviewResourceLinks && reviewImageResults.has(operation) ? reviewResourceLinks.sign(raw) : raw;
|
|
398
|
+
return portable(name, publication && name !== 'design_publish_changes' && name !== 'design_get_publication_status' ? await publication.decorate(name, value, requestInput) : value, actor);
|
|
399
|
+
};
|
|
400
|
+
const legacyExport = operation === 'design_get_source_export' && input !== null && typeof input === 'object' && 'exportId' in input && legacyExportIdSchema.safeParse(input.exportId).success;
|
|
401
|
+
let data: unknown;
|
|
402
|
+
if (mode === 'server' && operation === 'design_render') {
|
|
403
|
+
// Validate each caller before sharing only simultaneous identical reads.
|
|
404
|
+
if (!operationAllowed(operation, actor, mode)) throw new DesignError('forbidden', 'This operation is not available for this connection.');
|
|
405
|
+
const request = operationSchemas.design_render.parse(input);
|
|
406
|
+
await publication?.metadata();
|
|
407
|
+
const registered = (await workspace.listWorkingCopies()).find(entry => entry.workingCopyId === request.workingCopyId);
|
|
408
|
+
if (!registered) throw new DesignError('project_not_registered', 'Working copy is not registered');
|
|
409
|
+
const key = JSON.stringify([registered.projectId, request]);
|
|
410
|
+
let job = pendingRenders.get(key);
|
|
411
|
+
if (!job) {
|
|
412
|
+
job = budget.run(() => run(request));
|
|
413
|
+
pendingRenders.set(key, job);
|
|
414
|
+
const clear = () => { if (pendingRenders.get(key) === job) pendingRenders.delete(key); };
|
|
415
|
+
void job.then(clear, clear);
|
|
416
|
+
}
|
|
417
|
+
data = await job;
|
|
418
|
+
} else {
|
|
419
|
+
data = mode !== 'local' && (expensive.has(operation) || legacyExport || operation === 'design_get_system' && Boolean((input as { browser?: unknown } | null)?.browser)) ? await budget.run(run) : await run();
|
|
420
|
+
}
|
|
421
|
+
return mode !== 'local' ? externalResult({ ok: true, data }) : { ok: true, data };
|
|
422
|
+
} catch (error) {
|
|
423
|
+
const schema = Object.hasOwn(operationSchemas, name) ? operationSchemas[name as OperationName] : undefined;
|
|
424
|
+
const result = failure(inputFailure(error, schema) ?? error);
|
|
425
|
+
return mode !== 'local' || actor.kind === 'agent' && name === 'design_browse_design_system' ? externalResult(result) : result;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
execute,
|
|
430
|
+
listOperations(actor) {
|
|
431
|
+
return (Object.keys(operationSchemas) as OperationName[]).filter((name) => (!['design_publish_changes', 'design_get_publication_status'].includes(name) || Boolean(publisher && publication)) && (mode === 'local' && !actor || operationAllowed(name, actor ?? { kind: 'agent', trustedLocal: false }, mode))).map((name) => ({ name, inputSchema: z.toJSONSchema(operationSchemas[name], { unrepresentable: 'any', io: 'input' }) }));
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
async function assertNoDeletedThreads(review: ReviewService, workingCopyId: string, ids: readonly string[]) {
|
|
437
|
+
if (!ids.length) return;
|
|
438
|
+
const targets = new Set(ids);
|
|
439
|
+
let cursor: string | undefined;
|
|
440
|
+
do {
|
|
441
|
+
const page = await review.listComments({ workingCopyId, cursor, limit: 200, waitForOriginals: false });
|
|
442
|
+
if (page.threads.some(({ thread }) => targets.has(thread.target.artboardId))) {
|
|
443
|
+
throw new DesignError('forbidden', 'Agents cannot delete a page or canvas that still has comment threads');
|
|
444
|
+
}
|
|
445
|
+
cursor = page.nextCursor;
|
|
446
|
+
} while (cursor);
|
|
447
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { validateOrigins } from '../contracts/origins.js';
|
|
4
|
+
import { createPublicationGateway } from './publication-gateway.js';
|
|
5
|
+
|
|
6
|
+
const environment = z.object({
|
|
7
|
+
DESIGN_CONTROL_ORIGIN: z.string(), DESIGN_PREVIEW_ORIGIN: z.string(),
|
|
8
|
+
DESIGN_MCP_TOKEN_FILE: z.string().min(1), DESIGN_PUBLISH_TOKEN_FILE: z.string().min(1),
|
|
9
|
+
DESIGN_PUBLISH_REQUESTS_DIR: z.string().min(1), DESIGN_PUBLISH_RESULTS_DIR: z.string().min(1),
|
|
10
|
+
DESIGN_PUBLISH_IDENTITY_DIR: z.string().min(1), DESIGN_PUBLISH_RESERVATIONS_DIR: z.string().min(1),
|
|
11
|
+
DESIGN_PUBLISH_RECORDS_DIR: z.string().min(1),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
async function secret(filename: string): Promise<string> {
|
|
15
|
+
const token = (await readFile(filename, 'utf8')).replace(/\n$/, '');
|
|
16
|
+
if (!/^[A-Za-z0-9_-]{43,}$/.test(token)) throw new Error('invalid credential');
|
|
17
|
+
return token;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function main(): Promise<void> {
|
|
21
|
+
const env = environment.parse(process.env);
|
|
22
|
+
validateOrigins({ controlOrigin: env.DESIGN_CONTROL_ORIGIN, previewOrigin: env.DESIGN_PREVIEW_ORIGIN }, 'server');
|
|
23
|
+
const agentToken = await secret(env.DESIGN_MCP_TOKEN_FILE), publisherToken = await secret(env.DESIGN_PUBLISH_TOKEN_FILE);
|
|
24
|
+
if (agentToken === publisherToken) throw new Error('credentials must differ');
|
|
25
|
+
const server = createPublicationGateway({
|
|
26
|
+
controlOrigin: env.DESIGN_CONTROL_ORIGIN, mainOrigin: 'http://helpra-design:4310', agentToken, publisherToken,
|
|
27
|
+
directories: { requestDirectory: env.DESIGN_PUBLISH_REQUESTS_DIR, resultDirectory: env.DESIGN_PUBLISH_RESULTS_DIR,
|
|
28
|
+
identityDirectory: env.DESIGN_PUBLISH_IDENTITY_DIR, reservationDirectory: env.DESIGN_PUBLISH_RESERVATIONS_DIR, recordDirectory: env.DESIGN_PUBLISH_RECORDS_DIR },
|
|
29
|
+
});
|
|
30
|
+
server.listen(4312, '0.0.0.0');
|
|
31
|
+
const stop = (): void => { server.close(); };
|
|
32
|
+
process.once('SIGTERM', stop); process.once('SIGINT', stop);
|
|
33
|
+
}
|
|
34
|
+
main().catch(() => { process.stderr.write('publication_gateway_startup_failed\n'); process.exitCode = 1; });
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { createServer, request, type IncomingMessage, type ServerResponse } from 'node:http';
|
|
2
|
+
import { pipeline } from 'node:stream';
|
|
3
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
4
|
+
import { SUPPORTED_PROTOCOL_VERSIONS } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { DesignError, type OperationResult } from '../contracts/common.js';
|
|
7
|
+
import { operationSchemas, type OperationActor, type OperationDescription, type OperationName } from '../contracts/operations.js';
|
|
8
|
+
import { publicationStatusInputSchema } from '../contracts/publication-status.schemas.js';
|
|
9
|
+
import { readPublicationJob } from '../publication/publish-status.js';
|
|
10
|
+
import { authenticateMcp } from './mcp-auth.js';
|
|
11
|
+
import { assertOrigin } from './security.js';
|
|
12
|
+
import { createMcpServer } from './mcp.js';
|
|
13
|
+
import { operationAllowed } from './operation-policy.js';
|
|
14
|
+
import { failure, statusFor } from './results.js';
|
|
15
|
+
import { externalResult } from './remote-results.js';
|
|
16
|
+
import { currentPublication } from './status-current.js';
|
|
17
|
+
import { createForwardCapacity, createStatusCapacity, installIngressGuard } from './status-capacity.js';
|
|
18
|
+
import type { PublicationGatewayOptions } from './publication-gateway.types.js';
|
|
19
|
+
|
|
20
|
+
const routeSchema = z.object({ method: z.string(), params: z.object({ name: z.string().optional() }).optional() });
|
|
21
|
+
// The SDK's ping checks this MCP endpoint, not the replaceable main service.
|
|
22
|
+
const localMethods = new Set(['initialize', 'notifications/initialized', 'ping', 'tools/list']);
|
|
23
|
+
const limit = 10 * 1024 * 1024, small = 64 * 1024;
|
|
24
|
+
|
|
25
|
+
function listOperations(actor: OperationActor): OperationDescription[] {
|
|
26
|
+
return (Object.keys(operationSchemas) as OperationName[]).filter(name => operationAllowed(name, actor, 'server')).map(name => ({
|
|
27
|
+
name, inputSchema: z.toJSONSchema(operationSchemas[name], { unrepresentable: 'any', io: 'input' }),
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function unavailable(response: ServerResponse, error: unknown): void {
|
|
32
|
+
if (response.destroyed || response.headersSent) { response.destroy(); return; }
|
|
33
|
+
const result = externalResult(failure(error));
|
|
34
|
+
const status = result.ok ? 503 : statusFor(result.error.code);
|
|
35
|
+
response.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store' });
|
|
36
|
+
response.end(JSON.stringify(result));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function local(requestBody: unknown, requestMessage: IncomingMessage, response: ServerResponse, actor: OperationActor, options: PublicationGatewayOptions, statusRead: ReturnType<typeof createStatusCapacity>): Promise<void> {
|
|
40
|
+
const server = createMcpServer({
|
|
41
|
+
listOperations: async () => listOperations(actor),
|
|
42
|
+
execute: async (name, input): Promise<OperationResult<unknown>> => {
|
|
43
|
+
try {
|
|
44
|
+
if (name !== 'design_get_publication_status' || !operationAllowed(name, actor, 'server')) throw new DesignError('forbidden', 'This operation is not available for this connection.');
|
|
45
|
+
const value = publicationStatusInputSchema.parse(input);
|
|
46
|
+
const [observed, current] = await Promise.all([
|
|
47
|
+
statusRead(() => readPublicationJob(options.directories, value.operationId)),
|
|
48
|
+
currentPublication(options.mainOrigin, options.controlOrigin, options.agentToken),
|
|
49
|
+
]);
|
|
50
|
+
return { ok: true, data: { ...observed, rollback: 'unknown', currentPublication: current } };
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return externalResult(error instanceof z.ZodError ? { ok: false, error: { code: 'invalid_input', message: 'Operation input does not match its schema.' } } : failure(error));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
guide: async () => { throw new DesignError('service_unavailable', 'Guide is unavailable'); },
|
|
56
|
+
resource: async () => { throw new DesignError('service_unavailable', 'Resource is unavailable'); },
|
|
57
|
+
}, { stateless: true });
|
|
58
|
+
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined, enableJsonResponse: true });
|
|
59
|
+
try { await server.connect(transport); await transport.handleRequest(requestMessage, response, requestBody); }
|
|
60
|
+
finally { await server.close(); await transport.close(); }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function forward(requestMessage: IncomingMessage, response: ServerResponse, options: PublicationGatewayOptions, bytes: Buffer): Promise<void> {
|
|
64
|
+
return new Promise(resolve => {
|
|
65
|
+
const upstream = request(new URL(requestMessage.url ?? '/mcp', options.mainOrigin), { method: requestMessage.method, headers: requestMessage.headers }, incoming => {
|
|
66
|
+
response.writeHead(incoming.statusCode ?? 503, incoming.headers);
|
|
67
|
+
pipeline(incoming, response, () => resolve());
|
|
68
|
+
});
|
|
69
|
+
upstream.once('error', () => { unavailable(response, new DesignError('service_unavailable', 'Design is unavailable')); resolve(); });
|
|
70
|
+
response.once('close', () => upstream.destroy());
|
|
71
|
+
upstream.end(bytes);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function createPublicationGateway(options: PublicationGatewayOptions) {
|
|
76
|
+
const acquire = createForwardCapacity();
|
|
77
|
+
const statusRead = createStatusCapacity();
|
|
78
|
+
const server = createServer((requestMessage, response) => {
|
|
79
|
+
void (async () => {
|
|
80
|
+
let release: (() => void) | undefined, protectedWork = false;
|
|
81
|
+
try {
|
|
82
|
+
response.setHeader('X-Content-Type-Options', 'nosniff');
|
|
83
|
+
response.setHeader('Referrer-Policy', 'no-referrer');
|
|
84
|
+
response.setHeader('Cache-Control', 'no-store');
|
|
85
|
+
assertOrigin(requestMessage, options.controlOrigin);
|
|
86
|
+
const target = requestMessage.url ?? '';
|
|
87
|
+
if (!target.startsWith('/') || target.startsWith('//') || target.includes('\\')) throw new DesignError('invalid_input', 'Invalid request target.');
|
|
88
|
+
const url = new URL(target, options.controlOrigin);
|
|
89
|
+
if (url.origin !== options.controlOrigin) throw new DesignError('invalid_input', 'Invalid request target.');
|
|
90
|
+
const actor = authenticateMcp(requestMessage, url, { token: '', agentToken: options.agentToken, publisherToken: options.publisherToken });
|
|
91
|
+
if (requestMessage.method !== 'POST') { response.writeHead(405, { Allow: 'POST', 'Cache-Control': 'no-store' }); response.end(); return; }
|
|
92
|
+
if (requestMessage.headers['content-type']?.split(';')[0] !== 'application/json') throw new DesignError('invalid_input', 'Send operation inputs as application/json.');
|
|
93
|
+
const bodyDeadline = setTimeout(() => requestMessage.destroy(), 60000);
|
|
94
|
+
requestMessage.once('end', () => clearTimeout(bodyDeadline));
|
|
95
|
+
requestMessage.once('close', () => clearTimeout(bodyDeadline));
|
|
96
|
+
const length = Number(requestMessage.headers['content-length'] ?? 0);
|
|
97
|
+
if (length > limit) throw new DesignError('invalid_input', 'Operation input exceeds the 10 MiB limit.');
|
|
98
|
+
if (length > small) release = await acquire(response);
|
|
99
|
+
let size = 0; const chunks: Buffer[] = [];
|
|
100
|
+
for await (const chunk of requestMessage) {
|
|
101
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
102
|
+
size += bytes.length;
|
|
103
|
+
if (size > limit) throw new DesignError('invalid_input', 'Operation input exceeds the 10 MiB limit.');
|
|
104
|
+
if (size > small && !release) release = await acquire(response);
|
|
105
|
+
chunks.push(bytes);
|
|
106
|
+
}
|
|
107
|
+
const bytes = Buffer.concat(chunks);
|
|
108
|
+
let body: unknown;
|
|
109
|
+
try { body = JSON.parse(bytes.toString('utf8')) as unknown; }
|
|
110
|
+
catch { throw new DesignError('invalid_input', 'Operation input is not valid JSON.'); }
|
|
111
|
+
const route = routeSchema.safeParse(body);
|
|
112
|
+
// Modern clients can probe discovery before falling back to initialize.
|
|
113
|
+
// Let the same pinned SDK reject unsupported versions without needing main;
|
|
114
|
+
// this does not implement discovery or intercept supported-version requests.
|
|
115
|
+
// Larger bodies retain main's parsing budget and the existing forward limits.
|
|
116
|
+
const protocolVersion = requestMessage.headers['mcp-protocol-version'];
|
|
117
|
+
const rejectDiscovery = size <= small && route.success && route.data.method === 'server/discover'
|
|
118
|
+
&& typeof protocolVersion === 'string' && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion);
|
|
119
|
+
const isLocal = !Array.isArray(body) && route.success && (rejectDiscovery || localMethods.has(route.data.method) || route.data.method === 'tools/call' && route.data.params?.name === 'design_get_publication_status');
|
|
120
|
+
if (isLocal) {
|
|
121
|
+
release?.(); release = undefined;
|
|
122
|
+
protect(requestMessage.socket, true);
|
|
123
|
+
protectedWork = true;
|
|
124
|
+
await local(body, requestMessage, response, actor, options, statusRead);
|
|
125
|
+
} else {
|
|
126
|
+
release ??= await acquire(response);
|
|
127
|
+
protect(requestMessage.socket, true);
|
|
128
|
+
protectedWork = true;
|
|
129
|
+
await forward(requestMessage, response, options, bytes);
|
|
130
|
+
}
|
|
131
|
+
} catch (error) { unavailable(response, error); }
|
|
132
|
+
finally { if (protectedWork) protect(requestMessage.socket, false); release?.(); }
|
|
133
|
+
})();
|
|
134
|
+
});
|
|
135
|
+
// New status calls can displace incomplete or waiting ingress, while the two
|
|
136
|
+
// active forwards and local status work retain their sockets.
|
|
137
|
+
const protect = installIngressGuard(server);
|
|
138
|
+
return server;
|
|
139
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PublicationStatusDirectories } from '../publication/publish-status.types.js';
|
|
2
|
+
|
|
3
|
+
export interface PublicationGatewayOptions {
|
|
4
|
+
controlOrigin: string;
|
|
5
|
+
mainOrigin: string;
|
|
6
|
+
agentToken: string;
|
|
7
|
+
publisherToken: string;
|
|
8
|
+
directories: PublicationStatusDirectories;
|
|
9
|
+
}
|