Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Delete legacy prototypes folder from frontend (#8383)

James Brunton01b6b912b185
diff --git a/.github/workflows/PR-Demo-Comment-with-react.yml b/.github/workflows/PR-Demo-Comment-with-react.yml
index 6dfe7fa553..cc5da4c1e8 100644
--- a/.github/workflows/PR-Demo-Comment-with-react.yml
+++ b/.github/workflows/PR-Demo-Comment-with-react.yml
@@ -8,8 +8,8 @@ on:
pr_number:
description: "PR number to deploy"
required: true
- enable_prototypes:
- description: "Build with prototypes frontend"
+ enable_engine:
+ description: "Deploy the AI engine alongside"
required: false
type: boolean
default: false
@@ -67,7 +67,7 @@ jobs:
disable_security: ${{ steps.check-security-flag.outputs.disable_security }}
enable_pro: ${{ steps.check-pro-flag.outputs.enable_pro }}
enable_enterprise: ${{ steps.check-pro-flag.outputs.enable_enterprise }}
- enable_prototypes: ${{ steps.check-prototypes-flag.outputs.enable_prototypes }}
+ enable_engine: ${{ steps.check-engine-flag.outputs.enable_engine }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
@@ -125,21 +125,21 @@ jobs:
echo "enable_enterprise=false" >> $GITHUB_OUTPUT
fi
- - name: Check for prototypes flag
- id: check-prototypes-flag
+ - name: Check for engine flag
+ id: check-engine-flag
env:
COMMENT_BODY: ${{ github.event.comment.body }}
IS_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
- DISPATCH_PROTOTYPES: ${{ inputs.enable_prototypes }}
+ DISPATCH_ENGINE: ${{ inputs.enable_engine }}
run: |
if [[ "$IS_DISPATCH" == "true" ]]; then
- echo "enable_prototypes=$DISPATCH_PROTOTYPES" >> $GITHUB_OUTPUT
- elif [[ "$COMMENT_BODY" == *"prototypes"* ]]; then
- echo "Prototypes flag detected in comment"
- echo "enable_prototypes=true" >> $GITHUB_OUTPUT
+ echo "enable_engine=$DISPATCH_ENGINE" >> $GITHUB_OUTPUT
+ elif [[ "$COMMENT_BODY" == *"engine"* ]]; then
+ echo "Engine flag detected in comment"
+ echo "enable_engine=true" >> $GITHUB_OUTPUT
else
- echo "No prototypes flag detected in comment"
- echo "enable_prototypes=false" >> $GITHUB_OUTPUT
+ echo "No engine flag detected in comment"
+ echo "enable_engine=false" >> $GITHUB_OUTPUT
fi
- name: Add 'in_progress' reaction to comment
@@ -245,11 +245,10 @@ jobs:
tags: ghcr.io/${{ steps.repoowner.outputs.lowercase }}/stirling-pdf-test:pr-${{ needs.check-comment.outputs.pr_number }}
build-args: |
VERSION_TAG=alpha
- PROTOTYPES_BUILD=${{ needs.check-comment.outputs.enable_prototypes }}
platforms: linux/amd64
- name: Build and push engine image
- if: needs.check-comment.outputs.enable_prototypes == 'true'
+ if: needs.check-comment.outputs.enable_engine == 'true'
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
@@ -297,11 +296,11 @@ jobs:
PREMIUM_PROFEATURES_AUDIT_ENABLED="false"
fi
- ENABLE_PROTOTYPES="${{ needs.check-comment.outputs.enable_prototypes }}"
+ ENABLE_ENGINE="${{ needs.check-comment.outputs.enable_engine }}"
PR_NUMBER="${{ needs.check-comment.outputs.pr_number }}"
- # Build engine env vars for backend (only set when prototypes enabled)
- if [ "$ENABLE_PROTOTYPES" == "true" ]; then
+ # Build engine env vars for backend (only set when engine enabled)
+ if [ "$ENABLE_ENGINE" == "true" ]; then
AI_ENGINE_VARS="
SYSTEM_AIENGINE_ENABLED: \"true\"
SYSTEM_AIENGINE_URL: \"http://stirling-pdf-engine-pr-${PR_NUMBER}:5001\""
diff --git a/.taskfiles/frontend.yml b/.taskfiles/frontend.yml
index bee723223b..bd7e101d36 100644
--- a/.taskfiles/frontend.yml
+++ b/.taskfiles/frontend.yml
@@ -187,13 +187,6 @@ tasks:
- task: dev:_run
vars: { MODE: desktop, PORT: '{{.PORT}}', BACKEND_URL: '{{.BACKEND_URL}}', OPEN: '{{.OPEN}}' }
- dev:prototypes:
- desc: "Start frontend dev server in prototypes mode"
- deps: [prepare]
- cmds:
- - task: dev:_run
- vars: { MODE: prototypes, PORT: '{{.PORT}}', BACKEND_URL: '{{.BACKEND_URL}}', OPEN: '{{.OPEN}}' }
-
# ============================================================
# Build
# ============================================================
@@ -242,12 +235,6 @@ tasks:
cmds:
- npx vite build editor --mode desktop --outDir dist-desktop
- build:prototypes:
- desc: "Build for prototypes mode"
- deps: [prepare]
- cmds:
- - npx vite build editor --mode prototypes
-
storybook:
desc: "Start Storybook dev server"
@@ -471,13 +458,6 @@ tasks:
- task: typecheck:_run
vars: { PROJECT: editor/scripts/tsconfig.json }
- typecheck:prototypes:
- desc: "Typecheck prototypes build variant"
- deps: [prepare]
- cmds:
- - task: typecheck:_run
- vars: { PROJECT: editor/src/prototypes/tsconfig.json }
-
typecheck:portal:
desc: "Typecheck developer portal build variant"
deps: [install]
@@ -501,7 +481,6 @@ tasks:
- task: typecheck:desktop
- task: typecheck:cloud
- task: typecheck:scripts
- - task: typecheck:prototypes
- task: typecheck:portal
- task: typecheck:storybook
diff --git a/LICENSE b/LICENSE
index 5579823030..2b0c7af481 100644
--- a/LICENSE
+++ b/LICENSE
@@ -18,8 +18,6 @@ if that directory exists, is licensed under the license defined in "frontend/edi
if that directory exists, is licensed under the license defined in "frontend/editor/src/saas/LICENSE".
* All content that resides under the "frontend/editor/src/cloud/" directory of this repository,
if that directory exists, is licensed under the license defined in "frontend/editor/src/cloud/LICENSE".
-* All content that resides under the "frontend/editor/src/prototypes/" directory of this repository,
-if that directory exists, is licensed under the license defined in "frontend/editor/src/prototypes/LICENSE".
* All content that resides under the "frontend/editor/src/portal/" directory of this repository,
if that directory exists, is licensed under the license defined in "frontend/editor/src/portal/LICENSE".
* All content that resides under the "frontend/editor/src/portal-saas/" directory of this repository,
diff --git a/app/core/build.gradle b/app/core/build.gradle
index 26965ed614..f8ba95ac3c 100644
--- a/app/core/build.gradle
+++ b/app/core/build.gradle
@@ -161,7 +161,6 @@ springBoot {
// Frontend build tasks - only enabled with -PbuildWithFrontend=true
def buildWithFrontend = project.hasProperty('buildWithFrontend') && project.property('buildWithFrontend') == 'true'
-def buildPrototypes = project.hasProperty('prototypesMode') && project.property('prototypesMode') == 'true'
// The processor ships in every editor build by default; -PbuildWithPortal=false leaves it out.
// An explicit -PbuildWithPortal=true also forces the editor build.
def buildWithPortal = project.findProperty('buildWithPortal')?.toString() != 'false'
@@ -172,12 +171,10 @@ if (project.findProperty('buildWithPortal')?.toString() == 'true') {
// future portal). Editor-specific paths (src, public, dist, tauri) live one
// level deeper under frontend/editor/.
-// Vite mode: -PprototypesMode > -PfrontendMode > enableSaas > disableAdditional > proprietary.
+// Vite mode: -PfrontendMode > enableSaas > disableAdditional > proprietary.
def frontendModeOverride = project.findProperty('frontendMode')?.toString()?.toLowerCase()
def frontendMode
-if (buildPrototypes) {
- frontendMode = 'prototypes'
-} else if (frontendModeOverride) {
+if (frontendModeOverride) {
frontendMode = frontendModeOverride
} else if (gradle.ext.enableSaas) {
frontendMode = 'saas'
diff --git a/app/proprietary/src/main/java/stirling/software/proprietary/service/ToolKeyRegistry.java b/app/proprietary/src/main/java/stirling/software/proprietary/service/ToolKeyRegistry.java
index 68ee0abc1b..2e722aa7d3 100644
--- a/app/proprietary/src/main/java/stirling/software/proprietary/service/ToolKeyRegistry.java
+++ b/app/proprietary/src/main/java/stirling/software/proprietary/service/ToolKeyRegistry.java
@@ -11,8 +11,8 @@ import org.springframework.stereotype.Component;
* currentTool} would open its own cached aggregate over the stats table.
*
* <p>Hand-maintained mirror of {@code frontend/editor/src/core/types/toolId.ts} and the proprietary
- * and prototype overrides beside it. {@code ToolKeyRegistryTest} parses those files and fails when
- * the two drift, so adding a tool to the frontend fails the build until it is added here.
+ * override beside it. {@code ToolKeyRegistryTest} parses those files and fails when the two drift,
+ * so adding a tool to the frontend fails the build until it is added here.
*/
@Component
public class ToolKeyRegistry {
@@ -83,9 +83,8 @@ public class ToolKeyRegistry {
"devFolderScanning",
"devSsoGuide",
"devAirgapped",
- // Build-specific overrides: proprietary and prototype super tools
- "ai-workflow",
- "pdfCommentAgent");
+ // PROPRIETARY_SUPER_TOOL_IDS
+ "ai-workflow");
/** Longest key the set can hold, so storage can be sized from the data rather than a guess. */
public static final int MAX_KEY_LENGTH =
diff --git a/app/proprietary/src/test/java/stirling/software/proprietary/service/ToolKeyRegistryTest.java b/app/proprietary/src/test/java/stirling/software/proprietary/service/ToolKeyRegistryTest.java
index ccd7f7b42b..0ca16e5326 100644
--- a/app/proprietary/src/test/java/stirling/software/proprietary/service/ToolKeyRegistryTest.java
+++ b/app/proprietary/src/test/java/stirling/software/proprietary/service/ToolKeyRegistryTest.java
@@ -32,14 +32,13 @@ class ToolKeyRegistryTest {
private static final Pattern QUOTED = Pattern.compile("\"([^\"]+)\"");
/**
- * Every file that defines ids. The core file's proprietary and prototype imports resolve to
- * empty stubs; the build-specific overrides beside them are where those ids actually live.
+ * Every file that defines ids. The core file's proprietary import resolves to an empty stub;
+ * the proprietary override beside it is where those ids actually live.
*/
private static final List<String> SOURCES =
List.of(
"frontend/editor/src/core/types/toolId.ts",
- "frontend/editor/src/proprietary/types/proprietaryToolId.ts",
- "frontend/editor/src/prototypes/types/prototypeToolId.ts");
+ "frontend/editor/src/proprietary/types/proprietaryToolId.ts");
@Test
@DisplayName("the registry lists exactly the tool ids the frontend can send")
diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile
index 97ba49c1ec..dbf100fe1e 100644
--- a/docker/backend/Dockerfile
+++ b/docker/backend/Dockerfile
@@ -38,7 +38,6 @@ RUN gradle dependencies --no-daemon || true
COPY . .
-ARG PROTOTYPES_BUILD=false
ARG STIRLING_FLAVOR=proprietary
ENV STIRLING_FLAVOR=${STIRLING_FLAVOR}
@@ -50,7 +49,6 @@ RUN JPDFIUM_PLATFORM="$([ "$TARGETARCH" = arm64 ] && echo linux-arm64 || echo li
gradle clean build \
-PbuildWithFrontend=false \
-PjpdfiumPlatforms="$JPDFIUM_PLATFORM" \
- -PprototypesMode=${PROTOTYPES_BUILD} \
-PbundleOnnxRuntime=true \
-x spotlessApply -x spotlessCheck -x test -x sonarqube \
--no-daemon
diff --git a/docker/embedded/Dockerfile b/docker/embedded/Dockerfile
index 7dad8501b0..83abc570ff 100644
--- a/docker/embedded/Dockerfile
+++ b/docker/embedded/Dockerfile
@@ -55,7 +55,6 @@ RUN gradle dependencies --no-daemon || true
COPY . .
-ARG PROTOTYPES_BUILD=false
ARG STIRLING_FLAVOR=proprietary
ENV STIRLING_FLAVOR=${STIRLING_FLAVOR}
# Include the processor (admin portal) in the bundled editor; false leaves it out.
@@ -85,7 +84,6 @@ RUN JPDFIUM_PLATFORM="$([ "$TARGETARCH" = arm64 ] && echo linux-arm64 || echo li
-PbuildWithFrontend=true \
-PbuildWithPortal=${BUILD_PORTAL} \
-PjpdfiumPlatforms="$JPDFIUM_PLATFORM" \
- -PprototypesMode=${PROTOTYPES_BUILD} \
-PbundleOnnxRuntime=true \
-x spotlessApply -x spotlessCheck -x test -x sonarqube \
--no-daemon
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.toml
index 622ea08e4d..cde2d85876 100644
--- a/frontend/editor/public/locales/en-US/translation.toml
+++ b/frontend/editor/public/locales/en-US/translation.toml
@@ -3219,16 +3219,12 @@ text = "To make these permissions unchangeable, use the Add Password tool to set
[chat.actions]
copy = "Copy message"
-[chat.emptyState]
-text = "Ask a question about your documents or get help with PDF tools."
-
[chat.fab]
close = "Close chat"
open = "Open Stirling AI assistant"
[chat.header]
agentMenu = "Stirling agent options"
-assistant = "AI Assistant"
clearChat = "Clear chat"
[chat.input]
@@ -3279,11 +3275,6 @@ processing = "Processing ({{outcome}})..."
unsupported_capability = "Unsupported capability: {{capability}}"
usage_limit_reached = "You've reached your usage limit. Check your plan options to keep going."
-[chat.toolsUsed]
-summary_one = "Ran 1 tool"
-summary_other = "Ran {{count}} tools"
-unknownTool = "Unknown tool"
-
[classification.families]
correspondence = "Correspondence"
education = "Education"
@@ -5733,11 +5724,6 @@ desc = "Merge multiple pages of a PDF document into a single page"
tags = "layout,arrange,combine,N-up,2-up,4-up,multiple per page,pages per sheet,layout pages,tile,grid layout,multi-page layout,combine on page,handout"
title = "Multi-Page Layout"
-[home.pdfCommentAgent]
-desc = "Ask AI to annotate a PDF with sticky-note comments based on your prompt"
-tags = "AI,agent,comment,annotate,sticky note,review,feedback,notes"
-title = "Add AI comments"
-
[home.pdfOrganiser]
tags = "organize,rearrange,reorder,arrange pages,sort,move pages,delete pages,remove pages,page management,page organizer,resequence"
title = "Organize"
@@ -7151,24 +7137,6 @@ totalSeats_other = "Total ({{count}} seats)"
[payment.upgradeTeam]
title = "Upgrade to Team"
-[pdfCommentAgent]
-submit = "Generate comments"
-
-[pdfCommentAgent.error]
-emptyPrompt = "Please describe what the AI should comment on"
-failed = "Failed to generate comments"
-tooLong = "Prompt is too long (maximum {{max}} characters)"
-
-[pdfCommentAgent.prompt]
-label = "What should the AI comment on?"
-placeholder = "e.g. Flag any ambiguous dates and suggest clarifications"
-
-[pdfCommentAgent.results]
-title = "Commented PDF"
-
-[pdfCommentAgent.settings]
-title = "Comment instructions"
-
[pdfOrganiser]
placeholder = "(e.g. 1,3,2 or 4-8,2,10-12 or 2n-1)"
tags = "duplex,even,odd,sort,move"
diff --git a/frontend/editor/src/core/data/toolsTaxonomy.ts b/frontend/editor/src/core/data/toolsTaxonomy.ts
index 9f9e429623..94dba2fc60 100644
--- a/frontend/editor/src/core/data/toolsTaxonomy.ts
+++ b/frontend/editor/src/core/data/toolsTaxonomy.ts
@@ -16,7 +16,6 @@ import {
ToolKind,
} from "@app/types/toolId";
import { ProprietaryToolId } from "@app/types/proprietaryToolId";
-import { PrototypeToolId } from "@app/types/prototypeToolId";
export enum SubcategoryId {
AI = "ai",
@@ -82,7 +81,6 @@ export type ProprietaryToolRegistry = Record<
ProprietaryToolId,
ToolRegistryEntry
>;
-export type PrototypeToolRegistry = Record<PrototypeToolId, ToolRegistryEntry>;
export const SUBCATEGORY_ORDER: SubcategoryId[] = [
// First: AI steps are the ones a user is least likely to know exist.
diff --git a/frontend/editor/src/core/data/usePrototypeToolRegistry.tsx b/frontend/editor/src/core/data/usePrototypeToolRegistry.tsx
deleted file mode 100644
index b4da797a14..0000000000
--- a/frontend/editor/src/core/data/usePrototypeToolRegistry.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { useMemo } from "react";
-import { type PrototypeToolRegistry } from "@app/data/toolsTaxonomy";
-
-/**
- * Prototype tool registry extension.
- * This file is overridden in src/prototypes/data/usePrototypeToolRegistry.tsx
- * to add experimental tools that only ship in the prototypes build.
- *
- * No tools should be defined in this file.
- */
-
-// Empty hook that returns an empty registry (overridden in the prototypes overlay).
-export function usePrototypeToolRegistry(): PrototypeToolRegistry {
- return useMemo(() => ({}), []);
-}
diff --git a/frontend/editor/src/core/data/useTranslatedToolRegistry.tsx b/frontend/editor/src/core/data/useTranslatedToolRegistry.tsx
index dd5e258863..a42a881af4 100644
--- a/frontend/editor/src/core/data/useTranslatedToolRegistry.tsx
+++ b/frontend/editor/src/core/data/useTranslatedToolRegistry.tsx
@@ -43,7 +43,6 @@ import { bookletImpositionOperationConfig } from "@app/hooks/tools/bookletImposi
import { mergeOperationConfig } from "@app/hooks/tools/merge/useMergeOperation";
import { editTableOfContentsOperationConfig } from "@app/hooks/tools/editTableOfContents/useEditTableOfContentsOperation";
import { autoRenameOperationConfig } from "@app/hooks/tools/autoRename/useAutoRenameOperation";
-import { usePrototypeToolRegistry } from "@app/data/usePrototypeToolRegistry";
import { flattenOperationConfig } from "@app/hooks/tools/flatten/useFlattenOperation";
import { redactOperationConfig } from "@app/hooks/tools/redact/useRedactOperation";
import { rotateOperationConfig } from "@app/hooks/tools/rotate/useRotateOperation";
@@ -78,16 +77,11 @@ export interface TranslatedToolCatalog {
export function useTranslatedToolCatalog(): TranslatedToolCatalog {
const { t } = useTranslation();
const proprietaryTools = useProprietaryToolRegistry();
- const prototypeTools = usePrototypeToolRegistry();
return useMemo(() => {
const allTools: ToolRegistry = {
// Proprietary tools (if any)
...proprietaryTools,
- // Prototype-only tools (empty in the main/core/proprietary/saas/desktop
- // builds; the prototypes build overlay injects experimental tools here
- // via src/prototypes/data/usePrototypeToolRegistry.tsx).
- ...prototypeTools,
// Recommended Tools in order
pdfTextEditor: {
icon: <Icon name="square-pen" size="1.5rem" />,
@@ -1269,5 +1263,5 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog {
superTools,
linkTools,
};
- }, [t, proprietaryTools, prototypeTools]); // Re-compute when translations, proprietary, or prototype tools change
+ }, [t, proprietaryTools]);
}
diff --git a/frontend/editor/src/core/routes/portalBasename.ts b/frontend/editor/src/core/routes/portalBasename.ts
index 7648e6a760..8144bd91e0 100644
--- a/frontend/editor/src/core/routes/portalBasename.ts
+++ b/frontend/editor/src/core/routes/portalBasename.ts
@@ -2,7 +2,7 @@
* Base path where the admin portal route-set mounts inside the editor app
* (see adminRouteExtensions). Lives in core so any layer can reference the
* mount point without importing portal code — build flavors that ship no
- * portal (core, desktop, prototypes) must never resolve @portal.
+ * portal (core, desktop) must never resolve @portal.
*/
export const PORTAL_BASENAME = "/processor";
diff --git a/frontend/editor/src/core/types/prototypeToolId.ts b/frontend/editor/src/core/types/prototypeToolId.ts
deleted file mode 100644
index a1275b8ffc..0000000000
--- a/frontend/editor/src/core/types/prototypeToolId.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Prototype tool ID definitions.
- * This file is overridden in src/prototypes/types/prototypeToolId.ts
- * to add experimental tool IDs that only ship in the prototypes build.
- *
- * No tool IDs should be defined in this file.
- */
-
-export const PROTOTYPE_REGULAR_TOOL_IDS = [] as const;
-export const PROTOTYPE_SUPER_TOOL_IDS = [] as const;
-export const PROTOTYPE_LINK_TOOL_IDS = [] as const;
-
-export type PrototypeRegularToolId =
- (typeof PROTOTYPE_REGULAR_TOOL_IDS)[number];
-export type PrototypeSuperToolId = (typeof PROTOTYPE_SUPER_TOOL_IDS)[number];
-export type PrototypeLinkToolId = (typeof PROTOTYPE_LINK_TOOL_IDS)[number];
-export type PrototypeToolId =
- | PrototypeRegularToolId
- | PrototypeSuperToolId
- | PrototypeLinkToolId;
diff --git a/frontend/editor/src/core/types/toolId.ts b/frontend/editor/src/core/types/toolId.ts
index de647e2b6e..08b2ad4cbe 100644
--- a/frontend/editor/src/core/types/toolId.ts
+++ b/frontend/editor/src/core/types/toolId.ts
@@ -3,11 +3,6 @@ import {
PROPRIETARY_SUPER_TOOL_IDS,
PROPRIETARY_LINK_TOOL_IDS,
} from "@app/types/proprietaryToolId";
-import {
- PROTOTYPE_REGULAR_TOOL_IDS,
- PROTOTYPE_SUPER_TOOL_IDS,
- PROTOTYPE_LINK_TOOL_IDS,
-} from "@app/types/prototypeToolId";
export type ToolKind = "regular" | "super" | "link";
@@ -80,19 +75,16 @@ export const CORE_LINK_TOOL_IDS = [
export const REGULAR_TOOL_IDS = [
...CORE_REGULAR_TOOL_IDS,
...PROPRIETARY_REGULAR_TOOL_IDS,
- ...PROTOTYPE_REGULAR_TOOL_IDS,
] as const;
export const SUPER_TOOL_IDS = [
...CORE_SUPER_TOOL_IDS,
...PROPRIETARY_SUPER_TOOL_IDS,
- ...PROTOTYPE_SUPER_TOOL_IDS,
] as const;
export const LINK_TOOL_IDS = [
...CORE_LINK_TOOL_IDS,
...PROPRIETARY_LINK_TOOL_IDS,
- ...PROTOTYPE_LINK_TOOL_IDS,
] as const;
export const TOOL_IDS = [
diff --git a/frontend/editor/src/proprietary/utils/creditCosts.ts b/frontend/editor/src/proprietary/utils/creditCosts.ts
index d37f5cf12e..f10aa92f65 100644
--- a/frontend/editor/src/proprietary/utils/creditCosts.ts
+++ b/frontend/editor/src/proprietary/utils/creditCosts.ts
@@ -14,8 +14,7 @@ export const CREDIT_COSTS = {
* Based on backend ResourceWeight annotations.
*
* Typed as {@code Partial} so overlays can contribute per-build-only tool ids
- * (e.g. experimental tools in the prototypes build) without every overlay
- * needing to know every other overlay's ids. Unknown ids fall back to
+ * without every overlay needing to know every other overlay's ids. Unknown ids fall back to
* {@link CREDIT_COSTS.MEDIUM} in {@link getToolCreditCost}.
*/
export const TOOL_CREDIT_COSTS: Partial<Record<ToolId, number>> = {
diff --git a/frontend/editor/src/prototypes/App.tsx b/frontend/editor/src/prototypes/App.tsx
deleted file mode 100644
index 4f36bd1de8..0000000000
--- a/frontend/editor/src/prototypes/App.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import { Suspense } from "react";
-import { Routes, Route, Navigate, useParams } from "react-router-dom";
-import { AppProviders } from "@app/components/AppProviders";
-import { AppLayout } from "@app/components/AppLayout";
-import { LoadingFallback } from "@app/components/shared/LoadingFallback";
-import { PreferencesProvider } from "@app/contexts/PreferencesContext";
-import { ThemeProvider } from "@app/components/shared/ThemeProvider";
-import Landing from "@app/routes/Landing";
-import { RootGate } from "@app/routes/RootGate";
-import Login from "@app/routes/Login";
-import AuthCallback from "@app/routes/AuthCallback";
-import InviteAccept from "@app/routes/InviteAccept";
-import ShareLinkPage from "@app/routes/ShareLinkPage";
-import ParticipantView from "@app/components/workflow/ParticipantView";
-import Onboarding from "@app/components/onboarding/Onboarding";
-
-// Import global styles
-import "@app/styles/tailwind.css";
-import "@app/styles/cookieconsent.css";
-import "@app/styles/index.css";
-import "@app/auth/ui/auth-theme.css";
-
-// Import file ID debugging helpers (development only)
-import "@app/utils/fileIdSafety";
-
-// Minimal providers for public routes - no API calls, no authentication
-function MinimalProviders({ children }: { children: React.ReactNode }) {
- return (
- <PreferencesProvider>
- <ThemeProvider>{children}</ThemeProvider>
- </PreferencesProvider>
- );
-}
-
-// Participant signing page — token-gated, no login required
-function ParticipantViewPage() {
- const { token } = useParams<{ token: string }>();
- if (!token) return null;
- return <ParticipantView token={token} />;
-}
-
-export default function App() {
- return (
- <Suspense fallback={<LoadingFallback />}>
- <Routes>
- {/* Participant signing — public, token-gated, no auth required */}
- <Route
- path="/workflow/sign/:token"
- element={
- <MinimalProviders>
- <ParticipantViewPage />
- </MinimalProviders>
- }
- />
-
- {/* All other routes need AppProviders for backend integration.
- RootGate makes "/" route by role BEFORE any of it mounts. */}
- <Route
- path="*"
- element={
- <RootGate>
- <AppProviders>
- <AppLayout>
- <Routes>
- <Route path="/login" element={<Login />} />
- {/* Self-hosted has no signup - accounts are created by an
- admin. Old links land on login instead. */}
- <Route
- path="/signup"
- element={<Navigate to="/login" replace />}
- />
- <Route path="/auth/callback" element={<AuthCallback />} />
- <Route path="/invite/:token" element={<InviteAccept />} />
- <Route path="/share/:token" element={<ShareLinkPage />} />
- {/* Main app routes - Landing handles auth logic */}
- <Route path="/*" element={<Landing />} />
- </Routes>
- <Onboarding />
- </AppLayout>
- </AppProviders>
- </RootGate>
- }
- />
- </Routes>
- </Suspense>
- );
-}
diff --git a/frontend/editor/src/prototypes/LICENSE b/frontend/editor/src/prototypes/LICENSE
deleted file mode 100644
index d268556808..0000000000
--- a/frontend/editor/src/prototypes/LICENSE
+++ /dev/null
@@ -1,51 +0,0 @@
-Stirling PDF User License
-
-Copyright (c) 2025 Stirling PDF Inc.
-
-License Scope & Usage Rights
-
-Production use of the Stirling PDF Software is only permitted with a valid Stirling PDF User License.
-
-For purposes of this license, “the Software” refers to the Stirling PDF application and any associated documentation files
-provided by Stirling PDF Inc. You or your organization may not use the Software in production, at scale, or for business-critical
-processes unless you have agreed to, and remain in compliance with, the Stirling PDF Subscription Terms of Service
-(https://www.stirlingpdf.com/terms) or another valid agreement with Stirling PDF, and hold an active User License subscription
-covering the appropriate number of licensed users.
-
-Trial and Minimal Use
-
-You may use the Software without a paid subscription for the sole purposes of internal trial, evaluation, or minimal use, provided that:
-* Use is limited to the capabilities and restrictions defined by the Software itself;
-* You do not copy, distribute, sublicense, reverse-engineer, or use the Software in client-facing or commercial contexts.
-
-Continued use beyond this scope requires a valid Stirling PDF User License.
-
-Modifications and Derivative Works
-
-You may modify the Software only for development or internal testing purposes. Any such modifications or derivative works:
-
-* May not be deployed in production environments without a valid User License;
-* May not be distributed or sublicensed;
-* Remain the intellectual property of Stirling PDF and/or its licensors;
-* May only be used, copied, or exploited in accordance with the terms of a valid Stirling PDF User License subscription.
-
-Prohibited Actions
-
-Unless explicitly permitted by a paid license or separate agreement, you may not:
-
-* Use the Software in production environments;
-* Copy, merge, distribute, sublicense, or sell the Software;
-* Remove or alter any licensing or copyright notices;
-* Circumvent access restrictions or licensing requirements.
-
-Third-Party Components
-
-The Stirling PDF Software may include components subject to separate open source licenses. Such components remain governed by
-their original license terms as provided by their respective owners.
-
-Disclaimer
-
-THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/frontend/editor/src/prototypes/components/AccountLinkNotice.tsx b/frontend/editor/src/prototypes/components/AccountLinkNotice.tsx
deleted file mode 100644
index 6a653f968c..0000000000
--- a/frontend/editor/src/prototypes/components/AccountLinkNotice.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-/** The prototypes sandbox has no portal or account-link flow. */
-export function AccountLinkNotice() {
- return null;
-}
diff --git a/frontend/editor/src/prototypes/components/chat/ChatContext.tsx b/frontend/editor/src/prototypes/components/chat/ChatContext.tsx
deleted file mode 100644
index 2f2f5ca095..0000000000
--- a/frontend/editor/src/prototypes/components/chat/ChatContext.tsx
+++ /dev/null
@@ -1,591 +0,0 @@
-import {
- createContext,
- useContext,
- useReducer,
- useCallback,
- useRef,
- type ReactNode,
-} from "react";
-import { useAllFiles, useFileActions } from "@app/contexts/FileContext";
-import { generateId } from "@app/utils/generateId";
-import apiClient from "@app/services/apiClient";
-import { getAiBaseUrl } from "@app/services/aiBaseUrl";
-import { getAuthHeaders } from "@app/services/apiClientSetup";
-import { createChildStub } from "@app/contexts/file/fileActions";
-import {
- createNewStirlingFileStub,
- createStirlingFile,
- type StirlingFileStub,
-} from "@app/types/fileContext";
-import type { ToolOperation } from "@app/types/file";
-
-export interface ChatMessage {
- id: string;
- role: "user" | "assistant";
- content: string;
- timestamp: number;
- /**
- * Tool endpoint paths executed during this assistant turn (e.g.
- * {@code /api/v1/general/rotate-pdf}). Populated for assistant messages when the workflow
- * ran one or more tools, in execution order. Undefined for user messages and for assistant
- * turns that answered without running any tool.
- */
- toolsUsed?: string[];
-}
-
-export enum AiWorkflowPhase {
- ANALYZING = "analyzing",
- CALLING_ENGINE = "calling_engine",
- EXTRACTING_CONTENT = "extracting_content",
- EXECUTING_TOOL = "executing_tool",
- PROCESSING = "processing",
- ENGINE_PROGRESS = "engine_progress",
-}
-
-/**
- * Engine-side progress detail for ENGINE_PROGRESS events. Mirrors the Python
- * {@code ProgressEvent} discriminated union (engine/src/stirling/contracts/progress.py)
- * and the Java {@code AiEngineProgressDetail} sealed interface; the {@code phase}
- * string is the discriminator. Field names are camelCase because the engine
- * serialises by alias.
- */
-export interface WholeDocReadStartedDetail {
- phase: "whole_doc_read_started";
- question: string;
- pages: number;
- slices: number;
-}
-
-export interface WholeDocSliceDoneDetail {
- phase: "whole_doc_slice_done";
- completed: number;
- total: number;
- /** Page-range label, e.g. "pages=1-5". */
- pages: string;
- durationMs: number;
- excerpts: number;
- facts: number;
-}
-
-export interface WholeDocCompressionRoundDetail {
- phase: "whole_doc_compression_round";
- roundNumber: number;
- notesIn: number;
- groups: number;
-}
-
-export interface WholeDocReadDoneDetail {
- phase: "whole_doc_read_done";
- completed: number;
- slices: number;
- durationSeconds: number;
-}
-
-export type EngineProgressDetail =
- | WholeDocReadStartedDetail
- | WholeDocSliceDoneDetail
- | WholeDocCompressionRoundDetail
- | WholeDocReadDoneDetail;
-
-/**
- * What we actually carry across the wire boundary: a known typed variant, or a
- * forward-compat shape with just the discriminator string. The "unknown" arm
- * exists so a new engine-side phase rolling out before a frontend update keeps
- * rendering the generic processing message instead of crashing the union.
- */
-export interface UnknownEngineProgressDetail {
- phase: string;
-}
-
-export type AnyEngineProgressDetail =
- | EngineProgressDetail
- | UnknownEngineProgressDetail;
-
-const KNOWN_ENGINE_PHASES = new Set<string>([
- "whole_doc_read_started",
- "whole_doc_slice_done",
- "whole_doc_compression_round",
- "whole_doc_read_done",
-]);
-
-export function isKnownEngineProgressDetail(
- detail: AnyEngineProgressDetail,
-): detail is EngineProgressDetail {
- return KNOWN_ENGINE_PHASES.has(detail.phase);
-}
-
-export interface AiWorkflowProgress {
- phase: AiWorkflowPhase;
- /** Tool endpoint path currently executing, for EXECUTING_TOOL events. */
- tool?: string;
- /** 1-based step index, for EXECUTING_TOOL events. */
- stepIndex?: number;
- /** Total number of plan steps, for EXECUTING_TOOL events. */
- stepCount?: number;
- /**
- * Engine-side event payload, for ENGINE_PROGRESS events. Typed sub-phase
- * record (e.g. {@link WholeDocSliceDoneDetail}) the UI can render in detail.
- */
- engineDetail?: AnyEngineProgressDetail;
-}
-
-type AiWorkflowOutcome =
- | "answer"
- | "not_found"
- | "need_content"
- | "plan"
- | "need_clarification"
- | "cannot_do"
- | "tool_call"
- | "completed"
- | "unsupported_capability"
- | "cannot_continue";
-
-interface AiWorkflowResultFile {
- /** Stirling file ID — download with /api/v1/general/files/{fileId}. */
- fileId: string;
- fileName: string;
- contentType: string;
-}
-
-interface AiWorkflowResponse {
- outcome: AiWorkflowOutcome;
- answer?: string;
- summary?: string;
- rationale?: string;
- reason?: string;
- question?: string;
- capability?: string;
- message?: string;
- evidence?: Array<{ pageNumber: number; text: string }>;
- steps?: Array<Record<string, unknown>>;
- /** Every file produced by the workflow (empty if the outcome has no files). */
- resultFiles?: AiWorkflowResultFile[];
- // Legacy single-file fields — mirror the first entry of resultFiles.
- fileId?: string;
- fileName?: string;
- contentType?: string;
-}
-
-interface ChatState {
- messages: ChatMessage[];
- isOpen: boolean;
- isLoading: boolean;
- progress: AiWorkflowProgress | null;
-}
-
-type ChatAction =
- | { type: "ADD_MESSAGE"; message: ChatMessage }
- | { type: "SET_LOADING"; loading: boolean }
- | { type: "SET_PROGRESS"; progress: AiWorkflowProgress | null }
- | { type: "TOGGLE_OPEN" }
- | { type: "SET_OPEN"; open: boolean };
-
-function chatReducer(state: ChatState, action: ChatAction): ChatState {
- switch (action.type) {
- case "ADD_MESSAGE":
- return { ...state, messages: [...state.messages, action.message] };
- case "SET_LOADING":
- return { ...state, isLoading: action.loading };
- case "SET_PROGRESS":
- return { ...state, progress: action.progress };
- case "TOGGLE_OPEN":
- return { ...state, isOpen: !state.isOpen };
- case "SET_OPEN":
- return { ...state, isOpen: action.open };
- }
-}
-
-function formatWorkflowResponse(data: AiWorkflowResponse): string {
- switch (data.outcome) {
- case "answer":
- case "completed":
- return data.answer ?? data.summary ?? "Done.";
- case "need_clarification":
- return data.question ?? "Could you clarify your request?";
- case "cannot_do":
- return data.reason ?? "I'm unable to do that.";
- case "not_found":
- return data.reason ?? "I couldn't find the requested information.";
- case "unsupported_capability":
- return (
- data.message ??
- `Unsupported capability: ${data.capability ?? "unknown"}`
- );
- case "cannot_continue":
- return data.reason ?? "Something went wrong and I can't continue.";
- case "plan":
- return data.rationale
- ? `${data.rationale}\n\n${(data.steps ?? []).map((s, i) => `${i + 1}. ${JSON.stringify(s)}`).join("\n")}`
- : JSON.stringify(data.steps, null, 2);
- case "need_content":
- case "tool_call":
- return (
- data.rationale ?? data.summary ?? `Processing (${data.outcome})...`
- );
- default:
- return (
- data.answer ?? data.summary ?? data.message ?? JSON.stringify(data)
- );
- }
-}
-
-/**
- * Parses an SSE text stream and invokes callbacks for each named event.
- */
-interface ProgressEvent {
- phase: string;
- timestamp: number;
- tool?: string;
- stepIndex?: number;
- stepCount?: number;
- engineDetail?: AnyEngineProgressDetail;
-}
-
-async function consumeSSEStream(
- response: Response,
- handlers: {
- onProgress: (data: ProgressEvent) => void;
- onResult: (data: AiWorkflowResponse) => void;
- onError: (data: { message: string }) => void;
- },
-) {
- const reader = response.body!.getReader();
- const decoder = new TextDecoder();
- let buffer = "";
- let currentEvent = "";
-
- for (;;) {
- const { done, value } = await reader.read();
- if (done) break;
- buffer += decoder.decode(value, { stream: true });
-
- // SSE frames are separated by double newlines
- let boundary = buffer.indexOf("\n\n");
- while (boundary !== -1) {
- const frame = buffer.slice(0, boundary);
- buffer = buffer.slice(boundary + 2);
-
- let dataPayload = "";
- for (const line of frame.split("\n")) {
- if (line.startsWith("event:")) {
- currentEvent = line.slice(6).trim();
- } else if (line.startsWith("data:")) {
- dataPayload += line.slice(5);
- }
- }
-
- if (dataPayload) {
- try {
- const parsed = JSON.parse(dataPayload);
- if (currentEvent === "progress") {
- handlers.onProgress(parsed);
- } else if (currentEvent === "result") {
- handlers.onResult(parsed);
- } else if (currentEvent === "error") {
- handlers.onError(parsed);
- }
- } catch {
- // Skip malformed JSON frames
- }
- }
- currentEvent = "";
- boundary = buffer.indexOf("\n\n");
- }
- }
-}
-
-interface ChatContextValue {
- messages: ChatMessage[];
- isOpen: boolean;
- isLoading: boolean;
- progress: AiWorkflowProgress | null;
- toggleOpen: () => void;
- setOpen: (open: boolean) => void;
- sendMessage: (content: string) => Promise<void>;
- cancelMessage: () => void;
-}
-
-const ChatContext = createContext<ChatContextValue | null>(null);
-
-const initialState: ChatState = {
- messages: [],
- isOpen: false,
- isLoading: false,
- progress: null,
-};
-
-export function ChatProvider({ children }: { children: ReactNode }) {
- const [state, dispatch] = useReducer(chatReducer, initialState);
- const { files: activeFiles, fileStubs: activeFileStubs } = useAllFiles();
- const { actions: fileActions } = useFileActions();
- const abortRef = useRef<AbortController | null>(null);
- // Tracks the specific controller the user explicitly cancelled, so we can
- // distinguish a user-initiated cancel from an abort triggered by a new
- // message superseding the in-flight one.
- const userCancelledRef = useRef<AbortController | null>(null);
- const messagesRef = useRef<ChatMessage[]>(state.messages);
- messagesRef.current = state.messages;
-
- // Download a File from the Stirling files endpoint.
- const downloadFile = useCallback(
- async (descriptor: AiWorkflowResultFile): Promise<File> => {
- const response = await apiClient.get<Blob>(
- `/api/v1/general/files/${descriptor.fileId}`,
- { responseType: "blob" },
- );
- return new File([response.data], descriptor.fileName, {
- type: descriptor.contentType ?? response.data.type,
- });
- },
- [],
- );
-
- // Import the files produced by an AI workflow result into FileContext.
- //
- // If the workflow produced the same number of outputs as inputs, map each output to its
- // corresponding input as a new version in the same chain. Otherwise (merge, split, etc.)
- // add the outputs as new root files.
- const importResultFile = useCallback(
- async (
- result: AiWorkflowResponse,
- sourceStubs: StirlingFileStub[],
- ): Promise<void> => {
- const descriptors = result.resultFiles?.length
- ? result.resultFiles
- : result.fileId && result.fileName && result.contentType
- ? [
- {
- fileId: result.fileId,
- fileName: result.fileName,
- contentType: result.contentType,
- } satisfies AiWorkflowResultFile,
- ]
- : [];
- if (descriptors.length === 0) return;
-
- const files = await Promise.all(descriptors.map(downloadFile));
-
- if (sourceStubs.length > 0) {
- // Always consume the inputs so merge/split inputs are removed from the workbench.
- // For 1:1 operations (rotate, compress) the outputs carry the version chain; for
- // merge/split they're fresh roots.
- const operation: ToolOperation = {
- toolId: "ai-workflow",
- timestamp: Date.now(),
- };
- const isVersionMapping = files.length === sourceStubs.length;
- const stubs = files.map((file, i) =>
- isVersionMapping
- ? createChildStub(sourceStubs[i], operation, file)
- : createNewStirlingFileStub(file),
- );
- const stirlingFiles = files.map((file, i) =>
- createStirlingFile(file, stubs[i].id),
- );
- await fileActions.consumeFiles(
- sourceStubs.map((s) => s.id),
- stirlingFiles,
- stubs,
- );
- } else {
- // No inputs: pass raw files so addFiles assigns consistent IDs. Pre-assigning stub IDs
- // here would cause a fileId mismatch in filesRef, making getFiles() clone the file
- // on every render and breaking useFileWithUrl's memoisation (continuous PDF reloads).
- await fileActions.addFiles(files, { selectFiles: true });
- }
- },
- [fileActions, downloadFile],
- );
-
- const toggleOpen = useCallback(() => dispatch({ type: "TOGGLE_OPEN" }), []);
- const setOpen = useCallback(
- (open: boolean) => dispatch({ type: "SET_OPEN", open }),
- [],
- );
-
- const cancelMessage = useCallback(() => {
- const controller = abortRef.current;
- if (!controller) return;
- userCancelledRef.current = controller;
- controller.abort();
- }, []);
-
- const sendMessage = useCallback(
- async (content: string) => {
- // Abort any in-flight request
- abortRef.current?.abort();
- const controller = new AbortController();
- abortRef.current = controller;
-
- const priorMessages = messagesRef.current;
-
- const userMessage: ChatMessage = {
- id: generateId(),
- role: "user",
- content,
- timestamp: Date.now(),
- };
- dispatch({ type: "ADD_MESSAGE", message: userMessage });
- dispatch({ type: "SET_LOADING", loading: true });
- dispatch({ type: "SET_PROGRESS", progress: null });
-
- try {
- const formData = new FormData();
- formData.append("userMessage", content);
- activeFiles.forEach((file, i) => {
- formData.append(`fileInputs[${i}].fileInput`, file);
- });
- priorMessages.forEach((message, i) => {
- formData.append(`conversationHistory[${i}].role`, message.role);
- formData.append(`conversationHistory[${i}].content`, message.content);
- });
-
- const response = await fetch(
- `${getAiBaseUrl()}/api/v1/ai/orchestrate/stream`,
- {
- method: "POST",
- body: formData,
- headers: await getAuthHeaders(),
- credentials: "include",
- signal: controller.signal,
- },
- );
-
- if (!response.ok) {
- throw new Error(`AI engine request failed: ${response.status}`);
- }
-
- let receivedResult = false;
- const toolsUsed: string[] = [];
-
- await consumeSSEStream(response, {
- onProgress: (data) => {
- if (
- data.phase === AiWorkflowPhase.EXECUTING_TOOL &&
- typeof data.tool === "string"
- ) {
- toolsUsed.push(data.tool);
- }
- dispatch({
- type: "SET_PROGRESS",
- progress: {
- phase: data.phase as AiWorkflowPhase,
- tool: data.tool,
- stepIndex: data.stepIndex,
- stepCount: data.stepCount,
- engineDetail: data.engineDetail,
- },
- });
- },
- onResult: (data) => {
- receivedResult = true;
- dispatch({ type: "SET_PROGRESS", progress: null });
- const replyContent = formatWorkflowResponse(data);
- dispatch({
- type: "ADD_MESSAGE",
- message: {
- id: generateId(),
- role: "assistant",
- content: replyContent,
- timestamp: Date.now(),
- toolsUsed: toolsUsed.length > 0 ? toolsUsed : undefined,
- },
- });
- if (data.fileId || data.resultFiles?.length) {
- importResultFile(data, activeFileStubs).catch((err) => {
- console.error("Failed to import AI result file", err);
- dispatch({
- type: "ADD_MESSAGE",
- message: {
- id: generateId(),
- role: "assistant",
- content:
- "The file was processed but I couldn't download it.",
- timestamp: Date.now(),
- },
- });
- });
- }
- },
- onError: (data) => {
- receivedResult = true;
- dispatch({ type: "SET_PROGRESS", progress: null });
- dispatch({
- type: "ADD_MESSAGE",
- message: {
- id: generateId(),
- role: "assistant",
- content: data.message || "Something went wrong.",
- timestamp: Date.now(),
- },
- });
- },
- });
-
- if (!receivedResult) {
- throw new Error("Stream ended without a result");
- }
- } catch (e) {
- if ((e as Error).name === "AbortError") {
- if (userCancelledRef.current === controller) {
- userCancelledRef.current = null;
- dispatch({ type: "SET_PROGRESS", progress: null });
- dispatch({
- type: "ADD_MESSAGE",
- message: {
- id: generateId(),
- role: "assistant",
- content: "Cancelled.",
- timestamp: Date.now(),
- },
- });
- }
- return;
- }
- dispatch({ type: "SET_PROGRESS", progress: null });
- dispatch({
- type: "ADD_MESSAGE",
- message: {
- id: generateId(),
- role: "assistant",
- content:
- "Failed to get a response. The AI engine may not be available yet.",
- timestamp: Date.now(),
- },
- });
- } finally {
- dispatch({ type: "SET_LOADING", loading: false });
- if (abortRef.current === controller) {
- abortRef.current = null;
- }
- }
- },
- [activeFiles, activeFileStubs, importResultFile],
- );
-
- return (
- <ChatContext.Provider
- value={{
- messages: state.messages,
- isOpen: state.isOpen,
- isLoading: state.isLoading,
- progress: state.progress,
- toggleOpen,
- setOpen,
- sendMessage,
- cancelMessage,
- }}
- >
- {children}
- </ChatContext.Provider>
- );
-}
-
-export function useChat(): ChatContextValue {
- const context = useContext(ChatContext);
- if (!context) {
- throw new Error("useChat must be used within a ChatProvider");
- }
- return context;
-}
diff --git a/frontend/editor/src/prototypes/components/chat/ChatPanel.tsx b/frontend/editor/src/prototypes/components/chat/ChatPanel.tsx
deleted file mode 100644
index 634315dc9d..0000000000
--- a/frontend/editor/src/prototypes/components/chat/ChatPanel.tsx
+++ /dev/null
@@ -1,373 +0,0 @@
-import {
- useMemo,
- useRef,
- useEffect,
- useState,
- type KeyboardEvent,
-} from "react";
-import { useTranslation } from "react-i18next";
-import {
- ActionIcon,
- ScrollArea,
- TextInput,
- Stack,
- Text,
- Paper,
- Box,
- Transition,
- Loader,
- Group,
- Collapse,
- UnstyledButton,
- List,
-} from "@mantine/core";
-import { Icon } from "@app/ui/Icon";
-import {
- useChat,
- AiWorkflowPhase,
- isKnownEngineProgressDetail,
- type AiWorkflowProgress,
- type AnyEngineProgressDetail,
-} from "@app/components/chat/ChatContext";
-import { useTranslatedToolCatalog } from "@app/data/useTranslatedToolRegistry";
-import "@app/components/chat/ChatPanel.css";
-
-type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
-
-/** Resolver mapping a tool endpoint path to its translated display name. */
-type ToolNameResolver = (endpoint: string) => string | null;
-
-/**
- * Look up a tool's translated name from the tool catalog. The catalog's {@code operationConfig}
- * exposes the full API endpoint path for each tool, so we key the lookup on the exact path that
- * arrives in SSE progress events — no string parsing.
- */
-function useToolNameResolver(): ToolNameResolver {
- const { allTools } = useTranslatedToolCatalog();
- return useMemo(() => {
- const nameByEndpoint = new Map<string, string>();
- Object.values(allTools).forEach((tool) => {
- const endpoint = tool.operationConfig?.endpoint;
- // Only register tools with a static endpoint. Tools whose endpoint is a function
- // (dynamic routing, e.g. Convert / Split) need runtime params to resolve, so they fall
- // through to the generic progress message rather than mis-matching.
- if (typeof endpoint === "string") {
- nameByEndpoint.set(endpoint, tool.name);
- }
- });
- return (endpoint: string) => nameByEndpoint.get(endpoint) ?? null;
- }, [allTools]);
-}
-
-function formatProgress(
- progress: AiWorkflowProgress,
- t: TranslateFn,
- resolveToolName: ToolNameResolver,
-): string {
- if (progress.phase === AiWorkflowPhase.EXECUTING_TOOL && progress.tool) {
- const tool = resolveToolName(progress.tool);
- const hasSteps =
- progress.stepIndex != null &&
- progress.stepCount != null &&
- progress.stepCount > 1;
- if (tool) {
- return hasSteps
- ? t("chat.progress.executing_tool_step", {
- tool,
- step: progress.stepIndex,
- total: progress.stepCount,
- })
- : t("chat.progress.executing_tool_single", { tool });
- }
- // Unknown tool — fall back to a generic translated message rather than
- // prettifying the endpoint path by hand.
- return hasSteps
- ? t("chat.progress.executing_tool_generic_step", {
- step: progress.stepIndex,
- total: progress.stepCount,
- })
- : t("chat.progress.executing_tool_generic");
- }
- if (progress.phase === AiWorkflowPhase.ENGINE_PROGRESS) {
- return formatEngineProgress(progress.engineDetail, t);
- }
- return t(`chat.progress.${progress.phase}`);
-}
-
-/**
- * Render an engine-side progress event (e.g. chunked-reasoner slice progress) into a user-facing
- * message. Falls through to the generic processing label for unknown sub-phases so adding new
- * engine events doesn't break the UI before the frontend learns about them.
- */
-function formatEngineProgress(
- detail: AnyEngineProgressDetail | undefined,
- t: TranslateFn,
-): string {
- if (!detail || !isKnownEngineProgressDetail(detail)) {
- return t("chat.progress.processing");
- }
- switch (detail.phase) {
- case "whole_doc_read_started":
- return t("chat.progress.whole_doc_read_started");
- case "whole_doc_slice_done": {
- const percent =
- detail.total > 0
- ? Math.round((detail.completed / detail.total) * 100)
- : 0;
- return t("chat.progress.whole_doc_slice_done", { percent });
- }
- case "whole_doc_compression_round":
- return t("chat.progress.whole_doc_compression_round");
- case "whole_doc_read_done":
- return t("chat.progress.whole_doc_read_done");
- }
-}
-
-function ToolsUsedBlock({
- tools,
- resolveToolName,
- t,
-}: {
- tools: string[];
- resolveToolName: ToolNameResolver;
- t: TranslateFn;
-}) {
- const [expanded, setExpanded] = useState(false);
- const names = tools.map(
- (endpoint) => resolveToolName(endpoint) ?? t("chat.toolsUsed.unknownTool"),
- );
- const label = t("chat.toolsUsed.summary", { count: tools.length });
- return (
- <Box mt={6}>
- <UnstyledButton
- onClick={() => setExpanded((v) => !v)}
- aria-expanded={expanded}
- >
- <Group gap={4} wrap="nowrap">
- {expanded ? (
- <Icon name="chevron-up" size={14} />
- ) : (
- <Icon name="chevron-down" size={14} />
- )}
- <Text size="xs" c="dimmed">
- {label}
- </Text>
- </Group>
- </UnstyledButton>
- <Collapse in={expanded}>
- <List
- type="ordered"
- size="xs"
- mt={4}
- pl="lg"
- styles={{ itemWrapper: { lineHeight: 1.4 } }}
- >
- {names.map((name, i) => (
- <List.Item key={i}>{name}</List.Item>
- ))}
- </List>
- </Collapse>
- </Box>
- );
-}
-
-function ChatMessageBubble({
- role,
- content,
- toolsUsed,
- resolveToolName,
- t,
-}: {
- role: "user" | "assistant";
- content: string;
- toolsUsed?: string[];
- resolveToolName: ToolNameResolver;
- t: TranslateFn;
-}) {
- return (
- <div className={`chat-message chat-message-${role}`}>
- <Paper className={`chat-bubble chat-bubble-${role}`} p="xs" radius="md">
- <Text size="sm" style={{ whiteSpace: "pre-wrap" }}>
- {content}
- </Text>
- {toolsUsed && toolsUsed.length > 0 && (
- <ToolsUsedBlock
- tools={toolsUsed}
- resolveToolName={resolveToolName}
- t={t}
- />
- )}
- </Paper>
- </div>
- );
-}
-
-export interface ChatPanelProps {
- onBack?: () => void;
- backLabel?: string;
-}
-
-export function ChatPanel(_props: ChatPanelProps = {}) {
- const { t } = useTranslation();
- const {
- messages,
- isOpen,
- isLoading,
- progress,
- toggleOpen,
- sendMessage,
- cancelMessage,
- } = useChat();
- const resolveToolName = useToolNameResolver();
- const [input, setInput] = useState("");
- const scrollRef = useRef<HTMLDivElement>(null);
- const inputRef = useRef<HTMLInputElement>(null);
-
- useEffect(() => {
- if (scrollRef.current) {
- scrollRef.current.scrollTo({
- top: scrollRef.current.scrollHeight,
- behavior: "smooth",
- });
- }
- }, [messages]);
-
- useEffect(() => {
- if (isOpen) {
- inputRef.current?.focus();
- }
- }, [isOpen]);
-
- const handleSend = () => {
- const trimmed = input.trim();
- if (!trimmed || isLoading) return;
- setInput("");
- sendMessage(trimmed);
- };
-
- const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault();
- handleSend();
- }
- };
-
- return (
- <>
- {/* Toggle button - always visible */}
- {!isOpen && (
- <ActionIcon
- className="chat-toggle-button"
- variant="filled"
- color="blue"
- size="xl"
- radius="xl"
- onClick={toggleOpen}
- aria-label="Open chat"
- >
- <Icon name="message-square" size={24} />
- </ActionIcon>
- )}
-
- {/* Chat panel */}
- <Transition mounted={isOpen} transition="slide-left" duration={200}>
- {(styles) => (
- <Box className="chat-panel" style={styles}>
- {/* Header */}
- <div className="chat-panel-header">
- <Text fw={600} size="sm">
- {t("chat.header.assistant")}
- </Text>
- <ActionIcon
- variant="subtle"
- size="sm"
- onClick={toggleOpen}
- aria-label="Close chat"
- >
- <Icon name="x" size={16} />
- </ActionIcon>
- </div>
-
- {/* Messages */}
- <ScrollArea className="chat-panel-messages" viewportRef={scrollRef}>
- <Stack gap="sm" p="sm">
- {messages.length === 0 && (
- <Text size="sm" c="dimmed" ta="center" py="xl">
- {t("chat.emptyState.text")}
- </Text>
- )}
- {messages.map((msg) => (
- <ChatMessageBubble
- key={msg.id}
- role={msg.role}
- content={msg.content}
- toolsUsed={msg.toolsUsed}
- resolveToolName={resolveToolName}
- t={t}
- />
- ))}
- {isLoading && (
- <div className="chat-message chat-message-assistant">
- <Paper
- className="chat-bubble chat-bubble-assistant"
- p="xs"
- radius="md"
- >
- <Group gap="xs" wrap="nowrap">
- <Loader size="xs" type="dots" />
- <Text size="sm" c="dimmed">
- {progress
- ? formatProgress(progress, t, resolveToolName)
- : t("chat.progress.thinking")}
- </Text>
- </Group>
- </Paper>
- </div>
- )}
- </Stack>
- </ScrollArea>
-
- {/* Input */}
- <div className="chat-panel-input">
- <TextInput
- ref={inputRef}
- placeholder={t("chat.input.placeholder")}
- value={input}
- onChange={(e) => setInput(e.currentTarget.value)}
- onKeyDown={handleKeyDown}
- disabled={isLoading}
- rightSection={
- isLoading ? (
- <ActionIcon
- variant="filled"
- color="red"
- size="sm"
- onClick={cancelMessage}
- aria-label="Stop generating"
- >
- <Icon name="square" size={14} />
- </ActionIcon>
- ) : (
- <ActionIcon
- variant="filled"
- color="blue"
- size="sm"
- onClick={handleSend}
- disabled={!input.trim()}
- aria-label="Send message"
- >
- <Icon name="send" size={14} />
- </ActionIcon>
- )
- }
- rightSectionPointerEvents="all"
- rightSectionWidth={36}
- style={{ flex: 1 }}
- />
- </div>
- </Box>
- )}
- </Transition>
- </>
- );
-}
diff --git a/frontend/editor/src/prototypes/components/docs/DocsPage.tsx b/frontend/editor/src/prototypes/components/docs/DocsPage.tsx
deleted file mode 100644
index 7df5c6d217..0000000000
--- a/frontend/editor/src/prototypes/components/docs/DocsPage.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * The prototypes sandbox has no @portal alias, so it must not resolve the
- * portal-authored docs view — shadow the seam back to the stub.
- */
-export { default } from "@core/components/docs/DocsPage";
diff --git a/frontend/editor/src/prototypes/components/policies/FolderPolicySetupConfig.tsx b/frontend/editor/src/prototypes/components/policies/FolderPolicySetupConfig.tsx
deleted file mode 100644
index 5b99a698b1..0000000000
--- a/frontend/editor/src/prototypes/components/policies/FolderPolicySetupConfig.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { FolderIngestionSettings as FolderPolicySetupConfig } from "@app/components/policies/FolderIngestionSettings";
diff --git a/frontend/editor/src/prototypes/components/settings/useSettingsNav.tsx b/frontend/editor/src/prototypes/components/settings/useSettingsNav.tsx
deleted file mode 100644
index 9c4386f601..0000000000
--- a/frontend/editor/src/prototypes/components/settings/useSettingsNav.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * The prototypes sandbox has no @portal alias, so it must not resolve the
- * processor's settings sections — shadow the seam back to the core sections.
- */
-export { useSettingsNav } from "@core/components/settings/useSettingsNav";
-export type { SettingsNav } from "@app/components/settings/settingsNavTypes";
diff --git a/frontend/editor/src/prototypes/data/processorEntitySearch.ts b/frontend/editor/src/prototypes/data/processorEntitySearch.ts
deleted file mode 100644
index 2a3187ac5f..0000000000
--- a/frontend/editor/src/prototypes/data/processorEntitySearch.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Prototypes builds ship no portal (and have no @portal alias) — shadow the
- * entity search back to core's empty stub so the super search never resolves
- * the proprietary implementation's portal imports here.
- */
-export { useProcessorEntityGroups } from "@core/data/processorEntitySearch";
diff --git a/frontend/editor/src/prototypes/data/processorSearchIndex.ts b/frontend/editor/src/prototypes/data/processorSearchIndex.ts
deleted file mode 100644
index 8b09a79f29..0000000000
--- a/frontend/editor/src/prototypes/data/processorSearchIndex.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Prototypes builds ship no portal (and have no @portal alias) — shadow the
- * index back to core's empty list so the super search never resolves the
- * proprietary version's portal-flavored imports here.
- */
-export type { ProcessorSearchEntry } from "@core/data/processorSearchIndex";
-export {
- PROCESSOR_SEARCH_INDEX,
- isPortalEntityScopeAccessible,
-} from "@core/data/processorSearchIndex";
diff --git a/frontend/editor/src/prototypes/data/usePrototypeToolRegistry.tsx b/frontend/editor/src/prototypes/data/usePrototypeToolRegistry.tsx
deleted file mode 100644
index c650eb67fc..0000000000
--- a/frontend/editor/src/prototypes/data/usePrototypeToolRegistry.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { useMemo } from "react";
-import { useTranslation } from "react-i18next";
-
-import { Icon } from "@app/ui/Icon";
-import {
- SubcategoryId,
- ToolCategoryId,
- type PrototypeToolRegistry,
-} from "@app/data/toolsTaxonomy";
-import { pdfCommentAgentOperationConfig } from "@app/hooks/tools/pdfCommentAgent/pdfCommentAgentOperationConfig";
-import { asRegistryConfig } from "@app/hooks/tools/shared/toolOperationTypes";
-import PdfCommentAgent from "@app/tools/PdfCommentAgent";
-import { getSynonyms } from "@app/utils/toolSynonyms";
-
-/**
- * Prototype tool registry extension — real implementation.
- *
- * Overrides the empty stub at {@code core/data/usePrototypeToolRegistry.tsx}
- * when the build resolves {@code @app/*} through {@code src/prototypes/*}.
- * Experimental AI tools live here until they graduate to core / proprietary.
- */
-export function usePrototypeToolRegistry(): PrototypeToolRegistry {
- const { t } = useTranslation();
-
- return useMemo(
- () =>
- ({
- pdfCommentAgent: {
- icon: <Icon name="message-square-plus" size="1.5rem" />,
- name: t("home.pdfCommentAgent.title", "Add AI comments"),
- component: PdfCommentAgent,
- description: t(
- "home.pdfCommentAgent.desc",
- "Ask AI to annotate a PDF with sticky-note comments based on your prompt",
- ),
- categoryId: ToolCategoryId.ADVANCED_TOOLS,
- subcategoryId: SubcategoryId.DOCUMENT_REVIEW,
- maxFiles: 1,
- endpoints: ["pdf-comment-agent"],
- operationConfig: asRegistryConfig(pdfCommentAgentOperationConfig),
- automationSettings: null,
- synonyms: getSynonyms(t, "pdfCommentAgent"),
- versionStatus: "beta",
- },
- }) as PrototypeToolRegistry,
- [t],
- );
-}
diff --git a/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/pdfCommentAgentOperationConfig.ts b/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/pdfCommentAgentOperationConfig.ts
deleted file mode 100644
index 8994ee9df1..0000000000
--- a/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/pdfCommentAgentOperationConfig.ts
+++ /dev/null
@@ -1,112 +0,0 @@
-import apiClient from "@app/services/apiClient";
-import {
- defineCustomTool,
- CustomProcessorResult,
-} from "@app/hooks/tools/shared/toolOperationTypes";
-import {
- PdfCommentAgentParameters,
- defaultParameters,
-} from "@app/hooks/tools/pdfCommentAgent/usePdfCommentAgentParameters";
-
-export const PDF_COMMENT_AGENT_ENDPOINT = "/api/v1/ai/tools/pdf-comment-agent";
-
-/** Build the multipart payload Java expects: fileInput + prompt. */
-export const buildPdfCommentAgentFormData = (
- parameters: PdfCommentAgentParameters,
- file: File,
-): FormData => {
- const formData = new FormData();
- formData.append("fileInput", file);
- formData.append("prompt", parameters.prompt);
- return formData;
-};
-
-/**
- * Reject filenames that are blank or contain path separators. The server is
- * trusted to supply a sensible value, but guarding here means a hostile or
- * buggy backend cannot convince the browser save-dialog to steer the download
- * into a parent directory.
- */
-const sanitiseFilename = (raw: string): string | null => {
- const trimmed = raw.trim();
- if (!trimmed) return null;
- if (/[\\/]/.test(trimmed)) return null;
- return trimmed;
-};
-
-/**
- * Extract the filename from a Content-Disposition header, falling back to a
- * sensible default based on the input file name. Handles both the quoted and
- * RFC 5987 (``filename*=UTF-8''encoded``) forms.
- */
-const filenameFromContentDisposition = (
- header: string | undefined,
- inputName: string,
-): string => {
- const fallback = inputName.replace(/\.pdf$/i, "") + "-commented.pdf";
- if (!header) return fallback;
-
- // RFC 5987: filename*=UTF-8''encoded
- const extended = /filename\*=[^']*''([^;]+)/i.exec(header);
- if (extended?.[1]) {
- try {
- const decoded = sanitiseFilename(decodeURIComponent(extended[1]));
- if (decoded) return decoded;
- } catch {
- // fall through to plain form
- }
- }
-
- // Plain: filename="..." or filename=...
- const plain = /filename="?([^";]+)"?/i.exec(header);
- if (plain?.[1]) {
- const sanitised = sanitiseFilename(plain[1]);
- if (sanitised) return sanitised;
- }
- return fallback;
-};
-
-/**
- * Custom processor: POST the PDF + prompt to the Java AI endpoint, which streams
- * the annotated PDF back. Wrap the response Blob as a File so the standard
- * review panel (embedPDF viewer) renders it with the sticky-note annotations.
- */
-const processPdfCommentAgent = async (
- parameters: PdfCommentAgentParameters,
- files: File[],
-): Promise<CustomProcessorResult> => {
- if (files.length === 0) {
- return { files: [] };
- }
-
- const [inputFile] = files;
- const formData = buildPdfCommentAgentFormData(parameters, inputFile);
-
- const response = await apiClient.post<Blob>(
- PDF_COMMENT_AGENT_ENDPOINT,
- formData,
- { responseType: "blob" },
- );
-
- const dispositionHeader =
- (response.headers as Record<string, string | undefined>)[
- "content-disposition"
- ] ?? undefined;
- const fileName = filenameFromContentDisposition(
- dispositionHeader,
- inputFile.name,
- );
-
- const resultFile = new File([response.data], fileName, {
- type: response.data.type || "application/pdf",
- });
- return { files: [resultFile] };
-};
-
-export const pdfCommentAgentOperationConfig =
- defineCustomTool<PdfCommentAgentParameters>({
- operationType: "pdfCommentAgent",
- endpoint: PDF_COMMENT_AGENT_ENDPOINT,
- customProcessor: processPdfCommentAgent,
- defaultParameters,
- });
diff --git a/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/usePdfCommentAgentOperation.ts b/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/usePdfCommentAgentOperation.ts
deleted file mode 100644
index b8c537a3bb..0000000000
--- a/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/usePdfCommentAgentOperation.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { useTranslation } from "react-i18next";
-import { useToolOperation } from "@app/hooks/tools/shared/useToolOperation";
-import { createStandardErrorHandler } from "@app/utils/toolErrorHandler";
-import { pdfCommentAgentOperationConfig } from "@app/hooks/tools/pdfCommentAgent/pdfCommentAgentOperationConfig";
-
-export const usePdfCommentAgentOperation = () => {
- const { t } = useTranslation();
-
- return useToolOperation({
- ...pdfCommentAgentOperationConfig,
- getErrorMessage: createStandardErrorHandler(
- t("pdfCommentAgent.error.failed", "Failed to generate comments"),
- ),
- });
-};
diff --git a/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/usePdfCommentAgentParameters.ts b/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/usePdfCommentAgentParameters.ts
deleted file mode 100644
index 8366d0055e..0000000000
--- a/frontend/editor/src/prototypes/hooks/tools/pdfCommentAgent/usePdfCommentAgentParameters.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { BaseParameters } from "@app/types/parameters";
-import {
- useBaseParameters,
- BaseParametersHook,
-} from "@app/hooks/tools/shared/useBaseParameters";
-
-export interface PdfCommentAgentParameters extends BaseParameters {
- /** Natural-language instructions for what the AI should comment on. */
- prompt: string;
-}
-
-export const MAX_PROMPT_LENGTH = 4000;
-
-export const defaultParameters: PdfCommentAgentParameters = {
- prompt: "",
-};
-
-export type PdfCommentAgentParametersHook =
- BaseParametersHook<PdfCommentAgentParameters>;
-
-export const usePdfCommentAgentParameters =
- (): PdfCommentAgentParametersHook => {
- return useBaseParameters({
- defaultParameters,
- endpointName: "pdf-comment-agent",
- validateFn: (params) => {
- const trimmed = params.prompt.trim();
- return trimmed.length > 0 && params.prompt.length <= MAX_PROMPT_LENGTH;
- },
- });
- };
diff --git a/frontend/editor/src/prototypes/routes/docsRoute.ts b/frontend/editor/src/prototypes/routes/docsRoute.ts
deleted file mode 100644
index 3fb5587298..0000000000
--- a/frontend/editor/src/prototypes/routes/docsRoute.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-/** The prototypes sandbox ships no docs manifest. */
-export { DOCS_PATH, HAS_DOCS } from "@core/routes/docsRoute";
diff --git a/frontend/editor/src/prototypes/tools/PdfCommentAgent.tsx b/frontend/editor/src/prototypes/tools/PdfCommentAgent.tsx
deleted file mode 100644
index 0a1b37c7c0..0000000000
--- a/frontend/editor/src/prototypes/tools/PdfCommentAgent.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-import type { ChangeEvent } from "react";
-import { useCallback } from "react";
-import { useTranslation } from "react-i18next";
-import { Stack, Textarea } from "@mantine/core";
-import { createToolFlow } from "@app/components/tools/shared/createToolFlow";
-import { useBaseTool } from "@app/hooks/tools/shared/useBaseTool";
-import type { BaseToolProps } from "@app/types/tool";
-
-import {
- MAX_PROMPT_LENGTH,
- usePdfCommentAgentParameters,
-} from "@app/hooks/tools/pdfCommentAgent/usePdfCommentAgentParameters";
-import { usePdfCommentAgentOperation } from "@app/hooks/tools/pdfCommentAgent/usePdfCommentAgentOperation";
-
-const PdfCommentAgent = (props: BaseToolProps) => {
- const { t } = useTranslation();
-
- const base = useBaseTool(
- "pdf-comment-agent",
- usePdfCommentAgentParameters,
- usePdfCommentAgentOperation,
- props,
- );
-
- const handlePromptChange = useCallback(
- (event: ChangeEvent<HTMLTextAreaElement>) => {
- base.params.updateParameter("prompt", event.currentTarget.value);
- },
- [base.params],
- );
-
- // Inline validation error shown under the Textarea. Only rendered once the
- // user has typed something (or over-typed) — we don't want to yell about an
- // empty field that the user hasn't interacted with yet.
- const prompt = base.params.parameters.prompt;
- const trimmedLength = prompt.trim().length;
- let promptError: string | null = null;
- if (prompt.length > MAX_PROMPT_LENGTH) {
- promptError = t("pdfCommentAgent.error.tooLong", {
- max: MAX_PROMPT_LENGTH,
- defaultValue: `Prompt is too long (maximum ${MAX_PROMPT_LENGTH} characters)`,
- });
- } else if (prompt.length > 0 && trimmedLength === 0) {
- // User typed only whitespace — treat as empty with the empty-prompt message.
- promptError = t(
- "pdfCommentAgent.error.emptyPrompt",
- "Please describe what the AI should comment on",
- );
- }
-
- return createToolFlow({
- files: {
- selectedFiles: base.selectedFiles,
- isCollapsed: base.hasResults,
- },
- steps: [
- {
- title: t("pdfCommentAgent.settings.title", "Comment instructions"),
- isCollapsed: false,
- content: (
- <Stack gap="sm">
- <Textarea
- label={t(
- "pdfCommentAgent.prompt.label",
- "What should the AI comment on?",
- )}
- placeholder={t(
- "pdfCommentAgent.prompt.placeholder",
- "e.g. Flag any ambiguous dates and suggest clarifications",
- )}
- value={prompt}
- onChange={handlePromptChange}
- minRows={4}
- autosize
- maxLength={MAX_PROMPT_LENGTH}
- error={promptError}
- />
- </Stack>
- ),
- },
- ],
- executeButton: {
- text: t("pdfCommentAgent.submit", "Generate comments"),
- isVisible: !base.hasResults,
- loadingText: t("loading"),
- onClick: base.handleExecute,
- endpointEnabled: base.endpointEnabled,
- paramsValid: base.params.validateParameters(),
- },
- review: {
- isVisible: base.hasResults,
- operation: base.operation,
- title: t("pdfCommentAgent.results.title", "Commented PDF"),
- onFileClick: base.handleThumbnailClick,
- onUndo: base.handleUndo,
- },
- });
-};
-
-export default PdfCommentAgent;
diff --git a/frontend/editor/src/prototypes/tsconfig.json b/frontend/editor/src/prototypes/tsconfig.json
deleted file mode 100644
index 69919f86ca..0000000000
--- a/frontend/editor/src/prototypes/tsconfig.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "extends": "../../tsconfig.json",
- "compilerOptions": {
- "paths": {
- "@app/*": [
- "../../src/prototypes/*",
- "../../src/proprietary/*",
- "../../src/core/*"
- ],
- "@proprietary/*": ["../../src/proprietary/*"],
- "@core/*": ["../../src/core/*"],
- "@app/portal/*": [
- "../../src/prototypes/portal/*",
- "../../src/proprietary/portal/*",
- "../../src/core/portal/*",
- "../../src/portal/*"
- ],
- "@portal/*": ["../../src/portal/*"]
- }
- },
- "include": [
- "../global.d.ts",
- "../*.js",
- "../*.ts",
- "../*.tsx",
- "../core/setupTests.ts",
- "."
- ]
-}
diff --git a/frontend/editor/src/prototypes/types/prototypeToolId.ts b/frontend/editor/src/prototypes/types/prototypeToolId.ts
deleted file mode 100644
index 3d6743e064..0000000000
--- a/frontend/editor/src/prototypes/types/prototypeToolId.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Prototype tool ID definitions — real implementation.
- *
- * Overrides the empty stub at {@code core/types/prototypeToolId.ts} when
- * built in prototypes mode. Tools listed here are only reachable from the
- * prototypes build (and any build whose {@code @app/*} alias chain reaches
- * {@code src/prototypes/*}) — they are invisible to the core / proprietary
- * / saas / desktop bundles.
- *
- * Add an id here when the accompanying tool file lives under
- * {@code frontend/src/prototypes/tools/...} and you want it surfaced in the
- * prototypes build's tool picker.
- */
-
-export const PROTOTYPE_REGULAR_TOOL_IDS = ["pdfCommentAgent"] as const;
-// "ai-workflow" is a generic marker stamped onto files produced by the AI
-// orchestrator (which may invoke one or more underlying tools). Lives here as
-// a super-tool so ``ToolOperation.toolId`` stays typed; not user-pickable —
-// see ChatContext.tsx. The prototype tool registry doesn't include it as an
-// entry, which is fine since the registry uses an ``as`` cast.
-export const PROTOTYPE_SUPER_TOOL_IDS = ["ai-workflow"] as const;
-export const PROTOTYPE_LINK_TOOL_IDS = [] as const;
-
-export type PrototypeRegularToolId =
- (typeof PROTOTYPE_REGULAR_TOOL_IDS)[number];
-export type PrototypeSuperToolId = (typeof PROTOTYPE_SUPER_TOOL_IDS)[number];
-export type PrototypeLinkToolId = (typeof PROTOTYPE_LINK_TOOL_IDS)[number];
-export type PrototypeToolId =
- | PrototypeRegularToolId
- | PrototypeSuperToolId
- | PrototypeLinkToolId;
diff --git a/frontend/editor/tsconfig.desktop.vite.json b/frontend/editor/tsconfig.desktop.vite.json
index e25a7acb45..c5bae9b119 100644
--- a/frontend/editor/tsconfig.desktop.vite.json
+++ b/frontend/editor/tsconfig.desktop.vite.json
@@ -29,7 +29,6 @@
"src/cloud/**/*.test.ts*",
"src/cloud/**/*.spec.ts*",
"src/saas",
- "src/prototypes",
"src/portal-saas",
"src/portal/**/*.test.ts*",
"src/portal/**/*.spec.ts*"
diff --git a/frontend/editor/tsconfig.prototypes.vite.json b/frontend/editor/tsconfig.prototypes.vite.json
deleted file mode 100644
index d98a896999..0000000000
--- a/frontend/editor/tsconfig.prototypes.vite.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "extends": "./tsconfig.proprietary.vite.json",
- "compilerOptions": {
- "paths": {
- "@app/*": ["./src/prototypes/*", "./src/proprietary/*", "./src/core/*"],
- "@proprietary/*": ["./src/proprietary/*"],
- "@core/*": ["./src/core/*"],
- "@app/portal/*": [
- "./src/prototypes/portal/*",
- "./src/proprietary/portal/*",
- "./src/core/portal/*",
- "./src/portal/*"
- ],
- "@portal/*": ["./src/portal/*"]
- }
- },
- "exclude": [
- "src/core/**/*.test.ts*",
- "src/core/**/*.spec.ts*",
- "src/proprietary/**/*.test.ts*",
- "src/proprietary/**/*.spec.ts*",
- "src/desktop",
- "src/saas"
- ]
-}
diff --git a/frontend/editor/vite.config.ts b/frontend/editor/vite.config.ts
index d8d7ae89c0..1e67a42cf4 100644
--- a/frontend/editor/vite.config.ts
+++ b/frontend/editor/vite.config.ts
@@ -213,13 +213,7 @@ function subpathBareRedirectPlugin(subpath: string): PluginOption {
// into the saas and desktop builds. It has no entry here and no vite tsconfig;
// it is only typechecked standalone via editor/src/cloud/tsconfig.json
// (task frontend:typecheck:cloud) to prove it carries no saas/desktop-only deps.
-const VALID_MODES = [
- "core",
- "proprietary",
- "saas",
- "desktop",
- "prototypes",
-] as const;
+const VALID_MODES = ["core", "proprietary", "saas", "desktop"] as const;
type BuildMode = (typeof VALID_MODES)[number];
const TSCONFIG_MAP: Record<BuildMode, string> = {
@@ -227,7 +221,6 @@ const TSCONFIG_MAP: Record<BuildMode, string> = {
proprietary: "./tsconfig.proprietary.vite.json",
saas: "./tsconfig.saas.vite.json",
desktop: "./tsconfig.desktop.vite.json",
- prototypes: "./tsconfig.prototypes.vite.json",
};
export default defineConfig(async ({ mode, command }) => {
diff --git a/frontend/editor/vitest.config.ts b/frontend/editor/vitest.config.ts
index 1ab4681f7b..daad1b3fb1 100644
--- a/frontend/editor/vitest.config.ts
+++ b/frontend/editor/vitest.config.ts
@@ -141,26 +141,6 @@ export default defineConfig({
target: "es2020",
},
},
- {
- test: {
- name: "prototypes",
- ...TIMEOUTS,
- include: ["src/prototypes/**/*.test.{ts,tsx}"],
- environment: "jsdom",
- globals: true,
- setupFiles: ["./src/core/setupTests.ts"],
- },
- plugins: [
- iconSvgr(),
- react(),
- tsconfigPaths({
- projects: ["./tsconfig.prototypes.vite.json"],
- }),
- ],
- esbuild: {
- target: "es2020",
- },
- },
],
},
esbuild: {
diff --git a/frontend/oxlint.config.ts b/frontend/oxlint.config.ts
index 48c0d6bd6b..31dc5b2fef 100644
--- a/frontend/oxlint.config.ts
+++ b/frontend/oxlint.config.ts
@@ -342,15 +342,14 @@ export default defineConfig({
},
{
// Exempt from the shared-DS Mantine import ban (these layers may use
- // Mantine directly): the shared DS itself wraps Mantine, stories/tests
- // demo it, and prototypes are not shipped. Module-path bans still apply.
+ // Mantine directly): the shared DS itself wraps Mantine and stories/tests
+ // demo it. Module-path bans still apply.
// The three named files are ARIA tablist/segmented controls that the
// ESLint config exempted from the (now-dropped) raw-<button> and Mantine
// rules. Comes after the scoped bans above so it wins for these files;
// desktop/cloud keep theirs.
files: [
"editor/src/core/ui/**/*.{js,mjs,jsx,ts,tsx}",
- "editor/src/prototypes/**/*.{js,mjs,jsx,ts,tsx}",
"**/*.stories.{js,mjs,jsx,ts,tsx}",
"**/*.test.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/shared/FileSelectorPicker.tsx",