@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,626 +1,668 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/run/run.enum.ts
|
|
3
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
4
|
+
var RunStatusEnum = defineEnum("RunStatus", [
|
|
5
|
+
"QUEUED",
|
|
6
|
+
"IN_PROGRESS",
|
|
7
|
+
"COMPLETED",
|
|
8
|
+
"FAILED",
|
|
9
|
+
"CANCELLED",
|
|
10
|
+
"EXPIRED"
|
|
11
|
+
]);
|
|
12
|
+
var RunStepTypeEnum = defineEnum("RunStepType", [
|
|
13
|
+
"MESSAGE_CREATION",
|
|
14
|
+
"TOOL_CALL",
|
|
15
|
+
"TOOL_RESULT",
|
|
16
|
+
"ERROR"
|
|
17
|
+
]);
|
|
18
|
+
var LogLevelEnum = defineEnum("LogLevel", [
|
|
19
|
+
"DEBUG",
|
|
20
|
+
"INFO",
|
|
21
|
+
"WARN",
|
|
22
|
+
"ERROR"
|
|
23
|
+
]);
|
|
24
|
+
var GranularityEnum = defineEnum("Granularity", [
|
|
25
|
+
"hour",
|
|
26
|
+
"day",
|
|
27
|
+
"week",
|
|
28
|
+
"month"
|
|
29
|
+
]);
|
|
5
30
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
stability: "stable",
|
|
16
|
-
owners: [...OWNERS],
|
|
17
|
-
tags: ["run", "execute"],
|
|
18
|
-
description: "Starts a new agent run with the given input.",
|
|
19
|
-
goal: "Execute an AI agent with user input.",
|
|
20
|
-
context: "Called from chat interface or API."
|
|
21
|
-
},
|
|
22
|
-
io: {
|
|
23
|
-
input: defineSchemaModel({
|
|
24
|
-
name: "ExecuteAgentInput",
|
|
25
|
-
fields: {
|
|
26
|
-
agentId: {
|
|
27
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
28
|
-
isOptional: false
|
|
29
|
-
},
|
|
30
|
-
input: {
|
|
31
|
-
type: RunInputModel,
|
|
32
|
-
isOptional: false
|
|
33
|
-
},
|
|
34
|
-
sessionId: {
|
|
35
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
36
|
-
isOptional: true
|
|
37
|
-
},
|
|
38
|
-
metadata: {
|
|
39
|
-
type: ScalarTypeEnum.JSONObject(),
|
|
40
|
-
isOptional: true
|
|
41
|
-
},
|
|
42
|
-
stream: {
|
|
43
|
-
type: ScalarTypeEnum.Boolean(),
|
|
44
|
-
isOptional: true
|
|
45
|
-
},
|
|
46
|
-
maxIterations: {
|
|
47
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
48
|
-
isOptional: true
|
|
49
|
-
},
|
|
50
|
-
timeoutMs: {
|
|
51
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
52
|
-
isOptional: true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
output: defineSchemaModel({
|
|
57
|
-
name: "ExecuteAgentOutput",
|
|
58
|
-
fields: {
|
|
59
|
-
runId: {
|
|
60
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
61
|
-
isOptional: false
|
|
62
|
-
},
|
|
63
|
-
status: {
|
|
64
|
-
type: RunStatusEnum,
|
|
65
|
-
isOptional: false
|
|
66
|
-
},
|
|
67
|
-
estimatedWaitMs: {
|
|
68
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
69
|
-
isOptional: true
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}),
|
|
73
|
-
errors: {
|
|
74
|
-
AGENT_NOT_FOUND: {
|
|
75
|
-
description: "The specified agent does not exist",
|
|
76
|
-
http: 404,
|
|
77
|
-
gqlCode: "AGENT_NOT_FOUND",
|
|
78
|
-
when: "Agent ID is invalid"
|
|
79
|
-
},
|
|
80
|
-
AGENT_NOT_ACTIVE: {
|
|
81
|
-
description: "The specified agent is not active",
|
|
82
|
-
http: 400,
|
|
83
|
-
gqlCode: "AGENT_NOT_ACTIVE",
|
|
84
|
-
when: "Agent is in draft/paused/archived state"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
policy: { auth: "user" },
|
|
89
|
-
sideEffects: {
|
|
90
|
-
emits: [{
|
|
91
|
-
key: "run.started",
|
|
92
|
-
version: "1.0.0",
|
|
93
|
-
stability: "stable",
|
|
94
|
-
owners: [...OWNERS],
|
|
95
|
-
tags: ["run", "started"],
|
|
96
|
-
when: "Run is queued",
|
|
97
|
-
payload: RunSummaryModel
|
|
98
|
-
}],
|
|
99
|
-
audit: ["run.started"]
|
|
100
|
-
},
|
|
101
|
-
acceptance: {
|
|
102
|
-
scenarios: [{
|
|
103
|
-
key: "execute-agent-happy-path",
|
|
104
|
-
given: ["Agent exists", "Agent is active"],
|
|
105
|
-
when: ["User submits execution request"],
|
|
106
|
-
then: ["Run is created", "RunStarted event is emitted"]
|
|
107
|
-
}, {
|
|
108
|
-
key: "execute-agent-not-active",
|
|
109
|
-
given: ["Agent exists but is not active"],
|
|
110
|
-
when: ["User attempts to execute"],
|
|
111
|
-
then: ["AGENT_NOT_ACTIVE error is returned"]
|
|
112
|
-
}],
|
|
113
|
-
examples: [{
|
|
114
|
-
key: "basic-execute",
|
|
115
|
-
input: {
|
|
116
|
-
agentId: "agent-123",
|
|
117
|
-
input: { message: "Hello" }
|
|
118
|
-
},
|
|
119
|
-
output: {
|
|
120
|
-
runId: "run-456",
|
|
121
|
-
status: "pending",
|
|
122
|
-
estimatedWaitMs: 5e3
|
|
123
|
-
}
|
|
124
|
-
}]
|
|
125
|
-
}
|
|
31
|
+
// src/run/run.schema.ts
|
|
32
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
33
|
+
var RunInputModel = defineSchemaModel({
|
|
34
|
+
name: "RunInput",
|
|
35
|
+
description: "Input data for agent execution",
|
|
36
|
+
fields: {
|
|
37
|
+
message: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
38
|
+
context: { type: ScalarTypeEnum.JSONObject(), isOptional: true }
|
|
39
|
+
}
|
|
126
40
|
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
reason: {
|
|
150
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
151
|
-
isOptional: true
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}),
|
|
155
|
-
output: defineSchemaModel({
|
|
156
|
-
name: "CancelRunOutput",
|
|
157
|
-
fields: {
|
|
158
|
-
success: {
|
|
159
|
-
type: ScalarTypeEnum.Boolean(),
|
|
160
|
-
isOptional: false
|
|
161
|
-
},
|
|
162
|
-
status: {
|
|
163
|
-
type: RunStatusEnum,
|
|
164
|
-
isOptional: false
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}),
|
|
168
|
-
errors: {
|
|
169
|
-
RUN_NOT_FOUND: {
|
|
170
|
-
description: "The specified run does not exist",
|
|
171
|
-
http: 404,
|
|
172
|
-
gqlCode: "RUN_NOT_FOUND",
|
|
173
|
-
when: "Run ID is invalid"
|
|
174
|
-
},
|
|
175
|
-
RUN_NOT_CANCELLABLE: {
|
|
176
|
-
description: "The run cannot be cancelled",
|
|
177
|
-
http: 400,
|
|
178
|
-
gqlCode: "RUN_NOT_CANCELLABLE",
|
|
179
|
-
when: "Run is already completed/failed/cancelled"
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
policy: { auth: "user" },
|
|
184
|
-
sideEffects: {
|
|
185
|
-
emits: [{
|
|
186
|
-
key: "run.cancelled",
|
|
187
|
-
version: "1.0.0",
|
|
188
|
-
stability: "stable",
|
|
189
|
-
owners: [...OWNERS],
|
|
190
|
-
tags: ["run", "cancelled"],
|
|
191
|
-
when: "Run is cancelled",
|
|
192
|
-
payload: RunSummaryModel
|
|
193
|
-
}],
|
|
194
|
-
audit: ["run.cancelled"]
|
|
195
|
-
},
|
|
196
|
-
acceptance: {
|
|
197
|
-
scenarios: [{
|
|
198
|
-
key: "cancel-run-happy-path",
|
|
199
|
-
given: ["Run exists", "Run is in progress"],
|
|
200
|
-
when: ["User cancels run"],
|
|
201
|
-
then: ["Run is cancelled", "RunCancelled event is emitted"]
|
|
202
|
-
}, {
|
|
203
|
-
key: "cancel-run-already-completed",
|
|
204
|
-
given: ["Run exists but is already completed"],
|
|
205
|
-
when: ["User attempts to cancel"],
|
|
206
|
-
then: ["RUN_NOT_CANCELLABLE error is returned"]
|
|
207
|
-
}],
|
|
208
|
-
examples: [{
|
|
209
|
-
key: "cancel-basic",
|
|
210
|
-
input: {
|
|
211
|
-
runId: "run-456",
|
|
212
|
-
reason: "User requested"
|
|
213
|
-
},
|
|
214
|
-
output: {
|
|
215
|
-
success: true,
|
|
216
|
-
status: "cancelled"
|
|
217
|
-
}
|
|
218
|
-
}]
|
|
219
|
-
}
|
|
41
|
+
var RunStepModel = defineSchemaModel({
|
|
42
|
+
name: "RunStep",
|
|
43
|
+
description: "Individual step within a run",
|
|
44
|
+
fields: {
|
|
45
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
46
|
+
stepNumber: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
47
|
+
type: { type: RunStepTypeEnum, isOptional: false },
|
|
48
|
+
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
49
|
+
toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
50
|
+
input: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
51
|
+
output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
52
|
+
status: { type: RunStatusEnum, isOptional: false },
|
|
53
|
+
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
54
|
+
tokensUsed: {
|
|
55
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
56
|
+
isOptional: false,
|
|
57
|
+
defaultValue: 0
|
|
58
|
+
},
|
|
59
|
+
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
60
|
+
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
61
|
+
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
62
|
+
}
|
|
220
63
|
});
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
io: {
|
|
236
|
-
input: defineSchemaModel({
|
|
237
|
-
name: "GetRunInput",
|
|
238
|
-
fields: {
|
|
239
|
-
runId: {
|
|
240
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
241
|
-
isOptional: false
|
|
242
|
-
},
|
|
243
|
-
includeSteps: {
|
|
244
|
-
type: ScalarTypeEnum.Boolean(),
|
|
245
|
-
isOptional: true
|
|
246
|
-
},
|
|
247
|
-
includeLogs: {
|
|
248
|
-
type: ScalarTypeEnum.Boolean(),
|
|
249
|
-
isOptional: true
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}),
|
|
253
|
-
output: RunModel,
|
|
254
|
-
errors: { RUN_NOT_FOUND: {
|
|
255
|
-
description: "The specified run does not exist",
|
|
256
|
-
http: 404,
|
|
257
|
-
gqlCode: "RUN_NOT_FOUND",
|
|
258
|
-
when: "Run ID is invalid"
|
|
259
|
-
} }
|
|
260
|
-
},
|
|
261
|
-
policy: { auth: "user" },
|
|
262
|
-
acceptance: {
|
|
263
|
-
scenarios: [{
|
|
264
|
-
key: "get-run-happy-path",
|
|
265
|
-
given: ["Run exists"],
|
|
266
|
-
when: ["User requests run by ID"],
|
|
267
|
-
then: ["Run details are returned"]
|
|
268
|
-
}],
|
|
269
|
-
examples: [{
|
|
270
|
-
key: "get-with-steps",
|
|
271
|
-
input: {
|
|
272
|
-
runId: "run-456",
|
|
273
|
-
includeSteps: true,
|
|
274
|
-
includeLogs: false
|
|
275
|
-
},
|
|
276
|
-
output: {
|
|
277
|
-
id: "run-456",
|
|
278
|
-
status: "completed",
|
|
279
|
-
steps: []
|
|
280
|
-
}
|
|
281
|
-
}]
|
|
282
|
-
}
|
|
64
|
+
var RunLogModel = defineSchemaModel({
|
|
65
|
+
name: "RunLog",
|
|
66
|
+
description: "Execution log entry",
|
|
67
|
+
fields: {
|
|
68
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
69
|
+
stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
70
|
+
level: { type: LogLevelEnum, isOptional: false },
|
|
71
|
+
message: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
72
|
+
data: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
73
|
+
source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
74
|
+
traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
75
|
+
spanId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
76
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
77
|
+
}
|
|
283
78
|
});
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
context: "Run history/dashboard view."
|
|
297
|
-
},
|
|
298
|
-
io: {
|
|
299
|
-
input: defineSchemaModel({
|
|
300
|
-
name: "ListRunsInput",
|
|
301
|
-
fields: {
|
|
302
|
-
organizationId: {
|
|
303
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
304
|
-
isOptional: true
|
|
305
|
-
},
|
|
306
|
-
agentId: {
|
|
307
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
308
|
-
isOptional: true
|
|
309
|
-
},
|
|
310
|
-
userId: {
|
|
311
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
312
|
-
isOptional: true
|
|
313
|
-
},
|
|
314
|
-
sessionId: {
|
|
315
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
316
|
-
isOptional: true
|
|
317
|
-
},
|
|
318
|
-
status: {
|
|
319
|
-
type: RunStatusEnum,
|
|
320
|
-
isOptional: true
|
|
321
|
-
},
|
|
322
|
-
startDate: {
|
|
323
|
-
type: ScalarTypeEnum.DateTime(),
|
|
324
|
-
isOptional: true
|
|
325
|
-
},
|
|
326
|
-
endDate: {
|
|
327
|
-
type: ScalarTypeEnum.DateTime(),
|
|
328
|
-
isOptional: true
|
|
329
|
-
},
|
|
330
|
-
limit: {
|
|
331
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
332
|
-
isOptional: true,
|
|
333
|
-
defaultValue: 20
|
|
334
|
-
},
|
|
335
|
-
offset: {
|
|
336
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
337
|
-
isOptional: true,
|
|
338
|
-
defaultValue: 0
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}),
|
|
342
|
-
output: defineSchemaModel({
|
|
343
|
-
name: "ListRunsOutput",
|
|
344
|
-
fields: {
|
|
345
|
-
items: {
|
|
346
|
-
type: RunSummaryModel,
|
|
347
|
-
isArray: true,
|
|
348
|
-
isOptional: false
|
|
349
|
-
},
|
|
350
|
-
total: {
|
|
351
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
352
|
-
isOptional: false
|
|
353
|
-
},
|
|
354
|
-
hasMore: {
|
|
355
|
-
type: ScalarTypeEnum.Boolean(),
|
|
356
|
-
isOptional: false
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
})
|
|
360
|
-
},
|
|
361
|
-
policy: { auth: "user" },
|
|
362
|
-
acceptance: {
|
|
363
|
-
scenarios: [{
|
|
364
|
-
key: "list-runs-happy-path",
|
|
365
|
-
given: ["Organization has runs"],
|
|
366
|
-
when: ["User lists runs"],
|
|
367
|
-
then: ["Paginated list of runs is returned"]
|
|
368
|
-
}],
|
|
369
|
-
examples: [{
|
|
370
|
-
key: "list-by-agent",
|
|
371
|
-
input: {
|
|
372
|
-
agentId: "agent-123",
|
|
373
|
-
limit: 20,
|
|
374
|
-
offset: 0
|
|
375
|
-
},
|
|
376
|
-
output: {
|
|
377
|
-
items: [],
|
|
378
|
-
total: 0,
|
|
379
|
-
hasMore: false
|
|
380
|
-
}
|
|
381
|
-
}]
|
|
382
|
-
}
|
|
79
|
+
var RunAgentRefModel = defineSchemaModel({
|
|
80
|
+
name: "RunAgentRef",
|
|
81
|
+
description: "Agent reference in a run",
|
|
82
|
+
fields: {
|
|
83
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
84
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
85
|
+
modelProvider: {
|
|
86
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
87
|
+
isOptional: false
|
|
88
|
+
},
|
|
89
|
+
modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
90
|
+
}
|
|
383
91
|
});
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
92
|
+
var RunModel = defineSchemaModel({
|
|
93
|
+
name: "Run",
|
|
94
|
+
description: "Agent execution instance",
|
|
95
|
+
fields: {
|
|
96
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
97
|
+
organizationId: {
|
|
98
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
99
|
+
isOptional: false
|
|
100
|
+
},
|
|
101
|
+
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
102
|
+
userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
103
|
+
sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
104
|
+
input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
105
|
+
output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
106
|
+
status: { type: RunStatusEnum, isOptional: false },
|
|
107
|
+
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
108
|
+
errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
109
|
+
totalTokens: {
|
|
110
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
111
|
+
isOptional: false,
|
|
112
|
+
defaultValue: 0
|
|
113
|
+
},
|
|
114
|
+
promptTokens: {
|
|
115
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
116
|
+
isOptional: false,
|
|
117
|
+
defaultValue: 0
|
|
118
|
+
},
|
|
119
|
+
completionTokens: {
|
|
120
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
121
|
+
isOptional: false,
|
|
122
|
+
defaultValue: 0
|
|
123
|
+
},
|
|
124
|
+
totalIterations: {
|
|
125
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
126
|
+
isOptional: false,
|
|
127
|
+
defaultValue: 0
|
|
128
|
+
},
|
|
129
|
+
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
130
|
+
estimatedCostUsd: {
|
|
131
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
132
|
+
isOptional: true
|
|
133
|
+
},
|
|
134
|
+
queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
135
|
+
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
136
|
+
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
137
|
+
metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
138
|
+
steps: { type: RunStepModel, isArray: true, isOptional: true },
|
|
139
|
+
logs: { type: RunLogModel, isArray: true, isOptional: true },
|
|
140
|
+
agent: { type: RunAgentRefModel, isOptional: true }
|
|
141
|
+
}
|
|
429
142
|
});
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
fields: {
|
|
448
|
-
runId: {
|
|
449
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
450
|
-
isOptional: false
|
|
451
|
-
},
|
|
452
|
-
level: {
|
|
453
|
-
type: LogLevelEnum,
|
|
454
|
-
isOptional: true
|
|
455
|
-
},
|
|
456
|
-
stepId: {
|
|
457
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
458
|
-
isOptional: true
|
|
459
|
-
},
|
|
460
|
-
limit: {
|
|
461
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
462
|
-
isOptional: true,
|
|
463
|
-
defaultValue: 100
|
|
464
|
-
},
|
|
465
|
-
offset: {
|
|
466
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
467
|
-
isOptional: true,
|
|
468
|
-
defaultValue: 0
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}),
|
|
472
|
-
output: defineSchemaModel({
|
|
473
|
-
name: "GetRunLogsOutput",
|
|
474
|
-
fields: {
|
|
475
|
-
items: {
|
|
476
|
-
type: RunLogModel,
|
|
477
|
-
isArray: true,
|
|
478
|
-
isOptional: false
|
|
479
|
-
},
|
|
480
|
-
total: {
|
|
481
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
482
|
-
isOptional: false
|
|
483
|
-
},
|
|
484
|
-
hasMore: {
|
|
485
|
-
type: ScalarTypeEnum.Boolean(),
|
|
486
|
-
isOptional: false
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
})
|
|
490
|
-
},
|
|
491
|
-
policy: { auth: "user" },
|
|
492
|
-
acceptance: {
|
|
493
|
-
scenarios: [{
|
|
494
|
-
key: "get-run-logs-happy-path",
|
|
495
|
-
given: ["Run exists with logs"],
|
|
496
|
-
when: ["User requests logs"],
|
|
497
|
-
then: ["Paginated logs list is returned"]
|
|
498
|
-
}],
|
|
499
|
-
examples: [{
|
|
500
|
-
key: "get-logs-filtered",
|
|
501
|
-
input: {
|
|
502
|
-
runId: "run-456",
|
|
503
|
-
level: "error",
|
|
504
|
-
limit: 50
|
|
505
|
-
},
|
|
506
|
-
output: {
|
|
507
|
-
items: [],
|
|
508
|
-
total: 0,
|
|
509
|
-
hasMore: false
|
|
510
|
-
}
|
|
511
|
-
}]
|
|
512
|
-
}
|
|
143
|
+
var RunSummaryModel = defineSchemaModel({
|
|
144
|
+
name: "RunSummary",
|
|
145
|
+
description: "Summary of a run for list views",
|
|
146
|
+
fields: {
|
|
147
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
148
|
+
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
149
|
+
agentName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
150
|
+
status: { type: RunStatusEnum, isOptional: false },
|
|
151
|
+
totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
152
|
+
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
153
|
+
estimatedCostUsd: {
|
|
154
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
155
|
+
isOptional: true
|
|
156
|
+
},
|
|
157
|
+
queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
158
|
+
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
159
|
+
}
|
|
513
160
|
});
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
description: "Retrieves aggregated metrics for runs within a time period.",
|
|
525
|
-
goal: "Monitor and analyze agent usage.",
|
|
526
|
-
context: "Analytics dashboard."
|
|
527
|
-
},
|
|
528
|
-
io: {
|
|
529
|
-
input: defineSchemaModel({
|
|
530
|
-
name: "GetRunMetricsInput",
|
|
531
|
-
fields: {
|
|
532
|
-
organizationId: {
|
|
533
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
534
|
-
isOptional: false
|
|
535
|
-
},
|
|
536
|
-
agentId: {
|
|
537
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
538
|
-
isOptional: true
|
|
539
|
-
},
|
|
540
|
-
startDate: {
|
|
541
|
-
type: ScalarTypeEnum.DateTime(),
|
|
542
|
-
isOptional: false
|
|
543
|
-
},
|
|
544
|
-
endDate: {
|
|
545
|
-
type: ScalarTypeEnum.DateTime(),
|
|
546
|
-
isOptional: false
|
|
547
|
-
},
|
|
548
|
-
granularity: {
|
|
549
|
-
type: GranularityEnum,
|
|
550
|
-
isOptional: true,
|
|
551
|
-
defaultValue: "day"
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}),
|
|
555
|
-
output: defineSchemaModel({
|
|
556
|
-
name: "GetRunMetricsOutput",
|
|
557
|
-
fields: {
|
|
558
|
-
totalRuns: {
|
|
559
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
560
|
-
isOptional: false
|
|
561
|
-
},
|
|
562
|
-
completedRuns: {
|
|
563
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
564
|
-
isOptional: false
|
|
565
|
-
},
|
|
566
|
-
failedRuns: {
|
|
567
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
568
|
-
isOptional: false
|
|
569
|
-
},
|
|
570
|
-
totalTokens: {
|
|
571
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
572
|
-
isOptional: false
|
|
573
|
-
},
|
|
574
|
-
totalCostUsd: {
|
|
575
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
576
|
-
isOptional: false
|
|
577
|
-
},
|
|
578
|
-
averageDurationMs: {
|
|
579
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
580
|
-
isOptional: false
|
|
581
|
-
},
|
|
582
|
-
successRate: {
|
|
583
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
584
|
-
isOptional: false
|
|
585
|
-
},
|
|
586
|
-
timeline: {
|
|
587
|
-
type: TimelineDataPointModel,
|
|
588
|
-
isArray: true,
|
|
589
|
-
isOptional: false
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
})
|
|
593
|
-
},
|
|
594
|
-
policy: { auth: "user" },
|
|
595
|
-
acceptance: {
|
|
596
|
-
scenarios: [{
|
|
597
|
-
key: "get-run-metrics-happy-path",
|
|
598
|
-
given: ["Organization has run history"],
|
|
599
|
-
when: ["User requests metrics for date range"],
|
|
600
|
-
then: ["Aggregated metrics are returned"]
|
|
601
|
-
}],
|
|
602
|
-
examples: [{
|
|
603
|
-
key: "get-daily-metrics",
|
|
604
|
-
input: {
|
|
605
|
-
organizationId: "org-123",
|
|
606
|
-
startDate: "2025-01-01",
|
|
607
|
-
endDate: "2025-01-31",
|
|
608
|
-
granularity: "day"
|
|
609
|
-
},
|
|
610
|
-
output: {
|
|
611
|
-
totalRuns: 100,
|
|
612
|
-
completedRuns: 90,
|
|
613
|
-
failedRuns: 10,
|
|
614
|
-
totalTokens: 5e4,
|
|
615
|
-
totalCostUsd: 5,
|
|
616
|
-
averageDurationMs: 2500,
|
|
617
|
-
successRate: .9,
|
|
618
|
-
timeline: []
|
|
619
|
-
}
|
|
620
|
-
}]
|
|
621
|
-
}
|
|
161
|
+
var TimelineDataPointModel = defineSchemaModel({
|
|
162
|
+
name: "TimelineDataPoint",
|
|
163
|
+
description: "Timeline data point for metrics",
|
|
164
|
+
fields: {
|
|
165
|
+
period: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
166
|
+
runs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
167
|
+
tokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
168
|
+
costUsd: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
169
|
+
avgDurationMs: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
|
|
170
|
+
}
|
|
622
171
|
});
|
|
623
172
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
173
|
+
// src/run/run.operation.ts
|
|
174
|
+
import {
|
|
175
|
+
defineCommand,
|
|
176
|
+
defineQuery
|
|
177
|
+
} from "@contractspec/lib.contracts/operations";
|
|
178
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
179
|
+
var OWNERS = ["@agent-console-team"];
|
|
180
|
+
var ExecuteAgentCommand = defineCommand({
|
|
181
|
+
meta: {
|
|
182
|
+
key: "agent.run.execute",
|
|
183
|
+
version: "1.0.0",
|
|
184
|
+
stability: "stable",
|
|
185
|
+
owners: [...OWNERS],
|
|
186
|
+
tags: ["run", "execute"],
|
|
187
|
+
description: "Starts a new agent run with the given input.",
|
|
188
|
+
goal: "Execute an AI agent with user input.",
|
|
189
|
+
context: "Called from chat interface or API."
|
|
190
|
+
},
|
|
191
|
+
io: {
|
|
192
|
+
input: defineSchemaModel2({
|
|
193
|
+
name: "ExecuteAgentInput",
|
|
194
|
+
fields: {
|
|
195
|
+
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
196
|
+
input: { type: RunInputModel, isOptional: false },
|
|
197
|
+
sessionId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
198
|
+
metadata: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
199
|
+
stream: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
200
|
+
maxIterations: {
|
|
201
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
202
|
+
isOptional: true
|
|
203
|
+
},
|
|
204
|
+
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true }
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
output: defineSchemaModel2({
|
|
208
|
+
name: "ExecuteAgentOutput",
|
|
209
|
+
fields: {
|
|
210
|
+
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
211
|
+
status: { type: RunStatusEnum, isOptional: false },
|
|
212
|
+
estimatedWaitMs: {
|
|
213
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
214
|
+
isOptional: true
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}),
|
|
218
|
+
errors: {
|
|
219
|
+
AGENT_NOT_FOUND: {
|
|
220
|
+
description: "The specified agent does not exist",
|
|
221
|
+
http: 404,
|
|
222
|
+
gqlCode: "AGENT_NOT_FOUND",
|
|
223
|
+
when: "Agent ID is invalid"
|
|
224
|
+
},
|
|
225
|
+
AGENT_NOT_ACTIVE: {
|
|
226
|
+
description: "The specified agent is not active",
|
|
227
|
+
http: 400,
|
|
228
|
+
gqlCode: "AGENT_NOT_ACTIVE",
|
|
229
|
+
when: "Agent is in draft/paused/archived state"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
policy: { auth: "user" },
|
|
234
|
+
sideEffects: {
|
|
235
|
+
emits: [
|
|
236
|
+
{
|
|
237
|
+
key: "run.started",
|
|
238
|
+
version: "1.0.0",
|
|
239
|
+
stability: "stable",
|
|
240
|
+
owners: [...OWNERS],
|
|
241
|
+
tags: ["run", "started"],
|
|
242
|
+
when: "Run is queued",
|
|
243
|
+
payload: RunSummaryModel
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
audit: ["run.started"]
|
|
247
|
+
},
|
|
248
|
+
acceptance: {
|
|
249
|
+
scenarios: [
|
|
250
|
+
{
|
|
251
|
+
key: "execute-agent-happy-path",
|
|
252
|
+
given: ["Agent exists", "Agent is active"],
|
|
253
|
+
when: ["User submits execution request"],
|
|
254
|
+
then: ["Run is created", "RunStarted event is emitted"]
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
key: "execute-agent-not-active",
|
|
258
|
+
given: ["Agent exists but is not active"],
|
|
259
|
+
when: ["User attempts to execute"],
|
|
260
|
+
then: ["AGENT_NOT_ACTIVE error is returned"]
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
examples: [
|
|
264
|
+
{
|
|
265
|
+
key: "basic-execute",
|
|
266
|
+
input: { agentId: "agent-123", input: { message: "Hello" } },
|
|
267
|
+
output: { runId: "run-456", status: "pending", estimatedWaitMs: 5000 }
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
var CancelRunCommand = defineCommand({
|
|
273
|
+
meta: {
|
|
274
|
+
key: "agent.run.cancel",
|
|
275
|
+
version: "1.0.0",
|
|
276
|
+
stability: "stable",
|
|
277
|
+
owners: [...OWNERS],
|
|
278
|
+
tags: ["run", "cancel"],
|
|
279
|
+
description: "Cancels an in-progress agent run.",
|
|
280
|
+
goal: "Stop a running agent execution.",
|
|
281
|
+
context: "Called when user wants to abort a long-running task."
|
|
282
|
+
},
|
|
283
|
+
io: {
|
|
284
|
+
input: defineSchemaModel2({
|
|
285
|
+
name: "CancelRunInput",
|
|
286
|
+
fields: {
|
|
287
|
+
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
288
|
+
reason: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
289
|
+
}
|
|
290
|
+
}),
|
|
291
|
+
output: defineSchemaModel2({
|
|
292
|
+
name: "CancelRunOutput",
|
|
293
|
+
fields: {
|
|
294
|
+
success: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
295
|
+
status: { type: RunStatusEnum, isOptional: false }
|
|
296
|
+
}
|
|
297
|
+
}),
|
|
298
|
+
errors: {
|
|
299
|
+
RUN_NOT_FOUND: {
|
|
300
|
+
description: "The specified run does not exist",
|
|
301
|
+
http: 404,
|
|
302
|
+
gqlCode: "RUN_NOT_FOUND",
|
|
303
|
+
when: "Run ID is invalid"
|
|
304
|
+
},
|
|
305
|
+
RUN_NOT_CANCELLABLE: {
|
|
306
|
+
description: "The run cannot be cancelled",
|
|
307
|
+
http: 400,
|
|
308
|
+
gqlCode: "RUN_NOT_CANCELLABLE",
|
|
309
|
+
when: "Run is already completed/failed/cancelled"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
policy: { auth: "user" },
|
|
314
|
+
sideEffects: {
|
|
315
|
+
emits: [
|
|
316
|
+
{
|
|
317
|
+
key: "run.cancelled",
|
|
318
|
+
version: "1.0.0",
|
|
319
|
+
stability: "stable",
|
|
320
|
+
owners: [...OWNERS],
|
|
321
|
+
tags: ["run", "cancelled"],
|
|
322
|
+
when: "Run is cancelled",
|
|
323
|
+
payload: RunSummaryModel
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
audit: ["run.cancelled"]
|
|
327
|
+
},
|
|
328
|
+
acceptance: {
|
|
329
|
+
scenarios: [
|
|
330
|
+
{
|
|
331
|
+
key: "cancel-run-happy-path",
|
|
332
|
+
given: ["Run exists", "Run is in progress"],
|
|
333
|
+
when: ["User cancels run"],
|
|
334
|
+
then: ["Run is cancelled", "RunCancelled event is emitted"]
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
key: "cancel-run-already-completed",
|
|
338
|
+
given: ["Run exists but is already completed"],
|
|
339
|
+
when: ["User attempts to cancel"],
|
|
340
|
+
then: ["RUN_NOT_CANCELLABLE error is returned"]
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
examples: [
|
|
344
|
+
{
|
|
345
|
+
key: "cancel-basic",
|
|
346
|
+
input: { runId: "run-456", reason: "User requested" },
|
|
347
|
+
output: { success: true, status: "cancelled" }
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
var GetRunQuery = defineQuery({
|
|
353
|
+
meta: {
|
|
354
|
+
key: "agent.run.get",
|
|
355
|
+
version: "1.0.0",
|
|
356
|
+
stability: "stable",
|
|
357
|
+
owners: [...OWNERS],
|
|
358
|
+
tags: ["run", "get"],
|
|
359
|
+
description: "Retrieves a run by its ID with optional details.",
|
|
360
|
+
goal: "View detailed run information.",
|
|
361
|
+
context: "Run details page or monitoring."
|
|
362
|
+
},
|
|
363
|
+
io: {
|
|
364
|
+
input: defineSchemaModel2({
|
|
365
|
+
name: "GetRunInput",
|
|
366
|
+
fields: {
|
|
367
|
+
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
368
|
+
includeSteps: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
369
|
+
includeLogs: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
|
|
370
|
+
}
|
|
371
|
+
}),
|
|
372
|
+
output: RunModel,
|
|
373
|
+
errors: {
|
|
374
|
+
RUN_NOT_FOUND: {
|
|
375
|
+
description: "The specified run does not exist",
|
|
376
|
+
http: 404,
|
|
377
|
+
gqlCode: "RUN_NOT_FOUND",
|
|
378
|
+
when: "Run ID is invalid"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
policy: { auth: "user" },
|
|
383
|
+
acceptance: {
|
|
384
|
+
scenarios: [
|
|
385
|
+
{
|
|
386
|
+
key: "get-run-happy-path",
|
|
387
|
+
given: ["Run exists"],
|
|
388
|
+
when: ["User requests run by ID"],
|
|
389
|
+
then: ["Run details are returned"]
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
examples: [
|
|
393
|
+
{
|
|
394
|
+
key: "get-with-steps",
|
|
395
|
+
input: { runId: "run-456", includeSteps: true, includeLogs: false },
|
|
396
|
+
output: { id: "run-456", status: "completed", steps: [] }
|
|
397
|
+
}
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
var ListRunsQuery = defineQuery({
|
|
402
|
+
meta: {
|
|
403
|
+
key: "agent.run.list",
|
|
404
|
+
version: "1.0.0",
|
|
405
|
+
stability: "stable",
|
|
406
|
+
owners: [...OWNERS],
|
|
407
|
+
tags: ["run", "list"],
|
|
408
|
+
description: "Lists runs with optional filtering.",
|
|
409
|
+
goal: "Browse and search run history.",
|
|
410
|
+
context: "Run history/dashboard view."
|
|
411
|
+
},
|
|
412
|
+
io: {
|
|
413
|
+
input: defineSchemaModel2({
|
|
414
|
+
name: "ListRunsInput",
|
|
415
|
+
fields: {
|
|
416
|
+
organizationId: {
|
|
417
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
418
|
+
isOptional: true
|
|
419
|
+
},
|
|
420
|
+
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
421
|
+
userId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
422
|
+
sessionId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
423
|
+
status: { type: RunStatusEnum, isOptional: true },
|
|
424
|
+
startDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
425
|
+
endDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
426
|
+
limit: {
|
|
427
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
428
|
+
isOptional: true,
|
|
429
|
+
defaultValue: 20
|
|
430
|
+
},
|
|
431
|
+
offset: {
|
|
432
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
433
|
+
isOptional: true,
|
|
434
|
+
defaultValue: 0
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}),
|
|
438
|
+
output: defineSchemaModel2({
|
|
439
|
+
name: "ListRunsOutput",
|
|
440
|
+
fields: {
|
|
441
|
+
items: { type: RunSummaryModel, isArray: true, isOptional: false },
|
|
442
|
+
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
443
|
+
hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
|
|
444
|
+
}
|
|
445
|
+
})
|
|
446
|
+
},
|
|
447
|
+
policy: { auth: "user" },
|
|
448
|
+
acceptance: {
|
|
449
|
+
scenarios: [
|
|
450
|
+
{
|
|
451
|
+
key: "list-runs-happy-path",
|
|
452
|
+
given: ["Organization has runs"],
|
|
453
|
+
when: ["User lists runs"],
|
|
454
|
+
then: ["Paginated list of runs is returned"]
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
examples: [
|
|
458
|
+
{
|
|
459
|
+
key: "list-by-agent",
|
|
460
|
+
input: { agentId: "agent-123", limit: 20, offset: 0 },
|
|
461
|
+
output: { items: [], total: 0, hasMore: false }
|
|
462
|
+
}
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
var GetRunStepsQuery = defineQuery({
|
|
467
|
+
meta: {
|
|
468
|
+
key: "agent.run.getSteps",
|
|
469
|
+
version: "1.0.0",
|
|
470
|
+
stability: "stable",
|
|
471
|
+
owners: [...OWNERS],
|
|
472
|
+
tags: ["run", "steps"],
|
|
473
|
+
description: "Retrieves all steps for a specific run.",
|
|
474
|
+
goal: "View step-by-step execution details.",
|
|
475
|
+
context: "Run details page - steps tab."
|
|
476
|
+
},
|
|
477
|
+
io: {
|
|
478
|
+
input: defineSchemaModel2({
|
|
479
|
+
name: "GetRunStepsInput",
|
|
480
|
+
fields: {
|
|
481
|
+
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
482
|
+
}
|
|
483
|
+
}),
|
|
484
|
+
output: defineSchemaModel2({
|
|
485
|
+
name: "GetRunStepsOutput",
|
|
486
|
+
fields: {
|
|
487
|
+
steps: { type: RunStepModel, isArray: true, isOptional: false }
|
|
488
|
+
}
|
|
489
|
+
})
|
|
490
|
+
},
|
|
491
|
+
policy: { auth: "user" },
|
|
492
|
+
acceptance: {
|
|
493
|
+
scenarios: [
|
|
494
|
+
{
|
|
495
|
+
key: "get-run-steps-happy-path",
|
|
496
|
+
given: ["Run exists with steps"],
|
|
497
|
+
when: ["User requests steps"],
|
|
498
|
+
then: ["Steps list is returned"]
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
examples: [
|
|
502
|
+
{
|
|
503
|
+
key: "get-steps-basic",
|
|
504
|
+
input: { runId: "run-456" },
|
|
505
|
+
output: { steps: [] }
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
var GetRunLogsQuery = defineQuery({
|
|
511
|
+
meta: {
|
|
512
|
+
key: "agent.run.getLogs",
|
|
513
|
+
version: "1.0.0",
|
|
514
|
+
stability: "stable",
|
|
515
|
+
owners: [...OWNERS],
|
|
516
|
+
tags: ["run", "logs"],
|
|
517
|
+
description: "Retrieves all logs for a specific run.",
|
|
518
|
+
goal: "Debug and audit run execution.",
|
|
519
|
+
context: "Run details page - logs tab."
|
|
520
|
+
},
|
|
521
|
+
io: {
|
|
522
|
+
input: defineSchemaModel2({
|
|
523
|
+
name: "GetRunLogsInput",
|
|
524
|
+
fields: {
|
|
525
|
+
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
526
|
+
level: { type: LogLevelEnum, isOptional: true },
|
|
527
|
+
stepId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
528
|
+
limit: {
|
|
529
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
530
|
+
isOptional: true,
|
|
531
|
+
defaultValue: 100
|
|
532
|
+
},
|
|
533
|
+
offset: {
|
|
534
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
535
|
+
isOptional: true,
|
|
536
|
+
defaultValue: 0
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}),
|
|
540
|
+
output: defineSchemaModel2({
|
|
541
|
+
name: "GetRunLogsOutput",
|
|
542
|
+
fields: {
|
|
543
|
+
items: { type: RunLogModel, isArray: true, isOptional: false },
|
|
544
|
+
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
545
|
+
hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
|
|
546
|
+
}
|
|
547
|
+
})
|
|
548
|
+
},
|
|
549
|
+
policy: { auth: "user" },
|
|
550
|
+
acceptance: {
|
|
551
|
+
scenarios: [
|
|
552
|
+
{
|
|
553
|
+
key: "get-run-logs-happy-path",
|
|
554
|
+
given: ["Run exists with logs"],
|
|
555
|
+
when: ["User requests logs"],
|
|
556
|
+
then: ["Paginated logs list is returned"]
|
|
557
|
+
}
|
|
558
|
+
],
|
|
559
|
+
examples: [
|
|
560
|
+
{
|
|
561
|
+
key: "get-logs-filtered",
|
|
562
|
+
input: { runId: "run-456", level: "error", limit: 50 },
|
|
563
|
+
output: { items: [], total: 0, hasMore: false }
|
|
564
|
+
}
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
var GetRunMetricsQuery = defineQuery({
|
|
569
|
+
meta: {
|
|
570
|
+
key: "agent.run.getMetrics",
|
|
571
|
+
version: "1.0.0",
|
|
572
|
+
stability: "stable",
|
|
573
|
+
owners: [...OWNERS],
|
|
574
|
+
tags: ["run", "metrics"],
|
|
575
|
+
description: "Retrieves aggregated metrics for runs within a time period.",
|
|
576
|
+
goal: "Monitor and analyze agent usage.",
|
|
577
|
+
context: "Analytics dashboard."
|
|
578
|
+
},
|
|
579
|
+
io: {
|
|
580
|
+
input: defineSchemaModel2({
|
|
581
|
+
name: "GetRunMetricsInput",
|
|
582
|
+
fields: {
|
|
583
|
+
organizationId: {
|
|
584
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
585
|
+
isOptional: false
|
|
586
|
+
},
|
|
587
|
+
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
588
|
+
startDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
589
|
+
endDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
590
|
+
granularity: {
|
|
591
|
+
type: GranularityEnum,
|
|
592
|
+
isOptional: true,
|
|
593
|
+
defaultValue: "day"
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}),
|
|
597
|
+
output: defineSchemaModel2({
|
|
598
|
+
name: "GetRunMetricsOutput",
|
|
599
|
+
fields: {
|
|
600
|
+
totalRuns: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
601
|
+
completedRuns: {
|
|
602
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
603
|
+
isOptional: false
|
|
604
|
+
},
|
|
605
|
+
failedRuns: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
606
|
+
totalTokens: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
607
|
+
totalCostUsd: {
|
|
608
|
+
type: ScalarTypeEnum2.Float_unsecure(),
|
|
609
|
+
isOptional: false
|
|
610
|
+
},
|
|
611
|
+
averageDurationMs: {
|
|
612
|
+
type: ScalarTypeEnum2.Float_unsecure(),
|
|
613
|
+
isOptional: false
|
|
614
|
+
},
|
|
615
|
+
successRate: {
|
|
616
|
+
type: ScalarTypeEnum2.Float_unsecure(),
|
|
617
|
+
isOptional: false
|
|
618
|
+
},
|
|
619
|
+
timeline: {
|
|
620
|
+
type: TimelineDataPointModel,
|
|
621
|
+
isArray: true,
|
|
622
|
+
isOptional: false
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
})
|
|
626
|
+
},
|
|
627
|
+
policy: { auth: "user" },
|
|
628
|
+
acceptance: {
|
|
629
|
+
scenarios: [
|
|
630
|
+
{
|
|
631
|
+
key: "get-run-metrics-happy-path",
|
|
632
|
+
given: ["Organization has run history"],
|
|
633
|
+
when: ["User requests metrics for date range"],
|
|
634
|
+
then: ["Aggregated metrics are returned"]
|
|
635
|
+
}
|
|
636
|
+
],
|
|
637
|
+
examples: [
|
|
638
|
+
{
|
|
639
|
+
key: "get-daily-metrics",
|
|
640
|
+
input: {
|
|
641
|
+
organizationId: "org-123",
|
|
642
|
+
startDate: "2025-01-01",
|
|
643
|
+
endDate: "2025-01-31",
|
|
644
|
+
granularity: "day"
|
|
645
|
+
},
|
|
646
|
+
output: {
|
|
647
|
+
totalRuns: 100,
|
|
648
|
+
completedRuns: 90,
|
|
649
|
+
failedRuns: 10,
|
|
650
|
+
totalTokens: 50000,
|
|
651
|
+
totalCostUsd: 5,
|
|
652
|
+
averageDurationMs: 2500,
|
|
653
|
+
successRate: 0.9,
|
|
654
|
+
timeline: []
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
]
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
export {
|
|
661
|
+
ListRunsQuery,
|
|
662
|
+
GetRunStepsQuery,
|
|
663
|
+
GetRunQuery,
|
|
664
|
+
GetRunMetricsQuery,
|
|
665
|
+
GetRunLogsQuery,
|
|
666
|
+
ExecuteAgentCommand,
|
|
667
|
+
CancelRunCommand
|
|
668
|
+
};
|