@burdenoff/microfe-botmanor 2026.1201.2 → 2026.1202.1

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.
Files changed (46) hide show
  1. package/dist/botlit/BotmanorRootInner.js +2 -1
  2. package/dist/botlit/BotmanorRootInner.js.map +1 -1
  3. package/dist/botlit/components/GettingStartedChecklist.js +1 -1
  4. package/dist/botlit/components/GettingStartedChecklist.js.map +1 -1
  5. package/dist/botlit/components/StewardApprovalsInbox.d.ts +4 -0
  6. package/dist/botlit/components/StewardApprovalsInbox.js +419 -0
  7. package/dist/botlit/components/StewardApprovalsInbox.js.map +1 -0
  8. package/dist/botlit/hooks/useAgentApprovals.js +28 -17
  9. package/dist/botlit/hooks/useAgentApprovals.js.map +1 -1
  10. package/dist/botlit/hooks/useBotAgents.js +15 -11
  11. package/dist/botlit/hooks/useBotAgents.js.map +1 -1
  12. package/dist/botlit/hooks/useBots.js +36 -62
  13. package/dist/botlit/hooks/useBots.js.map +1 -1
  14. package/dist/botlit/hooks/useBuckets.js +31 -24
  15. package/dist/botlit/hooks/useBuckets.js.map +1 -1
  16. package/dist/botlit/hooks/useChannels.js +44 -30
  17. package/dist/botlit/hooks/useChannels.js.map +1 -1
  18. package/dist/botlit/hooks/useLLMProviders.js +8 -6
  19. package/dist/botlit/hooks/useLLMProviders.js.map +1 -1
  20. package/dist/botlit/hooks/useMCPServers.js +21 -17
  21. package/dist/botlit/hooks/useMCPServers.js.map +1 -1
  22. package/dist/botlit/hooks/usePromptTemplates.js +5 -3
  23. package/dist/botlit/hooks/usePromptTemplates.js.map +1 -1
  24. package/dist/botlit/hooks/useStorePublishing.js +20 -10
  25. package/dist/botlit/hooks/useStorePublishing.js.map +1 -1
  26. package/dist/botlit/hooks/useTemplates.js +35 -29
  27. package/dist/botlit/hooks/useTemplates.js.map +1 -1
  28. package/dist/botlit/hooks/useToolApprovals.d.ts +38 -5
  29. package/dist/botlit/hooks/useToolApprovals.js +50 -31
  30. package/dist/botlit/hooks/useToolApprovals.js.map +1 -1
  31. package/dist/botlit/pages/ToolApprovalsPage.js +125 -106
  32. package/dist/botlit/pages/ToolApprovalsPage.js.map +1 -1
  33. package/dist/botlit/permissions/botmanorPermissions.d.ts +1 -0
  34. package/dist/botlit/permissions/botmanorPermissions.js +1 -0
  35. package/dist/botlit/permissions/botmanorPermissions.js.map +1 -1
  36. package/dist/botlit/utils/stewardApprovals.d.ts +80 -0
  37. package/dist/botlit/utils/stewardApprovals.js +90 -0
  38. package/dist/botlit/utils/stewardApprovals.js.map +1 -0
  39. package/dist/generated/global-types.d.ts +7580 -811
  40. package/dist/generated/global-types.js.map +1 -1
  41. package/dist/generated/wspace-operations.d.ts +522 -3
  42. package/dist/generated/wspace-operations.js +281 -15
  43. package/dist/generated/wspace-operations.js.map +1 -1
  44. package/dist/generated/wspace-types.d.ts +9369 -61
  45. package/dist/generated/wspace-types.js.map +1 -1
  46. package/package.json +1 -1
