@contractspec/example.agent-console 3.7.6 → 3.7.7

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.
Files changed (175) hide show
  1. package/.turbo/turbo-build.log +18 -18
  2. package/AGENTS.md +50 -31
  3. package/README.md +69 -77
  4. package/dist/agent/agent.event.js +1 -1
  5. package/dist/agent/agent.operation.js +1 -1
  6. package/dist/agent/index.d.ts +5 -5
  7. package/dist/agent/index.js +1 -1
  8. package/dist/browser/agent/agent.event.js +1 -1
  9. package/dist/browser/agent/agent.operation.js +1 -1
  10. package/dist/browser/agent/index.js +1 -1
  11. package/dist/browser/index.js +2145 -2145
  12. package/dist/browser/presentations/index.js +4 -4
  13. package/dist/browser/run/index.js +536 -536
  14. package/dist/browser/run/run.event.js +2 -2
  15. package/dist/browser/run/run.presentation.js +2 -2
  16. package/dist/browser/tool/index.js +260 -260
  17. package/dist/browser/tool/tool.event.js +1 -1
  18. package/dist/browser/tool/tool.presentation.js +2 -2
  19. package/dist/browser/ui/AgentDashboard.js +956 -956
  20. package/dist/browser/ui/AgentRunList.js +16 -16
  21. package/dist/browser/ui/AgentToolRegistry.js +9 -9
  22. package/dist/browser/ui/hooks/index.js +153 -153
  23. package/dist/browser/ui/hooks/useAgentList.js +1 -1
  24. package/dist/browser/ui/hooks/useAgentMutations.js +1 -1
  25. package/dist/browser/ui/hooks/useRunList.js +1 -1
  26. package/dist/browser/ui/hooks/useToolList.js +1 -1
  27. package/dist/browser/ui/index.js +1222 -1222
  28. package/dist/browser/ui/modals/AgentActionsModal.js +13 -13
  29. package/dist/browser/ui/modals/CreateAgentModal.js +15 -15
  30. package/dist/browser/ui/modals/index.js +297 -297
  31. package/dist/browser/ui/renderers/agent-list.renderer.js +7 -7
  32. package/dist/browser/ui/renderers/index.js +157 -157
  33. package/dist/browser/ui/views/AgentListView.js +7 -7
  34. package/dist/browser/ui/views/RunListView.js +16 -16
  35. package/dist/browser/ui/views/ToolRegistryView.js +9 -9
  36. package/dist/browser/ui/views/index.js +97 -97
  37. package/dist/handlers/index.d.ts +1 -1
  38. package/dist/index.d.ts +4 -4
  39. package/dist/index.js +2145 -2145
  40. package/dist/node/agent/agent.event.js +1 -1
  41. package/dist/node/agent/agent.operation.js +1 -1
  42. package/dist/node/agent/index.js +1 -1
  43. package/dist/node/index.js +2145 -2145
  44. package/dist/node/presentations/index.js +4 -4
  45. package/dist/node/run/index.js +536 -536
  46. package/dist/node/run/run.event.js +2 -2
  47. package/dist/node/run/run.presentation.js +2 -2
  48. package/dist/node/tool/index.js +260 -260
  49. package/dist/node/tool/tool.event.js +1 -1
  50. package/dist/node/tool/tool.presentation.js +2 -2
  51. package/dist/node/ui/AgentDashboard.js +956 -956
  52. package/dist/node/ui/AgentRunList.js +16 -16
  53. package/dist/node/ui/AgentToolRegistry.js +9 -9
  54. package/dist/node/ui/hooks/index.js +153 -153
  55. package/dist/node/ui/hooks/useAgentList.js +1 -1
  56. package/dist/node/ui/hooks/useAgentMutations.js +1 -1
  57. package/dist/node/ui/hooks/useRunList.js +1 -1
  58. package/dist/node/ui/hooks/useToolList.js +1 -1
  59. package/dist/node/ui/index.js +1222 -1222
  60. package/dist/node/ui/modals/AgentActionsModal.js +13 -13
  61. package/dist/node/ui/modals/CreateAgentModal.js +15 -15
  62. package/dist/node/ui/modals/index.js +297 -297
  63. package/dist/node/ui/renderers/agent-list.renderer.js +7 -7
  64. package/dist/node/ui/renderers/index.js +157 -157
  65. package/dist/node/ui/views/AgentListView.js +7 -7
  66. package/dist/node/ui/views/RunListView.js +16 -16
  67. package/dist/node/ui/views/ToolRegistryView.js +9 -9
  68. package/dist/node/ui/views/index.js +97 -97
  69. package/dist/presentations/index.d.ts +3 -5
  70. package/dist/presentations/index.js +4 -4
  71. package/dist/run/index.d.ts +7 -7
  72. package/dist/run/index.js +536 -536
  73. package/dist/run/run.event.js +2 -2
  74. package/dist/run/run.handler.d.ts +3 -0
  75. package/dist/run/run.presentation.js +2 -2
  76. package/dist/shared/index.d.ts +1 -1
  77. package/dist/tool/index.d.ts +7 -7
  78. package/dist/tool/index.js +260 -260
  79. package/dist/tool/tool.event.js +1 -1
  80. package/dist/tool/tool.handler.d.ts +1 -1
  81. package/dist/tool/tool.presentation.js +2 -2
  82. package/dist/ui/AgentDashboard.js +956 -956
  83. package/dist/ui/AgentRunList.js +16 -16
  84. package/dist/ui/AgentToolRegistry.js +9 -9
  85. package/dist/ui/hooks/index.d.ts +4 -4
  86. package/dist/ui/hooks/index.js +153 -153
  87. package/dist/ui/hooks/useAgentList.d.ts +5 -0
  88. package/dist/ui/hooks/useAgentList.js +1 -1
  89. package/dist/ui/hooks/useAgentMutations.d.ts +9 -2
  90. package/dist/ui/hooks/useAgentMutations.js +1 -1
  91. package/dist/ui/hooks/useRunList.d.ts +5 -0
  92. package/dist/ui/hooks/useRunList.js +1 -1
  93. package/dist/ui/hooks/useToolList.d.ts +5 -0
  94. package/dist/ui/hooks/useToolList.js +1 -1
  95. package/dist/ui/index.d.ts +3 -3
  96. package/dist/ui/index.js +1222 -1222
  97. package/dist/ui/modals/AgentActionsModal.js +13 -13
  98. package/dist/ui/modals/CreateAgentModal.js +15 -15
  99. package/dist/ui/modals/index.d.ts +1 -1
  100. package/dist/ui/modals/index.js +297 -297
  101. package/dist/ui/renderers/agent-list.markdown.d.ts +5 -0
  102. package/dist/ui/renderers/agent-list.renderer.js +7 -7
  103. package/dist/ui/renderers/dashboard.markdown.d.ts +5 -0
  104. package/dist/ui/renderers/index.d.ts +2 -2
  105. package/dist/ui/renderers/index.js +157 -157
  106. package/dist/ui/renderers/run-list.markdown.d.ts +5 -0
  107. package/dist/ui/renderers/tool-registry.markdown.d.ts +5 -0
  108. package/dist/ui/views/AgentListView.js +7 -7
  109. package/dist/ui/views/RunListView.js +16 -16
  110. package/dist/ui/views/ToolRegistryView.js +9 -9
  111. package/dist/ui/views/index.js +97 -97
  112. package/package.json +6 -6
  113. package/src/agent/agent.entity.ts +111 -111
  114. package/src/agent/agent.enum.ts +12 -12
  115. package/src/agent/agent.event.ts +91 -91
  116. package/src/agent/agent.handler.ts +123 -123
  117. package/src/agent/agent.operation.ts +400 -400
  118. package/src/agent/agent.presentation.ts +62 -62
  119. package/src/agent/agent.schema.ts +175 -175
  120. package/src/agent/agent.test-spec.ts +48 -48
  121. package/src/agent/index.ts +46 -51
  122. package/src/agent.capability.ts +11 -11
  123. package/src/agent.feature.ts +131 -131
  124. package/src/docs/agent-console.docblock.ts +42 -42
  125. package/src/example.ts +35 -35
  126. package/src/handlers/agent.handlers.ts +522 -521
  127. package/src/handlers/index.ts +12 -12
  128. package/src/index.ts +8 -9
  129. package/src/presentations/index.ts +11 -13
  130. package/src/run/index.ts +49 -54
  131. package/src/run/run.entity.ts +137 -137
  132. package/src/run/run.enum.ts +18 -18
  133. package/src/run/run.event.ts +174 -174
  134. package/src/run/run.handler.ts +92 -91
  135. package/src/run/run.operation.ts +474 -474
  136. package/src/run/run.presentation.ts +42 -42
  137. package/src/run/run.schema.ts +126 -126
  138. package/src/run/run.test-spec.ts +48 -48
  139. package/src/seeders/index.ts +21 -21
  140. package/src/shared/index.ts +1 -1
  141. package/src/shared/mock-agents.ts +76 -76
  142. package/src/shared/mock-runs.ts +102 -102
  143. package/src/shared/mock-tools.ts +140 -140
  144. package/src/shared/overlay-types.ts +23 -23
  145. package/src/tool/index.ts +39 -44
  146. package/src/tool/tool.entity.ts +73 -73
  147. package/src/tool/tool.enum.ts +13 -13
  148. package/src/tool/tool.event.ts +80 -80
  149. package/src/tool/tool.handler.ts +102 -102
  150. package/src/tool/tool.operation.ts +328 -328
  151. package/src/tool/tool.presentation.ts +43 -43
  152. package/src/tool/tool.schema.ts +106 -106
  153. package/src/tool/tool.test-spec.ts +48 -48
  154. package/src/ui/AgentDashboard.tsx +348 -348
  155. package/src/ui/hooks/index.ts +7 -7
  156. package/src/ui/hooks/useAgentList.ts +57 -56
  157. package/src/ui/hooks/useAgentMutations.ts +160 -159
  158. package/src/ui/hooks/useRunList.ts +58 -57
  159. package/src/ui/hooks/useToolList.ts +102 -101
  160. package/src/ui/index.ts +6 -9
  161. package/src/ui/modals/AgentActionsModal.tsx +262 -262
  162. package/src/ui/modals/CreateAgentModal.tsx +232 -232
  163. package/src/ui/modals/index.ts +1 -1
  164. package/src/ui/overlays/demo-overlays.ts +52 -52
  165. package/src/ui/renderers/agent-list.markdown.ts +61 -60
  166. package/src/ui/renderers/agent-list.renderer.tsx +14 -14
  167. package/src/ui/renderers/dashboard.markdown.ts +140 -139
  168. package/src/ui/renderers/index.ts +3 -4
  169. package/src/ui/renderers/run-list.markdown.ts +48 -47
  170. package/src/ui/renderers/tool-registry.markdown.ts +66 -65
  171. package/src/ui/views/AgentListView.tsx +90 -90
  172. package/src/ui/views/RunListView.tsx +141 -141
  173. package/src/ui/views/ToolRegistryView.tsx +113 -113
  174. package/tsconfig.json +7 -8
  175. package/tsdown.config.js +7 -3
