@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
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Markdown Renderer for Agent List Presentation
3
+ *
4
+ * Uses handlers from the agent-console example package.
5
+ */
1
6
  import type { PresentationRenderer } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
2
7
  /**
3
8
  * Markdown renderer for agent-console.agent.list presentation
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/ui/hooks/useAgentList.ts
3
- import { useCallback, useEffect, useMemo, useState } from "react";
4
3
  import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
4
+ import { useCallback, useEffect, useMemo, useState } from "react";
5
5
  function useAgentList(options = {}) {
6
6
  const { handlers, projectId } = useTemplateRuntime();
7
7
  const { agent } = handlers;
@@ -55,13 +55,13 @@ function useAgentList(options = {}) {
55
55
  // src/ui/views/AgentListView.tsx
56
56
  import {
57
57
  Button,
58
- StatCard,
59
- StatCardGroup,
58
+ EmptyState,
60
59
  EntityCard,
61
- StatusChip,
62
- LoaderBlock,
63
60
  ErrorState,
64
- EmptyState
61
+ LoaderBlock,
62
+ StatCard,
63
+ StatCardGroup,
64
+ StatusChip
65
65
  } from "@contractspec/lib.design-system";
66
66
  import { jsxDEV } from "react/jsx-dev-runtime";
67
67
  "use client";
@@ -126,7 +126,7 @@ function AgentListView() {
126
126
  className: "flex items-center justify-between",
127
127
  children: [
128
128
  /* @__PURE__ */ jsxDEV("h3", {
129
- className: "text-lg font-semibold",
129
+ className: "font-semibold text-lg",
130
130
  children: "Agents"
131
131
  }, undefined, false, undefined, this),
