@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
@@ -216,6 +216,91 @@ async function mockTestToolHandler(input) {
216
216
  };
217
217
  }
218
218
 
219
+ // src/tool/tool.entity.ts
220
+ import {
221
+ defineEntity,
222
+ defineEntityEnum,
223
+ field,
224
+ index
225
+ } from "@contractspec/lib.schema";
226
+ var ToolCategoryEntityEnum = defineEntityEnum({
227
+ name: "ToolCategory",
228
+ values: [
229
+ "RETRIEVAL",
230
+ "COMPUTATION",
231
+ "COMMUNICATION",
232
+ "INTEGRATION",
233
+ "UTILITY",
234
+ "CUSTOM"
235
+ ],
236
+ description: "Category of tool"
237
+ });
238
+ var ToolStatusEntityEnum = defineEntityEnum({
239
+ name: "ToolStatus",
240
+ values: ["DRAFT", "ACTIVE", "DEPRECATED", "DISABLED"],
241
+ description: "Status of tool"
242
+ });
243
+ var ImplementationTypeEntityEnum = defineEntityEnum({
244
+ name: "ImplementationType",
245
+ values: ["http", "function", "workflow"],
246
+ description: "How the tool is implemented"
247
+ });
248
+ var ToolEntity = defineEntity({
249
+ name: "Tool",
250
+ schema: "agent_console",
251
+ description: "An AI tool that can be used by agents.",
252
+ fields: {
253
+ id: field.id(),
254
+ organizationId: field.string({
255
+ description: "Organization that owns this tool"
256
+ }),
257
+ name: field.string({ description: "Tool name" }),
258
+ slug: field.string({ description: "URL-safe identifier" }),
259
+ description: field.string({ description: "Tool description" }),
260
+ category: field.enum("ToolCategory", { default: "CUSTOM" }),
261
+ status: field.enum("ToolStatus", { default: "DRAFT" }),
262
+ parametersSchema: field.json({
263
+ description: "JSON Schema for tool parameters"
264
+ }),
265
+ outputSchema: field.json({
266
+ isOptional: true,
267
+ description: "JSON Schema for tool output"
268
+ }),
269
+ implementationType: field.enum("ImplementationType"),
270
+ implementationConfig: field.json({
271
+ description: "Implementation configuration"
272
+ }),
273
+ maxInvocationsPerMinute: field.int({
274
+ isOptional: true,
275
+ description: "Rate limit"
276
+ }),
277
+ timeoutMs: field.int({ default: 30000, description: "Execution timeout" }),
278
+ version: field.string({ default: "1.0.0", description: "Tool version" }),
279
+ tags: field.string({
280
+ isArray: true,
281
+ isOptional: true,
282
+ description: "Tags for categorization"
283
+ }),
284
+ createdAt: field.createdAt(),
285
+ updatedAt: field.updatedAt(),
286
+ createdById: field.string({
287
+ isOptional: true,
288
+ description: "User who created this tool"
289
+ }),
290
+ agents: field.hasMany("Agent", { description: "Agents using this tool" })
291
+ },
292
+ indexes: [
293
+ index.unique(["organizationId", "slug"]),
294
+ index.on(["organizationId", "category"]),
295
+ index.on(["organizationId", "status"])
296
+ ],
297
+ enums: [
298
+ ToolCategoryEntityEnum,
299
+ ToolStatusEntityEnum,
300
+ ImplementationTypeEntityEnum
301
+ ]
302
+ });
303
+
219
304
  // src/tool/tool.enum.ts
220
305
  import { defineEnum } from "@contractspec/lib.schema";