@@ -215,6 +215,91 @@ async function mockTestToolHandler(input) {
215
215
  };
216
216
  }
217
217
 
218
+ // src/tool/tool.entity.ts
219
+ import {
220
+ defineEntity,
221
+ defineEntityEnum,
222
+ field,
223
+ index
224
+ } from "@contractspec/lib.schema";
225
+ var ToolCategoryEntityEnum = defineEntityEnum({
226
+ name: "ToolCategory",
227
+ values: [
228
+ "RETRIEVAL",
229
+ "COMPUTATION",
230
+ "COMMUNICATION",
231
+ "INTEGRATION",
232
+ "UTILITY",
233
+ "CUSTOM"
234
+ ],
235
+ description: "Category of tool"
236
+ });
237
+ var ToolStatusEntityEnum = defineEntityEnum({
238
+ name: "ToolStatus",
239
+ values: ["DRAFT", "ACTIVE", "DEPRECATED", "DISABLED"],
240
+ description: "Status of tool"
241
+ });
242
+ var ImplementationTypeEntityEnum = defineEntityEnum({
243
+ name: "ImplementationType",
244
+ values: ["http", "function", "workflow"],
245
+ description: "How the tool is implemented"
246
+ });
247
+ var ToolEntity = defineEntity({
248
+ name: "Tool",
249
+ schema: "agent_console",
250
+ description: "An AI tool that can be used by agents.",
251
+ fields: {
252
+ id: field.id(),
253
+ organizationId: field.string({
254
+ description: "Organization that owns this tool"
255
+ }),
256
+ name: field.string({ description: "Tool name" }),
257
+ slug: field.string({ description: "URL-safe identifier" }),
258
+ description: field.string({ description: "Tool description" }),
259
+ category: field.enum("ToolCategory", { default: "CUSTOM" }),
260
+ status: field.enum("ToolStatus", { default: "DRAFT" }),
261
+ parametersSchema: field.json({
262
+ description: "JSON Schema for tool parameters"
263
+ }),
264
+ outputSchema: field.json({
265
+ isOptional: true,
266
+ description: "JSON Schema for tool output"
267
+ }),
268
+ implementationType: field.enum("ImplementationType"),
269
+ implementationConfig: field.json({
270
+ description: "Implementation configuration"
271
+ }),
272
+ maxInvocationsPerMinute: field.int({
273
+ isOptional: true,
274
+ description: "Rate limit"
275
+ }),
276
+ timeoutMs: field.int({ default: 30000, description: "Execution timeout" }),
277
+ version: field.string({ default: "1.0.0", description: "Tool version" }),
278
+ tags: field.string({
279
+ isArray: true,
280
+ isOptional: true,
281
+ description: "Tags for categorization"
282
+ }),
283
+ createdAt: field.createdAt(),
284
+ updatedAt: field.updatedAt(),
285
+ createdById: field.string({
286
+ isOptional: true,
287
+ description: "User who created this tool"
288
+ }),
289
+ agents: field.hasMany("Agent", { description: "Agents using this tool" })
290
+ },
291
+ indexes: [
292
+ index.unique(["organizationId", "slug"]),
293
+ index.on(["organizationId", "category"]),
294
+ index.on(["organizationId", "status"])
295
+ ],
296
+ enums: [
297
+ ToolCategoryEntityEnum,
298
+ ToolStatusEntityEnum,
299
+ ImplementationTypeEntityEnum
300
+ ]
301
+ });
302
+
218
303
  // src/tool/tool.enum.ts
