spine-framework 0.4.3 → 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.
Files changed (320) hide show
  1. package/.env.example +13 -3
  2. package/.framework/cli/commands/bootstrap.ts +392 -0
  3. package/.framework/cli/commands/dev.ts +91 -218
  4. package/.framework/cli/commands/doctor.ts +132 -26
  5. package/.framework/cli/commands/generate.ts +38 -298
  6. package/.framework/cli/commands/init.ts +20 -1
  7. package/.framework/cli/commands/migrate.ts +36 -30
  8. package/.framework/cli/commands/migrations.ts +16 -56
  9. package/.framework/cli/commands/upgrade.ts +35 -0
  10. package/.framework/cli/commands/validate-schema.ts +147 -0
  11. package/.framework/cli/context.ts +223 -110
  12. package/.framework/cli/index.ts +6 -0
  13. package/.framework/cli/lib/project-files.ts +241 -1
  14. package/.framework/functions/_shared/agent-runner.ts +1000 -81
  15. package/.framework/functions/_shared/cil.ts +2 -1
  16. package/.framework/functions/_shared/db.ts +3 -6
  17. package/.framework/functions/_shared/hash-api-key.ts +183 -79
  18. package/.framework/functions/_shared/kb.ts +61 -7
  19. package/.framework/functions/_shared/logging.ts +562 -224
  20. package/.framework/functions/_shared/message-sequence.ts +53 -0
  21. package/.framework/functions/_shared/middleware.ts +47 -44
  22. package/.framework/functions/_shared/pipeline-runner.ts +150 -37
  23. package/.framework/functions/_shared/principal.ts +9 -6
  24. package/.framework/functions/_shared/trigger-engine.ts +149 -40
  25. package/.framework/functions/admin-data.ts +48 -31
  26. package/.framework/functions/ai-agents.ts +103 -33
  27. package/.framework/functions/api-keys.ts +301 -122
  28. package/.framework/functions/apps.ts +43 -26
  29. package/.framework/functions/cil-ingest.ts +48 -15
  30. package/.framework/functions/debug-auth.ts +14 -8
  31. package/.framework/functions/deliveries.ts +39 -12
  32. package/.framework/functions/embeddings.ts +145 -76
  33. package/.framework/functions/integration-outbound.ts +67 -27
  34. package/.framework/functions/integrations.ts +254 -127
  35. package/.framework/functions/logs.ts +273 -133
  36. package/.framework/functions/observability.ts +277 -147
  37. package/.framework/functions/pipeline-executions.ts +1 -1
  38. package/.framework/functions/pipeline-runner-background.ts +120 -0
  39. package/.framework/functions/pipelines.ts +14 -9
  40. package/.framework/functions/prompt-configs.ts +7 -4
  41. package/.framework/functions/roles.ts +8 -5
  42. package/.framework/functions/security.ts +30 -17
  43. package/.framework/functions/system-cron.ts +250 -128
  44. package/.framework/functions/tests.ts +7 -6
  45. package/.framework/functions/timers.ts +310 -107
  46. package/.framework/functions/trigger-scheduler.ts +65 -5
  47. package/.framework/functions/triggers.ts +28 -13
  48. package/.framework/functions/types.ts +13 -10
  49. package/.framework/migrations/064_episode_leases.sql +196 -0
  50. package/.framework/migrations/065_execution_tables_updated_at.sql +20 -0
  51. package/.framework/migrations/066_episode_steal_thread_merge.sql +148 -0
  52. package/.framework/migrations/067_episode_lease_stale_steal.sql +93 -0
  53. package/.framework/migrations/068_cron_schedule_timer_rpcs.sql +251 -0
  54. package/.framework/migrations/069_log_stats_window.sql +54 -0
  55. package/.framework/migrations/070_app_type_schema_rpcs.sql +166 -0
  56. package/.framework/migrations/071_timer_interval_keys.sql +96 -0
  57. package/.framework/migrations/072_slug_autofill.sql +77 -0
  58. package/.framework/migrations/073_seed_member_roles.sql +26 -0
  59. package/.framework/schemas/spine.config.schema.json +62 -0
  60. package/.framework/src/App.tsx +3 -1
  61. package/.framework/src/apps/admin/index.tsx +1141 -775
  62. package/.framework/src/components/ErrorBoundary.tsx +136 -0
  63. package/.framework/src/components/admin/AdminListPage.tsx +81 -73
  64. package/.framework/src/components/admin/AdminSidebar.tsx +92 -81
  65. package/.framework/src/components/admin/EntitySelect.tsx +181 -0
  66. package/.framework/src/components/admin/PageInstructions.tsx +86 -127
  67. package/.framework/src/components/app-shell/GenericAppShell.tsx +3 -1
  68. package/.framework/src/components/app-shell/GenericDetailPage.tsx +37 -13
  69. package/.framework/src/components/app-shell/GenericListPage.tsx +28 -32
  70. package/.framework/src/components/auth/TurnstileWidget.tsx +9 -6
  71. package/.framework/src/components/kb/KBArticleEditor.tsx +49 -6
  72. package/.framework/src/components/layout/Layout.tsx +4 -2
  73. package/.framework/src/components/layout/Sidebar.tsx +304 -179
  74. package/.framework/src/components/runtime/DataDetailPage.tsx +67 -35
  75. package/.framework/src/components/runtime/DataHeader.tsx +96 -48
  76. package/.framework/src/components/runtime/DataListPage.tsx +3 -26
  77. package/.framework/src/components/runtime/DataStats.tsx +10 -10
  78. package/.framework/src/components/runtime/DataTable.tsx +12 -10
  79. package/.framework/src/components/ui/sheet.tsx +24 -26
  80. package/.framework/src/components/ui/textarea.tsx +74 -48
  81. package/.framework/src/hooks/useBranding.ts +47 -0
  82. package/.framework/src/hooks/useEntityList.ts +12 -9
  83. package/.framework/src/hooks/useListSchema.ts +108 -58
  84. package/.framework/src/instructions/README.md +57 -0
  85. package/.framework/src/instructions/ai-agents.md +69 -0
  86. package/.framework/src/instructions/alerts.md +80 -0
  87. package/.framework/src/instructions/api-keys.md +87 -0
  88. package/.framework/src/instructions/apps.md +77 -0
  89. package/.framework/src/instructions/concepts/ai-and-prompts.md +150 -0
  90. package/.framework/src/instructions/concepts/apps-and-renderers.md +162 -0
  91. package/.framework/src/instructions/concepts/auth-and-api-keys.md +133 -0
  92. package/.framework/src/instructions/concepts/automation.md +186 -0
  93. package/.framework/src/instructions/concepts/concurrency-and-idempotency.md +125 -0
  94. package/.framework/src/instructions/concepts/core-vs-custom.md +124 -0
  95. package/.framework/src/instructions/concepts/design-schema.md +152 -0
  96. package/.framework/src/instructions/concepts/integrations-and-webhooks.md +127 -0
  97. package/.framework/src/instructions/concepts/observability.md +116 -0
  98. package/.framework/src/instructions/concepts/permissions.md +150 -0
  99. package/.framework/src/instructions/concepts/runtime-records.md +111 -0
  100. package/.framework/src/instructions/concepts/scope-and-accounts.md +112 -0
  101. package/.framework/src/instructions/concepts/spine-way.md +172 -0
  102. package/.framework/src/instructions/deliveries.md +59 -0
  103. package/.framework/src/instructions/guide/00-orientation.md +106 -0
  104. package/.framework/src/instructions/guide/01-install-and-first-run.md +253 -0
  105. package/.framework/src/instructions/guide/02-project-map.md +147 -0
  106. package/.framework/src/instructions/guide/03-domain-model.md +223 -0
  107. package/.framework/src/instructions/guide/04-first-app.md +227 -0
  108. package/.framework/src/instructions/guide/05-glossary.md +183 -0
  109. package/.framework/src/instructions/integrations.md +96 -0
  110. package/.framework/src/instructions/internal/cil-markers.md +83 -0
  111. package/.framework/src/instructions/invites.md +60 -0
  112. package/.framework/src/instructions/kb.md +80 -0
  113. package/.framework/src/instructions/logs.md +77 -0
  114. package/.framework/src/instructions/observability.md +61 -0
  115. package/.framework/src/instructions/operations/deployment.md +115 -0
  116. package/.framework/src/instructions/operations/migrations.md +125 -0
  117. package/.framework/src/instructions/operations/security-checklist.md +148 -0
  118. package/.framework/src/instructions/operations/troubleshooting.md +170 -0
  119. package/.framework/src/instructions/operations/upgrade.md +116 -0
  120. package/.framework/src/instructions/pipeline-executions.md +62 -0
  121. package/.framework/src/instructions/pipelines.md +78 -0
  122. package/.framework/src/instructions/prompts.md +95 -0
  123. package/.framework/src/instructions/reference/api/admin-data.md +162 -0
  124. package/.framework/src/instructions/reference/api/auth.md +113 -0
  125. package/.framework/src/instructions/reference/api/errors-and-envelopes.md +113 -0
  126. package/.framework/src/instructions/reference/app-manifest.md +150 -0
  127. package/.framework/src/instructions/reference/cli.md +124 -0
  128. package/.framework/src/instructions/reference/database.md +132 -0
  129. package/.framework/src/instructions/reference/design-schema.md +280 -0
  130. package/.framework/src/instructions/reference/env-vars.md +133 -0
  131. package/.framework/src/instructions/reference/functions/account-nodes.md +75 -0
  132. package/.framework/src/instructions/reference/functions/admin-data.md +195 -0
  133. package/.framework/src/instructions/reference/functions/admin-funnel.md +90 -0
  134. package/.framework/src/instructions/reference/functions/admin-install-funnel.md +107 -0
  135. package/.framework/src/instructions/reference/functions/admin-signals.md +102 -0
  136. package/.framework/src/instructions/reference/functions/ai-agents.md +148 -0
  137. package/.framework/src/instructions/reference/functions/ai-interactions.md +156 -0
  138. package/.framework/src/instructions/reference/functions/api-keys.md +130 -0
  139. package/.framework/src/instructions/reference/functions/apps.md +140 -0
  140. package/.framework/src/instructions/reference/functions/auth.md +99 -0
  141. package/.framework/src/instructions/reference/functions/debug-auth.md +91 -0
  142. package/.framework/src/instructions/reference/functions/deliveries.md +110 -0
  143. package/.framework/src/instructions/reference/functions/embeddings.md +166 -0
  144. package/.framework/src/instructions/reference/functions/eval-harness.md +149 -0
  145. package/.framework/src/instructions/reference/functions/index.md +103 -0
  146. package/.framework/src/instructions/reference/functions/integration-outbound.md +200 -0
  147. package/.framework/src/instructions/reference/functions/integration-routes.md +151 -0
  148. package/.framework/src/instructions/reference/functions/integrations.md +130 -0
  149. package/.framework/src/instructions/reference/functions/invites.md +182 -0
  150. package/.framework/src/instructions/reference/functions/item-progress.md +107 -0
  151. package/.framework/src/instructions/reference/functions/kb.md +166 -0
  152. package/.framework/src/instructions/reference/functions/logs.md +141 -0
  153. package/.framework/src/instructions/reference/functions/observability.md +105 -0
  154. package/.framework/src/instructions/reference/functions/pipeline-executions.md +132 -0
  155. package/.framework/src/instructions/reference/functions/pipeline-runner-background.md +121 -0
  156. package/.framework/src/instructions/reference/functions/pipelines.md +136 -0
  157. package/.framework/src/instructions/reference/functions/prompt-configs.md +121 -0
  158. package/.framework/src/instructions/reference/functions/roles.md +121 -0
  159. package/.framework/src/instructions/reference/functions/security.md +140 -0
  160. package/.framework/src/instructions/reference/functions/system-cron.md +136 -0
  161. package/.framework/src/instructions/reference/functions/system.md +106 -0
  162. package/.framework/src/instructions/reference/functions/tests.md +97 -0
  163. package/.framework/src/instructions/reference/functions/timers.md +117 -0
  164. package/.framework/src/instructions/reference/functions/trigger-scheduler.md +102 -0
  165. package/.framework/src/instructions/reference/functions/triggers.md +140 -0
  166. package/.framework/src/instructions/reference/functions/types.md +146 -0
  167. package/.framework/src/instructions/reference/seeds.md +126 -0
  168. package/.framework/src/instructions/reference/shared-modules.md +127 -0
  169. package/.framework/src/instructions/reference/spine-config.md +114 -0
  170. package/.framework/src/instructions/roles.md +80 -0
  171. package/.framework/src/instructions/runtime-detail.md +70 -0
  172. package/.framework/src/instructions/runtime-list.md +77 -0
  173. package/.framework/src/instructions/security.md +67 -0
  174. package/.framework/src/instructions/tasks/add-a-pipeline.md +110 -0
  175. package/.framework/src/instructions/tasks/add-a-role.md +96 -0
  176. package/.framework/src/instructions/tasks/add-a-timer.md +114 -0
  177. package/.framework/src/instructions/tasks/add-a-trigger.md +106 -0
  178. package/.framework/src/instructions/tasks/add-a-type.md +151 -0
  179. package/.framework/src/instructions/tasks/add-a-webhook.md +108 -0
  180. package/.framework/src/instructions/tasks/add-an-ai-agent.md +108 -0
  181. package/.framework/src/instructions/tasks/add-an-integration.md +124 -0
  182. package/.framework/src/instructions/tasks/build-a-custom-page.md +118 -0
  183. package/.framework/src/instructions/tasks/package-and-install-an-app.md +127 -0
  184. package/.framework/src/instructions/tasks/test-your-code.md +108 -0
  185. package/.framework/src/instructions/tasks/write-a-function.md +132 -0
  186. package/.framework/src/instructions/tasks/write-a-migration.md +110 -0
  187. package/.framework/src/instructions/testing.md +59 -0
  188. package/.framework/src/instructions/timers.md +82 -0
  189. package/.framework/src/instructions/triggers.md +69 -0
  190. package/.framework/src/instructions/types.md +93 -0
  191. package/.framework/src/lib/branding.ts +128 -0
  192. package/.framework/src/pages/NoAppPage.tsx +3 -1
  193. package/.framework/src/pages/NotFoundPage.tsx +62 -31
  194. package/.framework/src/pages/SetupPage.tsx +5 -2
  195. package/.framework/src/pages/admin/AIAgentDetailPage.tsx +117 -106
  196. package/.framework/src/pages/admin/AIAgentsPage.tsx +86 -48
  197. package/.framework/src/pages/admin/APIKeyDetailPage.tsx +153 -152
  198. package/.framework/src/pages/admin/APIKeysPage.tsx +91 -90
  199. package/.framework/src/pages/admin/AlertsConfigPage.tsx +29 -18
  200. package/.framework/src/pages/admin/AppDetailPage.tsx +6 -60
  201. package/.framework/src/pages/admin/AppsPage.tsx +104 -66
  202. package/.framework/src/pages/admin/DeliveriesPage.tsx +5 -5
  203. package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +5 -23
  204. package/.framework/src/pages/admin/EmbeddingsPage.tsx +5 -26
  205. package/.framework/src/pages/admin/IntegrationDetailPage.tsx +7 -7
  206. package/.framework/src/pages/admin/IntegrationsPage.tsx +85 -43
  207. package/.framework/src/pages/admin/LogsPage.tsx +144 -76
  208. package/.framework/src/pages/admin/ObservabilityDashboard.tsx +223 -140
  209. package/.framework/src/pages/admin/PipelineDetailPage.tsx +134 -113
  210. package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +108 -45
  211. package/.framework/src/pages/admin/PipelinesPage.tsx +160 -115
  212. package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +96 -98
  213. package/.framework/src/pages/admin/PromptConfigsPage.tsx +101 -59
  214. package/.framework/src/pages/admin/RoleDetailPage.tsx +90 -79
  215. package/.framework/src/pages/admin/RolesPage.tsx +86 -43
  216. package/.framework/src/pages/admin/SecurityPage.tsx +1 -1
  217. package/.framework/src/pages/admin/TestingDashboard.tsx +16 -28
  218. package/.framework/src/pages/admin/TimerDetailPage.tsx +117 -100
  219. package/.framework/src/pages/admin/TimersPage.tsx +90 -62
  220. package/.framework/src/pages/admin/TriggerDetailPage.tsx +90 -83
  221. package/.framework/src/pages/admin/TriggersPage.tsx +124 -99
  222. package/.framework/src/pages/admin/TypeDetailPage.tsx +152 -138
  223. package/.framework/src/pages/admin/TypesPage.tsx +90 -48
  224. package/.framework/src/pages/admin/cil/CILAgentPage.tsx +17 -25
  225. package/.framework/src/pages/admin/cil/CILChunkDetailPage.tsx +17 -27
  226. package/.framework/src/pages/admin/cil/CILDashboardPage.tsx +72 -40
  227. package/.framework/src/pages/admin/cil/CILFileListPage.tsx +321 -129
  228. package/.framework/src/pages/admin/cil/CILFileSelectPage.tsx +18 -29
  229. package/.framework/src/pages/admin/cil/CILGraphPage.tsx +26 -38
  230. package/.framework/src/pages/admin/cil/CILIngestionPage.tsx +34 -46
  231. package/.framework/src/pages/admin/cil/CILProjectsPage.tsx +189 -103
  232. package/.framework/src/pages/admin/cil/CILSearchPage.tsx +246 -136
  233. package/.framework/src/pages/admin/cil/CILSuggestionsPage.tsx +11 -22
  234. package/.framework/src/pages/admin/cil/CILVersionsPage.tsx +9 -20
  235. package/.framework/src/pages/admin/cil/FlexiblePipelinePage.tsx +26 -38
  236. package/.framework/src/pages/admin/kb/KBAdminPage.tsx +7 -26
  237. package/.framework/src/pages/auth/AuthConfirmPage.tsx +3 -1
  238. package/.framework/src/pages/auth/ForgotPasswordPage.tsx +3 -1
  239. package/.framework/src/pages/auth/LoginPage.tsx +4 -2
  240. package/.framework/src/pages/auth/RegisterPage.tsx +3 -1
  241. package/.framework/templates/agent/AGENTS.md +150 -0
  242. package/.framework/templates/agent/skills/spine-add-ai-agent/SKILL.md +58 -0
  243. package/.framework/templates/agent/skills/spine-add-automation/SKILL.md +62 -0
  244. package/.framework/templates/agent/skills/spine-add-integration/SKILL.md +63 -0
  245. package/.framework/templates/agent/skills/spine-architect/SKILL.md +86 -0
  246. package/.framework/templates/agent/skills/spine-install-app/SKILL.md +72 -0
  247. package/.framework/templates/agent/skills/spine-migration/SKILL.md +75 -0
  248. package/.framework/templates/agent/skills/spine-new-app/SKILL.md +67 -0
  249. package/.framework/templates/agent/skills/spine-new-function/SKILL.md +65 -0
  250. package/.framework/templates/agent/skills/spine-new-type/SKILL.md +65 -0
  251. package/.framework/templates/agent/skills/spine-schema/SKILL.md +77 -0
  252. package/.framework/templates/agent/skills/spine-test/SKILL.md +67 -0
  253. package/.framework/templates/agent/skills/spine-troubleshoot/SKILL.md +74 -0
  254. package/.framework/templates/agent/skills/spine-upgrade/SKILL.md +69 -0
  255. package/.framework/templates/project.json +5 -1
  256. package/.framework/tests/unit/account-scoping-gates.test.ts +392 -0
  257. package/.framework/tests/unit/agent-files.test.ts +355 -0
  258. package/.framework/tests/unit/agent-runner.test.ts +496 -47
  259. package/.framework/tests/unit/api-keys-create-scope-gate.test.ts +160 -0
  260. package/.framework/tests/unit/api-keys-omit-secret-fields.test.ts +38 -0
  261. package/.framework/tests/unit/bootstrap.test.ts +242 -0
  262. package/.framework/tests/unit/cli-context-api-key.test.ts +114 -0
  263. package/.framework/tests/unit/debug-auth.test.ts +38 -0
  264. package/.framework/tests/unit/deliveries-account-scoping.test.ts +185 -0
  265. package/.framework/tests/unit/episode-lease.test.ts +695 -0
  266. package/.framework/tests/unit/integration-outbound-credentials.test.ts +167 -0
  267. package/.framework/tests/unit/integrations-audit-redaction.test.ts +130 -0
  268. package/.framework/tests/unit/kb-ingest-lease.test.ts +19 -0
  269. package/.framework/tests/unit/logging-app-id.test.ts +75 -0
  270. package/.framework/tests/unit/pipeline-runner-background.test.ts +120 -0
  271. package/.framework/tests/unit/pipeline-runner.test.ts +153 -1
  272. package/.framework/tests/unit/principal-cache.test.ts +15 -0
  273. package/.framework/tests/unit/system-context-denial.test.ts +145 -0
  274. package/.framework/tests/unit/system-cron.test.ts +240 -0
  275. package/.framework/tests/unit/timers.test.ts +159 -0
  276. package/.framework/tests/unit/trigger-engine.test.ts +278 -91
  277. package/.framework/tests/unit/trigger-scheduler.test.ts +78 -0
  278. package/README.md +125 -166
  279. package/config/tsconfig.cli.json +2 -2
  280. package/netlify.toml +5 -0
  281. package/package.json +15 -4
  282. package/templates/project/package-lock.json +2 -2
  283. package/.framework/docs/admin-routes.md +0 -76
  284. package/.framework/docs/api-docs-progress.md +0 -38
  285. package/.framework/docs/api-governance.md +0 -146
  286. package/.framework/docs/api-testing-results.md +0 -212
  287. package/.framework/docs/assembly-launch-guide.md +0 -138
  288. package/.framework/docs/audit-results.md +0 -590
  289. package/.framework/docs/db-api-inventory.md +0 -95
  290. package/.framework/docs/gap-remediation-backlog.md +0 -103
  291. package/.framework/docs/ui-adoption-verification.md +0 -111
  292. package/.framework/docs/ui-api-coverage.md +0 -84
  293. package/.framework/docs/v2-compatibility-audit.md +0 -228
  294. package/.framework/mcp/index.ts +0 -133
  295. package/.framework/mcp/load-env.ts +0 -60
  296. package/.framework/mcp/shared/app-manifest.ts +0 -275
  297. package/.framework/mcp/shared/db.ts +0 -477
  298. package/.framework/mcp/shared/kb.ts +0 -118
  299. package/.framework/mcp/tools/architect.ts +0 -431
  300. package/.framework/mcp/tools/cil/context.ts +0 -345
  301. package/.framework/mcp/tools/cil/graph.ts +0 -242
  302. package/.framework/mcp/tools/cil/ingest.ts +0 -1217
  303. package/.framework/mcp/tools/cil/pipeline-orchestrator.ts +0 -693
  304. package/.framework/mcp/tools/cil/pipeline.ts +0 -767
  305. package/.framework/mcp/tools/cil/project.ts +0 -791
  306. package/.framework/mcp/tools/cil/retrieval.ts +0 -336
  307. package/.framework/mcp/tools/cil/search-core.ts +0 -454
  308. package/.framework/mcp/tools/cil/search.ts +0 -97
  309. package/.framework/mcp/tools/cil/suggest.ts +0 -186
  310. package/.framework/mcp/tools/cil/validate.ts +0 -1369
  311. package/.framework/mcp/tools/kb/delete.ts +0 -139
  312. package/.framework/mcp/tools/kb/index.ts +0 -52
  313. package/.framework/mcp/tools/kb/ingest.ts +0 -84
  314. package/.framework/mcp/tools/kb/list-types.ts +0 -102
  315. package/.framework/mcp/tools/kb/publish.ts +0 -100
  316. package/.framework/mcp/tools/kb/reindex.ts +0 -86
  317. package/.framework/mcp/tools/kb/revoke.ts +0 -85
  318. package/.framework/mcp/tools/kb/search.ts +0 -101
  319. package/.framework/mcp/tools/kb/upsert.ts +0 -125
  320. 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
