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,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module src/pages/admin/AIAgentDetailPage
|
|
3
|
+
*/
|
|
4
|
+
import { useState, useEffect } from 'react'
|
|
5
|
+
import { useParams, useNavigate } from 'react-router-dom'
|
|
6
|
+
import { useApi } from '../../hooks/useApi'
|
|
7
|
+
import { apiFetch } from '../../lib/api'
|
|
8
|
+
import { Button } from '../../components/ui/button'
|
|
9
|
+
import { Input } from '../../components/ui/input'
|
|
10
|
+
import { Textarea } from '../../components/ui/textarea'
|
|
11
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../components/ui/select'
|
|
12
|
+
import { Checkbox } from '../../components/ui/checkbox'
|
|
13
|
+
import { Label } from '../../components/ui/label'
|
|
14
|
+
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card'
|
|
15
|
+
import { Skeleton } from '../../components/ui/skeleton'
|
|
16
|
+
import { Alert, AlertDescription, AlertTitle } from '../../components/ui/alert'
|
|
17
|
+
import { ArrowLeft, Bot, AlertCircle } from 'lucide-react'
|
|
18
|
+
|
|
19
|
+
interface AIAgent {
|
|
20
|
+
id: string
|
|
21
|
+
name: string
|
|
22
|
+
description?: string
|
|
23
|
+
agent_type: 'chat' | 'analysis' | 'automation' | 'custom'
|
|
24
|
+
model_config: { model: string; max_tokens?: number; temperature?: number }
|
|
25
|
+
system_prompt: string
|
|
26
|
+
tools: string[]
|
|
27
|
+
capabilities?: Record<string, any>
|
|
28
|
+
constraints?: Record<string, any>
|
|
29
|
+
is_active: boolean
|
|
30
|
+
created_at: string
|
|
31
|
+
updated_at: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const AGENT_TYPES = [
|
|
35
|
+
{ value: 'chat', label: 'Chat' },
|
|
36
|
+
{ value: 'analysis', label: 'Analysis' },
|
|
37
|
+
{ value: 'automation', label: 'Automation' },
|
|
38
|
+
{ value: 'custom', label: 'Custom' }
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
export function AIAgentDetailPage() {
|
|
42
|
+
const { id } = useParams<{ id: string }>()
|
|
43
|
+
const navigate = useNavigate()
|
|
44
|
+
const isCreateMode = !id || id === 'new'
|
|
45
|
+
const [isEditing, setIsEditing] = useState(isCreateMode)
|
|
46
|
+
const [editData, setEditData] = useState<Record<string, any>>({})
|
|
47
|
+
|
|
48
|
+
const { data: agent, loading, error } = useApi<AIAgent>(
|
|
49
|
+
async () => {
|
|
50
|
+
if (isCreateMode) return {
|
|
51
|
+
id: '', name: '', description: '', agent_type: 'chat' as const,
|
|
52
|
+
model_config: { model: 'gpt-4', max_tokens: 2048, temperature: 0.7 },
|
|
53
|
+
system_prompt: '', tools: [], capabilities: {}, constraints: {},
|
|
54
|
+
is_active: true, created_at: new Date().toISOString(), updated_at: new Date().toISOString()
|
|
55
|
+
}
|
|
56
|
+
const response = await apiFetch(`/api/ai-agents?method=GET&id=${id}`)
|
|
57
|
+
if (!response.ok) throw new Error('Failed to fetch AI agent')
|
|
58
|
+
const result = await response.json()
|
|
59
|
+
return result.data
|
|
60
|
+
},
|
|
61
|
+
{ immediate: !isCreateMode }
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (agent) {
|
|
66
|
+
setEditData({
|
|
67
|
+
name: agent.name, description: agent.description || '', agent_type: agent.agent_type,
|
|
68
|
+
model_config: agent.model_config || { model: 'gpt-4', max_tokens: 2048, temperature: 0.7 },
|
|
69
|
+
system_prompt: agent.system_prompt || '', tools: (agent.tools || []).join('\n'),
|
|
70
|
+
capabilities: JSON.stringify(agent.capabilities || {}, null, 2),
|
|
71
|
+
constraints: JSON.stringify(agent.constraints || {}, null, 2),
|
|
72
|
+
is_active: agent.is_active
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
}, [agent])
|
|
76
|
+
|
|
77
|
+
const handleSave = async () => {
|
|
78
|
+
try {
|
|
79
|
+
const payload = {
|
|
80
|
+
...editData,
|
|
81
|
+
tools: editData.tools?.split('\n').filter(Boolean) || [],
|
|
82
|
+
capabilities: JSON.parse(editData.capabilities || '{}'),
|
|
83
|
+
constraints: JSON.parse(editData.constraints || '{}')
|
|
84
|
+
}
|
|
85
|
+
const url = isCreateMode ? '/api/ai-agents' : `/api/ai-agents?id=${id}`
|
|
86
|
+
const response = await apiFetch(url, {
|
|
87
|
+
method: isCreateMode ? 'POST' : 'PATCH',
|
|
88
|
+
headers: { 'Content-Type': 'application/json' },
|
|
89
|
+
body: JSON.stringify(payload)
|
|
90
|
+
})
|
|
91
|
+
if (!response.ok) throw new Error('Failed to save')
|
|
92
|
+
const result = await response.json()
|
|
93
|
+
if (isCreateMode) navigate(`/spine-framework/admin/configs/ai-agents/${result.id}`)
|
|
94
|
+
else setIsEditing(false)
|
|
95
|
+
} catch (err) {
|
|
96
|
+
console.error('Error saving:', err)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (loading) return (
|
|
101
|
+
<div className="space-y-6">
|
|
102
|
+
<Skeleton className="h-8 w-48" />
|
|
103
|
+
<Card><CardHeader><Skeleton className="h-6 w-32" /></CardHeader><CardContent className="space-y-4"><Skeleton className="h-4 w-full" /><Skeleton className="h-4 w-2/3" /></CardContent></Card>
|
|
104
|
+
</div>
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
if (error) return (
|
|
108
|
+
<Alert variant="destructive"><AlertCircle className="h-4 w-4" /><AlertTitle>Failed to load</AlertTitle><AlertDescription>{String(error)}</AlertDescription></Alert>
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div className="space-y-6">
|
|
113
|
+
<div className="flex items-center gap-4">
|
|
114
|
+
<Button variant="ghost" onClick={() => navigate(-1)}><ArrowLeft className="h-5 w-5" /></Button>
|
|
115
|
+
<h1 className="text-2xl font-bold">{isCreateMode ? 'Create AI Agent' : agent?.name}</h1>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div className="flex justify-end gap-2">
|
|
119
|
+
{isEditing ? (
|
|
120
|
+
<><Button variant="outline" onClick={() => isCreateMode ? navigate(-1) : setIsEditing(false)}>Cancel</Button><Button onClick={handleSave}>{isCreateMode ? 'Create' : 'Save'}</Button></>
|
|
121
|
+
) : <Button onClick={() => setIsEditing(true)}>Edit</Button>}
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
{isEditing ? (
|
|
125
|
+
<Card><CardContent className="p-6 space-y-4">
|
|
126
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
127
|
+
<div className="space-y-2"><Label>Name</Label><Input value={editData.name || ''} onChange={e => setEditData({...editData, name: e.target.value})} /></div>
|
|
128
|
+
<div className="space-y-2"><Label>Type</Label><Select value={editData.agent_type || 'chat'} onValueChange={v => setEditData({...editData, agent_type: v})}><SelectTrigger><SelectValue /></SelectTrigger><SelectContent>{AGENT_TYPES.map(t => <SelectItem key={t.value} value={t.value}>{t.label}</SelectItem>)}</SelectContent></Select></div>
|
|
129
|
+
<div className="space-y-2"><Label>Model</Label><Input value={editData.model_config?.model || ''} onChange={e => setEditData({...editData, model_config: {...editData.model_config, model: e.target.value}})} /></div>
|
|
130
|
+
<div className="space-y-2"><Label>Max Tokens</Label><Input type="number" value={editData.model_config?.max_tokens || ''} onChange={e => setEditData({...editData, model_config: {...editData.model_config, max_tokens: parseInt(e.target.value)}})} /></div>
|
|
131
|
+
<div className="space-y-2"><Label>Temperature</Label><Input type="number" step="0.1" min="0" max="2" value={editData.model_config?.temperature || ''} onChange={e => setEditData({...editData, model_config: {...editData.model_config, temperature: parseFloat(e.target.value)}})} /></div>
|
|
132
|
+
</div>
|
|
133
|
+
<div className="space-y-2"><Label>Description</Label><Textarea value={editData.description || ''} onChange={e => setEditData({...editData, description: e.target.value})} rows={2} /></div>
|
|
134
|
+
<div className="space-y-2"><Label>System Prompt</Label><Textarea value={editData.system_prompt || ''} onChange={e => setEditData({...editData, system_prompt: e.target.value})} rows={4} /></div>
|
|
135
|
+
<div className="space-y-2"><Label>Tools (one per line)</Label><Textarea value={editData.tools || ''} onChange={e => setEditData({...editData, tools: e.target.value})} rows={3} /></div>
|
|
136
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
137
|
+
<div className="space-y-2"><Label>Capabilities (JSON)</Label><Textarea value={editData.capabilities || '{}'} onChange={e => setEditData({...editData, capabilities: e.target.value})} rows={4} className="font-mono text-sm" /></div>
|
|
138
|
+
<div className="space-y-2"><Label>Constraints (JSON)</Label><Textarea value={editData.constraints || '{}'} onChange={e => setEditData({...editData, constraints: e.target.value})} rows={4} className="font-mono text-sm" /></div>
|
|
139
|
+
</div>
|
|
140
|
+
<div className="flex items-center gap-2"><Checkbox id="active" checked={editData.is_active} onCheckedChange={c => setEditData({...editData, is_active: c === true})} /><Label htmlFor="active">Active</Label></div>
|
|
141
|
+
</CardContent></Card>
|
|
142
|
+
) : (
|
|
143
|
+
<div className="space-y-6">
|
|
144
|
+
<Card><CardContent className="p-6">
|
|
145
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
146
|
+
<div className="flex justify-between"><span className="text-muted-foreground">Type</span><span>{agent?.agent_type}</span></div>
|
|
147
|
+
<div className="flex justify-between"><span className="text-muted-foreground">Model</span><span>{agent?.model_config?.model}</span></div>
|
|
148
|
+
<div className="flex justify-between"><span className="text-muted-foreground">Max Tokens</span><span>{agent?.model_config?.max_tokens}</span></div>
|
|
149
|
+
<div className="flex justify-between"><span className="text-muted-foreground">Temperature</span><span>{agent?.model_config?.temperature}</span></div>
|
|
150
|
+
<div className="flex justify-between"><span className="text-muted-foreground">Active</span><span>{agent?.is_active ? 'Yes' : 'No'}</span></div>
|
|
151
|
+
<div className="flex justify-between"><span className="text-muted-foreground">Created</span><span>{new Date(agent?.created_at || '').toLocaleDateString()}</span></div>
|
|
152
|
+
</div>
|
|
153
|
+
<div className="mt-4"><span className="text-muted-foreground">Description</span><p className="mt-1">{agent?.description || '—'}</p></div>
|
|
154
|
+
<div className="mt-4"><span className="text-muted-foreground">System Prompt</span><p className="mt-1 text-sm bg-muted p-3 rounded">{agent?.system_prompt || '—'}</p></div>
|
|
155
|
+
</CardContent></Card>
|
|
156
|
+
<Card><CardHeader><CardTitle>Tools ({agent?.tools?.length || 0})</CardTitle></CardHeader><CardContent>{agent?.tools?.length ? <ul className="list-disc list-inside">{agent.tools.map((t, i) => <li key={i}>{t}</li>)}</ul> : <p className="text-muted-foreground">No tools configured</p>}</CardContent></Card>
|
|
157
|
+
</div>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module src/pages/admin/AIAgentsPage
|
|
3
|
+
* @audience installer
|
|
4
|
+
* @layer frontend-page
|
|
5
|
+
* @stability stable
|
|
6
|
+
*
|
|
7
|
+
* Admin list page for AI agents. Fetches all agents via
|
|
8
|
+
* `/api/ai-agents?action=list`, applies client-side search, agent-type
|
|
9
|
+
* filter (`chat` | `analysis` | `automation` | `custom`), and sort.
|
|
10
|
+
* Renders inside `AdminListPage` with stat cards and a sortable table.
|
|
11
|
+
* Row clicks navigate to `/spine-framework/admin/configs/ai-agents/:id`.
|
|
12
|
+
*
|
|
13
|
+
* @seeAlso src/pages/admin/AIAgentDetailPage.tsx
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { useState } from 'react'
|
|
17
|
+
import { useNavigate } from 'react-router-dom'
|
|
18
|
+
import { Cpu, CheckCircle, Clock } from 'lucide-react';
|
|
19
|
+
import { formatDateTime } from '../../lib/utils'
|
|
20
|
+
import { useApi } from '../../hooks/useApi'
|
|
21
|
+
import { apiFetch } from '../../lib/api'
|
|
22
|
+
import { AdminListPage } from '../../components/admin/AdminListPage'
|
|
23
|
+
import { SortableTableHeader } from '../../components/admin/SortableTableHeader'
|
|
24
|
+
import { Badge } from '../../components/ui/badge'
|
|
25
|
+
|
|
26
|
+
interface AIAgent {
|
|
27
|
+
id: string
|
|
28
|
+
name: string
|
|
29
|
+
description?: string
|
|
30
|
+
agent_type: 'chat' | 'analysis' | 'automation' | 'custom'
|
|
31
|
+
model_config: {
|
|
32
|
+
model: string
|
|
33
|
+
max_tokens?: number
|
|
34
|
+
temperature?: number
|
|
35
|
+
}
|
|
36
|
+
system_prompt: string
|
|
37
|
+
tools: string[]
|
|
38
|
+
capabilities?: Record<string, any>
|
|
39
|
+
constraints?: Record<string, any>
|
|
40
|
+
is_active: boolean
|
|
41
|
+
created_at: string
|
|
42
|
+
updated_at: string
|
|
43
|
+
created_by: string
|
|
44
|
+
account_id: string
|
|
45
|
+
app_id?: string
|
|
46
|
+
metadata?: Record<string, any>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function AIAgentsPage() {
|
|
50
|
+
const navigate = useNavigate()
|
|
51
|
+
|
|
52
|
+
const [searchTerm, setSearchTerm] = useState('')
|
|
53
|
+
const [selectedType, setSelectedType] = useState('all')
|
|
54
|
+
const [selectedModel, setSelectedModel] = useState('all')
|
|
55
|
+
const [selectedStatus, setSelectedStatus] = useState('all')
|
|
56
|
+
const [sortKey, setSortKey] = useState('name')
|
|
57
|
+
const [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('asc')
|
|
58
|
+
|
|
59
|
+
// Fetch AI agents from API
|
|
60
|
+
const { data: agents, loading } = useApi<AIAgent[]>(
|
|
61
|
+
async (params) => {
|
|
62
|
+
const response = await apiFetch('/api/ai-agents?action=list', { signal: params?.signal })
|
|
63
|
+
if (!response.ok) throw new Error('Failed to fetch AI agents')
|
|
64
|
+
const result = await response.json()
|
|
65
|
+
return result.data || []
|
|
66
|
+
},
|
|
67
|
+
{ immediate: true }
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
const agentTypes = [
|
|
71
|
+
{ value: 'all', label: 'All Types' },
|
|
72
|
+
{ value: 'chat', label: 'Chat' },
|
|
73
|
+
{ value: 'analysis', label: 'Analysis' },
|
|
74
|
+
{ value: 'automation', label: 'Automation' },
|
|
75
|
+
{ value: 'custom', label: 'Custom' }
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
const models = [
|
|
79
|
+
{ value: 'all', label: 'All Models' },
|
|
80
|
+
{ value: 'gpt-4', label: 'GPT-4' },
|
|
81
|
+
{ value: 'gpt-3.5-turbo', label: 'GPT-3.5 Turbo' },
|
|
82
|
+
{ value: 'claude-3-sonnet', label: 'Claude 3 Sonnet' },
|
|
83
|
+
{ value: 'claude-3-opus', label: 'Claude 3 Opus' }
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
const statusOptions = [
|
|
87
|
+
{ value: 'all', label: 'All Statuses' },
|
|
88
|
+
{ value: 'active', label: 'Active' },
|
|
89
|
+
{ value: 'inactive', label: 'Inactive' }
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
const filteredAgents = (agents || []).filter(agent => {
|
|
93
|
+
const matchesSearch = agent.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
94
|
+
(agent.description && agent.description.toLowerCase().includes(searchTerm.toLowerCase()))
|
|
95
|
+
const matchesType = selectedType === 'all' || agent.agent_type === selectedType
|
|
96
|
+
const matchesModel = selectedModel === 'all' || (agent.model_config?.model) === selectedModel
|
|
97
|
+
const matchesStatus = selectedStatus === 'all' ||
|
|
98
|
+
(selectedStatus === 'active' && agent.is_active) ||
|
|
99
|
+
(selectedStatus === 'inactive' && !agent.is_active)
|
|
100
|
+
return matchesSearch && matchesType && matchesModel && matchesStatus
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
console.log('AIAgentsPage - agents:', agents)
|
|
104
|
+
console.log('AIAgentsPage - filteredAgents:', filteredAgents)
|
|
105
|
+
|
|
106
|
+
// Helper functions
|
|
107
|
+
const getAgentBadgeColor = (agentType: string) => {
|
|
108
|
+
switch (agentType) {
|
|
109
|
+
case 'chat':
|
|
110
|
+
return 'bg-accent-blue/10 text-accent-blue'
|
|
111
|
+
case 'analysis':
|
|
112
|
+
return 'bg-green-100 text-green-800'
|
|
113
|
+
case 'automation':
|
|
114
|
+
return 'bg-purple-100 text-purple-800'
|
|
115
|
+
case 'custom':
|
|
116
|
+
return 'bg-orange-100 text-orange-800'
|
|
117
|
+
default:
|
|
118
|
+
return 'bg-slate-100 text-slate-800'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const getStatusBadgeColor = (isActive: boolean) => {
|
|
123
|
+
return isActive ? 'bg-green-100 text-green-800' : 'bg-slate-100 text-slate-800'
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const handleSort = (key: string) => {
|
|
127
|
+
if (sortKey === key) {
|
|
128
|
+
setSortDirection(sortDirection === 'asc' ? 'desc' : 'asc')
|
|
129
|
+
} else {
|
|
130
|
+
setSortKey(key)
|
|
131
|
+
setSortDirection('asc')
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const handleRowClick = (agent: AIAgent) => {
|
|
136
|
+
navigate(`/spine-framework/admin/configs/ai-agents/${agent.id}`)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Sort agents
|
|
140
|
+
const sortedAgents = [...(filteredAgents || [])].sort((a, b) => {
|
|
141
|
+
let aValue: any = a[sortKey as keyof AIAgent]
|
|
142
|
+
let bValue: any = b[sortKey as keyof AIAgent]
|
|
143
|
+
|
|
144
|
+
if (sortKey === 'model_config') {
|
|
145
|
+
aValue = a.model_config?.model || ''
|
|
146
|
+
bValue = b.model_config?.model || ''
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (typeof aValue === 'string') {
|
|
150
|
+
return sortDirection === 'asc'
|
|
151
|
+
? aValue.localeCompare(bValue)
|
|
152
|
+
: bValue.localeCompare(aValue)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (typeof aValue === 'number') {
|
|
156
|
+
return sortDirection === 'asc' ? aValue - bValue : bValue - aValue
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return 0
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const statsCards = [
|
|
163
|
+
{
|
|
164
|
+
title: 'Total Agents',
|
|
165
|
+
value: agents?.length || 0,
|
|
166
|
+
icon: Cpu,
|
|
167
|
+
iconColor: 'text-blue-500'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
title: 'Active',
|
|
171
|
+
value: (agents || []).filter(a => a.is_active).length,
|
|
172
|
+
icon: CheckCircle,
|
|
173
|
+
iconColor: 'text-green-500'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
title: 'Executions Today',
|
|
177
|
+
value: '24',
|
|
178
|
+
icon: Clock,
|
|
179
|
+
iconColor: 'text-orange-500'
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
|
|
183
|
+
const filters = [
|
|
184
|
+
{
|
|
185
|
+
label: 'Type',
|
|
186
|
+
value: selectedType,
|
|
187
|
+
options: agentTypes,
|
|
188
|
+
onChange: setSelectedType
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
label: 'Model',
|
|
192
|
+
value: selectedModel,
|
|
193
|
+
options: models,
|
|
194
|
+
onChange: setSelectedModel
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: 'Status',
|
|
198
|
+
value: selectedStatus,
|
|
199
|
+
options: statusOptions,
|
|
200
|
+
onChange: setSelectedStatus
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<AdminListPage
|
|
206
|
+
title="AI Agents"
|
|
207
|
+
description="Manage AI agents and their configurations"
|
|
208
|
+
newButtonText="New Agent"
|
|
209
|
+
newButtonHref="/spine-framework/admin/configs/ai-agents/new"
|
|
210
|
+
statsCards={statsCards}
|
|
211
|
+
searchPlaceholder="Search agents..."
|
|
212
|
+
searchValue={searchTerm}
|
|
213
|
+
onSearchChange={setSearchTerm}
|
|
214
|
+
filters={filters}
|
|
215
|
+
loading={loading}
|
|
216
|
+
emptyMessage="No AI agents found"
|
|
217
|
+
emptyIcon={Cpu}
|
|
218
|
+
>
|
|
219
|
+
{sortedAgents.length === 0 ? (
|
|
220
|
+
<div className="p-8 text-center">
|
|
221
|
+
<Cpu className="mx-auto h-12 w-12 text-slate-400" />
|
|
222
|
+
<h3 className="mt-2 text-sm font-medium text-slate-900">No agents found</h3>
|
|
223
|
+
<p className="mt-1 text-sm text-slate-500">
|
|
224
|
+
Try adjusting your search or filters
|
|
225
|
+
</p>
|
|
226
|
+
</div>
|
|
227
|
+
) : (
|
|
228
|
+
<table className="min-w-full divide-y divide-slate-200">
|
|
229
|
+
<thead className="bg-slate-50">
|
|
230
|
+
<tr>
|
|
231
|
+
<SortableTableHeader
|
|
232
|
+
title="Agent"
|
|
233
|
+
sortKey="name"
|
|
234
|
+
currentSortKey={sortKey}
|
|
235
|
+
currentSortDirection={sortDirection}
|
|
236
|
+
onSort={handleSort}
|
|
237
|
+
/>
|
|
238
|
+
<SortableTableHeader
|
|
239
|
+
title="Type"
|
|
240
|
+
sortKey="agent_type"
|
|
241
|
+
currentSortKey={sortKey}
|
|
242
|
+
currentSortDirection={sortDirection}
|
|
243
|
+
onSort={handleSort}
|
|
244
|
+
/>
|
|
245
|
+
<SortableTableHeader
|
|
246
|
+
title="Model"
|
|
247
|
+
sortKey="model_config"
|
|
248
|
+
currentSortKey={sortKey}
|
|
249
|
+
currentSortDirection={sortDirection}
|
|
250
|
+
onSort={handleSort}
|
|
251
|
+
/>
|
|
252
|
+
<SortableTableHeader
|
|
253
|
+
title="Status"
|
|
254
|
+
sortKey="is_active"
|
|
255
|
+
currentSortKey={sortKey}
|
|
256
|
+
currentSortDirection={sortDirection}
|
|
257
|
+
onSort={handleSort}
|
|
258
|
+
/>
|
|
259
|
+
<SortableTableHeader
|
|
260
|
+
title="Created"
|
|
261
|
+
sortKey="created_at"
|
|
262
|
+
currentSortKey={sortKey}
|
|
263
|
+
currentSortDirection={sortDirection}
|
|
264
|
+
onSort={handleSort}
|
|
265
|
+
/>
|
|
266
|
+
<th className="relative px-6 py-3">
|
|
267
|
+
<span className="sr-only">Actions</span>
|
|
268
|
+
</th>
|
|
269
|
+
</tr>
|
|
270
|
+
</thead>
|
|
271
|
+
<tbody className="bg-white divide-y divide-slate-200">
|
|
272
|
+
{sortedAgents.map((agent) => (
|
|
273
|
+
<tr
|
|
274
|
+
key={agent.id}
|
|
275
|
+
className="hover:bg-slate-50 cursor-pointer transition-colors"
|
|
276
|
+
onClick={() => handleRowClick(agent)}
|
|
277
|
+
>
|
|
278
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
279
|
+
<div>
|
|
280
|
+
<div className="font-medium text-slate-900">
|
|
281
|
+
<span className="text-accent-blue hover:text-navy">
|
|
282
|
+
{agent.name}
|
|
283
|
+
</span>
|
|
284
|
+
</div>
|
|
285
|
+
{agent.description && (
|
|
286
|
+
<div className="text-sm text-slate-500">{agent.description}</div>
|
|
287
|
+
)}
|
|
288
|
+
</div>
|
|
289
|
+
</td>
|
|
290
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
291
|
+
<Badge variant={getAgentBadgeColor(agent.agent_type) as any}>
|
|
292
|
+
{agent.agent_type}
|
|
293
|
+
</Badge>
|
|
294
|
+
</td>
|
|
295
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
296
|
+
<Badge variant="default">
|
|
297
|
+
{agent.model_config?.model || 'Unknown'}
|
|
298
|
+
</Badge>
|
|
299
|
+
</td>
|
|
300
|
+
<td className="px-6 py-4 whitespace-nowrap">
|
|
301
|
+
<Badge variant={getStatusBadgeColor(agent.is_active) as any}>
|
|
302
|
+
{agent.is_active ? 'Active' : 'Inactive'}
|
|
303
|
+
</Badge>
|
|
304
|
+
</td>
|
|
305
|
+
<td className="px-6 py-4 whitespace-nowrap text-sm text-slate-500">
|
|
306
|
+
{formatDateTime(agent.created_at)}
|
|
307
|
+
</td>
|
|
308
|
+
<td className="px-6 py-4 whitespace-nowrap text-right">
|
|
309
|
+
<span className="text-slate-400">→</span>
|
|
310
|
+
</td>
|
|
311
|
+
</tr>
|
|
312
|
+
))}
|
|
313
|
+
</tbody>
|
|
314
|
+
</table>
|
|
315
|
+
)}
|
|
316
|
+
</AdminListPage>
|
|
317
|
+
)
|
|
318
|
+
}
|