@contractspec/example.agent-console 3.7.6 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/.turbo/turbo-build.log +126 -105
  2. package/AGENTS.md +52 -31
  3. package/CHANGELOG.md +29 -0
  4. package/README.md +112 -83
  5. package/dist/agent/agent.event.js +1 -1
  6. package/dist/agent/agent.handler.d.ts +3 -0
  7. package/dist/agent/agent.handler.js +730 -1
  8. package/dist/agent/agent.operation.js +1 -1
  9. package/dist/agent/index.d.ts +5 -5
  10. package/dist/agent/index.js +74 -73
  11. package/dist/agent.feature.js +179 -0
  12. package/dist/browser/agent/agent.event.js +1 -1
  13. package/dist/browser/agent/agent.handler.js +730 -1
  14. package/dist/browser/agent/agent.operation.js +1 -1
  15. package/dist/browser/agent/index.js +74 -73
  16. package/dist/browser/agent.feature.js +179 -0
  17. package/dist/browser/docs/agent-console.docblock.js +11 -8
  18. package/dist/browser/docs/index.js +11 -8
  19. package/dist/browser/example.js +2 -3
  20. package/dist/browser/handlers/agent.handlers.js +1883 -2
  21. package/dist/browser/handlers/index.js +2142 -8
  22. package/dist/browser/index.js +4075 -3161
  23. package/dist/browser/presentations/index.js +51 -51
  24. package/dist/browser/run/index.js +380 -374
  25. package/dist/browser/run/run.event.js +2 -2
  26. package/dist/browser/run/run.handler.js +666 -1
  27. package/dist/browser/run/run.presentation.js +2 -2
  28. package/dist/browser/shared/index.js +293 -1
  29. package/dist/browser/shared/mock-runs.js +5 -0
  30. package/dist/browser/tool/index.js +161 -161
  31. package/dist/browser/tool/tool.event.js +1 -1
  32. package/dist/browser/tool/tool.handler.js +479 -3
  33. package/dist/browser/tool/tool.presentation.js +2 -2
  34. package/dist/browser/ui/AgentDashboard.js +1816 -931
  35. package/dist/browser/ui/AgentDashboard.visualizations.js +217 -0
  36. package/dist/browser/ui/AgentRunList.js +360 -128
  37. package/dist/browser/ui/AgentToolRegistry.js +9 -9
  38. package/dist/browser/ui/hooks/index.js +611 -161
  39. package/dist/browser/ui/hooks/useAgentList.js +1 -1
  40. package/dist/browser/ui/hooks/useAgentMutations.js +444 -9
  41. package/dist/browser/ui/hooks/useRunList.js +26 -11
  42. package/dist/browser/ui/hooks/useToolList.js +1 -1
  43. package/dist/browser/ui/index.js +2161 -1258
  44. package/dist/browser/ui/modals/AgentActionsModal.js +13 -13
  45. package/dist/browser/ui/modals/CreateAgentModal.js +15 -15
  46. package/dist/browser/ui/modals/index.js +297 -297
  47. package/dist/browser/ui/renderers/agent-list.markdown.js +14 -5
  48. package/dist/browser/ui/renderers/agent-list.renderer.js +7 -7
  49. package/dist/browser/ui/renderers/dashboard.markdown.js +207 -36
  50. package/dist/browser/ui/renderers/index.js +359 -163
  51. package/dist/browser/ui/renderers/run-list.markdown.js +9 -4
  52. package/dist/browser/ui/renderers/tool-registry.markdown.js +15 -4
  53. package/dist/browser/ui/views/AgentListView.js +7 -7
  54. package/dist/browser/ui/views/RunDataTable.js +326 -0
  55. package/dist/browser/ui/views/RunListView.js +360 -128
  56. package/dist/browser/ui/views/ToolRegistryView.js +9 -9
  57. package/dist/browser/ui/views/index.js +478 -246
  58. package/dist/browser/ui/views/run-data-table.columns.js +271 -0
  59. package/dist/browser/ui/views/run-list.shared.js +177 -0
  60. package/dist/browser/visualizations/catalog.js +134 -0
  61. package/dist/browser/visualizations/index.js +187 -0
  62. package/dist/browser/visualizations/selectors.js +181 -0
  63. package/dist/docs/agent-console.docblock.js +11 -8
  64. package/dist/docs/index.js +11 -8
  65. package/dist/example.js +2 -3
  66. package/dist/example.test.d.ts +1 -0
  67. package/dist/handlers/agent.handlers.d.ts +2 -0
  68. package/dist/handlers/agent.handlers.js +1883 -2
  69. package/dist/handlers/index.d.ts +2 -4
  70. package/dist/handlers/index.js +2142 -8
  71. package/dist/handlers/mock-handlers.test.d.ts +1 -0
  72. package/dist/index.d.ts +6 -4
  73. package/dist/index.js +4075 -3161
  74. package/dist/node/agent/agent.event.js +1 -1
  75. package/dist/node/agent/agent.handler.js +730 -1
  76. package/dist/node/agent/agent.operation.js +1 -1
  77. package/dist/node/agent/index.js +74 -73
  78. package/dist/node/agent.feature.js +179 -0
  79. package/dist/node/docs/agent-console.docblock.js +11 -8
  80. package/dist/node/docs/index.js +11 -8
  81. package/dist/node/example.js +2 -3
  82. package/dist/node/handlers/agent.handlers.js +1883 -2
  83. package/dist/node/handlers/index.js +2142 -8
  84. package/dist/node/index.js +4075 -3161
  85. package/dist/node/presentations/index.js +51 -51
  86. package/dist/node/run/index.js +380 -374
  87. package/dist/node/run/run.event.js +2 -2
  88. package/dist/node/run/run.handler.js +666 -1
  89. package/dist/node/run/run.presentation.js +2 -2
  90. package/dist/node/shared/index.js +293 -1
  91. package/dist/node/shared/mock-runs.js +5 -0
  92. package/dist/node/tool/index.js +161 -161
  93. package/dist/node/tool/tool.event.js +1 -1
  94. package/dist/node/tool/tool.handler.js +479 -3
  95. package/dist/node/tool/tool.presentation.js +2 -2
  96. package/dist/node/ui/AgentDashboard.js +1816 -931
  97. package/dist/node/ui/AgentDashboard.visualizations.js +217 -0
  98. package/dist/node/ui/AgentRunList.js +360 -128
  99. package/dist/node/ui/AgentToolRegistry.js +9 -9
  100. package/dist/node/ui/hooks/index.js +611 -161
  101. package/dist/node/ui/hooks/useAgentList.js +1 -1
  102. package/dist/node/ui/hooks/useAgentMutations.js +444 -9
  103. package/dist/node/ui/hooks/useRunList.js +26 -11
  104. package/dist/node/ui/hooks/useToolList.js +1 -1
  105. package/dist/node/ui/index.js +2161 -1258
  106. package/dist/node/ui/modals/AgentActionsModal.js +13 -13
  107. package/dist/node/ui/modals/CreateAgentModal.js +15 -15
  108. package/dist/node/ui/modals/index.js +297 -297
  109. package/dist/node/ui/renderers/agent-list.markdown.js +14 -5
  110. package/dist/node/ui/renderers/agent-list.renderer.js +7 -7
  111. package/dist/node/ui/renderers/dashboard.markdown.js +207 -36
  112. package/dist/node/ui/renderers/index.js +359 -163
  113. package/dist/node/ui/renderers/run-list.markdown.js +9 -4
  114. package/dist/node/ui/renderers/tool-registry.markdown.js +15 -4
  115. package/dist/node/ui/views/AgentListView.js +7 -7
  116. package/dist/node/ui/views/RunDataTable.js +326 -0
  117. package/dist/node/ui/views/RunListView.js +360 -128
  118. package/dist/node/ui/views/ToolRegistryView.js +9 -9
  119. package/dist/node/ui/views/index.js +478 -246
  120. package/dist/node/ui/views/run-data-table.columns.js +271 -0
  121. package/dist/node/ui/views/run-list.shared.js +177 -0
  122. package/dist/node/visualizations/catalog.js +134 -0
  123. package/dist/node/visualizations/index.js +187 -0
  124. package/dist/node/visualizations/selectors.js +181 -0
  125. package/dist/presentations/index.d.ts +3 -5
  126. package/dist/presentations/index.js +51 -51
  127. package/dist/proof/index.d.ts +2 -0
  128. package/dist/proof/meetup-proof.d.ts +10 -0
  129. package/dist/proof/meetup-proof.runtime.d.ts +22 -0
  130. package/dist/proof/meetup-proof.scenario.d.ts +2 -0
  131. package/dist/proof/meetup-proof.suite.d.ts +1 -0
  132. package/dist/proof/meetup-proof.test.d.ts +1 -0
  133. package/dist/run/index.d.ts +7 -7
  134. package/dist/run/index.js +380 -374
  135. package/dist/run/run.event.js +2 -2
  136. package/dist/run/run.handler.d.ts +7 -0
  137. package/dist/run/run.handler.js +666 -1
  138. package/dist/run/run.presentation.js +2 -2
  139. package/dist/shared/demo-dashboard-data.d.ts +16 -0
  140. package/dist/shared/demo-runtime-seed.d.ts +17 -0
  141. package/dist/shared/demo-runtime.d.ts +8 -0
  142. package/dist/shared/demo-runtime.test.d.ts +1 -0
  143. package/dist/shared/index.d.ts +4 -1
  144. package/dist/shared/index.js +293 -1
  145. package/dist/shared/mock-runs.d.ts +4 -0
  146. package/dist/shared/mock-runs.js +5 -0
  147. package/dist/tool/index.d.ts +7 -7
  148. package/dist/tool/index.js +161 -161
  149. package/dist/tool/tool.event.js +1 -1
  150. package/dist/tool/tool.handler.d.ts +3 -0
  151. package/dist/tool/tool.handler.js +479 -3
  152. package/dist/tool/tool.presentation.js +2 -2
  153. package/dist/ui/AgentDashboard.js +1816 -931
  154. package/dist/ui/AgentDashboard.sandbox.test.d.ts +1 -0
  155. package/dist/ui/AgentDashboard.visualizations.d.ts +4 -0
  156. package/dist/ui/AgentDashboard.visualizations.js +218 -0
  157. package/dist/ui/AgentRunList.js +360 -128
  158. package/dist/ui/AgentToolRegistry.js +9 -9
  159. package/dist/ui/hooks/index.d.ts +4 -4
  160. package/dist/ui/hooks/index.js +611 -161
  161. package/dist/ui/hooks/useAgentList.d.ts +5 -0
  162. package/dist/ui/hooks/useAgentList.js +1 -1
  163. package/dist/ui/hooks/useAgentMutations.d.ts +9 -2
  164. package/dist/ui/hooks/useAgentMutations.js +444 -9
  165. package/dist/ui/hooks/useRunList.d.ts +13 -2
  166. package/dist/ui/hooks/useRunList.js +26 -11
  167. package/dist/ui/hooks/useToolList.d.ts +5 -0
  168. package/dist/ui/hooks/useToolList.js +1 -1
  169. package/dist/ui/index.d.ts +3 -3
  170. package/dist/ui/index.js +2161 -1258
  171. package/dist/ui/modals/AgentActionsModal.js +13 -13
  172. package/dist/ui/modals/CreateAgentModal.js +15 -15
  173. package/dist/ui/modals/index.d.ts +1 -1
  174. package/dist/ui/modals/index.js +297 -297
  175. package/dist/ui/renderers/agent-list.markdown.d.ts +5 -0
  176. package/dist/ui/renderers/agent-list.markdown.js +14 -5
  177. package/dist/ui/renderers/agent-list.renderer.js +7 -7
  178. package/dist/ui/renderers/dashboard.markdown.d.ts +5 -0
  179. package/dist/ui/renderers/dashboard.markdown.js +207 -36
  180. package/dist/ui/renderers/index.d.ts +2 -2
  181. package/dist/ui/renderers/index.js +359 -163
  182. package/dist/ui/renderers/run-list.markdown.d.ts +5 -0
  183. package/dist/ui/renderers/run-list.markdown.js +9 -4
  184. package/dist/ui/renderers/tool-registry.markdown.d.ts +6 -1
  185. package/dist/ui/renderers/tool-registry.markdown.js +15 -4
  186. package/dist/ui/views/AgentListView.js +7 -7
  187. package/dist/ui/views/RunDataTable.d.ts +18 -0
  188. package/dist/ui/views/RunDataTable.js +327 -0
  189. package/dist/ui/views/RunListView.js +360 -128
  190. package/dist/ui/views/ToolRegistryView.js +9 -9
  191. package/dist/ui/views/index.js +478 -246
  192. package/dist/ui/views/run-data-table.columns.d.ts +3 -0
  193. package/dist/ui/views/run-data-table.columns.js +272 -0
  194. package/dist/ui/views/run-list.shared.d.ts +14 -0
  195. package/dist/ui/views/run-list.shared.js +178 -0
  196. package/dist/visualizations/catalog.d.ts +10 -0
  197. package/dist/visualizations/catalog.js +135 -0
  198. package/dist/visualizations/index.d.ts +2 -0
  199. package/dist/visualizations/index.js +188 -0
  200. package/dist/visualizations/selectors.d.ts +3 -0
  201. package/dist/visualizations/selectors.js +182 -0
  202. package/dist/visualizations/selectors.test.d.ts +1 -0
  203. package/package.json +114 -12
  204. package/proofs/agent-console-meetup.replay.json +220 -0
  205. package/src/agent/agent.entity.ts +111 -111
  206. package/src/agent/agent.enum.ts +12 -12
  207. package/src/agent/agent.event.ts +91 -91
  208. package/src/agent/agent.handler.ts +144 -127
  209. package/src/agent/agent.operation.ts +400 -400
  210. package/src/agent/agent.presentation.ts +62 -62
  211. package/src/agent/agent.schema.ts +175 -175
  212. package/src/agent/agent.test-spec.ts +48 -48
  213. package/src/agent/index.ts +46 -51
  214. package/src/agent.capability.ts +11 -11
  215. package/src/agent.feature.ts +134 -131
  216. package/src/docs/agent-console.docblock.ts +52 -49
  217. package/src/example.test.ts +75 -0
  218. package/src/example.ts +34 -35
  219. package/src/handlers/agent.handlers.ts +576 -522
  220. package/src/handlers/index.ts +30 -14
  221. package/src/handlers/mock-handlers.test.ts +77 -0
  222. package/src/index.ts +10 -9
  223. package/src/presentations/index.ts +11 -13
  224. package/src/proof/index.ts +2 -0
  225. package/src/proof/meetup-proof.runtime.ts +196 -0
  226. package/src/proof/meetup-proof.scenario.ts +99 -0
  227. package/src/proof/meetup-proof.suite.ts +29 -0
  228. package/src/proof/meetup-proof.test.ts +28 -0
  229. package/src/proof/meetup-proof.ts +130 -0
  230. package/src/run/index.ts +49 -54
  231. package/src/run/run.entity.ts +137 -137
  232. package/src/run/run.enum.ts +18 -18
  233. package/src/run/run.event.ts +174 -174
  234. package/src/run/run.handler.ts +113 -96
  235. package/src/run/run.operation.ts +474 -474
  236. package/src/run/run.presentation.ts +42 -42
  237. package/src/run/run.schema.ts +126 -126
  238. package/src/run/run.test-spec.ts +48 -48
  239. package/src/seeders/index.ts +21 -21
  240. package/src/shared/demo-dashboard-data.ts +58 -0
  241. package/src/shared/demo-runtime-seed.ts +139 -0
  242. package/src/shared/demo-runtime.test.ts +169 -0
  243. package/src/shared/demo-runtime.ts +260 -0
  244. package/src/shared/index.ts +12 -1
  245. package/src/shared/mock-agents.ts +76 -76
  246. package/src/shared/mock-runs.ts +107 -102
  247. package/src/shared/mock-tools.ts +140 -140
  248. package/src/shared/overlay-types.ts +23 -23
  249. package/src/tool/index.ts +39 -44
  250. package/src/tool/tool.entity.ts +73 -73
  251. package/src/tool/tool.enum.ts +13 -13
  252. package/src/tool/tool.event.ts +80 -80
  253. package/src/tool/tool.handler.ts +124 -107
  254. package/src/tool/tool.operation.ts +328 -328
  255. package/src/tool/tool.presentation.ts +43 -43
  256. package/src/tool/tool.schema.ts +106 -106
  257. package/src/tool/tool.test-spec.ts +48 -48
  258. package/src/ui/AgentDashboard.sandbox.test.tsx +312 -0
  259. package/src/ui/AgentDashboard.tsx +351 -348
  260. package/src/ui/AgentDashboard.visualizations.tsx +35 -0
  261. package/src/ui/hooks/index.ts +7 -7
  262. package/src/ui/hooks/useAgentList.ts +57 -56
  263. package/src/ui/hooks/useAgentMutations.ts +168 -159
  264. package/src/ui/hooks/useRunList.ts +90 -57
  265. package/src/ui/hooks/useToolList.ts +102 -101
  266. package/src/ui/index.ts +6 -9
  267. package/src/ui/modals/AgentActionsModal.tsx +262 -262
  268. package/src/ui/modals/CreateAgentModal.tsx +232 -232
  269. package/src/ui/modals/index.ts +1 -1
  270. package/src/ui/overlays/demo-overlays.ts +52 -52
  271. package/src/ui/renderers/agent-list.markdown.ts +81 -61
  272. package/src/ui/renderers/agent-list.renderer.tsx +14 -14
  273. package/src/ui/renderers/dashboard.markdown.ts +135 -139
  274. package/src/ui/renderers/index.ts +3 -4
  275. package/src/ui/renderers/run-list.markdown.ts +56 -47
  276. package/src/ui/renderers/tool-registry.markdown.ts +79 -66
  277. package/src/ui/views/AgentListView.tsx +90 -90
  278. package/src/ui/views/RunDataTable.tsx +74 -0
  279. package/src/ui/views/RunListView.tsx +84 -158
  280. package/src/ui/views/ToolRegistryView.tsx +113 -113
  281. package/src/ui/views/run-data-table.columns.tsx +102 -0
  282. package/src/ui/views/run-list.shared.tsx +139 -0
  283. package/src/visualizations/catalog.ts +132 -0
  284. package/src/visualizations/index.ts +2 -0
  285. package/src/visualizations/selectors.test.ts +12 -0
  286. package/src/visualizations/selectors.ts +70 -0
  287. package/tsconfig.json +7 -8
  288. package/tsdown.config.js +24 -3
