@burdenoff/microfe-botmanor 2026.1118.6 → 2026.1118.8

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 (43) hide show
  1. package/dist/botlit/components/AgentBindingsPanel.d.ts +4 -0
  2. package/dist/botlit/components/AgentBindingsPanel.js +305 -0
  3. package/dist/botlit/components/AgentBindingsPanel.js.map +1 -0
  4. package/dist/botlit/components/ChannelSelectorSheet.d.ts +9 -2
  5. package/dist/botlit/components/ChannelSelectorSheet.js.map +1 -1
  6. package/dist/botlit/hooks/index.d.ts +3 -1
  7. package/dist/botlit/hooks/index.js +14 -13
  8. package/dist/botlit/hooks/internal/globalWorkspaceScope.d.ts +15 -0
  9. package/dist/botlit/hooks/internal/globalWorkspaceScope.js +21 -0
  10. package/dist/botlit/hooks/internal/globalWorkspaceScope.js.map +1 -0
  11. package/dist/botlit/hooks/internal/workspaceGateway.d.ts +7 -0
  12. package/dist/botlit/hooks/internal/workspaceGateway.js +42 -22
  13. package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
  14. package/dist/botlit/hooks/useAgentBindings.d.ts +58 -0
  15. package/dist/botlit/hooks/useAgentBindings.js +87 -0
  16. package/dist/botlit/hooks/useAgentBindings.js.map +1 -0
  17. package/dist/botlit/hooks/useChannelSetup.d.ts +2 -1
  18. package/dist/botlit/hooks/useChannelSetup.js +61 -52
  19. package/dist/botlit/hooks/useChannelSetup.js.map +1 -1
  20. package/dist/botlit/hooks/useChannels.d.ts +9 -0
  21. package/dist/botlit/hooks/useChannels.js +83 -73
  22. package/dist/botlit/hooks/useChannels.js.map +1 -1
  23. package/dist/botlit/hooks/useUserPlatformConnection.js +98 -78
  24. package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
  25. package/dist/botlit/pages/AgentDetailPage.js +56 -55
  26. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  27. package/dist/botlit/pages/BotChannelsTab.js +457 -242
  28. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  29. package/dist/botlit/pages/PromptStudioPage.js +365 -175
  30. package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
  31. package/dist/botlit/permissions/index.js +3 -3
  32. package/dist/botlit/permissions/useBotmanorPermissions.js +5 -2
  33. package/dist/botlit/permissions/useBotmanorPermissions.js.map +1 -1
  34. package/dist/botlit/utils/promptVariables.d.ts +6 -0
  35. package/dist/botlit/utils/promptVariables.js +20 -0
  36. package/dist/botlit/utils/promptVariables.js.map +1 -0
  37. package/dist/generated/wspace-operations.d.ts +314 -0
  38. package/dist/generated/wspace-operations.js +189 -101
  39. package/dist/generated/wspace-operations.js.map +1 -1
  40. package/dist/generated/wspace-types.d.ts +139 -0
  41. package/dist/generated/wspace-types.js +3 -1
  42. package/dist/generated/wspace-types.js.map +1 -1
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PromptStudioPage.js","names":["Textarea","Textarea$1","toPromptVariable","value","record","name","templateVariables","template","promptTemplateVariables","variable","PromptStudioPage","useBotlit","templates","usePromptTemplates","isRunning","useRenderPromptTemplate","selectedPromptId","setSelectedPromptId","useState","testVariables","setTestVariables","testOutput","setTestOutput","selectedPrompt","useMemo","selectedVariables","handleTest","output","render","err","graphqlErrorMessage","PageLayout","BotmanorPermissionGate","BOTMANOR_PERMISSIONS","Button","Plus","navigateTo","PagePurpose","Play","Card","CardHeader","CardTitle","CardContent","loading","i","error","ErrorState","refetch","prompt","Badge","GlassCard","CardDescription","Tag","tag","FormField","formatRelativeTime","EmptyState","Input","e"],"sources":["../../../src/botlit/pages/PromptStudioPage.tsx"],"sourcesContent":["/**\n * Prompt Studio Page\n * @module botlit/pages\n */\n\nimport type { FC } from 'react';\nimport { useEffect, useMemo, useState } from 'react';\nimport { Plus, Play, Tag } from 'lucide-react';\nimport { toast } from 'sonner';\nimport { PagePurpose, GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../components/PageLayout';\nimport { Card, CardHeader, CardTitle, CardContent, CardDescription } from '../components/Card';\nimport { Button } from '../components/Button';\nimport { Input, Textarea, FormField } from '../components/Input';\nimport { Badge } from '../components/Badge';\nimport { EmptyState } from '../components/EmptyState';\nimport { ErrorState } from '../components/ErrorState';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport {\n usePromptTemplates,\n useRenderPromptTemplate,\n promptTemplateVariables,\n type PromptTemplateRecord,\n} from '../hooks';\nimport { graphqlErrorMessage } from '../utils/errors';\nimport { formatRelativeTime } from '../utils/formatters';\nimport type { PromptVariable } from '../types';\nimport { BOTMANOR_PERMISSIONS, BotmanorPermissionGate } from '../permissions';\n\n/** Normalises one entry of a template's free-form `variables` JSON. */\nfunction toPromptVariable(value: unknown): PromptVariable | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null;\n const record = value as Record<string, unknown>;\n const name = typeof record.name === 'string' ? record.name : undefined;\n if (!name) return null;\n const type = typeof record.type === 'string' ? record.type : 'string';\n return {\n name,\n type: type as PromptVariable['type'],\n description: typeof record.description === 'string' ? record.description : undefined,\n required: record.required === true,\n defaultValue: record.defaultValue,\n };\n}\n\nfunction templateVariables(template: PromptTemplateRecord | undefined): PromptVariable[] {\n if (!template) return [];\n return promptTemplateVariables(template)\n .map(toPromptVariable)\n .filter((variable): variable is PromptVariable => variable !== null);\n}\n\nexport const PromptStudioPage: FC = () => {\n const { navigateTo } = useBotlit();\n const { data: templates, loading, error, refetch } = usePromptTemplates();\n const { render, loading: isRunning } = useRenderPromptTemplate();\n\n const [selectedPromptId, setSelectedPromptId] = useState<string | null>(null);\n const [testVariables, setTestVariables] = useState<Record<string, string>>({});\n const [testOutput, setTestOutput] = useState('');\n\n // Select the first template once the list arrives.\n useEffect(() => {\n if (!selectedPromptId && templates.length > 0) {\n setSelectedPromptId(templates[0].id);\n }\n }, [templates, selectedPromptId]);\n\n const selectedPrompt = useMemo(\n () => templates.find((template) => template.id === selectedPromptId),\n [templates, selectedPromptId]\n );\n\n const selectedVariables = useMemo(() => templateVariables(selectedPrompt), [selectedPrompt]);\n\n const handleTest = async () => {\n if (!selectedPrompt) return;\n try {\n // Rendered by wspace-botlit-svc so the preview matches what the agent\n // actually receives — never a client-side string substitution.\n const output = await render({\n templateId: selectedPrompt.id,\n variables: testVariables,\n });\n setTestOutput(output);\n } catch (err) {\n toast.error(graphqlErrorMessage(err, 'Failed to render prompt'));\n }\n };\n\n return (\n <PageLayout\n title=\"Prompt Studio\"\n description=\"Create, test, and manage prompts for your AI agents\"\n actions={\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.PROMPT_TEMPLATE_CREATE}>\n <Button leftIcon={<Plus size={16} />} onClick={() => navigateTo('prompt-templates/new')}>\n New Prompt\n </Button>\n </BotmanorPermissionGate>\n }\n >\n <div className=\"space-y-6\">\n <PagePurpose icon={<Play size={18} />}>\n Prompt Studio is your interactive workbench for writing and testing prompts before they go\n live. Pick a prompt, edit its text and variables on the left, then fill in sample values\n and hit Run Test to preview exactly what the agent will receive — so you can iterate on\n wording and catch mistakes here instead of in production.\n </PagePurpose>\n\n <div className=\"grid grid-cols-12 gap-6\">\n {/* Prompt List */}\n <div className=\"col-span-3\">\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">Prompts</CardTitle>\n </CardHeader>\n <CardContent className=\"p-0\">\n {loading ? (\n <div className=\"space-y-2 p-4\">\n {[1, 2, 3].map((i) => (\n <div\n key={i}\n className=\"h-14 bg-bg-sunken motion-safe:animate-vc-shimmer rounded\"\n />\n ))}\n </div>\n ) : error ? (\n <ErrorState\n resource=\"prompt templates\"\n error={error}\n onRetry={() => void refetch()}\n className=\"m-4\"\n />\n ) : templates.length === 0 ? (\n <p className=\"p-4 text-sm text-text-secondary\">\n No prompt templates yet. Create one to start iterating.\n </p>\n ) : (\n <div className=\"divide-y divide-border-subtle\">\n {templates.map((prompt: PromptTemplateRecord) => (\n <button\n key={prompt.id}\n type=\"button\"\n className={`w-full text-left p-4 hover:bg-accent transition-colors ${\n selectedPrompt?.id === prompt.id ? 'bg-accent' : ''\n }`}\n onClick={() => {\n setSelectedPromptId(prompt.id);\n setTestVariables({});\n setTestOutput('');\n }}\n >\n <p className=\"font-medium truncate\">{prompt.name}</p>\n <p className=\"text-xs text-text-secondary mt-1 truncate\">\n v{prompt.version}\n </p>\n <div className=\"flex items-center gap-2 mt-2\">\n {prompt.visibility === 'PUBLIC' && (\n <Badge variant=\"secondary\" className=\"text-[10px]\">\n Public\n </Badge>\n )}\n <span className=\"text-xs text-text-secondary\">\n {templateVariables(prompt).length} vars\n </span>\n </div>\n </button>\n ))}\n </div>\n )}\n </CardContent>\n </Card>\n </div>\n\n {/* Editor */}\n <div className=\"col-span-6\">\n {selectedPrompt ? (\n <GlassCard treatment=\"glass\" glow className=\"overflow-hidden\">\n <CardHeader className=\"flex flex-row items-center justify-between\">\n <div>\n <CardTitle>{selectedPrompt.name}</CardTitle>\n <CardDescription>{selectedPrompt.description}</CardDescription>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => navigateTo(`prompt-templates/${selectedPrompt.id}`)}\n >\n Open template\n </Button>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {/* Tags */}\n <div className=\"flex items-center gap-2\">\n <Tag size={14} className=\"text-text-secondary\" />\n {selectedPrompt.tags.map((tag) => (\n <Badge key={tag} variant=\"secondary\">\n {tag}\n </Badge>\n ))}\n </div>\n\n {/* Content */}\n <FormField label=\"Prompt Content\">\n <Textarea\n value={selectedPrompt.templateText}\n rows={15}\n readOnly\n className=\"font-mono text-sm\"\n />\n </FormField>\n\n {/* Variables */}\n {selectedVariables.length > 0 && (\n <div>\n <p className=\"text-sm font-medium mb-2\">Variables</p>\n <div className=\"space-y-2\">\n {selectedVariables.map((variable: PromptVariable) => (\n <div\n key={variable.name}\n className=\"flex items-center gap-4 p-3 bg-bg-sunken rounded-lg\"\n >\n <div className=\"flex-1\">\n <p className=\"font-medium text-sm\">\n {`{{${variable.name}}}`}\n {variable.required && (\n <span className=\"text-status-error-text ml-1\">*</span>\n )}\n </p>\n {variable.description && (\n <p className=\"text-xs text-text-secondary\">\n {variable.description}\n </p>\n )}\n </div>\n <Badge variant=\"outline\" className=\"capitalize\">\n {variable.type}\n </Badge>\n </div>\n ))}\n </div>\n </div>\n )}\n\n <div className=\"pt-4 text-xs text-text-secondary\">\n Updated {formatRelativeTime(selectedPrompt.updatedAt)}\n </div>\n </CardContent>\n </GlassCard>\n ) : (\n <EmptyState\n illustration=\"onboarding\"\n title=\"Select a prompt\"\n description=\"Choose a prompt from the list to view and edit\"\n />\n )}\n </div>\n\n {/* Test Panel */}\n <div className=\"col-span-3\">\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base flex items-center gap-2\">\n <Play size={16} />\n Test Prompt\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {selectedVariables.map((variable: PromptVariable) => (\n <FormField key={variable.name} label={variable.name}>\n <Input\n placeholder={variable.description || `Enter ${variable.name}`}\n value={testVariables[variable.name] || ''}\n onChange={(e) =>\n setTestVariables({ ...testVariables, [variable.name]: e.target.value })\n }\n />\n </FormField>\n ))}\n\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.PROMPT_TEMPLATE_EXECUTE}>\n <Button\n className=\"w-full\"\n onClick={() => void handleTest()}\n isLoading={isRunning}\n disabled={!selectedPrompt}\n >\n Run Test\n </Button>\n </BotmanorPermissionGate>\n\n {testOutput && (\n <div>\n <p className=\"text-sm font-medium mb-2\">Output</p>\n <div className=\"p-3 bg-bg-sunken rounded-lg text-sm whitespace-pre-wrap font-mono max-h-64 overflow-auto\">\n {testOutput}\n </div>\n </div>\n )}\n </CardContent>\n </Card>\n </div>\n </div>\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,SAASE,EAAiB,GAAuC;CAC/D,IAAI,CAACC,KAAS,OAAOA,KAAU,YAAY,MAAM,QAAQA,CAAK,GAAG,OAAO;CACxE,IAAMC,IAASD,GACTE,IAA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AAW,MACTW,EAAiB;WAAE,GAAGD;YAAgBV,EAAS,OAAOiD,EAAE,OAAO;UAAM,CAAC;SAEzE,CAAA;QACQ,GARKjD,EAAS,IAQd,CACZ;QAED,kBAACuB,GAAD;SAAwB,YAAYC,EAAqB;SACvD,UAAA,kBAACC,GAAD;UACE,WAAU;UACV,eAAe,KAAKR,EAAW;UAC/B,WAAWZ;UACX,UAAU,CAACS;UACZ,UAAA;SAEO,CAAA;QACc,CAAA;QAEvBF,KACC,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;SAAG,WAAU;SAA2B,UAAA;QAAS,CAAA,GACjD,kBAAC,OAAD;SAAK,WAAU;SACZ,UAAAA;QACE,CAAA,CACF,EAAA,CAAA;OAEI;MACT,CAAA,CAAA,EAAA,CAAA;KACH,CAAA;IACF;GACF,CAAA,CAAA;;CACK,CAAA;AAEhB"}
1
+ {"version":3,"file":"PromptStudioPage.js","names":["_Fragment","Textarea","Textarea$1","Fragment$1","asJsonInput","value","asContract","SELECT_CLASS","ResultCard","Card","run","CardHeader","CardTitle","CardDescription","CardContent","PromptStudioPage","useBotlit","templates","usePromptTemplates","models","useLLMModels","running","useTestPromptTemplate","saving","useSavePromptTemplateVersion","selectedPromptId","setSelectedPromptId","useState","draftText","setDraftText","testVariables","setTestVariables","modelId","setModelId","userMessage","setUserMessage","runs","setRuns","bump","setBump","PromptVersionBump","changelog","setChangelog","draftContract","setDraftContract","shownPromptId","useRef","selectedPrompt","useMemo","template","versions","usePromptTemplateVersions","selectedVariables","promptTemplateVariables","activeModels","model","inputVariables","byName","variable","version","useEffect","dirty","canRun","variablesInput","declared","contract","name","typedVariableValue","runOne","templateText","err","graphqlErrorMessage","selectPrompt","promptId","confirmAction","showRuns","results","handleRun","handleCompare","other","draft","label","otherText","otherContract","handleSaveVersion","saved","save","toast","refetch","PageLayout","BotmanorPermissionGate","BOTMANOR_PERMISSIONS","Button","Plus","navigateTo","PagePurpose","Play","loading","i","error","ErrorState","prompt","Badge","FormField","event","Input","Save","formatRelativeTime","EmptyState","entry","e","GitCompare","History"],"sources":["../../../src/botlit/pages/PromptStudioPage.tsx"],"sourcesContent":["/**\n * Prompt Studio Page\n * @module botlit/pages\n *\n * Write and iterate a prompt against a live model (BOFF-15360): edit a draft\n * of a template, run it — or run the saved version and the draft side by\n * side — against a model registered in the workspace, then save the draft as\n * the template's next version. Earlier versions can be loaded back or compared.\n */\n\nimport type { FC } from 'react';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { GitCompare, History, Play, Plus, Save } from 'lucide-react';\nimport { toast } from 'sonner';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../components/PageLayout';\nimport { Card, CardHeader, CardTitle, CardContent, CardDescription } from '../components/Card';\nimport { Button } from '../components/Button';\nimport { Input, Textarea, FormField } from '../components/Input';\nimport { Badge } from '../components/Badge';\nimport { EmptyState } from '../components/EmptyState';\nimport { ErrorState } from '../components/ErrorState';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport {\n usePromptTemplates,\n usePromptTemplateVersions,\n promptTemplateVariables,\n useSavePromptTemplateVersion,\n useTestPromptTemplate,\n type PromptTemplateRecord,\n type PromptTemplateTestRecord,\n} from '../hooks';\nimport { useLLMModels } from '../hooks/useLLMProviders';\nimport { PromptVersionBump } from '../../generated/wspace-types';\nimport { confirmAction } from '../utils/confirmAction';\nimport { graphqlErrorMessage } from '../utils/errors';\nimport { typedVariableValue } from '../utils/promptVariables';\nimport { formatRelativeTime } from '../utils/formatters';\nimport { BOTMANOR_PERMISSIONS, BotmanorPermissionGate } from '../permissions';\n\n/**\n * A variable contract is a JSON array; codegen maps the `JSON` scalar to an\n * object type, so the stored contract is passed through unchanged with this\n * cast (the server validates its shape).\n */\nconst asJsonInput = (value: unknown): Record<string, unknown> => value as Record<string, unknown>;\n\n/**\n * A stored contract (JSON) in the shape `promptTemplateVariables` reads; that\n * helper normalises any JSON value, so the cast only names the field type.\n */\nconst asContract = (value: unknown): Pick<PromptTemplateRecord, 'variables'> => ({\n variables: value as PromptTemplateRecord['variables'],\n});\n\nconst SELECT_CLASS =\n 'h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 text-sm';\n\ninterface RunResult {\n label: string;\n result?: PromptTemplateTestRecord;\n error?: string;\n}\n\nconst ResultCard: FC<{ run: RunResult }> = ({ run }) => (\n <Card data-testid={`prompt-run-${run.label.toLowerCase().replace(/\\s+/g, '-')}`}>\n <CardHeader>\n <CardTitle className=\"text-base\">{run.label}</CardTitle>\n {run.result && (\n <CardDescription>\n {run.result.model} · {run.result.tokensUsed} tokens · {run.result.latencyMs} ms\n </CardDescription>\n )}\n </CardHeader>\n <CardContent className=\"space-y-3\">\n {run.error ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {run.error}\n </p>\n ) : (\n <>\n <div className=\"whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm\">\n {run.result?.output}\n </div>\n <details className=\"text-xs text-text-secondary\">\n <summary className=\"cursor-pointer\">Rendered prompt</summary>\n <pre className=\"mt-2 whitespace-pre-wrap font-mono\">{run.result?.renderedPrompt}</pre>\n </details>\n </>\n )}\n </CardContent>\n </Card>\n);\n\nexport const PromptStudioPage: FC = () => {\n const { navigateTo } = useBotlit();\n const { data: templates, loading, error, refetch } = usePromptTemplates();\n const models = useLLMModels();\n const { run, loading: running } = useTestPromptTemplate();\n const { save, loading: saving } = useSavePromptTemplateVersion();\n\n const [selectedPromptId, setSelectedPromptId] = useState<string | null>(null);\n const [draftText, setDraftText] = useState('');\n const [testVariables, setTestVariables] = useState<Record<string, string>>({});\n const [modelId, setModelId] = useState('');\n const [userMessage, setUserMessage] = useState('');\n const [runs, setRuns] = useState<RunResult[]>([]);\n const [bump, setBump] = useState<PromptVersionBump>(PromptVersionBump.Patch);\n const [changelog, setChangelog] = useState('');\n // The variable contract the draft is written against: the template's own,\n // or an earlier version's once that version is loaded.\n const [draftContract, setDraftContract] = useState<unknown>(null);\n // The prompt the page shows now; a run that finishes after the user moved\n // to another prompt is discarded.\n const shownPromptId = useRef<string | null>(null);\n\n useEffect(() => {\n if (!selectedPromptId && templates.length > 0) setSelectedPromptId(templates[0].id);\n }, [templates, selectedPromptId]);\n\n const selectedPrompt = useMemo(\n () => templates.find((template) => template.id === selectedPromptId),\n [templates, selectedPromptId]\n );\n const versions = usePromptTemplateVersions(selectedPrompt?.id);\n const selectedVariables = useMemo(\n () =>\n selectedPrompt\n ? promptTemplateVariables(\n draftContract === null ? selectedPrompt : asContract(draftContract)\n )\n : [],\n [selectedPrompt, draftContract]\n );\n const activeModels = useMemo(() => models.data.filter((model) => model.isActive), [models.data]);\n // Value fields for every variable the draft or an earlier version declares,\n // so a comparison with a version that names other variables can be filled in.\n const inputVariables = useMemo(() => {\n const byName = new Map(selectedVariables.map((variable) => [variable.name, variable]));\n for (const version of versions.data) {\n for (const variable of promptTemplateVariables(asContract(version.variables))) {\n if (!byName.has(variable.name)) byName.set(variable.name, variable);\n }\n }\n return [...byName.values()];\n }, [selectedVariables, versions.data]);\n\n useEffect(() => {\n shownPromptId.current = selectedPrompt?.id ?? null;\n setDraftText(selectedPrompt?.templateText ?? '');\n setDraftContract(null);\n }, [selectedPrompt?.id, selectedPrompt?.templateText]);\n\n useEffect(() => {\n if (!modelId && activeModels.length > 0) setModelId(activeModels[0].id);\n }, [activeModels, modelId]);\n\n const dirty =\n Boolean(selectedPrompt) &&\n (draftText !== selectedPrompt?.templateText || draftContract !== null);\n const canRun = Boolean(selectedPrompt && modelId && userMessage.trim());\n\n /** The filled-in values a run's contract declares (the server rejects others). */\n const variablesInput = (contract: unknown) => {\n const declared = new Map(\n promptTemplateVariables(\n contract === null && selectedPrompt ? selectedPrompt : asContract(contract)\n ).map((variable) => [variable.name, variable.type] as const)\n );\n return Object.fromEntries(\n Object.entries(testVariables)\n .filter(([name, value]) => value !== '' && declared.has(name))\n .map(([name, value]) => [name, typedVariableValue(declared.get(name) ?? 'string', value)])\n );\n };\n\n const runOne = async (\n label: string,\n templateText?: string,\n contract: unknown = null\n ): Promise<RunResult> => {\n if (!selectedPrompt) return { label, error: 'Select a prompt' };\n try {\n const result = await run({\n templateId: selectedPrompt.id,\n input: {\n llmModelId: modelId,\n userMessage,\n variables: variablesInput(contract),\n ...(templateText !== undefined ? { templateText } : {}),\n ...(contract !== null ? { variableDefinitions: asJsonInput(contract) } : {}),\n },\n });\n return { label, result };\n } catch (err) {\n return { label, error: graphqlErrorMessage(err, 'The model run failed') };\n }\n };\n\n // Switching prompts discards an unsaved draft only after the user agrees.\n const selectPrompt = async (promptId: string) => {\n if (promptId === selectedPrompt?.id) return;\n if (\n dirty &&\n !(await confirmAction({\n title: 'Discard draft?',\n message: 'This prompt has an unsaved draft. Discard it and open the other prompt?',\n confirmLabel: 'Discard draft',\n cancelLabel: 'Keep editing',\n }))\n )\n return;\n setSelectedPromptId(promptId);\n setTestVariables({});\n setRuns([]);\n };\n\n const showRuns = (promptId: string | undefined, results: RunResult[]) => {\n if (promptId && promptId === shownPromptId.current) setRuns(results);\n };\n\n const handleRun = async () => {\n const promptId = selectedPrompt?.id;\n showRuns(promptId, [await runOne('Draft', draftText, draftContract)]);\n };\n\n const handleCompare = async (label: string, otherText: string, otherContract: unknown = null) => {\n const promptId = selectedPrompt?.id;\n const [other, draft] = await Promise.all([\n runOne(label, otherText, otherContract),\n runOne('Draft', draftText, draftContract),\n ]);\n showRuns(promptId, [other, draft]);\n };\n\n const handleSaveVersion = async () => {\n if (!selectedPrompt) return;\n try {\n const saved = await save({\n templateId: selectedPrompt.id,\n input: {\n templateText: draftText,\n ...(draftContract !== null ? { variables: asJsonInput(draftContract) } : {}),\n bump,\n ...(changelog.trim() ? { changelog: changelog.trim() } : {}),\n },\n });\n toast.success(`Saved version ${saved.version}`);\n // The saved draft is the template now, contract included, unless the\n // user moved to another prompt while it was saving.\n if (shownPromptId.current === saved.id) {\n setChangelog('');\n setDraftText(saved.templateText);\n setDraftContract(null);\n }\n await refetch();\n if (shownPromptId.current === saved.id) void versions.refetch();\n } catch (err) {\n toast.error(graphqlErrorMessage(err, 'Failed to save the prompt version'));\n }\n };\n\n return (\n <PageLayout\n title=\"Prompt Studio\"\n description=\"Write a prompt, run it against a live model, compare and save versions\"\n actions={\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.PROMPT_TEMPLATE_CREATE}>\n <Button leftIcon={<Plus size={16} />} onClick={() => navigateTo('prompt-templates/new')}>\n New Prompt\n </Button>\n </BotmanorPermissionGate>\n }\n >\n <div className=\"space-y-6\">\n <PagePurpose icon={<Play size={18} />}>\n Prompt Studio is your workbench for prompts. Pick a template, edit the draft, fill in\n variable values and a test message, then run it against one of your workspace&apos;s\n models. Compare the draft with the saved or an earlier version side by side, and save the\n draft as the template&apos;s next version when it answers the way you want.\n </PagePurpose>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-12\">\n {/* Prompt List */}\n <div className=\"lg:col-span-3\">\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">Prompts</CardTitle>\n </CardHeader>\n <CardContent className=\"p-0\">\n {loading ? (\n <div className=\"space-y-2 p-4\">\n {[1, 2, 3].map((i) => (\n <div\n key={i}\n className=\"h-14 rounded bg-bg-sunken motion-safe:animate-vc-shimmer\"\n />\n ))}\n </div>\n ) : error ? (\n <ErrorState\n resource=\"prompt templates\"\n error={error}\n onRetry={() => void refetch()}\n className=\"m-4\"\n />\n ) : templates.length === 0 ? (\n <p className=\"p-4 text-sm text-text-secondary\">\n No prompt templates yet. Create one to start iterating.\n </p>\n ) : (\n <div className=\"divide-y divide-border-subtle\">\n {templates.map((prompt: PromptTemplateRecord) => (\n <button\n key={prompt.id}\n type=\"button\"\n className={`w-full p-4 text-left transition-colors hover:bg-accent ${\n selectedPrompt?.id === prompt.id ? 'bg-accent' : ''\n }`}\n disabled={running || saving}\n onClick={() => void selectPrompt(prompt.id)}\n >\n <p className=\"truncate font-medium\">{prompt.name}</p>\n <p className=\"mt-1 truncate text-xs text-text-secondary\">\n v{prompt.version}\n </p>\n <div className=\"mt-2 flex items-center gap-2\">\n {prompt.visibility === 'PUBLIC' && (\n <Badge variant=\"secondary\" className=\"text-[10px]\">\n Public\n </Badge>\n )}\n <span className=\"text-xs text-text-secondary\">\n {promptTemplateVariables(prompt).length} vars\n </span>\n </div>\n </button>\n ))}\n </div>\n )}\n </CardContent>\n </Card>\n </div>\n\n {/* Editor + runs */}\n <div className=\"space-y-6 lg:col-span-6\">\n {selectedPrompt ? (\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between\">\n <div>\n <CardTitle>\n {selectedPrompt.name}{' '}\n <Badge variant=\"outline\" className=\"ml-2\">\n v{selectedPrompt.version}\n </Badge>\n {dirty && (\n <Badge variant=\"secondary\" className=\"ml-2\">\n Unsaved draft\n </Badge>\n )}\n </CardTitle>\n <CardDescription>{selectedPrompt.description}</CardDescription>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n onClick={() => navigateTo(`prompt-templates/${selectedPrompt.id}`)}\n >\n Open template\n </Button>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <FormField label=\"Draft prompt\">\n <Textarea\n aria-label=\"Draft prompt\"\n readOnly={saving || running}\n value={draftText}\n rows={12}\n onChange={(event) => setDraftText(event.target.value)}\n className=\"font-mono text-sm\"\n />\n </FormField>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.PROMPT_TEMPLATE_UPDATE}>\n <div className=\"grid gap-3 sm:grid-cols-[10rem_1fr_auto] sm:items-end\">\n <label className=\"grid gap-1 text-sm\">\n Version bump\n <select\n aria-label=\"Version bump\"\n className={SELECT_CLASS}\n value={bump}\n onChange={(event) => setBump(event.target.value as PromptVersionBump)}\n >\n <option value={PromptVersionBump.Patch}>Patch</option>\n <option value={PromptVersionBump.Minor}>Minor</option>\n <option value={PromptVersionBump.Major}>Major</option>\n </select>\n </label>\n <label className=\"grid gap-1 text-sm\">\n Change note\n <Input\n aria-label=\"Change note\"\n placeholder=\"What changed in this version\"\n value={changelog}\n onChange={(event) => setChangelog(event.target.value)}\n />\n </label>\n <Button\n leftIcon={<Save size={16} />}\n onClick={() => void handleSaveVersion()}\n isLoading={saving}\n disabled={!dirty || !draftText.trim()}\n >\n Save as new version\n </Button>\n </div>\n </BotmanorPermissionGate>\n <div className=\"text-xs text-text-secondary\">\n Updated {formatRelativeTime(selectedPrompt.updatedAt)}\n </div>\n </CardContent>\n </Card>\n ) : (\n <EmptyState\n illustration=\"onboarding\"\n title=\"Select a prompt\"\n description=\"Choose a prompt from the list to iterate on it\"\n />\n )}\n\n {runs.length > 0 && (\n <div className={`grid gap-4 ${runs.length > 1 ? 'md:grid-cols-2' : ''}`}>\n {runs.map((entry) => (\n <ResultCard key={entry.label} run={entry} />\n ))}\n </div>\n )}\n </div>\n\n {/* Run panel + versions */}\n <div className=\"space-y-6 lg:col-span-3\">\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2 text-base\">\n <Play size={16} />\n Run against a model\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <label className=\"grid gap-1 text-sm\">\n Model\n <select\n aria-label=\"Model\"\n disabled={running}\n className={SELECT_CLASS}\n value={modelId}\n onChange={(event) => setModelId(event.target.value)}\n >\n {activeModels.length === 0 && <option value=\"\">No active models</option>}\n {activeModels.map((model) => (\n <option key={model.id} value={model.id}>\n {model.name}\n </option>\n ))}\n </select>\n </label>\n {inputVariables.map((variable) => (\n <FormField key={variable.name} label={variable.name}>\n <Input\n aria-label={`Value for ${variable.name}`}\n readOnly={running}\n placeholder={\n typeof variable.defaultValue === 'string'\n ? `Default: ${variable.defaultValue}`\n : variable.description || `Enter ${variable.name}`\n }\n value={testVariables[variable.name] || ''}\n onChange={(e) =>\n setTestVariables({ ...testVariables, [variable.name]: e.target.value })\n }\n />\n </FormField>\n ))}\n <FormField label=\"Test message\">\n <Textarea\n aria-label=\"Test message\"\n readOnly={running}\n rows={3}\n placeholder=\"What a user would ask\"\n value={userMessage}\n onChange={(event) => setUserMessage(event.target.value)}\n />\n </FormField>\n <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.PROMPT_TEMPLATE_EXECUTE}>\n <div className=\"grid gap-2\">\n <Button onClick={() => void handleRun()} isLoading={running} disabled={!canRun}>\n Run draft\n </Button>\n <Button\n variant=\"outline\"\n leftIcon={<GitCompare size={16} />}\n onClick={() =>\n void handleCompare(\n `Saved v${selectedPrompt?.version}`,\n selectedPrompt?.templateText ?? ''\n )\n }\n disabled={!canRun || running}\n >\n Compare with saved\n </Button>\n </div>\n </BotmanorPermissionGate>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2 text-base\">\n <History size={16} />\n Versions\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-3\">\n {versions.error ? (\n <ErrorState\n resource=\"prompt versions\"\n error={versions.error}\n onRetry={() => void versions.refetch()}\n />\n ) : versions.loading && versions.data.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">Loading versions…</p>\n ) : versions.data.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n No earlier versions. Saving a draft keeps the current one here.\n </p>\n ) : (\n versions.data.map((version) => (\n <div\n key={`${version.version}-${version.revision}`}\n className=\"space-y-2 rounded-lg border border-border-subtle p-3\"\n >\n <div className=\"flex items-center justify-between\">\n <Badge variant=\"outline\">v{version.version}</Badge>\n <span className=\"text-xs text-text-secondary\">\n {formatRelativeTime(String(version.savedAt))}\n </span>\n </div>\n {version.changelog && <p className=\"text-xs\">{version.changelog}</p>}\n <div className=\"flex gap-2\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n disabled={running || saving}\n onClick={() => {\n setDraftText(version.templateText);\n setDraftContract(version.variables);\n setTestVariables({});\n }}\n >\n Load\n </Button>\n <BotmanorPermissionGate\n permission={BOTMANOR_PERMISSIONS.PROMPT_TEMPLATE_EXECUTE}\n >\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={!canRun || running}\n onClick={() =>\n void handleCompare(\n `v${version.version}`,\n version.templateText,\n version.variables\n )\n }\n >\n Compare\n </Button>\n </BotmanorPermissionGate>\n </div>\n </div>\n ))\n )}\n </CardContent>\n </Card>\n </div>\n </div>\n </div>\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAMI,MAAe,MAA4CC,GAM3DC,KAAc,OAA6D,EAC/E,WAAWD,EACb,IAEME,IACJ,kFAQIC,MAAsC,EAAE,aAC5C,kBAACC,GAAD;CAAM,eAAa,cAAcC,EAAI,MAAM,YAAY,CAAC,CAAC,QAAQ,QAAQ,GAAG;CAA5E,UAAA,CACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;EAAW,WAAU;EAAa,UAAAF,EAAI;CAAiB,CAAA,GACtDA,EAAI,UACH,kBAACG,GAAD,EAAA,UAAA;EACGH,EAAI,OAAO;EAAM;EAAIA,EAAI,OAAO;EAAW;EAAWA,EAAI,OAAO;EAAU;CAC7D,EAAA,CAAA,CAET,EAAA,CAAA,GACZ,kBAACI,GAAD;EAAa,WAAU;EACpB,UAAAJ,EAAI,QACH,kBAAC,KAAD;GAAG,MAAK;GAAQ,WAAU;GACvB,UAAAA,EAAI;EACJ,CAAA,IAEH,kBAAAV,GAAA,EAAA,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAAU,EAAI,QAAQ;EACV,CAAA,GACL,kBAAC,WAAD;GAAS,WAAU;GAAnB,UAAA,CACE,kBAAC,WAAD;IAAS,WAAU;IAAiB,UAAA;GAAwB,CAAA,GAC5D,kBAAC,OAAD;IAAK,WAAU;IAAsC,UAAAA,EAAI,QAAQ;GAAoB,CAAA,CAC9E;EACT,CAAA,CAAA,EAAA,CAAA;CAEO,CAAA,CACT;A,IAGKK,UAA6B;CACxC,IAAM,EAAE,kBAAeC,GAAU,GAC3B,EAAE,MAAMC,GAAW,aAAS,UAAO,eAAYC,GAAmB,GAClEC,IAASC,GAAa,GACtB,EAAE,SAAK,SAASC,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AK,KAAK,MACjB,kBAAC,OAAD;QAEE,WAAU;QAFZ,UAAA;SAIE,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA,CACE,kBAACoD,GAAD;WAAO,SAAQ;WAAf,UAAA,CAAyB,KAAE3C,EAAQ,OAAe;UAClD,CAAA,GAAA,kBAAC,QAAD;WAAM,WAAU;WACb,UAAAgD,EAAmB,OAAOhD,EAAQ,OAAO,CAAC;UACvC,CAAA,CACH;;SACJA,EAAQ,aAAa,kBAAC,KAAD;UAAG,WAAU;UAAW,UAAAA,EAAQ;SAAa,CAAA;SACnE,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA,CACE,kBAACiC,GAAD;WACE,MAAK;WACL,SAAQ;WACR,UAAUvE,KAAWE;WACrB,eAAe;YAGb,AAFAM,EAAa8B,EAAQ,YAAY,GACjCf,EAAiBe,EAAQ,SAAS,GAClC5B,EAAiB,CAAC,CAAC;WACrB;WACD,UAAA;UAEO,CAAA,GACR,kBAAC2D,GAAD;WACE,YAAYC,EAAqB;WAEjC,UAAA,kBAACC,GAAD;YACE,MAAK;YACL,SAAQ;YACR,UAAU,CAAC9B,KAAUzC;YACrB,eACE,KAAKyD,GACH,IAAInB,EAAQ,WACZA,EAAQ,cACRA,EAAQ,SACV;YAEH,UAAA;WAEO,CAAA;UACc,CAAA,CACrB;;QACF;OA1CE,GAAA,GAAGA,EAAQ,QAAQ,GAAGA,EAAQ,UA0ChC,CACN;MAEQ,CAAA,CACT,EAAA,CAAA,CACH;;IACF;GACF,CAAA,CAAA;;CACK,CAAA;AAEhB"}
@@ -1,4 +1,4 @@
1
1
  import { BOTMANOR_PERMISSIONS as e } from "./botmanorPermissions.js";
2
- import { BotmanorPermissionGate as t, useBotmanorCan as n, useBotmanorPermissionDecision as r } from "./useBotmanorPermissions.js";
3
- import { RequirePermission as i } from "./PermissionRequired.js";
4
- export { e as BOTMANOR_PERMISSIONS, t as BotmanorPermissionGate, i as RequirePermission, n as useBotmanorCan, r as useBotmanorPermissionDecision };
2
+ import { BotmanorPermissionGate as t, useBotmanorCan as n, useBotmanorPermission as r, useBotmanorPermissionDecision as i } from "./useBotmanorPermissions.js";
3
+ import { RequirePermission as a } from "./PermissionRequired.js";
4
+ export { e as BOTMANOR_PERMISSIONS, t as BotmanorPermissionGate, a as RequirePermission, n as useBotmanorCan, r as useBotmanorPermission, i as useBotmanorPermissionDecision };
@@ -12,10 +12,13 @@ function a() {
12
12
  function o(e) {
13
13
  return i(r(), e);
14
14
  }
15
- var s = ({ permission: e, children: a, fallback: o = null, loading: s = null }) => {
15
+ function s(e) {
16
+ return a()(e);
17
+ }
18
+ var c = ({ permission: e, children: a, fallback: o = null, loading: s = null }) => {
16
19
  let c = i(r(), e);
17
20
  return c === "allowed" ? /* @__PURE__ */ n(t, { children: a }) : c === "loading" ? /* @__PURE__ */ n(t, { children: s }) : /* @__PURE__ */ n(t, { children: o });
18
21
  };
19
- export { s as BotmanorPermissionGate, i as resolvePermission, a as useBotmanorCan, o as useBotmanorPermissionDecision };
22
+ export { c as BotmanorPermissionGate, i as resolvePermission, a as useBotmanorCan, s as useBotmanorPermission, o as useBotmanorPermissionDecision };
20
23
 
21
24
  //# sourceMappingURL=useBotmanorPermissions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBotmanorPermissions.js","names":["_Fragment","Fragment$1","resolvePermission","context","permission","useBotmanorCan","useSafePermissions","useCallback","useBotmanorPermissionDecision","BotmanorPermissionGate","decision","loading","fallback"],"sources":["../../../src/botlit/permissions/useBotmanorPermissions.tsx"],"sourcesContent":["/**\n * BotManor permission hooks and gate\n * @module botlit/permissions\n *\n * Thin wrappers over the shell's fe-libs `PermissionProvider` that decide\n * whether the UI should offer a write control. They follow the fe-libs\n * `PermissionGate` contract (render children when allowed, `fallback` when\n * denied, `loading` while the permission set is still being fetched) with one\n * difference: they read the context through `useSafePermissions`, so the MFE\n * keeps rendering in a host that has not mounted RBAC (the standalone dev\n * host, Storybook, unit tests). With no provider every control is offered,\n * which is exactly the behaviour before gating existed; the gateway's `@rbac`\n * directive remains the enforcement point either way.\n *\n * While permissions load, checks answer `false` so a viewer never sees a\n * control flash on and then disappear.\n */\n\nimport { useCallback, type FC, type ReactNode } from 'react';\nimport { useSafePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport type { BotmanorPermission } from './botmanorPermissions';\n\n/** Answers whether the current member may use the control behind `permission`. */\nexport type BotmanorPermissionCheck = (permission: BotmanorPermission) => boolean;\n\n/** Outcome of resolving a permission against the shell context. */\nexport type PermissionDecision = 'allowed' | 'denied' | 'loading';\n\n/**\n * Resolve one permission against a (possibly absent) permission context.\n * Exported for unit tests; components use the hooks below.\n */\nexport function resolvePermission(\n context: ReturnType<typeof useSafePermissions>,\n permission: BotmanorPermission\n): PermissionDecision {\n if (!context) return 'allowed';\n if (context.isLoading) return 'loading';\n return context.hasPermission(permission) ? 'allowed' : 'denied';\n}\n\n/**\n * Returns a stable checker for any number of permissions on one page.\n *\n * @example\n * const can = useBotmanorCan();\n * {can(BOTMANOR_PERMISSIONS.POLICY_DELETE) && <Button onClick={remove}>Delete</Button>}\n */\nexport function useBotmanorCan(): BotmanorPermissionCheck {\n const context = useSafePermissions();\n return useCallback(\n (permission: BotmanorPermission) => resolvePermission(context, permission) === 'allowed',\n [context]\n );\n}\n\n/**\n * Three-state form for pages that must tell \"denied\" apart from \"still\n * loading\" (so a no-access state never flashes while permissions load).\n */\nexport function useBotmanorPermissionDecision(permission: BotmanorPermission): PermissionDecision {\n return resolvePermission(useSafePermissions(), permission);\n}\n\n/** Single-permission form of {@link useBotmanorCan}. */\nexport function useBotmanorPermission(permission: BotmanorPermission): boolean {\n return useBotmanorCan()(permission);\n}\n\nexport interface BotmanorPermissionGateProps {\n /** The `resource:action` pair the wrapped control needs. */\n permission: BotmanorPermission;\n /** Rendered when the member has the permission. */\n children: ReactNode;\n /** Rendered when the member lacks the permission. Nothing by default. */\n fallback?: ReactNode;\n /** Rendered while permissions load. Nothing by default. */\n loading?: ReactNode;\n}\n\n/**\n * Render `children` only for members who hold `permission`.\n *\n * @example\n * <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.POLICY_CREATE}>\n * <Button>Create Policy</Button>\n * </BotmanorPermissionGate>\n */\nexport const BotmanorPermissionGate: FC<BotmanorPermissionGateProps> = ({\n permission,\n children,\n fallback = null,\n loading = null,\n}) => {\n const decision = resolvePermission(useSafePermissions(), permission);\n if (decision === 'allowed') return <>{children}</>;\n if (decision === 'loading') return <>{loading}</>;\n return <>{fallback}</>;\n};\n"],"mappings":";;;;AAiCA,SAAgBE,EACd,GACA,GACoB;CAGpB,OAFKC,IACDA,EAAQ,YAAkB,YACvBA,EAAQ,cAAcC,CAAU,IAAI,YAAY,WAFlC;AAGvB;AASA,SAAgBC,IAA0C;CACxD,IAAMF,IAAUG,EAAmB;CACnC,OAAOC,GACJ,MAAmCL,EAAkBC,GAASC,CAAU,MAAM,WAC/E,CAACD,CAAO,CACV;AACF;AAMA,SAAgBK,EAA8B,GAAoD;CAChG,OAAON,EAAkBI,EAAmB,GAAGF,CAAU;AAC3D;AA0BA,IAAaK,KAA2D,EACtE,eACA,aACA,cAAW,MACX,aAAU,WACN;CACJ,IAAMC,IAAWR,EAAkBI,EAAmB,GAAGF,CAAU;CAGnE,OAFIM,MAAa,YAAkB,kBAAAV,GAAA,EAAG,YAAW,CAAA,IAC7CU,MAAa,YAAkB,kBAAAV,GAAA,EAAA,UAAGW,EAAU,CAAA,IACzC,kBAAAX,GAAA,EAAA,UAAGY,EAAW,CAAA;AACvB"}
1
+ {"version":3,"file":"useBotmanorPermissions.js","names":["_Fragment","Fragment$1","resolvePermission","context","permission","useBotmanorCan","useSafePermissions","useCallback","useBotmanorPermissionDecision","useBotmanorPermission","BotmanorPermissionGate","decision","loading","fallback"],"sources":["../../../src/botlit/permissions/useBotmanorPermissions.tsx"],"sourcesContent":["/**\n * BotManor permission hooks and gate\n * @module botlit/permissions\n *\n * Thin wrappers over the shell's fe-libs `PermissionProvider` that decide\n * whether the UI should offer a write control. They follow the fe-libs\n * `PermissionGate` contract (render children when allowed, `fallback` when\n * denied, `loading` while the permission set is still being fetched) with one\n * difference: they read the context through `useSafePermissions`, so the MFE\n * keeps rendering in a host that has not mounted RBAC (the standalone dev\n * host, Storybook, unit tests). With no provider every control is offered,\n * which is exactly the behaviour before gating existed; the gateway's `@rbac`\n * directive remains the enforcement point either way.\n *\n * While permissions load, checks answer `false` so a viewer never sees a\n * control flash on and then disappear.\n */\n\nimport { useCallback, type FC, type ReactNode } from 'react';\nimport { useSafePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport type { BotmanorPermission } from './botmanorPermissions';\n\n/** Answers whether the current member may use the control behind `permission`. */\nexport type BotmanorPermissionCheck = (permission: BotmanorPermission) => boolean;\n\n/** Outcome of resolving a permission against the shell context. */\nexport type PermissionDecision = 'allowed' | 'denied' | 'loading';\n\n/**\n * Resolve one permission against a (possibly absent) permission context.\n * Exported for unit tests; components use the hooks below.\n */\nexport function resolvePermission(\n context: ReturnType<typeof useSafePermissions>,\n permission: BotmanorPermission\n): PermissionDecision {\n if (!context) return 'allowed';\n if (context.isLoading) return 'loading';\n return context.hasPermission(permission) ? 'allowed' : 'denied';\n}\n\n/**\n * Returns a stable checker for any number of permissions on one page.\n *\n * @example\n * const can = useBotmanorCan();\n * {can(BOTMANOR_PERMISSIONS.POLICY_DELETE) && <Button onClick={remove}>Delete</Button>}\n */\nexport function useBotmanorCan(): BotmanorPermissionCheck {\n const context = useSafePermissions();\n return useCallback(\n (permission: BotmanorPermission) => resolvePermission(context, permission) === 'allowed',\n [context]\n );\n}\n\n/**\n * Three-state form for pages that must tell \"denied\" apart from \"still\n * loading\" (so a no-access state never flashes while permissions load).\n */\nexport function useBotmanorPermissionDecision(permission: BotmanorPermission): PermissionDecision {\n return resolvePermission(useSafePermissions(), permission);\n}\n\n/** Single-permission form of {@link useBotmanorCan}. */\nexport function useBotmanorPermission(permission: BotmanorPermission): boolean {\n return useBotmanorCan()(permission);\n}\n\nexport interface BotmanorPermissionGateProps {\n /** The `resource:action` pair the wrapped control needs. */\n permission: BotmanorPermission;\n /** Rendered when the member has the permission. */\n children: ReactNode;\n /** Rendered when the member lacks the permission. Nothing by default. */\n fallback?: ReactNode;\n /** Rendered while permissions load. Nothing by default. */\n loading?: ReactNode;\n}\n\n/**\n * Render `children` only for members who hold `permission`.\n *\n * @example\n * <BotmanorPermissionGate permission={BOTMANOR_PERMISSIONS.POLICY_CREATE}>\n * <Button>Create Policy</Button>\n * </BotmanorPermissionGate>\n */\nexport const BotmanorPermissionGate: FC<BotmanorPermissionGateProps> = ({\n permission,\n children,\n fallback = null,\n loading = null,\n}) => {\n const decision = resolvePermission(useSafePermissions(), permission);\n if (decision === 'allowed') return <>{children}</>;\n if (decision === 'loading') return <>{loading}</>;\n return <>{fallback}</>;\n};\n"],"mappings":";;;;AAiCA,SAAgBE,EACd,GACA,GACoB;CAGpB,OAFKC,IACDA,EAAQ,YAAkB,YACvBA,EAAQ,cAAcC,CAAU,IAAI,YAAY,WAFlC;AAGvB;AASA,SAAgBC,IAA0C;CACxD,IAAMF,IAAUG,EAAmB;CACnC,OAAOC,GACJ,MAAmCL,EAAkBC,GAASC,CAAU,MAAM,WAC/E,CAACD,CAAO,CACV;AACF;AAMA,SAAgBK,EAA8B,GAAoD;CAChG,OAAON,EAAkBI,EAAmB,GAAGF,CAAU;AAC3D;AAGA,SAAgBK,EAAsB,GAAyC;CAC7E,OAAOJ,EAAe,CAAC,CAACD,CAAU;AACpC;AAqBA,IAAaM,KAA2D,EACtE,eACA,aACA,cAAW,MACX,aAAU,WACN;CACJ,IAAMC,IAAWT,EAAkBI,EAAmB,GAAGF,CAAU;CAGnE,OAFIO,MAAa,YAAkB,kBAAAX,GAAA,EAAG,YAAW,CAAA,IAC7CW,MAAa,YAAkB,kBAAAX,GAAA,EAAA,UAAGY,EAAU,CAAA,IACzC,kBAAAZ,GAAA,EAAA,UAAGa,EAAW,CAAA;AACvB"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Prompt variable values typed in a text field, converted for the variable's
3
+ * declared type before they are sent (BOFF-15360). Text that does not parse
4
+ * is sent as typed, so the server names the variable that is invalid.
5
+ */
6
+ export declare function typedVariableValue(type: string, text: string): unknown;
@@ -0,0 +1,20 @@
1
+ // src/botlit/utils/promptVariables.ts
2
+ function e(e, t) {
3
+ if (e === "number") {
4
+ let e = Number(t);
5
+ return t.trim() !== "" && Number.isFinite(e) ? e : t;
6
+ }
7
+ if (e === "boolean") {
8
+ let e = t.trim().toLowerCase();
9
+ return e === "true" || e !== "false" && t;
10
+ }
11
+ if (e === "object" || e === "array") try {
12
+ return JSON.parse(t);
13
+ } catch {
14
+ return t;
15
+ }
16
+ return t;
17
+ }
18
+ export { e as typedVariableValue };
19
+
20
+ //# sourceMappingURL=promptVariables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptVariables.js","names":["typedVariableValue","type","parsed","text","normalized"],"sources":["../../../src/botlit/utils/promptVariables.ts"],"sourcesContent":["/**\n * Prompt variable values typed in a text field, converted for the variable's\n * declared type before they are sent (BOFF-15360). Text that does not parse\n * is sent as typed, so the server names the variable that is invalid.\n */\nexport function typedVariableValue(type: string, text: string): unknown {\n if (type === 'number') {\n const parsed = Number(text);\n return text.trim() !== '' && Number.isFinite(parsed) ? parsed : text;\n }\n if (type === 'boolean') {\n const normalized = text.trim().toLowerCase();\n return normalized === 'true' ? true : normalized === 'false' ? false : text;\n }\n if (type === 'object' || type === 'array') {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n return text;\n}\n"],"mappings":";AAKA,SAAgBA,EAAmB,GAAc,GAAuB;CACtE,IAAIC,MAAS,UAAU;EACrB,IAAMC,IAAS,OAAOC,CAAI;EAC1B,OAAOA,EAAK,KAAK,MAAM,MAAM,OAAO,SAASD,CAAM,IAAIA,IAASC;CAClE;CACA,IAAIF,MAAS,WAAW;EACtB,IAAMG,IAAaD,EAAK,KAAK,CAAC,CAAC,YAAY;EAC3C,OAAOC,MAAe,UAAgBA,MAAe,WAAkBD;CACzE;CACA,IAAIF,MAAS,YAAYA,MAAS,SAChC,IAAI;EACF,OAAO,KAAK,MAAME,CAAI;CACxB,QAAQ;EACN,OAAOA;CACT;CAEF,OAAOA;AACT"}
@@ -510,6 +510,7 @@ export type PromptTemplateFilterInput = {
510
510
  visibility?: Visibility | null | undefined;
511
511
  workspaceId?: string | number | null | undefined;
512
512
  };
513
+ export type PromptVersionBump = 'MAJOR' | 'MINOR' | 'PATCH';
513
514
  export type RetrievalMode = 'BM25_ONLY' | 'HYBRID' | 'VECTOR';
514
515
  export type RetrievalProfileFilterInput = {
515
516
  bucketId?: string | number | null | undefined;
@@ -519,6 +520,14 @@ export type RetrievalProfileFilterInput = {
519
520
  workspaceId?: string | number | null | undefined;
520
521
  };
521
522
  export type RoutingStrategy = 'CUSTOM' | 'INTELLIGENT' | 'ROUND_ROBIN' | 'SINGLE';
523
+ export type SavePromptTemplateVersionInput = {
524
+ bump?: PromptVersionBump | null | undefined;
525
+ changelog?: string | null | undefined;
526
+ templateText: string;
527
+ variables?: Record<string, unknown> | null | undefined;
528
+ /** Explicit MAJOR.MINOR.PATCH version; otherwise the current version is bumped. */
529
+ version?: string | null | undefined;
530
+ };
522
531
  /** Input for sending a message to an external channel */
523
532
  export type SendChannelMessageInput = {
524
533
  /** Bot app ID sending the message */
@@ -542,6 +551,15 @@ export type SendChannelMessageInput = {
542
551
  /** Workspace ID */
543
552
  workspaceId: string | number;
544
553
  };
554
+ /** Omit a field to leave that binding unchanged; pass null to detach it. */
555
+ export type SetAgentBindingsInput = {
556
+ promptTemplateId?: string | number | null | undefined;
557
+ /** Values for the template's declared variables, keyed by name. */
558
+ promptVariables?: Record<string, unknown> | null | undefined;
559
+ retrievalProfileId?: string | number | null | undefined;
560
+ /** The complete, ordered skill list. An empty list detaches every skill. */
561
+ skillIds?: Array<string | number> | null | undefined;
562
+ };
545
563
  export type SkillFilterInput = {
546
564
  bucketId?: string | number | null | undefined;
547
565
  promptTemplateId?: string | number | null | undefined;
@@ -558,6 +576,21 @@ export type StorePackageFilterInput = {
558
576
  publishedBy?: string | number | null | undefined;
559
577
  search?: string | null | undefined;
560
578
  };
579
+ /** Prompt Studio run of a template against a live model (BOFF-15360). */
580
+ export type TestPromptTemplateInput = {
581
+ /** An active model registered in this workspace. */
582
+ llmModelId: string | number;
583
+ maxTokens?: number | null | undefined;
584
+ temperature?: number | null | undefined;
585
+ /** Draft text to run; the saved text when omitted. */
586
+ templateText?: string | null | undefined;
587
+ /** The user message the rendered prompt answers. */
588
+ userMessage: string;
589
+ /** Draft variable contract; the saved contract when omitted. */
590
+ variableDefinitions?: Record<string, unknown> | null | undefined;
591
+ /** Values for the template variables, keyed by name. */
592
+ variables?: Record<string, unknown> | null | undefined;
593
+ };
561
594
  export type UpdateA2ARegistryEntryInput = {
562
595
  agentCard?: Record<string, unknown> | null | undefined;
563
596
  bucketId?: string | number | null | undefined;
@@ -881,6 +914,98 @@ export type DeleteA2ARegistryEntryMutationVariables = Exact<{
881
914
  export type DeleteA2ARegistryEntryMutation = {
882
915
  deleteA2ARegistryEntry: boolean;
883
916
  };
917
+ export type AgentBindingsFieldsFragment = {
918
+ agentId: string;
919
+ effectiveSystemPrompt: string;
920
+ promptTemplate: {
921
+ promptTemplateId: string;
922
+ name: string;
923
+ version: string;
924
+ status: Types.EntityStatus;
925
+ variables: Record<string, unknown>;
926
+ } | null;
927
+ skills: Array<{
928
+ skillId: string;
929
+ name: string;
930
+ description: string | null;
931
+ status: Types.EntityStatus;
932
+ position: number;
933
+ }>;
934
+ retrievalProfile: {
935
+ retrievalProfileId: string;
936
+ name: string;
937
+ status: Types.EntityStatus;
938
+ strategyMode: Types.RetrievalMode;
939
+ topK: number;
940
+ minRelevanceScore: number | null;
941
+ noAnswerIfBelowThreshold: boolean;
942
+ } | null;
943
+ };
944
+ export type GetAgentBindingsQueryVariables = Exact<{
945
+ agentId: string | number;
946
+ }>;
947
+ export type GetAgentBindingsQuery = {
948
+ getAgentBindings: {
949
+ agentId: string;
950
+ effectiveSystemPrompt: string;
951
+ promptTemplate: {
952
+ promptTemplateId: string;
953
+ name: string;
954
+ version: string;
955
+ status: Types.EntityStatus;
956
+ variables: Record<string, unknown>;
957
+ } | null;
958
+ skills: Array<{
959
+ skillId: string;
960
+ name: string;
961
+ description: string | null;
962
+ status: Types.EntityStatus;
963
+ position: number;
964
+ }>;
965
+ retrievalProfile: {
966
+ retrievalProfileId: string;
967
+ name: string;
968
+ status: Types.EntityStatus;
969
+ strategyMode: Types.RetrievalMode;
970
+ topK: number;
971
+ minRelevanceScore: number | null;
972
+ noAnswerIfBelowThreshold: boolean;
973
+ } | null;
974
+ };
975
+ };
976
+ export type SetAgentBindingsMutationVariables = Exact<{
977
+ agentId: string | number;
978
+ input: Types.SetAgentBindingsInput;
979
+ }>;
980
+ export type SetAgentBindingsMutation = {
981
+ setAgentBindings: {
982
+ agentId: string;
983
+ effectiveSystemPrompt: string;
984
+ promptTemplate: {
985
+ promptTemplateId: string;
986
+ name: string;
987
+ version: string;
988
+ status: Types.EntityStatus;
989
+ variables: Record<string, unknown>;
990
+ } | null;
991
+ skills: Array<{
992
+ skillId: string;
993
+ name: string;
994
+ description: string | null;
995
+ status: Types.EntityStatus;
996
+ position: number;
997
+ }>;
998
+ retrievalProfile: {
999
+ retrievalProfileId: string;
1000
+ name: string;
1001
+ status: Types.EntityStatus;
1002
+ strategyMode: Types.RetrievalMode;
1003
+ topK: number;
1004
+ minRelevanceScore: number | null;
1005
+ noAnswerIfBelowThreshold: boolean;
1006
+ } | null;
1007
+ };
1008
+ };
884
1009
  export type ListBotmanorAgentsQueryVariables = Exact<{
885
1010
  filters?: Types.BotmanorAgentFilterInput | null | undefined;
886
1011
  pagination?: Types.PaginationInput | null | undefined;
@@ -2527,6 +2652,62 @@ export type RenderPromptTemplateMutationVariables = Exact<{
2527
2652
  export type RenderPromptTemplateMutation = {
2528
2653
  renderPromptTemplate: string;
2529
2654
  };
2655
+ export type TestPromptTemplateMutationVariables = Exact<{
2656
+ id: string | number;
2657
+ input: Types.TestPromptTemplateInput;
2658
+ }>;
2659
+ export type TestPromptTemplateMutation = {
2660
+ testPromptTemplate: {
2661
+ renderedPrompt: string;
2662
+ output: string;
2663
+ model: string;
2664
+ tokensUsed: number;
2665
+ inputTokens: number | null;
2666
+ outputTokens: number | null;
2667
+ latencyMs: number;
2668
+ };
2669
+ };
2670
+ export type SavePromptTemplateVersionMutationVariables = Exact<{
2671
+ id: string | number;
2672
+ input: Types.SavePromptTemplateVersionInput;
2673
+ }>;
2674
+ export type SavePromptTemplateVersionMutation = {
2675
+ savePromptTemplateVersion: {
2676
+ id: string;
2677
+ version: string;
2678
+ revision: number;
2679
+ templateText: string;
2680
+ variables: Record<string, unknown>;
2681
+ updatedAt: string;
2682
+ versionHistory: Array<{
2683
+ version: string;
2684
+ revision: number;
2685
+ templateText: string;
2686
+ variables: Record<string, unknown>;
2687
+ changelog: string | null;
2688
+ savedAt: string;
2689
+ savedById: string;
2690
+ }>;
2691
+ };
2692
+ };
2693
+ export type GetPromptTemplateVersionsQueryVariables = Exact<{
2694
+ id: string | number;
2695
+ }>;
2696
+ export type GetPromptTemplateVersionsQuery = {
2697
+ getPromptTemplate: {
2698
+ id: string;
2699
+ version: string;
2700
+ versionHistory: Array<{
2701
+ version: string;
2702
+ revision: number;
2703
+ templateText: string;
2704
+ variables: Record<string, unknown>;
2705
+ changelog: string | null;
2706
+ savedAt: string;
2707
+ savedById: string;
2708
+ }>;
2709
+ } | null;
2710
+ };
2530
2711
  export type BotmanorRetentionStatusQueryVariables = Exact<{
2531
2712
  [key: string]: never;
2532
2713
  }>;
@@ -3101,6 +3282,7 @@ export type ForkInstalledPackageMutation = {
3101
3282
  } | null;
3102
3283
  };
3103
3284
  };
3285
+ export declare const AgentBindingsFieldsFragmentDoc: Apollo.DocumentNode;
3104
3286
  export declare const StorePackageFieldsFragmentDoc: Apollo.DocumentNode;
3105
3287
  export declare const InstalledPackageFieldsFragmentDoc: Apollo.DocumentNode;
3106
3288
  export declare const GetA2ARegistryEntryDocument: Apollo.DocumentNode;
@@ -3229,6 +3411,60 @@ export declare function useDeleteA2ARegistryEntryMutation(baseOptions?: ApolloRe
3229
3411
  export type DeleteA2ARegistryEntryMutationHookResult = ReturnType<typeof useDeleteA2ARegistryEntryMutation>;
3230
3412
  export type DeleteA2ARegistryEntryMutationResult = Apollo.MutationResult<Types.DeleteA2ARegistryEntryMutation>;
3231
3413
  export type DeleteA2ARegistryEntryMutationOptions = Apollo.BaseMutationOptions<Types.DeleteA2ARegistryEntryMutation, Types.DeleteA2ARegistryEntryMutationVariables>;
3414
+ export declare const GetAgentBindingsDocument: Apollo.DocumentNode;
3415
+ /**
3416
+ * __useGetAgentBindingsQuery__
3417
+ *
3418
+ * To run a query within a React component, call `useGetAgentBindingsQuery` and pass it any options that fit your needs.
3419
+ * When your component renders, `useGetAgentBindingsQuery` returns an object from Apollo Client that contains loading, error, and data properties
3420
+ * you can use to render your UI.
3421
+ *
3422
+ * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
3423
+ *
3424
+ * @example
3425
+ * const { data, loading, error } = useGetAgentBindingsQuery({
3426
+ * variables: {
3427
+ * agentId: // value for 'agentId'
3428
+ * },
3429
+ * });
3430
+ */
3431
+ export declare function useGetAgentBindingsQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables> & ({
3432
+ variables: Types.GetAgentBindingsQueryVariables;
3433
+ skip?: boolean;
3434
+ } | {
3435
+ skip: boolean;
3436
+ })): ApolloReactHooks.useQuery.Result<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables, "empty" | "complete" | "streaming", Types.GetAgentBindingsQueryVariables, undefined>;
3437
+ export declare function useGetAgentBindingsLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables>): ApolloReactHooks.useLazyQuery.ResultTuple<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables, "empty" | "complete" | "streaming", undefined>;
3438
+ export declare function useGetAgentBindingsSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables>;
3439
+ export declare function useGetAgentBindingsSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetAgentBindingsQuery | undefined, Types.GetAgentBindingsQueryVariables>;
3440
+ export type GetAgentBindingsQueryHookResult = ReturnType<typeof useGetAgentBindingsQuery>;
3441
+ export type GetAgentBindingsLazyQueryHookResult = ReturnType<typeof useGetAgentBindingsLazyQuery>;
3442
+ export type GetAgentBindingsSuspenseQueryHookResult = ReturnType<typeof useGetAgentBindingsSuspenseQuery>;
3443
+ export type GetAgentBindingsQueryResult = Apollo.QueryResult<Types.GetAgentBindingsQuery, Types.GetAgentBindingsQueryVariables>;
3444
+ export declare const SetAgentBindingsDocument: Apollo.DocumentNode;
3445
+ export type SetAgentBindingsMutationFn = Apollo.MutationFunction<Types.SetAgentBindingsMutation, Types.SetAgentBindingsMutationVariables>;
3446
+ /**
3447
+ * __useSetAgentBindingsMutation__
3448
+ *
3449
+ * To run a mutation, you first call `useSetAgentBindingsMutation` within a React component and pass it any options that fit your needs.
3450
+ * When your component renders, `useSetAgentBindingsMutation` returns a tuple that includes:
3451
+ * - A mutate function that you can call at any time to execute the mutation
3452
+ * - An object with fields that represent the current status of the mutation's execution
3453
+ *
3454
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
3455
+ *
3456
+ * @example
3457
+ * const [setAgentBindingsMutation, { data, loading, error }] = useSetAgentBindingsMutation({
3458
+ * variables: {
3459
+ * agentId: // value for 'agentId'
3460
+ * input: // value for 'input'
3461
+ * },
3462
+ * });
3463
+ */
3464
+ export declare function useSetAgentBindingsMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.SetAgentBindingsMutation, Types.SetAgentBindingsMutationVariables>): ApolloReactHooks.useMutation.ResultTuple<Types.SetAgentBindingsMutation, any, Apollo.ApolloCache, undefined>;
3465
+ export type SetAgentBindingsMutationHookResult = ReturnType<typeof useSetAgentBindingsMutation>;
3466
+ export type SetAgentBindingsMutationResult = Apollo.MutationResult<Types.SetAgentBindingsMutation>;
3467
+ export type SetAgentBindingsMutationOptions = Apollo.BaseMutationOptions<Types.SetAgentBindingsMutation, Types.SetAgentBindingsMutationVariables>;
3232
3468
  export declare const ListBotmanorAgentsDocument: Apollo.DocumentNode;
3233
3469
  /**
3234
3470
  * __useListBotmanorAgentsQuery__
@@ -5499,6 +5735,84 @@ export declare function useRenderPromptTemplateMutation(baseOptions?: ApolloReac
5499
5735
  export type RenderPromptTemplateMutationHookResult = ReturnType<typeof useRenderPromptTemplateMutation>;
5500
5736
  export type RenderPromptTemplateMutationResult = Apollo.MutationResult<Types.RenderPromptTemplateMutation>;
5501
5737
  export type RenderPromptTemplateMutationOptions = Apollo.BaseMutationOptions<Types.RenderPromptTemplateMutation, Types.RenderPromptTemplateMutationVariables>;
5738
+ export declare const TestPromptTemplateDocument: Apollo.DocumentNode;
5739
+ export type TestPromptTemplateMutationFn = Apollo.MutationFunction<Types.TestPromptTemplateMutation, Types.TestPromptTemplateMutationVariables>;
5740
+ /**
5741
+ * __useTestPromptTemplateMutation__
5742
+ *
5743
+ * To run a mutation, you first call `useTestPromptTemplateMutation` within a React component and pass it any options that fit your needs.
5744
+ * When your component renders, `useTestPromptTemplateMutation` returns a tuple that includes:
5745
+ * - A mutate function that you can call at any time to execute the mutation
5746
+ * - An object with fields that represent the current status of the mutation's execution
5747
+ *
5748
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
5749
+ *
5750
+ * @example
5751
+ * const [testPromptTemplateMutation, { data, loading, error }] = useTestPromptTemplateMutation({
5752
+ * variables: {
5753
+ * id: // value for 'id'
5754
+ * input: // value for 'input'
5755
+ * },
5756
+ * });
5757
+ */
5758
+ export declare function useTestPromptTemplateMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.TestPromptTemplateMutation, Types.TestPromptTemplateMutationVariables>): ApolloReactHooks.useMutation.ResultTuple<Types.TestPromptTemplateMutation, any, Apollo.ApolloCache, undefined>;
5759
+ export type TestPromptTemplateMutationHookResult = ReturnType<typeof useTestPromptTemplateMutation>;
5760
+ export type TestPromptTemplateMutationResult = Apollo.MutationResult<Types.TestPromptTemplateMutation>;
5761
+ export type TestPromptTemplateMutationOptions = Apollo.BaseMutationOptions<Types.TestPromptTemplateMutation, Types.TestPromptTemplateMutationVariables>;
5762
+ export declare const SavePromptTemplateVersionDocument: Apollo.DocumentNode;
5763
+ export type SavePromptTemplateVersionMutationFn = Apollo.MutationFunction<Types.SavePromptTemplateVersionMutation, Types.SavePromptTemplateVersionMutationVariables>;
5764
+ /**
5765
+ * __useSavePromptTemplateVersionMutation__
5766
+ *
5767
+ * To run a mutation, you first call `useSavePromptTemplateVersionMutation` within a React component and pass it any options that fit your needs.
5768
+ * When your component renders, `useSavePromptTemplateVersionMutation` returns a tuple that includes:
5769
+ * - A mutate function that you can call at any time to execute the mutation
5770
+ * - An object with fields that represent the current status of the mutation's execution
5771
+ *
5772
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
5773
+ *
5774
+ * @example
5775
+ * const [savePromptTemplateVersionMutation, { data, loading, error }] = useSavePromptTemplateVersionMutation({
5776
+ * variables: {
5777
+ * id: // value for 'id'
5778
+ * input: // value for 'input'
5779
+ * },
5780
+ * });
5781
+ */
5782
+ export declare function useSavePromptTemplateVersionMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.SavePromptTemplateVersionMutation, Types.SavePromptTemplateVersionMutationVariables>): ApolloReactHooks.useMutation.ResultTuple<Types.SavePromptTemplateVersionMutation, any, Apollo.ApolloCache, undefined>;
5783
+ export type SavePromptTemplateVersionMutationHookResult = ReturnType<typeof useSavePromptTemplateVersionMutation>;
5784
+ export type SavePromptTemplateVersionMutationResult = Apollo.MutationResult<Types.SavePromptTemplateVersionMutation>;
5785
+ export type SavePromptTemplateVersionMutationOptions = Apollo.BaseMutationOptions<Types.SavePromptTemplateVersionMutation, Types.SavePromptTemplateVersionMutationVariables>;
5786
+ export declare const GetPromptTemplateVersionsDocument: Apollo.DocumentNode;
5787
+ /**
5788
+ * __useGetPromptTemplateVersionsQuery__
5789
+ *
5790
+ * To run a query within a React component, call `useGetPromptTemplateVersionsQuery` and pass it any options that fit your needs.
5791
+ * When your component renders, `useGetPromptTemplateVersionsQuery` returns an object from Apollo Client that contains loading, error, and data properties
5792
+ * you can use to render your UI.
5793
+ *
5794
+ * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
5795
+ *
5796
+ * @example
5797
+ * const { data, loading, error } = useGetPromptTemplateVersionsQuery({
5798
+ * variables: {
5799
+ * id: // value for 'id'
5800
+ * },
5801
+ * });
5802
+ */
5803
+ export declare function useGetPromptTemplateVersionsQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables> & ({
5804
+ variables: Types.GetPromptTemplateVersionsQueryVariables;
5805
+ skip?: boolean;
5806
+ } | {
5807
+ skip: boolean;
5808
+ })): ApolloReactHooks.useQuery.Result<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables, "empty" | "complete" | "streaming", Types.GetPromptTemplateVersionsQueryVariables, undefined>;
5809
+ export declare function useGetPromptTemplateVersionsLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables>): ApolloReactHooks.useLazyQuery.ResultTuple<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables, "empty" | "complete" | "streaming", undefined>;
5810
+ export declare function useGetPromptTemplateVersionsSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables>;
5811
+ export declare function useGetPromptTemplateVersionsSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetPromptTemplateVersionsQuery | undefined, Types.GetPromptTemplateVersionsQueryVariables>;
5812
+ export type GetPromptTemplateVersionsQueryHookResult = ReturnType<typeof useGetPromptTemplateVersionsQuery>;
5813
+ export type GetPromptTemplateVersionsLazyQueryHookResult = ReturnType<typeof useGetPromptTemplateVersionsLazyQuery>;
5814
+ export type GetPromptTemplateVersionsSuspenseQueryHookResult = ReturnType<typeof useGetPromptTemplateVersionsSuspenseQuery>;
5815
+ export type GetPromptTemplateVersionsQueryResult = Apollo.QueryResult<Types.GetPromptTemplateVersionsQuery, Types.GetPromptTemplateVersionsQueryVariables>;
5502
5816
  export declare const BotmanorRetentionStatusDocument: Apollo.DocumentNode;
5503
5817
  /**
5504
5818
  * __useBotmanorRetentionStatusQuery__