221
306
  var ToolCategoryEnum = defineEnum("ToolCategory", [
@@ -238,114 +323,209 @@ var ImplementationTypeEnum = defineEnum("ImplementationType", [
238
323
  "workflow"
239
324
  ]);
240
325
 
241
- // src/tool/tool.schema.ts
326
+ // src/tool/tool.event.ts
327
+ import { defineEvent } from "@contractspec/lib.contracts-spec";
242
328
  import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
243
- var ToolModel = defineSchemaModel({
244
- name: "Tool",
245
- description: "AI tool definition",
329
+ var OWNERS = ["@agent-console-team"];
330
+ var ToolCreatedPayload = defineSchemaModel({
331
+ name: "ToolCreatedPayload",
332
+ description: "Payload for tool created event",
246
333
  fields: {
247
334
  id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
248
335
  organizationId: {
249
336
  type: ScalarTypeEnum.String_unsecure(),
250
337
  isOptional: false
251
338
  },
252
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
339
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
253
340
  slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
254
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
341
+ category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
342
+ implementationType: {
343
+ type: ScalarTypeEnum.String_unsecure(),
344
+ isOptional: false
345
+ },
346
+ createdById: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
347
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
348
+ }
349
+ });
350
+ var ToolCreatedEvent = defineEvent({
351
+ meta: {
352
+ key: "agent.tool.created",
353
+ version: "1.0.0",
354
+ description: "A new AI tool was created.",
355
+ stability: "stable",
356
+ owners: [...OWNERS],
357
+ tags: ["tool", "created"]
358
+ },
359
+ payload: ToolCreatedPayload
360
+ });
361
+ var ToolUpdatedPayload = defineSchemaModel({
362
+ name: "ToolUpdatedPayload",
363
+ description: "Payload for tool updated event",
364
+ fields: {
365
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
366
+ organizationId: {
367
+ type: ScalarTypeEnum.String_unsecure(),
368
+ isOptional: false
369
+ },
370
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
371
+ status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
372
+ updatedFields: {
373
+ type: ScalarTypeEnum.String_unsecure(),
374
+ isArray: true,
375
+ isOptional: false
376
+ },
377
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
378
+ }
379
+ });
380
+ var ToolUpdatedEvent = defineEvent({
381
+ meta: {
382
+ key: "agent.tool.updated",
383
+ version: "1.0.0",
384
+ description: "An AI tool configuration was updated.",
385
+ stability: "stable",
386
+ owners: [...OWNERS],
387
+ tags: ["tool", "updated"]
388
+ },
389
+ payload: ToolUpdatedPayload
390
+ });
391
+ var ToolStatusChangedPayload = defineSchemaModel({
392
+ name: "ToolStatusChangedPayload",
393
+ description: "Payload for tool status changed event",
394
+ fields: {
395
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
396
+ organizationId: {
397
+ type: ScalarTypeEnum.String_unsecure(),
398
+ isOptional: false
399
+ },
400
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
401
+ previousStatus: {
402
+ type: ScalarTypeEnum.String_unsecure(),
403
+ isOptional: false
404
+ },
405
+ newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
406
+ changedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
407
+ }
408
+ });
409
+ var ToolStatusChangedEvent = defineEvent({
410
+ meta: {
411
+ key: "agent.tool.statusChanged",
412
+ version: "1.0.0",
413
+ description: "An AI tool status was changed (activated, deprecated, disabled).",
414
+ stability: "stable",
415
+ owners: [...OWNERS],
416
+ tags: ["tool", "status"]
417
+ },
418
+ payload: ToolStatusChangedPayload
419
+ });
420
+
421
+ // src/tool/tool.schema.ts
422
+ import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
423
+ var ToolModel = defineSchemaModel2({
424
+ name: "Tool",
425
+ description: "AI tool definition",
426
+ fields: {
427
+ id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
428
+ organizationId: {
429
+ type: ScalarTypeEnum2.String_unsecure(),
430
+ isOptional: false
431
+ },
432
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
433
+ slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
434
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
255
435
  category: { type: ToolCategoryEnum, isOptional: false },
256
436
  status: { type: ToolStatusEnum, isOptional: false },
257
- parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
258
- outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
437
+ parametersSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: false },
438
+ outputSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
259
439
  implementationType: { type: ImplementationTypeEnum, isOptional: false },
260
440
  implementationConfig: {
261
- type: ScalarTypeEnum.JSONObject(),
441
+ type: ScalarTypeEnum2.JSONObject(),
262
442
  isOptional: false
263
443
  },
264
444
  maxInvocationsPerMinute: {
265
- type: ScalarTypeEnum.Int_unsecure(),
445
+ type: ScalarTypeEnum2.Int_unsecure(),
266
446
  isOptional: true
267
447
  },
268
448
  timeoutMs: {
269
- type: ScalarTypeEnum.Int_unsecure(),
449
+ type: ScalarTypeEnum2.Int_unsecure(),
270
450
  isOptional: false,
271
451
  defaultValue: 30000
272
452
  },
273
- version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
453
+ version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
274
454
  tags: {
275
- type: ScalarTypeEnum.String_unsecure(),
455
+ type: ScalarTypeEnum2.String_unsecure(),
276
456
  isArray: true,
277
457
  isOptional: true
278
458
  },
279
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
280
- updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
459
+ createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
460
+ updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
281
461
  }
282
462
  });
283
- var ToolSummaryModel = defineSchemaModel({
463
+ var ToolSummaryModel = defineSchemaModel2({
284
464
  name: "ToolSummary",
285
465
  description: "Summary of a tool for list views",
286
466
  fields: {
287
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
288
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
289
- slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
290
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
467
+ id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
468
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
469
+ slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
470
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
291
471
  category: { type: ToolCategoryEnum, isOptional: false },
292
472
  status: { type: ToolStatusEnum, isOptional: false },
293
- version: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
294
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
473
+ version: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
474
+ createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
295
475
  }
296
476
  });
297
- var CreateToolInputModel = defineSchemaModel({
477
+ var CreateToolInputModel = defineSchemaModel2({
298
478
  name: "CreateToolInput",
299
479
  description: "Input for creating a tool",
300
480
  fields: {
301
481
  organizationId: {
302
- type: ScalarTypeEnum.String_unsecure(),
482
+ type: ScalarTypeEnum2.String_unsecure(),
303
483
  isOptional: false
304
484
  },
305
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
306
- slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
307
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
485
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
486
+ slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
487
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
308
488
  category: { type: ToolCategoryEnum, isOptional: true },
309
- parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
310
- outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
489
+ parametersSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: false },
490
+ outputSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
311
491
  implementationType: { type: ImplementationTypeEnum, isOptional: false },
312
492
  implementationConfig: {
313
- type: ScalarTypeEnum.JSONObject(),
493
+ type: ScalarTypeEnum2.JSONObject(),
314
494
  isOptional: false
315
495
  },
316
496
  maxInvocationsPerMinute: {
317
- type: ScalarTypeEnum.Int_unsecure(),
497
+ type: ScalarTypeEnum2.Int_unsecure(),
318
498
  isOptional: true
319
499
  },
320
- timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
500
+ timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
321
501
  tags: {
322
- type: ScalarTypeEnum.String_unsecure(),
502
+ type: ScalarTypeEnum2.String_unsecure(),
323
503
  isArray: true,
324
504
  isOptional: true
325
505
  }
326
506
  }
327
507
  });
328
- var UpdateToolInputModel = defineSchemaModel({
508
+ var UpdateToolInputModel = defineSchemaModel2({
329
509
  name: "UpdateToolInput",
330
510
  description: "Input for updating a tool",
331
511
  fields: {
332
- toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
333
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: true },
334
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
512
+ toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
513
+ name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: true },
514
+ description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
335
515
  status: { type: ToolStatusEnum, isOptional: true },
336
- parametersSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
337
- outputSchema: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
516
+ parametersSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
517
+ outputSchema: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
338
518
  implementationConfig: {
339
- type: ScalarTypeEnum.JSONObject(),
519
+ type: ScalarTypeEnum2.JSONObject(),
340
520
  isOptional: true
341
521
  },
342
522
  maxInvocationsPerMinute: {
343
- type: ScalarTypeEnum.Int_unsecure(),
523
+ type: ScalarTypeEnum2.Int_unsecure(),
344
524
  isOptional: true
345
525
  },
346
- timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
526
+ timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
347
527
  tags: {
348
- type: ScalarTypeEnum.String_unsecure(),
528
+ type: ScalarTypeEnum2.String_unsecure(),
349
529
  isArray: true,
350
530
  isOptional: true
351
531
  }
@@ -357,14 +537,14 @@ import {
357
537
  defineCommand,
358
538
  defineQuery
359
539
  } from "@contractspec/lib.contracts-spec/operations";
360
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
361
- var OWNERS = ["@agent-console-team"];
540
+ import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
541
+ var OWNERS2 = ["@agent-console-team"];
362
542
  var CreateToolCommand = defineCommand({
363
543
  meta: {
364
544
  key: "agent.tool.create",
365
545
  version: "1.0.0",
366
546
  stability: "stable",
367
- owners: [...OWNERS],
547
+ owners: [...OWNERS2],
368
548
  tags: ["tool", "create"],
369
549
  description: "Creates a new AI tool definition.",
370
550
  goal: "Allow users to define new tools that agents can use.",
@@ -372,12 +552,12 @@ var CreateToolCommand = defineCommand({
372
552
  },
373
553
  io: {
374
554
  input: CreateToolInputModel,
375
- output: defineSchemaModel2({
555
+ output: defineSchemaModel3({
376
556
  name: "CreateToolOutput",
377
557
  fields: {
378
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
379
- name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
380
- slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
558
+ id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
559
+ name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
560
+ slug: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
381
561
  status: { type: ToolStatusEnum, isOptional: false }
382
562
  }
383
563
  }),
@@ -397,7 +577,7 @@ var CreateToolCommand = defineCommand({
397
577
  key: "tool.created",
398
578
  version: "1.0.0",
399
579
  stability: "stable",
400
- owners: [...OWNERS],
580
+ owners: [...OWNERS2],
401
581
  tags: ["tool", "created"],
402
582
  when: "Tool is successfully created",
403
583
  payload: ToolSummaryModel
@@ -444,7 +624,7 @@ var UpdateToolCommand = defineCommand({
444
624
  key: "agent.tool.update",
445
625
  version: "1.0.0",
446
626
  stability: "stable",
447
- owners: [...OWNERS],
627
+ owners: [...OWNERS2],
448
628
  tags: ["tool", "update"],
449
629
  description: "Updates an existing AI tool definition.",
450
630
  goal: "Allow users to modify tool settings and configuration.",
@@ -452,13 +632,13 @@ var UpdateToolCommand = defineCommand({
452
632
  },
453
633
  io: {
454
634
  input: UpdateToolInputModel,
455
- output: defineSchemaModel2({
635
+ output: defineSchemaModel3({
456
636
  name: "UpdateToolOutput",
457
637
  fields: {
458
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
459
- name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
638
+ id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
639
+ name: { type: ScalarTypeEnum3.NonEmptyString(), isOptional: false },
460
640
  status: { type: ToolStatusEnum, isOptional: false },
461
- updatedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
641
+ updatedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
462
642
  }
463
643
  }),
464
644
  errors: {
@@ -477,7 +657,7 @@ var UpdateToolCommand = defineCommand({
477
657
  key: "tool.updated",
478
658
  version: "1.0.0",
479
659
  stability: "stable",
480
- owners: [...OWNERS],
660
+ owners: [...OWNERS2],
481
661
  tags: ["tool", "updated"],
482
662
  when: "Tool is updated",
483
663
  payload: ToolSummaryModel
@@ -513,17 +693,17 @@ var GetToolQuery = defineQuery({
513
693
  key: "agent.tool.get",
514
694
  version: "1.0.0",
515
695
  stability: "stable",
516
- owners: [...OWNERS],
696
+ owners: [...OWNERS2],
517
697
  tags: ["tool", "get"],
518
698
  description: "Retrieves a tool by its ID.",
519
699
  goal: "View detailed tool configuration.",
520
700
  context: "Called when viewing tool details or editing."
521
701
  },
522
702
  io: {
523
- input: defineSchemaModel2({
703
+ input: defineSchemaModel3({
524
704
  name: "GetToolInput",
525
705
  fields: {
526
- toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
706
+ toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
527
707
  }
528
708
  }),
529
709
  output: ToolModel,
@@ -565,41 +745,41 @@ var ListToolsQuery = defineQuery({
565
745
  key: "agent.tool.list",
566
746
  version: "1.0.0",
567
747
  stability: "stable",
568
- owners: [...OWNERS],
748
+ owners: [...OWNERS2],
569
749
  tags: ["tool", "list"],
570
750
  description: "Lists tools for an organization with optional filtering.",
571
751
  goal: "Browse and search available tools.",
572
752
  context: "Tool list/dashboard view."
573
753
  },
574
754
  io: {
575
- input: defineSchemaModel2({
755
+ input: defineSchemaModel3({
576
756
  name: "ListToolsInput",
577
757
  fields: {
578
758
  organizationId: {
579
- type: ScalarTypeEnum2.String_unsecure(),
759
+ type: ScalarTypeEnum3.String_unsecure(),
580
760
  isOptional: false
581
761
  },
582
762
  category: { type: ToolCategoryEnum, isOptional: true },
583
763
  status: { type: ToolStatusEnum, isOptional: true },
584
- search: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
764
+ search: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
585
765
  limit: {
586
- type: ScalarTypeEnum2.Int_unsecure(),
766
+ type: ScalarTypeEnum3.Int_unsecure(),
587
767
  isOptional: true,
588
768
  defaultValue: 20
589
769
  },
590
770
  offset: {
591
- type: ScalarTypeEnum2.Int_unsecure(),
771
+ type: ScalarTypeEnum3.Int_unsecure(),
592
772
  isOptional: true,
593
773
  defaultValue: 0
594
774
  }
595
775
  }
596
776
  }),
597
- output: defineSchemaModel2({
777
+ output: defineSchemaModel3({
598
778
  name: "ListToolsOutput",
599
779
  fields: {
600
780
  items: { type: ToolSummaryModel, isArray: true, isOptional: false },
601
- total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
602
- hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
781
+ total: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
782
+ hasMore: { type: ScalarTypeEnum3.Boolean(), isOptional: false }
603
783
  }
604
784
  })
605
785
  },
@@ -627,27 +807,27 @@ var TestToolCommand = defineCommand({
627
807
  key: "agent.tool.test",
628
808
  version: "1.0.0",
629
809
  stability: "stable",
630
- owners: [...OWNERS],
810
+ owners: [...OWNERS2],
631
811
  tags: ["tool", "test"],
632
812
  description: "Tests a tool with sample input to verify it works correctly.",
633
813
  goal: "Validate tool configuration before deployment.",
634
814
  context: "Tool builder UI - test panel."
635
815
  },
636
816
  io: {
637
- input: defineSchemaModel2({
817
+ input: defineSchemaModel3({
638
818
  name: "TestToolInput",
639
819
  fields: {
640
- toolId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
641
- testInput: { type: ScalarTypeEnum2.JSONObject(), isOptional: false }
820
+ toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
821
+ testInput: { type: ScalarTypeEnum3.JSONObject(), isOptional: false }
642
822
  }
643
823
  }),
644
- output: defineSchemaModel2({
824
+ output: defineSchemaModel3({
645
825
  name: "TestToolOutput",
646
826
  fields: {
647
- success: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
648
- output: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
649
- error: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
650
- durationMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
827
+ success: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
828
+ output: { type: ScalarTypeEnum3.JSONObject(), isOptional: true },
829
+ error: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
830
+ durationMs: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false }
651
831
  }
652
832
  }),
653
833
  errors: {
@@ -692,190 +872,10 @@ var TestToolCommand = defineCommand({
692
872
  }
693
873
  });
694
874
 
695
- // src/tool/tool.event.ts
696
- import { defineEvent } from "@contractspec/lib.contracts-spec";
697
- import { ScalarTypeEnum as ScalarTypeEnum3, defineSchemaModel as defineSchemaModel3 } from "@contractspec/lib.schema";
698
- var OWNERS2 = ["@agent-console-team"];
699
- var ToolCreatedPayload = defineSchemaModel3({
700
- name: "ToolCreatedPayload",
701
- description: "Payload for tool created event",
702
- fields: {
703
- id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
704
- organizationId: {
705
- type: ScalarTypeEnum3.String_unsecure(),
706
- isOptional: false
707
- },
708
- name: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
709
- slug: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
710
- category: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
711
- implementationType: {
712
- type: ScalarTypeEnum3.String_unsecure(),
713
- isOptional: false
714
- },
715
- createdById: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
716
- createdAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
717
- }
718
- });
719
- var ToolCreatedEvent = defineEvent({
720
- meta: {
721
- key: "agent.tool.created",
722
- version: "1.0.0",
723
- description: "A new AI tool was created.",
724
- stability: "stable",
725
- owners: [...OWNERS2],
726
- tags: ["tool", "created"]
727
- },
728
- payload: ToolCreatedPayload
729
- });
730
- var ToolUpdatedPayload = defineSchemaModel3({
731
- name: "ToolUpdatedPayload",
732
- description: "Payload for tool updated event",
733
- fields: {
734
- id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
735
- organizationId: {
736
- type: ScalarTypeEnum3.String_unsecure(),
737
- isOptional: false
738
- },
739
- name: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
740
- status: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
741
- updatedFields: {
742
- type: ScalarTypeEnum3.String_unsecure(),
743
- isArray: true,
744
- isOptional: false
745
- },
746
- updatedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
747
- }
748
- });
749
- var ToolUpdatedEvent = defineEvent({
750
- meta: {
751
- key: "agent.tool.updated",
752
- version: "1.0.0",
753
- description: "An AI tool configuration was updated.",
754
- stability: "stable",
755
- owners: [...OWNERS2],
756
- tags: ["tool", "updated"]
757
- },
758
- payload: ToolUpdatedPayload
759
- });
760
- var ToolStatusChangedPayload = defineSchemaModel3({
761
- name: "ToolStatusChangedPayload",
762
- description: "Payload for tool status changed event",
763
- fields: {
764
- id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
765
- organizationId: {
766
- type: ScalarTypeEnum3.String_unsecure(),
767
- isOptional: false
768
- },
769
- name: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
770
- previousStatus: {
771
- type: ScalarTypeEnum3.String_unsecure(),
772
- isOptional: false
773
- },
774
- newStatus: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
775
- changedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
776
- }
777
- });
778
- var ToolStatusChangedEvent = defineEvent({
779
- meta: {
780
- key: "agent.tool.statusChanged",
781
- version: "1.0.0",
782
- description: "An AI tool status was changed (activated, deprecated, disabled).",
783
- stability: "stable",
784
- owners: [...OWNERS2],
785
- tags: ["tool", "status"]
786
- },
787
- payload: ToolStatusChangedPayload
788
- });
789
-
790
- // src/tool/tool.entity.ts
791
- import {
792
- defineEntity,
793
- defineEntityEnum,
794
- field,
795
- index
796
- } from "@contractspec/lib.schema";
797
- var ToolCategoryEntityEnum = defineEntityEnum({
798
- name: "ToolCategory",
799
- values: [
800
- "RETRIEVAL",
801
- "COMPUTATION",
802
- "COMMUNICATION",
803
- "INTEGRATION",
804
- "UTILITY",
805
- "CUSTOM"
806
- ],
807
- description: "Category of tool"
808
- });
809
- var ToolStatusEntityEnum = defineEntityEnum({
810
- name: "ToolStatus",
811
- values: ["DRAFT", "ACTIVE", "DEPRECATED", "DISABLED"],
812
- description: "Status of tool"
813
- });
814
- var ImplementationTypeEntityEnum = defineEntityEnum({
815
- name: "ImplementationType",
816
- values: ["http", "function", "workflow"],
817
- description: "How the tool is implemented"
818
- });
819
- var ToolEntity = defineEntity({
820
- name: "Tool",
821
- schema: "agent_console",
822
- description: "An AI tool that can be used by agents.",
823
- fields: {
824
- id: field.id(),
825
- organizationId: field.string({
826
- description: "Organization that owns this tool"
827
- }),
828
- name: field.string({ description: "Tool name" }),
829
- slug: field.string({ description: "URL-safe identifier" }),
830
- description: field.string({ description: "Tool description" }),
831
- category: field.enum("ToolCategory", { default: "CUSTOM" }),
832
- status: field.enum("ToolStatus", { default: "DRAFT" }),
833
- parametersSchema: field.json({
834
- description: "JSON Schema for tool parameters"
835
- }),
836
- outputSchema: field.json({
837
- isOptional: true,
838
- description: "JSON Schema for tool output"
839
- }),
840
- implementationType: field.enum("ImplementationType"),
841
- implementationConfig: field.json({
842
- description: "Implementation configuration"
843
- }),
844
- maxInvocationsPerMinute: field.int({
845
- isOptional: true,
846
- description: "Rate limit"
847
- }),
848
- timeoutMs: field.int({ default: 30000, description: "Execution timeout" }),
849
- version: field.string({ default: "1.0.0", description: "Tool version" }),
850
- tags: field.string({
851
- isArray: true,
852
- isOptional: true,
853
- description: "Tags for categorization"
854
- }),
855
- createdAt: field.createdAt(),
856
- updatedAt: field.updatedAt(),
857
- createdById: field.string({
858
- isOptional: true,
859
- description: "User who created this tool"
860
- }),
861
- agents: field.hasMany("Agent", { description: "Agents using this tool" })
862
- },
863
- indexes: [
864
- index.unique(["organizationId", "slug"]),
865
- index.on(["organizationId", "category"]),
866
- index.on(["organizationId", "status"])
867
- ],
868
- enums: [
869
- ToolCategoryEntityEnum,
870
- ToolStatusEntityEnum,
871
- ImplementationTypeEntityEnum
872
- ]
873
- });
874
-
875
875
  // src/tool/tool.presentation.ts
876
876
  import {
877
- StabilityEnum,
878
- definePresentation
877
+ definePresentation,
878
+ StabilityEnum
879
879
  } from "@contractspec/lib.contracts-spec";
880
880
  var ToolListPresentation = definePresentation({
881
881
  meta: {