@contractspec/example.agent-console 1.57.0 → 1.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +210 -278
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +31 -0
- package/dist/agent/agent.entity.d.ts +35 -40
- package/dist/agent/agent.entity.d.ts.map +1 -1
- package/dist/agent/agent.entity.js +124 -132
- package/dist/agent/agent.enum.d.ts +3 -8
- package/dist/agent/agent.enum.d.ts.map +1 -1
- package/dist/agent/agent.enum.js +22 -30
- package/dist/agent/agent.event.d.ts +105 -111
- package/dist/agent/agent.event.d.ts.map +1 -1
- package/dist/agent/agent.event.js +107 -200
- package/dist/agent/agent.handler.d.ts +74 -77
- package/dist/agent/agent.handler.d.ts.map +1 -1
- package/dist/agent/agent.handler.js +293 -75
- package/dist/agent/agent.operation.d.ts +424 -430
- package/dist/agent/agent.operation.d.ts.map +1 -1
- package/dist/agent/agent.operation.js +728 -478
- package/dist/agent/agent.presentation.d.ts +3 -8
- package/dist/agent/agent.presentation.d.ts.map +1 -1
- package/dist/agent/agent.presentation.js +275 -84
- package/dist/agent/agent.schema.d.ts +371 -376
- package/dist/agent/agent.schema.d.ts.map +1 -1
- package/dist/agent/agent.schema.js +209 -399
- package/dist/agent/agent.test-spec.d.ts +2 -7
- package/dist/agent/agent.test-spec.d.ts.map +1 -1
- package/dist/agent/agent.test-spec.js +56 -62
- package/dist/agent/index.d.ts +11 -8
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +1245 -9
- package/dist/agent.capability.d.ts +1 -6
- package/dist/agent.capability.d.ts.map +1 -1
- package/dist/agent.capability.js +17 -20
- package/dist/agent.feature.d.ts +7 -6
- package/dist/agent.feature.d.ts.map +1 -1
- package/dist/agent.feature.js +117 -303
- package/dist/browser/agent/agent.entity.js +127 -0
- package/dist/browser/agent/agent.enum.js +25 -0
- package/dist/browser/agent/agent.event.js +116 -0
- package/dist/browser/agent/agent.handler.js +301 -0
- package/dist/browser/agent/agent.operation.js +735 -0
- package/dist/browser/agent/agent.presentation.js +279 -0
- package/dist/browser/agent/agent.schema.js +215 -0
- package/dist/browser/agent/agent.test-spec.js +58 -0
- package/dist/browser/agent/index.js +1244 -0
- package/dist/browser/agent.capability.js +16 -0
- package/dist/browser/agent.feature.js +118 -0
- package/dist/browser/docs/agent-console.docblock.js +93 -0
- package/dist/browser/docs/index.js +93 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/agent.handlers.js +252 -0
- package/dist/browser/handlers/index.js +799 -0
- package/dist/browser/index.js +5895 -0
- package/dist/browser/presentations/index.js +684 -0
- package/dist/browser/run/index.js +1350 -0
- package/dist/browser/run/run.entity.js +160 -0
- package/dist/browser/run/run.enum.js +34 -0
- package/dist/browser/run/run.event.js +213 -0
- package/dist/browser/run/run.handler.js +254 -0
- package/dist/browser/run/run.operation.js +667 -0
- package/dist/browser/run/run.presentation.js +220 -0
- package/dist/browser/run/run.schema.js +179 -0
- package/dist/browser/run/run.test-spec.js +58 -0
- package/dist/browser/seeders/index.js +21 -0
- package/dist/browser/shared/index.js +334 -0
- package/dist/browser/shared/mock-agents.js +82 -0
- package/dist/browser/shared/mock-runs.js +108 -0
- package/dist/browser/shared/mock-tools.js +146 -0
- package/dist/browser/shared/overlay-types.js +0 -0
- package/dist/browser/tool/index.js +946 -0
- package/dist/browser/tool/tool.entity.js +90 -0
- package/dist/browser/tool/tool.enum.js +26 -0
- package/dist/browser/tool/tool.event.js +99 -0
- package/dist/browser/tool/tool.handler.js +223 -0
- package/dist/browser/tool/tool.operation.js +482 -0
- package/dist/browser/tool/tool.presentation.js +185 -0
- package/dist/browser/tool/tool.schema.js +141 -0
- package/dist/browser/tool/tool.test-spec.js +58 -0
- package/dist/browser/ui/AgentDashboard.js +1607 -0
- package/dist/browser/ui/AgentRunList.js +250 -0
- package/dist/browser/ui/AgentToolRegistry.js +212 -0
- package/dist/browser/ui/hooks/index.js +271 -0
- package/dist/browser/ui/hooks/useAgentList.js +55 -0
- package/dist/browser/ui/hooks/useAgentMutations.js +76 -0
- package/dist/browser/ui/hooks/useRunList.js +55 -0
- package/dist/browser/ui/hooks/useToolList.js +85 -0
- package/dist/browser/ui/index.js +2080 -0
- package/dist/browser/ui/modals/AgentActionsModal.js +304 -0
- package/dist/browser/ui/modals/CreateAgentModal.js +229 -0
- package/dist/browser/ui/modals/index.js +532 -0
- package/dist/browser/ui/overlays/demo-overlays.js +64 -0
- package/dist/browser/ui/overlays/index.js +64 -0
- package/dist/browser/ui/renderers/agent-list.markdown.js +55 -0
- package/dist/browser/ui/renderers/agent-list.renderer.js +180 -0
- package/dist/browser/ui/renderers/dashboard.markdown.js +117 -0
- package/dist/browser/ui/renderers/index.js +446 -0
- package/dist/browser/ui/renderers/run-list.markdown.js +45 -0
- package/dist/browser/ui/renderers/tool-registry.markdown.js +53 -0
- package/dist/browser/ui/views/AgentListView.js +165 -0
- package/dist/browser/ui/views/RunListView.js +247 -0
- package/dist/browser/ui/views/ToolRegistryView.js +209 -0
- package/dist/browser/ui/views/index.js +619 -0
- package/dist/docs/agent-console.docblock.d.ts +2 -1
- package/dist/docs/agent-console.docblock.d.ts.map +1 -0
- package/dist/docs/agent-console.docblock.js +45 -64
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +94 -1
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +41 -55
- package/dist/handlers/agent.handlers.d.ts +121 -120
- package/dist/handlers/agent.handlers.d.ts.map +1 -1
- package/dist/handlers/agent.handlers.js +235 -245
- package/dist/handlers/index.d.ts +8 -5
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +799 -5
- package/dist/index.d.ts +26 -48
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5896 -50
- package/dist/node/agent/agent.entity.js +127 -0
- package/dist/node/agent/agent.enum.js +25 -0
- package/dist/node/agent/agent.event.js +116 -0
- package/dist/node/agent/agent.handler.js +301 -0
- package/dist/node/agent/agent.operation.js +735 -0
- package/dist/node/agent/agent.presentation.js +279 -0
- package/dist/node/agent/agent.schema.js +215 -0
- package/dist/node/agent/agent.test-spec.js +58 -0
- package/dist/node/agent/index.js +1244 -0
- package/dist/node/agent.capability.js +16 -0
- package/dist/node/agent.feature.js +118 -0
- package/dist/node/docs/agent-console.docblock.js +93 -0
- package/dist/node/docs/index.js +93 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/agent.handlers.js +252 -0
- package/dist/node/handlers/index.js +799 -0
- package/dist/node/index.js +5895 -0
- package/dist/node/presentations/index.js +684 -0
- package/dist/node/run/index.js +1350 -0
- package/dist/node/run/run.entity.js +160 -0
- package/dist/node/run/run.enum.js +34 -0
- package/dist/node/run/run.event.js +213 -0
- package/dist/node/run/run.handler.js +254 -0
- package/dist/node/run/run.operation.js +667 -0
- package/dist/node/run/run.presentation.js +220 -0
- package/dist/node/run/run.schema.js +179 -0
- package/dist/node/run/run.test-spec.js +58 -0
- package/dist/node/seeders/index.js +21 -0
- package/dist/node/shared/index.js +334 -0
- package/dist/node/shared/mock-agents.js +82 -0
- package/dist/node/shared/mock-runs.js +108 -0
- package/dist/node/shared/mock-tools.js +146 -0
- package/dist/node/shared/overlay-types.js +0 -0
- package/dist/node/tool/index.js +946 -0
- package/dist/node/tool/tool.entity.js +90 -0
- package/dist/node/tool/tool.enum.js +26 -0
- package/dist/node/tool/tool.event.js +99 -0
- package/dist/node/tool/tool.handler.js +223 -0
- package/dist/node/tool/tool.operation.js +482 -0
- package/dist/node/tool/tool.presentation.js +185 -0
- package/dist/node/tool/tool.schema.js +141 -0
- package/dist/node/tool/tool.test-spec.js +58 -0
- package/dist/node/ui/AgentDashboard.js +1607 -0
- package/dist/node/ui/AgentRunList.js +250 -0
- package/dist/node/ui/AgentToolRegistry.js +212 -0
- package/dist/node/ui/hooks/index.js +271 -0
- package/dist/node/ui/hooks/useAgentList.js +55 -0
- package/dist/node/ui/hooks/useAgentMutations.js +76 -0
- package/dist/node/ui/hooks/useRunList.js +55 -0
- package/dist/node/ui/hooks/useToolList.js +85 -0
- package/dist/node/ui/index.js +2080 -0
- package/dist/node/ui/modals/AgentActionsModal.js +304 -0
- package/dist/node/ui/modals/CreateAgentModal.js +229 -0
- package/dist/node/ui/modals/index.js +532 -0
- package/dist/node/ui/overlays/demo-overlays.js +64 -0
- package/dist/node/ui/overlays/index.js +64 -0
- package/dist/node/ui/renderers/agent-list.markdown.js +55 -0
- package/dist/node/ui/renderers/agent-list.renderer.js +180 -0
- package/dist/node/ui/renderers/dashboard.markdown.js +117 -0
- package/dist/node/ui/renderers/index.js +446 -0
- package/dist/node/ui/renderers/run-list.markdown.js +45 -0
- package/dist/node/ui/renderers/tool-registry.markdown.js +53 -0
- package/dist/node/ui/views/AgentListView.js +165 -0
- package/dist/node/ui/views/RunListView.js +247 -0
- package/dist/node/ui/views/ToolRegistryView.js +209 -0
- package/dist/node/ui/views/index.js +619 -0
- package/dist/presentations/index.d.ts +9 -4
- package/dist/presentations/index.d.ts.map +1 -0
- package/dist/presentations/index.js +684 -4
- package/dist/run/index.d.ts +11 -8
- package/dist/run/index.d.ts.map +1 -0
- package/dist/run/index.js +1351 -9
- package/dist/run/run.entity.d.ts +55 -60
- package/dist/run/run.entity.d.ts.map +1 -1
- package/dist/run/run.entity.js +155 -199
- package/dist/run/run.enum.d.ts +4 -9
- package/dist/run/run.enum.d.ts.map +1 -1
- package/dist/run/run.enum.js +30 -40
- package/dist/run/run.event.d.ts +255 -261
- package/dist/run/run.event.d.ts.map +1 -1
- package/dist/run/run.event.js +198 -418
- package/dist/run/run.handler.d.ts +169 -172
- package/dist/run/run.handler.d.ts.map +1 -1
- package/dist/run/run.handler.js +246 -74
- package/dist/run/run.operation.d.ts +658 -664
- package/dist/run/run.operation.d.ts.map +1 -1
- package/dist/run/run.operation.js +659 -617
- package/dist/run/run.presentation.d.ts +2 -7
- package/dist/run/run.presentation.d.ts.map +1 -1
- package/dist/run/run.presentation.js +217 -61
- package/dist/run/run.schema.d.ts +367 -372
- package/dist/run/run.schema.d.ts.map +1 -1
- package/dist/run/run.schema.js +172 -330
- package/dist/run/run.test-spec.d.ts +2 -7
- package/dist/run/run.test-spec.d.ts.map +1 -1
- package/dist/run/run.test-spec.js +56 -62
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +19 -17
- package/dist/shared/index.d.ts +7 -4
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +334 -4
- package/dist/shared/mock-agents.d.ts +77 -80
- package/dist/shared/mock-agents.d.ts.map +1 -1
- package/dist/shared/mock-agents.js +82 -93
- package/dist/shared/mock-runs.d.ts +107 -110
- package/dist/shared/mock-runs.d.ts.map +1 -1
- package/dist/shared/mock-runs.js +108 -117
- package/dist/shared/mock-tools.d.ts +217 -220
- package/dist/shared/mock-tools.d.ts.map +1 -1
- package/dist/shared/mock-tools.js +146 -180
- package/dist/shared/overlay-types.d.ts +25 -28
- package/dist/shared/overlay-types.d.ts.map +1 -1
- package/dist/shared/overlay-types.js +1 -0
- package/dist/tool/index.d.ts +11 -8
- package/dist/tool/index.d.ts.map +1 -0
- package/dist/tool/index.js +947 -9
- package/dist/tool/tool.entity.d.ts +23 -28
- package/dist/tool/tool.entity.d.ts.map +1 -1
- package/dist/tool/tool.entity.js +87 -101
- package/dist/tool/tool.enum.d.ts +3 -8
- package/dist/tool/tool.enum.d.ts.map +1 -1
- package/dist/tool/tool.enum.js +23 -31
- package/dist/tool/tool.event.d.ts +84 -90
- package/dist/tool/tool.event.d.ts.map +1 -1
- package/dist/tool/tool.event.js +92 -151
- package/dist/tool/tool.handler.d.ts +266 -269
- package/dist/tool/tool.handler.d.ts.map +1 -1
- package/dist/tool/tool.handler.js +213 -76
- package/dist/tool/tool.operation.d.ts +359 -365
- package/dist/tool/tool.operation.d.ts.map +1 -1
- package/dist/tool/tool.operation.js +477 -400
- package/dist/tool/tool.presentation.d.ts +2 -7
- package/dist/tool/tool.presentation.d.ts.map +1 -1
- package/dist/tool/tool.presentation.js +182 -61
- package/dist/tool/tool.schema.d.ts +196 -201
- package/dist/tool/tool.schema.d.ts.map +1 -1
- package/dist/tool/tool.schema.js +137 -231
- package/dist/tool/tool.test-spec.d.ts +2 -7
- package/dist/tool/tool.test-spec.d.ts.map +1 -1
- package/dist/tool/tool.test-spec.js +56 -62
- package/dist/ui/AgentDashboard.d.ts +1 -6
- package/dist/ui/AgentDashboard.d.ts.map +1 -1
- package/dist/ui/AgentDashboard.js +1598 -410
- package/dist/ui/AgentRunList.d.ts +7 -2
- package/dist/ui/AgentRunList.d.ts.map +1 -0
- package/dist/ui/AgentRunList.js +249 -3
- package/dist/ui/AgentToolRegistry.d.ts +7 -2
- package/dist/ui/AgentToolRegistry.d.ts.map +1 -0
- package/dist/ui/AgentToolRegistry.js +211 -3
- package/dist/ui/hooks/index.d.ts +8 -6
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +270 -6
- package/dist/ui/hooks/useAgentList.d.ts +21 -25
- package/dist/ui/hooks/useAgentList.d.ts.map +1 -1
- package/dist/ui/hooks/useAgentList.js +52 -62
- package/dist/ui/hooks/useAgentMutations.d.ts +22 -25
- package/dist/ui/hooks/useAgentMutations.d.ts.map +1 -1
- package/dist/ui/hooks/useAgentMutations.js +73 -120
- package/dist/ui/hooks/useRunList.d.ts +17 -21
- package/dist/ui/hooks/useRunList.d.ts.map +1 -1
- package/dist/ui/hooks/useRunList.js +52 -62
- package/dist/ui/hooks/useToolList.d.ts +32 -36
- package/dist/ui/hooks/useToolList.d.ts.map +1 -1
- package/dist/ui/hooks/useToolList.js +82 -92
- package/dist/ui/index.d.ts +9 -24
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +2081 -24
- package/dist/ui/modals/AgentActionsModal.d.ts +11 -24
- package/dist/ui/modals/AgentActionsModal.d.ts.map +1 -1
- package/dist/ui/modals/AgentActionsModal.js +300 -257
- package/dist/ui/modals/CreateAgentModal.d.ts +12 -21
- package/dist/ui/modals/CreateAgentModal.d.ts.map +1 -1
- package/dist/ui/modals/CreateAgentModal.js +226 -210
- package/dist/ui/modals/index.d.ts +3 -3
- package/dist/ui/modals/index.d.ts.map +1 -0
- package/dist/ui/modals/index.js +532 -3
- package/dist/ui/overlays/demo-overlays.d.ts +10 -8
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -1
- package/dist/ui/overlays/demo-overlays.js +63 -71
- package/dist/ui/overlays/index.d.ts +2 -2
- package/dist/ui/overlays/index.d.ts.map +1 -0
- package/dist/ui/overlays/index.js +65 -3
- package/dist/ui/renderers/agent-list.markdown.d.ts +9 -8
- package/dist/ui/renderers/agent-list.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/agent-list.markdown.js +55 -50
- package/dist/ui/renderers/agent-list.renderer.d.ts +5 -6
- package/dist/ui/renderers/agent-list.renderer.d.ts.map +1 -1
- package/dist/ui/renderers/agent-list.renderer.js +179 -17
- package/dist/ui/renderers/dashboard.markdown.d.ts +9 -8
- package/dist/ui/renderers/dashboard.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/dashboard.markdown.js +115 -97
- package/dist/ui/renderers/index.d.ts +9 -6
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +446 -6
- package/dist/ui/renderers/run-list.markdown.d.ts +9 -8
- package/dist/ui/renderers/run-list.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/run-list.markdown.js +42 -40
- package/dist/ui/renderers/tool-registry.markdown.d.ts +9 -8
- package/dist/ui/renderers/tool-registry.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/tool-registry.markdown.js +52 -53
- package/dist/ui/views/AgentListView.d.ts +1 -6
- package/dist/ui/views/AgentListView.d.ts.map +1 -1
- package/dist/ui/views/AgentListView.js +161 -88
- package/dist/ui/views/RunListView.d.ts +4 -11
- package/dist/ui/views/RunListView.d.ts.map +1 -1
- package/dist/ui/views/RunListView.js +237 -154
- package/dist/ui/views/ToolRegistryView.d.ts +4 -11
- package/dist/ui/views/ToolRegistryView.d.ts.map +1 -1
- package/dist/ui/views/ToolRegistryView.js +205 -92
- package/dist/ui/views/index.d.ts +7 -4
- package/dist/ui/views/index.d.ts.map +1 -0
- package/dist/ui/views/index.js +619 -4
- package/package.json +656 -118
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -285
- package/dist/agent/agent.entity.js.map +0 -1
- package/dist/agent/agent.enum.js.map +0 -1
- package/dist/agent/agent.event.js.map +0 -1
- package/dist/agent/agent.handler.js.map +0 -1
- package/dist/agent/agent.operation.js.map +0 -1
- package/dist/agent/agent.presentation.js.map +0 -1
- package/dist/agent/agent.schema.js.map +0 -1
- package/dist/agent/agent.test-spec.js.map +0 -1
- package/dist/agent.capability.js.map +0 -1
- package/dist/agent.feature.js.map +0 -1
- package/dist/docs/agent-console.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/agent.handlers.js.map +0 -1
- package/dist/run/run.entity.js.map +0 -1
- package/dist/run/run.enum.js.map +0 -1
- package/dist/run/run.event.js.map +0 -1
- package/dist/run/run.handler.js.map +0 -1
- package/dist/run/run.operation.js.map +0 -1
- package/dist/run/run.presentation.js.map +0 -1
- package/dist/run/run.schema.js.map +0 -1
- package/dist/run/run.test-spec.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/shared/mock-agents.js.map +0 -1
- package/dist/shared/mock-runs.js.map +0 -1
- package/dist/shared/mock-tools.js.map +0 -1
- package/dist/tool/tool.entity.js.map +0 -1
- package/dist/tool/tool.enum.js.map +0 -1
- package/dist/tool/tool.event.js.map +0 -1
- package/dist/tool/tool.handler.js.map +0 -1
- package/dist/tool/tool.operation.js.map +0 -1
- package/dist/tool/tool.presentation.js.map +0 -1
- package/dist/tool/tool.schema.js.map +0 -1
- package/dist/tool/tool.test-spec.js.map +0 -1
- package/dist/ui/AgentDashboard.js.map +0 -1
- package/dist/ui/hooks/useAgentList.js.map +0 -1
- package/dist/ui/hooks/useAgentMutations.js.map +0 -1
- package/dist/ui/hooks/useRunList.js.map +0 -1
- package/dist/ui/hooks/useToolList.js.map +0 -1
- package/dist/ui/modals/AgentActionsModal.js.map +0 -1
- package/dist/ui/modals/CreateAgentModal.js.map +0 -1
- package/dist/ui/overlays/demo-overlays.js.map +0 -1
- package/dist/ui/renderers/agent-list.markdown.js.map +0 -1
- package/dist/ui/renderers/agent-list.renderer.js.map +0 -1
- package/dist/ui/renderers/dashboard.markdown.js.map +0 -1
- package/dist/ui/renderers/run-list.markdown.js.map +0 -1
- package/dist/ui/renderers/tool-registry.markdown.js.map +0 -1
- package/dist/ui/views/AgentListView.js.map +0 -1
- package/dist/ui/views/RunListView.js.map +0 -1
- package/dist/ui/views/ToolRegistryView.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,263 +1,253 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/handlers/agent.handlers.ts
|
|
1
3
|
import { web } from "@contractspec/lib.runtime-sandbox";
|
|
2
|
-
|
|
3
|
-
//#region src/handlers/agent.handlers.ts
|
|
4
|
-
const { generateId } = web;
|
|
4
|
+
var { generateId } = web;
|
|
5
5
|
function rowToAgent(row) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
return {
|
|
7
|
+
id: row.id,
|
|
8
|
+
projectId: row.projectId,
|
|
9
|
+
organizationId: row.organizationId,
|
|
10
|
+
name: row.name,
|
|
11
|
+
description: row.description ?? undefined,
|
|
12
|
+
modelProvider: row.modelProvider,
|
|
13
|
+
modelName: row.modelName,
|
|
14
|
+
systemPrompt: row.systemPrompt ?? undefined,
|
|
15
|
+
temperature: row.temperature,
|
|
16
|
+
maxTokens: row.maxTokens,
|
|
17
|
+
status: row.status,
|
|
18
|
+
createdAt: new Date(row.createdAt),
|
|
19
|
+
updatedAt: new Date(row.updatedAt)
|
|
20
|
+
};
|
|
21
21
|
}
|
|
22
22
|
function rowToTool(row) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
return {
|
|
24
|
+
id: row.id,
|
|
25
|
+
projectId: row.projectId,
|
|
26
|
+
organizationId: row.organizationId,
|
|
27
|
+
name: row.name,
|
|
28
|
+
description: row.description ?? undefined,
|
|
29
|
+
version: row.version,
|
|
30
|
+
category: row.category,
|
|
31
|
+
status: row.status,
|
|
32
|
+
inputSchema: row.inputSchema ?? undefined,
|
|
33
|
+
outputSchema: row.outputSchema ?? undefined,
|
|
34
|
+
endpoint: row.endpoint ?? undefined,
|
|
35
|
+
createdAt: new Date(row.createdAt),
|
|
36
|
+
updatedAt: new Date(row.updatedAt)
|
|
37
|
+
};
|
|
38
38
|
}
|
|
39
39
|
function rowToRun(row, agentName) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
return {
|
|
41
|
+
id: row.id,
|
|
42
|
+
projectId: row.projectId,
|
|
43
|
+
agentId: row.agentId,
|
|
44
|
+
agentName,
|
|
45
|
+
status: row.status,
|
|
46
|
+
input: row.input ?? undefined,
|
|
47
|
+
output: row.output ?? undefined,
|
|
48
|
+
totalTokens: row.totalTokens,
|
|
49
|
+
promptTokens: row.promptTokens,
|
|
50
|
+
completionTokens: row.completionTokens,
|
|
51
|
+
estimatedCostUsd: row.estimatedCostUsd,
|
|
52
|
+
durationMs: row.durationMs ?? undefined,
|
|
53
|
+
errorMessage: row.errorMessage ?? undefined,
|
|
54
|
+
queuedAt: new Date(row.queuedAt),
|
|
55
|
+
startedAt: row.startedAt ? new Date(row.startedAt) : undefined,
|
|
56
|
+
completedAt: row.completedAt ? new Date(row.completedAt) : undefined
|
|
57
|
+
};
|
|
58
58
|
}
|
|
59
59
|
function createAgentHandlers(db) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*/
|
|
101
|
-
async function createAgent(input, context) {
|
|
102
|
-
const id = generateId("agent");
|
|
103
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
104
|
-
await db.execute(`INSERT INTO agent_definition (id, projectId, organizationId, name, description, modelProvider, modelName, systemPrompt, temperature, maxTokens, status, createdAt, updatedAt)
|
|
60
|
+
async function listAgents(input) {
|
|
61
|
+
const {
|
|
62
|
+
projectId,
|
|
63
|
+
organizationId,
|
|
64
|
+
status,
|
|
65
|
+
search,
|
|
66
|
+
limit = 20,
|
|
67
|
+
offset = 0
|
|
68
|
+
} = input;
|
|
69
|
+
let whereClause = "WHERE projectId = ?";
|
|
70
|
+
const params = [projectId];
|
|
71
|
+
if (organizationId) {
|
|
72
|
+
whereClause += " AND organizationId = ?";
|
|
73
|
+
params.push(organizationId);
|
|
74
|
+
}
|
|
75
|
+
if (status && status !== "all") {
|
|
76
|
+
whereClause += " AND status = ?";
|
|
77
|
+
params.push(status);
|
|
78
|
+
}
|
|
79
|
+
if (search) {
|
|
80
|
+
whereClause += " AND (name LIKE ? OR description LIKE ?)";
|
|
81
|
+
params.push(`%${search}%`, `%${search}%`);
|
|
82
|
+
}
|
|
83
|
+
const countResult = (await db.query(`SELECT COUNT(*) as count FROM agent_definition ${whereClause}`, params)).rows;
|
|
84
|
+
const total = countResult[0]?.count ?? 0;
|
|
85
|
+
const rows = (await db.query(`SELECT * FROM agent_definition ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
|
|
86
|
+
return {
|
|
87
|
+
items: rows.map(rowToAgent),
|
|
88
|
+
total,
|
|
89
|
+
hasMore: offset + rows.length < total
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async function getAgent(id) {
|
|
93
|
+
const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])).rows;
|
|
94
|
+
return rows[0] ? rowToAgent(rows[0]) : null;
|
|
95
|
+
}
|
|
96
|
+
async function createAgent(input, context) {
|
|
97
|
+
const id = generateId("agent");
|
|
98
|
+
const now = new Date().toISOString();
|
|
99
|
+
await db.execute(`INSERT INTO agent_definition (id, projectId, organizationId, name, description, modelProvider, modelName, systemPrompt, temperature, maxTokens, status, createdAt, updatedAt)
|
|
105
100
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
101
|
+
id,
|
|
102
|
+
context.projectId,
|
|
103
|
+
context.organizationId,
|
|
104
|
+
input.name,
|
|
105
|
+
input.description ?? null,
|
|
106
|
+
input.modelProvider ?? "openai",
|
|
107
|
+
input.modelName ?? "gpt-4",
|
|
108
|
+
input.systemPrompt ?? null,
|
|
109
|
+
input.temperature ?? 0.7,
|
|
110
|
+
input.maxTokens ?? 4096,
|
|
111
|
+
"DRAFT",
|
|
112
|
+
now,
|
|
113
|
+
now
|
|
114
|
+
]);
|
|
115
|
+
const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])).rows;
|
|
116
|
+
const row = rows[0];
|
|
117
|
+
if (!row) {
|
|
118
|
+
throw new Error("Failed to retrieve created agent");
|
|
119
|
+
}
|
|
120
|
+
return rowToAgent(row);
|
|
121
|
+
}
|
|
122
|
+
async function updateAgent(input) {
|
|
123
|
+
const now = new Date().toISOString();
|
|
124
|
+
const updates = ["updatedAt = ?"];
|
|
125
|
+
const params = [now];
|
|
126
|
+
if (input.name !== undefined) {
|
|
127
|
+
updates.push("name = ?");
|
|
128
|
+
params.push(input.name);
|
|
129
|
+
}
|
|
130
|
+
if (input.description !== undefined) {
|
|
131
|
+
updates.push("description = ?");
|
|
132
|
+
params.push(input.description);
|
|
133
|
+
}
|
|
134
|
+
if (input.status !== undefined) {
|
|
135
|
+
updates.push("status = ?");
|
|
136
|
+
params.push(input.status);
|
|
137
|
+
}
|
|
138
|
+
params.push(input.id);
|
|
139
|
+
await db.execute(`UPDATE agent_definition SET ${updates.join(", ")} WHERE id = ?`, params);
|
|
140
|
+
const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [input.id])).rows;
|
|
141
|
+
if (!rows[0]) {
|
|
142
|
+
throw new Error("NOT_FOUND");
|
|
143
|
+
}
|
|
144
|
+
return rowToAgent(rows[0]);
|
|
145
|
+
}
|
|
146
|
+
async function listTools(input) {
|
|
147
|
+
const {
|
|
148
|
+
projectId,
|
|
149
|
+
organizationId,
|
|
150
|
+
category,
|
|
151
|
+
status,
|
|
152
|
+
search,
|
|
153
|
+
limit = 50,
|
|
154
|
+
offset = 0
|
|
155
|
+
} = input;
|
|
156
|
+
let whereClause = "WHERE projectId = ?";
|
|
157
|
+
const params = [projectId];
|
|
158
|
+
if (organizationId) {
|
|
159
|
+
whereClause += " AND organizationId = ?";
|
|
160
|
+
params.push(organizationId);
|
|
161
|
+
}
|
|
162
|
+
if (category && category !== "all") {
|
|
163
|
+
whereClause += " AND category = ?";
|
|
164
|
+
params.push(category);
|
|
165
|
+
}
|
|
166
|
+
if (status && status !== "all") {
|
|
167
|
+
whereClause += " AND status = ?";
|
|
168
|
+
params.push(status);
|
|
169
|
+
}
|
|
170
|
+
if (search) {
|
|
171
|
+
whereClause += " AND (name LIKE ? OR description LIKE ?)";
|
|
172
|
+
params.push(`%${search}%`, `%${search}%`);
|
|
173
|
+
}
|
|
174
|
+
const countResult = (await db.query(`SELECT COUNT(*) as count FROM agent_tool ${whereClause}`, params)).rows;
|
|
175
|
+
const total = countResult[0]?.count ?? 0;
|
|
176
|
+
const rows = (await db.query(`SELECT * FROM agent_tool ${whereClause} ORDER BY name ASC LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
|
|
177
|
+
return {
|
|
178
|
+
items: rows.map(rowToTool),
|
|
179
|
+
total,
|
|
180
|
+
hasMore: offset + rows.length < total
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
async function listRuns(input) {
|
|
184
|
+
const { projectId, agentId, status, limit = 20, offset = 0 } = input;
|
|
185
|
+
let whereClause = "WHERE r.projectId = ?";
|
|
186
|
+
const params = [projectId];
|
|
187
|
+
if (agentId) {
|
|
188
|
+
whereClause += " AND r.agentId = ?";
|
|
189
|
+
params.push(agentId);
|
|
190
|
+
}
|
|
191
|
+
if (status && status !== "all") {
|
|
192
|
+
whereClause += " AND r.status = ?";
|
|
193
|
+
params.push(status);
|
|
194
|
+
}
|
|
195
|
+
const countResult = (await db.query(`SELECT COUNT(*) as count FROM agent_run r ${whereClause}`, params)).rows;
|
|
196
|
+
const total = countResult[0]?.count ?? 0;
|
|
197
|
+
const rows = (await db.query(`SELECT r.*, a.name as agentName
|
|
201
198
|
FROM agent_run r
|
|
202
199
|
LEFT JOIN agent_definition a ON r.agentId = a.id
|
|
203
200
|
${whereClause}
|
|
204
|
-
ORDER BY r.queuedAt DESC LIMIT ? OFFSET ?`, [
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
params.push(input.startDate.toISOString());
|
|
228
|
-
}
|
|
229
|
-
if (input.endDate) {
|
|
230
|
-
whereClause += " AND queuedAt <= ?";
|
|
231
|
-
params.push(input.endDate.toISOString());
|
|
232
|
-
}
|
|
233
|
-
const data = (await db.query(`SELECT
|
|
201
|
+
ORDER BY r.queuedAt DESC LIMIT ? OFFSET ?`, [...params, limit, offset])).rows;
|
|
202
|
+
return {
|
|
203
|
+
items: rows.map((r) => rowToRun(r, r.agentName)),
|
|
204
|
+
total,
|
|
205
|
+
hasMore: offset + rows.length < total
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
async function getRunMetrics(input) {
|
|
209
|
+
let whereClause = "WHERE projectId = ?";
|
|
210
|
+
const params = [input.projectId];
|
|
211
|
+
if (input.agentId) {
|
|
212
|
+
whereClause += " AND agentId = ?";
|
|
213
|
+
params.push(input.agentId);
|
|
214
|
+
}
|
|
215
|
+
if (input.startDate) {
|
|
216
|
+
whereClause += " AND queuedAt >= ?";
|
|
217
|
+
params.push(input.startDate.toISOString());
|
|
218
|
+
}
|
|
219
|
+
if (input.endDate) {
|
|
220
|
+
whereClause += " AND queuedAt <= ?";
|
|
221
|
+
params.push(input.endDate.toISOString());
|
|
222
|
+
}
|
|
223
|
+
const result = (await db.query(`SELECT
|
|
234
224
|
COUNT(*) as totalRuns,
|
|
235
225
|
SUM(CASE WHEN status = 'COMPLETED' THEN 1 ELSE 0 END) as completedRuns,
|
|
236
226
|
AVG(CASE WHEN status = 'COMPLETED' THEN durationMs ELSE NULL END) as avgDuration,
|
|
237
227
|
COALESCE(SUM(totalTokens), 0) as totalTokens,
|
|
238
228
|
COALESCE(SUM(estimatedCostUsd), 0) as totalCost
|
|
239
|
-
FROM agent_run ${whereClause}`, params)).rows
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
229
|
+
FROM agent_run ${whereClause}`, params)).rows;
|
|
230
|
+
const data = result[0];
|
|
231
|
+
const totalRuns = data?.totalRuns ?? 0;
|
|
232
|
+
const completedRuns = data?.completedRuns ?? 0;
|
|
233
|
+
return {
|
|
234
|
+
totalRuns,
|
|
235
|
+
successRate: totalRuns > 0 ? completedRuns / totalRuns : 0,
|
|
236
|
+
averageDurationMs: data?.avgDuration ?? 0,
|
|
237
|
+
totalTokens: data?.totalTokens ?? 0,
|
|
238
|
+
totalCostUsd: data?.totalCost ?? 0
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
listAgents,
|
|
243
|
+
getAgent,
|
|
244
|
+
createAgent,
|
|
245
|
+
updateAgent,
|
|
246
|
+
listTools,
|
|
247
|
+
listRuns,
|
|
248
|
+
getRunMetrics
|
|
249
|
+
};
|
|
259
250
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
//# sourceMappingURL=agent.handlers.js.map
|
|
251
|
+
export {
|
|
252
|
+
createAgentHandlers
|
|
253
|
+
};
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
1
|
+
/**
|
|
2
|
+
* Agent Console Handlers - re-exports from domain modules for backward compatibility.
|
|
3
|
+
*/
|
|
4
|
+
export { mockCreateAgentHandler, mockGetAgentHandler, mockListAgentsHandler, type AgentSummary, } from '../agent/agent.handler';
|
|
5
|
+
export { mockExecuteAgentHandler, mockGetRunHandler, mockListRunsHandler, type RunSummary, } from '../run/run.handler';
|
|
6
|
+
export { mockCreateToolHandler, mockGetToolHandler, mockListToolsHandler, type ToolSummary, } from '../tool/tool.handler';
|
|
7
|
+
export * from './agent.handlers';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAG9B,cAAc,kBAAkB,CAAC"}
|