@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.entity.js","names":[],"sources":["../../src/run/run.entity.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Run status enum for entities.\n */\nexport const RunStatusEntityEnum = defineEntityEnum({\n name: 'RunStatus',\n values: [\n 'QUEUED',\n 'IN_PROGRESS',\n 'COMPLETED',\n 'FAILED',\n 'CANCELLED',\n 'EXPIRED',\n ],\n description: 'Status of an agent run',\n});\n\n/**\n * Run step type enum for entities.\n */\nexport const RunStepTypeEntityEnum = defineEntityEnum({\n name: 'RunStepType',\n values: ['MESSAGE_CREATION', 'TOOL_CALL', 'TOOL_RESULT', 'ERROR'],\n description: 'Type of run step',\n});\n\n/**\n * Log level enum for entities.\n */\nexport const LogLevelEntityEnum = defineEntityEnum({\n name: 'LogLevel',\n values: ['DEBUG', 'INFO', 'WARN', 'ERROR'],\n description: 'Log level',\n});\n\n/**\n * Run entity - Represents an agent execution.\n */\nexport const RunEntity = defineEntity({\n name: 'Run',\n schema: 'agent_console',\n description: 'An execution of an agent with input/output and metrics.',\n fields: {\n id: field.id(),\n organizationId: field.string({ description: 'Organization ID' }),\n agentId: field.foreignKey({ description: 'Agent being executed' }),\n userId: field.string({\n isOptional: true,\n description: 'User who initiated the run',\n }),\n sessionId: field.string({\n isOptional: true,\n description: 'Conversation session ID',\n }),\n input: field.json({ description: 'Input data for the run' }),\n output: field.json({\n isOptional: true,\n description: 'Output result from the run',\n }),\n status: field.enum('RunStatus', { default: 'QUEUED' }),\n errorMessage: field.string({\n isOptional: true,\n description: 'Error message if failed',\n }),\n errorCode: field.string({\n isOptional: true,\n description: 'Error code if failed',\n }),\n totalTokens: field.int({ default: 0, description: 'Total tokens used' }),\n promptTokens: field.int({ default: 0, description: 'Prompt tokens used' }),\n completionTokens: field.int({\n default: 0,\n description: 'Completion tokens used',\n }),\n totalIterations: field.int({\n default: 0,\n description: 'Number of iterations',\n }),\n durationMs: field.int({\n isOptional: true,\n description: 'Execution duration in ms',\n }),\n estimatedCostUsd: field.float({\n isOptional: true,\n description: 'Estimated cost in USD',\n }),\n queuedAt: field.dateTime({ description: 'When run was queued' }),\n startedAt: field.dateTime({\n isOptional: true,\n description: 'When run started executing',\n }),\n completedAt: field.dateTime({\n isOptional: true,\n description: 'When run completed',\n }),\n metadata: field.json({\n isOptional: true,\n description: 'Additional metadata',\n }),\n agent: field.belongsTo('Agent', ['agentId'], ['id']),\n steps: field.hasMany('RunStep', { description: 'Execution steps' }),\n logs: field.hasMany('RunLog', { description: 'Execution logs' }),\n },\n indexes: [\n index.on(['organizationId', 'agentId', 'queuedAt']),\n index.on(['organizationId', 'status']),\n index.on(['agentId', 'status']),\n index.on(['sessionId']),\n ],\n enums: [RunStatusEntityEnum],\n});\n\n/**\n * RunStep entity - Individual step in a run.\n */\nexport const RunStepEntity = defineEntity({\n name: 'RunStep',\n schema: 'agent_console',\n description: 'An individual step in an agent run.',\n fields: {\n id: field.id(),\n runId: field.foreignKey({ description: 'Parent run' }),\n stepNumber: field.int({ description: 'Step sequence number' }),\n type: field.enum('RunStepType'),\n toolId: field.string({\n isOptional: true,\n description: 'Tool used in this step',\n }),\n toolName: field.string({ isOptional: true, description: 'Tool name' }),\n input: field.json({ isOptional: true, description: 'Step input' }),\n output: field.json({ isOptional: true, description: 'Step output' }),\n status: field.enum('RunStatus'),\n errorMessage: field.string({ isOptional: true }),\n tokensUsed: field.int({ default: 0 }),\n durationMs: field.int({ isOptional: true }),\n startedAt: field.dateTime(),\n completedAt: field.dateTime({ isOptional: true }),\n run: field.belongsTo('Run', ['runId'], ['id']),\n },\n indexes: [index.on(['runId', 'stepNumber'])],\n enums: [RunStepTypeEntityEnum],\n});\n\n/**\n * RunLog entity - Log entry for a run.\n */\nexport const RunLogEntity = defineEntity({\n name: 'RunLog',\n schema: 'agent_console',\n description: 'A log entry for an agent run.',\n fields: {\n id: field.id(),\n runId: field.foreignKey({ description: 'Parent run' }),\n stepId: field.string({ isOptional: true, description: 'Related step' }),\n level: field.enum('LogLevel'),\n message: field.string({ description: 'Log message' }),\n data: field.json({ isOptional: true, description: 'Additional log data' }),\n source: field.string({\n isOptional: true,\n description: 'Log source component',\n }),\n traceId: field.string({ isOptional: true }),\n spanId: field.string({ isOptional: true }),\n timestamp: field.dateTime(),\n run: field.belongsTo('Run', ['runId'], ['id']),\n },\n indexes: [index.on(['runId', 'timestamp']), index.on(['runId', 'level'])],\n enums: [LogLevelEntityEnum],\n});\n"],"mappings":";;;;;;AAUA,MAAa,sBAAsB,iBAAiB;CAClD,MAAM;CACN,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACD;CACD,aAAa;CACd,CAAC;;;;AAKF,MAAa,wBAAwB,iBAAiB;CACpD,MAAM;CACN,QAAQ;EAAC;EAAoB;EAAa;EAAe;EAAQ;CACjE,aAAa;CACd,CAAC;;;;AAKF,MAAa,qBAAqB,iBAAiB;CACjD,MAAM;CACN,QAAQ;EAAC;EAAS;EAAQ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G,CAAC,SAAS,aAAa,CAAC,CAAC;CAC5C,OAAO,CAAC,sBAAsB;CAC/B,CAAC;;;;AAKF,MAAa,eAAe,aAAa;CACvC,MAAM;CACN,QAAQ;CACR,aAAa;CACb,QAAQ;EACN,IAAI,MAAM,IAAI;EACd,OAAO,MAAM,WAAW,EAAE,aAAa,cAAc,CAAC;EACtD,QAAQ,MAAM,OAAO;GAAE,YAAY;GAAM,aAAa;GAAgB,CAAC;EACvE,OAAO,MAAM,KAAK,WAAW;EAC7B,SAAS,MAAM,OAAO,EAAE,aAAa,eAAe,CAAC;EACrD,MAAM,MAAM,KAAK;GAAE,YAAY;GAAM,aAAa;GAAuB,CAAC;EAC1E,QAAQ,MAAM,OAAO;GACnB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC3C,QAAQ,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC1C,WAAW,MAAM,UAAU;EAC3B,KAAK,MAAM,UAAU,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC;EAC/C;CACD,SAAS,CAAC,MAAM,GAAG,CAAC,SAAS,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,SAAS,QAAQ,CAAC,CAAC;CACzE,OAAO,CAAC,mBAAmB;CAC5B,CAAC"}
|
package/dist/run/run.enum.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.enum.js","names":[],"sources":["../../src/run/run.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Run status enum.\n */\nexport const RunStatusEnum = defineEnum('RunStatus', [\n 'QUEUED',\n 'IN_PROGRESS',\n 'COMPLETED',\n 'FAILED',\n 'CANCELLED',\n 'EXPIRED',\n]);\n\n/**\n * Run step type enum.\n */\nexport const RunStepTypeEnum = defineEnum('RunStepType', [\n 'MESSAGE_CREATION',\n 'TOOL_CALL',\n 'TOOL_RESULT',\n 'ERROR',\n]);\n\n/**\n * Log level enum.\n */\nexport const LogLevelEnum = defineEnum('LogLevel', [\n 'DEBUG',\n 'INFO',\n 'WARN',\n 'ERROR',\n]);\n\n/**\n * Granularity enum for metrics.\n */\nexport const GranularityEnum = defineEnum('Granularity', [\n 'hour',\n 'day',\n 'week',\n 'month',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,gBAAgB,WAAW,aAAa;CACnD;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,kBAAkB,WAAW,eAAe;CACvD;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,eAAe,WAAW,YAAY;CACjD;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,kBAAkB,WAAW,eAAe;CACvD;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.event.js","names":[],"sources":["../../src/run/run.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * Payload for run started event.\n */\nconst RunStartedPayload = defineSchemaModel({\n name: 'RunStartedPayload',\n description: 'Payload for run started event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunStartedEvent - An agent run was started.\n */\nexport const RunStartedEvent = defineEvent({\n meta: {\n key: 'agent.run.started',\n version: '1.0.0',\n description: 'An agent run was started.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'started'],\n },\n payload: RunStartedPayload,\n});\n\n/**\n * Payload for run completed event.\n */\nconst RunCompletedPayload = defineSchemaModel({\n name: 'RunCompletedPayload',\n description: 'Payload for run completed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n promptTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completionTokens: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n estimatedCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: true,\n },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunCompletedEvent - An agent run completed successfully.\n */\nexport const RunCompletedEvent = defineEvent({\n meta: {\n key: 'agent.run.completed',\n version: '1.0.0',\n description: 'An agent run completed successfully.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'completed'],\n },\n payload: RunCompletedPayload,\n});\n\n/**\n * Payload for run failed event.\n */\nconst RunFailedPayload = defineSchemaModel({\n name: 'RunFailedPayload',\n description: 'Payload for run failed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n failedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunFailedEvent - An agent run failed.\n */\nexport const RunFailedEvent = defineEvent({\n meta: {\n key: 'agent.run.failed',\n version: '1.0.0',\n description: 'An agent run encountered an error.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'failed'],\n },\n payload: RunFailedPayload,\n});\n\n/**\n * Payload for run cancelled event.\n */\nconst RunCancelledPayload = defineSchemaModel({\n name: 'RunCancelledPayload',\n description: 'Payload for run cancelled event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cancelledBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n cancelledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunCancelledEvent - An agent run was cancelled.\n */\nexport const RunCancelledEvent = defineEvent({\n meta: {\n key: 'agent.run.cancelled',\n version: '1.0.0',\n description: 'An agent run was cancelled by the user.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancelled'],\n },\n payload: RunCancelledPayload,\n});\n\n/**\n * Payload for tool invoked event.\n */\nconst ToolInvokedPayload = defineSchemaModel({\n name: 'ToolInvokedPayload',\n description: 'Payload for tool invoked event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n invokedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolInvokedEvent - A tool was invoked during a run.\n */\nexport const ToolInvokedEvent = defineEvent({\n meta: {\n key: 'agent.run.toolInvoked',\n version: '1.0.0',\n description: 'A tool was invoked during an agent run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'tool', 'invoked'],\n },\n payload: ToolInvokedPayload,\n});\n\n/**\n * Payload for tool completed event.\n */\nconst ToolCompletedPayload = defineSchemaModel({\n name: 'ToolCompletedPayload',\n description: 'Payload for tool completed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolCompletedEvent - A tool invocation completed.\n */\nexport const ToolCompletedEvent = defineEvent({\n meta: {\n key: 'agent.run.toolCompleted',\n version: '1.0.0',\n description: 'A tool invocation completed during an agent run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'tool', 'completed'],\n },\n payload: ToolCompletedPayload,\n});\n\n/**\n * Message type enum.\n */\nconst MessageTypeEnum = defineEnum('MessageType', ['assistant', 'system']);\n\n/**\n * Payload for message generated event.\n */\nconst MessageGeneratedPayload = defineSchemaModel({\n name: 'MessageGeneratedPayload',\n description: 'Payload for message generated event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n messageType: { type: MessageTypeEnum, isOptional: false },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n tokensUsed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n generatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * MessageGeneratedEvent - Agent generated a message.\n */\nexport const MessageGeneratedEvent = defineEvent({\n meta: {\n key: 'agent.run.messageGenerated',\n version: '1.0.0',\n description: 'An agent generated a message during a run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'message', 'generated'],\n },\n payload: MessageGeneratedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAM,oBAAoB,kBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,OAAO;GAAE,MAAM,eAAe,YAAY;GAAE,YAAY;GAAO;EAC/D,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;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\n * Mock handlers for Run contracts.\n */\nimport { MOCK_RUNS } from '../shared/mock-runs';\nimport { MOCK_AGENTS } from '../shared/mock-agents';\n\nexport interface ListRunsInput {\n organizationId?: string;\n agentId?: string;\n userId?: string;\n sessionId?: string;\n status?:\n | 'QUEUED'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED'\n | 'CANCELLED'\n | 'EXPIRED';\n startDate?: Date;\n endDate?: Date;\n limit?: number;\n offset?: number;\n}\n\nexport interface RunSummary {\n id: string;\n agentId: string;\n agentName: string;\n status:\n | 'QUEUED'\n | 'IN_PROGRESS'\n | 'COMPLETED'\n | 'FAILED'\n | 'CANCELLED'\n | 'EXPIRED';\n totalTokens: number;\n durationMs?: number;\n estimatedCostUsd?: number;\n queuedAt: Date;\n completedAt?: Date;\n}\n\nexport interface ListRunsOutput {\n items: RunSummary[];\n total: number;\n hasMore: boolean;\n}\n\n/**\n * Mock handler for ListRunsQuery.\n */\nexport async function mockListRunsHandler(\n input: ListRunsInput\n): Promise<ListRunsOutput> {\n const { agentId, status, limit = 20, offset = 0 } = input;\n\n let filtered = [...MOCK_RUNS];\n if (agentId) filtered = filtered.filter((r) => r.agentId === agentId);\n if (status) filtered = filtered.filter((r) => r.status === status);\n\n const total = filtered.length;\n const items = filtered.slice(offset, offset + limit).map((r) => {\n const agent = MOCK_AGENTS.find((a) => a.id === r.agentId);\n return {\n id: r.id,\n agentId: r.agentId,\n agentName: agent?.name ?? 'Unknown',\n status: r.status,\n totalTokens: r.totalTokens,\n durationMs: r.durationMs,\n estimatedCostUsd: r.estimatedCostUsd,\n queuedAt: r.queuedAt,\n completedAt: r.completedAt,\n };\n });\n\n return { items, total, hasMore: offset + limit < total };\n}\n\n/**\n * Mock handler for GetRunQuery.\n */\nexport async function mockGetRunHandler(input: {\n runId: string;\n includeSteps?: boolean;\n includeLogs?: boolean;\n}) {\n const run = MOCK_RUNS.find((r) => r.id === input.runId);\n if (!run) throw new Error('RUN_NOT_FOUND');\n\n const agent = MOCK_AGENTS.find((a) => a.id === run.agentId);\n return {\n ...run,\n agent: agent\n ? {\n id: agent.id,\n name: agent.name,\n modelProvider: agent.modelProvider,\n modelName: agent.modelName,\n }\n : undefined,\n steps: input.includeSteps ? run.steps : undefined,\n logs: input.includeLogs ? run.logs : undefined,\n };\n}\n\n/**\n * Mock handler for ExecuteAgentCommand.\n */\nexport async function mockExecuteAgentHandler(input: {\n agentId: string;\n input: { message: string; context?: Record<string, unknown> };\n}) {\n const agent = MOCK_AGENTS.find((a) => a.id === input.agentId);\n if (!agent) throw new Error('AGENT_NOT_FOUND');\n if (agent.status !== 'ACTIVE') throw new Error('AGENT_NOT_ACTIVE');\n\n return {\n runId: `run-${Date.now()}`,\n status: 'QUEUED' as const,\n estimatedWaitMs: 500,\n };\n}\n\n/**\n * Mock handler for CancelRunCommand.\n */\nexport async function mockCancelRunHandler(input: {\n runId: string;\n reason?: string;\n}) {\n const run = MOCK_RUNS.find((r) => r.id === input.runId);\n if (!run) throw new Error('RUN_NOT_FOUND');\n if (!['QUEUED', 'IN_PROGRESS'].includes(run.status))\n throw new Error('RUN_NOT_CANCELLABLE');\n\n return { success: true, status: 'CANCELLED' as const };\n}\n"],"mappings":";;;;;;;;;;AAmDA,eAAsB,oBACpB,OACyB;CACzB,MAAM,EAAE,SAAS,QAAQ,QAAQ,IAAI,SAAS,MAAM;CAEpD,IAAI,WAAW,CAAC,GAAG,UAAU;AAC7B,KAAI,QAAS,YAAW,SAAS,QAAQ,MAAM,EAAE,YAAY,QAAQ;AACrE,KAAI,OAAQ,YAAW,SAAS,QAAQ,MAAM,EAAE,WAAW,OAAO;CAElE,MAAM,QAAQ,SAAS;AAgBvB,QAAO;EAAE,OAfK,SAAS,MAAM,QAAQ,SAAS,MAAM,CAAC,KAAK,MAAM;GAC9D,MAAM,QAAQ,YAAY,MAAM,MAAM,EAAE,OAAO,EAAE,QAAQ;AACzD,UAAO;IACL,IAAI,EAAE;IACN,SAAS,EAAE;IACX,WAAW,OA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":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { GranularityEnum, LogLevelEnum, RunStatusEnum } from './run.enum';\nimport {\n RunInputModel,\n RunLogModel,\n RunModel,\n RunStepModel,\n RunSummaryModel,\n TimelineDataPointModel,\n} from './run.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * ExecuteAgentCommand - Starts a new agent run.\n */\nexport const ExecuteAgentCommand = defineCommand({\n meta: {\n key: 'agent.run.execute',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'execute'],\n description: 'Starts a new agent run with the given input.',\n goal: 'Execute an AI agent with user input.',\n context: 'Called from chat interface or API.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ExecuteAgentInput',\n fields: {\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n input: { type: RunInputModel, isOptional: false },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n stream: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n maxIterations: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n }),\n output: defineSchemaModel({\n name: 'ExecuteAgentOutput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: RunStatusEnum, isOptional: false },\n estimatedWaitMs: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n },\n }),\n errors: {\n AGENT_NOT_FOUND: {\n description: 'The specified agent does not exist',\n http: 404,\n gqlCode: 'AGENT_NOT_FOUND',\n when: 'Agent ID is invalid',\n },\n AGENT_NOT_ACTIVE: {\n description: 'The specified agent is not active',\n http: 400,\n gqlCode: 'AGENT_NOT_ACTIVE',\n when: 'Agent is in draft/paused/archived state',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'run.started',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'started'],\n when: 'Run is queued',\n payload: RunSummaryModel,\n },\n ],\n audit: ['run.started'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'execute-agent-happy-path',\n given: ['Agent exists', 'Agent is active'],\n when: ['User submits execution request'],\n then: ['Run is created', 'RunStarted event is emitted'],\n },\n {\n key: 'execute-agent-not-active',\n given: ['Agent exists but is not active'],\n when: ['User attempts to execute'],\n then: ['AGENT_NOT_ACTIVE error is returned'],\n },\n ],\n examples: [\n {\n key: 'basic-execute',\n input: { agentId: 'agent-123', input: { message: 'Hello' } },\n output: { runId: 'run-456', status: 'pending', estimatedWaitMs: 5000 },\n },\n ],\n },\n});\n\n/**\n * CancelRunCommand - Cancels an in-progress run.\n */\nexport const CancelRunCommand = defineCommand({\n meta: {\n key: 'agent.run.cancel',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancel'],\n description: 'Cancels an in-progress agent run.',\n goal: 'Stop a running agent execution.',\n context: 'Called when user wants to abort a long-running task.',\n },\n io: {\n input: defineSchemaModel({\n name: 'CancelRunInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n }),\n output: defineSchemaModel({\n name: 'CancelRunOutput',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n status: { type: RunStatusEnum, isOptional: false },\n },\n }),\n errors: {\n RUN_NOT_FOUND: {\n description: 'The specified run does not exist',\n http: 404,\n gqlCode: 'RUN_NOT_FOUND',\n when: 'Run ID is invalid',\n },\n RUN_NOT_CANCELLABLE: {\n description: 'The run cannot be cancelled',\n http: 400,\n gqlCode: 'RUN_NOT_CANCELLABLE',\n when: 'Run is already completed/failed/cancelled',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'run.cancelled',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancelled'],\n when: 'Run is cancelled',\n payload: RunSummaryModel,\n },\n ],\n audit: ['run.cancelled'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'cancel-run-happy-path',\n given: ['Run exists', 'Run is in progress'],\n when: ['User cancels run'],\n then: ['Run is cancelled', 'RunCancelled event is emitted'],\n },\n {\n key: 'cancel-run-already-completed',\n given: ['Run exists but is already completed'],\n when: ['User attempts to cancel'],\n then: ['RUN_NOT_CANCELLABLE error is returned'],\n },\n ],\n examples: [\n {\n key: 'cancel-basic',\n input: { runId: 'run-456', reason: 'User requested' },\n output: { success: true, status: 'cancelled' },\n },\n ],\n },\n});\n\n/**\n * GetRunQuery - Retrieves a run by ID.\n */\nexport const GetRunQuery = defineQuery({\n meta: {\n key: 'agent.run.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'get'],\n description: 'Retrieves a run by its ID with optional details.',\n goal: 'View detailed run information.',\n context: 'Run details page or monitoring.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n includeSteps: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n includeLogs: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n }),\n output: RunModel,\n errors: {\n RUN_NOT_FOUND: {\n description: 'The specified run does not exist',\n http: 404,\n gqlCode: 'RUN_NOT_FOUND',\n when: 'Run ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-happy-path',\n given: ['Run exists'],\n when: ['User requests run by ID'],\n then: ['Run details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-with-steps',\n input: { runId: 'run-456', includeSteps: true, includeLogs: false },\n output: { id: 'run-456', status: 'completed', steps: [] },\n },\n ],\n },\n});\n\n/**\n * ListRunsQuery - Lists runs for an organization or agent.\n */\nexport const ListRunsQuery = defineQuery({\n meta: {\n key: 'agent.run.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'list'],\n description: 'Lists runs with optional filtering.',\n goal: 'Browse and search run history.',\n context: 'Run history/dashboard view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListRunsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: RunStatusEnum, isOptional: true },\n startDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'ListRunsOutput',\n fields: {\n items: { type: RunSummaryModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-runs-happy-path',\n given: ['Organization has runs'],\n when: ['User lists runs'],\n then: ['Paginated list of runs is returned'],\n },\n ],\n examples: [\n {\n key: 'list-by-agent',\n input: { agentId: 'agent-123', limit: 20, offset: 0 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * GetRunStepsQuery - Retrieves steps for a run.\n */\nexport const GetRunStepsQuery = defineQuery({\n meta: {\n key: 'agent.run.getSteps',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'steps'],\n description: 'Retrieves all steps for a specific run.',\n goal: 'View step-by-step execution details.',\n context: 'Run details page - steps tab.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunStepsInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunStepsOutput',\n fields: {\n steps: { type: RunStepModel, isArray: true, isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-steps-happy-path',\n given: ['Run exists with steps'],\n when: ['User requests steps'],\n then: ['Steps list is returned'],\n },\n ],\n examples: [\n {\n key: 'get-steps-basic',\n input: { runId: 'run-456' },\n output: { steps: [] },\n },\n ],\n },\n});\n\n/**\n * GetRunLogsQuery - Retrieves logs for a run.\n */\nexport const GetRunLogsQuery = defineQuery({\n meta: {\n key: 'agent.run.getLogs',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'logs'],\n description: 'Retrieves all logs for a specific run.',\n goal: 'Debug and audit run execution.',\n context: 'Run details page - logs tab.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunLogsInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n level: { type: LogLevelEnum, isOptional: true },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 100,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunLogsOutput',\n fields: {\n items: { type: RunLogModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-logs-happy-path',\n given: ['Run exists with logs'],\n when: ['User requests logs'],\n then: ['Paginated logs list is returned'],\n },\n ],\n examples: [\n {\n key: 'get-logs-filtered',\n input: { runId: 'run-456', level: 'error', limit: 50 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * GetRunMetricsQuery - Retrieves aggregated metrics for runs.\n */\nexport const GetRunMetricsQuery = defineQuery({\n meta: {\n key: 'agent.run.getMetrics',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'metrics'],\n description: 'Retrieves aggregated metrics for runs within a time period.',\n goal: 'Monitor and analyze agent usage.',\n context: 'Analytics dashboard.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunMetricsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n granularity: {\n type: GranularityEnum,\n isOptional: true,\n defaultValue: 'day',\n },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunMetricsOutput',\n fields: {\n totalRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedRuns: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n failedRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n averageDurationMs: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n successRate: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n timeline: {\n type: TimelineDataPointModel,\n isArray: true,\n isOptional: false,\n },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-metrics-happy-path',\n given: ['Organization has run history'],\n when: ['User requests metrics for date range'],\n then: ['Aggregated metrics are returned'],\n },\n ],\n examples: [\n {\n key: 'get-daily-metrics',\n input: {\n organizationId: 'org-123',\n startDate: '2025-01-01',\n endDate: '2025-01-31',\n granularity: 'day',\n },\n output: {\n totalRuns: 100,\n completedRuns: 90,\n failedRuns: 10,\n totalTokens: 50000,\n totalCostUsd: 5.0,\n averageDurationMs: 2500,\n successRate: 0.9,\n timeline: [],\n },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAeA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,OAAO,UAAU;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ;IACN,SAAS;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACtE,OAAO;KAAE,MAAM;KAAe,YAAY;KAAO;IACjD,WAAW;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAM;IACvE,UAAU;KAAE,MAAM,eAAe,YAAY;KAAE,YAAY;KAAM;IACjE,QAAQ;KAAE,MAAM,eAAe,SAAS;KAAE,YAAY;KAAM;IAC5D,eAAe;KACb,MAAM,eAAe,cAAc;KACnC,YAAY;KACb;IACD,WAAW;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAM;IACrE;GACF,CAAC;EACF,QAAQ,kBAAkB;GACxB,MAAM;GACN,QAAQ;IACN,OAAO;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACpE,QAAQ;KAAE,MAAM;KAAe,YAAY;KAAO;IAClD,iBAAiB;KACf,MAAM,eAAe,cAAc;KACnC,YAAY;KACb;IACF;GACF,CAAC;EACF,QAAQ;GACN,iBAAiB;IACf,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,kBAAkB;IAChB,aAAa;IACb,MAAM;IACN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eAAe,iBAAiB;KAAE,YAAY;KAAM;IACrE,WAAW;KAAE,MAAM,eAAe,UAAU;KAAE,YAAY;KAAO;IACjE,SAAS;KAAE,MAAM,eAAe,UAAU;KAAE,YAAY;KAAO;IAC/D,aAAa;KACX,MAAM;KACN,YAAY;KACZ,cAAc;KACf;IACF;GACF,CAAC;EACF,QAAQ,kBAAkB;GACxB,MAAM;GACN,QAAQ;IACN,WAAW;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAO;IACrE,eAAe;KACb,MAAM,eAAe,cAAc;KACnC,YAAY;KACb;IACD,YAAY;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAO;IACtE,aAAa;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAO;IACvE,cAAc;KACZ,MAAM,eAAe,gBAAgB;KACrC,YAAY;KACb;IACD,mBAAmB;KACjB,MAAM,eAAe,gBAAgB;KACrC,YAAY;KACb;IACD,aAAa;KACX,MAAM,eAAe,gBAAgB;KACrC,YAAY;KACb;IACD,UAAU;KACR,MAAM;KACN,SAAS;KACT,YAAY;KACb;IACF;GACF,CAAC;EACH;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,+BAA+B;GACvC,MAAM,CAAC,uCAAuC;GAC9C,MAAM,CAAC,kCAAkC;GAC1C,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,gBAAgB;IAChB,WAAW;IACX,SAAS;IACT,aAAa;IACd;GACD,QAAQ;IACN,WAAW;IACX,eAAe;IACf,YAAY;IACZ,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,aAAa;IACb,UAAU,EAAE;IACb;GACF,CACF;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.presentation.js","names":[],"sources":["../../src/run/run.presentation.ts"],"sourcesContent":["import { StabilityEnum, definePresentation } from '@contractspec/lib.contracts';\nimport { RunSummaryModel } from './run.schema';\n\n/**\n * Presentation for displaying a list of agent runs.\n */\nexport const RunListPresentation = definePresentation({\n meta: {\n key: 'agent-console.run.list',\n version: '1.0.0',\n title: 'Run List',\n description:\n 'List view of agent runs with status, tokens, and duration info',\n goal: 'Provide an overview of agent execution history and performance.',\n context: 'Run history dashboard.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['run', 'list', 'dashboard'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'RunListView',\n props: RunSummaryModel,\n },\n targets: ['react', 'markdown', 'application/json'],\n policy: { flags: ['agent-console.enabled'] },\n});\n\n/**\n * Presentation for run detail view.\n */\nexport const RunDetailPresentation = definePresentation({\n meta: {\n key: 'agent-console.run.detail',\n version: '1.0.0',\n title: 'Run Details',\n description: 'Detailed view of an agent run with steps, logs, and metrics',\n goal: 'Allow users to inspect and debug a specific agent run.',\n context: 'Detailed view of an agent run.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['run', 'detail'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'RunDetailView',\n },\n targets: ['react', 'markdown'],\n policy: { flags: ['agent-console.enabled'] },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,sBAAsB,mBAAmB;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM;GAAC;GAAO;GAAQ;GAAY;EAClC,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS;EAAC;EAAS;EAAY;EAAmB;CAClD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C,CAAC;;;;AAKF,MAAa,wBAAwB,mBAAmB;CACtD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM,CAAC,OAAO,SAAS;EACvB,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.schema.js","names":[],"sources":["../../src/run/run.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { RunStatusEnum, RunStepTypeEnum, LogLevelEnum } from './run.enum';\n\n/**\n * Input data for agent execution.\n */\nexport const RunInputModel = defineSchemaModel({\n name: 'RunInput',\n description: 'Input data for agent execution',\n fields: {\n message: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n context: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n },\n});\n\n/**\n * Individual step within a run.\n */\nexport const RunStepModel = defineSchemaModel({\n name: 'RunStep',\n description: 'Individual step within a run',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepNumber: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n type: { type: RunStepTypeEnum, isOptional: false },\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n status: { type: RunStatusEnum, isOptional: false },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n tokensUsed: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n defaultValue: 0,\n },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n/**\n * Execution log entry.\n */\nexport const RunLogModel = defineSchemaModel({\n name: 'RunLog',\n description: 'Execution log entry',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n level: { type: LogLevelEnum, isOptional: false },\n message: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n data: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n spanId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Agent reference in a run.\n */\nexport const RunAgentRefModel = defineSchemaModel({\n name: 'RunAgentRef',\n description: 'Agent reference in a run',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n modelProvider: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n/**\n * Agent execution instance.\n */\nexport const RunModel = defineSchemaModel({\n name: 'Run',\n description: 'Agent execution instance',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n status: { type: RunStatusEnum, isOptional: false },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n totalTokens: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n defaultValue: 0,\n },\n promptTokens: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n defaultValue: 0,\n },\n completionTokens: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n defaultValue: 0,\n },\n totalIterations: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n defaultValue: 0,\n },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n estimatedCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: true,\n },\n queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n steps: { type: RunStepModel, isArray: true, isOptional: true },\n logs: { type: RunLogModel, isArray: true, isOptional: true },\n agent: { type: RunAgentRefModel, isOptional: true },\n },\n});\n\n/**\n * Summary of a run for list views.\n */\nexport const RunSummaryModel = defineSchemaModel({\n name: 'RunSummary',\n description: 'Summary of a run for list views',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n status: { type: RunStatusEnum, isOptional: false },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n estimatedCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: true,\n },\n queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n/**\n * Timeline data point for metrics.\n */\nexport const TimelineDataPointModel = defineSchemaModel({\n name: 'TimelineDataPoint',\n description: 'Timeline data point for metrics',\n fields: {\n period: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n runs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n tokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n costUsd: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n avgDurationMs: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,gBAAgB,kBAAkB;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACrE,SAAS;GAAE,MAAM,eAAe,YAAY;GAAE,YAAY;GAAM;EACjE;CACF,CAAC;;;;AAKF,MAAa,eAAe,kBAAkB;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,MAAM;GAAE,MAAM;GAAiB,YAAY;GAAO;EAClD,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE,OAAO;GAAE,MAAM,eAAe,YAAY;GAAE,YAAY;GAAM;EAC9D,QAAQ;GAAE,MAAM,eAAe,YAAY;GAAE,YAAY;GAAM;EAC/D,QAAQ;GAAE,MAAM;GAAe,YAAY;GAAO;EAClD,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EAC1E,YAAY;GACV,MAAM,eAAe,cAAc;GACnC,YAAY;GACZ,cAAc;GACf;EACD,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EACrE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GA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W;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE,QAAQ;GAAE,MAAM;GAAe,YAAY;GAAO;EAClD,aAAa;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACvE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EACrE,kBAAkB;GAChB,MAAM,eAAe,gBAAgB;GACrC,YAAY;GACb;EACD,UAAU;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAChE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EACnE;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,MAAM;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAChE,QAAQ;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAClE,SAAS;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACrE,eAAe;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC5E;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.test-spec.js","names":[],"sources":["../../src/run/run.test-spec.ts"],"sourcesContent":["import { defineTestSpec } from '@contractspec/lib.contracts';\n\nexport const runListTest = defineTestSpec({\n meta: {\n key: 'test.agent.run.list',\n version: '1.0.0',\n owners: ['@agent-console-team'],\n description: 'Test for listing runs',\n stability: 'stable',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'agent.run.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'agent.run.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'agent.run.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const runGetTest = defineTestSpec({\n meta: {\n key: 'test.agent.run.get',\n version: '1.0.0',\n owners: ['@agent-console-team'],\n description: 'Test for getting run',\n stability: 'stable',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'agent.run.get', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'agent.run.get' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'agent.run.get' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n"],"mappings":";;;AAEA,MAAa,cAAc,eAAe;CACxC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,QAAQ,CAAC,sBAAsB;EAC/B,aAAa;EACb,WAAW;EACX,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAAkB,SAAS;GAAS;EACvD;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE;EAC9C,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE;EAC9C,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC;AAEF,MAAa,aAAa,eAAe;CACvC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,QAAQ,CAAC,sBAAsB;EAC/B,aAAa;EACb,WAAW;EACX,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAAiB,SAAS;GAAS;EACtD;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE;EAC7C,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE;EAC7C,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/seeders/index.ts"],"sourcesContent":["import type { DatabasePort } from '@contractspec/lib.runtime-sandbox';\n\nexport async function seedAgentConsole(params: {\n projectId: string;\n db: DatabasePort;\n}) {\n const { projectId, db } = params;\n\n const existing = await db.query(\n `SELECT COUNT(*) as count FROM agent_definition WHERE \"projectId\" = $1`,\n [projectId]\n );\n if ((existing.rows[0]?.count as number) > 0) return;\n\n await db.execute(\n `INSERT INTO agent_definition (id, \"projectId\", \"organizationId\", name, description, \"modelProvider\", \"modelName\", status)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`,\n [\n 'agent_1',\n projectId,\n 'org_demo',\n 'Demo Agent',\n 'A demo AI agent',\n 'openai',\n 'gpt-4',\n 'ACTIVE',\n ]\n );\n}\n"],"mappings":";AAEA,eAAsB,iBAAiB,QAGpC;CACD,MAAM,EAAE,WAAW,OAAO;AAM1B,MAJiB,MAAM,GAAG,MACxB,yEACA,CAAC,UAAU,CACZ,EACa,KAAK,IAAI,QAAmB,EAAG;AAE7C,OAAM,GAAG,QACP;+CAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-agents.js","names":[],"sources":["../../src/shared/mock-agents.ts"],"sourcesContent":["/**\n * Mock agent data for testing and demos.\n */\nexport const MOCK_AGENTS = [\n {\n id: 'agent-1',\n organizationId: 'demo-org',\n name: 'Customer Support Bot',\n slug: 'customer-support-bot',\n description: 'Handles tier-1 customer inquiries and routes complex issues.',\n status: 'ACTIVE' as const,\n modelProvider: 'OPENAI' as const,\n modelName: 'gpt-4o-mini',\n modelConfig: { temperature: 0.7 },\n systemPrompt: 'You are a helpful customer support assistant.',\n toolChoice: 'auto' as const,\n maxIterations: 10,\n timeoutMs: 120000,\n version: '1.0.0',\n tags: ['support', 'tier-1'],\n createdAt: new Date('2024-01-15T10:00:00Z'),\n updatedAt: new Date('2024-03-20T14:30:00Z'),\n },\n {\n id: 'agent-2',\n organizationId: 'demo-org',\n name: 'Code Review Assistant',\n slug: 'code-review-assistant',\n description: 'Reviews pull requests and provides actionable feedback.',\n status: 'ACTIVE' as const,\n modelProvider: 'ANTHROPIC' as const,\n modelName: 'claude-sonnet-4-20250514',\n modelConfig: { temperature: 0.3 },\n systemPrompt: 'You are a code review expert.',\n toolChoice: 'auto' as const,\n maxIterations: 15,\n timeoutMs: 180000,\n version: '2.1.0',\n tags: ['code', 'review', 'dev'],\n createdAt: new Date('2024-02-10T09:00:00Z'),\n updatedAt: new Date('2024-04-05T11:15:00Z'),\n },\n {\n id: 'agent-3',\n organizationId: 'demo-org',\n name: 'Data Analyst',\n slug: 'data-analyst',\n description: 'Queries databases and generates insights from data.',\n status: 'PAUSED' as const,\n modelProvider: 'OPENAI' as const,\n modelName: 'gpt-4o',\n modelConfig: { temperature: 0.5 },\n systemPrompt: 'You are a data analyst expert in SQL and analytics.',\n toolChoice: 'required' as const,\n maxIterations: 20,\n timeoutMs: 300000,\n version: '1.2.0',\n tags: ['data', 'analytics', 'sql'],\n createdAt: new Date('2024-03-01T08:00:00Z'),\n updatedAt: new Date('2024-04-10T16:45:00Z'),\n },\n {\n id: 'agent-4',\n organizationId: 'demo-org',\n name: 'Meeting Scheduler',\n slug: 'meeting-scheduler',\n description: 'Schedules meetings and manages calendar conflicts.',\n status: 'DRAFT' as const,\n modelProvider: 'GOOGLE' as const,\n modelName: 'gemini-2.0-flash',\n modelConfig: { temperature: 0.2 },\n systemPrompt: 'You help schedule and organize meetings efficiently.',\n toolChoice: 'auto' as const,\n maxIterations: 5,\n timeoutMs: 60000,\n version: '0.1.0',\n tags: ['calendar', 'scheduling'],\n createdAt: new Date('2024-04-01T12:00:00Z'),\n updatedAt: new Date('2024-04-01T12:00:00Z'),\n },\n];\n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
|
1
|
-
{"version":3,"file":"mock-runs.js","names":[],"sources":["../../src/shared/mock-runs.ts"],"sourcesContent":["/**\n * Mock run data for testing and demos.\n */\nexport const MOCK_RUNS = [\n {\n id: 'run-1',\n organizationId: 'demo-org',\n agentId: 'agent-1',\n agentName: 'Customer Support Bot',\n userId: 'user-1',\n sessionId: 'session-1',\n input: { message: 'How do I reset my password?', context: {} },\n output: { response: 'You can reset your password by clicking...' },\n status: 'COMPLETED' as const,\n totalTokens: 1250,\n promptTokens: 800,\n completionTokens: 450,\n totalIterations: 3,\n durationMs: 4500,\n estimatedCostUsd: 0.0025,\n queuedAt: new Date('2024-04-15T10:00:00Z'),\n startedAt: new Date('2024-04-15T10:00:01Z'),\n completedAt: new Date('2024-04-15T10:00:05Z'),\n steps: [],\n logs: [],\n },\n {\n id: 'run-2',\n organizationId: 'demo-org',\n agentId: 'agent-2',\n agentName: 'Code Review Assistant',\n userId: 'user-2',\n input: { message: 'Review PR #123', context: { prNumber: 123 } },\n status: 'IN_PROGRESS' as const,\n totalTokens: 3500,\n promptTokens: 3000,\n completionTokens: 500,\n totalIterations: 5,\n queuedAt: new Date('2024-04-15T10:30:00Z'),\n startedAt: new Date('2024-04-15T10:30:02Z'),\n steps: [],\n logs: [],\n },\n {\n id: 'run-3',\n organizationId: 'demo-org',\n agentId: 'agent-1',\n agentName: 'Customer Support Bot',\n userId: 'user-1',\n input: { message: 'What are your business hours?' },\n output: { response: 'Our business hours are 9 AM to 5 PM EST...' },\n status: 'COMPLETED' as const,\n totalTokens: 800,\n promptTokens: 500,\n completionTokens: 300,\n totalIterations: 2,\n durationMs: 2100,\n estimatedCostUsd: 0.0012,\n queuedAt: new Date('2024-04-15T09:00:00Z'),\n startedAt: new Date('2024-04-15T09:00:01Z'),\n completedAt: new Date('2024-04-15T09:00:03Z'),\n steps: [],\n logs: [],\n },\n {\n id: 'run-4',\n organizationId: 'demo-org',\n agentId: 'agent-3',\n agentName: 'Data Analyst',\n userId: 'user-3',\n input: { message: 'Generate sales report for Q1' },\n status: 'FAILED' as const,\n errorMessage: 'Database connection timeout',\n errorCode: 'DB_TIMEOUT',\n totalTokens: 2000,\n promptTokens: 1500,\n completionTokens: 500,\n totalIterations: 8,\n durationMs: 45000,\n queuedAt: new Date('2024-04-14T15:00:00Z'),\n startedAt: new Date('2024-04-14T15:00:05Z'),\n completedAt: new Date('2024-04-14T15:00:50Z'),\n steps: [],\n logs: [],\n },\n {\n id: 'run-5',\n organizationId: 'demo-org',\n agentId: 'agent-2',\n agentName: 'Code Review Assistant',\n userId: 'user-2',\n input: { message: 'Review PR #120' },\n output: { response: 'Code review complete. 3 suggestions...' },\n status: 'COMPLETED' as const,\n totalTokens: 5200,\n promptTokens: 4000,\n completionTokens: 1200,\n totalIterations: 7,\n durationMs: 15000,\n estimatedCostUsd: 0.0156,\n queuedAt: new Date('2024-04-14T11:00:00Z'),\n startedAt: new Date('2024-04-14T11:00:03Z'),\n completedAt: new Date('2024-04-14T11:00:18Z'),\n steps: [],\n logs: [],\n },\n];\n"],"mappings":";;;;AAGA,MAAa,YAAY;CACvB;EACE,IAAI;EACJ,gBAAgB;EAChB,SAAS;EACT,WAAW;EACX,QAAQ;EACR,WAAW;EACX,OAAO;GAAE,SAAS;GAA+B,SAAS,EAAE;GAAE;EAC9D,QAAQ,EAAE,UAAU,8CAA8C;EAClE,QAAQ;EACR,aAAa;EACb,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,kBAAkB;EAClB,0BAAU,IAAI,KAAK,uBAAuB;EAC1C,2BAAW,IAAI,KAAK,uBAAuB;EAC3C,6BAAa,IAAI,KAAK,uBAAuB;EAC7C,OAAO,EAAE;EACT,MAAM,EAAE;EACT;CACD;EACE,IAAI;EACJ,gBAAgB;EAChB,SAAS;EACT,WAAW;EACX,QAAQ;EACR,OAAO;GAAE,SAAS;GAAkB,SAAS,EAAE,UAAU,KAAK;GAAE;EAChE,QAAQ;EACR,aAAa;EACb,cAAc;EACd,kBAAk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-
{"version":3,"file":"mock-tools.js","names":[],"sources":["../../src/shared/mock-tools.ts"],"sourcesContent":["/**\n * Mock tool data for testing and demos.\n */\nexport const MOCK_TOOLS = [\n {\n id: 'tool-1',\n organizationId: 'demo-org',\n name: 'Web Search',\n slug: 'web-search',\n description: 'Search the web for real-time information using Brave API.',\n category: 'RETRIEVAL' as const,\n status: 'ACTIVE' as const,\n parametersSchema: {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'Search query' },\n numResults: { type: 'number', default: 10 },\n },\n required: ['query'],\n },\n outputSchema: { type: 'array', items: { type: 'object' } },\n implementationType: 'http' as const,\n implementationConfig: {\n url: 'https://api.brave.com/search',\n method: 'GET',\n },\n maxInvocationsPerMinute: 60,\n timeoutMs: 30000,\n version: '1.0.0',\n tags: ['search', 'web'],\n createdAt: new Date('2024-01-01T00:00:00Z'),\n updatedAt: new Date('2024-02-15T10:00:00Z'),\n },\n {\n id: 'tool-2',\n organizationId: 'demo-org',\n name: 'SQL Query',\n slug: 'sql-query',\n description: 'Execute read-only SQL queries against the data warehouse.',\n category: 'RETRIEVAL' as const,\n status: 'ACTIVE' as const,\n parametersSchema: {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'SQL query' },\n maxRows: { type: 'number', default: 100 },\n },\n required: ['query'],\n },\n outputSchema: { type: 'object' },\n implementationType: 'function' as const,\n implementationConfig: { handler: 'executeSqlQuery' },\n maxInvocationsPerMinute: 30,\n timeoutMs: 60000,\n version: '1.1.0',\n tags: ['sql', 'database'],\n createdAt: new Date('2024-01-05T00:00:00Z'),\n updatedAt: new Date('2024-03-10T14:00:00Z'),\n },\n {\n id: 'tool-3',\n organizationId: 'demo-org',\n name: 'Email Sender',\n slug: 'email-sender',\n description: 'Send emails via SMTP or API.',\n category: 'COMMUNICATION' as const,\n status: 'ACTIVE' as const,\n parametersSchema: {\n type: 'object',\n properties: {\n to: { type: 'string' },\n subject: { type: 'string' },\n body: { type: 'string' },\n },\n required: ['to', 'subject', 'body'],\n },\n implementationType: 'http' as const,\n implementationConfig: { url: '/api/send-email', method: 'POST' },\n maxInvocationsPerMinute: 10,\n timeoutMs: 30000,\n version: '1.0.0',\n tags: ['email', 'communication'],\n createdAt: new Date('2024-02-01T00:00:00Z'),\n updatedAt: new Date('2024-02-01T00:00:00Z'),\n },\n {\n id: 'tool-4',\n organizationId: 'demo-org',\n name: 'GitHub Integration',\n slug: 'github-integration',\n description: 'Interact with GitHub repositories, PRs, and issues.',\n category: 'INTEGRATION' as const,\n status: 'ACTIVE' as const,\n parametersSchema: {\n type: 'object',\n properties: {\n action: {\n type: 'string',\n enum: ['list_prs', 'get_pr', 'create_comment'],\n },\n repo: { type: 'string' },\n params: { type: 'object' },\n },\n required: ['action', 'repo'],\n },\n implementationType: 'http' as const,\n implementationConfig: { url: 'https://api.github.com', auth: 'token' },\n maxInvocationsPerMinute: 100,\n timeoutMs: 15000,\n version: '2.0.0',\n tags: ['github', 'integration', 'code'],\n createdAt: new Date('2024-02-20T00:00:00Z'),\n updatedAt: new Date('2024-04-01T09:00:00Z'),\n },\n {\n id: 'tool-5',\n organizationId: 'demo-org',\n name: 'Calculator',\n slug: 'calculator',\n description: 'Perform mathematical calculations.',\n category: 'COMPUTATION' as const,\n status: 'ACTIVE' as const,\n parametersSchema: {\n type: 'object',\n properties: {\n expression: {\n type: 'string',\n description: 'Math expression to evaluate',\n },\n },\n required: ['expression'],\n },\n outputSchema: {\n type: 'object',\n properties: { result: { type: 'number' } },\n },\n implementationType: 'function' as const,\n implementationConfig: { handler: 'evaluateMath' },\n timeoutMs: 5000,\n version: '1.0.0',\n tags: ['math', 'utility'],\n createdAt: new Date('2024-01-10T00:00:00Z'),\n updatedAt: new Date('2024-01-10T00:00:00Z'),\n },\n];\n"],"mappings":";;;;AAGA,MAAa,aAAa;CACxB;EACE,IAAI;EACJ,gBAAgB;EAChB,MAAM;EACN,MAAM;EACN,aAAa;EACb,UAAU;EACV,QAAQ;EACR,kBAAkB;GAChB,MAAM;GACN,YAAY;I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EAChC,2BAAW,IAAI,KAAK,uBAAuB;EAC3C,2BAAW,IAAI,KAAK,uBAAuB;EAC5C;CACD;EACE,IAAI;EACJ,gBAAgB;EAChB,MAAM;EACN,MAAM;EACN,aAAa;EACb,UAAU;EACV,QAAQ;EACR,kBAAkB;GAChB,MAAM;GACN,YAAY;IACV,QAAQ;KACN,MAAM;KACN,MAAM;MAAC;MAAY;MAAU;MAAiB;KAC/C;IACD,MAAM,EAAE,MAAM,UAAU;IACxB,QAAQ,EAAE,MAAM,UAAU;IAC3B;GACD,UAAU,CAAC,UAAU,OAAO;GAC7B;EACD,oBAAoB;EACpB,sBAAsB;GAAE,KAAK;GAA0B,MAAM;GAAS;EACtE,yBAAyB;EACzB,WAAW;EACX,SAAS;EACT,MAAM;GAAC;GAAU;GAAe;GAAO;EACvC,2BAAW,IAAI,KAAK,uBAAuB;EAC3C,2BAAW,IAAI,KAAK,uBAAuB;EAC5C;CACD;EACE,IAAI;EACJ,gBAAgB;EAChB,MAAM;EACN,MAAM;EACN,aAAa;EACb,UAAU;EACV,QAAQ;EACR,kBAAkB;GAChB,MAAM;GACN,YAAY,EACV,YAAY;IACV,MAAM;IACN,aAAa;IACd,EACF;GACD,UAAU,CAAC,aAAa;GACzB;EACD,cAAc;GACZ,MAAM;GACN,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,EAAE;GAC3C;EACD,oBAAoB;EACpB,sBAAsB,EAAE,SAAS,gBAAgB;EACjD,WAAW;EACX,SAAS;EACT,MAAM,CAAC,QAAQ,UAAU;EACzB,2BAAW,IAAI,KAAK,uBAAuB;EAC3C,2BAAW,IAAI,KAAK,uBAAuB;EAC5C;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.entity.js","names":[],"sources":["../../src/tool/tool.entity.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Tool category enum for entities.\n */\nexport const ToolCategoryEntityEnum = defineEntityEnum({\n name: 'ToolCategory',\n values: [\n 'RETRIEVAL',\n 'COMPUTATION',\n 'COMMUNICATION',\n 'INTEGRATION',\n 'UTILITY',\n 'CUSTOM',\n ],\n description: 'Category of tool',\n});\n\n/**\n * Tool status enum for entities.\n */\nexport const ToolStatusEntityEnum = defineEntityEnum({\n name: 'ToolStatus',\n values: ['DRAFT', 'ACTIVE', 'DEPRECATED', 'DISABLED'],\n description: 'Status of tool',\n});\n\n/**\n * Implementation type enum for entities.\n */\nexport const ImplementationTypeEntityEnum = defineEntityEnum({\n name: 'ImplementationType',\n values: ['http', 'function', 'workflow'],\n description: 'How the tool is implemented',\n});\n\n/**\n * Tool entity - Represents an AI tool definition.\n */\nexport const ToolEntity = defineEntity({\n name: 'Tool',\n schema: 'agent_console',\n description: 'An AI tool that can be used by agents.',\n fields: {\n id: field.id(),\n organizationId: field.string({\n description: 'Organization that owns this tool',\n }),\n name: field.string({ description: 'Tool name' }),\n slug: field.string({ description: 'URL-safe identifier' }),\n description: field.string({ description: 'Tool description' }),\n category: field.enum('ToolCategory', { default: 'CUSTOM' }),\n status: field.enum('ToolStatus', { default: 'DRAFT' }),\n parametersSchema: field.json({\n description: 'JSON Schema for tool parameters',\n }),\n outputSchema: field.json({\n isOptional: true,\n description: 'JSON Schema for tool output',\n }),\n implementationType: field.enum('ImplementationType'),\n implementationConfig: field.json({\n description: 'Implementation configuration',\n }),\n maxInvocationsPerMinute: field.int({\n isOptional: true,\n description: 'Rate limit',\n }),\n timeoutMs: field.int({ default: 30000, description: 'Execution timeout' }),\n version: field.string({ default: '1.0.0', description: 'Tool version' }),\n tags: field.string({\n isArray: true,\n isOptional: true,\n description: 'Tags for categorization',\n }),\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n createdById: field.string({\n isOptional: true,\n description: 'User who created this tool',\n }),\n agents: field.hasMany('Agent', { description: 'Agents using this tool' }),\n },\n indexes: [\n index.unique(['organizationId', 'slug']),\n index.on(['organizationId', 'category']),\n index.on(['organizationId', 'status']),\n ],\n enums: [\n ToolCategoryEntityEnum,\n ToolStatusEntityEnum,\n ImplementationTypeEntityEnum,\n ],\n});\n"],"mappings":";;;;;;AAUA,MAAa,yBAAyB,iBAAiB;CACrD,MAAM;CACN,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACD;CACD,aAAa;CACd,CAAC;;;;AAKF,MAAa,uBAAuB,iBAAiB;CACnD,MAAM;CACN,QAAQ;EAAC;EAAS;EAAU;EAAc;EAAW;CACrD,aAAa;CACd,CAAC;;;;AAKF,MAAa,+BAA+B,iBAAiB;CAC3D,MAAM;CACN,QAAQ;EAAC;EAAQ;EAAY;EAAW;CACxC,aAAa;CACd,CAAC;;;;AAKF,MAAa,aAAa,aAAa;CACrC,MAAM;CACN,QAAQ;CACR,aAAa;CACb,QAAQ;EACN,IAAI,MAAM,IAAI;EACd,gBAAgB,MAAM,OAAO,EAC3B,aAAa,oCACd,CAAC;EACF,MAAM,MAAM,OAAO,EAAE,aAAa,aAAa,CAAC;EAChD,MAAM,MAAM,OAAO,EAAE,aAAa,uBAAuB,CAAC;EAC1D,aAAa,MAAM,OAAO,EAAE,aAAa,oBAAoB,CAAC;EAC9D,UAAU,MAAM,KAAK,gBAAgB,EAAE,SAAS,UAAU,CAAC;EAC3D,QAAQ,MAAM,KAAK,cAAc,EAAE,SAAS,SAAS,CAAC;EACtD,kBAAkB,MAAM,KAAK,EAC3B,aAAa,mCACd,CAAC;EACF,cAAc,MAAM,KAAK;GACvB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,oBAAoB,MAAM,KAAK,qBAAqB;EACpD,sBAAsB,MAAM,KAAK,EAC/B,aAAa,gCACd,CAAC;EACF,yBAAyB,MAAM,IAAI;GACjC,YAAY;GACZ,aAAa;GACd,CAAC;EACF,WAAW,MAAM,IAAI;GAAE,SAAS;GAAO,aAAa;GAAqB,CAAC;EAC1E,SAAS,MAAM,OAAO;GAAE,SAAS;GAAS,aAAa;GAAgB,CAAC;EACxE,MAAM,MAAM,OAAO;GACjB,SAAS;GACT,YAAY;GACZ,aAAa;GACd,CAAC;EACF,WAAW,MAAM,WAAW;EAC5B,WAAW,MAAM,WAAW;EAC5B,aAAa,MAAM,OAAO;GACxB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,QAAQ,MAAM,QAAQ,SAAS,EAAE,aAAa,0BAA0B,CAAC;EAC1E;CACD,SAAS;EACP,MAAM,OAAO,CAAC,kBAAkB,OAAO,CAAC;EACxC,MAAM,GAAG,CAAC,kBAAkB,WAAW,CAAC;EACxC,MAAM,GAAG,CAAC,kBAAkB,SAAS,CAAC;EACvC;CACD,OAAO;EACL;EACA;EACA;EACD;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.enum.js","names":[],"sources":["../../src/tool/tool.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Tool category enum.\n */\nexport const ToolCategoryEnum = defineEnum('ToolCategory', [\n 'RETRIEVAL',\n 'COMPUTATION',\n 'COMMUNICATION',\n 'INTEGRATION',\n 'UTILITY',\n 'CUSTOM',\n]);\n\n/**\n * Tool status enum.\n */\nexport const ToolStatusEnum = defineEnum('ToolStatus', [\n 'DRAFT',\n 'ACTIVE',\n 'DEPRECATED',\n 'DISABLED',\n]);\n\n/**\n * Implementation type enum.\n */\nexport const ImplementationTypeEnum = defineEnum('ImplementationType', [\n 'http',\n 'function',\n 'workflow',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,mBAAmB,WAAW,gBAAgB;CACzD;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,iBAAiB,WAAW,cAAc;CACrD;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,yBAAyB,WAAW,sBAAsB;CACrE;CACA;CACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.event.js","names":[],"sources":["../../src/tool/tool.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * Payload for tool created event.\n */\nconst ToolCreatedPayload = defineSchemaModel({\n name: 'ToolCreatedPayload',\n description: 'Payload for tool created event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n implementationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n createdById: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolCreatedEvent - A new tool was created.\n */\nexport const ToolCreatedEvent = defineEvent({\n meta: {\n key: 'agent.tool.created',\n version: '1.0.0',\n description: 'A new AI tool was created.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'created'],\n },\n payload: ToolCreatedPayload,\n});\n\n/**\n * Payload for tool updated event.\n */\nconst ToolUpdatedPayload = defineSchemaModel({\n name: 'ToolUpdatedPayload',\n description: 'Payload for tool updated event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n updatedFields: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: false,\n },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolUpdatedEvent - A tool was updated.\n */\nexport const ToolUpdatedEvent = defineEvent({\n meta: {\n key: 'agent.tool.updated',\n version: '1.0.0',\n description: 'An AI tool configuration was updated.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'updated'],\n },\n payload: ToolUpdatedPayload,\n});\n\n/**\n * Payload for tool status changed event.\n */\nconst ToolStatusChangedPayload = defineSchemaModel({\n name: 'ToolStatusChangedPayload',\n description: 'Payload for tool status changed event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n previousStatus: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolStatusChangedEvent - A tool's status was changed.\n */\nexport const ToolStatusChangedEvent = defineEvent({\n meta: {\n key: 'agent.tool.statusChanged',\n version: '1.0.0',\n description:\n 'An AI tool status was changed (activated, deprecated, disabled).',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'status'],\n },\n payload: ToolStatusChangedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAM,qBAAqB,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,oBAAoB;GAClB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;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UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aACE;EACF,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,SAAS;EACzB;CACD,SAAS;CACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.handler.js","names":[],"sources":["../../src/tool/tool.handler.ts"],"sourcesContent":["/**\n * Mock handlers for Tool contracts.\n */\nimport { MOCK_TOOLS } from '../shared/mock-tools';\n\nexport interface ListToolsInput {\n organizationId: string;\n category?:\n | 'RETRIEVAL'\n | 'COMPUTATION'\n | 'COMMUNICATION'\n | 'INTEGRATION'\n | 'UTILITY'\n | 'CUSTOM';\n status?: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'DISABLED';\n search?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface ToolSummary {\n id: string;\n name: string;\n slug: string;\n description: string;\n category:\n | 'RETRIEVAL'\n | 'COMPUTATION'\n | 'COMMUNICATION'\n | 'INTEGRATION'\n | 'UTILITY'\n | 'CUSTOM';\n status: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'DISABLED';\n version: string;\n createdAt: Date;\n}\n\nexport interface ListToolsOutput {\n items: ToolSummary[];\n total: number;\n hasMore: boolean;\n}\n\n/**\n * Mock handler for ListToolsQuery.\n */\nexport async function mockListToolsHandler(\n input: ListToolsInput\n): Promise<ListToolsOutput> {\n const {\n organizationId,\n category,\n status,\n search,\n limit = 20,\n offset = 0,\n } = input;\n\n let filtered = MOCK_TOOLS.filter((t) => t.organizationId === organizationId);\n if (category) filtered = filtered.filter((t) => t.category === category);\n if (status) filtered = filtered.filter((t) => t.status === status);\n if (search) {\n const q = search.toLowerCase();\n filtered = filtered.filter(\n (t) =>\n t.name.toLowerCase().includes(q) ||\n t.description.toLowerCase().includes(q)\n );\n }\n\n const total = filtered.length;\n const items = filtered.slice(offset, offset + limit).map((t) => ({\n id: t.id,\n name: t.name,\n slug: t.slug,\n description: t.description,\n category: t.category,\n status: t.status,\n version: t.version,\n createdAt: t.createdAt,\n }));\n\n return { items, total, hasMore: offset + limit < total };\n}\n\n/**\n * Mock handler for GetToolQuery.\n */\nexport async function mockGetToolHandler(input: { toolId: string }) {\n const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);\n if (!tool) throw new Error('TOOL_NOT_FOUND');\n return tool;\n}\n\n/**\n * Mock handler for CreateToolCommand.\n */\nexport async function mockCreateToolHandler(input: {\n organizationId: string;\n name: string;\n slug: string;\n description: string;\n implementationType: 'http' | 'function' | 'workflow';\n}) {\n const exists = MOCK_TOOLS.some(\n (t) => t.organizationId === input.organizationId && t.slug === input.slug\n );\n if (exists) throw new Error('SLUG_EXISTS');\n return {\n id: `tool-${Date.now()}`,\n name: input.name,\n slug: input.slug,\n status: 'DRAFT' as const,\n };\n}\n\n/**\n * Mock handler for UpdateToolCommand.\n */\nexport async function mockUpdateToolHandler(input: {\n toolId: string;\n name?: string;\n status?: 'DRAFT' | 'ACTIVE' | 'DEPRECATED' | 'DISABLED';\n}) {\n const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);\n if (!tool) throw new Error('TOOL_NOT_FOUND');\n return {\n id: tool.id,\n name: input.name ?? tool.name,\n status: input.status ?? tool.status,\n updatedAt: new Date(),\n };\n}\n\n/**\n * Mock handler for TestToolCommand.\n */\nexport async function mockTestToolHandler(input: {\n toolId: string;\n testInput: Record<string, unknown>;\n}) {\n const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);\n if (!tool) throw new Error('TOOL_NOT_FOUND');\n\n // Simulate tool execution\n const startTime = Date.now();\n await new Promise((resolve) => setTimeout(resolve, 100));\n\n return {\n success: true,\n output: { result: 'Test successful', input: input.testInput },\n durationMs: Date.now() - startTime,\n };\n}\n"],"mappings":";;;;;;;;;AA8CA,eAAsB,qBACpB,OAC0B;CAC1B,MAAM,EACJ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C,QAAO;EACL,IAAI,KAAK;EACT,MAAM,MAAM,QAAQ,KAAK;EACzB,QAAQ,MAAM,UAAU,KAAK;EAC7B,2BAAW,IAAI,MAAM;EACtB;;;;;AAMH,eAAsB,oBAAoB,OAGvC;AAED,KAAI,CADS,WAAW,MAAM,MAAM,EAAE,OAAO,MAAM,OAAO,CAC/C,OAAM,IAAI,MAAM,iBAAiB;CAG5C,MAAM,YAAY,KAAK,KAAK;AAC5B,OAAM,IAAI,SAAS,YAAY,WAAW,SAAS,IAAI,CAAC;AAExD,QAAO;EACL,SAAS;EACT,QAAQ;GAAE,QAAQ;GAAmB,OAAO,MAAM;GAAW;EAC7D,YAAY,KAAK,KAAK,GAAG;EAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.operation.js","names":[],"sources":["../../src/tool/tool.operation.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ToolCategoryEnum, ToolStatusEnum } from './tool.enum';\nimport {\n CreateToolInputModel,\n ToolModel,\n ToolSummaryModel,\n UpdateToolInputModel,\n} from './tool.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * CreateToolCommand - Creates a new tool definition.\n */\nexport const CreateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'create'],\n description: 'Creates a new AI tool definition.',\n goal: 'Allow users to define new tools that agents can use.',\n context: 'Called from the tool builder UI when creating a new tool.',\n },\n io: {\n input: CreateToolInputModel,\n output: defineSchemaModel({\n name: 'CreateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n },\n }),\n errors: {\n SLUG_EXISTS: {\n description: 'A tool with this slug already exists in the organization',\n http: 409,\n gqlCode: 'SLUG_EXISTS',\n when: 'Slug is already taken',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.created',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'created'],\n when: 'Tool is successfully created',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-tool-happy-path',\n given: ['User is authenticated', 'Organization exists'],\n when: ['User submits valid tool configuration'],\n then: ['New tool is created', 'ToolCreated event is emitted'],\n },\n {\n key: 'create-tool-slug-conflict',\n given: ['Tool with same slug exists'],\n when: ['User submits tool with duplicate slug'],\n then: ['SLUG_EXISTS error is returned'],\n },\n ],\n examples: [\n {\n key: 'create-api-tool',\n input: {\n name: 'Weather API',\n slug: 'weather-api',\n category: 'api',\n description: 'Fetches weather data',\n },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n slug: 'weather-api',\n status: 'draft',\n },\n },\n ],\n },\n});\n\n/**\n * UpdateToolCommand - Updates an existing tool.\n */\nexport const UpdateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.update',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'update'],\n description: 'Updates an existing AI tool definition.',\n goal: 'Allow users to modify tool settings and configuration.',\n context: 'Called from the tool settings UI.',\n },\n io: {\n input: UpdateToolInputModel,\n output: defineSchemaModel({\n name: 'UpdateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.updated',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'updated'],\n when: 'Tool is updated',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.updated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-tool-happy-path',\n given: ['Tool exists', 'User owns the tool'],\n when: ['User submits updated configuration'],\n then: ['Tool is updated', 'ToolUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'update-description',\n input: { toolId: 'tool-123', description: 'Updated weather API tool' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'draft',\n updatedAt: '2025-01-01T00:00:00Z',\n },\n },\n ],\n },\n});\n\n/**\n * GetToolQuery - Retrieves a tool by ID.\n */\nexport const GetToolQuery = defineQuery({\n meta: {\n key: 'agent.tool.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'get'],\n description: 'Retrieves a tool by its ID.',\n goal: 'View detailed tool configuration.',\n context: 'Called when viewing tool details or editing.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: ToolModel,\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-tool-happy-path',\n given: ['Tool exists'],\n when: ['User requests tool by ID'],\n then: ['Tool details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-basic',\n input: { toolId: 'tool-123' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'active',\n category: 'api',\n },\n },\n ],\n },\n});\n\n/**\n * ListToolsQuery - Lists tools for an organization.\n */\nexport const ListToolsQuery = defineQuery({\n meta: {\n key: 'agent.tool.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'list'],\n description: 'Lists tools for an organization with optional filtering.',\n goal: 'Browse and search available tools.',\n context: 'Tool list/dashboard view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListToolsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n category: { type: ToolCategoryEnum, isOptional: true },\n status: { type: ToolStatusEnum, isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'ListToolsOutput',\n fields: {\n items: { type: ToolSummaryModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-tools-happy-path',\n given: ['Organization has tools'],\n when: ['User lists tools'],\n then: ['Paginated list of tools is returned'],\n },\n ],\n examples: [\n {\n key: 'list-by-category',\n input: { organizationId: 'org-123', category: 'api', limit: 10 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * TestToolCommand - Tests a tool with sample input.\n */\nexport const TestToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.test',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'test'],\n description: 'Tests a tool with sample input to verify it works correctly.',\n goal: 'Validate tool configuration before deployment.',\n context: 'Tool builder UI - test panel.',\n },\n io: {\n input: defineSchemaModel({\n name: 'TestToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n testInput: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'TestToolOutput',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n error: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n TOOL_EXECUTION_ERROR: {\n description: 'Tool execution failed',\n http: 500,\n gqlCode: 'TOOL_EXECUTION_ERROR',\n when: 'Tool returns an error',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: { audit: ['tool.tested'] },\n acceptance: {\n scenarios: [\n {\n key: 'test-tool-success',\n given: ['Tool exists', 'Tool is configured correctly'],\n when: ['User runs test with valid input'],\n then: ['Tool executes successfully', 'Output is returned'],\n },\n {\n key: 'test-tool-failure',\n given: ['Tool exists', 'Tool has configuration error'],\n when: ['User runs test'],\n then: ['TOOL_EXECUTION_ERROR is returned'],\n },\n ],\n examples: [\n {\n key: 'test-weather-api',\n input: { toolId: 'tool-123', testInput: { city: 'Paris' } },\n output: { success: true, output: { temperature: 22 }, durationMs: 150 },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAaA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,oBAAoB,cAAc;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,SAAS;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ,kBAAkB;GACxB,MAAM;GACN,QAAQ;IACN,IAAI;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACjE,MAAM;KAAE,MAAM,eAAe,gBAAgB;KAAE,YAAY;KAAO;IAClE,MAAM;KAAE,MAAM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AE,SAAS;IAAM,QAAQ,EAAE,aAAa,IAAI;IAAE,YAAY;IAAK;GACxE,CACF;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.presentation.js","names":[],"sources":["../../src/tool/tool.presentation.ts"],"sourcesContent":["import { StabilityEnum, definePresentation } from '@contractspec/lib.contracts';\nimport { ToolSummaryModel } from './tool.schema';\n\n/**\n * Presentation for displaying a list of tools.\n */\nexport const ToolListPresentation = definePresentation({\n meta: {\n key: 'agent-console.tool.list',\n version: '1.0.0',\n title: 'Tool List',\n description:\n 'List view of AI tools with category, status, and version info',\n goal: 'Provide an overview of all available tools for agents.',\n context: 'Tool management dashboard.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['tool', 'list', 'dashboard'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ToolListView',\n props: ToolSummaryModel,\n },\n targets: ['react', 'markdown', 'application/json'],\n policy: { flags: ['agent-console.enabled'] },\n});\n\n/**\n * Presentation for tool detail view.\n */\nexport const ToolDetailPresentation = definePresentation({\n meta: {\n key: 'agent-console.tool.detail',\n version: '1.0.0',\n title: 'Tool Details',\n description:\n 'Detailed view of an AI tool with configuration and test panel',\n goal: 'Allow users to inspect and test a specific tool.',\n context: 'Detailed view of a tool.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['tool', 'detail'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ToolDetailView',\n },\n targets: ['react', 'markdown'],\n policy: { flags: ['agent-console.enabled'] },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,uBAAuB,mBAAmB;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM;GAAC;GAAQ;GAAQ;GAAY;EACnC,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS;EAAC;EAAS;EAAY;EAAmB;CAClD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C,CAAC;;;;AAKF,MAAa,yBAAyB,mBAAmB;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM,CAAC,QAAQ,SAAS;EACxB,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.schema.js","names":[],"sources":["../../src/tool/tool.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport {\n ToolCategoryEnum,\n ToolStatusEnum,\n ImplementationTypeEnum,\n} from './tool.enum';\n\n/**\n * AI tool definition.\n */\nexport const ToolModel = defineSchemaModel({\n name: 'Tool',\n description: 'AI tool definition',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ToolCategoryEnum, isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n implementationType: { type: ImplementationTypeEnum, isOptional: false },\n implementationConfig: {\n type: ScalarTypeEnum.JSONObject(),\n isOptional: false,\n },\n maxInvocationsPerMinute: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n timeoutMs: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n defaultValue: 30000,\n },\n version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n tags: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Summary of a tool for list views.\n */\nexport const ToolSummaryModel = defineSchemaModel({\n name: 'ToolSummary',\n description: 'Summary of a tool for list views',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ToolCategoryEnum, isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Input for creating a tool.\n */\nexport const CreateToolInputModel = defineSchemaModel({\n name: 'CreateToolInput',\n description: 'Input for creating a tool',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ToolCategoryEnum, isOptional: true },\n parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n implementationType: { type: ImplementationTypeEnum, isOptional: false },\n implementationConfig: {\n type: ScalarTypeEnum.JSONObject(),\n isOptional: false,\n },\n maxInvocationsPerMinute: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n tags: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n },\n});\n\n/**\n * Input for updating a tool.\n */\nexport const UpdateToolInputModel = defineSchemaModel({\n name: 'UpdateToolInput',\n description: 'Input for updating a tool',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: true },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ToolStatusEnum, isOptional: true },\n parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n implementationConfig: {\n type: ScalarTypeEnum.JSONObject(),\n isOptional: true,\n },\n maxInvocationsPerMinute: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n tags: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n },\n});\n"],"mappings":";;;;;;;AAUA,MAAa,YAAY,kBAAkB;CACzC,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,UAAU;GAAE,MAAM;GAAkB,YAAY;GAAO;EACvD,QAAQ;GAAE,MAAM;GAAgB,YAAY;GAAO;EACnD,kBAAkB;GAAE,MAAM,eAAe,YAAY;GAAE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"tool.test-spec.js","names":[],"sources":["../../src/tool/tool.test-spec.ts"],"sourcesContent":["import { defineTestSpec } from '@contractspec/lib.contracts';\n\nexport const toolListTest = defineTestSpec({\n meta: {\n key: 'test.agent.tool.list',\n version: '1.0.0',\n owners: ['@agent-console-team'],\n description: 'Test for listing tools',\n stability: 'stable',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'agent.tool.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'agent.tool.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'agent.tool.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const toolGetTest = defineTestSpec({\n meta: {\n key: 'test.agent.tool.get',\n version: '1.0.0',\n owners: ['@agent-console-team'],\n description: 'Test for getting tool',\n stability: 'stable',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'agent.tool.get', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'agent.tool.get' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'agent.tool.get' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n"],"mappings":";;;AAEA,MAAa,eAAe,eAAe;CACzC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,QAAQ,CAAC,sBAAsB;EAC/B,aAAa;EACb,WAAW;EACX,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAAmB,SAAS;GAAS;EACxD;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,mBAAmB,EAAE;EAC/C,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,mBAAmB,EAAE;EAC/C,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC;AAEF,MAAa,cAAc,eAAe;CACxC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,QAAQ,CAAC,sBAAsB;EAC/B,aAAa;EACb,WAAW;EACX,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAAkB,SAAS;GAAS;EACvD;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE;EAC9C,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE;EAC9C,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentDashboard.js","names":[],"sources":["../../src/ui/AgentDashboard.tsx"],"sourcesContent":["'use client';\n\n/**\n * Agent Console Dashboard\n *\n * Fully integrated with ContractSpec example handlers,\n * design-system components, and command mutations.\n *\n * Commands wired:\n * - CreateAgentCommand -> Create Agent button + modal\n * - UpdateAgentCommand -> Status changes via modal\n * - ExecuteAgentCommand -> Execute agent via modal\n */\nimport { useState, useMemo, useCallback } from 'react';\nimport {\n StatCard,\n StatCardGroup,\n Button,\n} from '@contractspec/lib.design-system';\n// import { AgentListView } from './views/AgentListView';\nimport { RunListView } from './views/RunListView';\nimport { ToolRegistryView } from './views/ToolRegistryView';\nimport { useRunList, type RunMetrics } from './hooks/useRunList';\nimport { useAgentList, type Agent } from './hooks/useAgentList';\nimport { useAgentMutations } from './hooks/useAgentMutations';\nimport { CreateAgentModal } from './modals/CreateAgentModal';\nimport { AgentActionsModal } from './modals/AgentActionsModal';\n\ntype Tab = 'runs' | 'agents' | 'tools' | 'metrics';\n\nexport function AgentDashboard() {\n const [activeTab, setActiveTab] = useState<Tab>('runs');\n const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);\n const [selectedAgent, setSelectedAgent] = useState<Agent | null>(null);\n const [isAgentActionsOpen, setIsAgentActionsOpen] = useState(false);\n\n const { metrics, refetch: refetchRuns } = useRunList();\n const { refetch: refetchAgents } = useAgentList();\n\n const mutations = useAgentMutations({\n onSuccess: () => {\n refetchAgents();\n refetchRuns();\n },\n });\n\n const handleAgentClick = useCallback((agent: Agent) => {\n setSelectedAgent(agent);\n setIsAgentActionsOpen(true);\n }, []);\n\n const tabs: { id: Tab; label: string; icon: string }[] = [\n { id: 'runs', label: 'Runs', icon: '▶' },\n { id: 'agents', label: 'Agents', icon: '🤖' },\n { id: 'tools', label: 'Tools', icon: '🔧' },\n { id: 'metrics', label: 'Metrics', icon: '📊' },\n ];\n\n // Compute summary stats from metrics\n const summaryStats = useMemo(() => {\n if (!metrics) {\n return [\n { label: 'Total Runs', value: '-', hint: 'Loading...' },\n { label: 'Success Rate', value: '-', hint: '' },\n { label: 'Total Tokens', value: '-', hint: '' },\n { label: 'Total Cost', value: '-', hint: '' },\n ];\n }\n return [\n {\n label: 'Total Runs',\n value: metrics.totalRuns.toLocaleString(),\n hint: `${(metrics.successRate * 100).toFixed(0)}% success`,\n },\n {\n label: 'Success Rate',\n value: `${(metrics.successRate * 100).toFixed(0)}%`,\n hint: 'of all runs',\n },\n {\n label: 'Total Tokens',\n value:\n metrics.totalTokens >= 1000000\n ? `${(metrics.totalTokens / 1000000).toFixed(1)}M`\n : `${(metrics.totalTokens / 1000).toFixed(0)}K`,\n hint: 'This period',\n },\n {\n label: 'Total Cost',\n value: `$${metrics.totalCostUsd.toFixed(2)}`,\n hint: 'This period',\n },\n ];\n }, [metrics]);\n\n return (\n <div className=\"space-y-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-2xl font-bold\">AI Agent Console</h2>\n <Button onPress={() => setIsCreateModalOpen(true)}>\n <span className=\"mr-2\">+</span> New Agent\n </Button>\n </div>\n\n {/* Summary Stats Row */}\n <StatCardGroup>\n {summaryStats.map((stat, i) => (\n <StatCard\n key={i}\n label={stat.label}\n value={stat.value}\n hint={stat.hint}\n />\n ))}\n </StatCardGroup>\n\n {/* Navigation Tabs */}\n <nav className=\"bg-muted flex gap-1 rounded-lg p-1\" role=\"tablist\">\n {tabs.map((tab) => (\n <button\n key={tab.id}\n type=\"button\"\n role=\"tab\"\n aria-selected={activeTab === tab.id}\n onClick={() => setActiveTab(tab.id)}\n className={`flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors ${\n activeTab === tab.id\n ? 'bg-background text-foreground shadow-sm'\n : 'text-muted-foreground hover:text-foreground'\n }`}\n >\n <span>{tab.icon}</span>\n {tab.label}\n </button>\n ))}\n </nav>\n\n {/* Tab Content */}\n <div className=\"min-h-[400px]\" role=\"tabpanel\">\n {activeTab === 'runs' && <RunListView />}\n {activeTab === 'agents' && (\n <AgentListViewWithActions onAgentClick={handleAgentClick} />\n )}\n {activeTab === 'tools' && <ToolRegistryView />}\n {activeTab === 'metrics' && <MetricsView metrics={metrics} />}\n </div>\n\n {/* Create Agent Modal */}\n <CreateAgentModal\n isOpen={isCreateModalOpen}\n onClose={() => setIsCreateModalOpen(false)}\n onSubmit={async (input) => {\n await mutations.createAgent(input);\n }}\n isLoading={mutations.createState.loading}\n />\n\n {/* Agent Actions Modal */}\n <AgentActionsModal\n isOpen={isAgentActionsOpen}\n agent={selectedAgent}\n onClose={() => {\n setIsAgentActionsOpen(false);\n setSelectedAgent(null);\n }}\n onActivate={async (agentId) => {\n await mutations.activateAgent(agentId);\n }}\n onPause={async (agentId) => {\n await mutations.pauseAgent(agentId);\n }}\n onArchive={async (agentId) => {\n await mutations.archiveAgent(agentId);\n }}\n onExecute={async (agentId, message) => {\n await mutations.executeAgent({ agentId, message });\n }}\n isLoading={mutations.isLoading}\n />\n </div>\n );\n}\n\n/**\n * Agent List View with click handler\n */\nfunction AgentListViewWithActions({\n onAgentClick,\n}: {\n onAgentClick: (agent: Agent) => void;\n}) {\n const { data, loading, error, stats, refetch } = useAgentList();\n\n if (loading && !data) {\n return (\n <div className=\"text-muted-foreground flex h-64 items-center justify-center\">\n Loading agents...\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"text-destructive flex h-64 flex-col items-center justify-center\">\n <p>Failed to load agents: {error.message}</p>\n <Button variant=\"outline\" onPress={refetch} className=\"mt-2\">\n Retry\n </Button>\n </div>\n );\n }\n\n if (!data?.items.length) {\n return (\n <div className=\"text-muted-foreground flex h-64 flex-col items-center justify-center\">\n <p className=\"text-lg font-medium\">No agents yet</p>\n <p className=\"text-sm\">Create your first AI agent to get started.</p>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4\">\n {/* Stats */}\n {stats && (\n <div className=\"flex gap-4 text-sm\">\n <span>Total: {stats.total}</span>\n <span className=\"text-green-600\">Active: {stats.active}</span>\n <span className=\"text-yellow-600\">Paused: {stats.paused}</span>\n <span className=\"text-blue-600\">Draft: {stats.draft}</span>\n </div>\n )}\n\n {/* Agent Grid */}\n <div className=\"grid gap-4 md:grid-cols-2 lg:grid-cols-3\">\n {data.items.map((agent) => (\n <AgentCard\n key={agent.id}\n agent={agent}\n onClick={() => onAgentClick(agent)}\n />\n ))}\n </div>\n </div>\n );\n}\n\n/**\n * Agent Card Component\n */\nfunction AgentCard({ agent, onClick }: { agent: Agent; onClick: () => void }) {\n const statusColors: Record<string, string> = {\n ACTIVE:\n 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400',\n DRAFT: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400',\n PAUSED:\n 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400',\n ARCHIVED: 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400',\n };\n\n return (\n <div\n onClick={onClick}\n className=\"border-border bg-card cursor-pointer rounded-xl border p-4 transition-all hover:shadow-md\"\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') onClick();\n }}\n >\n <div className=\"flex items-start justify-between\">\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"truncate font-semibold\">{agent.name}</h3>\n <p className=\"text-muted-foreground text-sm\">\n {agent.modelProvider} / {agent.modelName}\n </p>\n </div>\n <span\n className={`rounded-full px-2 py-0.5 text-xs font-medium ${statusColors[agent.status]}`}\n >\n {agent.status}\n </span>\n </div>\n {agent.description && (\n <p className=\"text-muted-foreground mt-2 line-clamp-2 text-sm\">\n {agent.description}\n </p>\n )}\n <div className=\"mt-3 flex items-center justify-between\">\n <span className=\"text-muted-foreground text-xs\">{agent.modelName}</span>\n <Button variant=\"ghost\" size=\"sm\" onPress={onClick}>\n Actions\n </Button>\n </div>\n </div>\n );\n}\n\n/**\n * Metrics View - Shows usage analytics\n */\nfunction MetricsView({ metrics }: { metrics: RunMetrics | null }) {\n if (!metrics) {\n return (\n <div className=\"text-muted-foreground flex h-64 items-center justify-center\">\n Loading metrics...\n </div>\n );\n }\n\n // Calculate derived metrics\n const completedRuns = Math.round(metrics.totalRuns * metrics.successRate);\n const failedRuns = metrics.totalRuns - completedRuns;\n\n return (\n <div className=\"space-y-6\">\n <h3 className=\"text-lg font-semibold\">Usage Analytics</h3>\n\n <div className=\"grid gap-6 md:grid-cols-2\">\n {/* Success/Failure breakdown */}\n <div className=\"border-border bg-card rounded-xl border p-4\">\n <h4 className=\"font-medium\">Run Outcomes</h4>\n <div className=\"mt-4 space-y-3\">\n <ProgressBar\n label=\"Completed\"\n value={completedRuns}\n total={metrics.totalRuns}\n color=\"bg-green-500\"\n />\n <ProgressBar\n label=\"Failed\"\n value={failedRuns}\n total={metrics.totalRuns}\n color=\"bg-red-500\"\n />\n </div>\n </div>\n\n {/* Key Stats */}\n <div className=\"border-border bg-card rounded-xl border p-4\">\n <h4 className=\"font-medium\">Performance</h4>\n <dl className=\"mt-4 grid grid-cols-2 gap-4\">\n <div>\n <dt className=\"text-muted-foreground text-sm\">Avg Duration</dt>\n <dd className=\"text-xl font-semibold\">\n {(metrics.averageDurationMs / 1000).toFixed(1)}s\n </dd>\n </div>\n <div>\n <dt className=\"text-muted-foreground text-sm\">Success Rate</dt>\n <dd className=\"text-xl font-semibold\">\n {(metrics.successRate * 100).toFixed(0)}%\n </dd>\n </div>\n </dl>\n </div>\n </div>\n\n {/* Key Metrics */}\n <div className=\"border-border bg-card rounded-xl border p-4\">\n <h4 className=\"font-medium\">Key Metrics</h4>\n <dl className=\"mt-4 grid gap-4 sm:grid-cols-3\">\n <div>\n <dt className=\"text-muted-foreground text-sm\">Total Runs</dt>\n <dd className=\"text-2xl font-semibold\">\n {metrics.totalRuns.toLocaleString()}\n </dd>\n </div>\n <div>\n <dt className=\"text-muted-foreground text-sm\">Total Tokens</dt>\n <dd className=\"text-2xl font-semibold\">\n {(metrics.totalTokens / 1000).toFixed(0)}K\n </dd>\n </div>\n <div>\n <dt className=\"text-muted-foreground text-sm\">Cost per Run</dt>\n <dd className=\"text-2xl font-semibold\">\n $\n {metrics.totalRuns > 0\n ? (metrics.totalCostUsd / metrics.totalRuns).toFixed(4)\n : '0'}\n </dd>\n </div>\n </dl>\n </div>\n </div>\n );\n}\n\nfunction ProgressBar({\n label,\n value,\n total,\n color,\n}: {\n label: string;\n value: number;\n total: number;\n color: string;\n}) {\n const pct = total > 0 ? (value / total) * 100 : 0;\n return (\n <div>\n <div className=\"flex justify-between text-sm\">\n <span>{label}</span>\n <span className=\"text-muted-foreground\">\n {value} ({pct.toFixed(0)}%)\n </span>\n </div>\n <div className=\"bg-muted mt-1 h-2 overflow-hidden rounded-full\">\n <div className={`h-full ${color}`} style={{ width: `${pct}%` }} />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,iBAAiB;CAC/B,MAAM,CAAC,WAAW,gBAAgB,SAAc,OAAO;CACvD,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,MAAM;CACjE,MAA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Ac,KAAK,QAAQ,EAAE,EAAC;QACrC,IACD;OACH;MACD;KACF;GAGN,qBAAC;IAAI,WAAU;eACb,oBAAC;KAAG,WAAU;eAAc;MAAgB,EAC5C,qBAAC;KAAG,WAAU;;MACZ,qBAAC,oBACC,oBAAC;OAAG,WAAU;iBAAgC;QAAe,EAC7D,oBAAC;OAAG,WAAU;iBACX,QAAQ,UAAU,gBAAgB;QAChC,IACD;MACN,qBAAC,oBACC,oBAAC;OAAG,WAAU;iBAAgC;QAAiB,EAC/D,qBAAC;OAAG,WAAU;mBACV,QAAQ,cAAc,KAAM,QAAQ,EAAE,EAAC;QACtC,IACD;MACN,qBAAC,oBACC,oBAAC;OAAG,WAAU;iBAAgC;QAAiB,EAC/D,qBAAC;OAAG,WAAU;kBAAyB,KAEpC,QAAQ,YAAY,KAChB,QAAQ,eAAe,QAAQ,WAAW,QAAQ,EAAE,GACrD;QACD,IACD;;MACH;KACD;;GACF;;AAIV,SAAS,YAAY,EACnB,OACA,OACA,OACA,SAMC;CACD,MAAM,MAAM,QAAQ,IAAK,QAAQ,QAAS,MAAM;AAChD,QACE,qBAAC,oBACC,qBAAC;EAAI,WAAU;aACb,oBAAC,oBAAM,QAAa,EACpB,qBAAC;GAAK,WAAU;;IACb;IAAM;IAAG,IAAI,QAAQ,EAAE;IAAC;;IACpB;GACH,EACN,oBAAC;EAAI,WAAU;YACb,oBAAC;GAAI,WAAW,UAAU;GAAS,OAAO,EAAE,OAAO,GAAG,IAAI,IAAI;IAAI;GAC9D,IACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAgentList.js","names":[],"sources":["../../../src/ui/hooks/useAgentList.ts"],"sourcesContent":["/**\n * Hook for fetching and managing agent list data\n *\n * Uses runtime-local database-backed handlers.\n */\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useTemplateRuntime } from '@contractspec/lib.example-shared-ui';\nimport type {\n Agent as RuntimeAgent,\n ListAgentsOutput as RuntimeListAgentsOutput,\n} from '../../handlers/agent.handlers';\nimport type { AgentHandlers } from '../../handlers/agent.handlers';\n\n// Re-export types for convenience\nexport type Agent = RuntimeAgent;\nexport type ListAgentsOutput = RuntimeListAgentsOutput;\n\nexport interface UseAgentListOptions {\n search?: string;\n status?: 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ARCHIVED' | 'all';\n limit?: number;\n}\n\nexport function useAgentList(options: UseAgentListOptions = {}) {\n const { handlers, projectId } = useTemplateRuntime<{\n agent: AgentHandlers;\n }>();\n const { agent } = handlers;\n\n const [data, setData] = useState<ListAgentsOutput | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const [page, setPage] = useState(1);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n\n try {\n const result = await agent.listAgents({\n projectId,\n search: options.search,\n status: options.status === 'all' ? undefined : options.status,\n limit: options.limit ?? 20,\n offset: (page - 1) * (options.limit ?? 20),\n });\n setData(result);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Unknown error'));\n } finally {\n setLoading(false);\n }\n }, [agent, projectId, options.search, options.status, options.limit, page]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n // Calculate stats\n const stats = useMemo(() => {\n if (!data) return null;\n return {\n total: data.total,\n active: data.items.filter((a) => a.status === 'ACTIVE').length,\n paused: data.items.filter((a) => a.status === 'PAUSED').length,\n draft: data.items.filter((a) => a.status === 'DRAFT').length,\n };\n }, [data]);\n\n return {\n data,\n loading,\n error,\n stats,\n page,\n refetch: fetchData,\n nextPage: () => setPage((p) => p + 1),\n prevPage: () => page > 1 && setPage((p) => p - 1),\n };\n}\n"],"mappings":";;;;;;;;;AAuBA,SAAgB,aAAa,UAA+B,EAAE,EAAE;CAC9D,MAAM,EAAE,UAAU,cAAc,oBAE5B;CACJ,MAAM,EAAE,UAAU;CAElB,MAAM,CAAC,MAAM,WAAW,SAAkC,KAAK;CAC/D,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;CACtD,MAAM,CAAC,MAAM,WAAW,SAAS,EAAE;CAEnC,MAAM,YAAY,YAAY,YAAY;AACxC,aAAW,KAAK;AAChB,WAAS,KAAK;AAEd,MAAI;AAQF,WAPe,MAAM,MAAM,WAAW;IACpC;IACA,QAAQ,QAAQ;IAChB,QAAQ,QAAQ,WAAW,QAAQ,SAAY,QAAQ;IACvD,OAAO,QAAQ,SAAS;IACxB,SAAS,OAAO,MAAM,QAAQ,SAAS;IACxC,CAAC,CACa;WACR,KAAK;AACZ,YAAS,eAAe,QAAQ,sBAAM,IAAI,MAAM,gBAAgB,CAAC;YACzD;AACR,cAAW,MAAM;;IAElB;EAAC;EAAO;EAAW,QAAQ;EAAQ,QAAQ;EAAQ,QAAQ;EAAO;EAAK,CAAC;AAE3E,iBAAgB;AACd,aAAW;IACV,CAAC,UAAU,CAAC;AAaf,QAAO;EACL;EACA;EACA;EACA,OAdY,cAAc;AAC1B,OAAI,CAAC,KAAM,QAAO;AAClB,UAAO;IACL,OAAO,KAAK;IACZ,QAAQ,KAAK,MAAM,QAAQ,MAAM,EAAE,WAAW,SAAS,CAAC;IACxD,QAAQ,KAAK,MAAM,QAAQ,MAAM,EAAE,WAAW,SAAS,CAAC;IACxD,OAAO,KAAK,MAAM,QAAQ,MAAM,EAAE,WAAW,QAAQ,CAAC;IACvD;KACA,CAAC,KAAK,CAAC;EAOR;EACA,SAAS;EACT,gBAAgB,SAAS,MAAM,IAAI,EAAE;EACrC,gBAAgB,OAAO,KAAK,SAAS,MAAM,IAAI,EAAE;EAClD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAgentMutations.js","names":[],"sources":["../../../src/ui/hooks/useAgentMutations.ts"],"sourcesContent":["/**\n * Hook for Agent Console mutations (commands)\n *\n * Uses runtime-local database-backed handlers for:\n * - CreateAgentCommand\n * - UpdateAgentCommand\n */\nimport { useCallback, useState } from 'react';\nimport { useTemplateRuntime } from '@contractspec/lib.example-shared-ui';\nimport type {\n Agent,\n CreateAgentInput,\n UpdateAgentInput,\n AgentHandlers,\n} from '../../handlers/agent.handlers';\n\nexport interface MutationState<T> {\n loading: boolean;\n error: Error | null;\n data: T | null;\n}\n\nexport interface UseAgentMutationsOptions {\n onSuccess?: () => void;\n onError?: (error: Error) => void;\n}\n\nexport function useAgentMutations(options: UseAgentMutationsOptions = {}) {\n const { handlers, projectId } = useTemplateRuntime<{\n agent: AgentHandlers;\n }>();\n const { agent } = handlers;\n\n const [createState, setCreateState] = useState<MutationState<Agent>>({\n loading: false,\n error: null,\n data: null,\n });\n\n const [updateState, setUpdateState] = useState<MutationState<Agent>>({\n loading: false,\n error: null,\n data: null,\n });\n\n /**\n * Create a new agent\n */\n const createAgent = useCallback(\n async (input: CreateAgentInput): Promise<Agent | null> => {\n setCreateState({ loading: true, error: null, data: null });\n try {\n const result = await agent.createAgent(input, {\n projectId,\n organizationId: 'demo-org',\n });\n setCreateState({ loading: false, error: null, data: result });\n options.onSuccess?.();\n return result;\n } catch (err) {\n const error =\n err instanceof Error ? err : new Error('Failed to create agent');\n setCreateState({ loading: false, error, data: null });\n options.onError?.(error);\n return null;\n }\n },\n [agent, projectId, options]\n );\n\n /**\n * Update an agent (name, status)\n */\n const updateAgent = useCallback(\n async (input: UpdateAgentInput): Promise<Agent | null> => {\n setUpdateState({ loading: true, error: null, data: null });\n try {\n const result = await agent.updateAgent(input);\n setUpdateState({ loading: false, error: null, data: result });\n options.onSuccess?.();\n return result;\n } catch (err) {\n const error =\n err instanceof Error ? err : new Error('Failed to update agent');\n setUpdateState({ loading: false, error, data: null });\n options.onError?.(error);\n return null;\n }\n },\n [agent, options]\n );\n\n /**\n * Activate an agent\n */\n const activateAgent = useCallback(\n async (agentId: string): Promise<Agent | null> => {\n return updateAgent({ id: agentId, status: 'ACTIVE' });\n },\n [updateAgent]\n );\n\n /**\n * Pause an agent\n */\n const pauseAgent = useCallback(\n async (agentId: string): Promise<Agent | null> => {\n return updateAgent({ id: agentId, status: 'PAUSED' });\n },\n [updateAgent]\n );\n\n /**\n * Archive an agent\n */\n const archiveAgent = useCallback(\n async (agentId: string): Promise<Agent | null> => {\n return updateAgent({ id: agentId, status: 'ARCHIVED' });\n },\n [updateAgent]\n );\n\n /**\n * Execute an agent (placeholder - needs run handler)\n * Note: Execute functionality requires adding createRun/executeRun to agent handlers\n */\n const executeAgent = useCallback(\n async (input: { agentId: string; message: string }): Promise<null> => {\n // TODO: Implement execute when run creation handler is added to runtime-local\n console.log('Execute agent:', input);\n options.onSuccess?.();\n return null;\n },\n [options]\n );\n\n return {\n // Mutations\n createAgent,\n updateAgent,\n activateAgent,\n pauseAgent,\n archiveAgent,\n executeAgent,\n\n // State\n createState,\n updateState,\n\n // Convenience\n isLoading: createState.loading || updateState.loading,\n };\n}\n\n// Re-export types for convenience\nexport type { CreateAgentInput, UpdateAgentInput, Agent };\n"],"mappings":";;;;;;;;;;;AA2BA,SAAgB,kBAAkB,UAAoC,EAAE,EAAE;CACxE,MAAM,EAAE,UAAU,cAAc,oBAE5B;CACJ,MAAM,EAAE,UAAU;CAElB,MAAM,CAAC,aAAa,kBAAkB,SAA+B;EACnE,SAAS;EACT,OAAO;EACP,MAAM;EACP,CAAC;CAEF,MAAM,CAAC,aAAa,kBAAkB,SAA+B;EACnE,SAAS;EACT,OAAO;EACP,MAAM;EACP,CAAC;;;;CAKF,MAAM,cAAc,YAClB,OAAO,UAAmD;AACxD,iBAAe;GAAE,SAAS;GAAM,OAAO;GAAM,MAAM;GAAM,CAAC;AAC1D,MAAI;GACF,MAAM,SAAS,MAAM,MAAM,YAAY,OAAO;IAC5C;IACA,gBAAgB;IACjB,CAAC;AACF,kBAAe;IAAE,SAAS;IAAO,OAAO;IAAM,MAAM;IAAQ,CAAC;AAC7D,WAAQ,aAAa;AACrB,UAAO;WACA,KAAK;GACZ,MAAM,QACJ,eAAe,QAAQ,sBAAM,IAAI,MAAM,yBAAyB;AAClE,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ing run list data\n *\n * Uses runtime-local database-backed handlers.\n */\nimport { useCallback, useEffect, useState } from 'react';\nimport { useTemplateRuntime } from '@contractspec/lib.example-shared-ui';\nimport type {\n ListRunsOutput as RuntimeListRunsOutput,\n Run as RuntimeRun,\n RunMetrics as RuntimeRunMetrics,\n AgentHandlers,\n} from '../../handlers/agent.handlers';\n\n// Re-export types for convenience\nexport type Run = RuntimeRun;\nexport type ListRunsOutput = RuntimeListRunsOutput;\nexport type RunMetrics = RuntimeRunMetrics;\n\nexport interface UseRunListOptions {\n agentId?: string;\n status?: Run['status'] | 'all';\n limit?: number;\n}\n\nexport function useRunList(options: UseRunListOptions = {}) {\n const { handlers, projectId } = useTemplateRuntime<{\n agent: AgentHandlers;\n }>();\n const { agent } = handlers;\n\n const [data, setData] = useState<ListRunsOutput | null>(null);\n const [metrics, setMetrics] = useState<RunMetrics | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const [page, setPage] = useState(1);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n\n try {\n const [runsResult, metricsResult] = await Promise.all([\n agent.listRuns({\n projectId,\n agentId: options.agentId,\n status: options.status === 'all' ? undefined : options.status,\n limit: options.limit ?? 20,\n offset: (page - 1) * (options.limit ?? 20),\n }),\n agent.getRunMetrics({\n projectId,\n agentId: options.agentId,\n startDate: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days ago\n endDate: new Date(),\n }),\n ]);\n setData(runsResult);\n setMetrics(metricsResult);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Unknown error'));\n } finally {\n setLoading(false);\n }\n }, [agent, projectId, options.agentId, options.status, options.limit, page]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n return {\n data,\n metrics,\n loading,\n error,\n page,\n refetch: fetchData,\n nextPage: () => setPage((p) => p + 1),\n prevPage: () => page > 1 && setPage((p) => p - 1),\n };\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAgB,WAAW,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/useToolList.ts"],"sourcesContent":["/**\n * Hook for fetching and managing tool list data\n *\n * Uses runtime-local database-backed handlers.\n */\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useTemplateRuntime } from '@contractspec/lib.example-shared-ui';\nimport type {\n ListToolsOutput as RuntimeListToolsOutput,\n Tool as RuntimeTool,\n AgentHandlers,\n} from '../../handlers/agent.handlers';\n\n// Re-export types for convenience\nexport type Tool = RuntimeTool;\nexport type ListToolsOutput = RuntimeListToolsOutput;\n\nexport type ToolCategory = Tool['category'];\nexport type ToolStatus = Tool['status'];\n\nexport interface UseToolListOptions {\n search?: string;\n category?: ToolCategory;\n status?: ToolStatus | 'all';\n limit?: number;\n}\n\nexport function useToolList(options: UseToolListOptions = {}) {\n const { handlers, projectId } = useTemplateRuntime<{\n agent: AgentHandlers;\n }>();\n const { agent } = handlers;\n\n const [data, setData] = useState<ListToolsOutput | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const [page, setPage] = useState(1);\n\n const fetchData = useCallback(async () => {\n setLoading(true);\n setError(null);\n\n try {\n const result = await agent.listTools({\n projectId,\n search: options.search,\n category: options.category,\n status: options.status === 'all' ? undefined : options.status,\n limit: options.limit ?? 50,\n offset: (page - 1) * (options.limit ?? 50),\n });\n setData(result);\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Unknown error'));\n } finally {\n setLoading(false);\n }\n }, [\n agent,\n projectId,\n options.search,\n options.category,\n options.status,\n options.limit,\n page,\n ]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n // Calculate stats and grouping\n const { stats, groupedByCategory, categoryStats } = useMemo(() => {\n if (!data) return { stats: null, groupedByCategory: {}, categoryStats: [] };\n const items = data.items;\n\n const active = items.filter((t) => t.status === 'ACTIVE').length;\n const deprecated = items.filter((t) => t.status === 'DEPRECATED').length;\n const disabled = items.filter((t) => t.status === 'DISABLED').length;\n\n // Group by category\n const grouped: Record<string, Tool[]> = {};\n const byCategory: Record<string, number> = {};\n\n items.forEach((t) => {\n const cat = t.category;\n if (!grouped[cat]) grouped[cat] = [];\n grouped[cat].push(t);\n byCategory[cat] = (byCategory[cat] || 0) + 1;\n });\n\n // Category stats sorted by count\n const catStats = Object.entries(byCategory)\n .map(([category, count]) => ({ category, count }))\n .sort((a, b) => b.count - a.count);\n\n return {\n stats: {\n total: data.total,\n active,\n deprecated,\n disabled,\n topCategories: catStats.slice(0, 5),\n },\n groupedByCategory: grouped,\n categoryStats: catStats,\n };\n }, [data]);\n\n return {\n data,\n loading,\n error,\n stats,\n groupedByCategory,\n categoryStats,\n page,\n refetch: fetchData,\n nextPage: () => setPage((p) => p + 1),\n prevPage: () => page > 1 && setPage((p) => p - 1),\n };\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,YAAY,UAA8B,EAAE,EAAE;CAC5D,MAAM,EAAE,UAAU,cAAc,oBAE5B;CACJ,MAAM,EAAE,UAAU;CAElB,MAAM,CAAC,MAAM,WAAW,SAAiC,KAAK;CAC9D,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;CACtD,MAAM,CAAC,MAAM,WAAW,SAAS,EAAE;CAEnC,MAAM,YAAY,YAAY,YAAY;AACxC,aAAW,KAAK;AAChB,WAAS,KAAK;AAEd,MAAI;AASF,WARe,MAAM,MAAM,UAAU;IACnC;IACA,QAAQ,QAAQ;IAChB,UAAU,QAAQ;IAClB,QAAQ,QAAQ,WAAW,QAAQ,SAAY,QAAQ;IACvD,OAAO,QAAQ,SAAS;IACxB,SAAS,OAAO,MAAM,QAAQ,SAAS;IACxC,CAAC,CACa;WACR,KAAK;AACZ,YAAS,eAAe,QAAQ,sBAAM,IAAI,MAAM,gBAAgB,CAAC;YACzD;AACR,cAAW,MAAM;;IAElB;EACD;EACA;EACA,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR;EACD,CAAC;AAEF,iBAAgB;AACd,aAAW;IACV,CAAC,UAAU,CAAC;CAGf,MAAM,EAAE,OAAO,mBAAmB,kBAAkB,cAAc;AAChE,MAAI,CAAC,KAAM,QAAO;GAAE,OAAO;GAAM,mBAAmB,EAAE;GAAE,eAAe,EAAE;GAAE;EAC3E,MAAM,QAAQ,KAAK;EAEnB,MAAM,SAAS,MAAM,QAAQ,MAAM,EAAE,WAAW,SAAS,CAAC;EAC1D,MAAM,aAAa,MAAM,QAAQ,MAAM,EAAE,WAAW,aAAa,CAAC;EAClE,MAAM,WAAW,MAAM,QAAQ,MAAM,EAAE,WAAW,WAAW,CAAC;EAG9D,MAAM,UAAkC,EAAE;EAC1C,MAAM,aAAqC,EAAE;AAE7C,QAAM,SAAS,MAAM;GACnB,MAAM,MAAM,EAAE;AACd,OAAI,CAAC,QAAQ,KAAM,SAAQ,OAAO,EAAE;AACpC,WAAQ,KAAK,KAAK,EAAE;AACpB,cAAW,QAAQ,WAAW,QAAQ,KAAK;IAC3C;EAGF,MAAM,WAAW,OAAO,QAAQ,WAAW,CACxC,KAAK,CAAC,UAAU,YAAY;GAAE;GAAU;GAAO,EAAE,CACjD,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM;AAEpC,SAAO;GACL,OAAO;IACL,OAAO,KAAK;IACZ;IACA;IACA;IACA,eAAe,SAAS,MAAM,GAAG,EAAE;IACpC;GACD,mBAAmB;GACnB,eAAe;GAChB;IACA,CAAC,KAAK,CAAC;AAEV,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,gBAAgB,SAAS,MAAM,IAAI,EAAE;EACrC,gBAAgB,OAAO,KAAK,SAAS,MAAM,IAAI,EAAE;EAClD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentActionsModal.js","names":[],"sources":["../../../src/ui/modals/AgentActionsModal.tsx"],"sourcesContent":["'use client';\n\n/**\n * AgentActionsModal - Actions for a specific agent\n *\n * Wires to UpdateAgentCommand via useAgentMutations hook.\n */\nimport { useState } from 'react';\nimport { Button } from '@contractspec/lib.design-system';\nimport type { Agent } from '../hooks/useAgentList';\n\ntype ActionMode = 'menu' | 'execute' | 'confirm';\n\ninterface AgentActionsModalProps {\n isOpen: boolean;\n agent: Agent | null;\n onClose: () => void;\n onActivate: (agentId: string) => Promise<void>;\n onPause: (agentId: string) => Promise<void>;\n onArchive: (agentId: string) => Promise<void>;\n onExecute: (agentId: string, message: string) => Promise<void>;\n isLoading?: boolean;\n}\n\nfunction getStatusColor(status: Agent['status']): string {\n switch (status) {\n case 'ACTIVE':\n return 'text-green-600 bg-green-100 dark:text-green-400 dark:bg-green-900/30';\n case 'DRAFT':\n return 'text-blue-600 bg-blue-100 dark:text-blue-400 dark:bg-blue-900/30';\n case 'PAUSED':\n return 'text-yellow-600 bg-yellow-100 dark:text-yellow-400 dark:bg-yellow-900/30';\n case 'ARCHIVED':\n return 'text-gray-600 bg-gray-100 dark:text-gray-400 dark:bg-gray-700';\n default:\n return 'text-gray-600 bg-gray-100';\n }\n}\n\nexport function AgentActionsModal({\n isOpen,\n agent,\n onClose,\n onActivate,\n onPause,\n onArchive,\n onExecute,\n isLoading = false,\n}: AgentActionsModalProps) {\n const [mode, setMode] = useState<ActionMode>('menu');\n const [message, setMessage] = useState('');\n const [confirmAction, setConfirmAction] = useState<'archive' | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n const resetForm = () => {\n setMode('menu');\n setMessage('');\n setConfirmAction(null);\n setError(null);\n };\n\n const handleClose = () => {\n resetForm();\n onClose();\n };\n\n const handleExecute = async () => {\n if (!agent) return;\n setError(null);\n\n if (!message.trim()) {\n setError('Please enter a message');\n return;\n }\n\n try {\n await onExecute(agent.id, message.trim());\n handleClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to execute agent');\n }\n };\n\n const handleStatusChange = async (\n action: 'activate' | 'pause' | 'archive'\n ) => {\n if (!agent) return;\n setError(null);\n\n try {\n switch (action) {\n case 'activate':\n await onActivate(agent.id);\n break;\n case 'pause':\n await onPause(agent.id);\n break;\n case 'archive':\n await onArchive(agent.id);\n break;\n }\n handleClose();\n } catch (err) {\n setError(\n err instanceof Error ? err.message : `Failed to ${action} agent`\n );\n }\n };\n\n if (!isOpen || !agent) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <div\n className=\"bg-background/80 absolute inset-0 backdrop-blur-sm\"\n onClick={handleClose}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') handleClose();\n }}\n aria-label=\"Close modal\"\n />\n\n {/* Modal */}\n <div className=\"bg-card border-border relative z-10 w-full max-w-md rounded-xl border p-6 shadow-xl\">\n {/* Agent Header */}\n <div className=\"border-border mb-4 border-b pb-4\">\n <h2 className=\"text-xl font-semibold\">{agent.name}</h2>\n <div className=\"mt-1 flex items-center gap-2\">\n <span className=\"text-muted-foreground text-sm\">\n {agent.modelProvider} / {agent.modelName}\n </span>\n <span\n className={`rounded-full px-2 py-0.5 text-xs font-medium ${getStatusColor(agent.status)}`}\n >\n {agent.status}\n </span>\n </div>\n {agent.description && (\n <p className=\"text-muted-foreground mt-2 text-sm\">\n {agent.description}\n </p>\n )}\n </div>\n\n {/* Main Menu */}\n {mode === 'menu' && (\n <div className=\"space-y-3\">\n {/* Execute - Only for active agents */}\n {agent.status === 'ACTIVE' && (\n <Button\n className=\"w-full justify-start\"\n variant=\"ghost\"\n onPress={() => setMode('execute')}\n >\n <span className=\"mr-2\">▶️</span> Execute Agent\n </Button>\n )}\n\n {/* Status Changes */}\n {(agent.status === 'DRAFT' || agent.status === 'PAUSED') && (\n <Button\n className=\"w-full justify-start\"\n variant=\"ghost\"\n onPress={() => handleStatusChange('activate')}\n disabled={isLoading}\n >\n <span className=\"mr-2\">🟢</span> Activate Agent\n </Button>\n )}\n\n {agent.status === 'ACTIVE' && (\n <Button\n className=\"w-full justify-start\"\n variant=\"ghost\"\n onPress={() => handleStatusChange('pause')}\n disabled={isLoading}\n >\n <span className=\"mr-2\">⏸️</span> Pause Agent\n </Button>\n )}\n\n {agent.status !== 'ARCHIVED' && (\n <Button\n className=\"w-full justify-start text-yellow-600 hover:text-yellow-700\"\n variant=\"ghost\"\n onPress={() => {\n setConfirmAction('archive');\n setMode('confirm');\n }}\n >\n <span className=\"mr-2\">📦</span> Archive Agent\n </Button>\n )}\n\n {agent.status === 'ARCHIVED' && (\n <Button\n className=\"w-full justify-start\"\n variant=\"ghost\"\n onPress={() => handleStatusChange('activate')}\n disabled={isLoading}\n >\n <span className=\"mr-2\">🔄</span> Restore Agent\n </Button>\n )}\n\n {error && (\n <div className=\"bg-destructive/10 text-destructive rounded-md p-3 text-sm\">\n {error}\n </div>\n )}\n\n <div className=\"border-border border-t pt-3\">\n <Button\n className=\"w-full\"\n variant=\"outline\"\n onPress={handleClose}\n >\n Close\n </Button>\n </div>\n </div>\n )}\n\n {/* Execute Form */}\n {mode === 'execute' && (\n <div className=\"space-y-4\">\n <div>\n <label\n htmlFor=\"execute-message\"\n className=\"text-muted-foreground mb-1 block text-sm font-medium\"\n >\n Message *\n </label>\n <textarea\n id=\"execute-message\"\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder=\"Enter your message to the agent...\"\n rows={4}\n disabled={isLoading}\n className=\"border-input bg-background focus:ring-ring w-full rounded-md border px-3 py-2 text-sm focus:ring-2 focus:outline-none disabled:opacity-50\"\n />\n </div>\n\n {error && (\n <div className=\"bg-destructive/10 text-destructive rounded-md p-3 text-sm\">\n {error}\n </div>\n )}\n\n <div className=\"flex justify-end gap-3 pt-2\">\n <Button\n variant=\"ghost\"\n onPress={() => setMode('menu')}\n disabled={isLoading}\n >\n Back\n </Button>\n <Button onPress={handleExecute} disabled={isLoading}>\n {isLoading ? 'Executing...' : '▶️ Execute'}\n </Button>\n </div>\n </div>\n )}\n\n {/* Confirm Action */}\n {mode === 'confirm' && confirmAction === 'archive' && (\n <div className=\"space-y-4\">\n <p className=\"text-muted-foreground\">\n Are you sure you want to archive{' '}\n <span className=\"text-foreground font-medium\">{agent.name}</span>?\n </p>\n <p className=\"text-muted-foreground text-sm\">\n Archived agents cannot be executed but can be restored later.\n </p>\n\n {error && (\n <div className=\"bg-destructive/10 text-destructive rounded-md p-3 text-sm\">\n {error}\n </div>\n )}\n\n <div className=\"flex justify-end gap-3 pt-2\">\n <Button\n variant=\"ghost\"\n onPress={() => setMode('menu')}\n disabled={isLoading}\n >\n Cancel\n </Button>\n <Button\n onPress={() => handleStatusChange('archive')}\n disabled={isLoading}\n >\n {isLoading ? 'Archiving...' : '📦 Archive'}\n </Button>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,SAAS,eAAe,QAAiC;AACvD,SAAQ,QAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,QACE,QAAO;;;AAIb,SAAgB,kBAAkB,EAChC,QACA,OACA,SACA,YACA,SACA,WACA,WACA,YAAY,SACa;CACzB,MAAM,CAAC,MAAM,WAAW,SAAqB,OAAO;CACpD,MAAM,CAAC,SAAS,cAAc,SAAS,GAAG;CAC1C,MAAM,CAAC,eAAe,oBAAoB,SAA2B,KAAK;CAC1E,MAAM,CAAC,OAAO,YAAY,SAAwB,KAAK;CAEvD,MAAM,kBAAkB;AACtB,UAAQ,OAAO;AACf,aAAW,GAAG;AACd,mBAAiB,KAAK;AACtB,WAAS,KAAK;;CAGhB,MAAM,oBAAoB;AACxB,aAAW;AACX,WAAS;;CAGX,MAAM,gBAAgB,YAAY;AAChC,MAAI,CAAC,MAAO;AACZ,WAAS,KAAK;AAEd,MAAI,CAAC,QAAQ,MAAM,EAAE;AACnB,YAAS,yBAAyB;AAClC;;AAGF,MAAI;AACF,SAAM,UAAU,MAAM,IAAI,QAAQ,MAAM,CAAC;AACzC,gBAAa;WACN,KAAK;AACZ,YAAS,eAAe,QAAQ,IAAI,UAA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AI,WAAU;kBACb,oBAAC;QACC,SAAQ;QACR,eAAe,QAAQ,OAAO;QAC9B,UAAU;kBACX;SAEQ,EACT,oBAAC;QACC,eAAe,mBAAmB,UAAU;QAC5C,UAAU;kBAET,YAAY,iBAAiB;SACvB;QACL;;MACF;;IAEJ;GACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAgentModal.js","names":[],"sources":["../../../src/ui/modals/CreateAgentModal.tsx"],"sourcesContent":["'use client';\n\n/**\n * CreateAgentModal - Form for creating a new AI agent\n *\n * Wires to CreateAgentCommand via useAgentMutations hook.\n */\nimport { useState } from 'react';\nimport { Button, Input } from '@contractspec/lib.design-system';\n\n// Local type definition for modal props\nexport interface CreateAgentInput {\n name: string;\n description?: string;\n modelProvider: string;\n modelName: string;\n systemPrompt?: string;\n}\n\ninterface CreateAgentModalProps {\n isOpen: boolean;\n onClose: () => void;\n onSubmit: (input: CreateAgentInput) => Promise<void>;\n isLoading?: boolean;\n}\n\nconst MODEL_PROVIDERS = [\n {\n value: 'openai',\n label: 'OpenAI',\n models: ['gpt-4o', 'gpt-4-turbo', 'gpt-3.5-turbo'],\n },\n {\n value: 'anthropic',\n label: 'Anthropic',\n models: ['claude-3-opus', 'claude-3-sonnet', 'claude-3-haiku'],\n },\n { value: 'google', label: 'Google', models: ['gemini-pro', 'gemini-ultra'] },\n {\n value: 'mistral',\n label: 'Mistral',\n models: ['mistral-large', 'mistral-medium', 'mistral-small'],\n },\n] as const;\n\ntype ModelProvider = (typeof MODEL_PROVIDERS)[number]['value'];\n\nexport function CreateAgentModal({\n isOpen,\n onClose,\n onSubmit,\n isLoading = false,\n}: CreateAgentModalProps) {\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n const [modelProvider, setModelProvider] = useState<ModelProvider>('openai');\n const [modelName, setModelName] = useState('gpt-4o');\n const [systemPrompt, setSystemPrompt] = useState('');\n const [error, setError] = useState<string | null>(null);\n\n const selectedProvider = MODEL_PROVIDERS.find(\n (p) => p.value === modelProvider\n );\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setError(null);\n\n // Validation\n if (!name.trim()) {\n setError('Agent name is required');\n return;\n }\n\n try {\n await onSubmit({\n name: name.trim(),\n description: description.trim() || undefined,\n modelProvider,\n modelName,\n systemPrompt: systemPrompt.trim() || undefined,\n });\n\n // Reset form\n setName('');\n setDescription('');\n setModelProvider('openai');\n setModelName('gpt-4o');\n setSystemPrompt('');\n onClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to create agent');\n }\n };\n\n // Update model when provider changes\n const handleProviderChange = (provider: ModelProvider) => {\n setModelProvider(provider);\n const providerConfig = MODEL_PROVIDERS.find((p) => p.value === provider);\n if (providerConfig) {\n setModelName(providerConfig.models[0]);\n }\n };\n\n if (!isOpen) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <div\n className=\"bg-background/80 absolute inset-0 backdrop-blur-sm\"\n onClick={onClose}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') onClose();\n }}\n aria-label=\"Close modal\"\n />\n\n {/* Modal */}\n <div className=\"bg-card border-border relative z-10 max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-xl border p-6 shadow-xl\">\n <h2 className=\"mb-4 text-xl font-semibold\">Create New Agent</h2>\n\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n {/* Agent Name */}\n <div>\n <label\n htmlFor=\"agent-name\"\n className=\"text-muted-foreground mb-1 block text-sm font-medium\"\n >\n Agent Name *\n </label>\n <Input\n id=\"agent-name\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder=\"e.g., Customer Support Bot\"\n disabled={isLoading}\n />\n </div>\n\n {/* Description */}\n <div>\n <label\n htmlFor=\"agent-description\"\n className=\"text-muted-foreground mb-1 block text-sm font-medium\"\n >\n Description\n </label>\n <textarea\n id=\"agent-description\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n placeholder=\"Describe what this agent does...\"\n rows={2}\n disabled={isLoading}\n className=\"border-input bg-background focus:ring-ring w-full rounded-md border px-3 py-2 text-sm focus:ring-2 focus:outline-none disabled:opacity-50\"\n />\n </div>\n\n {/* Model Provider & Model */}\n <div className=\"flex gap-3\">\n <div className=\"flex-1\">\n <label\n htmlFor=\"model-provider\"\n className=\"text-muted-foreground mb-1 block text-sm font-medium\"\n >\n Provider *\n </label>\n <select\n id=\"model-provider\"\n value={modelProvider}\n onChange={(e) =>\n handleProviderChange(e.target.value as ModelProvider)\n }\n disabled={isLoading}\n className=\"border-input bg-background focus:ring-ring h-10 w-full rounded-md border px-3 py-2 text-sm focus:ring-2 focus:outline-none disabled:opacity-50\"\n >\n {MODEL_PROVIDERS.map((p) => (\n <option key={p.value} value={p.value}>\n {p.label}\n </option>\n ))}\n </select>\n </div>\n <div className=\"flex-1\">\n <label\n htmlFor=\"model-name\"\n className=\"text-muted-foreground mb-1 block text-sm font-medium\"\n >\n Model *\n </label>\n <select\n id=\"model-name\"\n value={modelName}\n onChange={(e) => setModelName(e.target.value)}\n disabled={isLoading}\n className=\"border-input bg-background focus:ring-ring h-10 w-full rounded-md border px-3 py-2 text-sm focus:ring-2 focus:outline-none disabled:opacity-50\"\n >\n {selectedProvider?.models.map((m) => (\n <option key={m} value={m}>\n {m}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n {/* System Prompt */}\n <div>\n <label\n htmlFor=\"system-prompt\"\n className=\"text-muted-foreground mb-1 block text-sm font-medium\"\n >\n System Prompt\n </label>\n <textarea\n id=\"system-prompt\"\n value={systemPrompt}\n onChange={(e) => setSystemPrompt(e.target.value)}\n placeholder=\"You are a helpful assistant that...\"\n rows={4}\n disabled={isLoading}\n className=\"border-input bg-background focus:ring-ring w-full rounded-md border px-3 py-2 font-mono text-sm focus:ring-2 focus:outline-none disabled:opacity-50\"\n />\n <p className=\"text-muted-foreground mt-1 text-xs\">\n Instructions that define the agent's behavior\n </p>\n </div>\n\n {/* Error Message */}\n {error && (\n <div className=\"bg-destructive/10 text-destructive rounded-md p-3 text-sm\">\n {error}\n </div>\n )}\n\n {/* Actions */}\n <div className=\"flex justify-end gap-3 pt-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onPress={onClose}\n disabled={isLoading}\n >\n Cancel\n </Button>\n <Button type=\"submit\" disabled={isLoading}>\n {isLoading ? 'Creating...' : 'Create Agent'}\n </Button>\n </div>\n </form>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,kBAAkB;CACtB;EACE,OAAO;EACP,OAAO;EACP,QAAQ;GAAC;GAAU;GAAe;GAAgB;EACnD;CACD;EACE,OAAO;EACP,OAAO;EACP,QAAQ;GAAC;GAAiB;GAAmB;GAAiB;EAC/D;CACD;EAAE,OAAO;EAAU,OAAO;EAAU,QAAQ,CAAC,cAAc,eAAe;EAAE;CAC5E;EACE,OAAO;EACP,OAAO;EACP,QAAQ;GAAC;GAAiB;GAAkB;GAAgB;EAC7D;CACF;AAID,SAAgB,iBAAiB,EAC/B,QACA,SACA,UACA,YAAY,SACY;CACxB,MAAM,CAAC,MAAM,WAAW,SAAS,GAAG;CACpC,MAAM,CAAC,aAAa,kBAAkB,SAAS,GAAG;CAClD,MAAM,CAAC,eAAe,oBAAoB,SAAwB,SAAS;CAC3E,MAAM,CAAC,WAAW,gBAAgB,SAAS,SAAS;CACpD,MAAM,CAAC,cAAc,mBAAmB,SAAS,GAAG;CACpD,MAAM,CAAC,OAAO,YAAY,SAAwB,KAAK;CAEvD,MAAM,mBAAmB,gBAAgB,MACtC,MAAM,EAAE,UAAU,cACpB;CAED,MAAM,eAAe,OAAO,MAAuB;AACjD,IAAE,gBAAgB;AAClB,WAAS,KAAK;AAGd,MAAI,CAAC,KAAK,MAAM,EAAE;AAChB,YAAS,yBAAyB;AAClC;;AAGF,MAAI;AACF,SAAM,SAAS;IACb,MAAM,KAAK,MAAM;IACjB,aAAa,YAAY,MA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MAAuB;QAEvD,UAAU;QACV,WAAU;kBAET,gBAAgB,KAAK,MACpB,oBAAC;SAAqB,OAAO,EAAE;mBAC5B,EAAE;WADQ,EAAE,MAEN,CACT;SACK;QACL,EACN,qBAAC;OAAI,WAAU;kBACb,oBAAC;QACC,SAAQ;QACR,WAAU;kBACX;SAEO,EACR,oBAAC;QACC,IAAG;QACH,OAAO;QACP,WAAW,MAAM,aAAa,EAAE,OAAO,MAAM;QAC7C,UAAU;QACV,WAAU;kBAET,kBAAkB,OAAO,KAAK,MAC7B,oBAAC;SAAe,OAAO;mBACpB;WADU,EAEJ,CACT;SACK;QACL;OACF;KAGN,qBAAC;MACC,oBAAC;OACC,SAAQ;OACR,WAAU;iBACX;QAEO;MACR,oBAAC;OACC,IAAG;OACH,OAAO;OACP,WAAW,MAAM,gBAAgB,EAAE,OAAO,MAAM;OAChD,aAAY;OACZ,MAAM;OACN,UAAU;OACV,WAAU;QACV;MACF,oBAAC;OAAE,WAAU;iBAAqC;QAE9C;SACA;KAGL,SACC,oBAAC;MAAI,WAAU;gBACZ;OACG;KAIR,qBAAC;MAAI,WAAU;iBACb,oBAAC;OACC,MAAK;OACL,SAAQ;OACR,SAAS;OACT,UAAU;iBACX;QAEQ,EACT,oBAAC;OAAO,MAAK;OAAS,UAAU;iBAC7B,YAAY,gBAAgB;QACtB;OACL;;KACD;IACH;GACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"demo-overlays.js","names":[],"sources":["../../../src/ui/overlays/demo-overlays.ts"],"sourcesContent":["/**\n * Demo Overlay Definitions for Agent Console\n *\n * These overlays customize the presentation for different contexts\n * (e.g., demo users, different roles).\n */\nimport type { OverlayDefinition } from '../../shared/overlay-types';\n\n/**\n * Demo user overlay - hides advanced configuration options\n */\nexport const agentConsoleDemoOverlay: OverlayDefinition = {\n overlayId: 'agent-console.demo-user',\n version: '1.0.0',\n description: 'Simplifies agent console for demo users',\n appliesTo: {\n feature: 'agent-console',\n role: 'demo',\n },\n modifications: [\n {\n type: 'hideField',\n field: 'modelConfig',\n reason: 'Advanced config not relevant for demo',\n },\n {\n type: 'hideField',\n field: 'webhookConfig',\n reason: 'Integration not available in demo',\n },\n {\n type: 'renameLabel',\n field: 'systemPrompt',\n newLabel: 'Agent Instructions',\n },\n {\n type: 'addBadge',\n position: 'header',\n label: 'Demo Mode',\n variant: 'warning',\n },\n ],\n};\n\n/**\n * Read-only overlay - for viewing without edit permissions\n */\nexport const agentConsoleReadOnlyOverlay: OverlayDefinition = {\n overlayId: 'agent-console.read-only',\n version: '1.0.0',\n description: 'Read-only view for non-admin users',\n appliesTo: {\n feature: 'agent-console',\n role: 'viewer',\n },\n modifications: [\n {\n type: 'hideField',\n field: 'deleteButton',\n reason: 'No delete permission',\n },\n { type: 'hideField', field: 'editButton', reason: 'No edit permission' },\n {\n type: 'hideField',\n field: 'createButton',\n reason: 'No create permission',\n },\n ],\n};\n\n/**\n * All overlays for agent-console\n */\nexport const agentConsoleOverlays: OverlayDefinition[] = [\n agentConsoleDemoOverlay,\n agentConsoleReadOnlyOverlay,\n];\n"],"mappings":";;;;AAWA,MAAa,0BAA6C;CACxD,WAAW;CACX,SAAS;CACT,aAAa;CACb,WAAW;EACT,SAAS;EACT,MAAM;EACP;CACD,eAAe;EACb;GACE,MAAM;GACN,OAAO;GACP,QAAQ;GACT;EACD;GACE,MAAM;GACN,OAAO;GACP,QAAQ;GACT;EACD;GACE,MAAM;GACN,OAAO;GACP,UAAU;GACX;EACD;GACE,MAAM;GACN,UAAU;GACV,OAAO;GACP,SAAS;GACV;EACF;CACF;;;;AAKD,MAAa,8BAAiD;CAC5D,WAAW;CACX,SAAS;CACT,aAAa;CACb,WAAW;EACT,SAAS;EACT,MAAM;EACP;CACD,eAAe;EACb;GACE,MAAM;GACN,OAAO;GACP,QAAQ;GACT;EACD;GAAE,MAAM;GAAa,OAAO;GAAc,QAAQ;GAAsB;EACxE;GACE,MAAM;GACN,OAAO;GACP,QAAQ;GACT;EACF;CACF;;;;AAKD,MAAa,uBAA4C,CACvD,yBACA,4BACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-list.markdown.js","names":[],"sources":["../../../src/ui/renderers/agent-list.markdown.ts"],"sourcesContent":["/**\n * Markdown Renderer for Agent List Presentation\n *\n * Uses handlers from the agent-console example package.\n */\nimport type {\n PresentationRenderer,\n PresentationSpec,\n} from '@contractspec/lib.contracts';\nimport {\n type AgentSummary,\n mockListAgentsHandler,\n} from '@contractspec/example.agent-console/handlers';\n\ntype Agent = AgentSummary;\n\n/**\n * Markdown renderer for agent-console.agent.list presentation\n * Only handles AgentListView component\n */\nexport const agentListMarkdownRenderer: PresentationRenderer<{\n mimeType: string;\n body: string;\n}> = {\n target: 'markdown',\n render: async (desc: PresentationSpec) => {\n // Only handle AgentListView\n if (\n desc.source.type !== 'component' ||\n desc.source.componentKey !== 'AgentListView'\n ) {\n throw new Error('agentListMarkdownRenderer: not AgentListView');\n }\n\n // Fetch data using mock handler\n const data = await mockListAgentsHandler({\n organizationId: 'demo-org',\n limit: 50,\n offset: 0,\n });\n\n // Generate markdown\n const lines: string[] = [\n `# ${desc.meta.description ?? 'Agent List'}`,\n '',\n `> ${desc.meta.key} v${desc.meta.version}`,\n '',\n `**Total Agents:** ${data.total}`,\n '',\n '## Agents',\n '',\n ];\n\n // Group by status\n const byStatus: Record<string, Agent[]> = {};\n for (const agent of data.items) {\n const status = agent.status;\n if (byStatus[status]) {\n byStatus[status].push(agent);\n } else {\n byStatus[status] = [agent];\n }\n }\n\n for (const [status, agents] of Object.entries(byStatus)) {\n lines.push(`### ${status} (${agents.length})`);\n lines.push('');\n for (const agent of agents) {\n lines.push(\n `- **${agent.name}** (${agent.modelProvider}/${agent.modelName})`\n );\n if (agent.description) {\n lines.push(` > ${agent.description}`);\n }\n }\n lines.push('');\n }\n\n return {\n mimeType: 'text/markdown',\n body: lines.join('\\n'),\n };\n },\n};\n"],"mappings":";;;;;;;AAoBA,MAAa,4BAGR;CACH,QAAQ;CACR,QAAQ,OAAO,SAA2B;AAExC,MACE,KAAK,OAAO,SAAS,eACrB,KAAK,OAAO,iBAAiB,gBAE7B,OAAM,IAAI,MAAM,+CAA+C;EAIjE,MAAM,OAAO,MAAM,sBAAsB;GACvC,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACT,CAAC;EAGF,MAAM,QAAkB;GACtB,KAAK,KAAK,KAAK,eAAe;GAC9B;GACA,KAAK,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK;GACjC;GACA,qBAAqB,KAAK;GAC1B;GACA;GACA;GACD;EAGD,MAAM,WAAoC,EAAE;AAC5C,OAAK,MAAM,SAAS,KAAK,OAAO;GAC9B,MAAM,SAAS,MAAM;AACrB,OAAI,SAAS,QACX,UAAS,QAAQ,KAAK,MAAM;OAE5B,UAAS,UAAU,CAAC,MAAM;;AAI9B,OAAK,MAAM,CAAC,QAAQ,WAAW,OAAO,QAAQ,SAAS,EAAE;AACvD,SAAM,KAAK,OAAO,OAAO,IAAI,OAAO,OAAO,GAAG;AAC9C,SAAM,KAAK,GAAG;AACd,QAAK,MAAM,SAAS,QAAQ;AAC1B,UAAM,KACJ,OAAO,MAAM,KAAK,MAAM,MAAM,cAAc,GAAG,MAAM,UAAU,GAChE;AACD,QAAI,MAAM,YACR,OAAM,KAAK,OAAO,MAAM,cAAc;;AAG1C,SAAM,KAAK,GAAG;;AAGhB,SAAO;GACL,UAAU;GACV,MAAM,MAAM,KAAK,KAAK;GACvB;;CAEJ"}
|