132
132
  /* @__PURE__ */ jsxDEV(Button, {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Markdown Renderer for Agent Console Dashboard
3
+ *
4
+ * Provides a comprehensive overview of agents, runs, and tools.
5
+ */
1
6
  import type { PresentationRenderer } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
2
7
  /**
3
8
  * Markdown renderer for agent-console.dashboard presentation
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Renderers for agent-console presentations
3
3
  */
4
- export { agentListReactRenderer } from './agent-list.renderer';
5
4
  export { agentListMarkdownRenderer } from './agent-list.markdown';
5
+ export { agentListReactRenderer } from './agent-list.renderer';
6
+ export { agentDashboardMarkdownRenderer } from './dashboard.markdown';
6
7
  export { runListMarkdownRenderer } from './run-list.markdown';
7
8
  export { toolRegistryMarkdownRenderer } from './tool-registry.markdown';
8
- export { agentDashboardMarkdownRenderer } from './dashboard.markdown';
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/ui/hooks/useAgentList.ts
3
- import { useCallback, useEffect, useMemo, useState } from "react";
4
3
  import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
4
+ import { useCallback, useEffect, useMemo, useState } from "react";
5
5
  function useAgentList(options = {}) {
6
6
  const { handlers, projectId } = useTemplateRuntime();
7
7
  const { agent } = handlers;
@@ -52,16 +52,69 @@ function useAgentList(options = {}) {
52
52
  };
53
53
  }
54
54
 
55
+ // src/ui/renderers/agent-list.markdown.ts
56
+ import {
57
+ mockListAgentsHandler
58
+ } from "@contractspec/example.agent-console/handlers";
59
+ var agentListMarkdownRenderer = {
60
+ target: "markdown",
61
+ render: async (desc) => {
62
+ if (desc.source.type !== "component" || desc.source.componentKey !== "AgentListView") {
63
+ throw new Error("agentListMarkdownRenderer: not AgentListView");
64
+ }
65
+ const data = await mockListAgentsHandler({
66
+ organizationId: "demo-org",
67
+ limit: 50,
68
+ offset: 0
69
+ });
70
+ const lines = [
71
+ `# ${desc.meta.description ?? "Agent List"}`,
72
+ "",
73
+ `> ${desc.meta.key} v${desc.meta.version}`,
74
+ "",
75
+ `**Total Agents:** ${data.total}`,
76
+ "",
77
+ "## Agents",
78
+ ""
79
+ ];
80
+ const byStatus = {};
81
+ for (const agent of data.items) {
82
+ const status = agent.status;
83
+ if (byStatus[status]) {
84
+ byStatus[status].push(agent);
85
+ } else {
86
+ byStatus[status] = [agent];
87
+ }
88
+ }
89
+ for (const [status, agents] of Object.entries(byStatus)) {
90
+ lines.push(`### ${status} (${agents.length})`);
91
+ lines.push("");
92
+ for (const agent of agents) {
93
+ lines.push(`- **${agent.name}** (${agent.modelProvider}/${agent.modelName})`);
94
+ if (agent.description) {
95
+ lines.push(` > ${agent.description}`);
96
+ }
97
+ }
98
+ lines.push("");
99
+ }
100
+ return {
101
+ mimeType: "text/markdown",
102
+ body: lines.join(`
103
+ `)
104
+ };
105
+ }
106
+ };
107
+
55
108
  // src/ui/views/AgentListView.tsx
56
109
  import {
57
110
  Button,
58
- StatCard,
59
- StatCardGroup,
111
+ EmptyState,
60
112
  EntityCard,
61
- StatusChip,
62
- LoaderBlock,
63
113
  ErrorState,
64
- EmptyState
114
+ LoaderBlock,
115
+ StatCard,
116
+ StatCardGroup,
117
+ StatusChip
65
118
  } from "@contractspec/lib.design-system";
66
119
  import { jsxDEV } from "react/jsx-dev-runtime";
67
120
  "use client";
@@ -126,7 +179,7 @@ function AgentListView() {
126
179
  className: "flex items-center justify-between",
127
180
  children: [
128
181
  /* @__PURE__ */ jsxDEV("h3", {
129
- className: "text-lg font-semibold",
182
+ className: "font-semibold text-lg",
130
183
  children: "Agents"
131
184
  }, undefined, false, undefined, this),
132
185
  /* @__PURE__ */ jsxDEV(Button, {
@@ -177,50 +230,112 @@ var agentListReactRenderer = {
177
230
  }
178
231
  };
179
232
 
180
- // src/ui/renderers/agent-list.markdown.ts
233
+ // src/ui/renderers/dashboard.markdown.ts
181
234
  import {
182
- mockListAgentsHandler
235
+ mockListAgentsHandler as mockListAgentsHandler2,
236
+ mockListRunsHandler,
237
+ mockListToolsHandler
183
238
  } from "@contractspec/example.agent-console/handlers";
184
- var agentListMarkdownRenderer = {
239
+ function formatDuration(ms) {
240
+ if (ms < 1000)
241
+ return `${ms}ms`;
242
+ if (ms < 60000)
243
+ return `${(ms / 1000).toFixed(1)}s`;
244
+ return `${(ms / 60000).toFixed(1)}m`;
245
+ }
246
+ var agentDashboardMarkdownRenderer = {
185
247
  target: "markdown",
186
248
  render: async (desc) => {
187
- if (desc.source.type !== "component" || desc.source.componentKey !== "AgentListView") {
188
- throw new Error("agentListMarkdownRenderer: not AgentListView");
249
+ if (desc.source.type !== "component" || desc.source.componentKey !== "AgentConsoleDashboard") {
250
+ throw new Error("agentDashboardMarkdownRenderer: not AgentConsoleDashboard");
189
251
  }
190
- const data = await mockListAgentsHandler({
191
- organizationId: "demo-org",
192
- limit: 50,
193
- offset: 0
194
- });
252
+ const [agentsData, runsData, toolsData] = await Promise.all([
253
+ mockListAgentsHandler2({
254
+ organizationId: "demo-org",
255
+ limit: 100
256
+ }),
257
+ mockListRunsHandler({
258
+ limit: 100
259
+ }),
260
+ mockListToolsHandler({
261
+ organizationId: "demo-org",
262
+ limit: 100
263
+ })
264
+ ]);
265
+ const activeAgents = agentsData.items.filter((a) => a.status === "ACTIVE").length;
266
+ const completedRuns = runsData.items.filter((r) => r.status === "COMPLETED").length;
267
+ const failedRuns = runsData.items.filter((r) => r.status === "FAILED").length;
268
+ const totalTokens = runsData.items.reduce((sum, r) => sum + (r.totalTokens ?? 0), 0);
269
+ const totalCost = runsData.items.reduce((sum, r) => sum + (r.estimatedCostUsd ?? 0), 0);
270
+ const activeTools = toolsData.items.filter((t) => t.status === "ACTIVE").length;
195
271
  const lines = [
196
- `# ${desc.meta.description ?? "Agent List"}`,
272
+ "# Agent Console Dashboard",
197
273
  "",
198
- `> ${desc.meta.key} v${desc.meta.version}`,
274
+ "> AI agent operations overview",
199
275
  "",
200
- `**Total Agents:** ${data.total}`,
276
+ "## Summary",
277
+ "",
278
+ "| Metric | Value |",
279
+ "|--------|-------|",
280
+ `| Total Agents | ${agentsData.total} |`,
281
+ `| Active Agents | ${activeAgents} |`,
282
+ `| Total Runs | ${runsData.total} |`,
283
+ `| Completed Runs | ${completedRuns} |`,
284
+ `| Failed Runs | ${failedRuns} |`,
285
+ `| Total Tokens | ${totalTokens.toLocaleString()} |`,
286
+ `| Total Cost | $${totalCost.toFixed(4)} |`,
287
+ `| Total Tools | ${toolsData.total} |`,
288
+ `| Active Tools | ${activeTools} |`,
201
289
  "",
202
290
  "## Agents",
203
291
  ""
204
292
  ];
205
- const byStatus = {};
206
- for (const agent of data.items) {
207
- const status = agent.status;
208
- if (byStatus[status]) {
209
- byStatus[status].push(agent);
210
- } else {
211
- byStatus[status] = [agent];
293
+ if (agentsData.items.length === 0) {
294
+ lines.push("_No agents configured._");
295
+ } else {
296
+ lines.push("| Agent | Model | Status | Description |");
297
+ lines.push("|-------|-------|--------|-------------|");
298
+ for (const agent of agentsData.items.slice(0, 5)) {
299
+ lines.push(`| ${agent.name} | ${agent.modelProvider}/${agent.modelName} | ${agent.status} | ${agent.description ?? "-"} |`);
300
+ }
301
+ if (agentsData.items.length > 5) {
302
+ lines.push(`| ... | ... | ... | _${agentsData.total - 5} more_ |`);
212
303
  }
213
304
  }
214
- for (const [status, agents] of Object.entries(byStatus)) {
215
- lines.push(`### ${status} (${agents.length})`);
216
- lines.push("");
217
- for (const agent of agents) {
218
- lines.push(`- **${agent.name}** (${agent.modelProvider}/${agent.modelName})`);
219
- if (agent.description) {
220
- lines.push(` > ${agent.description}`);
221
- }
305
+ lines.push("");
306
+ lines.push("## Recent Runs");
307
+ lines.push("");
308
+ if (runsData.items.length === 0) {
309
+ lines.push("_No runs yet._");
310
+ } else {
311
+ lines.push("| Run ID | Agent | Status | Duration | Tokens | Cost |");
312
+ lines.push("|--------|-------|--------|----------|--------|------|");
313
+ for (const run of runsData.items.slice(0, 5)) {
314
+ lines.push(`| ${run.id.slice(-8)} | ${run.agentName} | ${run.status} | ${run.durationMs ? formatDuration(run.durationMs) : "-"} | ${run.totalTokens ?? 0} | $${(run.estimatedCostUsd ?? 0).toFixed(4)} |`);
315
+ }
316
+ if (runsData.items.length > 5) {
317
+ lines.push(`| ... | ... | ... | ... | ... | _${runsData.total - 5} more_ |`);
318
+ }
319
+ }
320
+ lines.push("");
321
+ lines.push("## Tools");
322
+ lines.push("");
323
+ const toolsByCategory = {};
324
+ for (const tool of toolsData.items) {
325
+ const cat = tool.category;
326
+ if (!toolsByCategory[cat])
327
+ toolsByCategory[cat] = [];
328
+ toolsByCategory[cat].push(tool);
329
+ }
330
+ if (Object.keys(toolsByCategory).length === 0) {
331
+ lines.push("_No tools registered._");
332
+ } else {
333
+ lines.push("| Category | Tools | Active |");
334
+ lines.push("|----------|-------|--------|");
335
+ for (const [category, tools] of Object.entries(toolsByCategory).sort()) {
336
+ const active = tools.filter((t) => t.status === "ACTIVE").length;
337
+ lines.push(`| ${category} | ${tools.length} | ${active} |`);
222
338
  }
223
- lines.push("");
224
339
  }
225
340
  return {
226
341
  mimeType: "text/markdown",
@@ -231,8 +346,8 @@ var agentListMarkdownRenderer = {
231
346
  };
232
347
 
233
348
  // src/ui/renderers/run-list.markdown.ts
234
- import { mockListRunsHandler } from "@contractspec/example.agent-console/handlers";
235
- function formatDuration(ms) {
349
+ import { mockListRunsHandler as mockListRunsHandler2 } from "@contractspec/example.agent-console/handlers";
350
+ function formatDuration2(ms) {
236
351
  if (ms < 1000)
237
352
  return `${ms}ms`;
238
353
  if (ms < 60000)
@@ -245,7 +360,7 @@ var runListMarkdownRenderer = {
245
360
  if (desc.source.type !== "component" || desc.source.componentKey !== "RunListView") {
246
361
  throw new Error("runListMarkdownRenderer: not RunListView");
247
362
  }
248
- const data = await mockListRunsHandler({
363
+ const data = await mockListRunsHandler2({
249
364
  organizationId: "demo-org",
250
365
  limit: 20,
251
366
  offset: 0
@@ -263,7 +378,7 @@ var runListMarkdownRenderer = {
263
378
  "| --- | --- | --- | --- | --- | --- |"
264
379
  ];
265
380
  for (const run of data.items.slice(0, 10)) {
266
- lines.push(`| ${run.id.slice(-8)} | ${run.agentName} | ${run.status} | ${run.durationMs ? formatDuration(run.durationMs) : "-"} | ${run.totalTokens} | $${run.estimatedCostUsd?.toFixed(4) ?? "-"} |`);
381
+ lines.push(`| ${run.id.slice(-8)} | ${run.agentName} | ${run.status} | ${run.durationMs ? formatDuration2(run.durationMs) : "-"} | ${run.totalTokens} | $${run.estimatedCostUsd?.toFixed(4) ?? "-"} |`);
267
382
  }
268
383
  return {
269
384
  mimeType: "text/markdown",
@@ -274,14 +389,14 @@ var runListMarkdownRenderer = {
274
389
  };
275
390
 
276
391
  // src/ui/renderers/tool-registry.markdown.ts
277
- import { mockListToolsHandler } from "@contractspec/example.agent-console/handlers";
392
+ import { mockListToolsHandler as mockListToolsHandler2 } from "@contractspec/example.agent-console/handlers";
278
393
  var toolRegistryMarkdownRenderer = {
279
394
  target: "markdown",
280
395
  render: async (desc) => {
281
396
  if (desc.source.type !== "component" || desc.source.componentKey !== "ToolRegistryView") {
282
397
  throw new Error("toolRegistryMarkdownRenderer: not ToolRegistryView");
283
398
  }
284
- const data = await mockListToolsHandler({
399
+ const data = await mockListToolsHandler2({
285
400
  organizationId: "demo-org",
286
401
  limit: 50,
287
402
  offset: 0
@@ -323,121 +438,6 @@ var toolRegistryMarkdownRenderer = {
323
438
  };
324
439
  }
325
440
  };
326
-
327
- // src/ui/renderers/dashboard.markdown.ts
328
- import {
329
- mockListAgentsHandler as mockListAgentsHandler2,
330
- mockListRunsHandler as mockListRunsHandler2,
331
- mockListToolsHandler as mockListToolsHandler2
332
- } from "@contractspec/example.agent-console/handlers";
333
- function formatDuration2(ms) {
334
- if (ms < 1000)
335
- return `${ms}ms`;
336
- if (ms < 60000)
337
- return `${(ms / 1000).toFixed(1)}s`;
338
- return `${(ms / 60000).toFixed(1)}m`;
339
- }
340
- var agentDashboardMarkdownRenderer = {
341
- target: "markdown",
342
- render: async (desc) => {
343
- if (desc.source.type !== "component" || desc.source.componentKey !== "AgentConsoleDashboard") {
344
- throw new Error("agentDashboardMarkdownRenderer: not AgentConsoleDashboard");
345
- }
346
- const [agentsData, runsData, toolsData] = await Promise.all([
347
- mockListAgentsHandler2({
348
- organizationId: "demo-org",
349
- limit: 100
350
- }),
351
- mockListRunsHandler2({
352
- limit: 100
353
- }),
354
- mockListToolsHandler2({
355
- organizationId: "demo-org",
356
- limit: 100
357
- })
358
- ]);
359
- const activeAgents = agentsData.items.filter((a) => a.status === "ACTIVE").length;
360
- const completedRuns = runsData.items.filter((r) => r.status === "COMPLETED").length;
361
- const failedRuns = runsData.items.filter((r) => r.status === "FAILED").length;
362
- const totalTokens = runsData.items.reduce((sum, r) => sum + (r.totalTokens ?? 0), 0);
363
- const totalCost = runsData.items.reduce((sum, r) => sum + (r.estimatedCostUsd ?? 0), 0);
364
- const activeTools = toolsData.items.filter((t) => t.status === "ACTIVE").length;
365
- const lines = [
366
- "# Agent Console Dashboard",
367
- "",
368
- "> AI agent operations overview",
369
- "",
370
- "## Summary",
371
- "",
372
- "| Metric | Value |",
373
- "|--------|-------|",
374
- `| Total Agents | ${agentsData.total} |`,
375
- `| Active Agents | ${activeAgents} |`,
376
- `| Total Runs | ${runsData.total} |`,
377
- `| Completed Runs | ${completedRuns} |`,
378
- `| Failed Runs | ${failedRuns} |`,
379
- `| Total Tokens | ${totalTokens.toLocaleString()} |`,
380
- `| Total Cost | $${totalCost.toFixed(4)} |`,
381
- `| Total Tools | ${toolsData.total} |`,
382
- `| Active Tools | ${activeTools} |`,
383
- "",
384
- "## Agents",
385
- ""
386
- ];
387
- if (agentsData.items.length === 0) {
388
- lines.push("_No agents configured._");
389
- } else {
390
- lines.push("| Agent | Model | Status | Description |");
391
- lines.push("|-------|-------|--------|-------------|");
392
- for (const agent of agentsData.items.slice(0, 5)) {
393
- lines.push(`| ${agent.name} | ${agent.modelProvider}/${agent.modelName} | ${agent.status} | ${agent.description ?? "-"} |`);
394
- }
395
- if (agentsData.items.length > 5) {
396
- lines.push(`| ... | ... | ... | _${agentsData.total - 5} more_ |`);
397
- }
398
- }
399
- lines.push("");
400
- lines.push("## Recent Runs");
401
- lines.push("");
402
- if (runsData.items.length === 0) {
403
- lines.push("_No runs yet._");
404
- } else {
405
- lines.push("| Run ID | Agent | Status | Duration | Tokens | Cost |");
406
- lines.push("|--------|-------|--------|----------|--------|------|");
407
- for (const run of runsData.items.slice(0, 5)) {
408
- lines.push(`| ${run.id.slice(-8)} | ${run.agentName} | ${run.status} | ${run.durationMs ? formatDuration2(run.durationMs) : "-"} | ${run.totalTokens ?? 0} | $${(run.estimatedCostUsd ?? 0).toFixed(4)} |`);
409
- }
410
- if (runsData.items.length > 5) {
411
- lines.push(`| ... | ... | ... | ... | ... | _${runsData.total - 5} more_ |`);
412
- }
413
- }
414
- lines.push("");
415
- lines.push("## Tools");
416
- lines.push("");
417
- const toolsByCategory = {};
418
- for (const tool of toolsData.items) {
419
- const cat = tool.category;
420
- if (!toolsByCategory[cat])
421
- toolsByCategory[cat] = [];
422
- toolsByCategory[cat].push(tool);
423
- }
424
- if (Object.keys(toolsByCategory).length === 0) {
425
- lines.push("_No tools registered._");
426
- } else {
427
- lines.push("| Category | Tools | Active |");
428
- lines.push("|----------|-------|--------|");
429
- for (const [category, tools] of Object.entries(toolsByCategory).sort()) {
430
- const active = tools.filter((t) => t.status === "ACTIVE").length;
431
- lines.push(`| ${category} | ${tools.length} | ${active} |`);
432
- }
433
- }
434
- return {
435
- mimeType: "text/markdown",
436
- body: lines.join(`
437
- `)
438
- };
439
- }
440
- };
441
441
  export {
442
442
  toolRegistryMarkdownRenderer,
443
443
  runListMarkdownRenderer,
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Markdown Renderer for Run List Presentation
3
+ *
4
+ * Uses dynamic import for handlers to ensure correct build order.
5
+ */
1
6
  import type { PresentationRenderer } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
2
7
  /**
3
8
  * Markdown renderer for agent-console.run.list presentation
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Markdown Renderer for Tool Registry Presentation
3
+ *
4
+ * Uses dynamic import for handlers to ensure correct build order.
5
+ */
1
6
  import type { PresentationRenderer } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
2
7
  /**
3
8
  * Markdown renderer for agent-console.tool.registry presentation
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/ui/hooks/useAgentList.ts
3
- import { useCallback, useEffect, useMemo, useState } from "react";
4
3
  import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
4
+ import { useCallback, useEffect, useMemo, useState } from "react";
5
5
  function useAgentList(options = {}) {
6
6
  const { handlers, projectId } = useTemplateRuntime();
7
7
  const { agent } = handlers;
@@ -55,13 +55,13 @@ function useAgentList(options = {}) {
55
55
  // src/ui/views/AgentListView.tsx
56
56
  import {
57
57
  Button,
58
- StatCard,
59
- StatCardGroup,
58
+ EmptyState,
60
59
  EntityCard,
61
- StatusChip,
62
- LoaderBlock,
63
60
  ErrorState,
64
- EmptyState
61
+ LoaderBlock,
62
+ StatCard,
63
+ StatCardGroup,
64
+ StatusChip
65
65
  } from "@contractspec/lib.design-system";
66
66
  import { jsxDEV } from "react/jsx-dev-runtime";
67
67
  "use client";
@@ -126,7 +126,7 @@ function AgentListView() {
126
126
  className: "flex items-center justify-between",
127
127
  children: [
128
128
  /* @__PURE__ */ jsxDEV("h3", {
129
- className: "text-lg font-semibold",
129
+ className: "font-semibold text-lg",
130
130
  children: "Agents"
131
131
  }, undefined, false, undefined, this),
132
132
  /* @__PURE__ */ jsxDEV(Button, {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/ui/hooks/useRunList.ts
3
- import { useCallback, useEffect, useState } from "react";
4
3
  import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
4
+ import { useCallback, useEffect, useState } from "react";
5
5
  function useRunList(options = {}) {
6
6
  const { handlers, projectId } = useTemplateRuntime();
7
7
  const { agent } = handlers;
@@ -54,12 +54,12 @@ function useRunList(options = {}) {
54
54
 
55
55
  // src/ui/views/RunListView.tsx
56
56
  import {
57
- StatCard,
58
- StatCardGroup,
59
- StatusChip,
60
57
  EmptyState,
58
+ ErrorState,
61
59
  LoaderBlock,
62
- ErrorState
60
+ StatCard,
61
+ StatCardGroup,
62
+ StatusChip
63
63
  } from "@contractspec/lib.design-system";
64
64
  import { jsxDEV } from "react/jsx-dev-runtime";
65
65
  "use client";
@@ -144,45 +144,45 @@ function RunListView({ agentId, onRunClick }) {
144
144
  ]
145
145
  }, undefined, true, undefined, this),
146
146
  /* @__PURE__ */ jsxDEV("div", {
147
- className: "border-border rounded-lg border",
147
+ className: "rounded-lg border border-border",
148
148
  children: /* @__PURE__ */ jsxDEV("table", {
149
149
  className: "w-full",
150
150
  children: [
151
151
  /* @__PURE__ */ jsxDEV("thead", {
152
- className: "border-border bg-muted/30 border-b",
152
+ className: "border-border border-b bg-muted/30",
153
153
  children: /* @__PURE__ */ jsxDEV("tr", {
154
154
  children: [
155
155
  /* @__PURE__ */ jsxDEV("th", {
156
- className: "text-muted-foreground px-4 py-3 text-left text-sm font-medium",
156
+ className: "px-4 py-3 text-left font-medium text-muted-foreground text-sm",
157
157
  children: "Run"
158
158
  }, undefined, false, undefined, this),
159
159
  /* @__PURE__ */ jsxDEV("th", {
160
- className: "text-muted-foreground px-4 py-3 text-left text-sm font-medium",
160
+ className: "px-4 py-3 text-left font-medium text-muted-foreground text-sm",
161
161
  children: "Agent"
162
162
  }, undefined, false, undefined, this),
163
163
  /* @__PURE__ */ jsxDEV("th", {
164
- className: "text-muted-foreground px-4 py-3 text-left text-sm font-medium",
164
+ className: "px-4 py-3 text-left font-medium text-muted-foreground text-sm",
165
165
  children: "Status"
166
166
  }, undefined, false, undefined, this),
167
167
  /* @__PURE__ */ jsxDEV("th", {
168
- className: "text-muted-foreground px-4 py-3 text-right text-sm font-medium",
168
+ className: "px-4 py-3 text-right font-medium text-muted-foreground text-sm",
169
169
  children: "Tokens"
170
170
  }, undefined, false, undefined, this),
171
171
  /* @__PURE__ */ jsxDEV("th", {
172
- className: "text-muted-foreground px-4 py-3 text-right text-sm font-medium",
172
+ className: "px-4 py-3 text-right font-medium text-muted-foreground text-sm",
173
173
  children: "Duration"
174
174
  }, undefined, false, undefined, this),
175
175
  /* @__PURE__ */ jsxDEV("th", {
176
- className: "text-muted-foreground px-4 py-3 text-right text-sm font-medium",
176
+ className: "px-4 py-3 text-right font-medium text-muted-foreground text-sm",
177
177
  children: "Cost"
178
178
  }, undefined, false, undefined, this)
179
179
  ]
180
180
  }, undefined, true, undefined, this)
181
181
  }, undefined, false, undefined, this),
182
182
  /* @__PURE__ */ jsxDEV("tbody", {
183
- className: "divide-border divide-y",
183
+ className: "divide-y divide-border",
184
184
  children: data.items.map((run) => /* @__PURE__ */ jsxDEV("tr", {
185
- className: "hover:bg-muted/50 cursor-pointer transition-colors",
185
+ className: "cursor-pointer transition-colors hover:bg-muted/50",
186
186
  onClick: () => onRunClick?.(run.id),
187
187
  children: [
188
188
  /* @__PURE__ */ jsxDEV("td", {
@@ -231,7 +231,7 @@ function RunListView({ agentId, onRunClick }) {
231
231
  }, undefined, true, undefined, this)
232
232
  }, undefined, false, undefined, this),
233
233
  /* @__PURE__ */ jsxDEV("div", {
234
- className: "text-muted-foreground text-center text-sm",
234
+ className: "text-center text-muted-foreground text-sm",
235
235
  children: [
236
236
  "Showing ",
237
237
  data.items.length,
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/ui/hooks/useToolList.ts
3
- import { useCallback, useEffect, useMemo, useState } from "react";
4
3
  import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
4
+ import { useCallback, useEffect, useMemo, useState } from "react";
5
5
  function useToolList(options = {}) {
6
6
  const { handlers, projectId } = useTemplateRuntime();
7
7
  const { agent } = handlers;
@@ -84,14 +84,14 @@ function useToolList(options = {}) {
84
84
 
85
85
  // src/ui/views/ToolRegistryView.tsx
86
86
  import {
87
- StatCard,
88
- StatCardGroup,
89
- StatusChip,
90
- EntityCard,
87
+ Button,
91
88
  EmptyState,
92
- LoaderBlock,
89
+ EntityCard,
93
90
  ErrorState,
94
- Button
91
+ LoaderBlock,
92
+ StatCard,
93
+ StatCardGroup,
94
+ StatusChip
95
95
  } from "@contractspec/lib.design-system";
96
96
  import { jsxDEV } from "react/jsx-dev-runtime";
97
97
  "use client";
@@ -171,11 +171,11 @@ function ToolRegistryView({
171
171
  children: categoryIcons[category]
172
172
  }, undefined, false, undefined, this),
173
173
  /* @__PURE__ */ jsxDEV("h3", {
174
- className: "text-lg font-semibold",
174
+ className: "font-semibold text-lg",
175
175
  children: category
176
176
  }, undefined, false, undefined, this),
177
177
  /* @__PURE__ */ jsxDEV("span", {
178
- className: "bg-muted text-muted-foreground rounded-full px-2 py-0.5 text-xs",
178
+ className: "rounded-full bg-muted px-2 py-0.5 text-muted-foreground text-xs",
179
179
  children: tools.length
180
180
  }, undefined, false, undefined, this)
181
181
  ]