@contractspec/example.agent-console 1.57.0 → 1.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +210 -278
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +31 -0
- package/dist/agent/agent.entity.d.ts +35 -40
- package/dist/agent/agent.entity.d.ts.map +1 -1
- package/dist/agent/agent.entity.js +124 -132
- package/dist/agent/agent.enum.d.ts +3 -8
- package/dist/agent/agent.enum.d.ts.map +1 -1
- package/dist/agent/agent.enum.js +22 -30
- package/dist/agent/agent.event.d.ts +105 -111
- package/dist/agent/agent.event.d.ts.map +1 -1
- package/dist/agent/agent.event.js +107 -200
- package/dist/agent/agent.handler.d.ts +74 -77
- package/dist/agent/agent.handler.d.ts.map +1 -1
- package/dist/agent/agent.handler.js +293 -75
- package/dist/agent/agent.operation.d.ts +424 -430
- package/dist/agent/agent.operation.d.ts.map +1 -1
- package/dist/agent/agent.operation.js +728 -478
- package/dist/agent/agent.presentation.d.ts +3 -8
- package/dist/agent/agent.presentation.d.ts.map +1 -1
- package/dist/agent/agent.presentation.js +275 -84
- package/dist/agent/agent.schema.d.ts +371 -376
- package/dist/agent/agent.schema.d.ts.map +1 -1
- package/dist/agent/agent.schema.js +209 -399
- package/dist/agent/agent.test-spec.d.ts +2 -7
- package/dist/agent/agent.test-spec.d.ts.map +1 -1
- package/dist/agent/agent.test-spec.js +56 -62
- package/dist/agent/index.d.ts +11 -8
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +1245 -9
- package/dist/agent.capability.d.ts +1 -6
- package/dist/agent.capability.d.ts.map +1 -1
- package/dist/agent.capability.js +17 -20
- package/dist/agent.feature.d.ts +7 -6
- package/dist/agent.feature.d.ts.map +1 -1
- package/dist/agent.feature.js +117 -303
- package/dist/browser/agent/agent.entity.js +127 -0
- package/dist/browser/agent/agent.enum.js +25 -0
- package/dist/browser/agent/agent.event.js +116 -0
- package/dist/browser/agent/agent.handler.js +301 -0
- package/dist/browser/agent/agent.operation.js +735 -0
- package/dist/browser/agent/agent.presentation.js +279 -0
- package/dist/browser/agent/agent.schema.js +215 -0
- package/dist/browser/agent/agent.test-spec.js +58 -0
- package/dist/browser/agent/index.js +1244 -0
- package/dist/browser/agent.capability.js +16 -0
- package/dist/browser/agent.feature.js +118 -0
- package/dist/browser/docs/agent-console.docblock.js +93 -0
- package/dist/browser/docs/index.js +93 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/agent.handlers.js +252 -0
- package/dist/browser/handlers/index.js +799 -0
- package/dist/browser/index.js +5895 -0
- package/dist/browser/presentations/index.js +684 -0
- package/dist/browser/run/index.js +1350 -0
- package/dist/browser/run/run.entity.js +160 -0
- package/dist/browser/run/run.enum.js +34 -0
- package/dist/browser/run/run.event.js +213 -0
- package/dist/browser/run/run.handler.js +254 -0
- package/dist/browser/run/run.operation.js +667 -0
- package/dist/browser/run/run.presentation.js +220 -0
- package/dist/browser/run/run.schema.js +179 -0
- package/dist/browser/run/run.test-spec.js +58 -0
- package/dist/browser/seeders/index.js +21 -0
- package/dist/browser/shared/index.js +334 -0
- package/dist/browser/shared/mock-agents.js +82 -0
- package/dist/browser/shared/mock-runs.js +108 -0
- package/dist/browser/shared/mock-tools.js +146 -0
- package/dist/browser/shared/overlay-types.js +0 -0
- package/dist/browser/tool/index.js +946 -0
- package/dist/browser/tool/tool.entity.js +90 -0
- package/dist/browser/tool/tool.enum.js +26 -0
- package/dist/browser/tool/tool.event.js +99 -0
- package/dist/browser/tool/tool.handler.js +223 -0
- package/dist/browser/tool/tool.operation.js +482 -0
- package/dist/browser/tool/tool.presentation.js +185 -0
- package/dist/browser/tool/tool.schema.js +141 -0
- package/dist/browser/tool/tool.test-spec.js +58 -0
- package/dist/browser/ui/AgentDashboard.js +1607 -0
- package/dist/browser/ui/AgentRunList.js +250 -0
- package/dist/browser/ui/AgentToolRegistry.js +212 -0
- package/dist/browser/ui/hooks/index.js +271 -0
- package/dist/browser/ui/hooks/useAgentList.js +55 -0
- package/dist/browser/ui/hooks/useAgentMutations.js +76 -0
- package/dist/browser/ui/hooks/useRunList.js +55 -0
- package/dist/browser/ui/hooks/useToolList.js +85 -0
- package/dist/browser/ui/index.js +2080 -0
- package/dist/browser/ui/modals/AgentActionsModal.js +304 -0
- package/dist/browser/ui/modals/CreateAgentModal.js +229 -0
- package/dist/browser/ui/modals/index.js +532 -0
- package/dist/browser/ui/overlays/demo-overlays.js +64 -0
- package/dist/browser/ui/overlays/index.js +64 -0
- package/dist/browser/ui/renderers/agent-list.markdown.js +55 -0
- package/dist/browser/ui/renderers/agent-list.renderer.js +180 -0
- package/dist/browser/ui/renderers/dashboard.markdown.js +117 -0
- package/dist/browser/ui/renderers/index.js +446 -0
- package/dist/browser/ui/renderers/run-list.markdown.js +45 -0
- package/dist/browser/ui/renderers/tool-registry.markdown.js +53 -0
- package/dist/browser/ui/views/AgentListView.js +165 -0
- package/dist/browser/ui/views/RunListView.js +247 -0
- package/dist/browser/ui/views/ToolRegistryView.js +209 -0
- package/dist/browser/ui/views/index.js +619 -0
- package/dist/docs/agent-console.docblock.d.ts +2 -1
- package/dist/docs/agent-console.docblock.d.ts.map +1 -0
- package/dist/docs/agent-console.docblock.js +45 -64
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +94 -1
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +41 -55
- package/dist/handlers/agent.handlers.d.ts +121 -120
- package/dist/handlers/agent.handlers.d.ts.map +1 -1
- package/dist/handlers/agent.handlers.js +235 -245
- package/dist/handlers/index.d.ts +8 -5
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +799 -5
- package/dist/index.d.ts +26 -48
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5896 -50
- package/dist/node/agent/agent.entity.js +127 -0
- package/dist/node/agent/agent.enum.js +25 -0
- package/dist/node/agent/agent.event.js +116 -0
- package/dist/node/agent/agent.handler.js +301 -0
- package/dist/node/agent/agent.operation.js +735 -0
- package/dist/node/agent/agent.presentation.js +279 -0
- package/dist/node/agent/agent.schema.js +215 -0
- package/dist/node/agent/agent.test-spec.js +58 -0
- package/dist/node/agent/index.js +1244 -0
- package/dist/node/agent.capability.js +16 -0
- package/dist/node/agent.feature.js +118 -0
- package/dist/node/docs/agent-console.docblock.js +93 -0
- package/dist/node/docs/index.js +93 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/agent.handlers.js +252 -0
- package/dist/node/handlers/index.js +799 -0
- package/dist/node/index.js +5895 -0
- package/dist/node/presentations/index.js +684 -0
- package/dist/node/run/index.js +1350 -0
- package/dist/node/run/run.entity.js +160 -0
- package/dist/node/run/run.enum.js +34 -0
- package/dist/node/run/run.event.js +213 -0
- package/dist/node/run/run.handler.js +254 -0
- package/dist/node/run/run.operation.js +667 -0
- package/dist/node/run/run.presentation.js +220 -0
- package/dist/node/run/run.schema.js +179 -0
- package/dist/node/run/run.test-spec.js +58 -0
- package/dist/node/seeders/index.js +21 -0
- package/dist/node/shared/index.js +334 -0
- package/dist/node/shared/mock-agents.js +82 -0
- package/dist/node/shared/mock-runs.js +108 -0
- package/dist/node/shared/mock-tools.js +146 -0
- package/dist/node/shared/overlay-types.js +0 -0
- package/dist/node/tool/index.js +946 -0
- package/dist/node/tool/tool.entity.js +90 -0
- package/dist/node/tool/tool.enum.js +26 -0
- package/dist/node/tool/tool.event.js +99 -0
- package/dist/node/tool/tool.handler.js +223 -0
- package/dist/node/tool/tool.operation.js +482 -0
- package/dist/node/tool/tool.presentation.js +185 -0
- package/dist/node/tool/tool.schema.js +141 -0
- package/dist/node/tool/tool.test-spec.js +58 -0
- package/dist/node/ui/AgentDashboard.js +1607 -0
- package/dist/node/ui/AgentRunList.js +250 -0
- package/dist/node/ui/AgentToolRegistry.js +212 -0
- package/dist/node/ui/hooks/index.js +271 -0
- package/dist/node/ui/hooks/useAgentList.js +55 -0
- package/dist/node/ui/hooks/useAgentMutations.js +76 -0
- package/dist/node/ui/hooks/useRunList.js +55 -0
- package/dist/node/ui/hooks/useToolList.js +85 -0
- package/dist/node/ui/index.js +2080 -0
- package/dist/node/ui/modals/AgentActionsModal.js +304 -0
- package/dist/node/ui/modals/CreateAgentModal.js +229 -0
- package/dist/node/ui/modals/index.js +532 -0
- package/dist/node/ui/overlays/demo-overlays.js +64 -0
- package/dist/node/ui/overlays/index.js +64 -0
- package/dist/node/ui/renderers/agent-list.markdown.js +55 -0
- package/dist/node/ui/renderers/agent-list.renderer.js +180 -0
- package/dist/node/ui/renderers/dashboard.markdown.js +117 -0
- package/dist/node/ui/renderers/index.js +446 -0
- package/dist/node/ui/renderers/run-list.markdown.js +45 -0
- package/dist/node/ui/renderers/tool-registry.markdown.js +53 -0
- package/dist/node/ui/views/AgentListView.js +165 -0
- package/dist/node/ui/views/RunListView.js +247 -0
- package/dist/node/ui/views/ToolRegistryView.js +209 -0
- package/dist/node/ui/views/index.js +619 -0
- package/dist/presentations/index.d.ts +9 -4
- package/dist/presentations/index.d.ts.map +1 -0
- package/dist/presentations/index.js +684 -4
- package/dist/run/index.d.ts +11 -8
- package/dist/run/index.d.ts.map +1 -0
- package/dist/run/index.js +1351 -9
- package/dist/run/run.entity.d.ts +55 -60
- package/dist/run/run.entity.d.ts.map +1 -1
- package/dist/run/run.entity.js +155 -199
- package/dist/run/run.enum.d.ts +4 -9
- package/dist/run/run.enum.d.ts.map +1 -1
- package/dist/run/run.enum.js +30 -40
- package/dist/run/run.event.d.ts +255 -261
- package/dist/run/run.event.d.ts.map +1 -1
- package/dist/run/run.event.js +198 -418
- package/dist/run/run.handler.d.ts +169 -172
- package/dist/run/run.handler.d.ts.map +1 -1
- package/dist/run/run.handler.js +246 -74
- package/dist/run/run.operation.d.ts +658 -664
- package/dist/run/run.operation.d.ts.map +1 -1
- package/dist/run/run.operation.js +659 -617
- package/dist/run/run.presentation.d.ts +2 -7
- package/dist/run/run.presentation.d.ts.map +1 -1
- package/dist/run/run.presentation.js +217 -61
- package/dist/run/run.schema.d.ts +367 -372
- package/dist/run/run.schema.d.ts.map +1 -1
- package/dist/run/run.schema.js +172 -330
- package/dist/run/run.test-spec.d.ts +2 -7
- package/dist/run/run.test-spec.d.ts.map +1 -1
- package/dist/run/run.test-spec.js +56 -62
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +19 -17
- package/dist/shared/index.d.ts +7 -4
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +334 -4
- package/dist/shared/mock-agents.d.ts +77 -80
- package/dist/shared/mock-agents.d.ts.map +1 -1
- package/dist/shared/mock-agents.js +82 -93
- package/dist/shared/mock-runs.d.ts +107 -110
- package/dist/shared/mock-runs.d.ts.map +1 -1
- package/dist/shared/mock-runs.js +108 -117
- package/dist/shared/mock-tools.d.ts +217 -220
- package/dist/shared/mock-tools.d.ts.map +1 -1
- package/dist/shared/mock-tools.js +146 -180
- package/dist/shared/overlay-types.d.ts +25 -28
- package/dist/shared/overlay-types.d.ts.map +1 -1
- package/dist/shared/overlay-types.js +1 -0
- package/dist/tool/index.d.ts +11 -8
- package/dist/tool/index.d.ts.map +1 -0
- package/dist/tool/index.js +947 -9
- package/dist/tool/tool.entity.d.ts +23 -28
- package/dist/tool/tool.entity.d.ts.map +1 -1
- package/dist/tool/tool.entity.js +87 -101
- package/dist/tool/tool.enum.d.ts +3 -8
- package/dist/tool/tool.enum.d.ts.map +1 -1
- package/dist/tool/tool.enum.js +23 -31
- package/dist/tool/tool.event.d.ts +84 -90
- package/dist/tool/tool.event.d.ts.map +1 -1
- package/dist/tool/tool.event.js +92 -151
- package/dist/tool/tool.handler.d.ts +266 -269
- package/dist/tool/tool.handler.d.ts.map +1 -1
- package/dist/tool/tool.handler.js +213 -76
- package/dist/tool/tool.operation.d.ts +359 -365
- package/dist/tool/tool.operation.d.ts.map +1 -1
- package/dist/tool/tool.operation.js +477 -400
- package/dist/tool/tool.presentation.d.ts +2 -7
- package/dist/tool/tool.presentation.d.ts.map +1 -1
- package/dist/tool/tool.presentation.js +182 -61
- package/dist/tool/tool.schema.d.ts +196 -201
- package/dist/tool/tool.schema.d.ts.map +1 -1
- package/dist/tool/tool.schema.js +137 -231
- package/dist/tool/tool.test-spec.d.ts +2 -7
- package/dist/tool/tool.test-spec.d.ts.map +1 -1
- package/dist/tool/tool.test-spec.js +56 -62
- package/dist/ui/AgentDashboard.d.ts +1 -6
- package/dist/ui/AgentDashboard.d.ts.map +1 -1
- package/dist/ui/AgentDashboard.js +1598 -410
- package/dist/ui/AgentRunList.d.ts +7 -2
- package/dist/ui/AgentRunList.d.ts.map +1 -0
- package/dist/ui/AgentRunList.js +249 -3
- package/dist/ui/AgentToolRegistry.d.ts +7 -2
- package/dist/ui/AgentToolRegistry.d.ts.map +1 -0
- package/dist/ui/AgentToolRegistry.js +211 -3
- package/dist/ui/hooks/index.d.ts +8 -6
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +270 -6
- package/dist/ui/hooks/useAgentList.d.ts +21 -25
- package/dist/ui/hooks/useAgentList.d.ts.map +1 -1
- package/dist/ui/hooks/useAgentList.js +52 -62
- package/dist/ui/hooks/useAgentMutations.d.ts +22 -25
- package/dist/ui/hooks/useAgentMutations.d.ts.map +1 -1
- package/dist/ui/hooks/useAgentMutations.js +73 -120
- package/dist/ui/hooks/useRunList.d.ts +17 -21
- package/dist/ui/hooks/useRunList.d.ts.map +1 -1
- package/dist/ui/hooks/useRunList.js +52 -62
- package/dist/ui/hooks/useToolList.d.ts +32 -36
- package/dist/ui/hooks/useToolList.d.ts.map +1 -1
- package/dist/ui/hooks/useToolList.js +82 -92
- package/dist/ui/index.d.ts +9 -24
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +2081 -24
- package/dist/ui/modals/AgentActionsModal.d.ts +11 -24
- package/dist/ui/modals/AgentActionsModal.d.ts.map +1 -1
- package/dist/ui/modals/AgentActionsModal.js +300 -257
- package/dist/ui/modals/CreateAgentModal.d.ts +12 -21
- package/dist/ui/modals/CreateAgentModal.d.ts.map +1 -1
- package/dist/ui/modals/CreateAgentModal.js +226 -210
- package/dist/ui/modals/index.d.ts +3 -3
- package/dist/ui/modals/index.d.ts.map +1 -0
- package/dist/ui/modals/index.js +532 -3
- package/dist/ui/overlays/demo-overlays.d.ts +10 -8
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -1
- package/dist/ui/overlays/demo-overlays.js +63 -71
- package/dist/ui/overlays/index.d.ts +2 -2
- package/dist/ui/overlays/index.d.ts.map +1 -0
- package/dist/ui/overlays/index.js +65 -3
- package/dist/ui/renderers/agent-list.markdown.d.ts +9 -8
- package/dist/ui/renderers/agent-list.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/agent-list.markdown.js +55 -50
- package/dist/ui/renderers/agent-list.renderer.d.ts +5 -6
- package/dist/ui/renderers/agent-list.renderer.d.ts.map +1 -1
- package/dist/ui/renderers/agent-list.renderer.js +179 -17
- package/dist/ui/renderers/dashboard.markdown.d.ts +9 -8
- package/dist/ui/renderers/dashboard.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/dashboard.markdown.js +115 -97
- package/dist/ui/renderers/index.d.ts +9 -6
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +446 -6
- package/dist/ui/renderers/run-list.markdown.d.ts +9 -8
- package/dist/ui/renderers/run-list.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/run-list.markdown.js +42 -40
- package/dist/ui/renderers/tool-registry.markdown.d.ts +9 -8
- package/dist/ui/renderers/tool-registry.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/tool-registry.markdown.js +52 -53
- package/dist/ui/views/AgentListView.d.ts +1 -6
- package/dist/ui/views/AgentListView.d.ts.map +1 -1
- package/dist/ui/views/AgentListView.js +161 -88
- package/dist/ui/views/RunListView.d.ts +4 -11
- package/dist/ui/views/RunListView.d.ts.map +1 -1
- package/dist/ui/views/RunListView.js +237 -154
- package/dist/ui/views/ToolRegistryView.d.ts +4 -11
- package/dist/ui/views/ToolRegistryView.d.ts.map +1 -1
- package/dist/ui/views/ToolRegistryView.js +205 -92
- package/dist/ui/views/index.d.ts +7 -4
- package/dist/ui/views/index.d.ts.map +1 -0
- package/dist/ui/views/index.js +619 -4
- package/package.json +656 -118
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -285
- package/dist/agent/agent.entity.js.map +0 -1
- package/dist/agent/agent.enum.js.map +0 -1
- package/dist/agent/agent.event.js.map +0 -1
- package/dist/agent/agent.handler.js.map +0 -1
- package/dist/agent/agent.operation.js.map +0 -1
- package/dist/agent/agent.presentation.js.map +0 -1
- package/dist/agent/agent.schema.js.map +0 -1
- package/dist/agent/agent.test-spec.js.map +0 -1
- package/dist/agent.capability.js.map +0 -1
- package/dist/agent.feature.js.map +0 -1
- package/dist/docs/agent-console.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/agent.handlers.js.map +0 -1
- package/dist/run/run.entity.js.map +0 -1
- package/dist/run/run.enum.js.map +0 -1
- package/dist/run/run.event.js.map +0 -1
- package/dist/run/run.handler.js.map +0 -1
- package/dist/run/run.operation.js.map +0 -1
- package/dist/run/run.presentation.js.map +0 -1
- package/dist/run/run.schema.js.map +0 -1
- package/dist/run/run.test-spec.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/shared/mock-agents.js.map +0 -1
- package/dist/shared/mock-runs.js.map +0 -1
- package/dist/shared/mock-tools.js.map +0 -1
- package/dist/tool/tool.entity.js.map +0 -1
- package/dist/tool/tool.enum.js.map +0 -1
- package/dist/tool/tool.event.js.map +0 -1
- package/dist/tool/tool.handler.js.map +0 -1
- package/dist/tool/tool.operation.js.map +0 -1
- package/dist/tool/tool.presentation.js.map +0 -1
- package/dist/tool/tool.schema.js.map +0 -1
- package/dist/tool/tool.test-spec.js.map +0 -1
- package/dist/ui/AgentDashboard.js.map +0 -1
- package/dist/ui/hooks/useAgentList.js.map +0 -1
- package/dist/ui/hooks/useAgentMutations.js.map +0 -1
- package/dist/ui/hooks/useRunList.js.map +0 -1
- package/dist/ui/hooks/useToolList.js.map +0 -1
- package/dist/ui/modals/AgentActionsModal.js.map +0 -1
- package/dist/ui/modals/CreateAgentModal.js.map +0 -1
- package/dist/ui/overlays/demo-overlays.js.map +0 -1
- package/dist/ui/renderers/agent-list.markdown.js.map +0 -1
- package/dist/ui/renderers/agent-list.renderer.js.map +0 -1
- package/dist/ui/renderers/dashboard.markdown.js.map +0 -1
- package/dist/ui/renderers/run-list.markdown.js.map +0 -1
- package/dist/ui/renderers/tool-registry.markdown.js.map +0 -1
- package/dist/ui/views/AgentListView.js.map +0 -1
- package/dist/ui/views/RunListView.js.map +0 -1
- package/dist/ui/views/ToolRegistryView.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,486 +1,736 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/agent/agent.enum.ts
|
|
3
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
4
|
+
var AgentStatusEnum = defineEnum("AgentStatus", [
|
|
5
|
+
"DRAFT",
|
|
6
|
+
"ACTIVE",
|
|
7
|
+
"PAUSED",
|
|
8
|
+
"ARCHIVED"
|
|
9
|
+
]);
|
|
10
|
+
var ModelProviderEnum = defineEnum("ModelProvider", [
|
|
11
|
+
"OPENAI",
|
|
12
|
+
"ANTHROPIC",
|
|
13
|
+
"GOOGLE",
|
|
14
|
+
"MISTRAL",
|
|
15
|
+
"CUSTOM"
|
|
16
|
+
]);
|
|
17
|
+
var ToolChoiceEnum = defineEnum("ToolChoice", [
|
|
18
|
+
"auto",
|
|
19
|
+
"required",
|
|
20
|
+
"none"
|
|
21
|
+
]);
|
|
6
22
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
name: {
|
|
33
|
-
type: ScalarTypeEnum.NonEmptyString(),
|
|
34
|
-
isOptional: false
|
|
35
|
-
},
|
|
36
|
-
slug: {
|
|
37
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
38
|
-
isOptional: false
|
|
39
|
-
},
|
|
40
|
-
status: {
|
|
41
|
-
type: AgentStatusEnum,
|
|
42
|
-
isOptional: false
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}),
|
|
46
|
-
errors: { SLUG_EXISTS: {
|
|
47
|
-
description: "An agent with this slug already exists in the organization",
|
|
48
|
-
http: 409,
|
|
49
|
-
gqlCode: "SLUG_EXISTS",
|
|
50
|
-
when: "Slug is already taken"
|
|
51
|
-
} }
|
|
52
|
-
},
|
|
53
|
-
policy: { auth: "user" },
|
|
54
|
-
sideEffects: {
|
|
55
|
-
emits: [{
|
|
56
|
-
ref: AgentCreatedEvent.meta,
|
|
57
|
-
when: "Agent is successfully created"
|
|
58
|
-
}],
|
|
59
|
-
audit: ["agent-console.agent.created"]
|
|
60
|
-
},
|
|
61
|
-
acceptance: {
|
|
62
|
-
scenarios: [{
|
|
63
|
-
key: "create-agent-happy-path",
|
|
64
|
-
given: ["User is authenticated", "Organization exists"],
|
|
65
|
-
when: ["User submits valid agent configuration"],
|
|
66
|
-
then: ["New agent is created with DRAFT status", "AgentCreated event is emitted"]
|
|
67
|
-
}, {
|
|
68
|
-
key: "create-agent-slug-conflict",
|
|
69
|
-
given: ["User is authenticated", "Agent with same slug exists"],
|
|
70
|
-
when: ["User submits agent with duplicate slug"],
|
|
71
|
-
then: ["SLUG_EXISTS error is returned with 409 status"]
|
|
72
|
-
}],
|
|
73
|
-
examples: [{
|
|
74
|
-
key: "basic-create",
|
|
75
|
-
input: {
|
|
76
|
-
name: "Support Assistant",
|
|
77
|
-
slug: "support-assistant",
|
|
78
|
-
modelProvider: "openai",
|
|
79
|
-
modelId: "gpt-4"
|
|
80
|
-
},
|
|
81
|
-
output: {
|
|
82
|
-
id: "agent-123",
|
|
83
|
-
name: "Support Assistant",
|
|
84
|
-
slug: "support-assistant",
|
|
85
|
-
status: "draft"
|
|
86
|
-
}
|
|
87
|
-
}]
|
|
88
|
-
}
|
|
23
|
+
// src/agent/agent.event.ts
|
|
24
|
+
import { defineEvent, defineSchemaModel } from "@contractspec/lib.contracts";
|
|
25
|
+
import { ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
26
|
+
var OWNERS = ["@agent-console-team"];
|
|
27
|
+
var AgentCreatedPayload = defineSchemaModel({
|
|
28
|
+
name: "AgentCreatedPayload",
|
|
29
|
+
description: "Payload for agent created event",
|
|
30
|
+
fields: {
|
|
31
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
32
|
+
organizationId: {
|
|
33
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
34
|
+
isOptional: false
|
|
35
|
+
},
|
|
36
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
modelProvider: {
|
|
39
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
40
|
+
isOptional: false
|
|
41
|
+
},
|
|
42
|
+
modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
toolCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
44
|
+
createdById: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
45
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
46
|
+
}
|
|
89
47
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
description: "Updates an existing AI agent configuration.",
|
|
101
|
-
goal: "Allow users to modify agent settings and configuration.",
|
|
102
|
-
context: "Called from the agent settings UI."
|
|
103
|
-
},
|
|
104
|
-
io: {
|
|
105
|
-
input: UpdateAgentInputModel,
|
|
106
|
-
output: defineSchemaModel({
|
|
107
|
-
name: "UpdateAgentOutput",
|
|
108
|
-
fields: {
|
|
109
|
-
id: {
|
|
110
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
111
|
-
isOptional: false
|
|
112
|
-
},
|
|
113
|
-
name: {
|
|
114
|
-
type: ScalarTypeEnum.NonEmptyString(),
|
|
115
|
-
isOptional: false
|
|
116
|
-
},
|
|
117
|
-
status: {
|
|
118
|
-
type: AgentStatusEnum,
|
|
119
|
-
isOptional: false
|
|
120
|
-
},
|
|
121
|
-
updatedAt: {
|
|
122
|
-
type: ScalarTypeEnum.DateTime(),
|
|
123
|
-
isOptional: false
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
errors: { AGENT_NOT_FOUND: {
|
|
128
|
-
description: "The specified agent does not exist",
|
|
129
|
-
http: 404,
|
|
130
|
-
gqlCode: "AGENT_NOT_FOUND",
|
|
131
|
-
when: "Agent ID is invalid"
|
|
132
|
-
} }
|
|
133
|
-
},
|
|
134
|
-
policy: { auth: "user" },
|
|
135
|
-
sideEffects: {
|
|
136
|
-
emits: [{
|
|
137
|
-
key: "agent.updated",
|
|
138
|
-
version: "1.0.0",
|
|
139
|
-
stability: "stable",
|
|
140
|
-
owners: [...OWNERS],
|
|
141
|
-
tags: ["agent", "updated"],
|
|
142
|
-
when: "Agent is updated",
|
|
143
|
-
payload: AgentSummaryModel
|
|
144
|
-
}],
|
|
145
|
-
audit: ["agent.updated"]
|
|
146
|
-
},
|
|
147
|
-
acceptance: {
|
|
148
|
-
scenarios: [{
|
|
149
|
-
key: "update-agent-happy-path",
|
|
150
|
-
given: ["Agent exists", "User owns the agent"],
|
|
151
|
-
when: ["User submits updated configuration"],
|
|
152
|
-
then: ["Agent is updated", "AgentUpdated event is emitted"]
|
|
153
|
-
}, {
|
|
154
|
-
key: "update-agent-not-found",
|
|
155
|
-
given: ["Agent does not exist"],
|
|
156
|
-
when: ["User attempts to update"],
|
|
157
|
-
then: ["AGENT_NOT_FOUND error is returned"]
|
|
158
|
-
}],
|
|
159
|
-
examples: [{
|
|
160
|
-
key: "update-name",
|
|
161
|
-
input: {
|
|
162
|
-
agentId: "agent-123",
|
|
163
|
-
name: "Updated Assistant",
|
|
164
|
-
systemPrompt: "You are a helpful assistant."
|
|
165
|
-
},
|
|
166
|
-
output: {
|
|
167
|
-
id: "agent-123",
|
|
168
|
-
name: "Updated Assistant",
|
|
169
|
-
status: "draft",
|
|
170
|
-
updatedAt: "2025-01-01T00:00:00Z"
|
|
171
|
-
}
|
|
172
|
-
}]
|
|
173
|
-
}
|
|
48
|
+
var AgentCreatedEvent = defineEvent({
|
|
49
|
+
meta: {
|
|
50
|
+
key: "agent-console.agent.created",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
description: "A new AI agent was configured.",
|
|
53
|
+
stability: "stable",
|
|
54
|
+
owners: [...OWNERS],
|
|
55
|
+
tags: ["agent", "created"]
|
|
56
|
+
},
|
|
57
|
+
payload: AgentCreatedPayload
|
|
174
58
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
agentId: {
|
|
194
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
195
|
-
isOptional: false
|
|
196
|
-
},
|
|
197
|
-
includeTools: {
|
|
198
|
-
type: ScalarTypeEnum.Boolean(),
|
|
199
|
-
isOptional: true
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}),
|
|
203
|
-
output: AgentWithToolsModel,
|
|
204
|
-
errors: { AGENT_NOT_FOUND: {
|
|
205
|
-
description: "The specified agent does not exist",
|
|
206
|
-
http: 404,
|
|
207
|
-
gqlCode: "AGENT_NOT_FOUND",
|
|
208
|
-
when: "Agent ID is invalid"
|
|
209
|
-
} }
|
|
210
|
-
},
|
|
211
|
-
policy: { auth: "user" },
|
|
212
|
-
acceptance: {
|
|
213
|
-
scenarios: [{
|
|
214
|
-
key: "get-agent-happy-path",
|
|
215
|
-
given: ["Agent exists"],
|
|
216
|
-
when: ["User requests agent by ID"],
|
|
217
|
-
then: ["Agent details are returned"]
|
|
218
|
-
}, {
|
|
219
|
-
key: "get-agent-with-tools",
|
|
220
|
-
given: ["Agent exists with assigned tools"],
|
|
221
|
-
when: ["User requests agent with includeTools=true"],
|
|
222
|
-
then: ["Agent details with tools list are returned"]
|
|
223
|
-
}],
|
|
224
|
-
examples: [{
|
|
225
|
-
key: "get-basic",
|
|
226
|
-
input: {
|
|
227
|
-
agentId: "agent-123",
|
|
228
|
-
includeTools: false
|
|
229
|
-
},
|
|
230
|
-
output: {
|
|
231
|
-
id: "agent-123",
|
|
232
|
-
name: "Support Assistant",
|
|
233
|
-
status: "active",
|
|
234
|
-
tools: []
|
|
235
|
-
}
|
|
236
|
-
}]
|
|
237
|
-
}
|
|
59
|
+
var AgentUpdatedPayload = defineSchemaModel({
|
|
60
|
+
name: "AgentUpdatedPayload",
|
|
61
|
+
description: "Payload for agent updated event",
|
|
62
|
+
fields: {
|
|
63
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
64
|
+
organizationId: {
|
|
65
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
66
|
+
isOptional: false
|
|
67
|
+
},
|
|
68
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
69
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
70
|
+
updatedFields: {
|
|
71
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
72
|
+
isArray: true,
|
|
73
|
+
isOptional: false
|
|
74
|
+
},
|
|
75
|
+
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
76
|
+
}
|
|
238
77
|
});
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
description: "Lists agents for an organization with optional filtering.",
|
|
250
|
-
goal: "Browse and search available agents.",
|
|
251
|
-
context: "Agent list/dashboard view."
|
|
252
|
-
},
|
|
253
|
-
io: {
|
|
254
|
-
input: defineSchemaModel({
|
|
255
|
-
name: "ListAgentsInput",
|
|
256
|
-
fields: {
|
|
257
|
-
organizationId: {
|
|
258
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
259
|
-
isOptional: false
|
|
260
|
-
},
|
|
261
|
-
status: {
|
|
262
|
-
type: AgentStatusEnum,
|
|
263
|
-
isOptional: true
|
|
264
|
-
},
|
|
265
|
-
modelProvider: {
|
|
266
|
-
type: ModelProviderEnum,
|
|
267
|
-
isOptional: true
|
|
268
|
-
},
|
|
269
|
-
search: {
|
|
270
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
271
|
-
isOptional: true
|
|
272
|
-
},
|
|
273
|
-
limit: {
|
|
274
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
275
|
-
isOptional: true,
|
|
276
|
-
defaultValue: 20
|
|
277
|
-
},
|
|
278
|
-
offset: {
|
|
279
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
280
|
-
isOptional: true,
|
|
281
|
-
defaultValue: 0
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}),
|
|
285
|
-
output: defineSchemaModel({
|
|
286
|
-
name: "ListAgentsOutput",
|
|
287
|
-
fields: {
|
|
288
|
-
items: {
|
|
289
|
-
type: AgentSummaryModel,
|
|
290
|
-
isArray: true,
|
|
291
|
-
isOptional: false
|
|
292
|
-
},
|
|
293
|
-
total: {
|
|
294
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
295
|
-
isOptional: false
|
|
296
|
-
},
|
|
297
|
-
hasMore: {
|
|
298
|
-
type: ScalarTypeEnum.Boolean(),
|
|
299
|
-
isOptional: false
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
})
|
|
303
|
-
},
|
|
304
|
-
policy: { auth: "user" },
|
|
305
|
-
acceptance: {
|
|
306
|
-
scenarios: [{
|
|
307
|
-
key: "list-agents-happy-path",
|
|
308
|
-
given: ["Organization has agents"],
|
|
309
|
-
when: ["User lists agents"],
|
|
310
|
-
then: ["Paginated list of agents is returned"]
|
|
311
|
-
}, {
|
|
312
|
-
key: "list-agents-filter-by-status",
|
|
313
|
-
given: ["Organization has agents with mixed statuses"],
|
|
314
|
-
when: ["User filters by status=active"],
|
|
315
|
-
then: ["Only active agents are returned"]
|
|
316
|
-
}],
|
|
317
|
-
examples: [{
|
|
318
|
-
key: "list-basic",
|
|
319
|
-
input: {
|
|
320
|
-
organizationId: "org-123",
|
|
321
|
-
limit: 10,
|
|
322
|
-
offset: 0
|
|
323
|
-
},
|
|
324
|
-
output: {
|
|
325
|
-
items: [],
|
|
326
|
-
total: 0,
|
|
327
|
-
hasMore: false
|
|
328
|
-
}
|
|
329
|
-
}]
|
|
330
|
-
}
|
|
78
|
+
var AgentUpdatedEvent = defineEvent({
|
|
79
|
+
meta: {
|
|
80
|
+
key: "agent-console.agent.updated",
|
|
81
|
+
version: "1.0.0",
|
|
82
|
+
description: "An AI agent configuration was updated.",
|
|
83
|
+
stability: "stable",
|
|
84
|
+
owners: [...OWNERS],
|
|
85
|
+
tags: ["agent", "updated"]
|
|
86
|
+
},
|
|
87
|
+
payload: AgentUpdatedPayload
|
|
331
88
|
});
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
"agent",
|
|
343
|
-
"tool",
|
|
344
|
-
"assign"
|
|
345
|
-
],
|
|
346
|
-
description: "Assigns a tool to an agent with optional configuration.",
|
|
347
|
-
goal: "Enable agents to use specific tools.",
|
|
348
|
-
context: "Agent configuration UI - tool selection."
|
|
349
|
-
},
|
|
350
|
-
io: {
|
|
351
|
-
input: defineSchemaModel({
|
|
352
|
-
name: "AssignToolToAgentInput",
|
|
353
|
-
fields: {
|
|
354
|
-
agentId: {
|
|
355
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
356
|
-
isOptional: false
|
|
357
|
-
},
|
|
358
|
-
toolId: {
|
|
359
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
360
|
-
isOptional: false
|
|
361
|
-
},
|
|
362
|
-
config: {
|
|
363
|
-
type: ScalarTypeEnum.JSONObject(),
|
|
364
|
-
isOptional: true
|
|
365
|
-
},
|
|
366
|
-
order: {
|
|
367
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
368
|
-
isOptional: true
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}),
|
|
372
|
-
output: defineSchemaModel({
|
|
373
|
-
name: "AssignToolToAgentOutput",
|
|
374
|
-
fields: {
|
|
375
|
-
agentToolId: {
|
|
376
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
377
|
-
isOptional: false
|
|
378
|
-
},
|
|
379
|
-
agentId: {
|
|
380
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
381
|
-
isOptional: false
|
|
382
|
-
},
|
|
383
|
-
toolId: {
|
|
384
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
385
|
-
isOptional: false
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}),
|
|
389
|
-
errors: { TOOL_ALREADY_ASSIGNED: {
|
|
390
|
-
description: "This tool is already assigned to the agent",
|
|
391
|
-
http: 409,
|
|
392
|
-
gqlCode: "TOOL_ALREADY_ASSIGNED",
|
|
393
|
-
when: "Tool assignment already exists"
|
|
394
|
-
} }
|
|
395
|
-
},
|
|
396
|
-
policy: { auth: "user" },
|
|
397
|
-
sideEffects: { audit: ["agent.tool.assigned"] },
|
|
398
|
-
acceptance: {
|
|
399
|
-
scenarios: [{
|
|
400
|
-
key: "assign-tool-happy-path",
|
|
401
|
-
given: ["Agent exists", "Tool exists and is not assigned"],
|
|
402
|
-
when: ["User assigns tool to agent"],
|
|
403
|
-
then: ["Tool is assigned", "Assignment ID is returned"]
|
|
404
|
-
}, {
|
|
405
|
-
key: "assign-tool-already-assigned",
|
|
406
|
-
given: ["Tool is already assigned to agent"],
|
|
407
|
-
when: ["User attempts to assign again"],
|
|
408
|
-
then: ["TOOL_ALREADY_ASSIGNED error is returned"]
|
|
409
|
-
}],
|
|
410
|
-
examples: [{
|
|
411
|
-
key: "assign-basic",
|
|
412
|
-
input: {
|
|
413
|
-
agentId: "agent-123",
|
|
414
|
-
toolId: "tool-456"
|
|
415
|
-
},
|
|
416
|
-
output: {
|
|
417
|
-
agentToolId: "at-789",
|
|
418
|
-
agentId: "agent-123",
|
|
419
|
-
toolId: "tool-456"
|
|
420
|
-
}
|
|
421
|
-
}]
|
|
422
|
-
}
|
|
89
|
+
var AgentToolAssignedPayload = defineSchemaModel({
|
|
90
|
+
name: "AgentToolAssignedPayload",
|
|
91
|
+
description: "Payload for agent tool assigned event",
|
|
92
|
+
fields: {
|
|
93
|
+
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
+
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
+
agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
96
|
+
toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
97
|
+
assignedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
98
|
+
}
|
|
423
99
|
});
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
output: defineSchemaModel({
|
|
457
|
-
name: "RemoveToolFromAgentOutput",
|
|
458
|
-
fields: { success: {
|
|
459
|
-
type: ScalarTypeEnum.Boolean(),
|
|
460
|
-
isOptional: false
|
|
461
|
-
} }
|
|
462
|
-
})
|
|
463
|
-
},
|
|
464
|
-
policy: { auth: "user" },
|
|
465
|
-
sideEffects: { audit: ["agent.tool.removed"] },
|
|
466
|
-
acceptance: {
|
|
467
|
-
scenarios: [{
|
|
468
|
-
key: "remove-tool-happy-path",
|
|
469
|
-
given: ["Agent exists", "Tool is assigned to agent"],
|
|
470
|
-
when: ["User removes tool from agent"],
|
|
471
|
-
then: ["Tool is unassigned", "Success is returned"]
|
|
472
|
-
}],
|
|
473
|
-
examples: [{
|
|
474
|
-
key: "remove-basic",
|
|
475
|
-
input: {
|
|
476
|
-
agentId: "agent-123",
|
|
477
|
-
toolId: "tool-456"
|
|
478
|
-
},
|
|
479
|
-
output: { success: true }
|
|
480
|
-
}]
|
|
481
|
-
}
|
|
100
|
+
var AgentToolAssignedEvent = defineEvent({
|
|
101
|
+
meta: {
|
|
102
|
+
key: "agent-console.agent.toolAssigned",
|
|
103
|
+
version: "1.0.0",
|
|
104
|
+
description: "A tool was assigned to an agent.",
|
|
105
|
+
stability: "stable",
|
|
106
|
+
owners: [...OWNERS],
|
|
107
|
+
tags: ["agent", "tool", "assigned"]
|
|
108
|
+
},
|
|
109
|
+
payload: AgentToolAssignedPayload
|
|
110
|
+
});
|
|
111
|
+
var AgentToolRemovedPayload = defineSchemaModel({
|
|
112
|
+
name: "AgentToolRemovedPayload",
|
|
113
|
+
description: "Payload for agent tool removed event",
|
|
114
|
+
fields: {
|
|
115
|
+
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
116
|
+
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
117
|
+
agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
118
|
+
toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
119
|
+
removedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var AgentToolRemovedEvent = defineEvent({
|
|
123
|
+
meta: {
|
|
124
|
+
key: "agent-console.agent.toolRemoved",
|
|
125
|
+
version: "1.0.0",
|
|
126
|
+
description: "A tool was removed from an agent.",
|
|
127
|
+
stability: "stable",
|
|
128
|
+
owners: [...OWNERS],
|
|
129
|
+
tags: ["agent", "tool", "removed"]
|
|
130
|
+
},
|
|
131
|
+
payload: AgentToolRemovedPayload
|
|
482
132
|
});
|
|
483
133
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
134
|
+
// src/agent/agent.schema.ts
|
|
135
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
136
|
+
var AgentModel = defineSchemaModel2({
|
|
137
|
+
name: "Agent",
|
|
138
|
+
description: "AI agent configuration",
|
|
139
|
+
fields: {
|
|
140
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
141
|
+
organizationId: {
|
|
142
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
143
|
+
isOptional: false
|
|
144
|
+
},
|
|
145
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
146
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
147
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
148
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
149
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
150
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
151
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
152
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
153
|
+
userPromptTemplate: {
|
|
154
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
155
|
+
isOptional: true
|
|
156
|
+
},
|
|
157
|
+
toolIds: {
|
|
158
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
159
|
+
isArray: true,
|
|
160
|
+
isOptional: true
|
|
161
|
+
},
|
|
162
|
+
toolChoice: {
|
|
163
|
+
type: ToolChoiceEnum,
|
|
164
|
+
isOptional: false,
|
|
165
|
+
defaultValue: "auto"
|
|
166
|
+
},
|
|
167
|
+
maxIterations: {
|
|
168
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
169
|
+
isOptional: false,
|
|
170
|
+
defaultValue: 10
|
|
171
|
+
},
|
|
172
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
173
|
+
timeoutMs: {
|
|
174
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
175
|
+
isOptional: false,
|
|
176
|
+
defaultValue: 120000
|
|
177
|
+
},
|
|
178
|
+
version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
179
|
+
tags: {
|
|
180
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
181
|
+
isArray: true,
|
|
182
|
+
isOptional: true
|
|
183
|
+
},
|
|
184
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
185
|
+
updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
var AgentSummaryModel = defineSchemaModel2({
|
|
189
|
+
name: "AgentSummary",
|
|
190
|
+
description: "Summary of an agent for list views",
|
|
191
|
+
fields: {
|
|
192
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
193
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
194
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
195
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
196
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
197
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
198
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
199
|
+
version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
200
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
var AgentToolRefModel = defineSchemaModel2({
|
|
204
|
+
name: "AgentToolRef",
|
|
205
|
+
description: "Tool reference in agent context",
|
|
206
|
+
fields: {
|
|
207
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
208
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
209
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
210
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
211
|
+
category: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
var AgentWithToolsModel = defineSchemaModel2({
|
|
215
|
+
name: "AgentWithTools",
|
|
216
|
+
description: "Agent with associated tools",
|
|
217
|
+
fields: {
|
|
218
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
219
|
+
organizationId: {
|
|
220
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
221
|
+
isOptional: false
|
|
222
|
+
},
|
|
223
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
224
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
225
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
226
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
227
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
228
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
229
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
230
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
231
|
+
userPromptTemplate: {
|
|
232
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
233
|
+
isOptional: true
|
|
234
|
+
},
|
|
235
|
+
toolIds: {
|
|
236
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
237
|
+
isArray: true,
|
|
238
|
+
isOptional: true
|
|
239
|
+
},
|
|
240
|
+
toolChoice: { type: ToolChoiceEnum, isOptional: false },
|
|
241
|
+
maxIterations: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
242
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
243
|
+
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
244
|
+
version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
245
|
+
tags: {
|
|
246
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
247
|
+
isArray: true,
|
|
248
|
+
isOptional: true
|
|
249
|
+
},
|
|
250
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
251
|
+
updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
252
|
+
tools: { type: AgentToolRefModel, isArray: true, isOptional: true }
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
var CreateAgentInputModel = defineSchemaModel2({
|
|
256
|
+
name: "CreateAgentInput",
|
|
257
|
+
description: "Input for creating an agent",
|
|
258
|
+
fields: {
|
|
259
|
+
organizationId: {
|
|
260
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
261
|
+
isOptional: false
|
|
262
|
+
},
|
|
263
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
264
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
265
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
266
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
267
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
268
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
269
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
270
|
+
userPromptTemplate: {
|
|
271
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
272
|
+
isOptional: true
|
|
273
|
+
},
|
|
274
|
+
toolIds: {
|
|
275
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
276
|
+
isArray: true,
|
|
277
|
+
isOptional: true
|
|
278
|
+
},
|
|
279
|
+
toolChoice: { type: ToolChoiceEnum, isOptional: true },
|
|
280
|
+
maxIterations: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
281
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
282
|
+
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
283
|
+
tags: {
|
|
284
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
285
|
+
isArray: true,
|
|
286
|
+
isOptional: true
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
var UpdateAgentInputModel = defineSchemaModel2({
|
|
291
|
+
name: "UpdateAgentInput",
|
|
292
|
+
description: "Input for updating an agent",
|
|
293
|
+
fields: {
|
|
294
|
+
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
295
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: true },
|
|
296
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
297
|
+
status: { type: AgentStatusEnum, isOptional: true },
|
|
298
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
299
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
300
|
+
userPromptTemplate: {
|
|
301
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
302
|
+
isOptional: true
|
|
303
|
+
},
|
|
304
|
+
toolIds: {
|
|
305
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
306
|
+
isArray: true,
|
|
307
|
+
isOptional: true
|
|
308
|
+
},
|
|
309
|
+
toolChoice: { type: ToolChoiceEnum, isOptional: true },
|
|
310
|
+
maxIterations: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
311
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
312
|
+
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
313
|
+
tags: {
|
|
314
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
315
|
+
isArray: true,
|
|
316
|
+
isOptional: true
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
// src/agent/agent.operation.ts
|
|
322
|
+
import {
|
|
323
|
+
defineCommand,
|
|
324
|
+
defineQuery
|
|
325
|
+
} from "@contractspec/lib.contracts/operations";
|
|
326
|
+
import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
|
|
327
|
+
var OWNERS2 = ["@agent-console-team"];
|
|
328
|
+
var CreateAgentCommand = defineCommand({
|
|
329
|
+
meta: {
|
|
330
|
+
key: "agent-console.agent.create",
|
|
331
|
+
version: "1.0.0",
|
|
332
|
+
stability: "stable",
|
|
333
|
+
owners: [...OWNERS2],
|
|
334
|
+
tags: ["agent", "create"],
|
|
335
|
+
description: "Creates a new AI agent configuration.",
|
|
336
|
+
goal: "Allow users to define new AI agents with specific models and tools.",
|
|
337
|
+
context: "Called from the agent builder UI when creating a new agent."
|
|
338
|
+
},
|
|
339
|
+
io: {
|
|
340
|
+
input: CreateAgentInputModel,
|
|
341
|
+
output: defineSchemaModel3({
|
|
342
|
+
name: "CreateAgentOutput",
|
|
343
|
+
fields: {
|
|
344
|
+
id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
345
|
+
name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
|
|
346
|
+
slug: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
347
|
+
status: { type: AgentStatusEnum, isOptional: false }
|
|
348
|
+
}
|
|
349
|
+
}),
|
|
350
|
+
errors: {
|
|
351
|
+
SLUG_EXISTS: {
|
|
352
|
+
description: "An agent with this slug already exists in the organization",
|
|
353
|
+
http: 409,
|
|
354
|
+
gqlCode: "SLUG_EXISTS",
|
|
355
|
+
when: "Slug is already taken"
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
policy: { auth: "user" },
|
|
360
|
+
sideEffects: {
|
|
361
|
+
emits: [
|
|
362
|
+
{
|
|
363
|
+
ref: AgentCreatedEvent.meta,
|
|
364
|
+
when: "Agent is successfully created"
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
audit: ["agent-console.agent.created"]
|
|
368
|
+
},
|
|
369
|
+
acceptance: {
|
|
370
|
+
scenarios: [
|
|
371
|
+
{
|
|
372
|
+
key: "create-agent-happy-path",
|
|
373
|
+
given: ["User is authenticated", "Organization exists"],
|
|
374
|
+
when: ["User submits valid agent configuration"],
|
|
375
|
+
then: [
|
|
376
|
+
"New agent is created with DRAFT status",
|
|
377
|
+
"AgentCreated event is emitted"
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
key: "create-agent-slug-conflict",
|
|
382
|
+
given: ["User is authenticated", "Agent with same slug exists"],
|
|
383
|
+
when: ["User submits agent with duplicate slug"],
|
|
384
|
+
then: ["SLUG_EXISTS error is returned with 409 status"]
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
examples: [
|
|
388
|
+
{
|
|
389
|
+
key: "basic-create",
|
|
390
|
+
input: {
|
|
391
|
+
name: "Support Assistant",
|
|
392
|
+
slug: "support-assistant",
|
|
393
|
+
modelProvider: "openai",
|
|
394
|
+
modelId: "gpt-4"
|
|
395
|
+
},
|
|
396
|
+
output: {
|
|
397
|
+
id: "agent-123",
|
|
398
|
+
name: "Support Assistant",
|
|
399
|
+
slug: "support-assistant",
|
|
400
|
+
status: "draft"
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
var UpdateAgentCommand = defineCommand({
|
|
407
|
+
meta: {
|
|
408
|
+
key: "agent-console.agent.update",
|
|
409
|
+
version: "1.0.0",
|
|
410
|
+
stability: "stable",
|
|
411
|
+
owners: [...OWNERS2],
|
|
412
|
+
tags: ["agent", "update"],
|
|
413
|
+
description: "Updates an existing AI agent configuration.",
|
|
414
|
+
goal: "Allow users to modify agent settings and configuration.",
|
|
415
|
+
context: "Called from the agent settings UI."
|
|
416
|
+
},
|
|
417
|
+
io: {
|
|
418
|
+
input: UpdateAgentInputModel,
|
|
419
|
+
output: defineSchemaModel3({
|
|
420
|
+
name: "UpdateAgentOutput",
|
|
421
|
+
fields: {
|
|
422
|
+
id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
423
|
+
name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
|
|
424
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
425
|
+
updatedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
426
|
+
}
|
|
427
|
+
}),
|
|
428
|
+
errors: {
|
|
429
|
+
AGENT_NOT_FOUND: {
|
|
430
|
+
description: "The specified agent does not exist",
|
|
431
|
+
http: 404,
|
|
432
|
+
gqlCode: "AGENT_NOT_FOUND",
|
|
433
|
+
when: "Agent ID is invalid"
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
policy: { auth: "user" },
|
|
438
|
+
sideEffects: {
|
|
439
|
+
emits: [
|
|
440
|
+
{
|
|
441
|
+
key: "agent.updated",
|
|
442
|
+
version: "1.0.0",
|
|
443
|
+
stability: "stable",
|
|
444
|
+
owners: [...OWNERS2],
|
|
445
|
+
tags: ["agent", "updated"],
|
|
446
|
+
when: "Agent is updated",
|
|
447
|
+
payload: AgentSummaryModel
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
audit: ["agent.updated"]
|
|
451
|
+
},
|
|
452
|
+
acceptance: {
|
|
453
|
+
scenarios: [
|
|
454
|
+
{
|
|
455
|
+
key: "update-agent-happy-path",
|
|
456
|
+
given: ["Agent exists", "User owns the agent"],
|
|
457
|
+
when: ["User submits updated configuration"],
|
|
458
|
+
then: ["Agent is updated", "AgentUpdated event is emitted"]
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
key: "update-agent-not-found",
|
|
462
|
+
given: ["Agent does not exist"],
|
|
463
|
+
when: ["User attempts to update"],
|
|
464
|
+
then: ["AGENT_NOT_FOUND error is returned"]
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
examples: [
|
|
468
|
+
{
|
|
469
|
+
key: "update-name",
|
|
470
|
+
input: {
|
|
471
|
+
agentId: "agent-123",
|
|
472
|
+
name: "Updated Assistant",
|
|
473
|
+
systemPrompt: "You are a helpful assistant."
|
|
474
|
+
},
|
|
475
|
+
output: {
|
|
476
|
+
id: "agent-123",
|
|
477
|
+
name: "Updated Assistant",
|
|
478
|
+
status: "draft",
|
|
479
|
+
updatedAt: "2025-01-01T00:00:00Z"
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
var GetAgentQuery = defineQuery({
|
|
486
|
+
meta: {
|
|
487
|
+
key: "agent-console.agent.get",
|
|
488
|
+
version: "1.0.0",
|
|
489
|
+
stability: "stable",
|
|
490
|
+
owners: [...OWNERS2],
|
|
491
|
+
tags: ["agent", "get"],
|
|
492
|
+
description: "Retrieves an agent by its ID.",
|
|
493
|
+
goal: "View detailed agent configuration.",
|
|
494
|
+
context: "Called when viewing agent details or editing."
|
|
495
|
+
},
|
|
496
|
+
io: {
|
|
497
|
+
input: defineSchemaModel3({
|
|
498
|
+
name: "GetAgentInput",
|
|
499
|
+
fields: {
|
|
500
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
501
|
+
includeTools: { type: ScalarTypeEnum3.Boolean(), isOptional: true }
|
|
502
|
+
}
|
|
503
|
+
}),
|
|
504
|
+
output: AgentWithToolsModel,
|
|
505
|
+
errors: {
|
|
506
|
+
AGENT_NOT_FOUND: {
|
|
507
|
+
description: "The specified agent does not exist",
|
|
508
|
+
http: 404,
|
|
509
|
+
gqlCode: "AGENT_NOT_FOUND",
|
|
510
|
+
when: "Agent ID is invalid"
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
policy: { auth: "user" },
|
|
515
|
+
acceptance: {
|
|
516
|
+
scenarios: [
|
|
517
|
+
{
|
|
518
|
+
key: "get-agent-happy-path",
|
|
519
|
+
given: ["Agent exists"],
|
|
520
|
+
when: ["User requests agent by ID"],
|
|
521
|
+
then: ["Agent details are returned"]
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
key: "get-agent-with-tools",
|
|
525
|
+
given: ["Agent exists with assigned tools"],
|
|
526
|
+
when: ["User requests agent with includeTools=true"],
|
|
527
|
+
then: ["Agent details with tools list are returned"]
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
examples: [
|
|
531
|
+
{
|
|
532
|
+
key: "get-basic",
|
|
533
|
+
input: { agentId: "agent-123", includeTools: false },
|
|
534
|
+
output: {
|
|
535
|
+
id: "agent-123",
|
|
536
|
+
name: "Support Assistant",
|
|
537
|
+
status: "active",
|
|
538
|
+
tools: []
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
var ListAgentsQuery = defineQuery({
|
|
545
|
+
meta: {
|
|
546
|
+
key: "agent-console.agent.list",
|
|
547
|
+
version: "1.0.0",
|
|
548
|
+
stability: "stable",
|
|
549
|
+
owners: [...OWNERS2],
|
|
550
|
+
tags: ["agent", "list"],
|
|
551
|
+
description: "Lists agents for an organization with optional filtering.",
|
|
552
|
+
goal: "Browse and search available agents.",
|
|
553
|
+
context: "Agent list/dashboard view."
|
|
554
|
+
},
|
|
555
|
+
io: {
|
|
556
|
+
input: defineSchemaModel3({
|
|
557
|
+
name: "ListAgentsInput",
|
|
558
|
+
fields: {
|
|
559
|
+
organizationId: {
|
|
560
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
561
|
+
isOptional: false
|
|
562
|
+
},
|
|
563
|
+
status: { type: AgentStatusEnum, isOptional: true },
|
|
564
|
+
modelProvider: { type: ModelProviderEnum, isOptional: true },
|
|
565
|
+
search: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
566
|
+
limit: {
|
|
567
|
+
type: ScalarTypeEnum3.Int_unsecure(),
|
|
568
|
+
isOptional: true,
|
|
569
|
+
defaultValue: 20
|
|
570
|
+
},
|
|
571
|
+
offset: {
|
|
572
|
+
type: ScalarTypeEnum3.Int_unsecure(),
|
|
573
|
+
isOptional: true,
|
|
574
|
+
defaultValue: 0
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}),
|
|
578
|
+
output: defineSchemaModel3({
|
|
579
|
+
name: "ListAgentsOutput",
|
|
580
|
+
fields: {
|
|
581
|
+
items: { type: AgentSummaryModel, isArray: true, isOptional: false },
|
|
582
|
+
total: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
583
|
+
hasMore: { type: ScalarTypeEnum3.Boolean(), isOptional: false }
|
|
584
|
+
}
|
|
585
|
+
})
|
|
586
|
+
},
|
|
587
|
+
policy: { auth: "user" },
|
|
588
|
+
acceptance: {
|
|
589
|
+
scenarios: [
|
|
590
|
+
{
|
|
591
|
+
key: "list-agents-happy-path",
|
|
592
|
+
given: ["Organization has agents"],
|
|
593
|
+
when: ["User lists agents"],
|
|
594
|
+
then: ["Paginated list of agents is returned"]
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
key: "list-agents-filter-by-status",
|
|
598
|
+
given: ["Organization has agents with mixed statuses"],
|
|
599
|
+
when: ["User filters by status=active"],
|
|
600
|
+
then: ["Only active agents are returned"]
|
|
601
|
+
}
|
|
602
|
+
],
|
|
603
|
+
examples: [
|
|
604
|
+
{
|
|
605
|
+
key: "list-basic",
|
|
606
|
+
input: { organizationId: "org-123", limit: 10, offset: 0 },
|
|
607
|
+
output: { items: [], total: 0, hasMore: false }
|
|
608
|
+
}
|
|
609
|
+
]
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
var AssignToolToAgentCommand = defineCommand({
|
|
613
|
+
meta: {
|
|
614
|
+
key: "agent-console.agent.assignTool",
|
|
615
|
+
version: "1.0.0",
|
|
616
|
+
stability: "stable",
|
|
617
|
+
owners: [...OWNERS2],
|
|
618
|
+
tags: ["agent", "tool", "assign"],
|
|
619
|
+
description: "Assigns a tool to an agent with optional configuration.",
|
|
620
|
+
goal: "Enable agents to use specific tools.",
|
|
621
|
+
context: "Agent configuration UI - tool selection."
|
|
622
|
+
},
|
|
623
|
+
io: {
|
|
624
|
+
input: defineSchemaModel3({
|
|
625
|
+
name: "AssignToolToAgentInput",
|
|
626
|
+
fields: {
|
|
627
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
628
|
+
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
629
|
+
config: { type: ScalarTypeEnum3.JSONObject(), isOptional: true },
|
|
630
|
+
order: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: true }
|
|
631
|
+
}
|
|
632
|
+
}),
|
|
633
|
+
output: defineSchemaModel3({
|
|
634
|
+
name: "AssignToolToAgentOutput",
|
|
635
|
+
fields: {
|
|
636
|
+
agentToolId: {
|
|
637
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
638
|
+
isOptional: false
|
|
639
|
+
},
|
|
640
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
641
|
+
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
|
|
642
|
+
}
|
|
643
|
+
}),
|
|
644
|
+
errors: {
|
|
645
|
+
TOOL_ALREADY_ASSIGNED: {
|
|
646
|
+
description: "This tool is already assigned to the agent",
|
|
647
|
+
http: 409,
|
|
648
|
+
gqlCode: "TOOL_ALREADY_ASSIGNED",
|
|
649
|
+
when: "Tool assignment already exists"
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
policy: { auth: "user" },
|
|
654
|
+
sideEffects: { audit: ["agent.tool.assigned"] },
|
|
655
|
+
acceptance: {
|
|
656
|
+
scenarios: [
|
|
657
|
+
{
|
|
658
|
+
key: "assign-tool-happy-path",
|
|
659
|
+
given: ["Agent exists", "Tool exists and is not assigned"],
|
|
660
|
+
when: ["User assigns tool to agent"],
|
|
661
|
+
then: ["Tool is assigned", "Assignment ID is returned"]
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
key: "assign-tool-already-assigned",
|
|
665
|
+
given: ["Tool is already assigned to agent"],
|
|
666
|
+
when: ["User attempts to assign again"],
|
|
667
|
+
then: ["TOOL_ALREADY_ASSIGNED error is returned"]
|
|
668
|
+
}
|
|
669
|
+
],
|
|
670
|
+
examples: [
|
|
671
|
+
{
|
|
672
|
+
key: "assign-basic",
|
|
673
|
+
input: { agentId: "agent-123", toolId: "tool-456" },
|
|
674
|
+
output: {
|
|
675
|
+
agentToolId: "at-789",
|
|
676
|
+
agentId: "agent-123",
|
|
677
|
+
toolId: "tool-456"
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
var RemoveToolFromAgentCommand = defineCommand({
|
|
684
|
+
meta: {
|
|
685
|
+
key: "agent-console.agent.removeTool",
|
|
686
|
+
version: "1.0.0",
|
|
687
|
+
stability: "stable",
|
|
688
|
+
owners: [...OWNERS2],
|
|
689
|
+
tags: ["agent", "tool", "remove"],
|
|
690
|
+
description: "Removes a tool assignment from an agent.",
|
|
691
|
+
goal: "Disable specific tools for an agent.",
|
|
692
|
+
context: "Agent configuration UI - tool management."
|
|
693
|
+
},
|
|
694
|
+
io: {
|
|
695
|
+
input: defineSchemaModel3({
|
|
696
|
+
name: "RemoveToolFromAgentInput",
|
|
697
|
+
fields: {
|
|
698
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
699
|
+
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
|
|
700
|
+
}
|
|
701
|
+
}),
|
|
702
|
+
output: defineSchemaModel3({
|
|
703
|
+
name: "RemoveToolFromAgentOutput",
|
|
704
|
+
fields: {
|
|
705
|
+
success: { type: ScalarTypeEnum3.Boolean(), isOptional: false }
|
|
706
|
+
}
|
|
707
|
+
})
|
|
708
|
+
},
|
|
709
|
+
policy: { auth: "user" },
|
|
710
|
+
sideEffects: { audit: ["agent.tool.removed"] },
|
|
711
|
+
acceptance: {
|
|
712
|
+
scenarios: [
|
|
713
|
+
{
|
|
714
|
+
key: "remove-tool-happy-path",
|
|
715
|
+
given: ["Agent exists", "Tool is assigned to agent"],
|
|
716
|
+
when: ["User removes tool from agent"],
|
|
717
|
+
then: ["Tool is unassigned", "Success is returned"]
|
|
718
|
+
}
|
|
719
|
+
],
|
|
720
|
+
examples: [
|
|
721
|
+
{
|
|
722
|
+
key: "remove-basic",
|
|
723
|
+
input: { agentId: "agent-123", toolId: "tool-456" },
|
|
724
|
+
output: { success: true }
|
|
725
|
+
}
|
|
726
|
+
]
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
export {
|
|
730
|
+
UpdateAgentCommand,
|
|
731
|
+
RemoveToolFromAgentCommand,
|
|
732
|
+
ListAgentsQuery,
|
|
733
|
+
GetAgentQuery,
|
|
734
|
+
CreateAgentCommand,
|
|
735
|
+
AssignToolToAgentCommand
|
|
736
|
+
};
|