- // CIL[DOC-MACRO purpose="Defines the PromptConfigDetailPage React page file, imports dependencies, and declares the PromptConfig interface"]
3
- // CIL[DOC-RESPONSIBILITY responsibility="Top-of-file module documentation and dependency imports for the prompt config admin detail page"]
4
- // CIL[DOC-CONTEXT module="prompt-config-admin" layer="page" related_files=".framework/src/components/admin/PageInstructions.tsx,.framework/src/components/ui/alert.tsx,.framework/src/components/ui/button.tsx,.framework/src/components/ui/card.tsx,.framework/src/components/ui/checkbox.tsx,.framework/src/components/ui/input.tsx,.framework/src/components/ui/label.tsx,.framework/src/components/ui/skeleton.tsx,.framework/src/components/ui/textarea.tsx,.framework/src/hooks/useApi.ts,.framework/src/lib/api.ts,.framework/src/lib/utils.ts"]
5
- // CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
6
- // CIL[DOC-MICRO logic_summary="Imports React hooks, router hooks, UI components, API hooks, and utility modules; exports no runtime logic"]
7
- // CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
8
- // CIL[DOC-STABILITY stability="stable"]
9
- // CIL[DOC-AUDIENCE audience="developers"]
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
- // CIL[DOC-MACRO purpose="Type definition for prompt configuration records used by the detail page and API"]
42
- // CIL[DOC-RESPONSIBILITY responsibility="Declare the shape of prompt configuration data"]
43
- // CIL[DOC-CONTEXT module="prompt-config-admin" layer="domain" related_files=".framework/src/components/admin/PageInstructions.tsx,.framework/src/components/ui/alert.tsx,.framework/src/components/ui/button.tsx,.framework/src/components/ui/card.tsx,.framework/src/components/ui/checkbox.tsx,.framework/src/components/ui/input.tsx,.framework/src/components/ui/label.tsx,.framework/src/components/ui/skeleton.tsx,.framework/src/components/ui/textarea.tsx,.framework/src/hooks/useApi.ts,.framework/src/lib/api.ts,.framework/src/lib/utils.ts,.framework/src/pages/admin/PromptConfigDetailPage.tsx"]
44
- // CIL[DOC-CONTRACT inputs="none" outputs="PromptConfig type interface" errors="none" side_effects="none"]
45
- // CIL[DOC-MICRO logic_summary="Describes fields for prompt configuration including metadata, model settings, escalation, and runtime options"]
46
- // CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
47
- // CIL[DOC-STABILITY stability="stable"]
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
- // CIL[DOC-MACRO purpose="Admin page for creating and editing prompt configurations"]
87
- // CIL[DOC-RESPONSIBILITY responsibility="Render a form for prompt config fields, load existing config, validate JSON, and submit to API"]
88
- // CIL[DOC-CONTEXT module="prompt-config-admin" layer="page" related_files=".framework/src/components/admin/PageInstructions.tsx,.framework/src/components/ui/alert.tsx,.framework/src/components/ui/button.tsx,.framework/src/components/ui/card.tsx,.framework/src/components/ui/checkbox.tsx,.framework/src/components/ui/input.tsx,.framework/src/components/ui/label.tsx,.framework/src/components/ui/skeleton.tsx,.framework/src/components/ui/textarea.tsx,.framework/src/hooks/useApi.ts,.framework/src/lib/api.ts,.framework/src/lib/utils.ts,.framework/src/pages/admin/PromptConfigDetailPage.tsx"]
89
- // CIL[DOC-CONTRACT inputs="URL id param (optional), apiFetch, useApi hook" outputs="Rendered form UI, API save requests" errors="API fetch/save failures, invalid JSON input" side_effects="Updates form state, calls navigate, shows alert"]
90
- // CIL[DOC-MICRO logic_summary="Loads prompt config by id, initialises form state, validates JSON arrays/objects, submits create or patch request, and renders card-based form sections"]
91
- // CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
92
- // CIL[DOC-STABILITY stability="stable"]
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
- alert(err.message)
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 ID</Label>
338
- <Input
327
+ <Label>App</Label>
328
+ <AppSelect
339
329
  value={formData.app_id}