@@ -1,30 +1,46 @@
1
1
  /**
2
2
  * Agent Console Handlers - re-exports from domain modules for backward compatibility.
3
3
  */
4
+ import {
5
+ CreateAgentCommand,
6
+ ListAgentsQuery,
7
+ UpdateAgentCommand,
8
+ } from '../agent/agent.operation';
9
+ import { ExecuteAgentCommand, ListRunsQuery } from '../run/run.operation';
10
+ import { ListToolsQuery } from '../tool/tool.operation';
11
+
12
+ const HANDLER_BARREL_CONTRACTS = [
13
+ CreateAgentCommand,
14
+ ListAgentsQuery,
15
+ UpdateAgentCommand,
16
+ ExecuteAgentCommand,
17
+ ListRunsQuery,
18
+ ListToolsQuery,
19
+ ] as const;
20
+ void HANDLER_BARREL_CONTRACTS;
4
21
 
5
22
  // Agent handlers and types
6
23
  export {
7
- mockCreateAgentHandler,
8
- mockGetAgentHandler,
9
- mockListAgentsHandler,
10
- type AgentSummary,
24
+ type AgentSummary,
25
+ mockCreateAgentHandler,
26
+ mockGetAgentHandler,
27
+ mockListAgentsHandler,
11
28
  } from '../agent/agent.handler';
