mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-08 11:13:44 +02:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The backend now turns agent requests into durable connection intents. > - Operators need a clear path to inspect, configure, and finish those requests. > - The experience must preserve identity, agent access, and interrupted setup state. > - This pull request adds the connection intent setup experience across the app UI. > - The benefit is one guided flow from agent request to governed connection. ## Linked Issues or Issue Description Refs #11965 This is stack 9 of 11. It depends on stack 8 and replaces another reviewable part of #11965. ## What Changed - Add connection intent cards and setup flow integration. - Add browse, connection, app detail, and sidebar experience updates. - Preserve exact draft identity and access choices across resume and OAuth recovery. - Add focused UI, architecture, policy, and end-to-end coverage. - Keep transient retained-connection lookup failures retryable instead of misclassifying them as missing targets. - Align the dark-mode E2E contract with the intentionally hidden Gateways and Profiles sidebar tabs. ## Verification - `pnpm -r typecheck` - Focused UI result: 372 tests passed across 20 files. - AppsConnect regression suite: 80/80 passed, including failed connection and application lookups during retained reconnect. - `pnpm --filter @paperclipai/ui exec vitest run src/components/AppsSidebar.test.tsx` (1 passed) - `pnpm check:token-gates` - `pnpm --filter @paperclipai/db check:migrations` - `pnpm build` ## Risks - An interrupted OAuth flow can leave a durable draft that needs resume. - The UI resumes the exact draft and keeps its identity and agent access settings. - Retained reconnect retries refetch connections and applications together to avoid mixing partial snapshots. - Gateways and Profiles remain route-accessible but intentionally absent from the sidebar until their existing ship gate is lifted. - The change does not add a database migration. > I checked `ROADMAP.md`. This stack continues the existing app connection work from #11965 and does not duplicate another planned item. ## Model Used OpenAI Codex, GPT-5. The runtime model ID and context window were not exposed. The model used reasoning, tool use, and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have linked the public source pull request with `Refs #` - [x] I have not referenced internal or instance-local Paperclip issues or links - [x] My branch name describes the change and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
97 lines
4.0 KiB
TypeScript
97 lines
4.0 KiB
TypeScript
import * as React from "react";
|
|
import { StrictMode } from "react";
|
|
import * as ReactDOM from "react-dom";
|
|
import { BrowserRouter } from "@/lib/router";
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { App } from "./App";
|
|
import { AppErrorBoundary } from "./components/AppErrorBoundary";
|
|
import { SentryGate } from "./components/SentryGate";
|
|
import { CompanyProvider, useCompany } from "./context/CompanyContext";
|
|
import { LiveUpdatesProvider } from "./context/LiveUpdatesProvider";
|
|
import { BreadcrumbProvider } from "./context/BreadcrumbContext";
|
|
import { PanelProvider } from "./context/PanelContext";
|
|
import { SidebarProvider } from "./context/SidebarContext";
|
|
import { DialogProvider } from "./context/DialogContext";
|
|
import { EditorAutocompleteProvider } from "./context/EditorAutocompleteContext";
|
|
import { ToastProvider } from "./context/ToastContext";
|
|
import { ThemeProvider } from "./context/ThemeContext";
|
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
import { initPluginBridge } from "./plugins/bridge-init";
|
|
import { PluginLauncherProvider } from "./plugins/launchers";
|
|
import { startPerfMeasureReaper } from "./lib/perf-measure-reaper";
|
|
import { getOrCreatePaperclipReactRoot } from "./lib/react-root";
|
|
import { startServiceWorkerUpdates } from "./lib/service-worker-updates";
|
|
import "@mdxeditor/editor/style.css";
|
|
import "./index.css";
|
|
|
|
initPluginBridge(React, ReactDOM);
|
|
|
|
// React 19.2 emits an unbounded stream of performance.measure() entries for its
|
|
// DevTools performance tracks and never clears them; on a long-lived tab they
|
|
// accumulate into millions of native objects (GBs). Reap them periodically.
|
|
startPerfMeasureReaper();
|
|
|
|
// Parked SPA tabs never navigate, so beyond registering the worker this also
|
|
// re-checks /sw.js on tab focus and hourly, and applies a discovered update
|
|
// with one reload while the tab is hidden — otherwise an old worker and its
|
|
// cached shell can outlive a deploy indefinitely.
|
|
window.addEventListener("load", () => {
|
|
startServiceWorkerUpdates();
|
|
});
|
|
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
staleTime: 30_000,
|
|
// Explicit so cross-tab-published cache entries for resources this tab
|
|
// isn't observing get collected promptly rather than lingering. Single
|
|
// tuning point if we need to trim the cache footprint further.
|
|
gcTime: 5 * 60_000,
|
|
refetchOnWindowFocus: true,
|
|
},
|
|
},
|
|
});
|
|
|
|
function CompanyAwareBreadcrumbProvider({ children }: { children: React.ReactNode }) {
|
|
const { selectedCompany } = useCompany();
|
|
return <BreadcrumbProvider companyName={selectedCompany?.name ?? null}>{children}</BreadcrumbProvider>;
|
|
}
|
|
|
|
const rootElement = document.getElementById("root");
|
|
if (!rootElement) throw new Error("Paperclip root element is missing");
|
|
|
|
getOrCreatePaperclipReactRoot(window, rootElement).render(
|
|
<StrictMode>
|
|
<AppErrorBoundary>
|
|
<QueryClientProvider client={queryClient}>
|
|
<SentryGate />
|
|
<ThemeProvider>
|
|
<BrowserRouter>
|
|
<CompanyProvider>
|
|
<EditorAutocompleteProvider>
|
|
<ToastProvider>
|
|
<LiveUpdatesProvider>
|
|
<TooltipProvider>
|
|
<CompanyAwareBreadcrumbProvider>
|
|
<SidebarProvider>
|
|
<PanelProvider>
|
|
<PluginLauncherProvider>
|
|
<DialogProvider>
|
|
<App />
|
|
</DialogProvider>
|
|
</PluginLauncherProvider>
|
|
</PanelProvider>
|
|
</SidebarProvider>
|
|
</CompanyAwareBreadcrumbProvider>
|
|
</TooltipProvider>
|
|
</LiveUpdatesProvider>
|
|
</ToastProvider>
|
|
</EditorAutocompleteProvider>
|
|
</CompanyProvider>
|
|
</BrowserRouter>
|
|
</ThemeProvider>
|
|
</QueryClientProvider>
|
|
</AppErrorBoundary>
|
|
</StrictMode>
|
|
);
|