@contractspec/example.agent-console 1.44.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$colon$bundle.log +133 -0
- package/.turbo/turbo-build.log +134 -0
- package/CHANGELOG.md +212 -0
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/agent/agent.entity.d.ts +55 -0
- package/dist/agent/agent.entity.d.ts.map +1 -0
- package/dist/agent/agent.entity.js +136 -0
- package/dist/agent/agent.entity.js.map +1 -0
- package/dist/agent/agent.enum.d.ts +18 -0
- package/dist/agent/agent.enum.d.ts.map +1 -0
- package/dist/agent/agent.enum.js +34 -0
- package/dist/agent/agent.enum.js.map +1 -0
- package/dist/agent/agent.event.d.ts +128 -0
- package/dist/agent/agent.event.d.ts.map +1 -0
- package/dist/agent/agent.event.js +210 -0
- package/dist/agent/agent.event.js.map +1 -0
- package/dist/agent/agent.handler.d.ts +100 -0
- package/dist/agent/agent.handler.d.ts.map +1 -0
- package/dist/agent/agent.handler.js +84 -0
- package/dist/agent/agent.handler.js.map +1 -0
- package/dist/agent/agent.operation.d.ts +471 -0
- package/dist/agent/agent.operation.d.ts.map +1 -0
- package/dist/agent/agent.operation.js +486 -0
- package/dist/agent/agent.operation.js.map +1 -0
- package/dist/agent/agent.presentation.d.ts +19 -0
- package/dist/agent/agent.presentation.d.ts.map +1 -0
- package/dist/agent/agent.presentation.js +89 -0
- package/dist/agent/agent.presentation.js.map +1 -0
- package/dist/agent/agent.schema.d.ts +401 -0
- package/dist/agent/agent.schema.d.ts.map +1 -0
- package/dist/agent/agent.schema.js +406 -0
- package/dist/agent/agent.schema.js.map +1 -0
- package/dist/agent/index.d.ts +8 -0
- package/dist/agent/index.js +9 -0
- package/dist/agent.feature.d.ts +12 -0
- package/dist/agent.feature.d.ts.map +1 -0
- package/dist/agent.feature.js +303 -0
- package/dist/agent.feature.js.map +1 -0
- package/dist/docs/agent-console.docblock.d.ts +1 -0
- package/dist/docs/agent-console.docblock.js +113 -0
- package/dist/docs/agent-console.docblock.js.map +1 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/example.d.ts +40 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +51 -0
- package/dist/example.js.map +1 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.js +5 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +32 -0
- package/dist/presentations/index.d.ts +4 -0
- package/dist/presentations/index.js +5 -0
- package/dist/run/index.d.ts +8 -0
- package/dist/run/index.js +9 -0
- package/dist/run/run.entity.d.ts +82 -0
- package/dist/run/run.entity.d.ts.map +1 -0
- package/dist/run/run.entity.js +205 -0
- package/dist/run/run.entity.js.map +1 -0
- package/dist/run/run.enum.d.ts +22 -0
- package/dist/run/run.enum.d.ts.map +1 -0
- package/dist/run/run.enum.js +45 -0
- package/dist/run/run.enum.js.map +1 -0
- package/dist/run/run.event.d.ts +290 -0
- package/dist/run/run.event.d.ts.map +1 -0
- package/dist/run/run.event.js +434 -0
- package/dist/run/run.event.js.map +1 -0
- package/dist/run/run.handler.d.ts +203 -0
- package/dist/run/run.handler.d.ts.map +1 -0
- package/dist/run/run.handler.js +83 -0
- package/dist/run/run.handler.js.map +1 -0
- package/dist/run/run.operation.d.ts +720 -0
- package/dist/run/run.operation.d.ts.map +1 -0
- package/dist/run/run.operation.js +626 -0
- package/dist/run/run.operation.js.map +1 -0
- package/dist/run/run.presentation.d.ts +15 -0
- package/dist/run/run.presentation.d.ts.map +1 -0
- package/dist/run/run.presentation.js +65 -0
- package/dist/run/run.presentation.js.map +1 -0
- package/dist/run/run.schema.d.ts +416 -0
- package/dist/run/run.schema.d.ts.map +1 -0
- package/dist/run/run.schema.js +338 -0
- package/dist/run/run.schema.js.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/mock-agents.d.ts +88 -0
- package/dist/shared/mock-agents.d.ts.map +1 -0
- package/dist/shared/mock-agents.js +94 -0
- package/dist/shared/mock-agents.js.map +1 -0
- package/dist/shared/mock-runs.d.ts +120 -0
- package/dist/shared/mock-runs.d.ts.map +1 -0
- package/dist/shared/mock-runs.js +118 -0
- package/dist/shared/mock-runs.js.map +1 -0
- package/dist/shared/mock-tools.d.ts +244 -0
- package/dist/shared/mock-tools.d.ts.map +1 -0
- package/dist/shared/mock-tools.js +181 -0
- package/dist/shared/mock-tools.js.map +1 -0
- package/dist/tool/index.d.ts +8 -0
- package/dist/tool/index.js +9 -0
- package/dist/tool/tool.entity.d.ts +42 -0
- package/dist/tool/tool.entity.d.ts.map +1 -0
- package/dist/tool/tool.entity.js +105 -0
- package/dist/tool/tool.entity.js.map +1 -0
- package/dist/tool/tool.enum.d.ts +18 -0
- package/dist/tool/tool.enum.d.ts.map +1 -0
- package/dist/tool/tool.enum.js +35 -0
- package/dist/tool/tool.enum.js.map +1 -0
- package/dist/tool/tool.event.d.ts +103 -0
- package/dist/tool/tool.event.d.ts.map +1 -0
- package/dist/tool/tool.event.js +159 -0
- package/dist/tool/tool.event.js.map +1 -0
- package/dist/tool/tool.handler.d.ts +315 -0
- package/dist/tool/tool.handler.d.ts.map +1 -0
- package/dist/tool/tool.handler.js +87 -0
- package/dist/tool/tool.handler.js.map +1 -0
- package/dist/tool/tool.operation.d.ts +411 -0
- package/dist/tool/tool.operation.d.ts.map +1 -0
- package/dist/tool/tool.operation.js +406 -0
- package/dist/tool/tool.operation.js.map +1 -0
- package/dist/tool/tool.presentation.d.ts +15 -0
- package/dist/tool/tool.presentation.d.ts.map +1 -0
- package/dist/tool/tool.presentation.js +65 -0
- package/dist/tool/tool.presentation.js.map +1 -0
- package/dist/tool/tool.schema.d.ts +218 -0
- package/dist/tool/tool.schema.d.ts.map +1 -0
- package/dist/tool/tool.schema.js +236 -0
- package/dist/tool/tool.schema.js.map +1 -0
- package/example.ts +1 -0
- package/package.json +123 -0
- package/src/agent/agent.entity.ts +137 -0
- package/src/agent/agent.enum.ts +31 -0
- package/src/agent/agent.event.ts +142 -0
- package/src/agent/agent.handler.ts +178 -0
- package/src/agent/agent.operation.ts +444 -0
- package/src/agent/agent.presentation.ts +81 -0
- package/src/agent/agent.schema.ts +214 -0
- package/src/agent/index.ts +67 -0
- package/src/agent.feature.ts +146 -0
- package/src/docs/agent-console.docblock.ts +97 -0
- package/src/docs/index.ts +1 -0
- package/src/example.ts +34 -0
- package/src/handlers/index.ts +27 -0
- package/src/index.ts +27 -0
- package/src/presentations/index.ts +26 -0
- package/src/run/index.ts +68 -0
- package/src/run/run.entity.ts +175 -0
- package/src/run/run.enum.ts +43 -0
- package/src/run/run.event.ts +264 -0
- package/src/run/run.handler.ts +138 -0
- package/src/run/run.operation.ts +524 -0
- package/src/run/run.presentation.ts +55 -0
- package/src/run/run.schema.ts +169 -0
- package/src/shared/index.ts +6 -0
- package/src/shared/mock-agents.ts +81 -0
- package/src/shared/mock-runs.ts +107 -0
- package/src/shared/mock-tools.ts +145 -0
- package/src/tool/index.ts +60 -0
- package/src/tool/tool.entity.ts +99 -0
- package/src/tool/tool.enum.ts +32 -0
- package/src/tool/tool.event.ts +119 -0
- package/src/tool/tool.handler.ts +154 -0
- package/src/tool/tool.operation.ts +366 -0
- package/src/tool/tool.presentation.ts +56 -0
- package/src/tool/tool.schema.ts +133 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +7 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { ToolCategoryEnum, ToolStatusEnum } from "./tool.enum.js";
|
|
2
|
+
import { CreateToolInputModel, ToolModel, ToolSummaryModel, UpdateToolInputModel } from "./tool.schema.js";
|
|
3
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
4
|
+
import { defineCommand, defineQuery } from "@contractspec/lib.contracts/operations";
|
|
5
|
+
|
|
6
|
+
//#region src/tool/tool.operation.ts
|
|
7
|
+
const OWNERS = ["@agent-console-team"];
|
|
8
|
+
/**
|
|
9
|
+
* CreateToolCommand - Creates a new tool definition.
|
|
10
|
+
*/
|
|
11
|
+
const CreateToolCommand = defineCommand({
|
|
12
|
+
meta: {
|
|
13
|
+
key: "agent.tool.create",
|
|
14
|
+
version: 1,
|
|
15
|
+
stability: "stable",
|
|
16
|
+
owners: [...OWNERS],
|
|
17
|
+
tags: ["tool", "create"],
|
|
18
|
+
description: "Creates a new AI tool definition.",
|
|
19
|
+
goal: "Allow users to define new tools that agents can use.",
|
|
20
|
+
context: "Called from the tool builder UI when creating a new tool."
|
|
21
|
+
},
|
|
22
|
+
io: {
|
|
23
|
+
input: CreateToolInputModel,
|
|
24
|
+
output: defineSchemaModel({
|
|
25
|
+
name: "CreateToolOutput",
|
|
26
|
+
fields: {
|
|
27
|
+
id: {
|
|
28
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
29
|
+
isOptional: false
|
|
30
|
+
},
|
|
31
|
+
name: {
|
|
32
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
33
|
+
isOptional: false
|
|
34
|
+
},
|
|
35
|
+
slug: {
|
|
36
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
37
|
+
isOptional: false
|
|
38
|
+
},
|
|
39
|
+
status: {
|
|
40
|
+
type: ToolStatusEnum,
|
|
41
|
+
isOptional: false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
errors: { SLUG_EXISTS: {
|
|
46
|
+
description: "A tool with this slug already exists in the organization",
|
|
47
|
+
http: 409,
|
|
48
|
+
gqlCode: "SLUG_EXISTS",
|
|
49
|
+
when: "Slug is already taken"
|
|
50
|
+
} }
|
|
51
|
+
},
|
|
52
|
+
policy: { auth: "user" },
|
|
53
|
+
sideEffects: {
|
|
54
|
+
emits: [{
|
|
55
|
+
key: "tool.created",
|
|
56
|
+
version: 1,
|
|
57
|
+
stability: "stable",
|
|
58
|
+
owners: [...OWNERS],
|
|
59
|
+
tags: ["tool", "created"],
|
|
60
|
+
when: "Tool is successfully created",
|
|
61
|
+
payload: ToolSummaryModel
|
|
62
|
+
}],
|
|
63
|
+
audit: ["tool.created"]
|
|
64
|
+
},
|
|
65
|
+
acceptance: {
|
|
66
|
+
scenarios: [{
|
|
67
|
+
key: "create-tool-happy-path",
|
|
68
|
+
given: ["User is authenticated", "Organization exists"],
|
|
69
|
+
when: ["User submits valid tool configuration"],
|
|
70
|
+
then: ["New tool is created", "ToolCreated event is emitted"]
|
|
71
|
+
}, {
|
|
72
|
+
key: "create-tool-slug-conflict",
|
|
73
|
+
given: ["Tool with same slug exists"],
|
|
74
|
+
when: ["User submits tool with duplicate slug"],
|
|
75
|
+
then: ["SLUG_EXISTS error is returned"]
|
|
76
|
+
}],
|
|
77
|
+
examples: [{
|
|
78
|
+
key: "create-api-tool",
|
|
79
|
+
input: {
|
|
80
|
+
name: "Weather API",
|
|
81
|
+
slug: "weather-api",
|
|
82
|
+
category: "api",
|
|
83
|
+
description: "Fetches weather data"
|
|
84
|
+
},
|
|
85
|
+
output: {
|
|
86
|
+
id: "tool-123",
|
|
87
|
+
name: "Weather API",
|
|
88
|
+
slug: "weather-api",
|
|
89
|
+
status: "draft"
|
|
90
|
+
}
|
|
91
|
+
}]
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* UpdateToolCommand - Updates an existing tool.
|
|
96
|
+
*/
|
|
97
|
+
const UpdateToolCommand = defineCommand({
|
|
98
|
+
meta: {
|
|
99
|
+
key: "agent.tool.update",
|
|
100
|
+
version: 1,
|
|
101
|
+
stability: "stable",
|
|
102
|
+
owners: [...OWNERS],
|
|
103
|
+
tags: ["tool", "update"],
|
|
104
|
+
description: "Updates an existing AI tool definition.",
|
|
105
|
+
goal: "Allow users to modify tool settings and configuration.",
|
|
106
|
+
context: "Called from the tool settings UI."
|
|
107
|
+
},
|
|
108
|
+
io: {
|
|
109
|
+
input: UpdateToolInputModel,
|
|
110
|
+
output: defineSchemaModel({
|
|
111
|
+
name: "UpdateToolOutput",
|
|
112
|
+
fields: {
|
|
113
|
+
id: {
|
|
114
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
115
|
+
isOptional: false
|
|
116
|
+
},
|
|
117
|
+
name: {
|
|
118
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
119
|
+
isOptional: false
|
|
120
|
+
},
|
|
121
|
+
status: {
|
|
122
|
+
type: ToolStatusEnum,
|
|
123
|
+
isOptional: false
|
|
124
|
+
},
|
|
125
|
+
updatedAt: {
|
|
126
|
+
type: ScalarTypeEnum.DateTime(),
|
|
127
|
+
isOptional: false
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
errors: { TOOL_NOT_FOUND: {
|
|
132
|
+
description: "The specified tool does not exist",
|
|
133
|
+
http: 404,
|
|
134
|
+
gqlCode: "TOOL_NOT_FOUND",
|
|
135
|
+
when: "Tool ID is invalid"
|
|
136
|
+
} }
|
|
137
|
+
},
|
|
138
|
+
policy: { auth: "user" },
|
|
139
|
+
sideEffects: {
|
|
140
|
+
emits: [{
|
|
141
|
+
key: "tool.updated",
|
|
142
|
+
version: 1,
|
|
143
|
+
stability: "stable",
|
|
144
|
+
owners: [...OWNERS],
|
|
145
|
+
tags: ["tool", "updated"],
|
|
146
|
+
when: "Tool is updated",
|
|
147
|
+
payload: ToolSummaryModel
|
|
148
|
+
}],
|
|
149
|
+
audit: ["tool.updated"]
|
|
150
|
+
},
|
|
151
|
+
acceptance: {
|
|
152
|
+
scenarios: [{
|
|
153
|
+
key: "update-tool-happy-path",
|
|
154
|
+
given: ["Tool exists", "User owns the tool"],
|
|
155
|
+
when: ["User submits updated configuration"],
|
|
156
|
+
then: ["Tool is updated", "ToolUpdated event is emitted"]
|
|
157
|
+
}],
|
|
158
|
+
examples: [{
|
|
159
|
+
key: "update-description",
|
|
160
|
+
input: {
|
|
161
|
+
toolId: "tool-123",
|
|
162
|
+
description: "Updated weather API tool"
|
|
163
|
+
},
|
|
164
|
+
output: {
|
|
165
|
+
id: "tool-123",
|
|
166
|
+
name: "Weather API",
|
|
167
|
+
status: "draft",
|
|
168
|
+
updatedAt: "2025-01-01T00:00:00Z"
|
|
169
|
+
}
|
|
170
|
+
}]
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* GetToolQuery - Retrieves a tool by ID.
|
|
175
|
+
*/
|
|
176
|
+
const GetToolQuery = defineQuery({
|
|
177
|
+
meta: {
|
|
178
|
+
key: "agent.tool.get",
|
|
179
|
+
version: 1,
|
|
180
|
+
stability: "stable",
|
|
181
|
+
owners: [...OWNERS],
|
|
182
|
+
tags: ["tool", "get"],
|
|
183
|
+
description: "Retrieves a tool by its ID.",
|
|
184
|
+
goal: "View detailed tool configuration.",
|
|
185
|
+
context: "Called when viewing tool details or editing."
|
|
186
|
+
},
|
|
187
|
+
io: {
|
|
188
|
+
input: defineSchemaModel({
|
|
189
|
+
name: "GetToolInput",
|
|
190
|
+
fields: { toolId: {
|
|
191
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
192
|
+
isOptional: false
|
|
193
|
+
} }
|
|
194
|
+
}),
|
|
195
|
+
output: ToolModel,
|
|
196
|
+
errors: { TOOL_NOT_FOUND: {
|
|
197
|
+
description: "The specified tool does not exist",
|
|
198
|
+
http: 404,
|
|
199
|
+
gqlCode: "TOOL_NOT_FOUND",
|
|
200
|
+
when: "Tool ID is invalid"
|
|
201
|
+
} }
|
|
202
|
+
},
|
|
203
|
+
policy: { auth: "user" },
|
|
204
|
+
acceptance: {
|
|
205
|
+
scenarios: [{
|
|
206
|
+
key: "get-tool-happy-path",
|
|
207
|
+
given: ["Tool exists"],
|
|
208
|
+
when: ["User requests tool by ID"],
|
|
209
|
+
then: ["Tool details are returned"]
|
|
210
|
+
}],
|
|
211
|
+
examples: [{
|
|
212
|
+
key: "get-basic",
|
|
213
|
+
input: { toolId: "tool-123" },
|
|
214
|
+
output: {
|
|
215
|
+
id: "tool-123",
|
|
216
|
+
name: "Weather API",
|
|
217
|
+
status: "active",
|
|
218
|
+
category: "api"
|
|
219
|
+
}
|
|
220
|
+
}]
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
/**
|
|
224
|
+
* ListToolsQuery - Lists tools for an organization.
|
|
225
|
+
*/
|
|
226
|
+
const ListToolsQuery = defineQuery({
|
|
227
|
+
meta: {
|
|
228
|
+
key: "agent.tool.list",
|
|
229
|
+
version: 1,
|
|
230
|
+
stability: "stable",
|
|
231
|
+
owners: [...OWNERS],
|
|
232
|
+
tags: ["tool", "list"],
|
|
233
|
+
description: "Lists tools for an organization with optional filtering.",
|
|
234
|
+
goal: "Browse and search available tools.",
|
|
235
|
+
context: "Tool list/dashboard view."
|
|
236
|
+
},
|
|
237
|
+
io: {
|
|
238
|
+
input: defineSchemaModel({
|
|
239
|
+
name: "ListToolsInput",
|
|
240
|
+
fields: {
|
|
241
|
+
organizationId: {
|
|
242
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
243
|
+
isOptional: false
|
|
244
|
+
},
|
|
245
|
+
category: {
|
|
246
|
+
type: ToolCategoryEnum,
|
|
247
|
+
isOptional: true
|
|
248
|
+
},
|
|
249
|
+
status: {
|
|
250
|
+
type: ToolStatusEnum,
|
|
251
|
+
isOptional: true
|
|
252
|
+
},
|
|
253
|
+
search: {
|
|
254
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
255
|
+
isOptional: true
|
|
256
|
+
},
|
|
257
|
+
limit: {
|
|
258
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
259
|
+
isOptional: true,
|
|
260
|
+
defaultValue: 20
|
|
261
|
+
},
|
|
262
|
+
offset: {
|
|
263
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
264
|
+
isOptional: true,
|
|
265
|
+
defaultValue: 0
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}),
|
|
269
|
+
output: defineSchemaModel({
|
|
270
|
+
name: "ListToolsOutput",
|
|
271
|
+
fields: {
|
|
272
|
+
items: {
|
|
273
|
+
type: ToolSummaryModel,
|
|
274
|
+
isArray: true,
|
|
275
|
+
isOptional: false
|
|
276
|
+
},
|
|
277
|
+
total: {
|
|
278
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
279
|
+
isOptional: false
|
|
280
|
+
},
|
|
281
|
+
hasMore: {
|
|
282
|
+
type: ScalarTypeEnum.Boolean(),
|
|
283
|
+
isOptional: false
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
})
|
|
287
|
+
},
|
|
288
|
+
policy: { auth: "user" },
|
|
289
|
+
acceptance: {
|
|
290
|
+
scenarios: [{
|
|
291
|
+
key: "list-tools-happy-path",
|
|
292
|
+
given: ["Organization has tools"],
|
|
293
|
+
when: ["User lists tools"],
|
|
294
|
+
then: ["Paginated list of tools is returned"]
|
|
295
|
+
}],
|
|
296
|
+
examples: [{
|
|
297
|
+
key: "list-by-category",
|
|
298
|
+
input: {
|
|
299
|
+
organizationId: "org-123",
|
|
300
|
+
category: "api",
|
|
301
|
+
limit: 10
|
|
302
|
+
},
|
|
303
|
+
output: {
|
|
304
|
+
items: [],
|
|
305
|
+
total: 0,
|
|
306
|
+
hasMore: false
|
|
307
|
+
}
|
|
308
|
+
}]
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
/**
|
|
312
|
+
* TestToolCommand - Tests a tool with sample input.
|
|
313
|
+
*/
|
|
314
|
+
const TestToolCommand = defineCommand({
|
|
315
|
+
meta: {
|
|
316
|
+
key: "agent.tool.test",
|
|
317
|
+
version: 1,
|
|
318
|
+
stability: "stable",
|
|
319
|
+
owners: [...OWNERS],
|
|
320
|
+
tags: ["tool", "test"],
|
|
321
|
+
description: "Tests a tool with sample input to verify it works correctly.",
|
|
322
|
+
goal: "Validate tool configuration before deployment.",
|
|
323
|
+
context: "Tool builder UI - test panel."
|
|
324
|
+
},
|
|
325
|
+
io: {
|
|
326
|
+
input: defineSchemaModel({
|
|
327
|
+
name: "TestToolInput",
|
|
328
|
+
fields: {
|
|
329
|
+
toolId: {
|
|
330
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
331
|
+
isOptional: false
|
|
332
|
+
},
|
|
333
|
+
testInput: {
|
|
334
|
+
type: ScalarTypeEnum.JSONObject(),
|
|
335
|
+
isOptional: false
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}),
|
|
339
|
+
output: defineSchemaModel({
|
|
340
|
+
name: "TestToolOutput",
|
|
341
|
+
fields: {
|
|
342
|
+
success: {
|
|
343
|
+
type: ScalarTypeEnum.Boolean(),
|
|
344
|
+
isOptional: false
|
|
345
|
+
},
|
|
346
|
+
output: {
|
|
347
|
+
type: ScalarTypeEnum.JSONObject(),
|
|
348
|
+
isOptional: true
|
|
349
|
+
},
|
|
350
|
+
error: {
|
|
351
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
352
|
+
isOptional: true
|
|
353
|
+
},
|
|
354
|
+
durationMs: {
|
|
355
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
356
|
+
isOptional: false
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}),
|
|
360
|
+
errors: {
|
|
361
|
+
TOOL_NOT_FOUND: {
|
|
362
|
+
description: "The specified tool does not exist",
|
|
363
|
+
http: 404,
|
|
364
|
+
gqlCode: "TOOL_NOT_FOUND",
|
|
365
|
+
when: "Tool ID is invalid"
|
|
366
|
+
},
|
|
367
|
+
TOOL_EXECUTION_ERROR: {
|
|
368
|
+
description: "Tool execution failed",
|
|
369
|
+
http: 500,
|
|
370
|
+
gqlCode: "TOOL_EXECUTION_ERROR",
|
|
371
|
+
when: "Tool returns an error"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
policy: { auth: "user" },
|
|
376
|
+
sideEffects: { audit: ["tool.tested"] },
|
|
377
|
+
acceptance: {
|
|
378
|
+
scenarios: [{
|
|
379
|
+
key: "test-tool-success",
|
|
380
|
+
given: ["Tool exists", "Tool is configured correctly"],
|
|
381
|
+
when: ["User runs test with valid input"],
|
|
382
|
+
then: ["Tool executes successfully", "Output is returned"]
|
|
383
|
+
}, {
|
|
384
|
+
key: "test-tool-failure",
|
|
385
|
+
given: ["Tool exists", "Tool has configuration error"],
|
|
386
|
+
when: ["User runs test"],
|
|
387
|
+
then: ["TOOL_EXECUTION_ERROR is returned"]
|
|
388
|
+
}],
|
|
389
|
+
examples: [{
|
|
390
|
+
key: "test-weather-api",
|
|
391
|
+
input: {
|
|
392
|
+
toolId: "tool-123",
|
|
393
|
+
testInput: { city: "Paris" }
|
|
394
|
+
},
|
|
395
|
+
output: {
|
|
396
|
+
success: true,
|
|
397
|
+
output: { temperature: 22 },
|
|
398
|
+
durationMs: 150
|
|
399
|
+
}
|
|
400
|
+
}]
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
//#endregion
|
|
405
|
+
export { CreateToolCommand, GetToolQuery, ListToolsQuery, TestToolCommand, UpdateToolCommand };
|
|
406
|
+
//# sourceMappingURL=tool.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.operation.js","names":[],"sources":["../../src/tool/tool.operation.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ToolCategoryEnum, ToolStatusEnum } from './tool.enum';\nimport {\n CreateToolInputModel,\n ToolModel,\n ToolSummaryModel,\n UpdateToolInputModel,\n} from './tool.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * CreateToolCommand - Creates a new tool definition.\n */\nexport const CreateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'create'],\n description: 'Creates a new AI tool definition.',\n goal: 'Allow users to define new tools that agents can use.',\n context: 'Called from the tool builder UI when creating a new tool.',\n },\n io: {\n input: CreateToolInputModel,\n output: defineSchemaModel({\n name: 'CreateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n },\n }),\n errors: {\n SLUG_EXISTS: {\n description: 'A tool with this slug already exists in the organization',\n http: 409,\n gqlCode: 'SLUG_EXISTS',\n when: 'Slug is already taken',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.created',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'created'],\n when: 'Tool is successfully created',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-tool-happy-path',\n given: ['User is authenticated', 'Organization exists'],\n when: ['User submits valid tool configuration'],\n then: ['New tool is created', 'ToolCreated event is emitted'],\n },\n {\n key: 'create-tool-slug-conflict',\n given: ['Tool with same slug exists'],\n when: ['User submits tool with duplicate slug'],\n then: ['SLUG_EXISTS error is returned'],\n },\n ],\n examples: [\n {\n key: 'create-api-tool',\n input: {\n name: 'Weather API',\n slug: 'weather-api',\n category: 'api',\n description: 'Fetches weather data',\n },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n slug: 'weather-api',\n status: 'draft',\n },\n },\n ],\n },\n});\n\n/**\n * UpdateToolCommand - Updates an existing tool.\n */\nexport const UpdateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.update',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'update'],\n description: 'Updates an existing AI tool definition.',\n goal: 'Allow users to modify tool settings and configuration.',\n context: 'Called from the tool settings UI.',\n },\n io: {\n input: UpdateToolInputModel,\n output: defineSchemaModel({\n name: 'UpdateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.updated',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'updated'],\n when: 'Tool is updated',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.updated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-tool-happy-path',\n given: ['Tool exists', 'User owns the tool'],\n when: ['User submits updated configuration'],\n then: ['Tool is updated', 'ToolUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'update-description',\n input: { toolId: 'tool-123', description: 'Updated weather API tool' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'draft',\n updatedAt: '2025-01-01T00:00:00Z',\n },\n },\n ],\n },\n});\n\n/**\n * GetToolQuery - Retrieves a tool by ID.\n */\nexport const GetToolQuery = defineQuery({\n meta: {\n key: 'agent.tool.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'get'],\n description: 'Retrieves a tool by its ID.',\n goal: 'View detailed tool configuration.',\n context: 'Called when viewing tool details or editing.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: ToolModel,\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-tool-happy-path',\n given: ['Tool exists'],\n when: ['User requests tool by ID'],\n then: ['Tool details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-basic',\n input: { toolId: 'tool-123' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'active',\n category: 'api',\n },\n },\n ],\n },\n});\n\n/**\n * ListToolsQuery - Lists tools for an organization.\n */\nexport const ListToolsQuery = defineQuery({\n meta: {\n key: 'agent.tool.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'list'],\n description: 'Lists tools for an organization with optional filtering.',\n goal: 'Browse and search available tools.',\n context: 'Tool list/dashboard view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListToolsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n category: { type: ToolCategoryEnum, isOptional: true },\n status: { type: ToolStatusEnum, isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'ListToolsOutput',\n fields: {\n items: { type: ToolSummaryModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-tools-happy-path',\n given: ['Organization has tools'],\n when: ['User lists tools'],\n then: ['Paginated list of tools is returned'],\n },\n ],\n examples: [\n {\n key: 'list-by-category',\n input: { organizationId: 'org-123', category: 'api', limit: 10 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * TestToolCommand - Tests a tool with sample input.\n */\nexport const TestToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.test',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'test'],\n description: 'Tests a tool with sample input to verify it works correctly.',\n goal: 'Validate tool configuration before deployment.',\n context: 'Tool builder UI - test panel.',\n },\n io: {\n input: defineSchemaModel({\n name: 'TestToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n testInput: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'TestToolOutput',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n error: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n TOOL_EXECUTION_ERROR: {\n description: 'Tool execution failed',\n http: 500,\n gqlCode: 'TOOL_EXECUTION_ERROR',\n when: 'Tool returns an error',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: { audit: ['tool.tested'] },\n acceptance: {\n scenarios: [\n {\n key: 'test-tool-success',\n given: ['Tool exists', 'Tool is configured correctly'],\n when: ['User runs test with valid input'],\n then: ['Tool executes successfully', 'Output is returned'],\n },\n {\n key: 'test-tool-failure',\n given: ['Tool exists', 'Tool has configuration error'],\n when: ['User runs test'],\n then: ['TOOL_EXECUTION_ERROR is returned'],\n },\n ],\n examples: [\n {\n key: 'test-weather-api',\n input: { toolId: 'tool-123', testInput: { city: 'Paris' } },\n output: { success: true, output: { temperature: 22 }, durationMs: 150 },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAaA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,oBAAoB,cAAc;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,SAAS;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ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GACtD,MAAM,CAAC,iBAAiB;GACxB,MAAM,CAAC,mCAAmC;GAC3C,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,WAAW,EAAE,MAAM,SAAS;IAAE;GAC3D,QAAQ;IAAE,SAAS;IAAM,QAAQ,EAAE,aAAa,IAAI;IAAE,YAAY;IAAK;GACxE,CACF;EACF;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PresentationSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/tool/tool.presentation.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Presentation for displaying a list of tools.
|
|
7
|
+
*/
|
|
8
|
+
declare const ToolListPresentation: PresentationSpec;
|
|
9
|
+
/**
|
|
10
|
+
* Presentation for tool detail view.
|
|
11
|
+
*/
|
|
12
|
+
declare const ToolDetailPresentation: PresentationSpec;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ToolDetailPresentation, ToolListPresentation };
|
|
15
|
+
//# sourceMappingURL=tool.presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.presentation.d.ts","names":[],"sources":["../../src/tool/tool.presentation.ts"],"sourcesContent":[],"mappings":";;;;;;AAOA;AA2Ba,cA3BA,oBA2BwB,EA3BF,gBAgDlC;;;;cArBY,wBAAwB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ToolSummaryModel } from "./tool.schema.js";
|
|
2
|
+
import { StabilityEnum } from "@contractspec/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/tool/tool.presentation.ts
|
|
5
|
+
/**
|
|
6
|
+
* Presentation for displaying a list of tools.
|
|
7
|
+
*/
|
|
8
|
+
const ToolListPresentation = {
|
|
9
|
+
meta: {
|
|
10
|
+
key: "agent-console.tool.list",
|
|
11
|
+
version: 1,
|
|
12
|
+
title: "Tool List",
|
|
13
|
+
description: "List view of AI tools with category, status, and version info",
|
|
14
|
+
goal: "Provide an overview of all available tools for agents.",
|
|
15
|
+
context: "Tool management dashboard.",
|
|
16
|
+
domain: "agent-console",
|
|
17
|
+
owners: ["@agent-console-team"],
|
|
18
|
+
tags: [
|
|
19
|
+
"tool",
|
|
20
|
+
"list",
|
|
21
|
+
"dashboard"
|
|
22
|
+
],
|
|
23
|
+
stability: StabilityEnum.Experimental
|
|
24
|
+
},
|
|
25
|
+
source: {
|
|
26
|
+
type: "component",
|
|
27
|
+
framework: "react",
|
|
28
|
+
componentKey: "ToolListView",
|
|
29
|
+
props: ToolSummaryModel
|
|
30
|
+
},
|
|
31
|
+
targets: [
|
|
32
|
+
"react",
|
|
33
|
+
"markdown",
|
|
34
|
+
"application/json"
|
|
35
|
+
],
|
|
36
|
+
policy: { flags: ["agent-console.enabled"] }
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Presentation for tool detail view.
|
|
40
|
+
*/
|
|
41
|
+
const ToolDetailPresentation = {
|
|
42
|
+
meta: {
|
|
43
|
+
key: "agent-console.tool.detail",
|
|
44
|
+
version: 1,
|
|
45
|
+
title: "Tool Details",
|
|
46
|
+
description: "Detailed view of an AI tool with configuration and test panel",
|
|
47
|
+
goal: "Allow users to inspect and test a specific tool.",
|
|
48
|
+
context: "Detailed view of a tool.",
|
|
49
|
+
domain: "agent-console",
|
|
50
|
+
owners: ["@agent-console-team"],
|
|
51
|
+
tags: ["tool", "detail"],
|
|
52
|
+
stability: StabilityEnum.Experimental
|
|
53
|
+
},
|
|
54
|
+
source: {
|
|
55
|
+
type: "component",
|
|
56
|
+
framework: "react",
|
|
57
|
+
componentKey: "ToolDetailView"
|
|
58
|
+
},
|
|
59
|
+
targets: ["react", "markdown"],
|
|
60
|
+
policy: { flags: ["agent-console.enabled"] }
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { ToolDetailPresentation, ToolListPresentation };
|
|
65
|
+
//# sourceMappingURL=tool.presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.presentation.js","names":["ToolListPresentation: PresentationSpec","ToolDetailPresentation: PresentationSpec"],"sources":["../../src/tool/tool.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { ToolSummaryModel } from './tool.schema';\n\n/**\n * Presentation for displaying a list of tools.\n */\nexport const ToolListPresentation: PresentationSpec = {\n meta: {\n key: 'agent-console.tool.list',\n version: 1,\n title: 'Tool List',\n description:\n 'List view of AI tools with category, status, and version info',\n goal: 'Provide an overview of all available tools for agents.',\n context: 'Tool management dashboard.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['tool', 'list', 'dashboard'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ToolListView',\n props: ToolSummaryModel,\n },\n targets: ['react', 'markdown', 'application/json'],\n policy: { flags: ['agent-console.enabled'] },\n};\n\n/**\n * Presentation for tool detail view.\n */\nexport const ToolDetailPresentation: PresentationSpec = {\n meta: {\n key: 'agent-console.tool.detail',\n version: 1,\n title: 'Tool Details',\n description:\n 'Detailed view of an AI tool with configuration and test panel',\n goal: 'Allow users to inspect and test a specific tool.',\n context: 'Detailed view of a tool.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['tool', 'detail'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ToolDetailView',\n },\n targets: ['react', 'markdown'],\n policy: { flags: ['agent-console.enabled'] },\n};\n"],"mappings":";;;;;;;AAOA,MAAaA,uBAAyC;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM;GAAC;GAAQ;GAAQ;GAAY;EACnC,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS;EAAC;EAAS;EAAY;EAAmB;CAClD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C;;;;AAKD,MAAaC,yBAA2C;CACtD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM,CAAC,QAAQ,SAAS;EACxB,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C"}
|