340
- onChange={(e) => setFormData({ ...formData, app_id: e.target.value })}
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
- // CIL[DOC-MACRO purpose="Admin prompt config list page module header"]
3
- // CIL[DOC-RESPONSIBILITY responsibility="Imports React dependencies and admin UI components for prompt configuration management"]
4
- // 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"]
5
- // CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
6
- // CIL[DOC-MICRO logic_summary="Imports React, UI icons, components, hooks, and utilities for the prompt configs page" notable_decisions="[]"]
7
- // CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
8
- // CIL[DOC-STABILITY stability="stable"]
9
- // CIL[DOC-AUDIENCE audience="ai-rag"]
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
- is_default?: boolean
53
- prompt_type?: string
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.prompt_type === selectedType
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.prompt_type).filter(Boolean)))
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
- window.location.href = `/spine-framework/admin/configs/prompts/${config.id}`
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: 'Default',
153
- value: (promptConfigs || []).filter(c => c.is_default).length,
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: 'Type',
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="Type"
235
- sortKey="prompt_type"
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="is_default"
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.prompt_type || 'General'}</span>
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.is_default && (
304
- <span className="inline-flex px-1.5 py-0.5 text-xs font-medium rounded bg-yellow-100 text-yellow-700">Default</span>
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[DOC-VECTOR type="context" content="purpose='Renders the admin prompt configurations list page'; No verified external callers; imports: .framework/src/components/ui/LoadingSpinner.tsx,.framework/src/components/ui/button.tsx,.framework/src/components/admin/AdminListPage.tsx"]
326
- // CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
327
- // CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
328
- // CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
329
- // CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
330
- // CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
331
- // CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfigsPage:component"]
367
+ // CIL[END stable_id="~/.framework/src/pages/admin/PromptConfigsPage.tsx:PromptConfigsPage:component"]
368
+
369
+
370
+
371
+
372
+
373
+