219
304
  import { defineEnum } from "@contractspec/lib.schema";
220
305
  var ToolCategoryEnum = defineEnum("ToolCategory", [
@@ -237,114 +322,209 @@ var ImplementationTypeEnum = defineEnum("ImplementationType", [
237
322
  "workflow"
238
323
  ]);
239
324
 
240
- // src/tool/tool.schema.ts
325
+ // src/tool/tool.event.ts
326
+ import { defineEvent } from "@contractspec/lib.contracts-spec";
241
327
  import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
242
- var ToolModel = defineSchemaModel({
243
- name: "Tool",
244
- description: "AI tool definition",
328
+ var OWNERS = ["@agent-console-team"];
329
+ var ToolCreatedPayload = defineSchemaModel({
330
+ name: "ToolCreatedPayload",
331
+ description: "Payload for tool created event",
245
332
  fields: {
246
333
  id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
247
334
  organizationId: {
248
335
  type: ScalarTypeEnum.String_unsecure(),
249
336
  isOptional: false
250
337
  },
251
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
338
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
252
339
  slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
253
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
340
+ category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
341
+ implementationType: {
342
+ type: ScalarTypeEnum.String_unsecure(),
343
+ isOptional: false
344
+ },
345
+ createdById: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
346
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
347
+ }
348
+ });
349
+ var ToolCreatedEvent = defineEvent({
350
+ meta: {
351
+ key: "agent.tool.created",
352
+ version: "1.0.0",
353
+ description: "A new AI tool was created.",
354
+ stability: "stable",
355
+ owners: [...OWNERS],
356
+ tags: ["tool", "created"]
357
+ },
358
+ payload: ToolCreatedPayload
359
+ });
360
+ var ToolUpdatedPayload = defineSchemaModel({
361
+ name: "ToolUpdatedPayload",
362
+ description: "Payload for tool updated event",
363
+ fields: {
364
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
365
+ organizationId: {
366
+ type: ScalarTypeEnum.String_unsecure(),
367
+ isOptional: false
368
+ },
369
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
370
+ status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
371
+ updatedFields: {
372
+ type: ScalarTypeEnum.String_unsecure(),
373
+ isArray: true,
374
+ isOptional: false
375
+ },
376
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
377
+ }
378
+ });
379
+ var ToolUpdatedEvent = defineEvent({
380
+ meta: {
381
+ key: "agent.tool.updated",
382
+ version: "1.0.0",
383
+ description: "An AI tool configuration was updated.",
384
+ stability: "stable",
385
+ owners: [...OWNERS],
386
+ tags: ["tool", "updated"]
387
+ },
388
+ payload: ToolUpdatedPayload
389
+ });
390
+ var ToolStatusChangedPayload = defineSchemaModel({
391
+ name: "ToolStatusChangedPayload",
392
+ description: "Payload for tool status changed event",
393
+ fields: {
394
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
395
+ organizationId: {
396
+ type: ScalarTypeEnum.String_unsecure(),
397
+ isOptional: false
398
+ },
399
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
400
+ previousStatus: {
401
+ type: ScalarTypeEnum.String_unsecure(),
402
+ isOptional: false
403
+ },
404
+ newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
405
+ changedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
406
+ }
407
+ });
408
+ var ToolStatusChangedEvent = defineEvent({
409
+ meta: {
410
+ key: "agent.tool.statusChanged",
411
+ version: "1.0.0",
412
+ description: "An AI tool status was changed (activated, deprecated, disabled).",
413
+ stability: "stable",
414
+ owners: [...OWNERS],
415
+ tags: ["tool", "status"]
416
+ },
417
+ payload: ToolStatusChangedPayload
418
+ });
419
+
420
+ // src/tool/tool.schema.ts
421
+ import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
422
+ var ToolModel = defineSchemaModel2({
423
+ name: "Tool",
424
+ description: "AI tool definition",
425
+ fields: {
426
+ id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
427
+ organizationId: {
428
+ type: ScalarTypeEnum2.String_unsecure(),
429
+ isOptional: false
430
+ },
431
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
432
+ slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
433
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
254
434
  category: { type: ToolCategoryEnum, isOptional: false },
255
435
  status: { type: ToolStatusEnum, isOptional: false },
256
- parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
257
- outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
436
+ parametersSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: false },
437
+ outputSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
258
438
  implementationType: { type: ImplementationTypeEnum, isOptional: false },
259
439
  implementationConfig: {
260
- type: ScalarTypeEnum.JSONObject(),
440
+ type: ScalarTypeEnum2.JSONObject(),
261
441
  isOptional: false
262
442
  },
263
443
  maxInvocationsPerMinute: {
264
- type: ScalarTypeEnum.Int_unsecure(),
444
+ type: ScalarTypeEnum2.Int_unsecure(),
265
445
  isOptional: true
266
446
  },
267
447
  timeoutMs: {
268
- type: ScalarTypeEnum.Int_unsecure(),
448
+ type: ScalarTypeEnum2.Int_unsecure(),
269
449
  isOptional: false,
270
450
  defaultValue: 30000
271
451
  },
272
- version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
452
+ version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
273
453
  tags: {
274
- type: ScalarTypeEnum.String_unsecure(),
454
+ type: ScalarTypeEnum2.String_unsecure(),
275
455
  isArray: true,
276
456
  isOptional: true
277
457
  },
278
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
279
- updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
458
+ createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
459
+ updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
280
460
  }
281
461
  });
282
- var ToolSummaryModel = defineSchemaModel({
462
+ var ToolSummaryModel = defineSchemaModel2({
283
463
  name: "ToolSummary",
284
464
  description: "Summary of a tool for list views",
285
465
  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 },
466
+ id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
467
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
468
+ slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
469
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
290
470
  category: { type: ToolCategoryEnum, isOptional: false },
291
471
  status: { type: ToolStatusEnum, isOptional: false },
292
- version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
293
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
472
+ version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
473
+ createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
294
474
  }
295
475
  });
296
- var CreateToolInputModel = defineSchemaModel({
476
+ var CreateToolInputModel = defineSchemaModel2({
297
477
  name: "CreateToolInput",
298
478
  description: "Input for creating a tool",
299
479
  fields: {
300
480
  organizationId: {
301
- type: ScalarTypeEnum.String_unsecure(),
481
+ type: ScalarTypeEnum2.String_unsecure(),
302
482
  isOptional: false
303
483
  },
304
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
305
- slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
306
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
484
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
485
+ slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
486
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
307
487
  category: { type: ToolCategoryEnum, isOptional: true },
308
- parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
309
- outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
488
+ parametersSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: false },
489
+ outputSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
310
490
  implementationType: { type: ImplementationTypeEnum, isOptional: false },
311
491
  implementationConfig: {
312
- type: ScalarTypeEnum.JSONObject(),
492
+ type: ScalarTypeEnum2.JSONObject(),
313
493
  isOptional: false
314
494
  },
315
495
  maxInvocationsPerMinute: {
316
- type: ScalarTypeEnum.Int_unsecure(),
496
+ type: ScalarTypeEnum2.Int_unsecure(),
317
497
  isOptional: true
318
498
  },
319
- timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
499
+ timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
320
500
  tags: {
321
- type: ScalarTypeEnum.String_unsecure(),
501
+ type: ScalarTypeEnum2.String_unsecure(),
322
502
  isArray: true,
323
503
  isOptional: true
324
504
  }
325
505
  }
326
506
  });
327
- var UpdateToolInputModel = defineSchemaModel({
507
+ var UpdateToolInputModel = defineSchemaModel2({
328
508
  name: "UpdateToolInput",
329
509
  description: "Input for updating a tool",
330
510
  fields: {
331
- toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
332
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: true },
333
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
511
+ toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
512
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: true },
513
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
334
514
  status: { type: ToolStatusEnum, isOptional: true },
335
- parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
336
- outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
515
+ parametersSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
516
+ outputSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
337
517
  implementationConfig: {
338
- type: ScalarTypeEnum.JSONObject(),
518
+ type: ScalarTypeEnum2.JSONObject(),
339
519
  isOptional: true
340
520
  },
341
521
  maxInvocationsPerMinute: {
342
- type: ScalarTypeEnum.Int_unsecure(),
522
+ type: ScalarTypeEnum2.Int_unsecure(),
343
523
  isOptional: true
344
524
  },
345
- timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
525
+ timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
346
526
  tags: {
347
- type: ScalarTypeEnum.String_unsecure(),
527
+ type: ScalarTypeEnum2.String_unsecure(),
348
528
  isArray: true,
349
529
  isOptional: true
350
530
  }
@@ -356,14 +536,14 @@ import {
356
536
  defineCommand,
357
537
  defineQuery
358
538
  } from "@contractspec/lib.contracts-spec/operations";
359
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
360
- var OWNERS = ["@agent-console-team"];
539
+ import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
540
+ var OWNERS2 = ["@agent-console-team"];
361
541
  var CreateToolCommand = defineCommand({
362
542
  meta: {
363
543
  key: "agent.tool.create",
364
544
  version: "1.0.0",
365
545
  stability: "stable",
366
- owners: [...OWNERS],
546
+ owners: [...OWNERS2],
367
547
  tags: ["tool", "create"],
368
548
  description: "Creates a new AI tool definition.",
369
549
  goal: "Allow users to define new tools that agents can use.",
@@ -371,12 +551,12 @@ var CreateToolCommand = defineCommand({
371
551
  },
372
552
  io: {
373
553
  input: CreateToolInputModel,
374
- output: defineSchemaModel2({
554
+ output: defineSchemaModel3({
375
555
  name: "CreateToolOutput",
376
556
  fields: {
377
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
378
- name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
379
- slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
557
+ id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
558
+ name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
559
+ slug: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
380
560
  status: { type: ToolStatusEnum, isOptional: false }
381
561
  }
382
562
  }),
@@ -396,7 +576,7 @@ var CreateToolCommand = defineCommand({
396
576
  key: "tool.created",
397
577
  version: "1.0.0",
398
578
  stability: "stable",
399
- owners: [...OWNERS],
579
+ owners: [...OWNERS2],
400
580
  tags: ["tool", "created"],
401
581
  when: "Tool is successfully created",
402
582
  payload: ToolSummaryModel
@@ -443,7 +623,7 @@ var UpdateToolCommand = defineCommand({
443
623
  key: "agent.tool.update",
444
624
  version: "1.0.0",
445
625
  stability: "stable",
446
- owners: [...OWNERS],
626
+ owners: [...OWNERS2],
447
627
  tags: ["tool", "update"],
448
628
  description: "Updates an existing AI tool definition.",
449
629
  goal: "Allow users to modify tool settings and configuration.",
@@ -451,13 +631,13 @@ var UpdateToolCommand = defineCommand({
451
631
  },
452
632
  io: {
453
633
  input: UpdateToolInputModel,
454
- output: defineSchemaModel2({
634
+ output: defineSchemaModel3({
455
635
  name: "UpdateToolOutput",
456
636
  fields: {
457
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
458
- name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
637
+ id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
638
+ name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
459
639
  status: { type: ToolStatusEnum, isOptional: false },
460
- updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
640
+ updatedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
461
641
  }
462
642
  }),
463
643
  errors: {
@@ -476,7 +656,7 @@ var UpdateToolCommand = defineCommand({
476
656
  key: "tool.updated",
477
657
  version: "1.0.0",
478
658
  stability: "stable",
479
- owners: [...OWNERS],
659
+ owners: [...OWNERS2],
480
660
  tags: ["tool", "updated"],
481
661
  when: "Tool is updated",
482
662
  payload: ToolSummaryModel
@@ -512,17 +692,17 @@ var GetToolQuery = defineQuery({
512
692
  key: "agent.tool.get",
513
693
  version: "1.0.0",
514
694
  stability: "stable",
515
- owners: [...OWNERS],
695
+ owners: [...OWNERS2],
516
696
  tags: ["tool", "get"],
517
697
  description: "Retrieves a tool by its ID.",
518
698
  goal: "View detailed tool configuration.",
519
699
  context: "Called when viewing tool details or editing."
520
700
  },
521
701
  io: {
522
- input: defineSchemaModel2({
702
+ input: defineSchemaModel3({
523
703
  name: "GetToolInput",
524
704
  fields: {
525
- toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
705
+ toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
526
706
  }
527
707
  }),
528
708
  output: ToolModel,
@@ -564,41 +744,41 @@ var ListToolsQuery = defineQuery({
564
744
  key: "agent.tool.list",
565
745
  version: "1.0.0",
566
746
  stability: "stable",
567
- owners: [...OWNERS],
747
+ owners: [...OWNERS2],
568
748
  tags: ["tool", "list"],
569
749
  description: "Lists tools for an organization with optional filtering.",
570
750
  goal: "Browse and search available tools.",
571
751
  context: "Tool list/dashboard view."
572
752
  },
573
753
  io: {
574
- input: defineSchemaModel2({
754
+ input: defineSchemaModel3({
575
755
  name: "ListToolsInput",
576
756
  fields: {
577
757
  organizationId: {
578
- type: ScalarTypeEnum2.String_unsecure(),
758
+ type: ScalarTypeEnum3.String_unsecure(),
579
759
  isOptional: false
580
760
  },
581
761
  category: { type: ToolCategoryEnum, isOptional: true },
582
762
  status: { type: ToolStatusEnum, isOptional: true },
583
- search: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
763
+ search: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
584
764
  limit: {
585
- type: ScalarTypeEnum2.Int_unsecure(),
765
+ type: ScalarTypeEnum3.Int_unsecure(),
586
766
  isOptional: true,
587
767
  defaultValue: 20
588
768
  },
589
769
  offset: {
590
- type: ScalarTypeEnum2.Int_unsecure(),
770
+ type: ScalarTypeEnum3.Int_unsecure(),
591
771
  isOptional: true,
592
772
  defaultValue: 0
593
773
  }
594
774
  }
595
775
  }),
596
- output: defineSchemaModel2({
776
+ output: defineSchemaModel3({
597
777
  name: "ListToolsOutput",
598
778
  fields: {
599
779
  items: { type: ToolSummaryModel, isArray: true, isOptional: false },
600
- total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
601
- hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
780
+ total: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
781
+ hasMore: { type: ScalarTypeEnum3.Boolean(), isOptional: false }
602
782
  }
603
783
  })
604
784
  },
@@ -626,27 +806,27 @@ var TestToolCommand = defineCommand({
626
806
  key: "agent.tool.test",
627
807
  version: "1.0.0",
628
808
  stability: "stable",
629
- owners: [...OWNERS],
809
+ owners: [...OWNERS2],
630
810
  tags: ["tool", "test"],
631
811
  description: "Tests a tool with sample input to verify it works correctly.",
632
812
  goal: "Validate tool configuration before deployment.",
633
813
  context: "Tool builder UI - test panel."
634
814
  },
635
815
  io: {
636
- input: defineSchemaModel2({
816
+ input: defineSchemaModel3({
637
817
  name: "TestToolInput",
638
818
  fields: {
639
- toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
640
- testInput: { type: ScalarTypeEnum2.JSONObject(), isOptional: false }
819
+ toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
820
+ testInput: { type: ScalarTypeEnum3.JSONObject(), isOptional: false }
641
821
  }
642
822
  }),
643
- output: defineSchemaModel2({
823
+ output: defineSchemaModel3({
644
824
  name: "TestToolOutput",
645
825
  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 }
826
+ success: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
827
+ output: { type: ScalarTypeEnum3.JSONObject(), isOptional: true },
828
+ error: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
829
+ durationMs: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false }
650
830
  }
651
831
  }),
652
832
  errors: {
@@ -691,190 +871,10 @@ var TestToolCommand = defineCommand({
691
871
  }
692
872
  });
693
873
 
694
- // src/tool/tool.event.ts
695
- import { defineEvent } from "@contractspec/lib.contracts-spec";
696
- import { ScalarTypeEnum as ScalarTypeEnum3, defineSchemaModel as defineSchemaModel3 } 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
874
  // src/tool/tool.presentation.ts
875
875
  import {
876
- StabilityEnum,
877
- definePresentation
876
+ definePresentation,
877
+ StabilityEnum
878
878
  } from "@contractspec/lib.contracts-spec";
879
879
  var ToolListPresentation = definePresentation({
880
880
  meta: {