@@ -59,8 +59,9 @@ var b = 1e4, x = 2e3, S = new h({ defaultOptions: { queries: {
59
59
  children: C("botlit.root.loadFailed", "Something went wrong loading BotManor. Please refresh the page.")
60
60
  }),
61
61
  children: [/* @__PURE__ */ d(o, {}), /* @__PURE__ */ d(y, {
62
- workspaceId: null,
62
+ workspaceId: h.workspaceId || null,
63
63
  gateway: "global",
64
+ flagKeys: ["botmanor.stewards"],
64
65
  defaultEnabled: !0,
65
66
  children: /* @__PURE__ */ d(g, {
66
67
  client: S,
@@ -1 +1 @@
1
- {"version":3,"file":"BotmanorRootInner.js","names":["CLIENT_READY_TIMEOUT_MS","WORKSPACE_SETTLE_MS","queryClient","QueryClient","BotmanorRootInner","tr","useTr","workspaceClient","useGatewayClient","clientReady","clientTimedOut","setClientTimedOut","useState","workspaceSettled","setWorkspaceSettled","useEffect","registerTourRouteCatalog","BOTMANOR_TOUR_PRODUCT_ID","botmanorTourRoutes","props","timer","WorkspaceRequired","RouteLoader","isIntegrated","content","BotlitProvider","QuotaGuard","BotlitRoutes","ErrorBoundary","ConfirmActionBridge","FeatureFlagProvider","QueryClientProvider","ApolloProvider"],"sources":["../../src/botlit/BotmanorRootInner.tsx"],"sourcesContent":["/**\n * BotManor Root — implementation\n * @module botlit\n *\n * Product pages live behind this lazy boundary. Workflow routes and SDK\n * lifecycle are owned by the app-shell WorkflowsRoot, shared with every host.\n */\n\nimport type { FC } from 'react';\nimport { useEffect, useState } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { BotlitProvider } from './providers/BotlitProvider';\nimport { QuotaGuard } from './providers/QuotaGuard';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { BotlitRoutes } from './BotlitRoutes';\nimport { RouteLoader } from './components/RouteLoader';\nimport { useTr } from '../shared/hooks/useTr';\nimport { WorkspaceRequired } from './components/WorkspaceRequired';\nimport { ConfirmActionBridge } from './utils/confirmAction';\nimport type { BotmanorRootProps } from './types';\n\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { registerTourRouteCatalog } from '@burdenoff/fe-libs/shared/tours';\nimport { BOTMANOR_TOUR_PRODUCT_ID, botmanorTourRoutes } from './tours/tourRoutes';\n\n/** How long to wait for the shell's gateway clients before showing an error. */\nconst CLIENT_READY_TIMEOUT_MS = 10_000;\n\n/**\n * How long to keep showing the loading skeleton before concluding that the\n * shell really has no active workspace.\n *\n * The shell resolves org/workspace asynchronously and passes `workspaceId=\"\"`\n * until it lands, which is indistinguishable from \"this user has no\n * workspace\". Without this settle window the guided zero state would flash on\n * every cold load — a get-started screen appearing and vanishing reads as a\n * broken page, which is exactly what this component exists to avoid.\n */\nconst WORKSPACE_SETTLE_MS = 2_000;\n\n// Create a query client for this microfrontend\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n },\n },\n});\n\nexport const BotmanorRootInner: FC<BotmanorRootProps> = (props) => {\n // NOTE: Navigation is now handled by the shell's NavRegistration.tsx\n // The shell manages all product submenu items in a centralized way\n\n // Product operations use the shell's authenticated workspace gateway client.\n const tr = useTr();\n const workspaceClient = useGatewayClient('workspace');\n const clientReady = Boolean(workspaceClient);\n const [clientTimedOut, setClientTimedOut] = useState(false);\n const [workspaceSettled, setWorkspaceSettled] = useState(false);\n\n // Name each BotManor screen for product tours (BOFF-15482). Without this the\n // shell resolves every screen under the mount path to one pageId.\n useEffect(\n () => registerTourRouteCatalog(BOTMANOR_TOUR_PRODUCT_ID, botmanorTourRoutes(props.basePath)),\n [props.basePath]\n );\n\n // Timeout fallback: if gateway clients are never provided (test env, shell\n // misconfiguration, auth failure before hydration), show an error rather than\n // spinning indefinitely.\n useEffect(() => {\n if (clientReady) return;\n const timer = setTimeout(() => {\n setClientTimedOut(true);\n }, CLIENT_READY_TIMEOUT_MS);\n return () => clearTimeout(timer);\n }, [clientReady]);\n\n // Give the shell a bounded window to resolve the active workspace before the\n // guided zero state is allowed to render. Cancelled the moment a workspace\n // arrives — a workspace that is already present never starts the timer.\n useEffect(() => {\n if (props.workspaceId) return;\n const timer = setTimeout(() => setWorkspaceSettled(true), WORKSPACE_SETTLE_MS);\n return () => clearTimeout(timer);\n }, [props.workspaceId]);\n\n // Without a workspace every BotManor query is unscoped and every write is\n // rejected — guide the user instead of rendering empty lists. Until the\n // settle window elapses we cannot tell \"still resolving\" from \"none\", so we\n // keep the same skeleton the shell was already showing.\n if (!props.workspaceId) {\n if (!workspaceSettled) {\n return <RouteLoader label={tr('botlit.root.loadingWorkspace', 'Loading your workspace…')} />;\n }\n return <WorkspaceRequired basePath={props.basePath} navigate={props.navigate} />;\n }\n\n // Don't render until clients are ready (same pattern as microfe-bigconsole)\n if (!clientReady) {\n if (clientTimedOut) {\n return (\n <div className=\"flex h-full min-h-[200px] w-full items-center justify-center p-6\">\n <div className=\"text-center\">\n <p className=\"mb-4 text-sm text-text-secondary\">\n {tr(\n 'botlit.root.connectError',\n 'BotManor could not connect to the gateway. Please refresh the page or check your configuration.'\n )}\n </p>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg-hover\"\n >\n {tr('botlit.root.reload', 'Reload Page')}\n </button>\n </div>\n </div>\n );\n }\n // Same skeleton as the lazy-chunk fallback, so the content region never\n // switches loading idioms between first paint and the page rendering.\n return <RouteLoader />;\n }\n\n const isIntegrated = !!props.basePath;\n\n const content = (\n <BotlitProvider {...props}>\n {/* Every metered mutation that hits a plan limit opens one translated dialog. */}\n <QuotaGuard>\n <BotlitRoutes />\n </QuotaGuard>\n </BotlitProvider>\n );\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n {tr(\n 'botlit.root.loadFailed',\n 'Something went wrong loading BotManor. Please refresh the page.'\n )}\n </div>\n }\n >\n {/* Every confirmAction asks through fe-libs' useConfirm (BOFF-16859). */}\n <ConfirmActionBridge />\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <QueryClientProvider client={queryClient}>\n {isIntegrated ? (\n content\n ) : (\n <ApolloProvider client={workspaceClient}>{content}</ApolloProvider>\n )}\n </QueryClientProvider>\n </FeatureFlagProvider>\n </ErrorBoundary>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAMA,IAA0B,KAY1BC,IAAsB,KAGtBC,IAAc,IAAIC,EAAY,EAClC,gBAAgB,EACd,SAAS;CACP,WAAW;CACX,OAAO;AACT,EACF,EACF,CAAC,GAEYC,KAA4C,MAAU;CAKjE,IAAMC,IAAKC,EAAM,GACXC,IAAkBC,EAAiB,WAAW,GAC9CC,IAAc,EAAQF,GACtB,CAACG,GAAgBC,KAAqBC,EAAS,EAAK,GACpD,CAACC,GAAkBC,KAAuBF,EAAS,EAAK;CAiC9D,IA7BAG,QACQ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AA,GACtB,kBAACC,GAAD;GAAqB,aAAa;GAAM,SAAQ;GAAS,gBAAgB;GACvE,UAAA,kBAACC,GAAD;IAAqB,QAAQ7B;IAC1B,UAAAqB,IACCC,IAEA,kBAACQ,GAAD;KAAgB,QAAQzB;KAAkB,UAAAiB;IAAwB,CAAA;GAEjD,CAAA;EACF,CAAA,CACR;;AAEnB"}
1
+ {"version":3,"file":"BotmanorRootInner.js","names":["CLIENT_READY_TIMEOUT_MS","WORKSPACE_SETTLE_MS","queryClient","QueryClient","BotmanorRootInner","tr","useTr","workspaceClient","useGatewayClient","clientReady","clientTimedOut","setClientTimedOut","useState","workspaceSettled","setWorkspaceSettled","useEffect","registerTourRouteCatalog","BOTMANOR_TOUR_PRODUCT_ID","botmanorTourRoutes","props","timer","WorkspaceRequired","RouteLoader","isIntegrated","content","BotlitProvider","QuotaGuard","BotlitRoutes","ErrorBoundary","ConfirmActionBridge","FeatureFlagProvider","QueryClientProvider","ApolloProvider"],"sources":["../../src/botlit/BotmanorRootInner.tsx"],"sourcesContent":["/**\n * BotManor Root — implementation\n * @module botlit\n *\n * Product pages live behind this lazy boundary. Workflow routes and SDK\n * lifecycle are owned by the app-shell WorkflowsRoot, shared with every host.\n */\n\nimport type { FC } from 'react';\nimport { useEffect, useState } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { BotlitProvider } from './providers/BotlitProvider';\nimport { QuotaGuard } from './providers/QuotaGuard';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { BotlitRoutes } from './BotlitRoutes';\nimport { RouteLoader } from './components/RouteLoader';\nimport { useTr } from '../shared/hooks/useTr';\nimport { WorkspaceRequired } from './components/WorkspaceRequired';\nimport { ConfirmActionBridge } from './utils/confirmAction';\nimport type { BotmanorRootProps } from './types';\n\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { registerTourRouteCatalog } from '@burdenoff/fe-libs/shared/tours';\nimport { BOTMANOR_TOUR_PRODUCT_ID, botmanorTourRoutes } from './tours/tourRoutes';\n\n/** How long to wait for the shell's gateway clients before showing an error. */\nconst CLIENT_READY_TIMEOUT_MS = 10_000;\n\n/**\n * How long to keep showing the loading skeleton before concluding that the\n * shell really has no active workspace.\n *\n * The shell resolves org/workspace asynchronously and passes `workspaceId=\"\"`\n * until it lands, which is indistinguishable from \"this user has no\n * workspace\". Without this settle window the guided zero state would flash on\n * every cold load — a get-started screen appearing and vanishing reads as a\n * broken page, which is exactly what this component exists to avoid.\n */\nconst WORKSPACE_SETTLE_MS = 2_000;\n\n// Create a query client for this microfrontend\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n },\n },\n});\n\nexport const BotmanorRootInner: FC<BotmanorRootProps> = (props) => {\n // NOTE: Navigation is now handled by the shell's NavRegistration.tsx\n // The shell manages all product submenu items in a centralized way\n\n // Product operations use the shell's authenticated workspace gateway client.\n const tr = useTr();\n const workspaceClient = useGatewayClient('workspace');\n const clientReady = Boolean(workspaceClient);\n const [clientTimedOut, setClientTimedOut] = useState(false);\n const [workspaceSettled, setWorkspaceSettled] = useState(false);\n\n // Name each BotManor screen for product tours (BOFF-15482). Without this the\n // shell resolves every screen under the mount path to one pageId.\n useEffect(\n () => registerTourRouteCatalog(BOTMANOR_TOUR_PRODUCT_ID, botmanorTourRoutes(props.basePath)),\n [props.basePath]\n );\n\n // Timeout fallback: if gateway clients are never provided (test env, shell\n // misconfiguration, auth failure before hydration), show an error rather than\n // spinning indefinitely.\n useEffect(() => {\n if (clientReady) return;\n const timer = setTimeout(() => {\n setClientTimedOut(true);\n }, CLIENT_READY_TIMEOUT_MS);\n return () => clearTimeout(timer);\n }, [clientReady]);\n\n // Give the shell a bounded window to resolve the active workspace before the\n // guided zero state is allowed to render. Cancelled the moment a workspace\n // arrives — a workspace that is already present never starts the timer.\n useEffect(() => {\n if (props.workspaceId) return;\n const timer = setTimeout(() => setWorkspaceSettled(true), WORKSPACE_SETTLE_MS);\n return () => clearTimeout(timer);\n }, [props.workspaceId]);\n\n // Without a workspace every BotManor query is unscoped and every write is\n // rejected — guide the user instead of rendering empty lists. Until the\n // settle window elapses we cannot tell \"still resolving\" from \"none\", so we\n // keep the same skeleton the shell was already showing.\n if (!props.workspaceId) {\n if (!workspaceSettled) {\n return <RouteLoader label={tr('botlit.root.loadingWorkspace', 'Loading your workspace…')} />;\n }\n return <WorkspaceRequired basePath={props.basePath} navigate={props.navigate} />;\n }\n\n // Don't render until clients are ready (same pattern as microfe-bigconsole)\n if (!clientReady) {\n if (clientTimedOut) {\n return (\n <div className=\"flex h-full min-h-[200px] w-full items-center justify-center p-6\">\n <div className=\"text-center\">\n <p className=\"mb-4 text-sm text-text-secondary\">\n {tr(\n 'botlit.root.connectError',\n 'BotManor could not connect to the gateway. Please refresh the page or check your configuration.'\n )}\n </p>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg-hover\"\n >\n {tr('botlit.root.reload', 'Reload Page')}\n </button>\n </div>\n </div>\n );\n }\n // Same skeleton as the lazy-chunk fallback, so the content region never\n // switches loading idioms between first paint and the page rendering.\n return <RouteLoader />;\n }\n\n const isIntegrated = !!props.basePath;\n\n const content = (\n <BotlitProvider {...props}>\n {/* Every metered mutation that hits a plan limit opens one translated dialog. */}\n <QuotaGuard>\n <BotlitRoutes />\n </QuotaGuard>\n </BotlitProvider>\n );\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n {tr(\n 'botlit.root.loadFailed',\n 'Something went wrong loading BotManor. Please refresh the page.'\n )}\n </div>\n }\n >\n {/* Every confirmAction asks through fe-libs' useConfirm (BOFF-16859). */}\n <ConfirmActionBridge />\n <FeatureFlagProvider\n workspaceId={props.workspaceId || null}\n gateway=\"global\"\n flagKeys={['botmanor.stewards']}\n defaultEnabled={true}\n >\n <QueryClientProvider client={queryClient}>\n {isIntegrated ? (\n content\n ) : (\n <ApolloProvider client={workspaceClient}>{content}</ApolloProvider>\n )}\n </QueryClientProvider>\n </FeatureFlagProvider>\n </ErrorBoundary>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAMA,IAA0B,KAY1BC,IAAsB,KAGtBC,IAAc,IAAIC,EAAY,EAClC,gBAAgB,EACd,SAAS;CACP,WAAW;CACX,OAAO;AACT,EACF,EACF,CAAC,GAEYC,KAA4C,MAAU;CAKjE,IAAMC,IAAKC,EAAM,GACXC,IAAkBC,EAAiB,WAAW,GAC9CC,IAAc,EAAQF,GACtB,CAACG,GAAgBC,KAAqBC,EAAS,EAAK,GACpD,CAACC,GAAkBC,KAAuBF,EAAS,EAAK;CAiC9D,IA7BAG,QACQC,EAAyBC,GAA0BC,EAAmBC,EAAM,QAAQ,CAAC,GAC3F,CAACA,EAAM,QAAQ,CACjB,GAKAJ,QAAgB;EACd,IAAIN,GAAa;EACjB,IAAMW,IAAQ,iBAAiB;GAC7B,EAAkB,EAAI;EACxB,GAAGpB,CAAuB;EAC1B,aAAa,aAAaoB,CAAK;CACjC,GAAG,CAACX,CAAW,CAAC,GAKhBM,QAAgB;EACd,IAAII,EAAM,aAAa;EACvB,IAAMC,IAAQ,iBAAiBN,EAAoB,EAAI,GAAGb,CAAmB;EAC7E,aAAa,aAAamB,CAAK;CACjC,GAAG,CAACD,EAAM,WAAW,CAAC,GAMlB,CAACA,EAAM,aAIT,OAHKN,IAGE,kBAACQ,GAAD;EAAmB,UAAUF,EAAM;EAAU,UAAUA,EAAM;CAAW,CAAA,IAFtE,kBAACG,GAAD,EAAa,OAAOjB,EAAG,gCAAgC,yBAAyB,EAAI,CAAA;CAM/F,IAAI,CAACI,GAwBH,OAvBIC,IAEA,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;IACV,UAAAL,EACC,4BACA,iGACF;GACC,CAAA,GACH,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,OAAO,SAAS,OAAO;IACtC,WAAU;IAET,UAAAA,EAAG,sBAAsB,aAAa;GACjC,CAAA,CACL;;CACF,CAAA,IAKF,kBAACiB,GAAD,CAAc,CAAA;CAGvB,IAAMC,IAAe,CAAC,CAACJ,EAAM,UAEvBK,IACJ,kBAACC,GAAD;EAAgB,GAAIN;EAElB,UAAA,kBAACO,GAAD,EAAA,UACE,kBAACC,GAAD,CAAe,CAAA,EACL,CAAA;CACE,CAAA;CAGlB,OACE,kBAACC,GAAD;EACE,UACE,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAAvB,EACC,0BACA,iEACF;EACG,CAAA;EAPT,UAAA,CAWE,kBAACwB,GAAD,CAAsB,CAAA,GACtB,kBAACC,GAAD;GACE,aAAaX,EAAM,eAAe;GAClC,SAAQ;GACR,UAAU,CAAC,mBAAmB;GAC9B,gBAAgB;GAEhB,UAAA,kBAACY,GAAD;IAAqB,QAAQ7B;IAC1B,UAAAqB,IACCC,IAEA,kBAACQ,GAAD;KAAgB,QAAQzB;KAAkB,UAAAiB;IAAwB,CAAA;GAEjD,CAAA;EACF,CAAA,CACR;;AAEnB"}
@@ -30,7 +30,7 @@ var b = (e) => {
30
30
  let b = t(), { navigateTo: x } = l(), S = n(), C = s !== null, w = d(() => ({ filters: { workspaceId: S } }), [S]), T = r({
31
31
  document: e,
32
32
  variables: w,
33
- select: (e) => (e?.listKnowledgeBases.length ?? 0) > 0,
33
+ select: (e) => (e?.listBotmanorKnowledgeBasesPage.total ?? 0) > 0,
34
34
  fallback: !1,
35
35
  enabled: !!S,
36
36
  errorMessage: "Failed to check for knowledge bases"
@@ -1 +1 @@
1
- {"version":3,"file":"GettingStartedChecklist.js","names":["GettingStartedChecklist","canCreateBots","useBotmanorPermissionDecision","BOTMANOR_PERMISSIONS","canReadRuns","ChecklistWithRuns","props","ChecklistBody","runs","useExecutionSummary","t","useTr","useBotlit","workspaceId","useWorkspaceId","hasRun","knowledgeVariables","useMemo","knowledge","useWorkspaceQuery","BotmanorGettingStartedKnowledgeDocument","data","providers","useLLMProviders","channels","useChannelOverview","state","isSetupComplete","steps","BookOpen","navigateTo","KeyRound","Bot","AppWindow","Radio","MessageSquare","step","NextSteps"],"sources":["../../../src/botlit/components/GettingStartedChecklist.tsx"],"sourcesContent":["/**\n * First-bot checklist on the dashboard (BOFF-15482)\n * @module botlit/components\n *\n * BotManor's setup order is not obvious: an agent answers from knowledge with\n * a model, and a bot puts agents in front of people through a channel. This\n * checklist walks a new workspace through that order. Every tick comes from\n * real data (counts and one-row reads), never from clicks, so it stays right\n * when someone else in the workspace does a step. It disappears once every\n * step is done and can be dismissed (per workspace) before that.\n */\n\nimport type { FC } from 'react';\nimport { useMemo } from 'react';\nimport { AppWindow, BookOpen, Bot, KeyRound, MessageSquare, Radio } from 'lucide-react';\nimport { NextSteps, type NextStep } from '@burdenoff/fe-libs/ui';\n\nimport {\n BotmanorGettingStartedKnowledgeDocument,\n type BotmanorGettingStartedKnowledgeQuery,\n} from '../../generated/wspace-operations';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useWorkspaceId, useWorkspaceQuery } from '../hooks/internal/workspaceGateway';\nimport { useChannelOverview } from '../hooks/useChannels';\nimport { useExecutionSummary } from '../hooks/useExecutions';\nimport { useLLMProviders } from '../hooks/useLLMProviders';\nimport { BOTMANOR_PERMISSIONS, useBotmanorPermissionDecision } from '../permissions';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { isSetupComplete, type GettingStartedState } from '../utils/gettingStarted';\n\nexport interface GettingStartedChecklistProps {\n /** True once the workspace has a bot (from the dashboard's exact counts). */\n hasBot: boolean;\n /** True once the workspace has an agent. */\n hasAgent: boolean;\n}\n\n/**\n * Members who cannot build bots have nothing to set up, so the checklist (and\n * every read behind it) is skipped for them. A member who cannot read runs\n * sees no \"test\" step, and the runs read is skipped too.\n */\nexport const GettingStartedChecklist: FC<GettingStartedChecklistProps> = (props) => {\n const canCreateBots =\n useBotmanorPermissionDecision(BOTMANOR_PERMISSIONS.APP_CREATE) === 'allowed';\n const canReadRuns =\n useBotmanorPermissionDecision(BOTMANOR_PERMISSIONS.EXECUTION_READ) === 'allowed';\n if (!canCreateBots) return null;\n return canReadRuns ? (\n <ChecklistWithRuns {...props} />\n ) : (\n <ChecklistBody {...props} hasRun={null} />\n );\n};\n\n/** Reads whether the workspace has any run yet. */\nconst ChecklistWithRuns: FC<GettingStartedChecklistProps> = (props) => {\n const runs = useExecutionSummary();\n return <ChecklistBody {...props} hasRun={(runs.data?.total ?? 0) > 0} />;\n};\n\nconst ChecklistBody: FC<\n GettingStartedChecklistProps & {\n /** Whether a run exists; null when the member cannot read runs. */\n hasRun: boolean | null;\n }\n> = ({ hasBot, hasAgent, hasRun }) => {\n const t = useTr();\n const { navigateTo } = useBotlit();\n const workspaceId = useWorkspaceId();\n const canReadRuns = hasRun !== null;\n\n const knowledgeVariables = useMemo(() => ({ filters: { workspaceId } }), [workspaceId]);\n const knowledge = useWorkspaceQuery<BotmanorGettingStartedKnowledgeQuery, boolean>({\n document: BotmanorGettingStartedKnowledgeDocument,\n variables: knowledgeVariables,\n select: (data) => (data?.listKnowledgeBases.length ?? 0) > 0,\n fallback: false,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to check for knowledge bases',\n });\n const providers = useLLMProviders();\n const channels = useChannelOverview();\n\n const state: GettingStartedState = {\n hasKnowledge: knowledge.data,\n hasModel: providers.data.length > 0,\n hasAgent,\n hasBot,\n hasChannel: (channels.data?.connectorCount ?? 0) > 0,\n // A member who cannot read runs cannot see this step's result, so it is\n // left out (below) rather than blocking the checklist forever.\n hasRun: hasRun ?? true,\n };\n\n // A finished setup has nothing to suggest.\n if (isSetupComplete(state)) return null;\n\n const steps: NextStep[] = [\n {\n id: 'knowledge',\n label: t('botlit.dashboard.gettingStarted.knowledge', 'Add knowledge'),\n description: t(\n 'botlit.dashboard.gettingStarted.knowledgeDesc',\n 'Upload the documents and FAQs your bot should answer from.'\n ),\n icon: <BookOpen size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('knowledge/new'),\n done: state.hasKnowledge,\n },\n {\n id: 'model',\n label: t('botlit.dashboard.gettingStarted.model', 'Connect a model provider'),\n description: t(\n 'botlit.dashboard.gettingStarted.modelDesc',\n 'Add the LLM provider and key your agents use to reply.'\n ),\n icon: <KeyRound size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('settings'),\n done: state.hasModel,\n },\n {\n id: 'agent',\n label: t('botlit.dashboard.gettingStarted.agent', 'Create an agent'),\n description: t(\n 'botlit.dashboard.gettingStarted.agentDesc',\n 'Give it a model, instructions and your knowledge.'\n ),\n icon: <Bot size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('agents/new'),\n done: state.hasAgent,\n },\n {\n id: 'bot',\n label: t('botlit.dashboard.gettingStarted.bot', 'Create a bot'),\n description: t(\n 'botlit.dashboard.gettingStarted.botDesc',\n 'Wrap your agent in a bot that people can talk to.'\n ),\n icon: <AppWindow size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('bots/new'),\n done: state.hasBot,\n },\n {\n id: 'channel',\n label: t('botlit.dashboard.gettingStarted.channel', 'Connect a channel'),\n description: t(\n 'botlit.dashboard.gettingStarted.channelDesc',\n 'Put the bot on a website widget, Slack, Teams or another channel.'\n ),\n icon: <Radio size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('channels/new'),\n done: state.hasChannel,\n },\n {\n id: 'test',\n label: t('botlit.dashboard.gettingStarted.test', 'Try it in chat'),\n description: t(\n 'botlit.dashboard.gettingStarted.testDesc',\n 'Send a first message and check the answer end to end.'\n ),\n icon: <MessageSquare size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('chat'),\n done: state.hasRun,\n },\n ].filter((step) => step.id !== 'test' || canReadRuns);\n\n return (\n <div data-tour=\"botmanor-dashboard-getting-started\" data-testid=\"getting-started-checklist\">\n <NextSteps\n title={t('botlit.dashboard.gettingStarted.title', 'Get your first bot live')}\n storageKey={`botmanor-getting-started-${workspaceId ?? 'none'}`}\n steps={steps}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA0CA,IAAaA,KAA6D,MAAU;CAClF,IAAMC,IACJC,EAA8BC,EAAqB,UAAU,MAAM,WAC/DC,IACJF,EAA8BC,EAAqB,cAAc,MAAM;CAEzE,OADKF,IACEG,IACL,kBAACC,GAAD,EAAmB,GAAIC,EAAQ,CAAA,IAE/B,kBAACC,GAAD;EAAe,GAAID;EAAO,QAAQ;CAAO,CAAA,IAJhB;AAM7B,GAGMD,KAAuD,MAAU;CACrE,IAAMG,IAAOC,EAAoB;CACjC,OAAO,kBAACF,GAAD;EAAe,GAAID;EAAO,SAASE,EAAK,MAAM,SAAS,KAAK;CAAI,CAAA;AACzE,GAEMD,KAKD,EAAE,WAAQ,aAAU,gBAAa;CACpC,IAAMG,IAAIC,EAAM,GACV,EAAE,kBAAeC,EAAU,GAC3BC,IAAcC,EAAe,GAC7BV,IAAcW,MAAW,MAEzBC,IAAqBC,SAAe,EAAE,SAAS,EAAE,eAAY,EAAE,IAAI,CAACJ,CAAW,CAAC,GAChFK,IAAYC,EAAiE;EACjF,UAAUC;EACV,WAAWJ;EACX,SAAS,OAAUK,GAAM,mBAAmB,UAAU,KAAK;EAC3D,UAAU;EACV,SAAS,EAAQR;EACjB,cAAc;CAChB,CAAC,GACKS,IAAYC,EAAgB,GAC5BC,IAAWC,EAAmB,GAE9BC,IAA6B;EACjC,cAAcR,EAAU;EACxB,UAAUI,EAAU,KAAK,SAAS;EAClC;EACA;EACA,aAAaE,EAAS,MAAM,kBAAkB,KAAK;EAGnD,QAAQT,KAAU;CACpB;CAGA,IAAIY,EAAgBD,CAAK,GAAG,OAAO;CAEnC,IAAME,IAAoB;EACxB;GACE,IAAI;GACJ,OAAO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AD;EAAK,aAAU;EAAqC,eAAY;EAC9D,UAAA,kBAACiC,GAAD;GACE,OAAO3B,EAAE,yCAAyC,yBAAyB;GAC3E,YAAY,4BAA4BG,KAAe;GAChD;EACR,CAAA;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"GettingStartedChecklist.js","names":["GettingStartedChecklist","canCreateBots","useBotmanorPermissionDecision","BOTMANOR_PERMISSIONS","canReadRuns","ChecklistWithRuns","props","ChecklistBody","runs","useExecutionSummary","t","useTr","useBotlit","workspaceId","useWorkspaceId","hasRun","knowledgeVariables","useMemo","knowledge","useWorkspaceQuery","BotmanorGettingStartedKnowledgeDocument","data","providers","useLLMProviders","channels","useChannelOverview","state","isSetupComplete","steps","BookOpen","navigateTo","KeyRound","Bot","AppWindow","Radio","MessageSquare","step","NextSteps"],"sources":["../../../src/botlit/components/GettingStartedChecklist.tsx"],"sourcesContent":["/**\n * First-bot checklist on the dashboard (BOFF-15482)\n * @module botlit/components\n *\n * BotManor's setup order is not obvious: an agent answers from knowledge with\n * a model, and a bot puts agents in front of people through a channel. This\n * checklist walks a new workspace through that order. Every tick comes from\n * real data (counts and one-row reads), never from clicks, so it stays right\n * when someone else in the workspace does a step. It disappears once every\n * step is done and can be dismissed (per workspace) before that.\n */\n\nimport type { FC } from 'react';\nimport { useMemo } from 'react';\nimport { AppWindow, BookOpen, Bot, KeyRound, MessageSquare, Radio } from 'lucide-react';\nimport { NextSteps, type NextStep } from '@burdenoff/fe-libs/ui';\n\nimport {\n BotmanorGettingStartedKnowledgeDocument,\n type BotmanorGettingStartedKnowledgeQuery,\n} from '../../generated/wspace-operations';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useWorkspaceId, useWorkspaceQuery } from '../hooks/internal/workspaceGateway';\nimport { useChannelOverview } from '../hooks/useChannels';\nimport { useExecutionSummary } from '../hooks/useExecutions';\nimport { useLLMProviders } from '../hooks/useLLMProviders';\nimport { BOTMANOR_PERMISSIONS, useBotmanorPermissionDecision } from '../permissions';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport { isSetupComplete, type GettingStartedState } from '../utils/gettingStarted';\n\nexport interface GettingStartedChecklistProps {\n /** True once the workspace has a bot (from the dashboard's exact counts). */\n hasBot: boolean;\n /** True once the workspace has an agent. */\n hasAgent: boolean;\n}\n\n/**\n * Members who cannot build bots have nothing to set up, so the checklist (and\n * every read behind it) is skipped for them. A member who cannot read runs\n * sees no \"test\" step, and the runs read is skipped too.\n */\nexport const GettingStartedChecklist: FC<GettingStartedChecklistProps> = (props) => {\n const canCreateBots =\n useBotmanorPermissionDecision(BOTMANOR_PERMISSIONS.APP_CREATE) === 'allowed';\n const canReadRuns =\n useBotmanorPermissionDecision(BOTMANOR_PERMISSIONS.EXECUTION_READ) === 'allowed';\n if (!canCreateBots) return null;\n return canReadRuns ? (\n <ChecklistWithRuns {...props} />\n ) : (\n <ChecklistBody {...props} hasRun={null} />\n );\n};\n\n/** Reads whether the workspace has any run yet. */\nconst ChecklistWithRuns: FC<GettingStartedChecklistProps> = (props) => {\n const runs = useExecutionSummary();\n return <ChecklistBody {...props} hasRun={(runs.data?.total ?? 0) > 0} />;\n};\n\nconst ChecklistBody: FC<\n GettingStartedChecklistProps & {\n /** Whether a run exists; null when the member cannot read runs. */\n hasRun: boolean | null;\n }\n> = ({ hasBot, hasAgent, hasRun }) => {\n const t = useTr();\n const { navigateTo } = useBotlit();\n const workspaceId = useWorkspaceId();\n const canReadRuns = hasRun !== null;\n\n const knowledgeVariables = useMemo(() => ({ filters: { workspaceId } }), [workspaceId]);\n const knowledge = useWorkspaceQuery<BotmanorGettingStartedKnowledgeQuery, boolean>({\n document: BotmanorGettingStartedKnowledgeDocument,\n variables: knowledgeVariables,\n select: (data) => (data?.listBotmanorKnowledgeBasesPage.total ?? 0) > 0,\n fallback: false,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to check for knowledge bases',\n });\n const providers = useLLMProviders();\n const channels = useChannelOverview();\n\n const state: GettingStartedState = {\n hasKnowledge: knowledge.data,\n hasModel: providers.data.length > 0,\n hasAgent,\n hasBot,\n hasChannel: (channels.data?.connectorCount ?? 0) > 0,\n // A member who cannot read runs cannot see this step's result, so it is\n // left out (below) rather than blocking the checklist forever.\n hasRun: hasRun ?? true,\n };\n\n // A finished setup has nothing to suggest.\n if (isSetupComplete(state)) return null;\n\n const steps: NextStep[] = [\n {\n id: 'knowledge',\n label: t('botlit.dashboard.gettingStarted.knowledge', 'Add knowledge'),\n description: t(\n 'botlit.dashboard.gettingStarted.knowledgeDesc',\n 'Upload the documents and FAQs your bot should answer from.'\n ),\n icon: <BookOpen size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('knowledge/new'),\n done: state.hasKnowledge,\n },\n {\n id: 'model',\n label: t('botlit.dashboard.gettingStarted.model', 'Connect a model provider'),\n description: t(\n 'botlit.dashboard.gettingStarted.modelDesc',\n 'Add the LLM provider and key your agents use to reply.'\n ),\n icon: <KeyRound size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('settings'),\n done: state.hasModel,\n },\n {\n id: 'agent',\n label: t('botlit.dashboard.gettingStarted.agent', 'Create an agent'),\n description: t(\n 'botlit.dashboard.gettingStarted.agentDesc',\n 'Give it a model, instructions and your knowledge.'\n ),\n icon: <Bot size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('agents/new'),\n done: state.hasAgent,\n },\n {\n id: 'bot',\n label: t('botlit.dashboard.gettingStarted.bot', 'Create a bot'),\n description: t(\n 'botlit.dashboard.gettingStarted.botDesc',\n 'Wrap your agent in a bot that people can talk to.'\n ),\n icon: <AppWindow size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('bots/new'),\n done: state.hasBot,\n },\n {\n id: 'channel',\n label: t('botlit.dashboard.gettingStarted.channel', 'Connect a channel'),\n description: t(\n 'botlit.dashboard.gettingStarted.channelDesc',\n 'Put the bot on a website widget, Slack, Teams or another channel.'\n ),\n icon: <Radio size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('channels/new'),\n done: state.hasChannel,\n },\n {\n id: 'test',\n label: t('botlit.dashboard.gettingStarted.test', 'Try it in chat'),\n description: t(\n 'botlit.dashboard.gettingStarted.testDesc',\n 'Send a first message and check the answer end to end.'\n ),\n icon: <MessageSquare size={16} aria-hidden=\"true\" />,\n onClick: () => navigateTo('chat'),\n done: state.hasRun,\n },\n ].filter((step) => step.id !== 'test' || canReadRuns);\n\n return (\n <div data-tour=\"botmanor-dashboard-getting-started\" data-testid=\"getting-started-checklist\">\n <NextSteps\n title={t('botlit.dashboard.gettingStarted.title', 'Get your first bot live')}\n storageKey={`botmanor-getting-started-${workspaceId ?? 'none'}`}\n steps={steps}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA0CA,IAAaA,KAA6D,MAAU;CAClF,IAAMC,IACJC,EAA8BC,EAAqB,UAAU,MAAM,WAC/DC,IACJF,EAA8BC,EAAqB,cAAc,MAAM;CAEzE,OADKF,IACEG,IACL,kBAACC,GAAD,EAAmB,GAAIC,EAAQ,CAAA,IAE/B,kBAACC,GAAD;EAAe,GAAID;EAAO,QAAQ;CAAO,CAAA,IAJhB;AAM7B,GAGMD,KAAuD,MAAU;CACrE,IAAMG,IAAOC,EAAoB;CACjC,OAAO,kBAACF,GAAD;EAAe,GAAID;EAAO,SAASE,EAAK,MAAM,SAAS,KAAK;CAAI,CAAA;AACzE,GAEMD,KAKD,EAAE,WAAQ,aAAU,gBAAa;CACpC,IAAMG,IAAIC,EAAM,GACV,EAAE,kBAAeC,EAAU,GAC3BC,IAAcC,EAAe,GAC7BV,IAAcW,MAAW,MAEzBC,IAAqBC,SAAe,EAAE,SAAS,EAAE,eAAY,EAAE,IAAI,CAACJ,CAAW,CAAC,GAChFK,IAAYC,EAAiE;EACjF,UAAUC;EACV,WAAWJ;EACX,SAAS,OAAUK,GAAM,+BAA+B,SAAS,KAAK;EACtE,UAAU;EACV,SAAS,EAAQR;EACjB,cAAc;CAChB,CAAC,GACKS,IAAYC,EAAgB,GAC5BC,I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AAE,wCAAwC,gBAAgB;GACjE,aAAaA,EACX,4CACA,uDACF;GACA,MAAM,kBAACyB,GAAD;IAAe,MAAM;IAAI,eAAY;GAAQ,CAAA;GACnD,eAAeL,EAAW,MAAM;GAChC,MAAMJ,EAAM;EACd;CACF,CAAC,CAAC,QAAQ,MAASU,EAAK,OAAO,UAAUhC,CAAW;CAEpD,OACE,kBAAC,OAAD;EAAK,aAAU;EAAqC,eAAY;EAC9D,UAAA,kBAACiC,GAAD;GACE,OAAO3B,EAAE,yCAAyC,yBAAyB;GAC3E,YAAY,4BAA4BG,KAAe;GAChD;EACR,CAAA;CACE,CAAA;AAET"}
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ export declare const StewardApprovalsInbox: FC<{
3
+ onOpenAgent: (agentId: string) => void;
4
+ }>;
@@ -0,0 +1,419 @@
1
+ import { useTr as e } from "../../shared/hooks/useTr.js";
2
+ import { Badge as t } from "./Badge.js";
3
+ import { BOTMANOR_PERMISSIONS as n } from "../permissions/botmanorPermissions.js";
4
+ import { BotmanorPermissionGate as r } from "../permissions/useBotmanorPermissions.js";
5
+ import { Button as i } from "./Button.js";
6
+ import { EmptyState as a } from "./EmptyState.js";
7
+ import { ErrorState as o } from "./ErrorState.js";
8
+ import { useDecideToolApproval as s, useToolApprovals as c } from "../hooks/useToolApprovals.js";
9
+ import { cn as l } from "../utils/cn.js";
10
+ import { APPROVAL_SCOPES as u, RULE_SCOPE_DAYS as d, argumentLines as f, availableScopes as p, countBySource as m, decisionNeedsNote as h, defaultScope as g, fixedDefaultLabel as _, isRuleScope as v, shortHash as y, stewardOptions as b, timeLeft as x } from "../utils/stewardApprovals.js";
11
+ import "../permissions/index.js";
12
+ import { useEffect as S, useMemo as C, useState as w } from "react";
13
+ import { Textarea as T, ThemedSelect as E } from "@burdenoff/fe-libs/ui";
14
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
15
+ import { CheckCircle2 as A, Inbox as j, Lock as M, ShieldAlert as N, XCircle as P } from "lucide-react";
16
+ import { toast as F } from "sonner";
17
+ // src/botlit/components/StewardApprovalsInbox.tsx
18
+ var I = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", L = "h-9 rounded-md border border-border-default bg-bg-surface px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", R = ({ active: e, onClick: t, children: n }) => /* @__PURE__ */ O("button", {
19
+ type: "button",
20
+ "aria-pressed": e,
21
+ onClick: t,
22
+ className: l(I, e ? "border-primary bg-bg-sunken text-text-primary" : "border-border-subtle text-text-secondary hover:text-text-primary"),
23
+ children: n
24
+ }), z = ({ onOpenAgent: n }) => {
25
+ let r = e(), [u, f] = w("ALL"), [p, h] = w(""), [g, _] = w(!1), [v, y] = w("PENDING"), [T, D] = w(null), [A, M] = w(50);
26
+ S(() => {
27
+ M(50);
28
+ }, [
29
+ u,
30
+ p,
31
+ g,
32
+ v
33
+ ]);
34
+ let N = u === "ALL" ? void 0 : u, P = v === "PENDING" ? "PENDING" : void 0, I = !!(N || p), z = c({
35
+ status: P,
36
+ mine: g
37
+ }, { limit: A }), V = c({
38
+ status: P,
39
+ mine: g,
40
+ source: N,
41
+ stewardId: p || void 0
42
+ }, {
43
+ limit: A,
44
+ enabled: I
45
+ }), H = I ? V : z, { decide: U, pendingId: W } = s(), G = (e) => v === "PENDING" ? e : e.filter((e) => e.status !== "PENDING"), K = C(() => G(z.data), [z.data, v]), q = m(K), J = C(() => b(K), [K]), Y = C(() => G(H.data), [H.data, v]), X = H.data.length >= A, Z = async () => {
46
+ await Promise.all([z.refetch(), I ? V.refetch() : void 0]);
47
+ }, Q = Y.find((e) => e.id === T) ?? Y[0] ?? null;
48
+ return /* @__PURE__ */ k("div", {
49
+ className: "space-y-4",
50
+ "data-testid": "steward-approvals-inbox",
51
+ children: [
52
+ /* @__PURE__ */ k("div", {
53
+ className: "flex flex-wrap items-center gap-3",
54
+ children: [
55
+ /* @__PURE__ */ k("div", {
56
+ className: "flex flex-wrap items-center gap-2",
57
+ role: "group",
58
+ "aria-label": "Source",
59
+ children: [
60
+ /* @__PURE__ */ O("span", {
61
+ className: "text-sm text-text-secondary",
62
+ children: r("botlit.stewardApprovals.filter.source", "Source")
63
+ }),
64
+ /* @__PURE__ */ O(R, {
65
+ active: u === "ALL",
66
+ onClick: () => f("ALL"),
67
+ children: `${r("botlit.stewardApprovals.filter.all", "All")} (${q.all})`
68
+ }),
69
+ /* @__PURE__ */ O(R, {
70
+ active: u === "AGENT_CHAT",
71
+ onClick: () => f("AGENT_CHAT"),
72
+ children: `${r("botlit.stewardApprovals.source.agentChat", "Agent chat")} (${q.agentChat})`
73
+ }),
74
+ /* @__PURE__ */ O(R, {
75
+ active: u === "STEWARD",
76
+ onClick: () => f("STEWARD"),
77
+ children: `${r("botlit.stewardApprovals.source.steward", "Steward")} (${q.steward})`
78
+ })
79
+ ]
80
+ }),
81
+ /* @__PURE__ */ k("div", {
82
+ className: "flex flex-wrap items-center gap-2",
83
+ children: [/* @__PURE__ */ O(R, {
84
+ active: g,
85
+ onClick: () => _((e) => !e),
86
+ children: r("botlit.stewardApprovals.filter.mine", "Only mine")
87
+ }), /* @__PURE__ */ k(E, {
88
+ className: L,
89
+ "aria-label": r("botlit.stewardApprovals.filter.steward", "Steward"),
90
+ value: p,
91
+ onChange: (e) => h(e.target.value),
92
+ disabled: J.length === 0,
93
+ children: [/* @__PURE__ */ O("option", {
94
+ value: "",
95
+ children: r("botlit.stewardApprovals.filter.allStewards", "All stewards")
96
+ }), J.map((e) => /* @__PURE__ */ O("option", {
97
+ value: e.id,
98
+ children: e.label
99
+ }, e.id))]
100
+ })]
101
+ }),
102
+ /* @__PURE__ */ O("div", {
103
+ className: "ml-auto",
104
+ children: /* @__PURE__ */ O(i, {
105
+ variant: "outline",
106
+ size: "sm",
107
+ "aria-pressed": v === "DECIDED",
108
+ onClick: () => y(v === "PENDING" ? "DECIDED" : "PENDING"),
109
+ children: v === "PENDING" ? r("botlit.stewardApprovals.history", "History") : r("botlit.stewardApprovals.backToPending", "Back to pending")
110
+ })
111
+ })
112
+ ]
113
+ }),
114
+ H.error ? /* @__PURE__ */ O(o, {
115
+ resource: r("botlit.toolApprovals.resource", "tool approvals"),
116
+ error: H.error,
117
+ onRetry: () => void H.refetch()
118
+ }) : H.loading && H.data.length === 0 ? /* @__PURE__ */ O("div", { className: "h-48 rounded-lg bg-bg-sunken motion-safe:animate-vc-shimmer" }) : Y.length === 0 ? /* @__PURE__ */ O(a, {
119
+ icon: /* @__PURE__ */ O(j, { size: 32 }),
120
+ title: v === "PENDING" ? r("botlit.stewardApprovals.empty.title", "Nothing is waiting for you") : r("botlit.stewardApprovals.empty.historyTitle", "No decisions yet"),
121
+ description: r("botlit.stewardApprovals.empty.description", "Tool calls from agent chats and stewards that need a person appear here.")
122
+ }) : /* @__PURE__ */ k("div", {
123
+ className: "grid gap-4 lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]",
124
+ children: [/* @__PURE__ */ O("ul", {
125
+ className: "space-y-2",
126
+ "aria-label": r("botlit.stewardApprovals.listLabel", "Approval requests"),
127
+ "data-testid": "steward-approvals-list",
128
+ children: Y.map((e) => {
129
+ let n = e.source === "STEWARD", i = Q?.id === e.id;
130
+ return /* @__PURE__ */ O("li", { children: /* @__PURE__ */ k("button", {
131
+ type: "button",
132
+ "aria-current": i ? "true" : void 0,
133
+ onClick: () => D(e.id),
134
+ "data-testid": `steward-approval-row-${e.id}`,
135
+ className: l("w-full rounded-lg border p-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", i ? "border-primary bg-bg-sunken" : "border-border-subtle"),
136
+ children: [/* @__PURE__ */ k("div", {
137
+ className: "flex flex-wrap items-center gap-2",
138
+ children: [
139
+ /* @__PURE__ */ O(t, {
140
+ variant: n ? "default" : "outline",
141
+ children: n ? r("botlit.stewardApprovals.source.steward", "Steward") : r("botlit.stewardApprovals.source.agentChat", "Agent chat")
142
+ }),
143
+ /* @__PURE__ */ O("span", {
144
+ className: "font-medium",
145
+ children: e.agentName ?? e.agentId
146
+ }),
147
+ e.fixedDefault && /* @__PURE__ */ O(t, {
148
+ variant: "warning",
149
+ children: r("botlit.stewardApprovals.alwaysAsks", "Always asks")
150
+ }),
151
+ /* @__PURE__ */ O("span", {
152
+ className: "ml-auto text-xs text-text-secondary",
153
+ children: e.status === "PENDING" ? x(e.expiresAt) : e.status
154
+ })
155
+ ]
156
+ }), /* @__PURE__ */ k("p", {
157
+ className: "mt-1 break-all font-mono text-xs text-text-secondary",
158
+ children: [e.toolName, e.destination ? ` → ${e.destination}` : ""]
159
+ })]
160
+ }) }, e.id);
161
+ })
162
+ }), Q && /* @__PURE__ */ O("section", {
163
+ className: "space-y-4 rounded-lg border border-border-subtle p-4",
164
+ "aria-label": r("botlit.stewardApprovals.detailLabel", "Request details"),
165
+ "data-testid": "steward-approval-detail",
166
+ children: /* @__PURE__ */ O(B, {
167
+ request: Q,
168
+ busy: W === Q.id,
169
+ scopeLabel: (e) => {
170
+ switch (e) {
171
+ case "ONCE": return r("botlit.stewardApprovals.scope.once", "Once");
172
+ case "RUN": return r("botlit.stewardApprovals.scope.run", "This run");
173
+ case "DUTY": return r("botlit.stewardApprovals.scope.duty", "This duty");
174
+ case "TIME_LIMITED": return r("botlit.stewardApprovals.scope.timeLimited", "Time-limited");
175
+ case "STANDING": return r("botlit.stewardApprovals.scope.standing", "Standing rule");
176
+ }
177
+ },
178
+ scopeHint: (e) => {
179
+ switch (e) {
180
+ case "ONCE": return r("botlit.stewardApprovals.hint.once", "Only this call");
181
+ case "RUN": return r("botlit.stewardApprovals.hint.run", "The same tool, destination and purpose for the rest of this run");
182
+ case "DUTY": return r("botlit.stewardApprovals.hint.duty", "Creates a rule for runs of this duty, same tool, destination and purpose");
183
+ case "TIME_LIMITED": return r("botlit.stewardApprovals.hint.timeLimited", "Creates a rule for {days} days, same tool, destination and purpose").replace("{days}", String(d.TIME_LIMITED));
184
+ case "STANDING": return r("botlit.stewardApprovals.hint.standing", "Creates a rule for {days} days, same tool, destination and purpose").replace("{days}", String(d.STANDING));
185
+ }
186
+ },
187
+ onOpenAgent: n,
188
+ onDecide: async (e, t, n) => {
189
+ try {
190
+ await U(Q.id, e, t, n), F.success(e === "APPROVE" ? r("botlit.stewardApprovals.toast.approved", "Approved") : r("botlit.stewardApprovals.toast.denied", "Denied")), await Z();
191
+ } catch (e) {
192
+ F.error(e instanceof Error ? e.message : r("botlit.toolApprovals.toast.error", "Could not record the decision"));
193
+ }
194
+ }
195
+ }, Q.id)
196
+ })]
197
+ }),
198
+ X && !H.error ? /* @__PURE__ */ O("div", {
199
+ className: "flex justify-center",
200
+ children: /* @__PURE__ */ O(i, {
201
+ variant: "outline",
202
+ size: "sm",
203
+ disabled: H.loading,
204
+ onClick: () => M((e) => e + 50),
205
+ children: r("botlit.stewardApprovals.loadMore", "Load more")
206
+ })
207
+ }) : null
208
+ ]
209
+ });
210
+ }, B = ({ request: a, busy: o, scopeLabel: s, scopeHint: c, onOpenAgent: d, onDecide: m }) => {
211
+ let b = e(), S = a.source === "STEWARD", C = a.status === "PENDING", E = p(a), [j, F] = w(g(a, a.requestedScope)), [I, L] = w(""), R = y(a.argumentsHash), z = f(a.arguments), B = !!a.fixedDefault && E.every((e) => !v(e));
212
+ return /* @__PURE__ */ k(D, { children: [
213
+ /* @__PURE__ */ k("div", {
214
+ className: "flex flex-wrap items-start justify-between gap-2",
215
+ children: [/* @__PURE__ */ k("h2", {
216
+ className: "text-lg font-semibold",
217
+ children: [
218
+ /* @__PURE__ */ O("button", {
219
+ type: "button",
220
+ className: "text-primary hover:underline",
221
+ onClick: () => d(a.agentId),
222
+ children: a.agentName ?? a.agentId
223
+ }),
224
+ " ",
225
+ "· ",
226
+ /* @__PURE__ */ O("code", {
227
+ className: "font-mono text-base",
228
+ children: a.toolName
229
+ })
230
+ ]
231
+ }), C && /* @__PURE__ */ O(t, {
232
+ variant: "warning",
233
+ children: x(a.expiresAt) === "expired" ? b("botlit.stewardApprovals.expired", "Expired") : `${b("botlit.stewardApprovals.expiresIn", "Expires in")} ${x(a.expiresAt)}`
234
+ })]
235
+ }),
236
+ a.fixedDefault && /* @__PURE__ */ k("div", {
237
+ className: "flex items-start gap-2 rounded-md border border-border-subtle bg-bg-sunken p-3 text-sm",
238
+ "data-testid": "fixed-default-notice",
239
+ children: [/* @__PURE__ */ O(M, {
240
+ size: 16,
241
+ className: "mt-0.5 shrink-0",
242
+ "aria-hidden": "true"
243
+ }), /* @__PURE__ */ k("p", { children: [
244
+ /* @__PURE__ */ k("span", {
245
+ className: "font-medium",
246
+ children: [_(a.fixedDefault), "."]
247
+ }),
248
+ " ",
249
+ B ? b("botlit.stewardApprovals.fixedDefault.locked", "This kind of call always goes to a person. It can be approved once or for this run, never as a standing rule.") : b("botlit.stewardApprovals.fixedDefault.exception", "This kind of call always goes to a person. A rule is possible only because it names an exact recipient and purpose.")
250
+ ] })]
251
+ }),
252
+ S && /* @__PURE__ */ k("div", {
253
+ className: "rounded-md border border-border-subtle bg-bg-sunken p-3 text-sm",
254
+ children: [
255
+ /* @__PURE__ */ k("p", {
256
+ className: "flex items-center gap-2 font-medium",
257
+ children: [
258
+ /* @__PURE__ */ O(N, {
259
+ size: 14,
260
+ "aria-hidden": "true"
261
+ }),
262
+ b("botlit.stewardApprovals.reviewer", "Reviewer model note"),
263
+ a.reviewerVerdict && /* @__PURE__ */ O(t, {
264
+ variant: "outline",
265
+ children: a.reviewerVerdict
266
+ })
267
+ ]
268
+ }),
269
+ a.charterCitation ? /* @__PURE__ */ k("p", {
270
+ className: "mt-1 break-words",
271
+ children: [
272
+ b("botlit.stewardApprovals.ownerSaid", "Owner said:"),
273
+ " ",
274
+ /* @__PURE__ */ k("em", { children: [
275
+ "“",
276
+ a.charterCitation,
277
+ "”"
278
+ ] })
279
+ ]
280
+ }) : /* @__PURE__ */ O("p", {
281
+ className: "mt-1 text-text-secondary",
282
+ children: b("botlit.stewardApprovals.noCitation", "No verified quote of the owner supports this call.")
283
+ }),
284
+ a.reviewerNote && /* @__PURE__ */ O("p", {
285
+ className: "mt-1 break-words",
286
+ children: a.reviewerNote
287
+ })
288
+ ]
289
+ }),
290
+ a.purpose && /* @__PURE__ */ k("p", {
291
+ className: "text-sm",
292
+ children: [/* @__PURE__ */ k("span", {
293
+ className: "text-text-secondary",
294
+ children: [b("botlit.stewardApprovals.purpose", "Purpose:"), " "]
295
+ }), a.purpose]
296
+ }),
297
+ /* @__PURE__ */ k("div", { children: [
298
+ /* @__PURE__ */ k("p", {
299
+ className: "mb-1 text-xs text-text-secondary",
300
+ children: [b("botlit.stewardApprovals.arguments", "Exact arguments"), S && ` · ${b("botlit.stewardApprovals.argumentsProvenance", "written by the steward model, not verified")}`]
301
+ }),
302
+ /* @__PURE__ */ O("dl", {
303
+ className: "max-h-48 overflow-auto rounded-md bg-bg-sunken p-2 font-mono text-xs",
304
+ "data-testid": "steward-approval-arguments",
305
+ children: z.length === 0 ? /* @__PURE__ */ O("dd", {
306
+ className: "text-text-secondary",
307
+ children: "{}"
308
+ }) : z.map((e) => /* @__PURE__ */ k("div", {
309
+ className: "flex gap-2",
310
+ children: [/* @__PURE__ */ k("dt", {
311
+ className: "shrink-0 text-text-secondary",
312
+ children: [e.key, ":"]
313
+ }), /* @__PURE__ */ O("dd", {
314
+ className: "break-all",
315
+ children: e.value
316
+ })]
317
+ }, e.key))
318
+ }),
319
+ R && /* @__PURE__ */ k("p", {
320
+ className: "mt-1 text-xs text-text-secondary",
321
+ children: [
322
+ b("botlit.stewardApprovals.hash", "Argument hash"),
323
+ " ",
324
+ /* @__PURE__ */ O("code", {
325
+ className: "font-mono",
326
+ children: R
327
+ }),
328
+ " ·",
329
+ " ",
330
+ b("botlit.stewardApprovals.hashBinds", "approval binds to this hash")
331
+ ]
332
+ })
333
+ ] }),
334
+ !C && /* @__PURE__ */ k("div", {
335
+ className: "space-y-1 text-sm",
336
+ "data-testid": "steward-approval-outcome",
337
+ children: [
338
+ /* @__PURE__ */ k("p", { children: [
339
+ /* @__PURE__ */ O(t, {
340
+ variant: a.status === "APPROVED" ? "success" : "outline",
341
+ children: a.status
342
+ }),
343
+ " ",
344
+ a.grantedScope && `${b("botlit.stewardApprovals.grantedScope", "Scope")}: ${s(a.grantedScope)}`
345
+ ] }),
346
+ a.decisionNote && /* @__PURE__ */ O("p", {
347
+ className: "break-words",
348
+ children: a.decisionNote
349
+ }),
350
+ a.createdRuleId && /* @__PURE__ */ O("p", {
351
+ className: "text-text-secondary",
352
+ children: b("botlit.stewardApprovals.ruleCreated", "A standing rule was created from this approval.")
353
+ })
354
+ ]
355
+ }),
356
+ C && /* @__PURE__ */ O(r, {
357
+ permission: n.AGENT_APPROVE,
358
+ fallback: /* @__PURE__ */ O("p", {
359
+ className: "text-sm text-text-secondary",
360
+ "data-testid": "approve-forbidden",
361
+ children: b("botlit.stewardApprovals.forbidden", "You can see this request but you do not have permission to decide it.")
362
+ }),
363
+ children: /* @__PURE__ */ k("div", {
364
+ className: "space-y-4",
365
+ children: [
366
+ S && /* @__PURE__ */ k("fieldset", {
367
+ className: "space-y-2",
368
+ children: [/* @__PURE__ */ O("legend", {
369
+ className: "mb-1 text-xs text-text-secondary",
370
+ children: b("botlit.stewardApprovals.approveFor", "Approve for")
371
+ }), u.filter((e) => E.includes(e)).map((e) => /* @__PURE__ */ k("label", {
372
+ className: l("flex cursor-pointer items-start gap-3 rounded-md border p-2 text-sm", j === e ? "border-primary" : "border-border-subtle"),
373
+ children: [/* @__PURE__ */ O("input", {
374
+ type: "radio",
375
+ name: `scope-${a.id}`,
376
+ className: "mt-1 shrink-0 accent-primary",
377
+ checked: j === e,
378
+ onChange: () => F(e)
379
+ }), /* @__PURE__ */ k("span", { children: [/* @__PURE__ */ O("span", {
380
+ className: "font-medium",
381
+ children: s(e)
382
+ }), /* @__PURE__ */ O("span", {
383
+ className: "block text-xs text-text-secondary",
384
+ children: c(e)
385
+ })] })]
386
+ }, e))]
387
+ }),
388
+ /* @__PURE__ */ O(T, {
389
+ "aria-label": b("botlit.stewardApprovals.denyNote", "Deny note (required to deny)"),
390
+ value: I,
391
+ maxLength: 2e3,
392
+ onChange: (e) => L(e.target.value),
393
+ placeholder: b("botlit.stewardApprovals.denyPlaceholder", "Why is this denied?"),
394
+ rows: 2
395
+ }),
396
+ /* @__PURE__ */ k("div", {
397
+ className: "flex justify-end gap-2",
398
+ children: [/* @__PURE__ */ O(i, {
399
+ variant: "destructive",
400
+ leftIcon: /* @__PURE__ */ O(P, { size: 14 }),
401
+ disabled: o || h("DENY", I),
402
+ title: h("DENY", I) ? b("botlit.stewardApprovals.denyNeedsNote", "Add a reason to deny") : void 0,
403
+ onClick: () => void m("DENY", I, void 0),
404
+ children: b("botlit.toolApprovals.deny", "Deny")
405
+ }), /* @__PURE__ */ O(i, {
406
+ leftIcon: /* @__PURE__ */ O(A, { size: 14 }),
407
+ isLoading: o,
408
+ onClick: () => void m("APPROVE", I, S ? j : void 0),
409
+ children: S ? `${b("botlit.toolApprovals.approve", "Approve")} — ${s(j).toLowerCase()}` : b("botlit.toolApprovals.approve", "Approve")
410
+ })]
411
+ })
412
+ ]
413
+ })
414
+ })
415
+ ] });
416
+ };
417
+ export { z as StewardApprovalsInbox };
418
+
419
+ //# sourceMappingURL=StewardApprovalsInbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StewardApprovalsInbox.js","names":["EmptyState","_Fragment","EmptyState$1","Fragment$1","CHIP_BASE","SELECT_CLASS","Chip","active","cn","StewardApprovalsInbox","t","useTr","source","setSource","useState","stewardId","setStewardId","mine","setMine","view","setView","selectedId","setSelectedId","limit","setLimit","sourceFilter","statusFilter","filtered","overview","useToolApprovals","filteredQueue","queue","useDecideToolApproval","decidedOnly","list","row","base","useMemo","counts","countBySource","stewards","stewardOptions","rows","canLoadMore","refetchAll","selected","value","ThemedSelect","event","option","Button","ErrorState","Inbox","isSteward","Badge","timeLeft","ApprovalDetail","pendingId","scope","RULE_SCOPE_DAYS","decide","decision","note","toast","err","request","pending","scopes","availableScopes","setScope","defaultScope","setNote","hash","shortHash","lines","argumentLines","lockedOut","isRuleScope","item","onOpenAgent","Lock","fixedDefaultLabel","ShieldAlert","line","scopeLabel","BotmanorPermissionGate","BOTMANOR_PERMISSIONS","APPROVAL_SCOPES","scopeHint","Textarea","XCircle","busy","decisionNeedsNote","onDecide","CheckCircle2"],"sources":["../../../src/botlit/components/StewardApprovalsInbox.tsx"],"sourcesContent":["/**\n * Steward approvals inbox (BOFF-16146 C3.3, mockup 31)\n * @module botlit/components\n *\n * The Steward-aware view of the tool approvals queue from BOFF-15360. One list\n * for calls from agent chats and from stewards, a source filter, a steward\n * filter and a \"mine\" filter. A steward request shows the exact arguments, the\n * reviewer's verified quote of the owner's own words, and the scope the\n * reviewer is approving (once, this run, this duty, time-limited, standing).\n * Fixed defaults (password, payment, one-time code, message outside the\n * workspace) never offer a standing rule. The service enforces all of this\n * again; the screen only avoids offering a choice it would refuse.\n */\n\nimport { useEffect, useMemo, useState, type FC } from 'react';\nimport { CheckCircle2, Inbox, Lock, ShieldAlert, XCircle } from 'lucide-react';\nimport { toast } from 'sonner';\nimport { Textarea, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { Badge } from './Badge';\nimport { Button } from './Button';\nimport { EmptyState } from './EmptyState';\nimport { ErrorState } from './ErrorState';\nimport {\n useDecideToolApproval,\n useToolApprovals,\n TOOL_APPROVALS_PAGE_SIZE,\n type ToolApprovalRecord,\n type ToolApprovalSource,\n} from '../hooks/useToolApprovals';\nimport { cn } from '../utils/cn';\nimport {\n APPROVAL_SCOPES,\n RULE_SCOPE_DAYS,\n argumentLines,\n availableScopes,\n countBySource,\n decisionNeedsNote,\n defaultScope,\n fixedDefaultLabel,\n isRuleScope,\n shortHash,\n stewardOptions,\n timeLeft,\n type ApprovalScope,\n} from '../utils/stewardApprovals';\nimport { BOTMANOR_PERMISSIONS, BotmanorPermissionGate } from '../permissions';\n\ntype SourceFilter = 'ALL' | ToolApprovalSource;\ntype View = 'PENDING' | 'DECIDED';\n\nconst CHIP_BASE =\n 'rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]';\nconst SELECT_CLASS =\n 'h-9 rounded-md border border-border-default bg-bg-surface px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]';\n\nconst Chip: FC<{ active: boolean; onClick: () => void; children: string }> = ({\n active,\n onClick,\n children,\n}) => (\n <button\n type=\"button\"\n aria-pressed={active}\n onClick={onClick}\n className={cn(\n CHIP_BASE,\n active\n ? 'border-primary bg-bg-sunken text-text-primary'\n : 'border-border-subtle text-text-secondary hover:text-text-primary'\n )}\n >\n {children}\n </button>\n);\n\nexport const StewardApprovalsInbox: FC<{ onOpenAgent: (agentId: string) => void }> = ({\n onOpenAgent,\n}) => {\n const t = useTr();\n const [source, setSource] = useState<SourceFilter>('ALL');\n const [stewardId, setStewardId] = useState('');\n const [mine, setMine] = useState(false);\n const [view, setView] = useState<View>('PENDING');\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n const [limit, setLimit] = useState(TOOL_APPROVALS_PAGE_SIZE);\n useEffect(() => {\n setLimit(TOOL_APPROVALS_PAGE_SIZE);\n }, [source, stewardId, mine, view]);\n const sourceFilter = source === 'ALL' ? undefined : source;\n const statusFilter = view === 'PENDING' ? 'PENDING' : undefined;\n const filtered = Boolean(sourceFilter || stewardId);\n\n // Unfiltered by source and steward, so the chip counts and the steward list\n // stay complete while a filter is applied.\n const overview = useToolApprovals({ status: statusFilter, mine }, { limit });\n // The service applies the source and steward filters, so a match past the\n // first page is not hidden by a client-side filter.\n const filteredQueue = useToolApprovals(\n { status: statusFilter, mine, source: sourceFilter, stewardId: stewardId || undefined },\n { limit, enabled: filtered }\n );\n const queue = filtered ? filteredQueue : overview;\n const { decide, pendingId } = useDecideToolApproval();\n\n const decidedOnly = (list: ToolApprovalRecord[]) =>\n view === 'PENDING' ? list : list.filter((row) => row.status !== 'PENDING');\n const base = useMemo(() => decidedOnly(overview.data), [overview.data, view]);\n const counts = countBySource(base);\n const stewards = useMemo(() => stewardOptions(base), [base]);\n const rows = useMemo(() => decidedOnly(queue.data), [queue.data, view]);\n const canLoadMore = queue.data.length >= limit;\n const refetchAll = async () => {\n await Promise.all([overview.refetch(), filtered ? filteredQueue.refetch() : undefined]);\n };\n const selected = rows.find((row) => row.id === selectedId) ?? rows[0] ?? null;\n\n const scopeLabel = (scope: ApprovalScope): string => {\n switch (scope) {\n case 'ONCE':\n return t('botlit.stewardApprovals.scope.once', 'Once');\n case 'RUN':\n return t('botlit.stewardApprovals.scope.run', 'This run');\n case 'DUTY':\n return t('botlit.stewardApprovals.scope.duty', 'This duty');\n case 'TIME_LIMITED':\n return t('botlit.stewardApprovals.scope.timeLimited', 'Time-limited');\n case 'STANDING':\n return t('botlit.stewardApprovals.scope.standing', 'Standing rule');\n }\n };\n\n const scopeHint = (scope: ApprovalScope): string => {\n switch (scope) {\n case 'ONCE':\n return t('botlit.stewardApprovals.hint.once', 'Only this call');\n case 'RUN':\n return t(\n 'botlit.stewardApprovals.hint.run',\n 'The same tool, destination and purpose for the rest of this run'\n );\n case 'DUTY':\n return t(\n 'botlit.stewardApprovals.hint.duty',\n 'Creates a rule for runs of this duty, same tool, destination and purpose'\n );\n case 'TIME_LIMITED':\n return t(\n 'botlit.stewardApprovals.hint.timeLimited',\n 'Creates a rule for {days} days, same tool, destination and purpose'\n ).replace('{days}', String(RULE_SCOPE_DAYS.TIME_LIMITED));\n case 'STANDING':\n return t(\n 'botlit.stewardApprovals.hint.standing',\n 'Creates a rule for {days} days, same tool, destination and purpose'\n ).replace('{days}', String(RULE_SCOPE_DAYS.STANDING));\n }\n };\n\n return (\n <div className=\"space-y-4\" data-testid=\"steward-approvals-inbox\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <div className=\"flex flex-wrap items-center gap-2\" role=\"group\" aria-label=\"Source\">\n <span className=\"text-sm text-text-secondary\">\n {t('botlit.stewardApprovals.filter.source', 'Source')}\n </span>\n <Chip active={source === 'ALL'} onClick={() => setSource('ALL')}>\n {`${t('botlit.stewardApprovals.filter.all', 'All')} (${counts.all})`}\n </Chip>\n <Chip active={source === 'AGENT_CHAT'} onClick={() => setSource('AGENT_CHAT')}>\n {`${t('botlit.stewardApprovals.source.agentChat', 'Agent chat')} (${counts.agentChat})`}\n </Chip>\n <Chip active={source === 'STEWARD'} onClick={() => setSource('STEWARD')}>\n {`${t('botlit.stewardApprovals.source.steward', 'Steward')} (${counts.steward})`}\n </Chip>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Chip active={mine} onClick={() => setMine((value) => !value)}>\n {t('botlit.stewardApprovals.filter.mine', 'Only mine')}\n </Chip>\n <ThemedSelect\n className={SELECT_CLASS}\n aria-label={t('botlit.stewardApprovals.filter.steward', 'Steward')}\n value={stewardId}\n onChange={(event) => setStewardId(event.target.value)}\n disabled={stewards.length === 0}\n >\n <option value=\"\">\n {t('botlit.stewardApprovals.filter.allStewards', 'All stewards')}\n </option>\n {stewards.map((option) => (\n <option key={option.id} value={option.id}>\n {option.label}\n </option>\n ))}\n </ThemedSelect>\n </div>\n <div className=\"ml-auto\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-pressed={view === 'DECIDED'}\n onClick={() => setView(view === 'PENDING' ? 'DECIDED' : 'PENDING')}\n >\n {view === 'PENDING'\n ? t('botlit.stewardApprovals.history', 'History')\n : t('botlit.stewardApprovals.backToPending', 'Back to pending')}\n </Button>\n </div>\n </div>\n\n {queue.error ? (\n <ErrorState\n resource={t('botlit.toolApprovals.resource', 'tool approvals')}\n error={queue.error}\n onRetry={() => void queue.refetch()}\n />\n ) : queue.loading && queue.data.length === 0 ? (\n <div className=\"h-48 rounded-lg bg-bg-sunken motion-safe:animate-vc-shimmer\" />\n ) : rows.length === 0 ? (\n <EmptyState\n icon={<Inbox size={32} />}\n title={\n view === 'PENDING'\n ? t('botlit.stewardApprovals.empty.title', 'Nothing is waiting for you')\n : t('botlit.stewardApprovals.empty.historyTitle', 'No decisions yet')\n }\n description={t(\n 'botlit.stewardApprovals.empty.description',\n 'Tool calls from agent chats and stewards that need a person appear here.'\n )}\n />\n ) : (\n <div className=\"grid gap-4 lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]\">\n <ul\n className=\"space-y-2\"\n aria-label={t('botlit.stewardApprovals.listLabel', 'Approval requests')}\n data-testid=\"steward-approvals-list\"\n >\n {rows.map((row) => {\n const isSteward = row.source === 'STEWARD';\n const active = selected?.id === row.id;\n return (\n <li key={row.id}>\n <button\n type=\"button\"\n aria-current={active ? 'true' : undefined}\n onClick={() => setSelectedId(row.id)}\n data-testid={`steward-approval-row-${row.id}`}\n className={cn(\n 'w-full rounded-lg border p-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n active ? 'border-primary bg-bg-sunken' : 'border-border-subtle'\n )}\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant={isSteward ? 'default' : 'outline'}>\n {isSteward\n ? t('botlit.stewardApprovals.source.steward', 'Steward')\n : t('botlit.stewardApprovals.source.agentChat', 'Agent chat')}\n </Badge>\n <span className=\"font-medium\">{row.agentName ?? row.agentId}</span>\n {row.fixedDefault && (\n <Badge variant=\"warning\">\n {t('botlit.stewardApprovals.alwaysAsks', 'Always asks')}\n </Badge>\n )}\n <span className=\"ml-auto text-xs text-text-secondary\">\n {row.status === 'PENDING' ? timeLeft(row.expiresAt) : row.status}\n </span>\n </div>\n <p className=\"mt-1 break-all font-mono text-xs text-text-secondary\">\n {row.toolName}\n {row.destination ? ` → ${row.destination}` : ''}\n </p>\n </button>\n </li>\n );\n })}\n </ul>\n\n {selected && (\n <section\n className=\"space-y-4 rounded-lg border border-border-subtle p-4\"\n aria-label={t('botlit.stewardApprovals.detailLabel', 'Request details')}\n data-testid=\"steward-approval-detail\"\n >\n <ApprovalDetail\n key={selected.id}\n request={selected}\n busy={pendingId === selected.id}\n scopeLabel={scopeLabel}\n scopeHint={scopeHint}\n onOpenAgent={onOpenAgent}\n onDecide={async (decision, note, scope) => {\n try {\n await decide(selected.id, decision, note, scope);\n toast.success(\n decision === 'APPROVE'\n ? t('botlit.stewardApprovals.toast.approved', 'Approved')\n : t('botlit.stewardApprovals.toast.denied', 'Denied')\n );\n await refetchAll();\n } catch (err: unknown) {\n toast.error(\n err instanceof Error\n ? err.message\n : t('botlit.toolApprovals.toast.error', 'Could not record the decision')\n );\n }\n }}\n />\n </section>\n )}\n </div>\n )}\n {canLoadMore && !queue.error ? (\n <div className=\"flex justify-center\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={queue.loading}\n onClick={() => setLimit((value) => value + TOOL_APPROVALS_PAGE_SIZE)}\n >\n {t('botlit.stewardApprovals.loadMore', 'Load more')}\n </Button>\n </div>\n ) : null}\n </div>\n );\n};\n\ninterface ApprovalDetailProps {\n request: ToolApprovalRecord;\n busy: boolean;\n scopeLabel: (scope: ApprovalScope) => string;\n scopeHint: (scope: ApprovalScope) => string;\n onOpenAgent: (agentId: string) => void;\n onDecide: (\n decision: 'APPROVE' | 'DENY',\n note: string,\n scope: ApprovalScope | undefined\n ) => Promise<void>;\n}\n\nconst ApprovalDetail: FC<ApprovalDetailProps> = ({\n request,\n busy,\n scopeLabel,\n scopeHint,\n onOpenAgent,\n onDecide,\n}) => {\n const t = useTr();\n const isSteward = request.source === 'STEWARD';\n const pending = request.status === 'PENDING';\n const scopes = availableScopes(request);\n const [scope, setScope] = useState<ApprovalScope>(defaultScope(request, request.requestedScope));\n const [note, setNote] = useState('');\n const hash = shortHash(request.argumentsHash);\n const lines = argumentLines(request.arguments);\n const lockedOut = Boolean(request.fixedDefault) && scopes.every((item) => !isRuleScope(item));\n\n return (\n <>\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <h2 className=\"text-lg font-semibold\">\n <button\n type=\"button\"\n className=\"text-primary hover:underline\"\n onClick={() => onOpenAgent(request.agentId)}\n >\n {request.agentName ?? request.agentId}\n </button>{' '}\n · <code className=\"font-mono text-base\">{request.toolName}</code>\n </h2>\n {pending && (\n <Badge variant=\"warning\">\n {timeLeft(request.expiresAt) === 'expired'\n ? t('botlit.stewardApprovals.expired', 'Expired')\n : `${t('botlit.stewardApprovals.expiresIn', 'Expires in')} ${timeLeft(request.expiresAt)}`}\n </Badge>\n )}\n </div>\n\n {request.fixedDefault && (\n <div\n className=\"flex items-start gap-2 rounded-md border border-border-subtle bg-bg-sunken p-3 text-sm\"\n data-testid=\"fixed-default-notice\"\n >\n <Lock size={16} className=\"mt-0.5 shrink-0\" aria-hidden=\"true\" />\n <p>\n <span className=\"font-medium\">{fixedDefaultLabel(request.fixedDefault)}.</span>{' '}\n {lockedOut\n ? t(\n 'botlit.stewardApprovals.fixedDefault.locked',\n 'This kind of call always goes to a person. It can be approved once or for this run, never as a standing rule.'\n )\n : t(\n 'botlit.stewardApprovals.fixedDefault.exception',\n 'This kind of call always goes to a person. A rule is possible only because it names an exact recipient and purpose.'\n )}\n </p>\n </div>\n )}\n\n {isSteward && (\n <div className=\"rounded-md border border-border-subtle bg-bg-sunken p-3 text-sm\">\n <p className=\"flex items-center gap-2 font-medium\">\n <ShieldAlert size={14} aria-hidden=\"true\" />\n {t('botlit.stewardApprovals.reviewer', 'Reviewer model note')}\n {request.reviewerVerdict && <Badge variant=\"outline\">{request.reviewerVerdict}</Badge>}\n </p>\n {request.charterCitation ? (\n <p className=\"mt-1 break-words\">\n {t('botlit.stewardApprovals.ownerSaid', 'Owner said:')}{' '}\n <em>&ldquo;{request.charterCitation}&rdquo;</em>\n </p>\n ) : (\n <p className=\"mt-1 text-text-secondary\">\n {t(\n 'botlit.stewardApprovals.noCitation',\n 'No verified quote of the owner supports this call.'\n )}\n </p>\n )}\n {request.reviewerNote && <p className=\"mt-1 break-words\">{request.reviewerNote}</p>}\n </div>\n )}\n\n {request.purpose && (\n <p className=\"text-sm\">\n <span className=\"text-text-secondary\">\n {t('botlit.stewardApprovals.purpose', 'Purpose:')}{' '}\n </span>\n {request.purpose}\n </p>\n )}\n\n <div>\n <p className=\"mb-1 text-xs text-text-secondary\">\n {t('botlit.stewardApprovals.arguments', 'Exact arguments')}\n {isSteward &&\n ` · ${t('botlit.stewardApprovals.argumentsProvenance', 'written by the steward model, not verified')}`}\n </p>\n <dl\n className=\"max-h-48 overflow-auto rounded-md bg-bg-sunken p-2 font-mono text-xs\"\n data-testid=\"steward-approval-arguments\"\n >\n {lines.length === 0 ? (\n <dd className=\"text-text-secondary\">{'{}'}</dd>\n ) : (\n lines.map((line) => (\n <div key={line.key} className=\"flex gap-2\">\n <dt className=\"shrink-0 text-text-secondary\">{line.key}:</dt>\n <dd className=\"break-all\">{line.value}</dd>\n </div>\n ))\n )}\n </dl>\n {hash && (\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t('botlit.stewardApprovals.hash', 'Argument hash')}{' '}\n <code className=\"font-mono\">{hash}</code> ·{' '}\n {t('botlit.stewardApprovals.hashBinds', 'approval binds to this hash')}\n </p>\n )}\n </div>\n\n {!pending && (\n <div className=\"space-y-1 text-sm\" data-testid=\"steward-approval-outcome\">\n <p>\n <Badge variant={request.status === 'APPROVED' ? 'success' : 'outline'}>\n {request.status}\n </Badge>{' '}\n {request.grantedScope &&\n `${t('botlit.stewardApprovals.grantedScope', 'Scope')}: ${scopeLabel(request.grantedScope)}`}\n </p>\n {request.decisionNote && <p className=\"break-words\">{request.decisionNote}</p>}\n {request.createdRuleId && (\n <p className=\"text-text-secondary\">\n {t(\n 'botlit.stewardApprovals.ruleCreated',\n 'A standing rule was created from this approval.'\n )}\n </p>\n )}\n </div>\n )}\n\n {pending && (\n <BotmanorPermissionGate\n permission={BOTMANOR_PERMISSIONS.AGENT_APPROVE}\n fallback={\n <p className=\"text-sm text-text-secondary\" data-testid=\"approve-forbidden\">\n {t(\n 'botlit.stewardApprovals.forbidden',\n 'You can see this request but you do not have permission to decide it.'\n )}\n </p>\n }\n >\n <div className=\"space-y-4\">\n {isSteward && (\n <fieldset className=\"space-y-2\">\n <legend className=\"mb-1 text-xs text-text-secondary\">\n {t('botlit.stewardApprovals.approveFor', 'Approve for')}\n </legend>\n {APPROVAL_SCOPES.filter((item) => scopes.includes(item)).map((item) => (\n <label\n key={item}\n className={cn(\n 'flex cursor-pointer items-start gap-3 rounded-md border p-2 text-sm',\n scope === item ? 'border-primary' : 'border-border-subtle'\n )}\n >\n <input\n type=\"radio\"\n name={`scope-${request.id}`}\n className=\"mt-1 shrink-0 accent-primary\"\n checked={scope === item}\n onChange={() => setScope(item)}\n />\n <span>\n <span className=\"font-medium\">{scopeLabel(item)}</span>\n <span className=\"block text-xs text-text-secondary\">{scopeHint(item)}</span>\n </span>\n </label>\n ))}\n </fieldset>\n )}\n <Textarea\n aria-label={t('botlit.stewardApprovals.denyNote', 'Deny note (required to deny)')}\n value={note}\n maxLength={2000}\n onChange={(event) => setNote(event.target.value)}\n placeholder={t('botlit.stewardApprovals.denyPlaceholder', 'Why is this denied?')}\n rows={2}\n />\n <div className=\"flex justify-end gap-2\">\n <Button\n variant=\"destructive\"\n leftIcon={<XCircle size={14} />}\n disabled={busy || decisionNeedsNote('DENY', note)}\n title={\n decisionNeedsNote('DENY', note)\n ? t('botlit.stewardApprovals.denyNeedsNote', 'Add a reason to deny')\n : undefined\n }\n onClick={() => void onDecide('DENY', note, undefined)}\n >\n {t('botlit.toolApprovals.deny', 'Deny')}\n </Button>\n <Button\n leftIcon={<CheckCircle2 size={14} />}\n isLoading={busy}\n onClick={() => void onDecide('APPROVE', note, isSteward ? scope : undefined)}\n >\n {isSteward\n ? `${t('botlit.toolApprovals.approve', 'Approve')} — ${scopeLabel(scope).toLowerCase()}`\n : t('botlit.toolApprovals.approve', 'Approve')}\n </Button>\n </div>\n </div>\n </BotmanorPermissionGate>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;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