@contractspec/example.agent-console 1.57.0 → 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 +210 -278
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +16 -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
|
@@ -0,0 +1,946 @@
|
|
|
1
|
+
// src/shared/mock-tools.ts
|
|
2
|
+
var MOCK_TOOLS = [
|
|
3
|
+
{
|
|
4
|
+
id: "tool-1",
|
|
5
|
+
organizationId: "demo-org",
|
|
6
|
+
name: "Web Search",
|
|
7
|
+
slug: "web-search",
|
|
8
|
+
description: "Search the web for real-time information using Brave API.",
|
|
9
|
+
category: "RETRIEVAL",
|
|
10
|
+
status: "ACTIVE",
|
|
11
|
+
parametersSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
query: { type: "string", description: "Search query" },
|
|
15
|
+
numResults: { type: "number", default: 10 }
|
|
16
|
+
},
|
|
17
|
+
required: ["query"]
|
|
18
|
+
},
|
|
19
|
+
outputSchema: { type: "array", items: { type: "object" } },
|
|
20
|
+
implementationType: "http",
|
|
21
|
+
implementationConfig: {
|
|
22
|
+
url: "https://api.brave.com/search",
|
|
23
|
+
method: "GET"
|
|
24
|
+
},
|
|
25
|
+
maxInvocationsPerMinute: 60,
|
|
26
|
+
timeoutMs: 30000,
|
|
27
|
+
version: "1.0.0",
|
|
28
|
+
tags: ["search", "web"],
|
|
29
|
+
createdAt: new Date("2024-01-01T00:00:00Z"),
|
|
30
|
+
updatedAt: new Date("2024-02-15T10:00:00Z")
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "tool-2",
|
|
34
|
+
organizationId: "demo-org",
|
|
35
|
+
name: "SQL Query",
|
|
36
|
+
slug: "sql-query",
|
|
37
|
+
description: "Execute read-only SQL queries against the data warehouse.",
|
|
38
|
+
category: "RETRIEVAL",
|
|
39
|
+
status: "ACTIVE",
|
|
40
|
+
parametersSchema: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
query: { type: "string", description: "SQL query" },
|
|
44
|
+
maxRows: { type: "number", default: 100 }
|
|
45
|
+
},
|
|
46
|
+
required: ["query"]
|
|
47
|
+
},
|
|
48
|
+
outputSchema: { type: "object" },
|
|
49
|
+
implementationType: "function",
|
|
50
|
+
implementationConfig: { handler: "executeSqlQuery" },
|
|
51
|
+
maxInvocationsPerMinute: 30,
|
|
52
|
+
timeoutMs: 60000,
|
|
53
|
+
version: "1.1.0",
|
|
54
|
+
tags: ["sql", "database"],
|
|
55
|
+
createdAt: new Date("2024-01-05T00:00:00Z"),
|
|
56
|
+
updatedAt: new Date("2024-03-10T14:00:00Z")
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "tool-3",
|
|
60
|
+
organizationId: "demo-org",
|
|
61
|
+
name: "Email Sender",
|
|
62
|
+
slug: "email-sender",
|
|
63
|
+
description: "Send emails via SMTP or API.",
|
|
64
|
+
category: "COMMUNICATION",
|
|
65
|
+
status: "ACTIVE",
|
|
66
|
+
parametersSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
to: { type: "string" },
|
|
70
|
+
subject: { type: "string" },
|
|
71
|
+
body: { type: "string" }
|
|
72
|
+
},
|
|
73
|
+
required: ["to", "subject", "body"]
|
|
74
|
+
},
|
|
75
|
+
implementationType: "http",
|
|
76
|
+
implementationConfig: { url: "/api/send-email", method: "POST" },
|
|
77
|
+
maxInvocationsPerMinute: 10,
|
|
78
|
+
timeoutMs: 30000,
|
|
79
|
+
version: "1.0.0",
|
|
80
|
+
tags: ["email", "communication"],
|
|
81
|
+
createdAt: new Date("2024-02-01T00:00:00Z"),
|
|
82
|
+
updatedAt: new Date("2024-02-01T00:00:00Z")
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "tool-4",
|
|
86
|
+
organizationId: "demo-org",
|
|
87
|
+
name: "GitHub Integration",
|
|
88
|
+
slug: "github-integration",
|
|
89
|
+
description: "Interact with GitHub repositories, PRs, and issues.",
|
|
90
|
+
category: "INTEGRATION",
|
|
91
|
+
status: "ACTIVE",
|
|
92
|
+
parametersSchema: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
action: {
|
|
96
|
+
type: "string",
|
|
97
|
+
enum: ["list_prs", "get_pr", "create_comment"]
|
|
98
|
+
},
|
|
99
|
+
repo: { type: "string" },
|
|
100
|
+
params: { type: "object" }
|
|
101
|
+
},
|
|
102
|
+
required: ["action", "repo"]
|
|
103
|
+
},
|
|
104
|
+
implementationType: "http",
|
|
105
|
+
implementationConfig: { url: "https://api.github.com", auth: "token" },
|
|
106
|
+
maxInvocationsPerMinute: 100,
|
|
107
|
+
timeoutMs: 15000,
|
|
108
|
+
version: "2.0.0",
|
|
109
|
+
tags: ["github", "integration", "code"],
|
|
110
|
+
createdAt: new Date("2024-02-20T00:00:00Z"),
|
|
111
|
+
updatedAt: new Date("2024-04-01T09:00:00Z")
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "tool-5",
|
|
115
|
+
organizationId: "demo-org",
|
|
116
|
+
name: "Calculator",
|
|
117
|
+
slug: "calculator",
|
|
118
|
+
description: "Perform mathematical calculations.",
|
|
119
|
+
category: "COMPUTATION",
|
|
120
|
+
status: "ACTIVE",
|
|
121
|
+
parametersSchema: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
expression: {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "Math expression to evaluate"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
required: ["expression"]
|
|
130
|
+
},
|
|
131
|
+
outputSchema: {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties: { result: { type: "number" } }
|
|
134
|
+
},
|
|
135
|
+
implementationType: "function",
|
|
136
|
+
implementationConfig: { handler: "evaluateMath" },
|
|
137
|
+
timeoutMs: 5000,
|
|
138
|
+
version: "1.0.0",
|
|
139
|
+
tags: ["math", "utility"],
|
|
140
|
+
createdAt: new Date("2024-01-10T00:00:00Z"),
|
|
141
|
+
updatedAt: new Date("2024-01-10T00:00:00Z")
|
|
142
|
+
}
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
// src/tool/tool.handler.ts
|
|
146
|
+
async function mockListToolsHandler(input) {
|
|
147
|
+
const {
|
|
148
|
+
organizationId,
|
|
149
|
+
category,
|
|
150
|
+
status,
|
|
151
|
+
search,
|
|
152
|
+
limit = 20,
|
|
153
|
+
offset = 0
|
|
154
|
+
} = input;
|
|
155
|
+
let filtered = MOCK_TOOLS.filter((t) => t.organizationId === organizationId);
|
|
156
|
+
if (category)
|
|
157
|
+
filtered = filtered.filter((t) => t.category === category);
|
|
158
|
+
if (status)
|
|
159
|
+
filtered = filtered.filter((t) => t.status === status);
|
|
160
|
+
if (search) {
|
|
161
|
+
const q = search.toLowerCase();
|
|
162
|
+
filtered = filtered.filter((t) => t.name.toLowerCase().includes(q) || t.description.toLowerCase().includes(q));
|
|
163
|
+
}
|
|
164
|
+
const total = filtered.length;
|
|
165
|
+
const items = filtered.slice(offset, offset + limit).map((t) => ({
|
|
166
|
+
id: t.id,
|
|
167
|
+
name: t.name,
|
|
168
|
+
slug: t.slug,
|
|
169
|
+
description: t.description,
|
|
170
|
+
category: t.category,
|
|
171
|
+
status: t.status,
|
|
172
|
+
version: t.version,
|
|
173
|
+
createdAt: t.createdAt
|
|
174
|
+
}));
|
|
175
|
+
return { items, total, hasMore: offset + limit < total };
|
|
176
|
+
}
|
|
177
|
+
async function mockGetToolHandler(input) {
|
|
178
|
+
const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
|
|
179
|
+
if (!tool)
|
|
180
|
+
throw new Error("TOOL_NOT_FOUND");
|
|
181
|
+
return tool;
|
|
182
|
+
}
|
|
183
|
+
async function mockCreateToolHandler(input) {
|
|
184
|
+
const exists = MOCK_TOOLS.some((t) => t.organizationId === input.organizationId && t.slug === input.slug);
|
|
185
|
+
if (exists)
|
|
186
|
+
throw new Error("SLUG_EXISTS");
|
|
187
|
+
return {
|
|
188
|
+
id: `tool-${Date.now()}`,
|
|
189
|
+
name: input.name,
|
|
190
|
+
slug: input.slug,
|
|
191
|
+
status: "DRAFT"
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
async function mockUpdateToolHandler(input) {
|
|
195
|
+
const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
|
|
196
|
+
if (!tool)
|
|
197
|
+
throw new Error("TOOL_NOT_FOUND");
|
|
198
|
+
return {
|
|
199
|
+
id: tool.id,
|
|
200
|
+
name: input.name ?? tool.name,
|
|
201
|
+
status: input.status ?? tool.status,
|
|
202
|
+
updatedAt: new Date
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
async function mockTestToolHandler(input) {
|
|
206
|
+
const tool = MOCK_TOOLS.find((t) => t.id === input.toolId);
|
|
207
|
+
if (!tool)
|
|
208
|
+
throw new Error("TOOL_NOT_FOUND");
|
|
209
|
+
const startTime = Date.now();
|
|
210
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
211
|
+
return {
|
|
212
|
+
success: true,
|
|
213
|
+
output: { result: "Test successful", input: input.testInput },
|
|
214
|
+
durationMs: Date.now() - startTime
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/tool/tool.enum.ts
|
|
219
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
220
|
+
var ToolCategoryEnum = defineEnum("ToolCategory", [
|
|
221
|
+
"RETRIEVAL",
|
|
222
|
+
"COMPUTATION",
|
|
223
|
+
"COMMUNICATION",
|
|
224
|
+
"INTEGRATION",
|
|
225
|
+
"UTILITY",
|
|
226
|
+
"CUSTOM"
|
|
227
|
+
]);
|
|
228
|
+
var ToolStatusEnum = defineEnum("ToolStatus", [
|
|
229
|
+
"DRAFT",
|
|
230
|
+
"ACTIVE",
|
|
231
|
+
"DEPRECATED",
|
|
232
|
+
"DISABLED"
|
|
233
|
+
]);
|
|
234
|
+
var ImplementationTypeEnum = defineEnum("ImplementationType", [
|
|
235
|
+
"http",
|
|
236
|
+
"function",
|
|
237
|
+
"workflow"
|
|
238
|
+
]);
|
|
239
|
+
|
|
240
|
+
// src/tool/tool.schema.ts
|
|
241
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
242
|
+
var ToolModel = defineSchemaModel({
|
|
243
|
+
name: "Tool",
|
|
244
|
+
description: "AI tool definition",
|
|
245
|
+
fields: {
|
|
246
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
247
|
+
organizationId: {
|
|
248
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
249
|
+
isOptional: false
|
|
250
|
+
},
|
|
251
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
252
|
+
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
253
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
254
|
+
category: { type: ToolCategoryEnum, isOptional: false },
|
|
255
|
+
status: { type: ToolStatusEnum, isOptional: false },
|
|
256
|
+
parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
257
|
+
outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
258
|
+
implementationType: { type: ImplementationTypeEnum, isOptional: false },
|
|
259
|
+
implementationConfig: {
|
|
260
|
+
type: ScalarTypeEnum.JSONObject(),
|
|
261
|
+
isOptional: false
|
|
262
|
+
},
|
|
263
|
+
maxInvocationsPerMinute: {
|
|
264
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
265
|
+
isOptional: true
|
|
266
|
+
},
|
|
267
|
+
timeoutMs: {
|
|
268
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
269
|
+
isOptional: false,
|
|
270
|
+
defaultValue: 30000
|
|
271
|
+
},
|
|
272
|
+
version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
273
|
+
tags: {
|
|
274
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
275
|
+
isArray: true,
|
|
276
|
+
isOptional: true
|
|
277
|
+
},
|
|
278
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
279
|
+
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
var ToolSummaryModel = defineSchemaModel({
|
|
283
|
+
name: "ToolSummary",
|
|
284
|
+
description: "Summary of a tool for list views",
|
|
285
|
+
fields: {
|
|
286
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
287
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
288
|
+
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
289
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
290
|
+
category: { type: ToolCategoryEnum, isOptional: false },
|
|
291
|
+
status: { type: ToolStatusEnum, isOptional: false },
|
|
292
|
+
version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
293
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
var CreateToolInputModel = defineSchemaModel({
|
|
297
|
+
name: "CreateToolInput",
|
|
298
|
+
description: "Input for creating a tool",
|
|
299
|
+
fields: {
|
|
300
|
+
organizationId: {
|
|
301
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
302
|
+
isOptional: false
|
|
303
|
+
},
|
|
304
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
305
|
+
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
306
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
307
|
+
category: { type: ToolCategoryEnum, isOptional: true },
|
|
308
|
+
parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
309
|
+
outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
310
|
+
implementationType: { type: ImplementationTypeEnum, isOptional: false },
|
|
311
|
+
implementationConfig: {
|
|
312
|
+
type: ScalarTypeEnum.JSONObject(),
|
|
313
|
+
isOptional: false
|
|
314
|
+
},
|
|
315
|
+
maxInvocationsPerMinute: {
|
|
316
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
317
|
+
isOptional: true
|
|
318
|
+
},
|
|
319
|
+
timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
320
|
+
tags: {
|
|
321
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
322
|
+
isArray: true,
|
|
323
|
+
isOptional: true
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
var UpdateToolInputModel = defineSchemaModel({
|
|
328
|
+
name: "UpdateToolInput",
|
|
329
|
+
description: "Input for updating a tool",
|
|
330
|
+
fields: {
|
|
331
|
+
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
332
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: true },
|
|
333
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
334
|
+
status: { type: ToolStatusEnum, isOptional: true },
|
|
335
|
+
parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
336
|
+
outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
337
|
+
implementationConfig: {
|
|
338
|
+
type: ScalarTypeEnum.JSONObject(),
|
|
339
|
+
isOptional: true
|
|
340
|
+
},
|
|
341
|
+
maxInvocationsPerMinute: {
|
|
342
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
343
|
+
isOptional: true
|
|
344
|
+
},
|
|
345
|
+
timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
346
|
+
tags: {
|
|
347
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
348
|
+
isArray: true,
|
|
349
|
+
isOptional: true
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// src/tool/tool.operation.ts
|
|
355
|
+
import {
|
|
356
|
+
defineCommand,
|
|
357
|
+
defineQuery
|
|
358
|
+
} from "@contractspec/lib.contracts/operations";
|
|
359
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
360
|
+
var OWNERS = ["@agent-console-team"];
|
|
361
|
+
var CreateToolCommand = defineCommand({
|
|
362
|
+
meta: {
|
|
363
|
+
key: "agent.tool.create",
|
|
364
|
+
version: "1.0.0",
|
|
365
|
+
stability: "stable",
|
|
366
|
+
owners: [...OWNERS],
|
|
367
|
+
tags: ["tool", "create"],
|
|
368
|
+
description: "Creates a new AI tool definition.",
|
|
369
|
+
goal: "Allow users to define new tools that agents can use.",
|
|
370
|
+
context: "Called from the tool builder UI when creating a new tool."
|
|
371
|
+
},
|
|
372
|
+
io: {
|
|
373
|
+
input: CreateToolInputModel,
|
|
374
|
+
output: defineSchemaModel2({
|
|
375
|
+
name: "CreateToolOutput",
|
|
376
|
+
fields: {
|
|
377
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
378
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
379
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
380
|
+
status: { type: ToolStatusEnum, isOptional: false }
|
|
381
|
+
}
|
|
382
|
+
}),
|
|
383
|
+
errors: {
|
|
384
|
+
SLUG_EXISTS: {
|
|
385
|
+
description: "A tool with this slug already exists in the organization",
|
|
386
|
+
http: 409,
|
|
387
|
+
gqlCode: "SLUG_EXISTS",
|
|
388
|
+
when: "Slug is already taken"
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
policy: { auth: "user" },
|
|
393
|
+
sideEffects: {
|
|
394
|
+
emits: [
|
|
395
|
+
{
|
|
396
|
+
key: "tool.created",
|
|
397
|
+
version: "1.0.0",
|
|
398
|
+
stability: "stable",
|
|
399
|
+
owners: [...OWNERS],
|
|
400
|
+
tags: ["tool", "created"],
|
|
401
|
+
when: "Tool is successfully created",
|
|
402
|
+
payload: ToolSummaryModel
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
audit: ["tool.created"]
|
|
406
|
+
},
|
|
407
|
+
acceptance: {
|
|
408
|
+
scenarios: [
|
|
409
|
+
{
|
|
410
|
+
key: "create-tool-happy-path",
|
|
411
|
+
given: ["User is authenticated", "Organization exists"],
|
|
412
|
+
when: ["User submits valid tool configuration"],
|
|
413
|
+
then: ["New tool is created", "ToolCreated event is emitted"]
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
key: "create-tool-slug-conflict",
|
|
417
|
+
given: ["Tool with same slug exists"],
|
|
418
|
+
when: ["User submits tool with duplicate slug"],
|
|
419
|
+
then: ["SLUG_EXISTS error is returned"]
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
examples: [
|
|
423
|
+
{
|
|
424
|
+
key: "create-api-tool",
|
|
425
|
+
input: {
|
|
426
|
+
name: "Weather API",
|
|
427
|
+
slug: "weather-api",
|
|
428
|
+
category: "api",
|
|
429
|
+
description: "Fetches weather data"
|
|
430
|
+
},
|
|
431
|
+
output: {
|
|
432
|
+
id: "tool-123",
|
|
433
|
+
name: "Weather API",
|
|
434
|
+
slug: "weather-api",
|
|
435
|
+
status: "draft"
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
var UpdateToolCommand = defineCommand({
|
|
442
|
+
meta: {
|
|
443
|
+
key: "agent.tool.update",
|
|
444
|
+
version: "1.0.0",
|
|
445
|
+
stability: "stable",
|
|
446
|
+
owners: [...OWNERS],
|
|
447
|
+
tags: ["tool", "update"],
|
|
448
|
+
description: "Updates an existing AI tool definition.",
|
|
449
|
+
goal: "Allow users to modify tool settings and configuration.",
|
|
450
|
+
context: "Called from the tool settings UI."
|
|
451
|
+
},
|
|
452
|
+
io: {
|
|
453
|
+
input: UpdateToolInputModel,
|
|
454
|
+
output: defineSchemaModel2({
|
|
455
|
+
name: "UpdateToolOutput",
|
|
456
|
+
fields: {
|
|
457
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
458
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
459
|
+
status: { type: ToolStatusEnum, isOptional: false },
|
|
460
|
+
updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
461
|
+
}
|
|
462
|
+
}),
|
|
463
|
+
errors: {
|
|
464
|
+
TOOL_NOT_FOUND: {
|
|
465
|
+
description: "The specified tool does not exist",
|
|
466
|
+
http: 404,
|
|
467
|
+
gqlCode: "TOOL_NOT_FOUND",
|
|
468
|
+
when: "Tool ID is invalid"
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
policy: { auth: "user" },
|
|
473
|
+
sideEffects: {
|
|
474
|
+
emits: [
|
|
475
|
+
{
|
|
476
|
+
key: "tool.updated",
|
|
477
|
+
version: "1.0.0",
|
|
478
|
+
stability: "stable",
|
|
479
|
+
owners: [...OWNERS],
|
|
480
|
+
tags: ["tool", "updated"],
|
|
481
|
+
when: "Tool is updated",
|
|
482
|
+
payload: ToolSummaryModel
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
audit: ["tool.updated"]
|
|
486
|
+
},
|
|
487
|
+
acceptance: {
|
|
488
|
+
scenarios: [
|
|
489
|
+
{
|
|
490
|
+
key: "update-tool-happy-path",
|
|
491
|
+
given: ["Tool exists", "User owns the tool"],
|
|
492
|
+
when: ["User submits updated configuration"],
|
|
493
|
+
then: ["Tool is updated", "ToolUpdated event is emitted"]
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
examples: [
|
|
497
|
+
{
|
|
498
|
+
key: "update-description",
|
|
499
|
+
input: { toolId: "tool-123", description: "Updated weather API tool" },
|
|
500
|
+
output: {
|
|
501
|
+
id: "tool-123",
|
|
502
|
+
name: "Weather API",
|
|
503
|
+
status: "draft",
|
|
504
|
+
updatedAt: "2025-01-01T00:00:00Z"
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
var GetToolQuery = defineQuery({
|
|
511
|
+
meta: {
|
|
512
|
+
key: "agent.tool.get",
|
|
513
|
+
version: "1.0.0",
|
|
514
|
+
stability: "stable",
|
|
515
|
+
owners: [...OWNERS],
|
|
516
|
+
tags: ["tool", "get"],
|
|
517
|
+
description: "Retrieves a tool by its ID.",
|
|
518
|
+
goal: "View detailed tool configuration.",
|
|
519
|
+
context: "Called when viewing tool details or editing."
|
|
520
|
+
},
|
|
521
|
+
io: {
|
|
522
|
+
input: defineSchemaModel2({
|
|
523
|
+
name: "GetToolInput",
|
|
524
|
+
fields: {
|
|
525
|
+
toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
526
|
+
}
|
|
527
|
+
}),
|
|
528
|
+
output: ToolModel,
|
|
529
|
+
errors: {
|
|
530
|
+
TOOL_NOT_FOUND: {
|
|
531
|
+
description: "The specified tool does not exist",
|
|
532
|
+
http: 404,
|
|
533
|
+
gqlCode: "TOOL_NOT_FOUND",
|
|
534
|
+
when: "Tool ID is invalid"
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
policy: { auth: "user" },
|
|
539
|
+
acceptance: {
|
|
540
|
+
scenarios: [
|
|
541
|
+
{
|
|
542
|
+
key: "get-tool-happy-path",
|
|
543
|
+
given: ["Tool exists"],
|
|
544
|
+
when: ["User requests tool by ID"],
|
|
545
|
+
then: ["Tool details are returned"]
|
|
546
|
+
}
|
|
547
|
+
],
|
|
548
|
+
examples: [
|
|
549
|
+
{
|
|
550
|
+
key: "get-basic",
|
|
551
|
+
input: { toolId: "tool-123" },
|
|
552
|
+
output: {
|
|
553
|
+
id: "tool-123",
|
|
554
|
+
name: "Weather API",
|
|
555
|
+
status: "active",
|
|
556
|
+
category: "api"
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
var ListToolsQuery = defineQuery({
|
|
563
|
+
meta: {
|
|
564
|
+
key: "agent.tool.list",
|
|
565
|
+
version: "1.0.0",
|
|
566
|
+
stability: "stable",
|
|
567
|
+
owners: [...OWNERS],
|
|
568
|
+
tags: ["tool", "list"],
|
|
569
|
+
description: "Lists tools for an organization with optional filtering.",
|
|
570
|
+
goal: "Browse and search available tools.",
|
|
571
|
+
context: "Tool list/dashboard view."
|
|
572
|
+
},
|
|
573
|
+
io: {
|
|
574
|
+
input: defineSchemaModel2({
|
|
575
|
+
name: "ListToolsInput",
|
|
576
|
+
fields: {
|
|
577
|
+
organizationId: {
|
|
578
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
579
|
+
isOptional: false
|
|
580
|
+
},
|
|
581
|
+
category: { type: ToolCategoryEnum, isOptional: true },
|
|
582
|
+
status: { type: ToolStatusEnum, isOptional: true },
|
|
583
|
+
search: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
584
|
+
limit: {
|
|
585
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
586
|
+
isOptional: true,
|
|
587
|
+
defaultValue: 20
|
|
588
|
+
},
|
|
589
|
+
offset: {
|
|
590
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
591
|
+
isOptional: true,
|
|
592
|
+
defaultValue: 0
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}),
|
|
596
|
+
output: defineSchemaModel2({
|
|
597
|
+
name: "ListToolsOutput",
|
|
598
|
+
fields: {
|
|
599
|
+
items: { type: ToolSummaryModel, isArray: true, isOptional: false },
|
|
600
|
+
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
601
|
+
hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
|
|
602
|
+
}
|
|
603
|
+
})
|
|
604
|
+
},
|
|
605
|
+
policy: { auth: "user" },
|
|
606
|
+
acceptance: {
|
|
607
|
+
scenarios: [
|
|
608
|
+
{
|
|
609
|
+
key: "list-tools-happy-path",
|
|
610
|
+
given: ["Organization has tools"],
|
|
611
|
+
when: ["User lists tools"],
|
|
612
|
+
then: ["Paginated list of tools is returned"]
|
|
613
|
+
}
|
|
614
|
+
],
|
|
615
|
+
examples: [
|
|
616
|
+
{
|
|
617
|
+
key: "list-by-category",
|
|
618
|
+
input: { organizationId: "org-123", category: "api", limit: 10 },
|
|
619
|
+
output: { items: [], total: 0, hasMore: false }
|
|
620
|
+
}
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
var TestToolCommand = defineCommand({
|
|
625
|
+
meta: {
|
|
626
|
+
key: "agent.tool.test",
|
|
627
|
+
version: "1.0.0",
|
|
628
|
+
stability: "stable",
|
|
629
|
+
owners: [...OWNERS],
|
|
630
|
+
tags: ["tool", "test"],
|
|
631
|
+
description: "Tests a tool with sample input to verify it works correctly.",
|
|
632
|
+
goal: "Validate tool configuration before deployment.",
|
|
633
|
+
context: "Tool builder UI - test panel."
|
|
634
|
+
},
|
|
635
|
+
io: {
|
|
636
|
+
input: defineSchemaModel2({
|
|
637
|
+
name: "TestToolInput",
|
|
638
|
+
fields: {
|
|
639
|
+
toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
640
|
+
testInput: { type: ScalarTypeEnum2.JSONObject(), isOptional: false }
|
|
641
|
+
}
|
|
642
|
+
}),
|
|
643
|
+
output: defineSchemaModel2({
|
|
644
|
+
name: "TestToolOutput",
|
|
645
|
+
fields: {
|
|
646
|
+
success: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
647
|
+
output: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
648
|
+
error: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
649
|
+
durationMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
|
|
650
|
+
}
|
|
651
|
+
}),
|
|
652
|
+
errors: {
|
|
653
|
+
TOOL_NOT_FOUND: {
|
|
654
|
+
description: "The specified tool does not exist",
|
|
655
|
+
http: 404,
|
|
656
|
+
gqlCode: "TOOL_NOT_FOUND",
|
|
657
|
+
when: "Tool ID is invalid"
|
|
658
|
+
},
|
|
659
|
+
TOOL_EXECUTION_ERROR: {
|
|
660
|
+
description: "Tool execution failed",
|
|
661
|
+
http: 500,
|
|
662
|
+
gqlCode: "TOOL_EXECUTION_ERROR",
|
|
663
|
+
when: "Tool returns an error"
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
policy: { auth: "user" },
|
|
668
|
+
sideEffects: { audit: ["tool.tested"] },
|
|
669
|
+
acceptance: {
|
|
670
|
+
scenarios: [
|
|
671
|
+
{
|
|
672
|
+
key: "test-tool-success",
|
|
673
|
+
given: ["Tool exists", "Tool is configured correctly"],
|
|
674
|
+
when: ["User runs test with valid input"],
|
|
675
|
+
then: ["Tool executes successfully", "Output is returned"]
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
key: "test-tool-failure",
|
|
679
|
+
given: ["Tool exists", "Tool has configuration error"],
|
|
680
|
+
when: ["User runs test"],
|
|
681
|
+
then: ["TOOL_EXECUTION_ERROR is returned"]
|
|
682
|
+
}
|
|
683
|
+
],
|
|
684
|
+
examples: [
|
|
685
|
+
{
|
|
686
|
+
key: "test-weather-api",
|
|
687
|
+
input: { toolId: "tool-123", testInput: { city: "Paris" } },
|
|
688
|
+
output: { success: true, output: { temperature: 22 }, durationMs: 150 }
|
|
689
|
+
}
|
|
690
|
+
]
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
// src/tool/tool.event.ts
|
|
695
|
+
import { defineEvent, defineSchemaModel as defineSchemaModel3 } from "@contractspec/lib.contracts";
|
|
696
|
+
import { ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
|
|
697
|
+
var OWNERS2 = ["@agent-console-team"];
|
|
698
|
+
var ToolCreatedPayload = defineSchemaModel3({
|
|
699
|
+
name: "ToolCreatedPayload",
|
|
700
|
+
description: "Payload for tool created event",
|
|
701
|
+
fields: {
|
|
702
|
+
id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
703
|
+
organizationId: {
|
|
704
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
705
|
+
isOptional: false
|
|
706
|
+
},
|
|
707
|
+
name: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
708
|
+
slug: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
709
|
+
category: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
710
|
+
implementationType: {
|
|
711
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
712
|
+
isOptional: false
|
|
713
|
+
},
|
|
714
|
+
createdById: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
715
|
+
createdAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
var ToolCreatedEvent = defineEvent({
|
|
719
|
+
meta: {
|
|
720
|
+
key: "agent.tool.created",
|
|
721
|
+
version: "1.0.0",
|
|
722
|
+
description: "A new AI tool was created.",
|
|
723
|
+
stability: "stable",
|
|
724
|
+
owners: [...OWNERS2],
|
|
725
|
+
tags: ["tool", "created"]
|
|
726
|
+
},
|
|
727
|
+
payload: ToolCreatedPayload
|
|
728
|
+
});
|
|
729
|
+
var ToolUpdatedPayload = defineSchemaModel3({
|
|
730
|
+
name: "ToolUpdatedPayload",
|
|
731
|
+
description: "Payload for tool updated event",
|
|
732
|
+
fields: {
|
|
733
|
+
id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
734
|
+
organizationId: {
|
|
735
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
736
|
+
isOptional: false
|
|
737
|
+
},
|
|
738
|
+
name: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
739
|
+
status: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
740
|
+
updatedFields: {
|
|
741
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
742
|
+
isArray: true,
|
|
743
|
+
isOptional: false
|
|
744
|
+
},
|
|
745
|
+
updatedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
var ToolUpdatedEvent = defineEvent({
|
|
749
|
+
meta: {
|
|
750
|
+
key: "agent.tool.updated",
|
|
751
|
+
version: "1.0.0",
|
|
752
|
+
description: "An AI tool configuration was updated.",
|
|
753
|
+
stability: "stable",
|
|
754
|
+
owners: [...OWNERS2],
|
|
755
|
+
tags: ["tool", "updated"]
|
|
756
|
+
},
|
|
757
|
+
payload: ToolUpdatedPayload
|
|
758
|
+
});
|
|
759
|
+
var ToolStatusChangedPayload = defineSchemaModel3({
|
|
760
|
+
name: "ToolStatusChangedPayload",
|
|
761
|
+
description: "Payload for tool status changed event",
|
|
762
|
+
fields: {
|
|
763
|
+
id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
764
|
+
organizationId: {
|
|
765
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
766
|
+
isOptional: false
|
|
767
|
+
},
|
|
768
|
+
name: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
769
|
+
previousStatus: {
|
|
770
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
771
|
+
isOptional: false
|
|
772
|
+
},
|
|
773
|
+
newStatus: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
774
|
+
changedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
var ToolStatusChangedEvent = defineEvent({
|
|
778
|
+
meta: {
|
|
779
|
+
key: "agent.tool.statusChanged",
|
|
780
|
+
version: "1.0.0",
|
|
781
|
+
description: "An AI tool status was changed (activated, deprecated, disabled).",
|
|
782
|
+
stability: "stable",
|
|
783
|
+
owners: [...OWNERS2],
|
|
784
|
+
tags: ["tool", "status"]
|
|
785
|
+
},
|
|
786
|
+
payload: ToolStatusChangedPayload
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
// src/tool/tool.entity.ts
|
|
790
|
+
import {
|
|
791
|
+
defineEntity,
|
|
792
|
+
defineEntityEnum,
|
|
793
|
+
field,
|
|
794
|
+
index
|
|
795
|
+
} from "@contractspec/lib.schema";
|
|
796
|
+
var ToolCategoryEntityEnum = defineEntityEnum({
|
|
797
|
+
name: "ToolCategory",
|
|
798
|
+
values: [
|
|
799
|
+
"RETRIEVAL",
|
|
800
|
+
"COMPUTATION",
|
|
801
|
+
"COMMUNICATION",
|
|
802
|
+
"INTEGRATION",
|
|
803
|
+
"UTILITY",
|
|
804
|
+
"CUSTOM"
|
|
805
|
+
],
|
|
806
|
+
description: "Category of tool"
|
|
807
|
+
});
|
|
808
|
+
var ToolStatusEntityEnum = defineEntityEnum({
|
|
809
|
+
name: "ToolStatus",
|
|
810
|
+
values: ["DRAFT", "ACTIVE", "DEPRECATED", "DISABLED"],
|
|
811
|
+
description: "Status of tool"
|
|
812
|
+
});
|
|
813
|
+
var ImplementationTypeEntityEnum = defineEntityEnum({
|
|
814
|
+
name: "ImplementationType",
|
|
815
|
+
values: ["http", "function", "workflow"],
|
|
816
|
+
description: "How the tool is implemented"
|
|
817
|
+
});
|
|
818
|
+
var ToolEntity = defineEntity({
|
|
819
|
+
name: "Tool",
|
|
820
|
+
schema: "agent_console",
|
|
821
|
+
description: "An AI tool that can be used by agents.",
|
|
822
|
+
fields: {
|
|
823
|
+
id: field.id(),
|
|
824
|
+
organizationId: field.string({
|
|
825
|
+
description: "Organization that owns this tool"
|
|
826
|
+
}),
|
|
827
|
+
name: field.string({ description: "Tool name" }),
|
|
828
|
+
slug: field.string({ description: "URL-safe identifier" }),
|
|
829
|
+
description: field.string({ description: "Tool description" }),
|
|
830
|
+
category: field.enum("ToolCategory", { default: "CUSTOM" }),
|
|
831
|
+
status: field.enum("ToolStatus", { default: "DRAFT" }),
|
|
832
|
+
parametersSchema: field.json({
|
|
833
|
+
description: "JSON Schema for tool parameters"
|
|
834
|
+
}),
|
|
835
|
+
outputSchema: field.json({
|
|
836
|
+
isOptional: true,
|
|
837
|
+
description: "JSON Schema for tool output"
|
|
838
|
+
}),
|
|
839
|
+
implementationType: field.enum("ImplementationType"),
|
|
840
|
+
implementationConfig: field.json({
|
|
841
|
+
description: "Implementation configuration"
|
|
842
|
+
}),
|
|
843
|
+
maxInvocationsPerMinute: field.int({
|
|
844
|
+
isOptional: true,
|
|
845
|
+
description: "Rate limit"
|
|
846
|
+
}),
|
|
847
|
+
timeoutMs: field.int({ default: 30000, description: "Execution timeout" }),
|
|
848
|
+
version: field.string({ default: "1.0.0", description: "Tool version" }),
|
|
849
|
+
tags: field.string({
|
|
850
|
+
isArray: true,
|
|
851
|
+
isOptional: true,
|
|
852
|
+
description: "Tags for categorization"
|
|
853
|
+
}),
|
|
854
|
+
createdAt: field.createdAt(),
|
|
855
|
+
updatedAt: field.updatedAt(),
|
|
856
|
+
createdById: field.string({
|
|
857
|
+
isOptional: true,
|
|
858
|
+
description: "User who created this tool"
|
|
859
|
+
}),
|
|
860
|
+
agents: field.hasMany("Agent", { description: "Agents using this tool" })
|
|
861
|
+
},
|
|
862
|
+
indexes: [
|
|
863
|
+
index.unique(["organizationId", "slug"]),
|
|
864
|
+
index.on(["organizationId", "category"]),
|
|
865
|
+
index.on(["organizationId", "status"])
|
|
866
|
+
],
|
|
867
|
+
enums: [
|
|
868
|
+
ToolCategoryEntityEnum,
|
|
869
|
+
ToolStatusEntityEnum,
|
|
870
|
+
ImplementationTypeEntityEnum
|
|
871
|
+
]
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
// src/tool/tool.presentation.ts
|
|
875
|
+
import { StabilityEnum, definePresentation } from "@contractspec/lib.contracts";
|
|
876
|
+
var ToolListPresentation = definePresentation({
|
|
877
|
+
meta: {
|
|
878
|
+
key: "agent-console.tool.list",
|
|
879
|
+
version: "1.0.0",
|
|
880
|
+
title: "Tool List",
|
|
881
|
+
description: "List view of AI tools with category, status, and version info",
|
|
882
|
+
goal: "Provide an overview of all available tools for agents.",
|
|
883
|
+
context: "Tool management dashboard.",
|
|
884
|
+
domain: "agent-console",
|
|
885
|
+
owners: ["@agent-console-team"],
|
|
886
|
+
tags: ["tool", "list", "dashboard"],
|
|
887
|
+
stability: StabilityEnum.Experimental
|
|
888
|
+
},
|
|
889
|
+
source: {
|
|
890
|
+
type: "component",
|
|
891
|
+
framework: "react",
|
|
892
|
+
componentKey: "ToolListView",
|
|
893
|
+
props: ToolSummaryModel
|
|
894
|
+
},
|
|
895
|
+
targets: ["react", "markdown", "application/json"],
|
|
896
|
+
policy: { flags: ["agent-console.enabled"] }
|
|
897
|
+
});
|
|
898
|
+
var ToolDetailPresentation = definePresentation({
|
|
899
|
+
meta: {
|
|
900
|
+
key: "agent-console.tool.detail",
|
|
901
|
+
version: "1.0.0",
|
|
902
|
+
title: "Tool Details",
|
|
903
|
+
description: "Detailed view of an AI tool with configuration and test panel",
|
|
904
|
+
goal: "Allow users to inspect and test a specific tool.",
|
|
905
|
+
context: "Detailed view of a tool.",
|
|
906
|
+
domain: "agent-console",
|
|
907
|
+
owners: ["@agent-console-team"],
|
|
908
|
+
tags: ["tool", "detail"],
|
|
909
|
+
stability: StabilityEnum.Experimental
|
|
910
|
+
},
|
|
911
|
+
source: {
|
|
912
|
+
type: "component",
|
|
913
|
+
framework: "react",
|
|
914
|
+
componentKey: "ToolDetailView"
|
|
915
|
+
},
|
|
916
|
+
targets: ["react", "markdown"],
|
|
917
|
+
policy: { flags: ["agent-console.enabled"] }
|
|
918
|
+
});
|
|
919
|
+
export {
|
|
920
|
+
mockUpdateToolHandler,
|
|
921
|
+
mockTestToolHandler,
|
|
922
|
+
mockListToolsHandler,
|
|
923
|
+
mockGetToolHandler,
|
|
924
|
+
mockCreateToolHandler,
|
|
925
|
+
UpdateToolInputModel,
|
|
926
|
+
UpdateToolCommand,
|
|
927
|
+
ToolUpdatedEvent,
|
|
928
|
+
ToolSummaryModel,
|
|
929
|
+
ToolStatusEnum,
|
|
930
|
+
ToolStatusEntityEnum,
|
|
931
|
+
ToolStatusChangedEvent,
|
|
932
|
+
ToolModel,
|
|
933
|
+
ToolListPresentation,
|
|
934
|
+
ToolEntity,
|
|
935
|
+
ToolDetailPresentation,
|
|
936
|
+
ToolCreatedEvent,
|
|
937
|
+
ToolCategoryEnum,
|
|
938
|
+
ToolCategoryEntityEnum,
|
|
939
|
+
TestToolCommand,
|
|
940
|
+
ListToolsQuery,
|
|
941
|
+
ImplementationTypeEnum,
|
|
942
|
+
ImplementationTypeEntityEnum,
|
|
943
|
+
GetToolQuery,
|
|
944
|
+
CreateToolInputModel,
|
|
945
|
+
CreateToolCommand
|
|
946
|
+
};
|