12
29
 
13
30
  // Run handlers and types
14
31
  export {
15
- mockExecuteAgentHandler,
16
- mockGetRunHandler,
17
- mockListRunsHandler,
18
- type RunSummary,
32
+ mockExecuteAgentHandler,
33
+ mockGetRunHandler,
34
+ mockListRunsHandler,
35
+ type RunSummary,
19
36
  } from '../run/run.handler';
20
-
37
+ export { createAgentConsoleDemoHandlers } from '../shared/demo-runtime';
21
38
  // Tool handlers and types
22
39
  export {
23
- mockCreateToolHandler,
24
- mockGetToolHandler,
25
- mockListToolsHandler,
26
- type ToolSummary,
40
+ mockCreateToolHandler,
41
+ mockGetToolHandler,
42
+ mockListToolsHandler,
43
+ type ToolSummary,
27
44
  } from '../tool/tool.handler';
28
-
29
45
  // Runtime handlers (PGLite)
30
46
  export * from './agent.handlers';
@@ -0,0 +1,77 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import { mockCreateAgentHandler } from '../agent/agent.handler';
3
+ import { mockExecuteAgentHandler } from '../run/run.handler';
4
+ import {
5
+ mockCreateToolHandler,
6
+ mockTestToolHandler,
7
+ } from '../tool/tool.handler';
8
+
9
+ function numericSuffix(value: string): number {
10
+ const suffix = value.split('-').at(-1);
11
+ if (!suffix) {
12
+ throw new Error(`Missing numeric suffix in ${value}.`);
13
+ }
14
+ return Number.parseInt(suffix, 10);
15
+ }
16
+
17
+ describe('agent-console mock handlers', () => {
18
+ it('allocates monotonic mock agent and tool ids', async () => {
19
+ const createdAgentA = await mockCreateAgentHandler({
20
+ organizationId: 'demo-org',
21
+ name: 'Meetup Mock Agent A',
22
+ slug: 'meetup-mock-agent-a',
23
+ modelProvider: 'OPENAI',
24
+ modelName: 'gpt-5.4',
25
+ systemPrompt: 'Keep responses stable.',
26
+ });
27
+ const createdAgentB = await mockCreateAgentHandler({
28
+ organizationId: 'demo-org',
29
+ name: 'Meetup Mock Agent B',
30
+ slug: 'meetup-mock-agent-b',
31
+ modelProvider: 'OPENAI',
32
+ modelName: 'gpt-5.4',
33
+ systemPrompt: 'Keep responses stable.',
34
+ });
35
+ const createdToolA = await mockCreateToolHandler({
36
+ organizationId: 'demo-org',
37
+ name: 'Meetup Tool A',
38
+ slug: 'meetup-tool-a',
39
+ description: 'First deterministic tool.',
40
+ implementationType: 'function',
41
+ });
42
+ const createdToolB = await mockCreateToolHandler({
43
+ organizationId: 'demo-org',
44
+ name: 'Meetup Tool B',
45
+ slug: 'meetup-tool-b',
46
+ description: 'Second deterministic tool.',
47
+ implementationType: 'function',
48
+ });
49
+
50
+ expect(numericSuffix(createdAgentB.id)).toBe(
51
+ numericSuffix(createdAgentA.id) + 1
52
+ );
53
+ expect(numericSuffix(createdToolB.id)).toBe(
54
+ numericSuffix(createdToolA.id) + 1
55
+ );
56
+ });
57
+
58
+ it('allocates monotonic run ids and returns a stable tool test duration', async () => {
59
+ const firstRun = await mockExecuteAgentHandler({
60
+ agentId: 'agent-1',
61
+ input: { message: 'First run' },
62
+ });
63
+ const secondRun = await mockExecuteAgentHandler({
64
+ agentId: 'agent-1',
65
+ input: { message: 'Second run' },
66
+ });
67
+ const toolResult = await mockTestToolHandler({
68
+ toolId: 'tool-1',
69
+ testInput: { query: 'stable duration' },
70
+ });
71
+
72
+ expect(numericSuffix(secondRun.runId)).toBe(
73
+ numericSuffix(firstRun.runId) + 1
74
+ );
75
+ expect(toolResult.durationMs).toBe(100);
76
+ });
77
+ });
package/src/index.ts CHANGED
@@ -17,16 +17,17 @@
17
17
 
