@contractspec/example.agent-console 1.56.1 → 1.58.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 +211 -277
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +36 -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 -7
- 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 +40 -55
- package/dist/handlers/agent.handlers.d.ts +121 -121
- 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 -9
- 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 -9
- 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 -7
- 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 -9
- 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 -9
- 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 -9
- 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 +657 -119
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -280
- 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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/ui/renderers/agent-list.markdown.ts
|
|
2
|
+
import {
|
|
3
|
+
mockListAgentsHandler
|
|
4
|
+
} from "@contractspec/example.agent-console/handlers";
|
|
5
|
+
var agentListMarkdownRenderer = {
|
|
6
|
+
target: "markdown",
|
|
7
|
+
render: async (desc) => {
|
|
8
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "AgentListView") {
|
|
9
|
+
throw new Error("agentListMarkdownRenderer: not AgentListView");
|
|
10
|
+
}
|
|
11
|
+
const data = await mockListAgentsHandler({
|
|
12
|
+
organizationId: "demo-org",
|
|
13
|
+
limit: 50,
|
|
14
|
+
offset: 0
|
|
15
|
+
});
|
|
16
|
+
const lines = [
|
|
17
|
+
`# ${desc.meta.description ?? "Agent List"}`,
|
|
18
|
+
"",
|
|
19
|
+
`> ${desc.meta.key} v${desc.meta.version}`,
|
|
20
|
+
"",
|
|
21
|
+
`**Total Agents:** ${data.total}`,
|
|
22
|
+
"",
|
|
23
|
+
"## Agents",
|
|
24
|
+
""
|
|
25
|
+
];
|
|
26
|
+
const byStatus = {};
|
|
27
|
+
for (const agent of data.items) {
|
|
28
|
+
const status = agent.status;
|
|
29
|
+
if (byStatus[status]) {
|
|
30
|
+
byStatus[status].push(agent);
|
|
31
|
+
} else {
|
|
32
|
+
byStatus[status] = [agent];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (const [status, agents] of Object.entries(byStatus)) {
|
|
36
|
+
lines.push(`### ${status} (${agents.length})`);
|
|
37
|
+
lines.push("");
|
|
38
|
+
for (const agent of agents) {
|
|
39
|
+
lines.push(`- **${agent.name}** (${agent.modelProvider}/${agent.modelName})`);
|
|
40
|
+
if (agent.description) {
|
|
41
|
+
lines.push(` > ${agent.description}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
lines.push("");
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
mimeType: "text/markdown",
|
|
48
|
+
body: lines.join(`
|
|
49
|
+
`)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
agentListMarkdownRenderer
|
|
55
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// src/ui/hooks/useAgentList.ts
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
function useAgentList(options = {}) {
|
|
5
|
+
const { handlers, projectId } = useTemplateRuntime();
|
|
6
|
+
const { agent } = handlers;
|
|
7
|
+
const [data, setData] = useState(null);
|
|
8
|
+
const [loading, setLoading] = useState(true);
|
|
9
|
+
const [error, setError] = useState(null);
|
|
10
|
+
const [page, setPage] = useState(1);
|
|
11
|
+
const fetchData = useCallback(async () => {
|
|
12
|
+
setLoading(true);
|
|
13
|
+
setError(null);
|
|
14
|
+
try {
|
|
15
|
+
const result = await agent.listAgents({
|
|
16
|
+
projectId,
|
|
17
|
+
search: options.search,
|
|
18
|
+
status: options.status === "all" ? undefined : options.status,
|
|
19
|
+
limit: options.limit ?? 20,
|
|
20
|
+
offset: (page - 1) * (options.limit ?? 20)
|
|
21
|
+
});
|
|
22
|
+
setData(result);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
setError(err instanceof Error ? err : new Error("Unknown error"));
|
|
25
|
+
} finally {
|
|
26
|
+
setLoading(false);
|
|
27
|
+
}
|
|
28
|
+
}, [agent, projectId, options.search, options.status, options.limit, page]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
fetchData();
|
|
31
|
+
}, [fetchData]);
|
|
32
|
+
const stats = useMemo(() => {
|
|
33
|
+
if (!data)
|
|
34
|
+
return null;
|
|
35
|
+
return {
|
|
36
|
+
total: data.total,
|
|
37
|
+
active: data.items.filter((a) => a.status === "ACTIVE").length,
|
|
38
|
+
paused: data.items.filter((a) => a.status === "PAUSED").length,
|
|
39
|
+
draft: data.items.filter((a) => a.status === "DRAFT").length
|
|
40
|
+
};
|
|
41
|
+
}, [data]);
|
|
42
|
+
return {
|
|
43
|
+
data,
|
|
44
|
+
loading,
|
|
45
|
+
error,
|
|
46
|
+
stats,
|
|
47
|
+
page,
|
|
48
|
+
refetch: fetchData,
|
|
49
|
+
nextPage: () => setPage((p) => p + 1),
|
|
50
|
+
prevPage: () => page > 1 && setPage((p) => p - 1)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/ui/views/AgentListView.tsx
|
|
55
|
+
import {
|
|
56
|
+
Button,
|
|
57
|
+
StatCard,
|
|
58
|
+
StatCardGroup,
|
|
59
|
+
EntityCard,
|
|
60
|
+
StatusChip,
|
|
61
|
+
LoaderBlock,
|
|
62
|
+
ErrorState,
|
|
63
|
+
EmptyState
|
|
64
|
+
} from "@contractspec/lib.design-system";
|
|
65
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
66
|
+
"use client";
|
|
67
|
+
function getStatusTone(status) {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case "ACTIVE":
|
|
70
|
+
return "success";
|
|
71
|
+
case "PAUSED":
|
|
72
|
+
case "DRAFT":
|
|
73
|
+
return "warning";
|
|
74
|
+
case "ARCHIVED":
|
|
75
|
+
return "neutral";
|
|
76
|
+
default:
|
|
77
|
+
return "neutral";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function AgentListView() {
|
|
81
|
+
const { data, loading, error, stats, refetch } = useAgentList();
|
|
82
|
+
if (loading && !data) {
|
|
83
|
+
return /* @__PURE__ */ jsxDEV(LoaderBlock, {
|
|
84
|
+
label: "Loading agents..."
|
|
85
|
+
}, undefined, false, undefined, this);
|
|
86
|
+
}
|
|
87
|
+
if (error) {
|
|
88
|
+
return /* @__PURE__ */ jsxDEV(ErrorState, {
|
|
89
|
+
title: "Failed to load agents",
|
|
90
|
+
description: error.message,
|
|
91
|
+
onRetry: refetch,
|
|
92
|
+
retryLabel: "Retry"
|
|
93
|
+
}, undefined, false, undefined, this);
|
|
94
|
+
}
|
|
95
|
+
if (!data?.items.length) {
|
|
96
|
+
return /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
97
|
+
title: "No agents yet",
|
|
98
|
+
description: "Create your first AI agent to get started."
|
|
99
|
+
}, undefined, false, undefined, this);
|
|
100
|
+
}
|
|
101
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
102
|
+
className: "space-y-6",
|
|
103
|
+
children: [
|
|
104
|
+
stats && /* @__PURE__ */ jsxDEV(StatCardGroup, {
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
107
|
+
label: "Total Agents",
|
|
108
|
+
value: stats.total
|
|
109
|
+
}, undefined, false, undefined, this),
|
|
110
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
111
|
+
label: "Active",
|
|
112
|
+
value: stats.active
|
|
113
|
+
}, undefined, false, undefined, this),
|
|
114
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
115
|
+
label: "Paused",
|
|
116
|
+
value: stats.paused
|
|
117
|
+
}, undefined, false, undefined, this),
|
|
118
|
+
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
119
|
+
label: "Draft",
|
|
120
|
+
value: stats.draft
|
|
121
|
+
}, undefined, false, undefined, this)
|
|
122
|
+
]
|
|
123
|
+
}, undefined, true, undefined, this),
|
|
124
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
125
|
+
className: "flex items-center justify-between",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsxDEV("h3", {
|
|
128
|
+
className: "text-lg font-semibold",
|
|
129
|
+
children: "Agents"
|
|
130
|
+
}, undefined, false, undefined, this),
|
|
131
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
132
|
+
onPress: () => alert("Create Agent clicked!"),
|
|
133
|
+
children: "Create Agent"
|
|
134
|
+
}, undefined, false, undefined, this)
|
|
135
|
+
]
|
|
136
|
+
}, undefined, true, undefined, this),
|
|
137
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
138
|
+
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
139
|
+
children: data.items.map((agent) => /* @__PURE__ */ jsxDEV(EntityCard, {
|
|
140
|
+
cardTitle: agent.name,
|
|
141
|
+
cardSubtitle: agent.modelName,
|
|
142
|
+
meta: /* @__PURE__ */ jsxDEV("p", {
|
|
143
|
+
className: "text-muted-foreground text-sm",
|
|
144
|
+
children: agent.description
|
|
145
|
+
}, undefined, false, undefined, this),
|
|
146
|
+
chips: /* @__PURE__ */ jsxDEV(StatusChip, {
|
|
147
|
+
tone: getStatusTone(agent.status),
|
|
148
|
+
label: agent.status
|
|
149
|
+
}, undefined, false, undefined, this),
|
|
150
|
+
footer: /* @__PURE__ */ jsxDEV("span", {
|
|
151
|
+
className: "text-muted-foreground text-xs",
|
|
152
|
+
children: [
|
|
153
|
+
"Created ",
|
|
154
|
+
agent.createdAt.toLocaleDateString()
|
|
155
|
+
]
|
|
156
|
+
}, undefined, true, undefined, this),
|
|
157
|
+
onClick: () => alert(`View agent: ${agent.name}`)
|
|
158
|
+
}, agent.id, false, undefined, this))
|
|
159
|
+
}, undefined, false, undefined, this)
|
|
160
|
+
]
|
|
161
|
+
}, undefined, true, undefined, this);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/ui/renderers/agent-list.renderer.tsx
|
|
165
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
166
|
+
var agentListReactRenderer = {
|
|
167
|
+
target: "react",
|
|
168
|
+
render: async (desc) => {
|
|
169
|
+
if (desc.source.type !== "component") {
|
|
170
|
+
throw new Error("AgentListRenderer: expected component source");
|
|
171
|
+
}
|
|
172
|
+
if (desc.source.componentKey !== "AgentListView") {
|
|
173
|
+
throw new Error(`AgentListRenderer: unknown component ${desc.source.componentKey}`);
|
|
174
|
+
}
|
|
175
|
+
return /* @__PURE__ */ jsxDEV2(AgentListView, {}, undefined, false, undefined, this);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
export {
|
|
179
|
+
agentListReactRenderer
|
|
180
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// src/ui/renderers/dashboard.markdown.ts
|
|
2
|
+
import {
|
|
3
|
+
mockListAgentsHandler,
|
|
4
|
+
mockListRunsHandler,
|
|
5
|
+
mockListToolsHandler
|
|
6
|
+
} from "@contractspec/example.agent-console/handlers";
|
|
7
|
+
function formatDuration(ms) {
|
|
8
|
+
if (ms < 1000)
|
|
9
|
+
return `${ms}ms`;
|
|
10
|
+
if (ms < 60000)
|
|
11
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
12
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
13
|
+
}
|
|
14
|
+
var agentDashboardMarkdownRenderer = {
|
|
15
|
+
target: "markdown",
|
|
16
|
+
render: async (desc) => {
|
|
17
|
+
if (desc.source.type !== "component" || desc.source.componentKey !== "AgentConsoleDashboard") {
|
|
18
|
+
throw new Error("agentDashboardMarkdownRenderer: not AgentConsoleDashboard");
|
|
19
|
+
}
|
|
20
|
+
const [agentsData, runsData, toolsData] = await Promise.all([
|
|
21
|
+
mockListAgentsHandler({
|
|
22
|
+
organizationId: "demo-org",
|
|
23
|
+
limit: 100
|
|
24
|
+
}),
|
|
25
|
+
mockListRunsHandler({
|
|
26
|
+
limit: 100
|
|
27
|
+
}),
|
|
28
|
+
mockListToolsHandler({
|
|
29
|
+
organizationId: "demo-org",
|
|
30
|
+
limit: 100
|
|
31
|
+
})
|
|
32
|
+
]);
|
|
33
|
+
const activeAgents = agentsData.items.filter((a) => a.status === "ACTIVE").length;
|
|
34
|
+
const completedRuns = runsData.items.filter((r) => r.status === "COMPLETED").length;
|
|
35
|
+
const failedRuns = runsData.items.filter((r) => r.status === "FAILED").length;
|
|
36
|
+
const totalTokens = runsData.items.reduce((sum, r) => sum + (r.totalTokens ?? 0), 0);
|
|
37
|
+
const totalCost = runsData.items.reduce((sum, r) => sum + (r.estimatedCostUsd ?? 0), 0);
|
|
38
|
+
const activeTools = toolsData.items.filter((t) => t.status === "ACTIVE").length;
|
|
39
|
+
const lines = [
|
|
40
|
+
"# Agent Console Dashboard",
|
|
41
|
+
"",
|
|
42
|
+
"> AI agent operations overview",
|
|
43
|
+
"",
|
|
44
|
+
"## Summary",
|
|
45
|
+
"",
|
|
46
|
+
"| Metric | Value |",
|
|
47
|
+
"|--------|-------|",
|
|
48
|
+
`| Total Agents | ${agentsData.total} |`,
|
|
49
|
+
`| Active Agents | ${activeAgents} |`,
|
|
50
|
+
`| Total Runs | ${runsData.total} |`,
|
|
51
|
+
`| Completed Runs | ${completedRuns} |`,
|
|
52
|
+
`| Failed Runs | ${failedRuns} |`,
|
|
53
|
+
`| Total Tokens | ${totalTokens.toLocaleString()} |`,
|
|
54
|
+
`| Total Cost | $${totalCost.toFixed(4)} |`,
|
|
55
|
+
`| Total Tools | ${toolsData.total} |`,
|
|
56
|
+
`| Active Tools | ${activeTools} |`,
|
|
57
|
+
"",
|
|
58
|
+
"## Agents",
|
|
59
|
+
""
|
|
60
|
+
];
|
|
61
|
+
if (agentsData.items.length === 0) {
|
|
62
|
+
lines.push("_No agents configured._");
|
|
63
|
+
} else {
|
|
64
|
+
lines.push("| Agent | Model | Status | Description |");
|
|
65
|
+
lines.push("|-------|-------|--------|-------------|");
|
|
66
|
+
for (const agent of agentsData.items.slice(0, 5)) {
|
|
67
|
+
lines.push(`| ${agent.name} | ${agent.modelProvider}/${agent.modelName} | ${agent.status} | ${agent.description ?? "-"} |`);
|
|
68
|
+
}
|
|
69
|
+
if (agentsData.items.length > 5) {
|
|
70
|
+
lines.push(`| ... | ... | ... | _${agentsData.total - 5} more_ |`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
lines.push("");
|
|
74
|
+
lines.push("## Recent Runs");
|
|
75
|
+
lines.push("");
|
|
76
|
+
if (runsData.items.length === 0) {
|
|
77
|
+
lines.push("_No runs yet._");
|
|
78
|
+
} else {
|
|
79
|
+
lines.push("| Run ID | Agent | Status | Duration | Tokens | Cost |");
|
|
80
|
+
lines.push("|--------|-------|--------|----------|--------|------|");
|
|
81
|
+
for (const run of runsData.items.slice(0, 5)) {
|
|
82
|
+
lines.push(`| ${run.id.slice(-8)} | ${run.agentName} | ${run.status} | ${run.durationMs ? formatDuration(run.durationMs) : "-"} | ${run.totalTokens ?? 0} | $${(run.estimatedCostUsd ?? 0).toFixed(4)} |`);
|
|
83
|
+
}
|
|
84
|
+
if (runsData.items.length > 5) {
|
|
85
|
+
lines.push(`| ... | ... | ... | ... | ... | _${runsData.total - 5} more_ |`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
lines.push("");
|
|
89
|
+
lines.push("## Tools");
|
|
90
|
+
lines.push("");
|
|
91
|
+
const toolsByCategory = {};
|
|
92
|
+
for (const tool of toolsData.items) {
|
|
93
|
+
const cat = tool.category;
|
|
94
|
+
if (!toolsByCategory[cat])
|
|
95
|
+
toolsByCategory[cat] = [];
|
|
96
|
+
toolsByCategory[cat].push(tool);
|
|
97
|
+
}
|
|
98
|
+
if (Object.keys(toolsByCategory).length === 0) {
|
|
99
|
+
lines.push("_No tools registered._");
|
|
100
|
+
} else {
|
|
101
|
+
lines.push("| Category | Tools | Active |");
|
|
102
|
+
lines.push("|----------|-------|--------|");
|
|
103
|
+
for (const [category, tools] of Object.entries(toolsByCategory).sort()) {
|
|
104
|
+
const active = tools.filter((t) => t.status === "ACTIVE").length;
|
|
105
|
+
lines.push(`| ${category} | ${tools.length} | ${active} |`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
mimeType: "text/markdown",
|
|
110
|
+
body: lines.join(`
|
|
111
|
+
`)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
export {
|
|
116
|
+
agentDashboardMarkdownRenderer
|
|
117
|
+
};
|