@contractspec/example.agent-console 3.7.6 → 3.8.2
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 +126 -105
- package/AGENTS.md +52 -31
- package/CHANGELOG.md +29 -0
- package/README.md +112 -83
- package/dist/agent/agent.event.js +1 -1
- package/dist/agent/agent.handler.d.ts +3 -0
- package/dist/agent/agent.handler.js +730 -1
- package/dist/agent/agent.operation.js +1 -1
- package/dist/agent/index.d.ts +5 -5
- package/dist/agent/index.js +74 -73
- package/dist/agent.feature.js +179 -0
- package/dist/browser/agent/agent.event.js +1 -1
- package/dist/browser/agent/agent.handler.js +730 -1
- package/dist/browser/agent/agent.operation.js +1 -1
- package/dist/browser/agent/index.js +74 -73
- package/dist/browser/agent.feature.js +179 -0
- package/dist/browser/docs/agent-console.docblock.js +11 -8
- package/dist/browser/docs/index.js +11 -8
- package/dist/browser/example.js +2 -3
- package/dist/browser/handlers/agent.handlers.js +1883 -2
- package/dist/browser/handlers/index.js +2142 -8
- package/dist/browser/index.js +4075 -3161
- package/dist/browser/presentations/index.js +51 -51
- package/dist/browser/run/index.js +380 -374
- package/dist/browser/run/run.event.js +2 -2
- package/dist/browser/run/run.handler.js +666 -1
- package/dist/browser/run/run.presentation.js +2 -2
- package/dist/browser/shared/index.js +293 -1
- package/dist/browser/shared/mock-runs.js +5 -0
- package/dist/browser/tool/index.js +161 -161
- package/dist/browser/tool/tool.event.js +1 -1
- package/dist/browser/tool/tool.handler.js +479 -3
- package/dist/browser/tool/tool.presentation.js +2 -2
- package/dist/browser/ui/AgentDashboard.js +1816 -931
- package/dist/browser/ui/AgentDashboard.visualizations.js +217 -0
- package/dist/browser/ui/AgentRunList.js +360 -128
- package/dist/browser/ui/AgentToolRegistry.js +9 -9
- package/dist/browser/ui/hooks/index.js +611 -161
- package/dist/browser/ui/hooks/useAgentList.js +1 -1
- package/dist/browser/ui/hooks/useAgentMutations.js +444 -9
- package/dist/browser/ui/hooks/useRunList.js +26 -11
- package/dist/browser/ui/hooks/useToolList.js +1 -1
- package/dist/browser/ui/index.js +2161 -1258
- package/dist/browser/ui/modals/AgentActionsModal.js +13 -13
- package/dist/browser/ui/modals/CreateAgentModal.js +15 -15
- package/dist/browser/ui/modals/index.js +297 -297
- package/dist/browser/ui/renderers/agent-list.markdown.js +14 -5
- package/dist/browser/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/browser/ui/renderers/dashboard.markdown.js +207 -36
- package/dist/browser/ui/renderers/index.js +359 -163
- package/dist/browser/ui/renderers/run-list.markdown.js +9 -4
- package/dist/browser/ui/renderers/tool-registry.markdown.js +15 -4
- package/dist/browser/ui/views/AgentListView.js +7 -7
- package/dist/browser/ui/views/RunDataTable.js +326 -0
- package/dist/browser/ui/views/RunListView.js +360 -128
- package/dist/browser/ui/views/ToolRegistryView.js +9 -9
- package/dist/browser/ui/views/index.js +478 -246
- package/dist/browser/ui/views/run-data-table.columns.js +271 -0
- package/dist/browser/ui/views/run-list.shared.js +177 -0
- package/dist/browser/visualizations/catalog.js +134 -0
- package/dist/browser/visualizations/index.js +187 -0
- package/dist/browser/visualizations/selectors.js +181 -0
- package/dist/docs/agent-console.docblock.js +11 -8
- package/dist/docs/index.js +11 -8
- package/dist/example.js +2 -3
- package/dist/example.test.d.ts +1 -0
- package/dist/handlers/agent.handlers.d.ts +2 -0
- package/dist/handlers/agent.handlers.js +1883 -2
- package/dist/handlers/index.d.ts +2 -4
- package/dist/handlers/index.js +2142 -8
- package/dist/handlers/mock-handlers.test.d.ts +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +4075 -3161
- package/dist/node/agent/agent.event.js +1 -1
- package/dist/node/agent/agent.handler.js +730 -1
- package/dist/node/agent/agent.operation.js +1 -1
- package/dist/node/agent/index.js +74 -73
- package/dist/node/agent.feature.js +179 -0
- package/dist/node/docs/agent-console.docblock.js +11 -8
- package/dist/node/docs/index.js +11 -8
- package/dist/node/example.js +2 -3
- package/dist/node/handlers/agent.handlers.js +1883 -2
- package/dist/node/handlers/index.js +2142 -8
- package/dist/node/index.js +4075 -3161
- package/dist/node/presentations/index.js +51 -51
- package/dist/node/run/index.js +380 -374
- package/dist/node/run/run.event.js +2 -2
- package/dist/node/run/run.handler.js +666 -1
- package/dist/node/run/run.presentation.js +2 -2
- package/dist/node/shared/index.js +293 -1
- package/dist/node/shared/mock-runs.js +5 -0
- package/dist/node/tool/index.js +161 -161
- package/dist/node/tool/tool.event.js +1 -1
- package/dist/node/tool/tool.handler.js +479 -3
- package/dist/node/tool/tool.presentation.js +2 -2
- package/dist/node/ui/AgentDashboard.js +1816 -931
- package/dist/node/ui/AgentDashboard.visualizations.js +217 -0
- package/dist/node/ui/AgentRunList.js +360 -128
- package/dist/node/ui/AgentToolRegistry.js +9 -9
- package/dist/node/ui/hooks/index.js +611 -161
- package/dist/node/ui/hooks/useAgentList.js +1 -1
- package/dist/node/ui/hooks/useAgentMutations.js +444 -9
- package/dist/node/ui/hooks/useRunList.js +26 -11
- package/dist/node/ui/hooks/useToolList.js +1 -1
- package/dist/node/ui/index.js +2161 -1258
- package/dist/node/ui/modals/AgentActionsModal.js +13 -13
- package/dist/node/ui/modals/CreateAgentModal.js +15 -15
- package/dist/node/ui/modals/index.js +297 -297
- package/dist/node/ui/renderers/agent-list.markdown.js +14 -5
- package/dist/node/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/node/ui/renderers/dashboard.markdown.js +207 -36
- package/dist/node/ui/renderers/index.js +359 -163
- package/dist/node/ui/renderers/run-list.markdown.js +9 -4
- package/dist/node/ui/renderers/tool-registry.markdown.js +15 -4
- package/dist/node/ui/views/AgentListView.js +7 -7
- package/dist/node/ui/views/RunDataTable.js +326 -0
- package/dist/node/ui/views/RunListView.js +360 -128
- package/dist/node/ui/views/ToolRegistryView.js +9 -9
- package/dist/node/ui/views/index.js +478 -246
- package/dist/node/ui/views/run-data-table.columns.js +271 -0
- package/dist/node/ui/views/run-list.shared.js +177 -0
- package/dist/node/visualizations/catalog.js +134 -0
- package/dist/node/visualizations/index.js +187 -0
- package/dist/node/visualizations/selectors.js +181 -0
- package/dist/presentations/index.d.ts +3 -5
- package/dist/presentations/index.js +51 -51
- package/dist/proof/index.d.ts +2 -0
- package/dist/proof/meetup-proof.d.ts +10 -0
- package/dist/proof/meetup-proof.runtime.d.ts +22 -0
- package/dist/proof/meetup-proof.scenario.d.ts +2 -0
- package/dist/proof/meetup-proof.suite.d.ts +1 -0
- package/dist/proof/meetup-proof.test.d.ts +1 -0
- package/dist/run/index.d.ts +7 -7
- package/dist/run/index.js +380 -374
- package/dist/run/run.event.js +2 -2
- package/dist/run/run.handler.d.ts +7 -0
- package/dist/run/run.handler.js +666 -1
- package/dist/run/run.presentation.js +2 -2
- package/dist/shared/demo-dashboard-data.d.ts +16 -0
- package/dist/shared/demo-runtime-seed.d.ts +17 -0
- package/dist/shared/demo-runtime.d.ts +8 -0
- package/dist/shared/demo-runtime.test.d.ts +1 -0
- package/dist/shared/index.d.ts +4 -1
- package/dist/shared/index.js +293 -1
- package/dist/shared/mock-runs.d.ts +4 -0
- package/dist/shared/mock-runs.js +5 -0
- package/dist/tool/index.d.ts +7 -7
- package/dist/tool/index.js +161 -161
- package/dist/tool/tool.event.js +1 -1
- package/dist/tool/tool.handler.d.ts +3 -0
- package/dist/tool/tool.handler.js +479 -3
- package/dist/tool/tool.presentation.js +2 -2
- package/dist/ui/AgentDashboard.js +1816 -931
- package/dist/ui/AgentDashboard.sandbox.test.d.ts +1 -0
- package/dist/ui/AgentDashboard.visualizations.d.ts +4 -0
- package/dist/ui/AgentDashboard.visualizations.js +218 -0
- package/dist/ui/AgentRunList.js +360 -128
- package/dist/ui/AgentToolRegistry.js +9 -9
- package/dist/ui/hooks/index.d.ts +4 -4
- package/dist/ui/hooks/index.js +611 -161
- package/dist/ui/hooks/useAgentList.d.ts +5 -0
- package/dist/ui/hooks/useAgentList.js +1 -1
- package/dist/ui/hooks/useAgentMutations.d.ts +9 -2
- package/dist/ui/hooks/useAgentMutations.js +444 -9
- package/dist/ui/hooks/useRunList.d.ts +13 -2
- package/dist/ui/hooks/useRunList.js +26 -11
- package/dist/ui/hooks/useToolList.d.ts +5 -0
- package/dist/ui/hooks/useToolList.js +1 -1
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +2161 -1258
- package/dist/ui/modals/AgentActionsModal.js +13 -13
- package/dist/ui/modals/CreateAgentModal.js +15 -15
- package/dist/ui/modals/index.d.ts +1 -1
- package/dist/ui/modals/index.js +297 -297
- package/dist/ui/renderers/agent-list.markdown.d.ts +5 -0
- package/dist/ui/renderers/agent-list.markdown.js +14 -5
- package/dist/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/ui/renderers/dashboard.markdown.d.ts +5 -0
- package/dist/ui/renderers/dashboard.markdown.js +207 -36
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.js +359 -163
- package/dist/ui/renderers/run-list.markdown.d.ts +5 -0
- package/dist/ui/renderers/run-list.markdown.js +9 -4
- package/dist/ui/renderers/tool-registry.markdown.d.ts +6 -1
- package/dist/ui/renderers/tool-registry.markdown.js +15 -4
- package/dist/ui/views/AgentListView.js +7 -7
- package/dist/ui/views/RunDataTable.d.ts +18 -0
- package/dist/ui/views/RunDataTable.js +327 -0
- package/dist/ui/views/RunListView.js +360 -128
- package/dist/ui/views/ToolRegistryView.js +9 -9
- package/dist/ui/views/index.js +478 -246
- package/dist/ui/views/run-data-table.columns.d.ts +3 -0
- package/dist/ui/views/run-data-table.columns.js +272 -0
- package/dist/ui/views/run-list.shared.d.ts +14 -0
- package/dist/ui/views/run-list.shared.js +178 -0
- package/dist/visualizations/catalog.d.ts +10 -0
- package/dist/visualizations/catalog.js +135 -0
- package/dist/visualizations/index.d.ts +2 -0
- package/dist/visualizations/index.js +188 -0
- package/dist/visualizations/selectors.d.ts +3 -0
- package/dist/visualizations/selectors.js +182 -0
- package/dist/visualizations/selectors.test.d.ts +1 -0
- package/package.json +114 -12
- package/proofs/agent-console-meetup.replay.json +220 -0
- package/src/agent/agent.entity.ts +111 -111
- package/src/agent/agent.enum.ts +12 -12
- package/src/agent/agent.event.ts +91 -91
- package/src/agent/agent.handler.ts +144 -127
- package/src/agent/agent.operation.ts +400 -400
- package/src/agent/agent.presentation.ts +62 -62
- package/src/agent/agent.schema.ts +175 -175
- package/src/agent/agent.test-spec.ts +48 -48
- package/src/agent/index.ts +46 -51
- package/src/agent.capability.ts +11 -11
- package/src/agent.feature.ts +134 -131
- package/src/docs/agent-console.docblock.ts +52 -49
- package/src/example.test.ts +75 -0
- package/src/example.ts +34 -35
- package/src/handlers/agent.handlers.ts +576 -522
- package/src/handlers/index.ts +30 -14
- package/src/handlers/mock-handlers.test.ts +77 -0
- package/src/index.ts +10 -9
- package/src/presentations/index.ts +11 -13
- package/src/proof/index.ts +2 -0
- package/src/proof/meetup-proof.runtime.ts +196 -0
- package/src/proof/meetup-proof.scenario.ts +99 -0
- package/src/proof/meetup-proof.suite.ts +29 -0
- package/src/proof/meetup-proof.test.ts +28 -0
- package/src/proof/meetup-proof.ts +130 -0
- package/src/run/index.ts +49 -54
- package/src/run/run.entity.ts +137 -137
- package/src/run/run.enum.ts +18 -18
- package/src/run/run.event.ts +174 -174
- package/src/run/run.handler.ts +113 -96
- package/src/run/run.operation.ts +474 -474
- package/src/run/run.presentation.ts +42 -42
- package/src/run/run.schema.ts +126 -126
- package/src/run/run.test-spec.ts +48 -48
- package/src/seeders/index.ts +21 -21
- package/src/shared/demo-dashboard-data.ts +58 -0
- package/src/shared/demo-runtime-seed.ts +139 -0
- package/src/shared/demo-runtime.test.ts +169 -0
- package/src/shared/demo-runtime.ts +260 -0
- package/src/shared/index.ts +12 -1
- package/src/shared/mock-agents.ts +76 -76
- package/src/shared/mock-runs.ts +107 -102
- package/src/shared/mock-tools.ts +140 -140
- package/src/shared/overlay-types.ts +23 -23
- package/src/tool/index.ts +39 -44
- package/src/tool/tool.entity.ts +73 -73
- package/src/tool/tool.enum.ts +13 -13
- package/src/tool/tool.event.ts +80 -80
- package/src/tool/tool.handler.ts +124 -107
- package/src/tool/tool.operation.ts +328 -328
- package/src/tool/tool.presentation.ts +43 -43
- package/src/tool/tool.schema.ts +106 -106
- package/src/tool/tool.test-spec.ts +48 -48
- package/src/ui/AgentDashboard.sandbox.test.tsx +312 -0
- package/src/ui/AgentDashboard.tsx +351 -348
- package/src/ui/AgentDashboard.visualizations.tsx +35 -0
- package/src/ui/hooks/index.ts +7 -7
- package/src/ui/hooks/useAgentList.ts +57 -56
- package/src/ui/hooks/useAgentMutations.ts +168 -159
- package/src/ui/hooks/useRunList.ts +90 -57
- package/src/ui/hooks/useToolList.ts +102 -101
- package/src/ui/index.ts +6 -9
- package/src/ui/modals/AgentActionsModal.tsx +262 -262
- package/src/ui/modals/CreateAgentModal.tsx +232 -232
- package/src/ui/modals/index.ts +1 -1
- package/src/ui/overlays/demo-overlays.ts +52 -52
- package/src/ui/renderers/agent-list.markdown.ts +81 -61
- package/src/ui/renderers/agent-list.renderer.tsx +14 -14
- package/src/ui/renderers/dashboard.markdown.ts +135 -139
- package/src/ui/renderers/index.ts +3 -4
- package/src/ui/renderers/run-list.markdown.ts +56 -47
- package/src/ui/renderers/tool-registry.markdown.ts +79 -66
- package/src/ui/views/AgentListView.tsx +90 -90
- package/src/ui/views/RunDataTable.tsx +74 -0
- package/src/ui/views/RunListView.tsx +84 -158
- package/src/ui/views/ToolRegistryView.tsx +113 -113
- package/src/ui/views/run-data-table.columns.tsx +102 -0
- package/src/ui/views/run-list.shared.tsx +139 -0
- package/src/visualizations/catalog.ts +132 -0
- package/src/visualizations/index.ts +2 -0
- package/src/visualizations/selectors.test.ts +12 -0
- package/src/visualizations/selectors.ts +70 -0
- package/tsconfig.json +7 -8
- package/tsdown.config.js +24 -3
|
@@ -1,4 +1,136 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
// src/agent/agent.enum.ts
|
|
3
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
4
|
+
var AgentStatusEnum = defineEnum("AgentStatus", [
|
|
5
|
+
"DRAFT",
|
|
6
|
+
"ACTIVE",
|
|
7
|
+
"PAUSED",
|
|
8
|
+
"ARCHIVED"
|
|
9
|
+
]);
|
|
10
|
+
var ModelProviderEnum = defineEnum("ModelProvider", [
|
|
11
|
+
"OPENAI",
|
|
12
|
+
"ANTHROPIC",
|
|
13
|
+
"GOOGLE",
|
|
14
|
+
"MISTRAL",
|
|
15
|
+
"CUSTOM"
|
|
16
|
+
]);
|
|
17
|
+
var ToolChoiceEnum = defineEnum("ToolChoice", [
|
|
18
|
+
"auto",
|
|
19
|
+
"required",
|
|
20
|
+
"none"
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
// src/agent/agent.event.ts
|
|
24
|
+
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
25
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
26
|
+
var OWNERS = ["@agent-console-team"];
|
|
27
|
+
var AgentCreatedPayload = defineSchemaModel({
|
|
28
|
+
name: "AgentCreatedPayload",
|
|
29
|
+
description: "Payload for agent created event",
|
|
30
|
+
fields: {
|
|
31
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
32
|
+
organizationId: {
|
|
33
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
34
|
+
isOptional: false
|
|
35
|
+
},
|
|
36
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
modelProvider: {
|
|
39
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
40
|
+
isOptional: false
|
|
41
|
+
},
|
|
42
|
+
modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
+
toolCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
44
|
+
createdById: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
45
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var AgentCreatedEvent = defineEvent({
|
|
49
|
+
meta: {
|
|
50
|
+
key: "agent-console.agent.created",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
description: "A new AI agent was configured.",
|
|
53
|
+
stability: "stable",
|
|
54
|
+
owners: [...OWNERS],
|
|
55
|
+
tags: ["agent", "created"]
|
|
56
|
+
},
|
|
57
|
+
payload: AgentCreatedPayload
|
|
58
|
+
});
|
|
59
|
+
var AgentUpdatedPayload = defineSchemaModel({
|
|
60
|
+
name: "AgentUpdatedPayload",
|
|
61
|
+
description: "Payload for agent updated event",
|
|
62
|
+
fields: {
|
|
63
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
64
|
+
organizationId: {
|
|
65
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
66
|
+
isOptional: false
|
|
67
|
+
},
|
|
68
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
69
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
70
|
+
updatedFields: {
|
|
71
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
72
|
+
isArray: true,
|
|
73
|
+
isOptional: false
|
|
74
|
+
},
|
|
75
|
+
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
var AgentUpdatedEvent = defineEvent({
|
|
79
|
+
meta: {
|
|
80
|
+
key: "agent-console.agent.updated",
|
|
81
|
+
version: "1.0.0",
|
|
82
|
+
description: "An AI agent configuration was updated.",
|
|
83
|
+
stability: "stable",
|
|
84
|
+
owners: [...OWNERS],
|
|
85
|
+
tags: ["agent", "updated"]
|
|
86
|
+
},
|
|
87
|
+
payload: AgentUpdatedPayload
|
|
88
|
+
});
|
|
89
|
+
var AgentToolAssignedPayload = defineSchemaModel({
|
|
90
|
+
name: "AgentToolAssignedPayload",
|
|
91
|
+
description: "Payload for agent tool assigned event",
|
|
92
|
+
fields: {
|
|
93
|
+
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
+
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
+
agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
96
|
+
toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
97
|
+
assignedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
var AgentToolAssignedEvent = defineEvent({
|
|
101
|
+
meta: {
|
|
102
|
+
key: "agent-console.agent.toolAssigned",
|
|
103
|
+
version: "1.0.0",
|
|
104
|
+
description: "A tool was assigned to an agent.",
|
|
105
|
+
stability: "stable",
|
|
106
|
+
owners: [...OWNERS],
|
|
107
|
+
tags: ["agent", "tool", "assigned"]
|
|
108
|
+
},
|
|
109
|
+
payload: AgentToolAssignedPayload
|
|
110
|
+
});
|
|
111
|
+
var AgentToolRemovedPayload = defineSchemaModel({
|
|
112
|
+
name: "AgentToolRemovedPayload",
|
|
113
|
+
description: "Payload for agent tool removed event",
|
|
114
|
+
fields: {
|
|
115
|
+
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
116
|
+
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
117
|
+
agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
118
|
+
toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
119
|
+
removedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var AgentToolRemovedEvent = defineEvent({
|
|
123
|
+
meta: {
|
|
124
|
+
key: "agent-console.agent.toolRemoved",
|
|
125
|
+
version: "1.0.0",
|
|
126
|
+
description: "A tool was removed from an agent.",
|
|
127
|
+
stability: "stable",
|
|
128
|
+
owners: [...OWNERS],
|
|
129
|
+
tags: ["agent", "tool", "removed"]
|
|
130
|
+
},
|
|
131
|
+
payload: AgentToolRemovedPayload
|
|
132
|
+
});
|
|
133
|
+
|
|
2
134
|
// src/shared/mock-agents.ts
|
|
3
135
|
var MOCK_AGENTS = [
|
|
4
136
|
{
|
|
@@ -223,7 +355,604 @@ var MOCK_TOOLS = [
|
|
|
223
355
|
}
|
|
224
356
|
];
|
|
225
357
|
|
|
358
|
+
// src/agent/agent.schema.ts
|
|
359
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
360
|
+
var AgentModel = defineSchemaModel2({
|
|
361
|
+
name: "Agent",
|
|
362
|
+
description: "AI agent configuration",
|
|
363
|
+
fields: {
|
|
364
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
365
|
+
organizationId: {
|
|
366
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
367
|
+
isOptional: false
|
|
368
|
+
},
|
|
369
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
370
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
371
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
372
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
373
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
374
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
375
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
376
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
377
|
+
userPromptTemplate: {
|
|
378
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
379
|
+
isOptional: true
|
|
380
|
+
},
|
|
381
|
+
toolIds: {
|
|
382
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
383
|
+
isArray: true,
|
|
384
|
+
isOptional: true
|
|
385
|
+
},
|
|
386
|
+
toolChoice: {
|
|
387
|
+
type: ToolChoiceEnum,
|
|
388
|
+
isOptional: false,
|
|
389
|
+
defaultValue: "auto"
|
|
390
|
+
},
|
|
391
|
+
maxIterations: {
|
|
392
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
393
|
+
isOptional: false,
|
|
394
|
+
defaultValue: 10
|
|
395
|
+
},
|
|
396
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
397
|
+
timeoutMs: {
|
|
398
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
399
|
+
isOptional: false,
|
|
400
|
+
defaultValue: 120000
|
|
401
|
+
},
|
|
402
|
+
version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
403
|
+
tags: {
|
|
404
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
405
|
+
isArray: true,
|
|
406
|
+
isOptional: true
|
|
407
|
+
},
|
|
408
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
409
|
+
updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
var AgentSummaryModel = defineSchemaModel2({
|
|
413
|
+
name: "AgentSummary",
|
|
414
|
+
description: "Summary of an agent for list views",
|
|
415
|
+
fields: {
|
|
416
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
417
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
418
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
419
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
420
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
421
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
422
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
423
|
+
version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
424
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
var AgentToolRefModel = defineSchemaModel2({
|
|
428
|
+
name: "AgentToolRef",
|
|
429
|
+
description: "Tool reference in agent context",
|
|
430
|
+
fields: {
|
|
431
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
432
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
433
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
434
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
435
|
+
category: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
var AgentWithToolsModel = defineSchemaModel2({
|
|
439
|
+
name: "AgentWithTools",
|
|
440
|
+
description: "Agent with associated tools",
|
|
441
|
+
fields: {
|
|
442
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
443
|
+
organizationId: {
|
|
444
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
445
|
+
isOptional: false
|
|
446
|
+
},
|
|
447
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
448
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
449
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
450
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
451
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
452
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
453
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
454
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
455
|
+
userPromptTemplate: {
|
|
456
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
457
|
+
isOptional: true
|
|
458
|
+
},
|
|
459
|
+
toolIds: {
|
|
460
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
461
|
+
isArray: true,
|
|
462
|
+
isOptional: true
|
|
463
|
+
},
|
|
464
|
+
toolChoice: { type: ToolChoiceEnum, isOptional: false },
|
|
465
|
+
maxIterations: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
466
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
467
|
+
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
468
|
+
version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
469
|
+
tags: {
|
|
470
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
471
|
+
isArray: true,
|
|
472
|
+
isOptional: true
|
|
473
|
+
},
|
|
474
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
475
|
+
updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
476
|
+
tools: { type: AgentToolRefModel, isArray: true, isOptional: true }
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
var CreateAgentInputModel = defineSchemaModel2({
|
|
480
|
+
name: "CreateAgentInput",
|
|
481
|
+
description: "Input for creating an agent",
|
|
482
|
+
fields: {
|
|
483
|
+
organizationId: {
|
|
484
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
485
|
+
isOptional: false
|
|
486
|
+
},
|
|
487
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
488
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
489
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
490
|
+
modelProvider: { type: ModelProviderEnum, isOptional: false },
|
|
491
|
+
modelName: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
492
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
493
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
494
|
+
userPromptTemplate: {
|
|
495
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
496
|
+
isOptional: true
|
|
497
|
+
},
|
|
498
|
+
toolIds: {
|
|
499
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
500
|
+
isArray: true,
|
|
501
|
+
isOptional: true
|
|
502
|
+
},
|
|
503
|
+
toolChoice: { type: ToolChoiceEnum, isOptional: true },
|
|
504
|
+
maxIterations: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
505
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
506
|
+
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
507
|
+
tags: {
|
|
508
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
509
|
+
isArray: true,
|
|
510
|
+
isOptional: true
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
var UpdateAgentInputModel = defineSchemaModel2({
|
|
515
|
+
name: "UpdateAgentInput",
|
|
516
|
+
description: "Input for updating an agent",
|
|
517
|
+
fields: {
|
|
518
|
+
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
519
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: true },
|
|
520
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
521
|
+
status: { type: AgentStatusEnum, isOptional: true },
|
|
522
|
+
modelConfig: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
523
|
+
systemPrompt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
524
|
+
userPromptTemplate: {
|
|
525
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
526
|
+
isOptional: true
|
|
527
|
+
},
|
|
528
|
+
toolIds: {
|
|
529
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
530
|
+
isArray: true,
|
|
531
|
+
isOptional: true
|
|
532
|
+
},
|
|
533
|
+
toolChoice: { type: ToolChoiceEnum, isOptional: true },
|
|
534
|
+
maxIterations: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
535
|
+
maxTokensPerRun: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
536
|
+
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
537
|
+
tags: {
|
|
538
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
539
|
+
isArray: true,
|
|
540
|
+
isOptional: true
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
// src/agent/agent.operation.ts
|
|
546
|
+
import {
|
|
547
|
+
defineCommand,
|
|
548
|
+
defineQuery
|
|
549
|
+
} from "@contractspec/lib.contracts-spec/operations";
|
|
550
|
+
import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
|
|
551
|
+
var OWNERS2 = ["@agent-console-team"];
|
|
552
|
+
var CreateAgentCommand = defineCommand({
|
|
553
|
+
meta: {
|
|
554
|
+
key: "agent-console.agent.create",
|
|
555
|
+
version: "1.0.0",
|
|
556
|
+
stability: "stable",
|
|
557
|
+
owners: [...OWNERS2],
|
|
558
|
+
tags: ["agent", "create"],
|
|
559
|
+
description: "Creates a new AI agent configuration.",
|
|
560
|
+
goal: "Allow users to define new AI agents with specific models and tools.",
|
|
561
|
+
context: "Called from the agent builder UI when creating a new agent."
|
|
562
|
+
},
|
|
563
|
+
io: {
|
|
564
|
+
input: CreateAgentInputModel,
|
|
565
|
+
output: defineSchemaModel3({
|
|
566
|
+
name: "CreateAgentOutput",
|
|
567
|
+
fields: {
|
|
568
|
+
id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
569
|
+
name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
|
|
570
|
+
slug: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
571
|
+
status: { type: AgentStatusEnum, isOptional: false }
|
|
572
|
+
}
|
|
573
|
+
}),
|
|
574
|
+
errors: {
|
|
575
|
+
SLUG_EXISTS: {
|
|
576
|
+
description: "An agent with this slug already exists in the organization",
|
|
577
|
+
http: 409,
|
|
578
|
+
gqlCode: "SLUG_EXISTS",
|
|
579
|
+
when: "Slug is already taken"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
policy: { auth: "user" },
|
|
584
|
+
sideEffects: {
|
|
585
|
+
emits: [
|
|
586
|
+
{
|
|
587
|
+
ref: AgentCreatedEvent.meta,
|
|
588
|
+
when: "Agent is successfully created"
|
|
589
|
+
}
|
|
590
|
+
],
|
|
591
|
+
audit: ["agent-console.agent.created"]
|
|
592
|
+
},
|
|
593
|
+
acceptance: {
|
|
594
|
+
scenarios: [
|
|
595
|
+
{
|
|
596
|
+
key: "create-agent-happy-path",
|
|
597
|
+
given: ["User is authenticated", "Organization exists"],
|
|
598
|
+
when: ["User submits valid agent configuration"],
|
|
599
|
+
then: [
|
|
600
|
+
"New agent is created with DRAFT status",
|
|
601
|
+
"AgentCreated event is emitted"
|
|
602
|
+
]
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
key: "create-agent-slug-conflict",
|
|
606
|
+
given: ["User is authenticated", "Agent with same slug exists"],
|
|
607
|
+
when: ["User submits agent with duplicate slug"],
|
|
608
|
+
then: ["SLUG_EXISTS error is returned with 409 status"]
|
|
609
|
+
}
|
|
610
|
+
],
|
|
611
|
+
examples: [
|
|
612
|
+
{
|
|
613
|
+
key: "basic-create",
|
|
614
|
+
input: {
|
|
615
|
+
name: "Support Assistant",
|
|
616
|
+
slug: "support-assistant",
|
|
617
|
+
modelProvider: "openai",
|
|
618
|
+
modelId: "gpt-4"
|
|
619
|
+
},
|
|
620
|
+
output: {
|
|
621
|
+
id: "agent-123",
|
|
622
|
+
name: "Support Assistant",
|
|
623
|
+
slug: "support-assistant",
|
|
624
|
+
status: "draft"
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
]
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
var UpdateAgentCommand = defineCommand({
|
|
631
|
+
meta: {
|
|
632
|
+
key: "agent-console.agent.update",
|
|
633
|
+
version: "1.0.0",
|
|
634
|
+
stability: "stable",
|
|
635
|
+
owners: [...OWNERS2],
|
|
636
|
+
tags: ["agent", "update"],
|
|
637
|
+
description: "Updates an existing AI agent configuration.",
|
|
638
|
+
goal: "Allow users to modify agent settings and configuration.",
|
|
639
|
+
context: "Called from the agent settings UI."
|
|
640
|
+
},
|
|
641
|
+
io: {
|
|
642
|
+
input: UpdateAgentInputModel,
|
|
643
|
+
output: defineSchemaModel3({
|
|
644
|
+
name: "UpdateAgentOutput",
|
|
645
|
+
fields: {
|
|
646
|
+
id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
647
|
+
name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
|
|
648
|
+
status: { type: AgentStatusEnum, isOptional: false },
|
|
649
|
+
updatedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
650
|
+
}
|
|
651
|
+
}),
|
|
652
|
+
errors: {
|
|
653
|
+
AGENT_NOT_FOUND: {
|
|
654
|
+
description: "The specified agent does not exist",
|
|
655
|
+
http: 404,
|
|
656
|
+
gqlCode: "AGENT_NOT_FOUND",
|
|
657
|
+
when: "Agent ID is invalid"
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
policy: { auth: "user" },
|
|
662
|
+
sideEffects: {
|
|
663
|
+
emits: [
|
|
664
|
+
{
|
|
665
|
+
key: "agent.updated",
|
|
666
|
+
version: "1.0.0",
|
|
667
|
+
stability: "stable",
|
|
668
|
+
owners: [...OWNERS2],
|
|
669
|
+
tags: ["agent", "updated"],
|
|
670
|
+
when: "Agent is updated",
|
|
671
|
+
payload: AgentSummaryModel
|
|
672
|
+
}
|
|
673
|
+
],
|
|
674
|
+
audit: ["agent.updated"]
|
|
675
|
+
},
|
|
676
|
+
acceptance: {
|
|
677
|
+
scenarios: [
|
|
678
|
+
{
|
|
679
|
+
key: "update-agent-happy-path",
|
|
680
|
+
given: ["Agent exists", "User owns the agent"],
|
|
681
|
+
when: ["User submits updated configuration"],
|
|
682
|
+
then: ["Agent is updated", "AgentUpdated event is emitted"]
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
key: "update-agent-not-found",
|
|
686
|
+
given: ["Agent does not exist"],
|
|
687
|
+
when: ["User attempts to update"],
|
|
688
|
+
then: ["AGENT_NOT_FOUND error is returned"]
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
examples: [
|
|
692
|
+
{
|
|
693
|
+
key: "update-name",
|
|
694
|
+
input: {
|
|
695
|
+
agentId: "agent-123",
|
|
696
|
+
name: "Updated Assistant",
|
|
697
|
+
systemPrompt: "You are a helpful assistant."
|
|
698
|
+
},
|
|
699
|
+
output: {
|
|
700
|
+
id: "agent-123",
|
|
701
|
+
name: "Updated Assistant",
|
|
702
|
+
status: "draft",
|
|
703
|
+
updatedAt: "2025-01-01T00:00:00Z"
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
]
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
var GetAgentQuery = defineQuery({
|
|
710
|
+
meta: {
|
|
711
|
+
key: "agent-console.agent.get",
|
|
712
|
+
version: "1.0.0",
|
|
713
|
+
stability: "stable",
|
|
714
|
+
owners: [...OWNERS2],
|
|
715
|
+
tags: ["agent", "get"],
|
|
716
|
+
description: "Retrieves an agent by its ID.",
|
|
717
|
+
goal: "View detailed agent configuration.",
|
|
718
|
+
context: "Called when viewing agent details or editing."
|
|
719
|
+
},
|
|
720
|
+
io: {
|
|
721
|
+
input: defineSchemaModel3({
|
|
722
|
+
name: "GetAgentInput",
|
|
723
|
+
fields: {
|
|
724
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
725
|
+
includeTools: { type: ScalarTypeEnum3.Boolean(), isOptional: true }
|
|
726
|
+
}
|
|
727
|
+
}),
|
|
728
|
+
output: AgentWithToolsModel,
|
|
729
|
+
errors: {
|
|
730
|
+
AGENT_NOT_FOUND: {
|
|
731
|
+
description: "The specified agent does not exist",
|
|
732
|
+
http: 404,
|
|
733
|
+
gqlCode: "AGENT_NOT_FOUND",
|
|
734
|
+
when: "Agent ID is invalid"
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
policy: { auth: "user" },
|
|
739
|
+
acceptance: {
|
|
740
|
+
scenarios: [
|
|
741
|
+
{
|
|
742
|
+
key: "get-agent-happy-path",
|
|
743
|
+
given: ["Agent exists"],
|
|
744
|
+
when: ["User requests agent by ID"],
|
|
745
|
+
then: ["Agent details are returned"]
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
key: "get-agent-with-tools",
|
|
749
|
+
given: ["Agent exists with assigned tools"],
|
|
750
|
+
when: ["User requests agent with includeTools=true"],
|
|
751
|
+
then: ["Agent details with tools list are returned"]
|
|
752
|
+
}
|
|
753
|
+
],
|
|
754
|
+
examples: [
|
|
755
|
+
{
|
|
756
|
+
key: "get-basic",
|
|
757
|
+
input: { agentId: "agent-123", includeTools: false },
|
|
758
|
+
output: {
|
|
759
|
+
id: "agent-123",
|
|
760
|
+
name: "Support Assistant",
|
|
761
|
+
status: "active",
|
|
762
|
+
tools: []
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
]
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
var ListAgentsQuery = defineQuery({
|
|
769
|
+
meta: {
|
|
770
|
+
key: "agent-console.agent.list",
|
|
771
|
+
version: "1.0.0",
|
|
772
|
+
stability: "stable",
|
|
773
|
+
owners: [...OWNERS2],
|
|
774
|
+
tags: ["agent", "list"],
|
|
775
|
+
description: "Lists agents for an organization with optional filtering.",
|
|
776
|
+
goal: "Browse and search available agents.",
|
|
777
|
+
context: "Agent list/dashboard view."
|
|
778
|
+
},
|
|
779
|
+
io: {
|
|
780
|
+
input: defineSchemaModel3({
|
|
781
|
+
name: "ListAgentsInput",
|
|
782
|
+
fields: {
|
|
783
|
+
organizationId: {
|
|
784
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
785
|
+
isOptional: false
|
|
786
|
+
},
|
|
787
|
+
status: { type: AgentStatusEnum, isOptional: true },
|
|
788
|
+
modelProvider: { type: ModelProviderEnum, isOptional: true },
|
|
789
|
+
search: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
790
|
+
limit: {
|
|
791
|
+
type: ScalarTypeEnum3.Int_unsecure(),
|
|
792
|
+
isOptional: true,
|
|
793
|
+
defaultValue: 20
|
|
794
|
+
},
|
|
795
|
+
offset: {
|
|
796
|
+
type: ScalarTypeEnum3.Int_unsecure(),
|
|
797
|
+
isOptional: true,
|
|
798
|
+
defaultValue: 0
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}),
|
|
802
|
+
output: defineSchemaModel3({
|
|
803
|
+
name: "ListAgentsOutput",
|
|
804
|
+
fields: {
|
|
805
|
+
items: { type: AgentSummaryModel, isArray: true, isOptional: false },
|
|
806
|
+
total: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
807
|
+
hasMore: { type: ScalarTypeEnum3.Boolean(), isOptional: false }
|
|
808
|
+
}
|
|
809
|
+
})
|
|
810
|
+
},
|
|
811
|
+
policy: { auth: "user" },
|
|
812
|
+
acceptance: {
|
|
813
|
+
scenarios: [
|
|
814
|
+
{
|
|
815
|
+
key: "list-agents-happy-path",
|
|
816
|
+
given: ["Organization has agents"],
|
|
817
|
+
when: ["User lists agents"],
|
|
818
|
+
then: ["Paginated list of agents is returned"]
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
key: "list-agents-filter-by-status",
|
|
822
|
+
given: ["Organization has agents with mixed statuses"],
|
|
823
|
+
when: ["User filters by status=active"],
|
|
824
|
+
then: ["Only active agents are returned"]
|
|
825
|
+
}
|
|
826
|
+
],
|
|
827
|
+
examples: [
|
|
828
|
+
{
|
|
829
|
+
key: "list-basic",
|
|
830
|
+
input: { organizationId: "org-123", limit: 10, offset: 0 },
|
|
831
|
+
output: { items: [], total: 0, hasMore: false }
|
|
832
|
+
}
|
|
833
|
+
]
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
var AssignToolToAgentCommand = defineCommand({
|
|
837
|
+
meta: {
|
|
838
|
+
key: "agent-console.agent.assignTool",
|
|
839
|
+
version: "1.0.0",
|
|
840
|
+
stability: "stable",
|
|
841
|
+
owners: [...OWNERS2],
|
|
842
|
+
tags: ["agent", "tool", "assign"],
|
|
843
|
+
description: "Assigns a tool to an agent with optional configuration.",
|
|
844
|
+
goal: "Enable agents to use specific tools.",
|
|
845
|
+
context: "Agent configuration UI - tool selection."
|
|
846
|
+
},
|
|
847
|
+
io: {
|
|
848
|
+
input: defineSchemaModel3({
|
|
849
|
+
name: "AssignToolToAgentInput",
|
|
850
|
+
fields: {
|
|
851
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
852
|
+
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
853
|
+
config: { type: ScalarTypeEnum3.JSONObject(), isOptional: true },
|
|
854
|
+
order: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: true }
|
|
855
|
+
}
|
|
856
|
+
}),
|
|
857
|
+
output: defineSchemaModel3({
|
|
858
|
+
name: "AssignToolToAgentOutput",
|
|
859
|
+
fields: {
|
|
860
|
+
agentToolId: {
|
|
861
|
+
type: ScalarTypeEnum3.String_unsecure(),
|
|
862
|
+
isOptional: false
|
|
863
|
+
},
|
|
864
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
865
|
+
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
|
|
866
|
+
}
|
|
867
|
+
}),
|
|
868
|
+
errors: {
|
|
869
|
+
TOOL_ALREADY_ASSIGNED: {
|
|
870
|
+
description: "This tool is already assigned to the agent",
|
|
871
|
+
http: 409,
|
|
872
|
+
gqlCode: "TOOL_ALREADY_ASSIGNED",
|
|
873
|
+
when: "Tool assignment already exists"
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
policy: { auth: "user" },
|
|
878
|
+
sideEffects: { audit: ["agent.tool.assigned"] },
|
|
879
|
+
acceptance: {
|
|
880
|
+
scenarios: [
|
|
881
|
+
{
|
|
882
|
+
key: "assign-tool-happy-path",
|
|
883
|
+
given: ["Agent exists", "Tool exists and is not assigned"],
|
|
884
|
+
when: ["User assigns tool to agent"],
|
|
885
|
+
then: ["Tool is assigned", "Assignment ID is returned"]
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
key: "assign-tool-already-assigned",
|
|
889
|
+
given: ["Tool is already assigned to agent"],
|
|
890
|
+
when: ["User attempts to assign again"],
|
|
891
|
+
then: ["TOOL_ALREADY_ASSIGNED error is returned"]
|
|
892
|
+
}
|
|
893
|
+
],
|
|
894
|
+
examples: [
|
|
895
|
+
{
|
|
896
|
+
key: "assign-basic",
|
|
897
|
+
input: { agentId: "agent-123", toolId: "tool-456" },
|
|
898
|
+
output: {
|
|
899
|
+
agentToolId: "at-789",
|
|
900
|
+
agentId: "agent-123",
|
|
901
|
+
toolId: "tool-456"
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
var RemoveToolFromAgentCommand = defineCommand({
|
|
908
|
+
meta: {
|
|
909
|
+
key: "agent-console.agent.removeTool",
|
|
910
|
+
version: "1.0.0",
|
|
911
|
+
stability: "stable",
|
|
912
|
+
owners: [...OWNERS2],
|
|
913
|
+
tags: ["agent", "tool", "remove"],
|
|
914
|
+
description: "Removes a tool assignment from an agent.",
|
|
915
|
+
goal: "Disable specific tools for an agent.",
|
|
916
|
+
context: "Agent configuration UI - tool management."
|
|
917
|
+
},
|
|
918
|
+
io: {
|
|
919
|
+
input: defineSchemaModel3({
|
|
920
|
+
name: "RemoveToolFromAgentInput",
|
|
921
|
+
fields: {
|
|
922
|
+
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
923
|
+
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
|
|
924
|
+
}
|
|
925
|
+
}),
|
|
926
|
+
output: defineSchemaModel3({
|
|
927
|
+
name: "RemoveToolFromAgentOutput",
|
|
928
|
+
fields: {
|
|
929
|
+
success: { type: ScalarTypeEnum3.Boolean(), isOptional: false }
|
|
930
|
+
}
|
|
931
|
+
})
|
|
932
|
+
},
|
|
933
|
+
policy: { auth: "user" },
|
|
934
|
+
sideEffects: { audit: ["agent.tool.removed"] },
|
|
935
|
+
acceptance: {
|
|
936
|
+
scenarios: [
|
|
937
|
+
{
|
|
938
|
+
key: "remove-tool-happy-path",
|
|
939
|
+
given: ["Agent exists", "Tool is assigned to agent"],
|
|
940
|
+
when: ["User removes tool from agent"],
|
|
941
|
+
then: ["Tool is unassigned", "Success is returned"]
|
|
942
|
+
}
|
|
943
|
+
],
|
|
944
|
+
examples: [
|
|
945
|
+
{
|
|
946
|
+
key: "remove-basic",
|
|
947
|
+
input: { agentId: "agent-123", toolId: "tool-456" },
|
|
948
|
+
output: { success: true }
|
|
949
|
+
}
|
|
950
|
+
]
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
|
|
226
954
|
// src/agent/agent.handler.ts
|
|
955
|
+
var nextMockAgentId = MOCK_AGENTS.length + 1;
|
|
227
956
|
async function mockListAgentsHandler(input) {
|
|
228
957
|
const {
|
|
229
958
|
organizationId,
|
|
@@ -277,7 +1006,7 @@ async function mockCreateAgentHandler(input) {
|
|
|
277
1006
|
if (exists)
|
|
278
1007
|
throw new Error("SLUG_EXISTS");
|
|
279
1008
|
return {
|
|
280
|
-
id: `agent-${
|
|
1009
|
+
id: `agent-${nextMockAgentId++}`,
|
|
281
1010
|
name: input.name,
|
|
282
1011
|
slug: input.slug,
|
|
283
1012
|
status: "DRAFT"
|