18
18
  // Domain exports
19
19
  export * from './agent';
20
- export * from './run';
21
- export * from './tool';
22
- export * from './shared';
23
- export * from './ui';
24
- export {
25
- createAgentHandlers,
26
- type AgentHandlers,
27
- } from './handlers/agent.handlers';
28
-
29
20
  // Feature spec export
30
21
  export * from './agent.feature';
31
22
  export { default as example } from './example';
23
+ export {
24
+ type AgentHandlers,
25
+ createAgentHandlers,
26
+ } from './handlers/agent.handlers';
27
+ export * from './proof';
28
+ export * from './run';
29
+ export * from './shared';
30
+ export * from './tool';
31
+ export * from './ui';
32
+ export * from './visualizations';
32
33
  import './docs';
@@ -4,23 +4,21 @@
4
4
 
5
5
  // Agent presentations
6
6
  export {
7
- AgentListPresentation,
8
- AgentDetailPresentation,
9
- AgentConsoleDashboardPresentation,
7
+ AgentConsoleDashboardPresentation,
8
+ AgentDetailPresentation,
9
+ AgentListPresentation,
10
10
  } from '../agent/agent.presentation';
11
-
12
11
  // Run presentations
12
+ // Alias: RunMetricsPresentation -> RunDetailPresentation (for backward compatibility)
13
13
  export {
14
- RunListPresentation,
15
- RunDetailPresentation,
14
+ RunDetailPresentation,
15
+ RunDetailPresentation as RunMetricsPresentation,
16
+ RunListPresentation,
16
17
  } from '../run/run.presentation';
