spine-framework 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.framework/README.md +129 -0
- package/.framework/cli/bin.cjs +14 -0
- package/.framework/cli/commands/agents.ts +153 -0
- package/.framework/cli/commands/auth.ts +94 -0
- package/.framework/cli/commands/create-app.ts +185 -0
- package/.framework/cli/commands/dev.ts +295 -0
- package/.framework/cli/commands/doctor.ts +442 -0
- package/.framework/cli/commands/generate.ts +332 -0
- package/.framework/cli/commands/init.ts +272 -0
- package/.framework/cli/commands/install-app.ts +391 -0
- package/.framework/cli/commands/items.ts +253 -0
- package/.framework/cli/commands/migrations.ts +141 -0
- package/.framework/cli/commands/pipelines.ts +166 -0
- package/.framework/cli/commands/status.ts +197 -0
- package/.framework/cli/commands/system.ts +184 -0
- package/.framework/cli/commands/test.ts +227 -0
- package/.framework/cli/commands/uninstall-app.ts +166 -0
- package/.framework/cli/context.ts +268 -0
- package/.framework/cli/env-loader.ts +36 -0
- package/.framework/cli/index.ts +106 -0
- package/.framework/cli/welcome.cjs +45 -0
- package/.framework/docs/API.md +384 -0
- package/.framework/docs/STABILITY.md +52 -0
- package/.framework/docs/admin-routes.md +76 -0
- package/.framework/docs/api-docs-progress.md +38 -0
- package/.framework/docs/api-governance.md +146 -0
- package/.framework/docs/api-testing-results.md +212 -0
- package/.framework/docs/apis/admin-configs.md +567 -0
- package/.framework/docs/apis/admin-data.md +272 -0
- package/.framework/docs/apis/index.md +231 -0
- package/.framework/docs/apis/internal.md +295 -0
- package/.framework/docs/apis/runtime.md +537 -0
- package/.framework/docs/assembly-launch-guide.md +138 -0
- package/.framework/docs/audit-results.md +590 -0
- package/.framework/docs/authorization-model.md +170 -0
- package/.framework/docs/db-api-inventory.md +95 -0
- package/.framework/docs/examples/custom-app/README.md +77 -0
- package/.framework/docs/examples/custom-function/README.md +27 -0
- package/.framework/docs/examples/custom-function/handler.ts +48 -0
- package/.framework/docs/examples/custom-webhook/README.md +68 -0
- package/.framework/docs/gap-remediation-backlog.md +103 -0
- package/.framework/docs/guides/cli-guide.md +224 -0
- package/.framework/docs/guides/getting-started.md +103 -0
- package/.framework/docs/guides/import-guide.md +193 -0
- package/.framework/docs/guides/testing-guide.md +229 -0
- package/.framework/docs/permission-examples.md +326 -0
- package/.framework/docs/ui-adoption-verification.md +111 -0
- package/.framework/docs/ui-api-coverage.md +84 -0
- package/.framework/docs/v2-compatibility-audit.md +228 -0
- package/.framework/functions/.gitkeep +1 -0
- package/.framework/functions/_shared/agent-runner.ts +1097 -0
- package/.framework/functions/_shared/app-manifest.ts +184 -0
- package/.framework/functions/_shared/audit.ts +150 -0
- package/.framework/functions/_shared/db.ts +174 -0
- package/.framework/functions/_shared/index.ts +382 -0
- package/.framework/functions/_shared/middleware.ts +490 -0
- package/.framework/functions/_shared/permissions.ts +1325 -0
- package/.framework/functions/_shared/pipeline-runner.ts +731 -0
- package/.framework/functions/_shared/principal.ts +760 -0
- package/.framework/functions/_shared/schema-utils.ts +967 -0
- package/.framework/functions/_shared/testing.ts +258 -0
- package/.framework/functions/_shared/trigger-engine.ts +425 -0
- package/.framework/functions/_shared/webhook-registration.ts +168 -0
- package/.framework/functions/_shared/webhook-registry.ts +129 -0
- package/.framework/functions/account-nodes.ts +111 -0
- package/.framework/functions/admin-data.ts +606 -0
- package/.framework/functions/ai-agents.ts +323 -0
- package/.framework/functions/api-keys.ts +376 -0
- package/.framework/functions/apps.ts +483 -0
- package/.framework/functions/auth.ts +196 -0
- package/.framework/functions/debug-auth.ts +107 -0
- package/.framework/functions/embeddings.ts +556 -0
- package/.framework/functions/integration-routes.ts +523 -0
- package/.framework/functions/integrations.ts +319 -0
- package/.framework/functions/item-progress.ts +272 -0
- package/.framework/functions/logs.ts +438 -0
- package/.framework/functions/observability.ts +275 -0
- package/.framework/functions/pipeline-executions.ts +494 -0
- package/.framework/functions/pipelines.ts +485 -0
- package/.framework/functions/prompt-configs.ts +339 -0
- package/.framework/functions/roles.ts +387 -0
- package/.framework/functions/system-cron.ts +742 -0
- package/.framework/functions/system.ts +323 -0
- package/.framework/functions/tests.ts +119 -0
- package/.framework/functions/timers.ts +357 -0
- package/.framework/functions/triggers.ts +563 -0
- package/.framework/functions/types.ts +604 -0
- package/.framework/migrations/000_foundation.sql +1256 -0
- package/.framework/migrations/001_seed.sql +92 -0
- package/.framework/migrations/002_seed_constraints.sql +13 -0
- package/.framework/migrations/003_auth_user_trigger.sql +59 -0
- package/.framework/src/App.tsx +126 -0
- package/.framework/src/apps/admin/index.tsx +173 -0
- package/.framework/src/components/AppWrapper.tsx +56 -0
- package/.framework/src/components/CustomAppLoader.tsx +116 -0
- package/.framework/src/components/admin/AdminListPage.tsx +151 -0
- package/.framework/src/components/admin/AdminSidebar.tsx +166 -0
- package/.framework/src/components/admin/AdminStatsCard.tsx +62 -0
- package/.framework/src/components/admin/SortableTableHeader.tsx +42 -0
- package/.framework/src/components/app-shell/GenericAppShell.tsx +181 -0
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +200 -0
- package/.framework/src/components/app-shell/GenericListPage.tsx +116 -0
- package/.framework/src/components/app-sidebar.tsx +228 -0
- package/.framework/src/components/auth/ProtectedRoute.tsx +88 -0
- package/.framework/src/components/layout/AppShell.tsx +91 -0
- package/.framework/src/components/layout/Header.tsx +88 -0
- package/.framework/src/components/layout/Layout.tsx +95 -0
- package/.framework/src/components/layout/Sidebar.tsx +329 -0
- package/.framework/src/components/runtime/DataDetailHeader.tsx +77 -0
- package/.framework/src/components/runtime/DataDetailPage.tsx +171 -0
- package/.framework/src/components/runtime/DataFilters.tsx +91 -0
- package/.framework/src/components/runtime/DataHeader.tsx +68 -0
- package/.framework/src/components/runtime/DataListPage.tsx +124 -0
- package/.framework/src/components/runtime/DataStats.tsx +70 -0
- package/.framework/src/components/runtime/DataTable.tsx +174 -0
- package/.framework/src/components/runtime/SchemaDetailForm.tsx +134 -0
- package/.framework/src/components/runtime/index.ts +18 -0
- package/.framework/src/components/search-form.tsx +29 -0
- package/.framework/src/components/shared/AgentView.tsx +213 -0
- package/.framework/src/components/shared/FieldRenderer.tsx +478 -0
- package/.framework/src/components/shared/SchemaFields.tsx +226 -0
- package/.framework/src/components/ui/DataTable.tsx +343 -0
- package/.framework/src/components/ui/Form.tsx +281 -0
- package/.framework/src/components/ui/ItemCard.tsx +296 -0
- package/.framework/src/components/ui/ItemListView.tsx +308 -0
- package/.framework/src/components/ui/LoadingSpinner.tsx +52 -0
- package/.framework/src/components/ui/Modal.tsx +61 -0
- package/.framework/src/components/ui/RichTextEditor.tsx +210 -0
- package/.framework/src/components/ui/accordion.tsx +82 -0
- package/.framework/src/components/ui/alert-dialog.tsx +197 -0
- package/.framework/src/components/ui/alert.tsx +76 -0
- package/.framework/src/components/ui/aspect-ratio.tsx +11 -0
- package/.framework/src/components/ui/avatar.tsx +110 -0
- package/.framework/src/components/ui/badge.tsx +49 -0
- package/.framework/src/components/ui/breadcrumb.tsx +122 -0
- package/.framework/src/components/ui/button-group.tsx +83 -0
- package/.framework/src/components/ui/button.tsx +65 -0
- package/.framework/src/components/ui/calendar.tsx +222 -0
- package/.framework/src/components/ui/card.tsx +100 -0
- package/.framework/src/components/ui/carousel.tsx +240 -0
- package/.framework/src/components/ui/chart.tsx +373 -0
- package/.framework/src/components/ui/checkbox.tsx +31 -0
- package/.framework/src/components/ui/collapsible.tsx +33 -0
- package/.framework/src/components/ui/combobox.tsx +299 -0
- package/.framework/src/components/ui/command.tsx +193 -0
- package/.framework/src/components/ui/context-menu.tsx +261 -0
- package/.framework/src/components/ui/dialog.tsx +165 -0
- package/.framework/src/components/ui/direction.tsx +22 -0
- package/.framework/src/components/ui/drawer.tsx +132 -0
- package/.framework/src/components/ui/dropdown-menu.tsx +269 -0
- package/.framework/src/components/ui/empty.tsx +104 -0
- package/.framework/src/components/ui/field.tsx +238 -0
- package/.framework/src/components/ui/hover-card.tsx +42 -0
- package/.framework/src/components/ui/input-group.tsx +153 -0
- package/.framework/src/components/ui/input-otp.tsx +87 -0
- package/.framework/src/components/ui/input.tsx +19 -0
- package/.framework/src/components/ui/item.tsx +196 -0
- package/.framework/src/components/ui/kbd.tsx +26 -0
- package/.framework/src/components/ui/label.tsx +22 -0
- package/.framework/src/components/ui/menubar.tsx +277 -0
- package/.framework/src/components/ui/native-select.tsx +61 -0
- package/.framework/src/components/ui/navigation-menu.tsx +164 -0
- package/.framework/src/components/ui/pagination.tsx +129 -0
- package/.framework/src/components/ui/popover.tsx +87 -0
- package/.framework/src/components/ui/progress.tsx +31 -0
- package/.framework/src/components/ui/radio-group.tsx +42 -0
- package/.framework/src/components/ui/resizable.tsx +50 -0
- package/.framework/src/components/ui/scroll-area.tsx +53 -0
- package/.framework/src/components/ui/select.tsx +195 -0
- package/.framework/src/components/ui/separator.tsx +26 -0
- package/.framework/src/components/ui/sheet.tsx +145 -0
- package/.framework/src/components/ui/sidebar.tsx +706 -0
- package/.framework/src/components/ui/skeleton.tsx +13 -0
- package/.framework/src/components/ui/slider.tsx +59 -0
- package/.framework/src/components/ui/sonner.tsx +47 -0
- package/.framework/src/components/ui/spinner.tsx +10 -0
- package/.framework/src/components/ui/switch.tsx +33 -0
- package/.framework/src/components/ui/table-primitives.tsx +141 -0
- package/.framework/src/components/ui/table.tsx +114 -0
- package/.framework/src/components/ui/tabs.tsx +90 -0
- package/.framework/src/components/ui/textarea.tsx +18 -0
- package/.framework/src/components/ui/toggle-group.tsx +89 -0
- package/.framework/src/components/ui/toggle.tsx +45 -0
- package/.framework/src/components/ui/tooltip.tsx +57 -0
- package/.framework/src/contexts/AppContext.tsx +133 -0
- package/.framework/src/contexts/AuthContext.tsx +371 -0
- package/.framework/src/hooks/use-mobile.ts +19 -0
- package/.framework/src/hooks/useApi.ts +526 -0
- package/.framework/src/hooks/useApps.ts +114 -0
- package/.framework/src/hooks/useEntityList.ts +190 -0
- package/.framework/src/hooks/useEntityRecord.ts +308 -0
- package/.framework/src/hooks/useForm.ts +307 -0
- package/.framework/src/hooks/useListSchema.ts +264 -0
- package/.framework/src/hooks/useSchemaRecord.ts +223 -0
- package/.framework/src/index.css +128 -0
- package/.framework/src/lib/api.ts +156 -0
- package/.framework/src/lib/supabase.ts +94 -0
- package/.framework/src/lib/utils.ts +317 -0
- package/.framework/src/main.tsx +27 -0
- package/.framework/src/pages/DashboardPage.tsx +181 -0
- package/.framework/src/pages/NotFoundPage.tsx +39 -0
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +161 -0
- package/.framework/src/pages/admin/AIAgentsPage.tsx +318 -0
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +199 -0
- package/.framework/src/pages/admin/APIKeysPage.tsx +303 -0
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +523 -0
- package/.framework/src/pages/admin/AppDetailPage.tsx +493 -0
- package/.framework/src/pages/admin/AppsPage.tsx +355 -0
- package/.framework/src/pages/admin/DesignedPage.tsx +491 -0
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +534 -0
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +424 -0
- package/.framework/src/pages/admin/ExtendedShadcnTestPage.tsx +176 -0
- package/.framework/src/pages/admin/IncrementalShadcnTestPage.tsx +109 -0
- package/.framework/src/pages/admin/IntegratedDashboard.tsx +402 -0
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +187 -0
- package/.framework/src/pages/admin/IntegrationsPage.tsx +301 -0
- package/.framework/src/pages/admin/LogsPage.tsx +283 -0
- package/.framework/src/pages/admin/MinimalShadcnTestPage.tsx +85 -0
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +470 -0
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +183 -0
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +279 -0
- package/.framework/src/pages/admin/PipelinesPage.tsx +390 -0
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +299 -0
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +292 -0
- package/.framework/src/pages/admin/ProperlyDesignedPage.tsx +434 -0
- package/.framework/src/pages/admin/RoleDetailPage.tsx +273 -0
- package/.framework/src/pages/admin/RolesPage.tsx +292 -0
- package/.framework/src/pages/admin/SelectTestPage.tsx +61 -0
- package/.framework/src/pages/admin/ShadcnTestPage.tsx +588 -0
- package/.framework/src/pages/admin/SimpleDashboard.tsx +387 -0
- package/.framework/src/pages/admin/TestRunDetailPage.tsx +172 -0
- package/.framework/src/pages/admin/TestingDashboard.tsx +257 -0
- package/.framework/src/pages/admin/TimerDetailPage.tsx +151 -0
- package/.framework/src/pages/admin/TimersPage.tsx +376 -0
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +149 -0
- package/.framework/src/pages/admin/TriggersPage.tsx +381 -0
- package/.framework/src/pages/admin/TypeDetailPage.tsx +694 -0
- package/.framework/src/pages/admin/TypesPage.tsx +295 -0
- package/.framework/src/pages/auth/LoginPage.tsx +188 -0
- package/.framework/src/pages/auth/RegisterPage.tsx +163 -0
- package/.framework/src/pages/spine-framework/APIPage.tsx +17 -0
- package/.framework/src/pages/spine-framework/CLIPage.tsx +25 -0
- package/.framework/src/types/auth.ts +125 -0
- package/.framework/src/types/types.ts +407 -0
- package/STRUCTURE.md +150 -0
- package/config/components.json +25 -0
- package/config/deno.lock +108 -0
- package/config/package-lock.json +17183 -0
- package/config/postcss.config.cjs +10 -0
- package/config/tailwind.config.cjs +78 -0
- package/config/tsconfig.build.json +32 -0
- package/config/tsconfig.cli.json +18 -0
- package/config/tsconfig.json +41 -0
- package/config/tsconfig.node.json +17 -0
- package/config/tsconfig.node.tsbuildinfo +1 -0
- package/config/tsconfig.tsbuildinfo +1 -0
- package/config/typedoc.json +16 -0
- package/config/vite.config.d.ts +2 -0
- package/config/vite.config.ts +72 -0
- package/dist/cli/commands/agents.d.ts +39 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/auth.d.ts +36 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/create-app.d.ts +23 -0
- package/dist/cli/commands/create-app.d.ts.map +1 -0
- package/dist/cli/commands/dev.d.ts +39 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/doctor.d.ts +42 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/generate.d.ts +36 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +30 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/install-app.d.ts +30 -0
- package/dist/cli/commands/install-app.d.ts.map +1 -0
- package/dist/cli/commands/items.d.ts +45 -0
- package/dist/cli/commands/items.d.ts.map +1 -0
- package/dist/cli/commands/migrations.d.ts +41 -0
- package/dist/cli/commands/migrations.d.ts.map +1 -0
- package/dist/cli/commands/pipelines.d.ts +40 -0
- package/dist/cli/commands/pipelines.d.ts.map +1 -0
- package/dist/cli/commands/status.d.ts +23 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/system.d.ts +29 -0
- package/dist/cli/commands/system.d.ts.map +1 -0
- package/dist/cli/commands/test.d.ts +46 -0
- package/dist/cli/commands/test.d.ts.map +1 -0
- package/dist/cli/commands/uninstall-app.d.ts +23 -0
- package/dist/cli/commands/uninstall-app.d.ts.map +1 -0
- package/dist/cli/context.d.ts +88 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/env-loader.d.ts +14 -0
- package/dist/cli/env-loader.d.ts.map +1 -0
- package/dist/cli/index.d.ts +41 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/functions/_shared/agent-runner.d.ts +156 -0
- package/dist/functions/_shared/agent-runner.d.ts.map +1 -0
- package/dist/functions/_shared/app-manifest.d.ts +68 -0
- package/dist/functions/_shared/app-manifest.d.ts.map +1 -0
- package/dist/functions/_shared/audit.d.ts +91 -0
- package/dist/functions/_shared/audit.d.ts.map +1 -0
- package/dist/functions/_shared/db.d.ts +125 -0
- package/dist/functions/_shared/db.d.ts.map +1 -0
- package/dist/functions/_shared/index.d.ts +298 -0
- package/dist/functions/_shared/index.d.ts.map +1 -0
- package/dist/functions/_shared/middleware.d.ts +315 -0
- package/dist/functions/_shared/middleware.d.ts.map +1 -0
- package/dist/functions/_shared/permissions.d.ts +626 -0
- package/dist/functions/_shared/permissions.d.ts.map +1 -0
- package/dist/functions/_shared/pipeline-runner.d.ts +124 -0
- package/dist/functions/_shared/pipeline-runner.d.ts.map +1 -0
- package/dist/functions/_shared/principal.d.ts +284 -0
- package/dist/functions/_shared/principal.d.ts.map +1 -0
- package/dist/functions/_shared/schema-utils.d.ts +181 -0
- package/dist/functions/_shared/schema-utils.d.ts.map +1 -0
- package/dist/functions/_shared/testing.d.ts +172 -0
- package/dist/functions/_shared/testing.d.ts.map +1 -0
- package/dist/functions/_shared/trigger-engine.d.ts +140 -0
- package/dist/functions/_shared/trigger-engine.d.ts.map +1 -0
- package/dist/functions/_shared/webhook-registration.d.ts +81 -0
- package/dist/functions/_shared/webhook-registration.d.ts.map +1 -0
- package/dist/functions/_shared/webhook-registry.d.ts +57 -0
- package/dist/functions/_shared/webhook-registry.d.ts.map +1 -0
- package/dist/functions/account-nodes.d.ts +48 -0
- package/dist/functions/account-nodes.d.ts.map +1 -0
- package/dist/functions/admin-data.d.ts +178 -0
- package/dist/functions/admin-data.d.ts.map +1 -0
- package/dist/functions/ai-agents.d.ts +125 -0
- package/dist/functions/ai-agents.d.ts.map +1 -0
- package/dist/functions/api-keys.d.ts +140 -0
- package/dist/functions/api-keys.d.ts.map +1 -0
- package/dist/functions/apps.d.ts +163 -0
- package/dist/functions/apps.d.ts.map +1 -0
- package/dist/functions/auth.d.ts +74 -0
- package/dist/functions/auth.d.ts.map +1 -0
- package/dist/functions/debug-auth.d.ts +33 -0
- package/dist/functions/debug-auth.d.ts.map +1 -0
- package/dist/functions/embeddings.d.ts +205 -0
- package/dist/functions/embeddings.d.ts.map +1 -0
- package/dist/functions/integration-routes.d.ts +45 -0
- package/dist/functions/integration-routes.d.ts.map +1 -0
- package/dist/functions/integrations.d.ts +124 -0
- package/dist/functions/integrations.d.ts.map +1 -0
- package/dist/functions/item-progress.d.ts +41 -0
- package/dist/functions/item-progress.d.ts.map +1 -0
- package/dist/functions/logs.d.ts +162 -0
- package/dist/functions/logs.d.ts.map +1 -0
- package/dist/functions/observability.d.ts +123 -0
- package/dist/functions/observability.d.ts.map +1 -0
- package/dist/functions/pipeline-executions.d.ts +190 -0
- package/dist/functions/pipeline-executions.d.ts.map +1 -0
- package/dist/functions/pipelines.d.ts +171 -0
- package/dist/functions/pipelines.d.ts.map +1 -0
- package/dist/functions/prompt-configs.d.ts +125 -0
- package/dist/functions/prompt-configs.d.ts.map +1 -0
- package/dist/functions/roles.d.ts +118 -0
- package/dist/functions/roles.d.ts.map +1 -0
- package/dist/functions/system-cron.d.ts +65 -0
- package/dist/functions/system-cron.d.ts.map +1 -0
- package/dist/functions/system.d.ts +29 -0
- package/dist/functions/system.d.ts.map +1 -0
- package/dist/functions/tests.d.ts +28 -0
- package/dist/functions/tests.d.ts.map +1 -0
- package/dist/functions/timers.d.ts +139 -0
- package/dist/functions/timers.d.ts.map +1 -0
- package/dist/functions/triggers.d.ts +203 -0
- package/dist/functions/triggers.d.ts.map +1 -0
- package/dist/functions/types.d.ts +151 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/src/types/types.d.ts +364 -0
- package/dist/src/types/types.d.ts.map +1 -0
- package/package.json +192 -0
- package/scripts/app-install-cli.ts +286 -0
- package/scripts/assemble-frontend.sh +79 -0
- package/scripts/assemble-functions.sh +62 -0
- package/scripts/assemble.sh +35 -0
- package/scripts/boundary-check.sh +106 -0
- package/scripts/build-manifest.sh +80 -0
- package/scripts/check-core-integrity.sh +82 -0
- package/scripts/ingest-chunks.cjs +202 -0
- package/scripts/kb-chunk-parser.cjs +312 -0
- package/scripts/kb-chunk-parser.ts +330 -0
- package/scripts/load-test-app-install.ts +484 -0
- package/scripts/netlify-dev-wrapper.sh +22 -0
- package/scripts/verify-integrity.sh +69 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module src/pages/admin/PromptConfigDetailPage
|
|
3
|
+
* @audience installer
|
|
4
|
+
* @layer frontend-page
|
|
5
|
+
* @stability stable
|
|
6
|
+
*
|
|
7
|
+
* Create / view / edit page for a single LLM prompt configuration.
|
|
8
|
+
* Route param: `id` (UUID). Exposes `system_prompt`, `model`,
|
|
9
|
+
* `temperature`, `max_tokens`, `prompt_type`, `category`, and
|
|
10
|
+
* `is_default` as editable fields.
|
|
11
|
+
*
|
|
12
|
+
* @seeAlso src/pages/admin/PromptConfigsPage.tsx
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { useState, useEffect } from 'react'
|
|
16
|
+
import { useParams, useNavigate } from 'react-router-dom'
|
|
17
|
+
import { Button } from '../../components/ui/button'
|
|
18
|
+
import { Input } from '../../components/ui/input'
|
|
19
|
+
import { Textarea } from '../../components/ui/textarea'
|
|
20
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../components/ui/select'
|
|
21
|
+
import { Checkbox } from '../../components/ui/checkbox'
|
|
22
|
+
import { Label } from '../../components/ui/label'
|
|
23
|
+
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card'
|
|
24
|
+
import { Skeleton } from '../../components/ui/skeleton'
|
|
25
|
+
import { Alert, AlertDescription, AlertTitle } from '../../components/ui/alert'
|
|
26
|
+
import { ArrowLeft, FileText, AlertCircle } from 'lucide-react'
|
|
27
|
+
import { useApi } from '../../hooks/useApi'
|
|
28
|
+
import { apiFetch } from '../../lib/api'
|
|
29
|
+
import { formatDateTime } from '../../lib/utils'
|
|
30
|
+
|
|
31
|
+
interface PromptConfig {
|
|
32
|
+
id: string
|
|
33
|
+
name: string
|
|
34
|
+
description?: string
|
|
35
|
+
prompt_type: string
|
|
36
|
+
category: string
|
|
37
|
+
template: string
|
|
38
|
+
variables: string[]
|
|
39
|
+
model_config: Record<string, any>
|
|
40
|
+
is_default: boolean
|
|
41
|
+
is_active: boolean
|
|
42
|
+
metadata?: Record<string, any>
|
|
43
|
+
created_at: string
|
|
44
|
+
updated_at: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const PROMPT_TYPES = [
|
|
48
|
+
{ value: 'system', label: 'System' },
|
|
49
|
+
{ value: 'user', label: 'User' },
|
|
50
|
+
{ value: 'assistant', label: 'Assistant' },
|
|
51
|
+
{ value: 'function', label: 'Function' },
|
|
52
|
+
{ value: 'general', label: 'General' }
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
export function PromptConfigDetailPage() {
|
|
56
|
+
const { id } = useParams<{ id: string }>()
|
|
57
|
+
const navigate = useNavigate()
|
|
58
|
+
const isCreateMode = !id || id === 'new'
|
|
59
|
+
|
|
60
|
+
const [formData, setFormData] = useState({
|
|
61
|
+
name: '',
|
|
62
|
+
description: '',
|
|
63
|
+
prompt_type: 'general',
|
|
64
|
+
category: 'general',
|
|
65
|
+
template: '',
|
|
66
|
+
variables: '',
|
|
67
|
+
model_config: '{}',
|
|
68
|
+
is_default: false,
|
|
69
|
+
is_active: true
|
|
70
|
+
})
|
|
71
|
+
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
72
|
+
|
|
73
|
+
const { data: config, loading, error } = useApi<PromptConfig>(
|
|
74
|
+
async () => {
|
|
75
|
+
if (isCreateMode) return null
|
|
76
|
+
const response = await apiFetch(`/api/prompt-configs?action=get&id=${id}`)
|
|
77
|
+
if (!response.ok) throw new Error('Failed to fetch')
|
|
78
|
+
const result = await response.json()
|
|
79
|
+
return result.data || result
|
|
80
|
+
},
|
|
81
|
+
{ immediate: !isCreateMode }
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (config) {
|
|
86
|
+
setFormData({
|
|
87
|
+
name: config.name || '',
|
|
88
|
+
description: config.description || '',
|
|
89
|
+
prompt_type: config.prompt_type || 'general',
|
|
90
|
+
category: config.category || 'general',
|
|
91
|
+
template: config.template || '',
|
|
92
|
+
variables: (config.variables || []).join(', '),
|
|
93
|
+
model_config: JSON.stringify(config.model_config || {}, null, 2),
|
|
94
|
+
is_default: config.is_default || false,
|
|
95
|
+
is_active: config.is_active
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
}, [config])
|
|
99
|
+
|
|
100
|
+
const handleSubmit = async (e: React.FormEvent) => {
|
|
101
|
+
e.preventDefault()
|
|
102
|
+
setIsSubmitting(true)
|
|
103
|
+
try {
|
|
104
|
+
const body = {
|
|
105
|
+
...formData,
|
|
106
|
+
variables: formData.variables.split(',').map(v => v.trim()).filter(Boolean),
|
|
107
|
+
model_config: JSON.parse(formData.model_config)
|
|
108
|
+
}
|
|
109
|
+
const url = isCreateMode ? '/api/prompt-configs' : `/api/prompt-configs?id=${id}`
|
|
110
|
+
const response = await apiFetch(url, {
|
|
111
|
+
method: isCreateMode ? 'POST' : 'PATCH',
|
|
112
|
+
headers: { 'Content-Type': 'application/json' },
|
|
113
|
+
body: JSON.stringify(body)
|
|
114
|
+
})
|
|
115
|
+
if (!response.ok) throw new Error('Failed to save')
|
|
116
|
+
const result = await response.json()
|
|
117
|
+
if (isCreateMode) { navigate(`/spine-framework/admin/configs/prompts/${result.config_id || result.id}`) } else { navigate(-1) }
|
|
118
|
+
} catch (err: any) {
|
|
119
|
+
alert(err.message)
|
|
120
|
+
} finally {
|
|
121
|
+
setIsSubmitting(false)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (loading) {
|
|
126
|
+
return (
|
|
127
|
+
<div className="space-y-6">
|
|
128
|
+
<Skeleton className="h-8 w-48" />
|
|
129
|
+
<Card>
|
|
130
|
+
<CardHeader><Skeleton className="h-6 w-32" /></CardHeader>
|
|
131
|
+
<CardContent className="space-y-4">
|
|
132
|
+
<Skeleton className="h-4 w-full" />
|
|
133
|
+
<Skeleton className="h-4 w-full" />
|
|
134
|
+
<Skeleton className="h-4 w-2/3" />
|
|
135
|
+
</CardContent>
|
|
136
|
+
</Card>
|
|
137
|
+
</div>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (error) {
|
|
142
|
+
return (
|
|
143
|
+
<Alert variant="destructive">
|
|
144
|
+
<AlertCircle className="h-4 w-4" />
|
|
145
|
+
<AlertTitle>Failed to load</AlertTitle>
|
|
146
|
+
<AlertDescription>{String(error)}</AlertDescription>
|
|
147
|
+
</Alert>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div className="space-y-6">
|
|
153
|
+
<div className="flex items-center gap-4">
|
|
154
|
+
<Button variant="ghost" onClick={() => navigate(-1)}>
|
|
155
|
+
<ArrowLeft className="w-5 h-5" />
|
|
156
|
+
</Button>
|
|
157
|
+
<h1 className="text-2xl font-bold">
|
|
158
|
+
{isCreateMode ? 'Create Prompt Config' : config?.name || 'Prompt Config'}
|
|
159
|
+
</h1>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<form onSubmit={handleSubmit} className="space-y-6">
|
|
163
|
+
<Card>
|
|
164
|
+
<CardHeader>
|
|
165
|
+
<CardTitle className="flex items-center gap-2">
|
|
166
|
+
<FileText className="w-5 h-5 text-primary" />
|
|
167
|
+
Configuration
|
|
168
|
+
</CardTitle>
|
|
169
|
+
</CardHeader>
|
|
170
|
+
<CardContent>
|
|
171
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
172
|
+
<div className="space-y-2">
|
|
173
|
+
<Label>Name *</Label>
|
|
174
|
+
<Input
|
|
175
|
+
value={formData.name}
|
|
176
|
+
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
|
177
|
+
required
|
|
178
|
+
/>
|
|
179
|
+
</div>
|
|
180
|
+
<div className="space-y-2">
|
|
181
|
+
<Label>Type</Label>
|
|
182
|
+
<Select value={formData.prompt_type} onValueChange={(v) => setFormData({ ...formData, prompt_type: v })}>
|
|
183
|
+
<SelectTrigger>
|
|
184
|
+
<SelectValue />
|
|
185
|
+
</SelectTrigger>
|
|
186
|
+
<SelectContent>
|
|
187
|
+
{PROMPT_TYPES.map(opt => <SelectItem key={opt.value} value={opt.value}>{opt.label}</SelectItem>)}
|
|
188
|
+
</SelectContent>
|
|
189
|
+
</Select>
|
|
190
|
+
</div>
|
|
191
|
+
<div className="space-y-2">
|
|
192
|
+
<Label>Category</Label>
|
|
193
|
+
<Input
|
|
194
|
+
value={formData.category}
|
|
195
|
+
onChange={(e) => setFormData({ ...formData, category: e.target.value })}
|
|
196
|
+
/>
|
|
197
|
+
</div>
|
|
198
|
+
<div className="space-y-2">
|
|
199
|
+
<Label>Variables</Label>
|
|
200
|
+
<Input
|
|
201
|
+
value={formData.variables}
|
|
202
|
+
onChange={(e) => setFormData({ ...formData, variables: e.target.value })}
|
|
203
|
+
placeholder="var1, var2, var3"
|
|
204
|
+
/>
|
|
205
|
+
</div>
|
|
206
|
+
<div className="md:col-span-2 space-y-2">
|
|
207
|
+
<Label>Description</Label>
|
|
208
|
+
<Textarea
|
|
209
|
+
value={formData.description}
|
|
210
|
+
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
|
|
211
|
+
rows={2}
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
</CardContent>
|
|
216
|
+
</Card>
|
|
217
|
+
|
|
218
|
+
<Card>
|
|
219
|
+
<CardHeader>
|
|
220
|
+
<CardTitle>Template</CardTitle>
|
|
221
|
+
</CardHeader>
|
|
222
|
+
<CardContent>
|
|
223
|
+
<Textarea
|
|
224
|
+
value={formData.template}
|
|
225
|
+
onChange={(e) => setFormData({ ...formData, template: e.target.value })}
|
|
226
|
+
className="font-mono text-sm"
|
|
227
|
+
rows={10}
|
|
228
|
+
placeholder="Enter prompt template with {{variables}}"
|
|
229
|
+
required
|
|
230
|
+
/>
|
|
231
|
+
</CardContent>
|
|
232
|
+
</Card>
|
|
233
|
+
|
|
234
|
+
<Card>
|
|
235
|
+
<CardHeader>
|
|
236
|
+
<CardTitle>Model Config (JSON)</CardTitle>
|
|
237
|
+
</CardHeader>
|
|
238
|
+
<CardContent>
|
|
239
|
+
<Textarea
|
|
240
|
+
value={formData.model_config}
|
|
241
|
+
onChange={(e) => setFormData({ ...formData, model_config: e.target.value })}
|
|
242
|
+
className="font-mono text-sm"
|
|
243
|
+
rows={6}
|
|
244
|
+
/>
|
|
245
|
+
</CardContent>
|
|
246
|
+
</Card>
|
|
247
|
+
|
|
248
|
+
<Card>
|
|
249
|
+
<CardHeader>
|
|
250
|
+
<CardTitle>Options</CardTitle>
|
|
251
|
+
</CardHeader>
|
|
252
|
+
<CardContent>
|
|
253
|
+
<div className="space-y-3">
|
|
254
|
+
<div className="flex items-center gap-2">
|
|
255
|
+
<Checkbox
|
|
256
|
+
id="is_default"
|
|
257
|
+
checked={formData.is_default}
|
|
258
|
+
onCheckedChange={(checked) => setFormData({ ...formData, is_default: checked === true })}
|
|
259
|
+
/>
|
|
260
|
+
<Label htmlFor="is_default" className="text-sm">Default for type</Label>
|
|
261
|
+
</div>
|
|
262
|
+
<div className="flex items-center gap-2">
|
|
263
|
+
<Checkbox
|
|
264
|
+
id="is_active"
|
|
265
|
+
checked={formData.is_active}
|
|
266
|
+
onCheckedChange={(checked) => setFormData({ ...formData, is_active: checked === true })}
|
|
267
|
+
/>
|
|
268
|
+
<Label htmlFor="is_active" className="text-sm">Active</Label>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
</CardContent>
|
|
272
|
+
</Card>
|
|
273
|
+
|
|
274
|
+
{!isCreateMode && config && (
|
|
275
|
+
<Card>
|
|
276
|
+
<CardHeader>
|
|
277
|
+
<CardTitle>Info</CardTitle>
|
|
278
|
+
</CardHeader>
|
|
279
|
+
<CardContent>
|
|
280
|
+
<dl className="grid grid-cols-2 gap-4 text-sm">
|
|
281
|
+
<div><dt className="text-muted-foreground">Created</dt><dd>{formatDateTime(config.created_at)}</dd></div>
|
|
282
|
+
<div><dt className="text-muted-foreground">Updated</dt><dd>{formatDateTime(config.updated_at)}</dd></div>
|
|
283
|
+
</dl>
|
|
284
|
+
</CardContent>
|
|
285
|
+
</Card>
|
|
286
|
+
)}
|
|
287
|
+
|
|
288
|
+
<div className="flex items-center justify-end gap-3">
|
|
289
|
+
<Button type="button" variant="secondary" onClick={() => navigate(-1)}>
|
|
290
|
+
Cancel
|
|
291
|
+
</Button>
|
|
292
|
+
<Button type="submit" disabled={isSubmitting}>
|
|
293
|
+
{isCreateMode ? 'Create' : 'Update'}
|
|
294
|
+
</Button>
|
|
295
|
+
</div>
|
|
296
|
+
</form>
|
|
297
|
+
</div>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module src/pages/admin/PromptConfigsPage
|
|
3
|
+
* @audience installer
|
|
4
|
+
* @layer frontend-page
|
|
5
|
+
* @stability stable
|
|
6
|
+
*
|
|
7
|
+
* Admin list page for LLM prompt configurations. Fetches all configs via
|
|
8
|
+
* `/api/prompt-configs?action=list`, applies client-side search, category
|
|
9
|
+
* filter, and sort. Highlights the default config with a star badge.
|
|
10
|
+
* Renders inside `AdminListPage`. Row clicks navigate to
|
|
11
|
+
* `/spine-framework/admin/configs/prompt-configs/:id`.
|
|
12
|
+
*
|
|
13
|
+
* @seeAlso src/pages/admin/PromptConfigDetailPage.tsx
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import React, { useState } from 'react'
|
|
17
|
+
import { Plus, FileText, CheckCircle, Star, Cpu, MessageSquare } from 'lucide-react';
|
|
18
|
+
import { LoadingSpinner } from '../../components/ui/LoadingSpinner'
|
|
19
|
+
import { Button } from '../../components/ui/button'
|
|
20
|
+
import { AdminListPage } from '../../components/admin/AdminListPage'
|
|
21
|
+
import { SortableTableHeader } from '../../components/admin/SortableTableHeader'
|
|
22
|
+
import { formatDateTime } from '../../lib/utils'
|
|
23
|
+
import { useApi } from '../../hooks/useApi'
|
|
24
|
+
import { apiFetch } from '../../lib/api'
|
|
25
|
+
|
|
26
|
+
interface PromptConfig {
|
|
27
|
+
id: string
|
|
28
|
+
name: string
|
|
29
|
+
slug: string
|
|
30
|
+
system_prompt?: string
|
|
31
|
+
model?: string
|
|
32
|
+
temperature?: number
|
|
33
|
+
max_tokens?: number
|
|
34
|
+
is_multi_turn?: boolean
|
|
35
|
+
is_active: boolean
|
|
36
|
+
is_default?: boolean
|
|
37
|
+
prompt_type?: string
|
|
38
|
+
category?: string
|
|
39
|
+
app_id?: string
|
|
40
|
+
app?: any
|
|
41
|
+
created_by?: string
|
|
42
|
+
created_at: string
|
|
43
|
+
updated_at: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function PromptConfigsPage() {
|
|
47
|
+
const [searchTerm, setSearchTerm] = useState('')
|
|
48
|
+
const [selectedStatus, setSelectedStatus] = useState('all')
|
|
49
|
+
const [selectedType, setSelectedType] = useState('all')
|
|
50
|
+
const [sortKey, setSortKey] = useState('name')
|
|
51
|
+
const [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('asc')
|
|
52
|
+
|
|
53
|
+
const { data: promptConfigs, loading, error, refetch } = useApi<PromptConfig[]>(
|
|
54
|
+
async () => {
|
|
55
|
+
const response = await apiFetch('/api/prompt-configs?action=list')
|
|
56
|
+
if (!response.ok) throw new Error('Failed to fetch prompt configs')
|
|
57
|
+
const result = await response.json()
|
|
58
|
+
return (result.data || result) as PromptConfig[]
|
|
59
|
+
},
|
|
60
|
+
{ immediate: true }
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
const filteredPromptConfigs = (promptConfigs || []).filter(config => {
|
|
64
|
+
const matchesSearch = config.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
65
|
+
config.slug.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
66
|
+
(config.system_prompt?.toLowerCase().includes(searchTerm.toLowerCase()) || false)
|
|
67
|
+
const matchesStatus = selectedStatus === 'all' ||
|
|
68
|
+
(selectedStatus === 'active' && config.is_active) ||
|
|
69
|
+
(selectedStatus === 'inactive' && !config.is_active)
|
|
70
|
+
const matchesType = selectedType === 'all' || config.prompt_type === selectedType
|
|
71
|
+
return matchesSearch && matchesStatus && matchesType
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const promptTypes = Array.from(new Set((promptConfigs || []).map(c => c.prompt_type).filter(Boolean)))
|
|
75
|
+
|
|
76
|
+
const handleSort = (key: string) => {
|
|
77
|
+
if (sortKey === key) {
|
|
78
|
+
setSortDirection(sortDirection === 'asc' ? 'desc' : 'asc')
|
|
79
|
+
} else {
|
|
80
|
+
setSortKey(key)
|
|
81
|
+
setSortDirection('asc')
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const handleRowClick = (config: PromptConfig) => {
|
|
86
|
+
window.location.href = `/spine-framework/admin/configs/prompts/${config.id}`
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const sortedConfigs = [...(filteredPromptConfigs || [])].sort((a, b) => {
|
|
90
|
+
let aValue: any = a[sortKey as keyof PromptConfig]
|
|
91
|
+
let bValue: any = b[sortKey as keyof PromptConfig]
|
|
92
|
+
|
|
93
|
+
if (typeof aValue === 'string') {
|
|
94
|
+
return sortDirection === 'asc'
|
|
95
|
+
? aValue.localeCompare(bValue)
|
|
96
|
+
: bValue.localeCompare(aValue)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (typeof aValue === 'boolean') {
|
|
100
|
+
return sortDirection === 'asc' ? (aValue ? 1 : 0) : (bValue ? 1 : 0)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return 0
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const statsCards = [
|
|
107
|
+
{
|
|
108
|
+
title: 'Total Prompts',
|
|
109
|
+
value: (promptConfigs || []).length,
|
|
110
|
+
icon: FileText,
|
|
111
|
+
iconColor: 'text-blue-500'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: 'Active',
|
|
115
|
+
value: (promptConfigs || []).filter(c => c.is_active).length,
|
|
116
|
+
icon: CheckCircle,
|
|
117
|
+
iconColor: 'text-green-500'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
title: 'Default',
|
|
121
|
+
value: (promptConfigs || []).filter(c => c.is_default).length,
|
|
122
|
+
icon: Star,
|
|
123
|
+
iconColor: 'text-yellow-500'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: 'Multi-Turn',
|
|
127
|
+
value: (promptConfigs || []).filter(c => c.is_multi_turn).length,
|
|
128
|
+
icon: MessageSquare,
|
|
129
|
+
iconColor: 'text-purple-500'
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
const statusOptions = [
|
|
134
|
+
{ value: 'all', label: 'All Status' },
|
|
135
|
+
{ value: 'active', label: 'Active' },
|
|
136
|
+
{ value: 'inactive', label: 'Inactive' }
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
const typeOptions = [
|
|
140
|
+
{ value: 'all', label: 'All Types' },
|
|
141
|
+
...promptTypes.filter((type): type is string => !!type).map(type => ({ value: type, label: type.charAt(0).toUpperCase() + type.slice(1) }))
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
const filters = [
|
|
145
|
+
{
|
|
146
|
+
label: 'Status',
|
|
147
|
+
value: selectedStatus,
|
|
148
|
+
options: statusOptions,
|
|
149
|
+
onChange: (v: string) => setSelectedStatus(v)
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
label: 'Type',
|
|
153
|
+
value: selectedType,
|
|
154
|
+
options: typeOptions,
|
|
155
|
+
onChange: (v: string) => setSelectedType(v)
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<AdminListPage
|
|
161
|
+
title="Prompt Configs"
|
|
162
|
+
description="Manage AI prompt templates and configurations"
|
|
163
|
+
newButtonText="Add Prompt Config"
|
|
164
|
+
newButtonHref="/spine-framework/admin/configs/prompts/new"
|
|
165
|
+
statsCards={statsCards}
|
|
166
|
+
searchPlaceholder="Search prompts..."
|
|
167
|
+
searchValue={searchTerm}
|
|
168
|
+
onSearchChange={setSearchTerm}
|
|
169
|
+
filters={filters}
|
|
170
|
+
loading={loading}
|
|
171
|
+
error={error}
|
|
172
|
+
emptyMessage="No prompt configs found"
|
|
173
|
+
emptyIcon={FileText}
|
|
174
|
+
>
|
|
175
|
+
{sortedConfigs.length === 0 ? (
|
|
176
|
+
<div className="p-8 text-center">
|
|
177
|
+
<FileText className="mx-auto h-12 w-12 text-slate-400" />
|
|
178
|
+
<h3 className="mt-2 text-sm font-medium text-slate-900">No prompt configs found</h3>
|
|
179
|
+
<p className="mt-1 text-sm text-slate-500">
|
|
180
|
+
Try adjusting your search or filters
|
|
181
|
+
</p>
|
|
182
|
+
</div>
|
|
183
|
+
) : (
|
|
184
|
+
<table className="min-w-full divide-y divide-slate-200">
|
|
185
|
+
<thead className="bg-slate-50">
|
|
186
|
+
<tr>
|
|
187
|
+
<SortableTableHeader
|
|
188
|
+
title="Name"
|
|
189
|
+
sortKey="name"
|
|
190
|
+
currentSortKey={sortKey}
|
|
191
|
+
currentSortDirection={sortDirection}
|
|
192
|
+
onSort={handleSort}
|
|
193
|
+
/>
|
|
194
|
+
<SortableTableHeader
|
|
195
|
+
title="Model"
|
|
196
|
+
sortKey="model"
|
|
197
|
+
currentSortKey={sortKey}
|
|
198
|
+
currentSortDirection={sortDirection}
|
|
199
|
+
onSort={handleSort}
|
|
200
|
+
/>
|
|
201
|
+
<SortableTableHeader
|
|
202
|
+
title="Type"
|
|
203
|
+
sortKey="prompt_type"
|
|
204
|
+
currentSortKey={sortKey}
|
|
205
|
+
currentSortDirection={sortDirection}
|
|
206
|
+
onSort={handleSort}
|
|
207
|
+
/>
|
|
208
|
+
<SortableTableHeader
|
|
209
|
+
title="Status"
|
|
210
|
+
sortKey="is_active"
|
|
211
|
+
currentSortKey={sortKey}
|
|
212
|
+
currentSortDirection={sortDirection}
|
|
213
|
+
onSort={handleSort}
|
|
214
|
+
/>
|
|
215
|
+
<SortableTableHeader
|
|
216
|
+
title="Settings"
|
|
217
|
+
sortKey="is_default"
|
|
218
|
+
currentSortKey={sortKey}
|
|
219
|
+
currentSortDirection={sortDirection}
|
|
220
|
+
onSort={handleSort}
|
|
221
|
+
/>
|
|
222
|
+
<SortableTableHeader
|
|
223
|
+
title="Created"
|
|
224
|
+
sortKey="created_at"
|
|
225
|
+
currentSortKey={sortKey}
|
|
226
|
+
currentSortDirection={sortDirection}
|
|
227
|
+
onSort={handleSort}
|
|
228
|
+
/>
|
|
229
|
+
<th className="relative px-6 py-3">
|
|
230
|
+
<span className="sr-only">Actions</span>
|
|
231
|
+
</th>
|
|
232
|
+
</tr>
|
|
233
|
+
</thead>
|
|
234
|
+
<tbody className="bg-white divide-y divide-slate-200">
|
|
235
|
+
{sortedConfigs.map((config) => (
|
|
236
|
+
<tr
|
|
237
|
+
key={config.id}
|
|
238
|
+
className="hover:bg-slate-50 cursor-pointer transition-colors"
|
|
239
|
+
onClick={() => handleRowClick(config)}
|
|
240
|
+
>
|
|
241
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
242
|
+
<div>
|
|
243
|
+
<div className="font-medium text-slate-900">
|
|
244
|
+
<span className="text-accent-blue hover:text-navy">
|
|
245
|
+
{config.name}
|
|
246
|
+
</span>
|
|
247
|
+
</div>
|
|
248
|
+
<div className="text-xs text-slate-500 font-mono">{config.slug}</div>
|
|
249
|
+
</div>
|
|
250
|
+
</td>
|
|
251
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
252
|
+
<span className="inline-flex items-center gap-1.5 px-2 py-0.5 text-xs font-medium rounded-md bg-purple-100 text-purple-700">
|
|
253
|
+
<Cpu className="w-3 h-3" />
|
|
254
|
+
{config.model || 'Default'}
|
|
255
|
+
</span>
|
|
256
|
+
</td>
|
|
257
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
258
|
+
<span className="text-sm text-slate-600 capitalize">{config.prompt_type || 'General'}</span>
|
|
259
|
+
</td>
|
|
260
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
261
|
+
<span className={`inline-flex px-2 py-0.5 text-xs font-medium rounded-md ${
|
|
262
|
+
config.is_active
|
|
263
|
+
? 'bg-green-100 text-green-700'
|
|
264
|
+
: 'bg-slate-100 text-slate-600'
|
|
265
|
+
}`}>
|
|
266
|
+
{config.is_active ? 'Active' : 'Inactive'}
|
|
267
|
+
</span>
|
|
268
|
+
</td>
|
|
269
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
270
|
+
<div className="flex gap-1">
|
|
271
|
+
{config.is_default && (
|
|
272
|
+
<span className="inline-flex px-1.5 py-0.5 text-xs font-medium rounded bg-yellow-100 text-yellow-700">Default</span>
|
|
273
|
+
)}
|
|
274
|
+
{config.is_multi_turn && (
|
|
275
|
+
<span className="inline-flex px-1.5 py-0.5 text-xs font-medium rounded bg-blue-100 text-blue-700">Multi-turn</span>
|
|
276
|
+
)}
|
|
277
|
+
</div>
|
|
278
|
+
</td>
|
|
279
|
+
<td className="px-6 py-4 whitespace-nowrap text-sm text-slate-500">
|
|
280
|
+
{formatDateTime(config.created_at)}
|
|
281
|
+
</td>
|
|
282
|
+
<td className="px-6 py-4 whitespace-nowrap text-right">
|
|
283
|
+
<span className="text-slate-400">→</span>
|
|
284
|
+
</td>
|
|
285
|
+
</tr>
|
|
286
|
+
))}
|
|
287
|
+
</tbody>
|
|
288
|
+
</table>
|
|
289
|
+
)}
|
|
290
|
+
</AdminListPage>
|
|
291
|
+
)
|
|
292
|
+
}
|