spine-framework 0.4.4 → 0.5.0-rc.4
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/.env.example +13 -3
- package/.framework/cli/commands/bootstrap.ts +392 -0
- package/.framework/cli/commands/dev.ts +91 -218
- package/.framework/cli/commands/doctor.ts +132 -26
- package/.framework/cli/commands/generate.ts +38 -298
- package/.framework/cli/commands/init.ts +20 -1
- package/.framework/cli/commands/migrate.ts +36 -30
- package/.framework/cli/commands/migrations.ts +16 -56
- package/.framework/cli/commands/upgrade.ts +35 -0
- package/.framework/cli/commands/validate-schema.ts +147 -0
- package/.framework/cli/context.ts +223 -110
- package/.framework/cli/index.ts +6 -0
- package/.framework/cli/lib/project-files.ts +241 -1
- package/.framework/functions/_shared/hash-api-key.ts +183 -79
- package/.framework/functions/_shared/logging.ts +562 -224
- package/.framework/functions/_shared/middleware.ts +47 -44
- package/.framework/functions/admin-data.ts +39 -28
- package/.framework/functions/ai-agents.ts +10 -6
- package/.framework/functions/api-keys.ts +301 -122
- package/.framework/functions/apps.ts +43 -26
- package/.framework/functions/cil-ingest.ts +48 -15
- package/.framework/functions/debug-auth.ts +14 -8
- package/.framework/functions/deliveries.ts +39 -12
- package/.framework/functions/embeddings.ts +145 -76
- package/.framework/functions/integration-outbound.ts +67 -27
- package/.framework/functions/integrations.ts +254 -127
- package/.framework/functions/logs.ts +273 -133
- package/.framework/functions/observability.ts +277 -147
- package/.framework/functions/pipeline-executions.ts +1 -1
- package/.framework/functions/pipelines.ts +14 -9
- package/.framework/functions/prompt-configs.ts +7 -4
- package/.framework/functions/roles.ts +8 -5
- package/.framework/functions/security.ts +30 -17
- package/.framework/functions/system-cron.ts +240 -127
- package/.framework/functions/tests.ts +7 -6
- package/.framework/functions/timers.ts +310 -107
- package/.framework/functions/triggers.ts +28 -13
- package/.framework/functions/types.ts +13 -10
- package/.framework/migrations/069_log_stats_window.sql +54 -0
- package/.framework/migrations/070_app_type_schema_rpcs.sql +166 -0
- package/.framework/migrations/071_timer_interval_keys.sql +96 -0
- package/.framework/migrations/072_slug_autofill.sql +77 -0
- package/.framework/migrations/073_seed_member_roles.sql +26 -0
- package/.framework/src/apps/admin/index.tsx +1141 -775
- package/.framework/src/components/ErrorBoundary.tsx +136 -0
- package/.framework/src/components/admin/AdminListPage.tsx +81 -73
- package/.framework/src/components/admin/AdminSidebar.tsx +88 -79
- package/.framework/src/components/admin/EntitySelect.tsx +181 -0
- package/.framework/src/components/admin/PageInstructions.tsx +86 -127
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +37 -13
- package/.framework/src/components/app-shell/GenericListPage.tsx +28 -32
- package/.framework/src/components/layout/Sidebar.tsx +300 -177
- package/.framework/src/components/runtime/DataDetailPage.tsx +67 -35
- package/.framework/src/components/runtime/DataHeader.tsx +96 -48
- package/.framework/src/components/runtime/DataListPage.tsx +3 -26
- package/.framework/src/components/runtime/DataStats.tsx +10 -10
- package/.framework/src/components/runtime/DataTable.tsx +12 -10
- package/.framework/src/components/ui/sheet.tsx +24 -26
- package/.framework/src/components/ui/textarea.tsx +74 -48
- package/.framework/src/hooks/useEntityList.ts +12 -9
- package/.framework/src/hooks/useListSchema.ts +108 -58
- package/.framework/src/instructions/README.md +57 -0
- package/.framework/src/instructions/ai-agents.md +69 -0
- package/.framework/src/instructions/alerts.md +80 -0
- package/.framework/src/instructions/api-keys.md +87 -0
- package/.framework/src/instructions/apps.md +77 -0
- package/.framework/src/instructions/concepts/ai-and-prompts.md +150 -0
- package/.framework/src/instructions/concepts/apps-and-renderers.md +162 -0
- package/.framework/src/instructions/concepts/auth-and-api-keys.md +133 -0
- package/.framework/src/instructions/concepts/automation.md +186 -0
- package/.framework/src/instructions/concepts/concurrency-and-idempotency.md +125 -0
- package/.framework/src/instructions/concepts/core-vs-custom.md +124 -0
- package/.framework/src/instructions/concepts/design-schema.md +152 -0
- package/.framework/src/instructions/concepts/integrations-and-webhooks.md +127 -0
- package/.framework/src/instructions/concepts/observability.md +116 -0
- package/.framework/src/instructions/concepts/permissions.md +150 -0
- package/.framework/src/instructions/concepts/runtime-records.md +111 -0
- package/.framework/src/instructions/concepts/scope-and-accounts.md +112 -0
- package/.framework/src/instructions/concepts/spine-way.md +172 -0
- package/.framework/src/instructions/deliveries.md +59 -0
- package/.framework/src/instructions/guide/00-orientation.md +106 -0
- package/.framework/src/instructions/guide/01-install-and-first-run.md +253 -0
- package/.framework/src/instructions/guide/02-project-map.md +147 -0
- package/.framework/src/instructions/guide/03-domain-model.md +223 -0
- package/.framework/src/instructions/guide/04-first-app.md +227 -0
- package/.framework/src/instructions/guide/05-glossary.md +183 -0
- package/.framework/src/instructions/integrations.md +96 -0
- package/.framework/src/instructions/internal/cil-markers.md +83 -0
- package/.framework/src/instructions/invites.md +60 -0
- package/.framework/src/instructions/kb.md +80 -0
- package/.framework/src/instructions/logs.md +77 -0
- package/.framework/src/instructions/observability.md +61 -0
- package/.framework/src/instructions/operations/deployment.md +115 -0
- package/.framework/src/instructions/operations/migrations.md +125 -0
- package/.framework/src/instructions/operations/security-checklist.md +148 -0
- package/.framework/src/instructions/operations/troubleshooting.md +170 -0
- package/.framework/src/instructions/operations/upgrade.md +116 -0
- package/.framework/src/instructions/pipeline-executions.md +62 -0
- package/.framework/src/instructions/pipelines.md +78 -0
- package/.framework/src/instructions/prompts.md +95 -0
- package/.framework/src/instructions/reference/api/admin-data.md +162 -0
- package/.framework/src/instructions/reference/api/auth.md +113 -0
- package/.framework/src/instructions/reference/api/errors-and-envelopes.md +113 -0
- package/.framework/src/instructions/reference/app-manifest.md +150 -0
- package/.framework/src/instructions/reference/cli.md +124 -0
- package/.framework/src/instructions/reference/database.md +132 -0
- package/.framework/src/instructions/reference/design-schema.md +280 -0
- package/.framework/src/instructions/reference/env-vars.md +133 -0
- package/.framework/src/instructions/reference/functions/account-nodes.md +75 -0
- package/.framework/src/instructions/reference/functions/admin-data.md +195 -0
- package/.framework/src/instructions/reference/functions/admin-funnel.md +90 -0
- package/.framework/src/instructions/reference/functions/admin-install-funnel.md +107 -0
- package/.framework/src/instructions/reference/functions/admin-signals.md +102 -0
- package/.framework/src/instructions/reference/functions/ai-agents.md +148 -0
- package/.framework/src/instructions/reference/functions/ai-interactions.md +156 -0
- package/.framework/src/instructions/reference/functions/api-keys.md +130 -0
- package/.framework/src/instructions/reference/functions/apps.md +140 -0
- package/.framework/src/instructions/reference/functions/auth.md +99 -0
- package/.framework/src/instructions/reference/functions/debug-auth.md +91 -0
- package/.framework/src/instructions/reference/functions/deliveries.md +110 -0
- package/.framework/src/instructions/reference/functions/embeddings.md +166 -0
- package/.framework/src/instructions/reference/functions/eval-harness.md +149 -0
- package/.framework/src/instructions/reference/functions/index.md +103 -0
- package/.framework/src/instructions/reference/functions/integration-outbound.md +200 -0
- package/.framework/src/instructions/reference/functions/integration-routes.md +151 -0
- package/.framework/src/instructions/reference/functions/integrations.md +130 -0
- package/.framework/src/instructions/reference/functions/invites.md +182 -0
- package/.framework/src/instructions/reference/functions/item-progress.md +107 -0
- package/.framework/src/instructions/reference/functions/kb.md +166 -0
- package/.framework/src/instructions/reference/functions/logs.md +141 -0
- package/.framework/src/instructions/reference/functions/observability.md +105 -0
- package/.framework/src/instructions/reference/functions/pipeline-executions.md +132 -0
- package/.framework/src/instructions/reference/functions/pipeline-runner-background.md +121 -0
- package/.framework/src/instructions/reference/functions/pipelines.md +136 -0
- package/.framework/src/instructions/reference/functions/prompt-configs.md +121 -0
- package/.framework/src/instructions/reference/functions/roles.md +121 -0
- package/.framework/src/instructions/reference/functions/security.md +140 -0
- package/.framework/src/instructions/reference/functions/system-cron.md +136 -0
- package/.framework/src/instructions/reference/functions/system.md +106 -0
- package/.framework/src/instructions/reference/functions/tests.md +97 -0
- package/.framework/src/instructions/reference/functions/timers.md +117 -0
- package/.framework/src/instructions/reference/functions/trigger-scheduler.md +102 -0
- package/.framework/src/instructions/reference/functions/triggers.md +140 -0
- package/.framework/src/instructions/reference/functions/types.md +146 -0
- package/.framework/src/instructions/reference/seeds.md +126 -0
- package/.framework/src/instructions/reference/shared-modules.md +127 -0
- package/.framework/src/instructions/reference/spine-config.md +114 -0
- package/.framework/src/instructions/roles.md +80 -0
- package/.framework/src/instructions/runtime-detail.md +70 -0
- package/.framework/src/instructions/runtime-list.md +77 -0
- package/.framework/src/instructions/security.md +67 -0
- package/.framework/src/instructions/tasks/add-a-pipeline.md +110 -0
- package/.framework/src/instructions/tasks/add-a-role.md +96 -0
- package/.framework/src/instructions/tasks/add-a-timer.md +114 -0
- package/.framework/src/instructions/tasks/add-a-trigger.md +106 -0
- package/.framework/src/instructions/tasks/add-a-type.md +151 -0
- package/.framework/src/instructions/tasks/add-a-webhook.md +108 -0
- package/.framework/src/instructions/tasks/add-an-ai-agent.md +108 -0
- package/.framework/src/instructions/tasks/add-an-integration.md +124 -0
- package/.framework/src/instructions/tasks/build-a-custom-page.md +118 -0
- package/.framework/src/instructions/tasks/package-and-install-an-app.md +127 -0
- package/.framework/src/instructions/tasks/test-your-code.md +108 -0
- package/.framework/src/instructions/tasks/write-a-function.md +132 -0
- package/.framework/src/instructions/tasks/write-a-migration.md +110 -0
- package/.framework/src/instructions/testing.md +59 -0
- package/.framework/src/instructions/timers.md +82 -0
- package/.framework/src/instructions/triggers.md +69 -0
- package/.framework/src/instructions/types.md +93 -0
- package/.framework/src/pages/NotFoundPage.tsx +62 -31
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +117 -106
- package/.framework/src/pages/admin/AIAgentsPage.tsx +86 -48
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +153 -152
- package/.framework/src/pages/admin/APIKeysPage.tsx +91 -90
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +29 -18
- package/.framework/src/pages/admin/AppDetailPage.tsx +6 -60
- package/.framework/src/pages/admin/AppsPage.tsx +104 -66
- package/.framework/src/pages/admin/DeliveriesPage.tsx +5 -5
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +5 -23
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +5 -26
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +7 -7
- package/.framework/src/pages/admin/IntegrationsPage.tsx +85 -43
- package/.framework/src/pages/admin/LogsPage.tsx +144 -76
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +223 -140
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +134 -113
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +108 -45
- package/.framework/src/pages/admin/PipelinesPage.tsx +160 -115
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +96 -98
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +101 -59
- package/.framework/src/pages/admin/RoleDetailPage.tsx +90 -79
- package/.framework/src/pages/admin/RolesPage.tsx +86 -43
- package/.framework/src/pages/admin/SecurityPage.tsx +1 -1
- package/.framework/src/pages/admin/TestingDashboard.tsx +16 -28
- package/.framework/src/pages/admin/TimerDetailPage.tsx +117 -100
- package/.framework/src/pages/admin/TimersPage.tsx +90 -62
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +90 -83
- package/.framework/src/pages/admin/TriggersPage.tsx +124 -99
- package/.framework/src/pages/admin/TypeDetailPage.tsx +152 -138
- package/.framework/src/pages/admin/TypesPage.tsx +90 -48
- package/.framework/src/pages/admin/cil/CILAgentPage.tsx +17 -25
- package/.framework/src/pages/admin/cil/CILChunkDetailPage.tsx +17 -27
- package/.framework/src/pages/admin/cil/CILDashboardPage.tsx +72 -40
- package/.framework/src/pages/admin/cil/CILFileListPage.tsx +321 -129
- package/.framework/src/pages/admin/cil/CILFileSelectPage.tsx +18 -29
- package/.framework/src/pages/admin/cil/CILGraphPage.tsx +26 -38
- package/.framework/src/pages/admin/cil/CILIngestionPage.tsx +34 -46
- package/.framework/src/pages/admin/cil/CILProjectsPage.tsx +189 -103
- package/.framework/src/pages/admin/cil/CILSearchPage.tsx +246 -136
- package/.framework/src/pages/admin/cil/CILSuggestionsPage.tsx +11 -22
- package/.framework/src/pages/admin/cil/CILVersionsPage.tsx +9 -20
- package/.framework/src/pages/admin/cil/FlexiblePipelinePage.tsx +26 -38
- package/.framework/src/pages/admin/kb/KBAdminPage.tsx +7 -26
- package/.framework/templates/agent/AGENTS.md +150 -0
- package/.framework/templates/agent/skills/spine-add-ai-agent/SKILL.md +58 -0
- package/.framework/templates/agent/skills/spine-add-automation/SKILL.md +62 -0
- package/.framework/templates/agent/skills/spine-add-integration/SKILL.md +63 -0
- package/.framework/templates/agent/skills/spine-architect/SKILL.md +86 -0
- package/.framework/templates/agent/skills/spine-install-app/SKILL.md +72 -0
- package/.framework/templates/agent/skills/spine-migration/SKILL.md +75 -0
- package/.framework/templates/agent/skills/spine-new-app/SKILL.md +67 -0
- package/.framework/templates/agent/skills/spine-new-function/SKILL.md +65 -0
- package/.framework/templates/agent/skills/spine-new-type/SKILL.md +65 -0
- package/.framework/templates/agent/skills/spine-schema/SKILL.md +77 -0
- package/.framework/templates/agent/skills/spine-test/SKILL.md +67 -0
- package/.framework/templates/agent/skills/spine-troubleshoot/SKILL.md +74 -0
- package/.framework/templates/agent/skills/spine-upgrade/SKILL.md +69 -0
- package/.framework/templates/project.json +4 -1
- package/.framework/tests/unit/account-scoping-gates.test.ts +392 -0
- package/.framework/tests/unit/agent-files.test.ts +355 -0
- package/.framework/tests/unit/agent-runner.test.ts +479 -44
- package/.framework/tests/unit/api-keys-create-scope-gate.test.ts +160 -0
- package/.framework/tests/unit/api-keys-omit-secret-fields.test.ts +38 -0
- package/.framework/tests/unit/bootstrap.test.ts +242 -0
- package/.framework/tests/unit/cli-context-api-key.test.ts +114 -0
- package/.framework/tests/unit/debug-auth.test.ts +38 -0
- package/.framework/tests/unit/deliveries-account-scoping.test.ts +185 -0
- package/.framework/tests/unit/integration-outbound-credentials.test.ts +167 -0
- package/.framework/tests/unit/integrations-audit-redaction.test.ts +130 -0
- package/.framework/tests/unit/logging-app-id.test.ts +75 -0
- package/.framework/tests/unit/system-context-denial.test.ts +145 -0
- package/.framework/tests/unit/system-cron.test.ts +240 -0
- package/.framework/tests/unit/timers.test.ts +159 -0
- package/README.md +125 -166
- package/config/tsconfig.cli.json +2 -2
- package/package.json +15 -4
- package/templates/project/package-lock.json +2 -2
- package/.framework/docs/admin-routes.md +0 -76
- package/.framework/docs/api-docs-progress.md +0 -38
- package/.framework/docs/api-governance.md +0 -146
- package/.framework/docs/api-testing-results.md +0 -212
- package/.framework/docs/assembly-launch-guide.md +0 -138
- package/.framework/docs/audit-results.md +0 -590
- package/.framework/docs/db-api-inventory.md +0 -95
- package/.framework/docs/gap-remediation-backlog.md +0 -103
- package/.framework/docs/ui-adoption-verification.md +0 -111
- package/.framework/docs/ui-api-coverage.md +0 -84
- package/.framework/docs/v2-compatibility-audit.md +0 -228
- package/.framework/mcp/index.ts +0 -133
- package/.framework/mcp/load-env.ts +0 -60
- package/.framework/mcp/shared/app-manifest.ts +0 -275
- package/.framework/mcp/shared/db.ts +0 -477
- package/.framework/mcp/shared/kb.ts +0 -118
- package/.framework/mcp/tools/architect.ts +0 -431
- package/.framework/mcp/tools/cil/context.ts +0 -345
- package/.framework/mcp/tools/cil/graph.ts +0 -242
- package/.framework/mcp/tools/cil/ingest.ts +0 -1217
- package/.framework/mcp/tools/cil/pipeline-orchestrator.ts +0 -693
- package/.framework/mcp/tools/cil/pipeline.ts +0 -767
- package/.framework/mcp/tools/cil/project.ts +0 -791
- package/.framework/mcp/tools/cil/retrieval.ts +0 -336
- package/.framework/mcp/tools/cil/search-core.ts +0 -454
- package/.framework/mcp/tools/cil/search.ts +0 -97
- package/.framework/mcp/tools/cil/suggest.ts +0 -186
- package/.framework/mcp/tools/cil/validate.ts +0 -1369
- package/.framework/mcp/tools/kb/delete.ts +0 -139
- package/.framework/mcp/tools/kb/index.ts +0 -52
- package/.framework/mcp/tools/kb/ingest.ts +0 -84
- package/.framework/mcp/tools/kb/list-types.ts +0 -102
- package/.framework/mcp/tools/kb/publish.ts +0 -100
- package/.framework/mcp/tools/kb/reindex.ts +0 -86
- package/.framework/mcp/tools/kb/revoke.ts +0 -85
- package/.framework/mcp/tools/kb/search.ts +0 -101
- package/.framework/mcp/tools/kb/upsert.ts +0 -125
- package/.framework/mcp/tools/observability.ts +0 -510
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx:module_header:module_header" type="module_header" identity="module_header" parent="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx"]
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @module PromptConfigDetailPage
|
|
4
|
+
* @audience internal
|
|
5
|
+
* @layer app-specific
|
|
6
|
+
* @stability stable
|
|
7
|
+
*
|
|
8
|
+
* This module represents the Prompt Configuration Detail page in the admin section of the application, allowing users to view and edit prompt configurations. It integrates various UI components and hooks to manage state and API interactions. INVARIANT: The user must have appropriate permissions to access this page.
|
|
9
|
+
*
|
|
10
|
+
* @seeAlso EntitySelect (provides entity selection functionality).
|
|
11
|
+
* @seeAlso useApi (custom hook for API interactions).
|
|
12
|
+
* @seeAlso PageInstructions (displays instructions for the page).
|
|
13
|
+
*
|
|
14
|
+
* @cil-generated
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
10
25
|
|
|
11
26
|
|
|
12
27
|
|
|
@@ -21,6 +36,7 @@ import { Input } from '../../components/ui/input'
|
|
|
21
36
|
import { Textarea } from '../../components/ui/textarea'
|
|
22
37
|
import { Checkbox } from '../../components/ui/checkbox'
|
|
23
38
|
import { Label } from '../../components/ui/label'
|
|
39
|
+
import { AppSelect } from '../../components/admin/EntitySelect'
|
|
24
40
|
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card'
|
|
25
41
|
import { Skeleton } from '../../components/ui/skeleton'
|
|
26
42
|
import { Alert, AlertDescription, AlertTitle } from '../../components/ui/alert'
|
|
@@ -28,23 +44,31 @@ import { ArrowLeft, FileText, AlertCircle } from 'lucide-react'
|
|
|
28
44
|
import { useApi } from '../../hooks/useApi'
|
|
29
45
|
import { apiFetch } from '../../lib/api'
|
|
30
46
|
import { formatDateTime } from '../../lib/utils'
|
|
31
|
-
import { PageInstructions } from '../../components/admin/PageInstructions'
|
|
32
|
-
|
|
33
|
-
// CIL[DOC-VECTOR type="context" content="purpose='Defines the PromptConfigDetailPage React page file, imports dependencies, and declares the PromptConfig interface'; No verified external callers; imports: .framework/src/components/ui/button.tsx,.framework/src/components/ui/input.tsx,.framework/src/components/ui/textarea.tsx"]
|
|
34
|
-
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
35
|
-
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
36
|
-
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
37
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
38
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
39
47
|
// CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx:module_header:module_header"]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
40
64
|
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx:PromptConfig:interface" type="interface" identity="PromptConfig" parent="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx"]
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
/**
|
|
66
|
+
* The PromptConfig interface defines the structure for configuration settings related to prompts in the application. It encapsulates various properties that control the behavior and characteristics of prompts used in the system.
|
|
67
|
+
*
|
|
68
|
+
* @sideEffects none
|
|
69
|
+
* @stability stable
|
|
70
|
+
* @cil-generated
|
|
71
|
+
*/
|
|
48
72
|
interface PromptConfig {
|
|
49
73
|
id: string
|
|
50
74
|
name: string
|
|
@@ -74,22 +98,37 @@ interface PromptConfig {
|
|
|
74
98
|
created_at: string
|
|
75
99
|
updated_at: string
|
|
76
100
|
}
|
|
77
|
-
// CIL[DOC-VECTOR type="context" content="purpose='Type definition for prompt configuration records used by the detail page and API'; No verified external callers; imports: .framework/src/components/ui/button.tsx,.framework/src/components/ui/input.tsx,.framework/src/components/ui/textarea.tsx"]
|
|
78
|
-
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
79
|
-
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
80
|
-
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
81
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
82
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
83
101
|
// CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx:PromptConfig:interface"]
|
|
84
102
|
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
85
118
|
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx:PromptConfigDetailPage:component" type="component" identity="PromptConfigDetailPage" parent="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx"]
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
119
|
+
/**
|
|
120
|
+
* The PromptConfigDetailPage component manages the creation and editing of prompt configurations in an admin interface. It fetches existing configurations or initializes a new one based on the provided ID.
|
|
121
|
+
*
|
|
122
|
+
* @macro Component for managing prompt configuration details in an admin panel.
|
|
123
|
+
* @micro Uses React hooks to manage state and side effects for form handling and API interactions.
|
|
124
|
+
* @outputSpec JSX.Element
|
|
125
|
+
* @throws Error — if the API fetch fails
|
|
126
|
+
* @sideEffects Makes API calls to fetch and submit prompt configurations.
|
|
127
|
+
* @stability stable
|
|
128
|
+
* @calls useParams, useNavigate, useApi, apiFetch
|
|
129
|
+
* @errorHandling throws an error if the API fetch fails
|
|
130
|
+
* @cil-generated
|
|
131
|
+
*/
|
|
93
132
|
export function PromptConfigDetailPage() {
|
|
94
133
|
const { id } = useParams<{ id: string }>()
|
|
95
134
|
const navigate = useNavigate()
|
|
@@ -120,6 +159,7 @@ export function PromptConfigDetailPage() {
|
|
|
120
159
|
is_active: true
|
|
121
160
|
})
|
|
122
161
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
162
|
+
const [formError, setFormError] = useState<string | null>(null)
|
|
123
163
|
|
|
124
164
|
const { data: config, loading, error } = useApi<PromptConfig>(
|
|
125
165
|
async () => {
|
|
@@ -164,6 +204,7 @@ export function PromptConfigDetailPage() {
|
|
|
164
204
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
165
205
|
e.preventDefault()
|
|
166
206
|
setIsSubmitting(true)
|
|
207
|
+
setFormError(null)
|
|
167
208
|
try {
|
|
168
209
|
let parsedKnowledgeSources: any[]
|
|
169
210
|
let parsedAvailableTools: any[]
|
|
@@ -213,7 +254,7 @@ export function PromptConfigDetailPage() {
|
|
|
213
254
|
const result = await response.json()
|
|
214
255
|
if (isCreateMode) { navigate(`/spine-framework/admin/configs/prompts/${result.config_id || result.id}`) } else { navigate(-1) }
|
|
215
256
|
} catch (err: any) {
|
|
216
|
-
|
|
257
|
+
setFormError(err.message)
|
|
217
258
|
} finally {
|
|
218
259
|
setIsSubmitting(false)
|
|
219
260
|
}
|
|
@@ -255,57 +296,6 @@ export function PromptConfigDetailPage() {
|
|
|
255
296
|
{isCreateMode ? 'Create Prompt Config' : config?.name || 'Prompt Config'}
|
|
256
297
|
</h1>
|
|
257
298
|
</div>
|
|
258
|
-
|
|
259
|
-
<PageInstructions
|
|
260
|
-
description="Create and manage prompt configurations that define LLM behavior."
|
|
261
|
-
sections={[
|
|
262
|
-
{ title: 'What this prompt config controls', content: 'A prompt config stores the prompt body, model settings, escalation rules, knowledge sources, available tools, tool constraints, and metadata that AI agents and chat interfaces use at runtime.' },
|
|
263
|
-
{ title: 'Fields explained', content: <ul className="list-disc pl-4 space-y-1">
|
|
264
|
-
<li><strong>Name *</strong> — string, required. The display and lookup name.</li>
|
|
265
|
-
<li><strong>Slug *</strong> — string, required. The unique key callers use to select this config.</li>
|
|
266
|
-
<li><strong>Description</strong> — string, optional. Human-readable purpose.</li>
|
|
267
|
-
<li><strong>App ID</strong> — uuid, optional. Links this config to a specific app; editable only when creating.</li>
|
|
268
|
-
<li><strong>System Prompt</strong> — text. Optional base system instructions.</li>
|
|
269
|
-
<li><strong>Context Template</strong> — text. The prompt body; may include variable placeholders.</li>
|
|
270
|
-
<li><strong>Model</strong> — string, default gpt-4o. The model to use for this prompt.</li>
|
|
271
|
-
<li><strong>Temperature</strong> — number, default 0.7. Sampling temperature.</li>
|
|
272
|
-
<li><strong>Max Tokens</strong> — number, default 4000. Token limit for the response.</li>
|
|
273
|
-
<li><strong>Is Multi Turn</strong> — checkbox, default true. Whether the prompt supports conversation history.</li>
|
|
274
|
-
<li><strong>Max History Messages</strong> — number, default 20. Number of prior messages to include.</li>
|
|
275
|
-
<li><strong>Confidence Threshold</strong> — number, optional. Minimum confidence before taking action.</li>
|
|
276
|
-
<li><strong>Escalation Action / Target</strong> — strings, optional. Where to route low-confidence results.</li>
|
|
277
|
-
<li><strong>Output Mode / Field</strong> — strings, optional. How and where to emit the model output.</li>
|
|
278
|
-
<li><strong>Requires Review</strong> — checkbox, default false. Whether outputs need human review.</li>
|
|
279
|
-
<li><strong>Knowledge Sources</strong> — JSON array, default []. Data sources the prompt can draw from.</li>
|
|
280
|
-
<li><strong>Available Tools</strong> — JSON array, default []. Tool definitions the prompt can invoke.</li>
|
|
281
|
-
<li><strong>Tool Constraints</strong> — JSON object, default {}. Rules restricting tool use.</li>
|
|
282
|
-
<li><strong>Metadata</strong> — JSON object, default {}. Extra structured data attached to the config.</li>
|
|
283
|
-
<li><strong>Active</strong> — checkbox, default true. Inactive configs are not returned as candidates.</li>
|
|
284
|
-
</ul> },
|
|
285
|
-
{ title: 'Options and values', content: <ul className="list-disc pl-4 space-y-1">
|
|
286
|
-
<li><strong>Model</strong> defaults to <em>gpt-4o</em> if left blank.</li>
|
|
287
|
-
<li><strong>Temperature</strong> can be any number; 0 is deterministic, higher values produce more random output.</li>
|
|
288
|
-
<li><strong>JSON fields</strong> must contain valid JSON. Arrays are expected for <em>Knowledge Sources</em> and <em>Available Tools</em>; objects are expected for <em>Tool Constraints</em> and <em>Metadata</em>.</li>
|
|
289
|
-
<li><strong>Active</strong>: when checked, callers can select this config by slug or default lookup.</li>
|
|
290
|
-
</ul> },
|
|
291
|
-
{ title: 'Downstream impact', content: <ul className="list-disc pl-4 space-y-1">
|
|
292
|
-
<li>AI agents and pipelines look up prompts by slug. Missing or inactive configs break those calls.</li>
|
|
293
|
-
<li>Context Template variables must be supplied by callers; unresolved placeholders remain literal in the rendered text.</li>
|
|
294
|
-
<li>Malformed JSON in the JSON fields will prevent save and may break runtime callers expecting arrays or objects.</li>
|
|
295
|
-
</ul> },
|
|
296
|
-
{ title: 'How to create, save, and validate', content: <ol className="list-decimal pl-4 space-y-1">
|
|
297
|
-
<li>In create mode, enter the required <em>Name</em> and <em>Slug</em>. Optionally set <em>App ID</em>.</li>
|
|
298
|
-
<li>Fill the <em>Context Template</em> prompt body, model defaults, and any optional escalation/output fields.</li>
|
|
299
|
-
<li>Paste valid JSON into the four JSON textareas. Click <strong>Create</strong> or <strong>Update</strong> to save.</li>
|
|
300
|
-
</ol> },
|
|
301
|
-
{ title: 'Common mistakes', content: <ul className="list-disc pl-4 space-y-1">
|
|
302
|
-
<li>Leaving <em>Slug</em> empty or duplicating an existing slug.</li>
|
|
303
|
-
<li>Entering JSON arrays as a string or leaving a JSON field completely blank.</li>
|
|
304
|
-
<li>Setting <em>Max Tokens</em> or <em>Max History Messages</em> to 0 or non-numeric values.</li>
|
|
305
|
-
</ul> },
|
|
306
|
-
]}
|
|
307
|
-
/>
|
|
308
|
-
|
|
309
299
|
<form onSubmit={handleSubmit} className="space-y-6">
|
|
310
300
|
<Card>
|
|
311
301
|
<CardHeader>
|
|
@@ -334,11 +324,10 @@ export function PromptConfigDetailPage() {
|
|
|
334
324
|
</div>
|
|
335
325
|
{isCreateMode && (
|
|
336
326
|
<div className="space-y-2">
|
|
337
|
-
<Label>App
|
|
338
|
-
<
|
|
327
|
+
<Label>App</Label>
|
|
328
|
+
<AppSelect
|
|
339
329
|
value={formData.app_id}
|
|
340
|
-
onChange={(
|
|
341
|
-
placeholder="00000000-0000-0000-0000-000000000000"
|
|
330
|
+
onChange={(v) => setFormData({ ...formData, app_id: v })}
|
|
342
331
|
/>
|
|
343
332
|
</div>
|
|
344
333
|
)}
|
|
@@ -424,6 +413,13 @@ export function PromptConfigDetailPage() {
|
|
|
424
413
|
|
|
425
414
|
|
|
426
415
|
|
|
416
|
+
/**
|
|
417
|
+
* The constant 'v' captures the value from an event target, typically from a user input field, to facilitate the handling of user input in the component's state management.
|
|
418
|
+
*
|
|
419
|
+
* @sideEffects none
|
|
420
|
+
* @stability stable
|
|
421
|
+
* @cil-generated
|
|
422
|
+
*/
|
|
427
423
|
const v = e.target.value
|
|
428
424
|
|
|
429
425
|
setFormData({ ...formData, confidence_threshold: v === '' ? '' : Number(v) })
|
|
@@ -577,6 +573,7 @@ export function PromptConfigDetailPage() {
|
|
|
577
573
|
)}
|
|
578
574
|
|
|
579
575
|
<div className="flex items-center justify-end gap-3">
|
|
576
|
+
{formError && <p className="text-sm text-red-600 mr-auto">{formError}</p>}
|
|
580
577
|
<Button type="button" variant="secondary" onClick={() => navigate(-1)}>
|
|
581
578
|
Cancel
|
|
582
579
|
</Button>
|
|
@@ -588,13 +585,14 @@ export function PromptConfigDetailPage() {
|
|
|
588
585
|
</div>
|
|
589
586
|
)
|
|
590
587
|
}
|
|
591
|
-
// CIL[DOC-VECTOR type="context" content="purpose='Admin page for creating and editing prompt configurations'; No verified external callers; imports: .framework/src/components/ui/button.tsx,.framework/src/components/ui/input.tsx,.framework/src/components/ui/textarea.tsx"]
|
|
592
|
-
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
593
|
-
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
594
|
-
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
595
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
596
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
597
588
|
// CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigDetailPage.tsx:PromptConfigDetailPage:component"]
|
|
598
589
|
|
|
599
590
|
|
|
600
591
|
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:module_header:module_header" type="module_header" identity="module_header" parent="~/.framework/src/pages/admin/PromptConfigsPage.tsx"]
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @module PromptConfigsPage
|
|
4
|
+
* @audience both
|
|
5
|
+
* @layer shared-core
|
|
6
|
+
* @stability stable
|
|
7
|
+
*
|
|
8
|
+
* This module represents the Prompt Configurations page in the admin section of the application, allowing administrators to manage prompt configurations effectively. It utilizes various UI components and hooks to provide a responsive interface for listing and sorting configurations.
|
|
9
|
+
* INVARIANT: The user must have admin privileges to access this page.
|
|
10
|
+
*
|
|
11
|
+
* @seeAlso LoadingSpinner (provides loading feedback for async operations).
|
|
12
|
+
* @seeAlso Button (used for triggering actions on the page).
|
|
13
|
+
* @seeAlso AdminListPage (base component for displaying lists in the admin section).
|
|
14
|
+
* @seeAlso SortableTableHeader (enables sorting functionality for table headers).
|
|
15
|
+
*
|
|
16
|
+
* @cil-generated
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
10
27
|
|
|
11
28
|
|
|
12
29
|
|
|
@@ -14,6 +31,7 @@
|
|
|
14
31
|
|
|
15
32
|
|
|
16
33
|
import React, { useState } from 'react'
|
|
34
|
+
import { useNavigate } from 'react-router-dom'
|
|
17
35
|
import { Plus, FileText, CheckCircle, Star, Cpu, MessageSquare } from 'lucide-react';
|
|
18
36
|
import { LoadingSpinner } from '../../components/ui/LoadingSpinner'
|
|
19
37
|
import { Button } from '../../components/ui/button'
|
|
@@ -22,23 +40,32 @@ import { SortableTableHeader } from '../../components/admin/SortableTableHeader'
|
|
|
22
40
|
import { formatDateTime } from '../../lib/utils'
|
|
23
41
|
import { useApi } from '../../hooks/useApi'
|
|
24
42
|
import { apiFetch } from '../../lib/api'
|
|
25
|
-
|
|
26
|
-
// CIL[DOC-VECTOR type="context" content="purpose='Admin prompt config list page module header'; No verified external callers; imports: .framework/src/components/ui/LoadingSpinner.tsx,.framework/src/components/ui/button.tsx,.framework/src/components/admin/AdminListPage.tsx"]
|
|
27
|
-
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
28
|
-
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
29
|
-
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
30
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
31
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
32
43
|
// CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:module_header:module_header"]
|
|
33
|
-
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfig:interface" type="interface" identity="PromptConfig" parent="~/.framework/src/pages/admin/PromptConfigsPage.tsx"]
|
|
34
|
-
// CIL[DOC-MACRO purpose="PromptConfig TypeScript interface definition"]
|
|
35
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Declares the shape of prompt configuration records used by the admin page"]
|
|
36
|
-
// CIL[DOC-CONTEXT module="admin-prompt-configs" layer="types" related_files=".framework/src/components/admin/AdminListPage.tsx,.framework/src/components/admin/SortableTableHeader.tsx,.framework/src/components/ui/LoadingSpinner.tsx,.framework/src/components/ui/button.tsx,.framework/src/hooks/useApi.ts,.framework/src/lib/api.ts,.framework/src/lib/utils.ts,.framework/src/pages/admin/PromptConfigsPage.tsx"]
|
|
37
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="PromptConfig type" errors="none" side_effects="none"]
|
|
38
|
-
// CIL[DOC-MICRO logic_summary="Defines optional and required fields for prompt config records including model settings, status, and audit timestamps" notable_decisions="[]"]
|
|
39
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
40
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
41
44
|
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfig:interface" type="interface" identity="PromptConfig" parent="~/.framework/src/pages/admin/PromptConfigsPage.tsx"]
|
|
62
|
+
/**
|
|
63
|
+
* The PromptConfig interface defines the structure for configuration objects related to prompts in the application. It encapsulates various properties that dictate the behavior and metadata of prompts.
|
|
64
|
+
*
|
|
65
|
+
* @sideEffects none
|
|
66
|
+
* @stability internal
|
|
67
|
+
* @cil-generated
|
|
68
|
+
*/
|
|
42
69
|
interface PromptConfig {
|
|
43
70
|
id: string
|
|
44
71
|
name: string
|
|
@@ -49,33 +76,48 @@ interface PromptConfig {
|
|
|
49
76
|
max_tokens?: number
|
|
50
77
|
is_multi_turn?: boolean
|
|
51
78
|
is_active: boolean
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
category?: string
|
|
79
|
+
is_system?: boolean
|
|
80
|
+
output_mode?: string
|
|
55
81
|
app_id?: string
|
|
56
82
|
app?: any
|
|
57
83
|
created_by?: string
|
|
58
84
|
created_at: string
|
|
59
85
|
updated_at: string
|
|
60
86
|
}
|
|
61
|
-
// CIL[DOC-VECTOR type="context" content="purpose='PromptConfig TypeScript interface definition'; No verified external callers; imports: .framework/src/components/ui/LoadingSpinner.tsx,.framework/src/components/ui/button.tsx,.framework/src/components/admin/AdminListPage.tsx"]
|
|
62
|
-
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
63
|
-
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
64
|
-
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
65
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
66
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
67
87
|
// CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfig:interface"]
|
|
68
88
|
|
|
69
|
-
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfigsPage:component" type="component" identity="PromptConfigsPage" parent="~/.framework/src/pages/admin/PromptConfigsPage.tsx"]
|
|
70
|
-
// CIL[DOC-MACRO purpose="Renders the admin prompt configurations list page"]
|
|
71
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Loads prompt configs, applies filters and sorting, and renders an AdminListPage with stats and table"]
|
|
72
|
-
// CIL[DOC-CONTEXT module="admin-prompt-configs" layer="pages" related_files=".framework/src/components/admin/AdminListPage.tsx,.framework/src/components/admin/SortableTableHeader.tsx,.framework/src/components/ui/LoadingSpinner.tsx,.framework/src/components/ui/button.tsx,.framework/src/hooks/useApi.ts,.framework/src/lib/api.ts,.framework/src/lib/utils.ts,.framework/src/pages/admin/PromptConfigsPage.tsx"]
|
|
73
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="JSX element" errors="useApi error if API fetch fails" side_effects="window navigation on row click"]
|
|
74
|
-
// CIL[DOC-MICRO logic_summary="Fetches prompt configs, filters by search, status, and type, sorts by selected key, and renders stat cards and sortable table rows" notable_decisions="[]"]
|
|
75
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
76
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
77
89
|
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// CIL[BEGIN stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfigsPage:component" type="component" identity="PromptConfigsPage" parent="~/.framework/src/pages/admin/PromptConfigsPage.tsx"]
|
|
106
|
+
/**
|
|
107
|
+
* The PromptConfigsPage component manages the display and filtering of prompt configuration settings in the admin interface. It allows users to search, sort, and navigate to detailed views of prompt configurations.
|
|
108
|
+
*
|
|
109
|
+
* @macro Admin interface component for managing prompt configurations.
|
|
110
|
+
* @micro Utilizes state management for search and sorting, and fetches data from an external API.
|
|
111
|
+
* @outputSpec JSX.Element — renders the UI for managing prompt configurations.
|
|
112
|
+
* @throws Error — if the API fetch fails
|
|
113
|
+
* @sideEffects Fetches prompt configurations from an external API.
|
|
114
|
+
* @stability internal
|
|
115
|
+
* @calls useApi, apiFetch, useNavigate
|
|
116
|
+
* @errorHandling throws an error if the API fetch fails
|
|
117
|
+
* @cil-generated
|
|
118
|
+
*/
|
|
78
119
|
export function PromptConfigsPage() {
|
|
120
|
+
const navigate = useNavigate()
|
|
79
121
|
const [searchTerm, setSearchTerm] = useState('')
|
|
80
122
|
const [selectedStatus, setSelectedStatus] = useState('all')
|
|
81
123
|
const [selectedType, setSelectedType] = useState('all')
|
|
@@ -99,11 +141,11 @@ export function PromptConfigsPage() {
|
|
|
99
141
|
const matchesStatus = selectedStatus === 'all' ||
|
|
100
142
|
(selectedStatus === 'active' && config.is_active) ||
|
|
101
143
|
(selectedStatus === 'inactive' && !config.is_active)
|
|
102
|
-
const matchesType = selectedType === 'all' || config.
|
|
144
|
+
const matchesType = selectedType === 'all' || config.output_mode === selectedType
|
|
103
145
|
return matchesSearch && matchesStatus && matchesType
|
|
104
146
|
})
|
|
105
147
|
|
|
106
|
-
const promptTypes = Array.from(new Set((promptConfigs || []).map(c => c.
|
|
148
|
+
const promptTypes = Array.from(new Set((promptConfigs || []).map(c => c.output_mode).filter(Boolean)))
|
|
107
149
|
|
|
108
150
|
const handleSort = (key: string) => {
|
|
109
151
|
if (sortKey === key) {
|
|
@@ -115,7 +157,7 @@ export function PromptConfigsPage() {
|
|
|
115
157
|
}
|
|
116
158
|
|
|
117
159
|
const handleRowClick = (config: PromptConfig) => {
|
|
118
|
-
|
|
160
|
+
navigate(`/spine-framework/admin/configs/prompts/${config.id}`)
|
|
119
161
|
}
|
|
120
162
|
|
|
121
163
|
const sortedConfigs = [...(filteredPromptConfigs || [])].sort((a, b) => {
|
|
@@ -149,8 +191,8 @@ export function PromptConfigsPage() {
|
|
|
149
191
|
iconColor: 'text-green-500'
|
|
150
192
|
},
|
|
151
193
|
{
|
|
152
|
-
title: '
|
|
153
|
-
value: (promptConfigs || []).filter(c => c.
|
|
194
|
+
title: 'System',
|
|
195
|
+
value: (promptConfigs || []).filter(c => c.is_system).length,
|
|
154
196
|
icon: Star,
|
|
155
197
|
iconColor: 'text-yellow-500'
|
|
156
198
|
},
|
|
@@ -181,7 +223,7 @@ export function PromptConfigsPage() {
|
|
|
181
223
|
onChange: (v: string) => setSelectedStatus(v)
|
|
182
224
|
},
|
|
183
225
|
{
|
|
184
|
-
label: '
|
|
226
|
+
label: 'Output',
|
|
185
227
|
value: selectedType,
|
|
186
228
|
options: typeOptions,
|
|
187
229
|
onChange: (v: string) => setSelectedType(v)
|
|
@@ -231,8 +273,8 @@ export function PromptConfigsPage() {
|
|
|
231
273
|
onSort={handleSort}
|
|
232
274
|
/>
|
|
233
275
|
<SortableTableHeader
|
|
234
|
-
title="
|
|
235
|
-
sortKey="
|
|
276
|
+
title="Output"
|
|
277
|
+
sortKey="output_mode"
|
|
236
278
|
currentSortKey={sortKey}
|
|
237
279
|
currentSortDirection={sortDirection}
|
|
238
280
|
onSort={handleSort}
|
|
@@ -246,7 +288,7 @@ export function PromptConfigsPage() {
|
|
|
246
288
|
/>
|
|
247
289
|
<SortableTableHeader
|
|
248
290
|
title="Settings"
|
|
249
|
-
sortKey="
|
|
291
|
+
sortKey="is_system"
|
|
250
292
|
currentSortKey={sortKey}
|
|
251
293
|
currentSortDirection={sortDirection}
|
|
252
294
|
onSort={handleSort}
|
|
@@ -287,7 +329,7 @@ export function PromptConfigsPage() {
|
|
|
287
329
|
</span>
|
|
288
330
|
</td>
|
|
289
331
|
<td className="px-6 py-4 whitespace-nowrap">
|
|
290
|
-
<span className="text-sm text-slate-600 capitalize">{config.
|
|
332
|
+
<span className="text-sm text-slate-600 capitalize">{config.output_mode || '—'}</span>
|
|
291
333
|
</td>
|
|
292
334
|
<td className="px-6 py-4 whitespace-nowrap">
|
|
293
335
|
<span className={`inline-flex px-2 py-0.5 text-xs font-medium rounded-md ${
|
|
@@ -300,8 +342,8 @@ export function PromptConfigsPage() {
|
|
|
300
342
|
</td>
|
|
301
343
|
<td className="px-6 py-4 whitespace-nowrap">
|
|
302
344
|
<div className="flex gap-1">
|
|
303
|
-
{config.
|
|
304
|
-
<span className="inline-flex px-1.5 py-0.5 text-xs font-medium rounded bg-yellow-100 text-yellow-700">
|
|
345
|
+
{config.is_system && (
|
|
346
|
+
<span className="inline-flex px-1.5 py-0.5 text-xs font-medium rounded bg-yellow-100 text-yellow-700">System</span>
|
|
305
347
|
)}
|
|
306
348
|
{config.is_multi_turn && (
|
|
307
349
|
<span className="inline-flex px-1.5 py-0.5 text-xs font-medium rounded bg-blue-100 text-blue-700">Multi-turn</span>
|
|
@@ -322,10 +364,10 @@ export function PromptConfigsPage() {
|
|
|
322
364
|
</AdminListPage>
|
|
323
365
|
)
|
|
324
366
|
}
|
|
325
|
-
// CIL[
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
367
|
+
// CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfigsPage:component"]
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|