17
- // Alias: RunMetricsPresentation -> RunDetailPresentation (for backward compatibility)
18
- export { RunDetailPresentation as RunMetricsPresentation } from '../run/run.presentation';
19
-
20
18
  // Tool presentations
19
+ // Alias: ToolRegistryPresentation -> ToolListPresentation (for backward compatibility)
21
20
  export {
22
- ToolListPresentation,
23
- ToolDetailPresentation,
21
+ ToolDetailPresentation,
22
+ ToolListPresentation,
23
+ ToolListPresentation as ToolRegistryPresentation,
24
24
  } from '../tool/tool.presentation';
25
- // Alias: ToolRegistryPresentation -> ToolListPresentation (for backward compatibility)
26
- export { ToolListPresentation as ToolRegistryPresentation } from '../tool/tool.presentation';
@@ -0,0 +1,2 @@
1
+ export * from './meetup-proof.scenario';
2
+ export * from './meetup-proof.suite';
@@ -0,0 +1,196 @@
1
+ import type {
2
+ HarnessArtifactQuery,
3
+ HarnessArtifactStore,
4
+ HarnessExecutionAdapter,
5
+ HarnessStoredArtifact,
6
+ } from '@contractspec/lib.harness';
7
+ import type { AgentHandlers, Run } from '../handlers/agent.handlers';
8
+ import { getAgentConsoleDashboardData } from '../shared/demo-dashboard-data';
9
+ import { MEETUP_AGENT_NAME } from './meetup-proof.scenario';
10
+
11
+ export class MemoryArtifactStore implements HarnessArtifactStore {
12
+ private readonly items: HarnessStoredArtifact[] = [];
13
+
14
+ async put(artifact: HarnessStoredArtifact) {
15
+ this.items.push(artifact);
16
+ return artifact;
17
+ }
18
+
19
+ async get(artifactId: string) {
20
+ return this.items.find((artifact) => artifact.artifactId === artifactId);
21
+ }
22
+
23
+ async list(query: HarnessArtifactQuery = {}) {
24
+ return this.items.filter((artifact) => {
25
+ if (query.runId && artifact.runId !== query.runId) return false;
26
+ if (query.stepId && artifact.stepId !== query.stepId) return false;
27
+ if (query.kind && artifact.kind !== query.kind) return false;
28
+ return true;
29
+ });
30
+ }
31
+ }
32
+
33
+ export function createProofNow() {
34
+ let tick = 0;
35
+ const base = Date.parse('2026-03-20T09:30:00.000Z');
36
+ return () => new Date(base + tick++ * 60_000);
37
+ }
38
+
39
+ export function createProofIdFactory(prefix: string) {
40
+ let index = 0;
41
+ return () => `${prefix}-${++index}`;
42
+ }
43
+
44
+ export function createMeetupEntityIdFactory() {
45
+ const counters = { agent: 0, run: 0 };
46
+ return (kind: 'agent' | 'run') => `${kind}-meetup-${++counters[kind]}`;
47
+ }
48
+
49
+ interface MeetupExecutionState {
50
+ agentId: string;
51
+ runId: string;
52
+ }
53
+
54
+ function buildRunSummary(run: Run) {
55
+ return {
56
+ status: 'completed' as const,
57
+ summary: `Executed ${run.agentName} and completed ${run.id}.`,
58
+ output: {
59
+ runId: run.id,
60
+ status: run.status,
61
+ totalTokens: run.totalTokens,
62
+ },
63
+ artifacts: [
64
+ {
65
+ kind: 'step-summary' as const,
66
+ summary: `Completed ${run.id} for ${run.agentName}`,
67
+ },
68
+ ],
69
+ };
70
+ }
71
+
72
+ export function createMeetupProofAdapter(input: {
73
+ handlers: AgentHandlers;
74
+ projectId: string;
75
+ organizationId: string;
76
+ state: MeetupExecutionState;
77
+ }): HarnessExecutionAdapter {
78
+ return {
79
+ mode: 'code-execution',
80
+ supports: () => true,
81
+ execute: async ({ step }) => {
82
+ const { handlers, projectId, organizationId, state } = input;
83
+ switch (step.key) {
84
+ case 'open-dashboard': {
85
+ const dashboard = await getAgentConsoleDashboardData(handlers, {
86
+ projectId,
87
+ organizationId,
88
+ });
89
+ return {
90
+ status: 'completed',
91
+ summary: `Seeded dashboard ready with ${dashboard.summary.totalAgents} agents, ${dashboard.summary.totalTools} tools, and ${dashboard.summary.totalRuns} runs.`,
92
+ output: {
93
+ agentCount: dashboard.summary.totalAgents,
94
+ runCount: dashboard.summary.totalRuns,
95
+ toolCount: dashboard.summary.totalTools,
96
+ },
97
+ artifacts: [
98
+ {
99
+ kind: 'step-summary',
100
+ summary: `Seeded dashboard agents=${dashboard.summary.totalAgents} tools=${dashboard.summary.totalTools} runs=${dashboard.summary.totalRuns}`,
101
+ },
102
+ ],
103
+ };
104
+ }
105
+ case 'create-agent': {
106
+ const agent = await handlers.createAgent(
107
+ {
108
+ name: MEETUP_AGENT_NAME,
109
+ description:
110
+ 'Offline-safe walkthrough agent for the Paris meetup.',
111
+ systemPrompt:
112
+ 'Demonstrate the deterministic ContractSpec meetup flow.',
113
+ },
114
+ { projectId, organizationId }
115
+ );
116
+ state.agentId = agent.id;
117
+ return {
118
+ status: 'completed',
119
+ summary: `Created ${agent.name} as ${agent.id}.`,
120
+ output: {
121
+ agentId: agent.id,
122
+ status: agent.status,
123
+ },
124
+ artifacts: [
125
+ {
126
+ kind: 'step-summary',
127
+ summary: `Created ${agent.name} (${agent.id})`,
128
+ },
129
+ ],
130
+ };
131
+ }
132
+ case 'activate-agent': {
133
+ const agent = await handlers.updateAgent({
134
+ id: state.agentId,
135
+ status: 'ACTIVE',
136
+ });
137
+ return {
138
+ status: 'completed',
139
+ summary: `Activated ${agent.name}.`,
140
+ output: {
141
+ agentId: agent.id,
142
+ status: agent.status,
143
+ },
144
+ artifacts: [
145
+ {
146
+ kind: 'step-summary',
147
+ summary: `Activated ${agent.name}`,
148
+ },
149
+ ],
150
+ };
151
+ }
152
+ case 'execute-agent': {
153
+ const run = await handlers.executeAgent({
154
+ agentId: state.agentId,
155
+ message: 'Summarize the meetup proof lane.',
156
+ context: { projectId, organizationId },
157
+ });
158
+ state.runId = run.id;
159
+ return buildRunSummary(run);
160
+ }
161
+ case 'inspect-dashboard': {
162
+ const [dashboard, metrics] = await Promise.all([
163
+ getAgentConsoleDashboardData(handlers, {
164
+ projectId,
165
+ organizationId,
166
+ }),
167
+ handlers.getRunMetrics({ projectId }),
168
+ ]);
169
+ return {
170
+ status: 'completed',
171
+ summary: `${MEETUP_AGENT_NAME} is visible with ${dashboard.summary.totalAgents} agents and ${dashboard.summary.totalRuns} runs.`,
172
+ output: {
173
+ agentCount: dashboard.summary.totalAgents,
174
+ runCount: dashboard.summary.totalRuns,
175
+ toolCount: dashboard.summary.totalTools,
176
+ latestAgentName: dashboard.agents[0]?.name ?? null,
177
+ latestRunId: dashboard.runs[0]?.id ?? null,
178
+ successRate: metrics.successRate,
179
+ },
180
+ artifacts: [
181
+ {
182
+ kind: 'step-summary',
183
+ summary: `Final dashboard agents=${dashboard.summary.totalAgents} runs=${dashboard.summary.totalRuns}`,
184
+ },
185
+ ],
186
+ };
187
+ }
188
+ default:
189
+ return {
190
+ status: 'failed',
191
+ summary: `Unknown meetup proof step ${step.key}.`,
192
+ };
193
+ }
194
+ },
195
+ };
196
+ }
@@ -0,0 +1,99 @@
1
+ import { defineHarnessScenario } from '@contractspec/lib.contracts-spec';
2
+ import { MOCK_AGENTS } from '../shared/mock-agents';
3
+ import { MOCK_RUNS } from '../shared/mock-runs';
4
+ import { MOCK_TOOLS } from '../shared/mock-tools';
5
+
6
+ export const MEETUP_AGENT_NAME = 'Paris Meetup Demo Agent';
7
+ const SEEDED_COMPLETED_RUNS = MOCK_RUNS.filter(
8
+ (run) => run.status === 'COMPLETED'
9
+ ).length;
10
+ const SUCCESS_RATE_AFTER_MEETUP_EXECUTION =
11
+ (SEEDED_COMPLETED_RUNS + 1) / (MOCK_RUNS.length + 1);
12
+
13
+ export const AGENT_CONSOLE_MEETUP_PROOF_SCENARIO = defineHarnessScenario({
14
+ meta: {
15
+ key: 'agent-console.meetup.proof',
16
+ version: '1.0.0',
17
+ title: 'Agent console meetup proof',
18
+ description:
19
+ 'Verifies the deterministic autonomous-agent walkthrough end-to-end.',
20
+ domain: 'agent-console',
21
+ owners: ['@agent-console-team'],
22
+ tags: ['meetup', 'proof', 'autonomous-agents'],
23
+ stability: 'experimental',
24
+ },
25
+ target: {
26
+ allowlistedDomains: ['sandbox.contractspec.local'],
27
+ isolation: 'sandbox',
28
+ },
29
+ allowedModes: ['code-execution'],
30
+ steps: [
31
+ {
32
+ key: 'open-dashboard',
33
+ description: 'Inspect seeded dashboard state',
34
+ actionClass: 'code-exec-read',
35
+ intent:
36
+ 'Confirm the local demo starts with seeded agents, tools, and runs.',
37
+ },
38
+ {
39
+ key: 'create-agent',
40
+ description: 'Create the meetup demo agent',
41
+ actionClass: 'code-exec-mutate',
42
+ intent: 'Add a new agent for the walkthrough.',
43
+ mutatesState: true,
44
+ },
45
+ {
46
+ key: 'activate-agent',
47
+ description: 'Activate the meetup demo agent',
48
+ actionClass: 'code-exec-mutate',
49
+ intent: 'Move the new agent into an executable state.',
50
+ mutatesState: true,
51
+ },
52
+ {
53
+ key: 'execute-agent',
54
+ description: 'Run the meetup demo agent',
55
+ actionClass: 'code-exec-mutate',
56
+ intent: 'Create a deterministic completed run.',
57
+ mutatesState: true,
58
+ },
59
+ {
60
+ key: 'inspect-dashboard',
61
+ description: 'Confirm dashboard totals after execution',
62
+ actionClass: 'code-exec-read',
63
+ intent: 'Verify the new agent and run are visible in the demo state.',
64
+ },
65
+ ],
66
+ assertions: [
67
+ {
68
+ key: 'captured-step-summaries',
69
+ type: 'count',
70
+ source: 'step-summary',
71
+ match: 5,
72
+ },
73
+ {
74
+ key: 'execution-completed',
75
+ type: 'step-status',
76
+ source: 'execute-agent',
77
+ match: 'completed',
78
+ },
79
+ {
80
+ key: 'final-summary-mentions-meetup-agent',
81
+ type: 'text-match',
82
+ source: 'inspect-dashboard',
83
+ match: MEETUP_AGENT_NAME,
84
+ },
85
+ {
86
+ key: 'final-dashboard-shape',
87
+ type: 'json-match',
88
+ source: 'inspect-dashboard',
89
+ match: {
90
+ agentCount: MOCK_AGENTS.length + 1,
91
+ runCount: MOCK_RUNS.length + 1,
92
+ toolCount: MOCK_TOOLS.length,
93
+ latestAgentName: MEETUP_AGENT_NAME,
94
+ latestRunId: 'run-meetup-1',
95
+ successRate: SUCCESS_RATE_AFTER_MEETUP_EXECUTION,
96
+ },
97
+ },
98
+ ],
99
+ });
@@ -0,0 +1,29 @@
1
+ import { defineHarnessSuite } from '@contractspec/lib.contracts-spec';
2
+ import { AGENT_CONSOLE_MEETUP_PROOF_SCENARIO } from './meetup-proof.scenario';
3
+
4
+ export const AgentConsoleMeetupProofSuite = defineHarnessSuite({
5
+ meta: {
6
+ key: 'agent-console.meetup.proof-suite',
7
+ version: '1.0.0',
8
+ title: 'Agent console meetup proof suite',
9
+ description:
10
+ 'Bundles the deterministic meetup walkthrough into a reusable harness suite.',
11
+ domain: 'agent-console',
12
+ owners: ['@agent-console-team'],
13
+ tags: ['meetup', 'proof', 'harness-suite'],
14
+ stability: 'experimental',
15
+ },
16
+ summary:
17
+ 'Runs the canonical agent-console meetup scenario and validates the final dashboard evidence.',
18
+ tags: ['agent-console', 'meetup', 'proof'],
19
+ scenarios: [
20
+ {
21
+ scenario: {
22
+ key: AGENT_CONSOLE_MEETUP_PROOF_SCENARIO.meta.key,
23
+ version: AGENT_CONSOLE_MEETUP_PROOF_SCENARIO.meta.version,
24
+ },
25
+ required: true,
26
+ weight: 1,
27
+ },
28
+ ],
29
+ });
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import { summarizeHarnessReplayBundle } from '@contractspec/lib.harness';
3
+ import { runAgentConsoleMeetupProof } from './meetup-proof';
4
+ import { AGENT_CONSOLE_MEETUP_PROOF_SCENARIO } from './meetup-proof.scenario';
5
+
6
+ describe('agent-console meetup proof', () => {
7
+ it('runs the canonical walkthrough and generates a replay bundle', async () => {
8
+ const result = await runAgentConsoleMeetupProof();
9
+ const summary = summarizeHarnessReplayBundle(result.replayBundle);
10
+
11
+ expect(result.evaluation.status).toBe('passed');
12
+ expect(
13
+ result.evaluation.assertions.every((item) => item.status === 'passed')
14
+ ).toBe(true);
15
+ expect(result.evaluation.run.scenarioKey).toBe(
16
+ AGENT_CONSOLE_MEETUP_PROOF_SCENARIO.meta.key
17
+ );
18
+ expect(result.replayUri).toBe('memory://agent-console-meetup-proof');
19
+ expect(summary.status).toBe('completed');
20
+ expect(summary.stepCount).toBe(
21
+ AGENT_CONSOLE_MEETUP_PROOF_SCENARIO.steps.length
22
+ );
23
+ expect(summary.artifactCount).toBe(
24
+ AGENT_CONSOLE_MEETUP_PROOF_SCENARIO.steps.length
25
+ );
26
+ expect(summary.failedAssertions).toBe(0);
27
+ });
28
+ });
@@ -0,0 +1,130 @@
1
+ import {
2
+ HarnessEvaluationRunner,
3
+ type HarnessReplayBundle,
4
+ type HarnessReplaySink,
5
+ HarnessRunner,
6
+ } from '@contractspec/lib.harness';
7
+ import { createAgentConsoleDemoHandlers } from '../shared/demo-runtime';
8
+ import {
9
+ AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
10
+ AGENT_CONSOLE_DEMO_PROJECT_ID,
11
+ } from '../shared/demo-runtime-seed';
12
+ import {
13
+ createMeetupEntityIdFactory,
14
+ createMeetupProofAdapter,
15
+ createProofIdFactory,
16
+ createProofNow,
17
+ MemoryArtifactStore,
18
+ } from './meetup-proof.runtime';
19
+ import { AGENT_CONSOLE_MEETUP_PROOF_SCENARIO } from './meetup-proof.scenario';
20
+
21
+ function isHarnessReplayBundle(value: unknown): value is HarnessReplayBundle {
22
+ return (
23
+ typeof value === 'object' &&
24
+ value !== null &&
25
+ 'version' in value &&
26
+ 'run' in value &&
27
+ 'assertions' in value &&
28
+ 'artifacts' in value
29
+ );
30
+ }
31
+
32
+ export async function runAgentConsoleMeetupProof(input?: {
33
+ projectId?: string;
34
+ organizationId?: string;
35
+ replaySink?: HarnessReplaySink;
36
+ }) {
37
+ const projectId = input?.projectId ?? AGENT_CONSOLE_DEMO_PROJECT_ID;
38
+ const organizationId =
39
+ input?.organizationId ?? AGENT_CONSOLE_DEMO_ORGANIZATION_ID;
40
+ const harnessNow = createProofNow();
41
+ const handlers = createAgentConsoleDemoHandlers({
42
+ projectId,
43
+ organizationId,
44
+ now: createProofNow(),
45
+ idFactory: createMeetupEntityIdFactory(),
46
+ });
47
+ const executionState = {
48
+ agentId: '',
49
+ runId: '',
50
+ };
51
+ const artifactStore = new MemoryArtifactStore();
52
+ const replayUris: string[] = [];
53
+ let replayBundle: HarnessReplayBundle | null = null;
54
+ const adapter = createMeetupProofAdapter({
55
+ handlers,
56
+ projectId,
57
+ organizationId,
58
+ state: executionState,
59
+ });
60
+
61
+ const replaySink: HarnessReplaySink = {
62
+ async save(bundle: unknown) {
63
+ if (!isHarnessReplayBundle(bundle)) {
64
+ throw new Error('Replay sink received an invalid harness bundle.');
65
+ }
66
+ replayBundle = bundle;
67
+ const delegatedUri = await input?.replaySink?.save(bundle);
68
+ const uri = delegatedUri ?? 'memory://agent-console-meetup-proof';
69
+ replayUris.push(uri);
70
+ return uri;
71
+ },
72
+ };
73
+
74
+ const runner = new HarnessRunner({
75
+ targetResolver: {
76
+ async resolve() {
77
+ return {
78
+ targetId: 'sandbox-agent-console',
79
+ kind: 'sandbox',
80
+ isolation: 'sandbox',
81
+ environment: 'local',
82
+ baseUrl: 'https://sandbox.contractspec.local/agent-console',
83
+ allowlistedDomains: ['sandbox.contractspec.local'],
84
+ };
85
+ },
86
+ },
87
+ artifactStore,
88
+ adapters: [adapter],
89
+ approvalGateway: {
90
+ async approve() {
91
+ return { approved: true, approverId: 'meetup-proof' };
92
+ },
93
+ },
94
+ now: harnessNow,
95
+ idFactory: createProofIdFactory('proof'),
96
+ defaultMode: 'code-execution',
97
+ });
98
+ const evaluationRunner = new HarnessEvaluationRunner({
99
+ runner,
100
+ replaySink,
101
+ now: harnessNow,
102
+ idFactory: createProofIdFactory('evaluation'),
103
+ });
104
+ const evaluation = await evaluationRunner.runScenarioEvaluation({
105
+ scenario: AGENT_CONSOLE_MEETUP_PROOF_SCENARIO,
106
+ mode: 'code-execution',
107
+ target: {
108
+ targetId: 'sandbox-agent-console',
109
+ isolation: 'sandbox',
110
+ baseUrl: 'https://sandbox.contractspec.local/agent-console',
111
+ allowlistedDomains: ['sandbox.contractspec.local'],
112
+ },
113
+ context: {
114
+ metadata: {
115
+ lane: 'meetup-proof',
116
+ templateId: 'agent-console',
117
+ },
118
+ },
119
+ });
120
+
121
+ if (!replayBundle) {
122
+ throw new Error('Meetup proof did not produce a replay bundle.');
123
+ }
124
+
125
+ return {
126
+ evaluation,
127
+ replayBundle,
128
+ replayUri: replayUris[0] ?? evaluation.replayBundleUri,
129
+ };
130
+ }