@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.
- package/.turbo/turbo-build.log +126 -105
- package/AGENTS.md +52 -31
- package/CHANGELOG.md +29 -0
- package/README.md +112 -83
- package/dist/agent/agent.event.js +1 -1
- package/dist/agent/agent.handler.d.ts +3 -0
- package/dist/agent/agent.handler.js +730 -1
- package/dist/agent/agent.operation.js +1 -1
- package/dist/agent/index.d.ts +5 -5
- package/dist/agent/index.js +74 -73
- package/dist/agent.feature.js +179 -0
- package/dist/browser/agent/agent.event.js +1 -1
- package/dist/browser/agent/agent.handler.js +730 -1
- package/dist/browser/agent/agent.operation.js +1 -1
- package/dist/browser/agent/index.js +74 -73
- package/dist/browser/agent.feature.js +179 -0
- package/dist/browser/docs/agent-console.docblock.js +11 -8
- package/dist/browser/docs/index.js +11 -8
- package/dist/browser/example.js +2 -3
- package/dist/browser/handlers/agent.handlers.js +1883 -2
- package/dist/browser/handlers/index.js +2142 -8
- package/dist/browser/index.js +4075 -3161
- package/dist/browser/presentations/index.js +51 -51
- package/dist/browser/run/index.js +380 -374
- package/dist/browser/run/run.event.js +2 -2
- package/dist/browser/run/run.handler.js +666 -1
- package/dist/browser/run/run.presentation.js +2 -2
- package/dist/browser/shared/index.js +293 -1
- package/dist/browser/shared/mock-runs.js +5 -0
- package/dist/browser/tool/index.js +161 -161
- package/dist/browser/tool/tool.event.js +1 -1
- package/dist/browser/tool/tool.handler.js +479 -3
- package/dist/browser/tool/tool.presentation.js +2 -2
- package/dist/browser/ui/AgentDashboard.js +1816 -931
- package/dist/browser/ui/AgentDashboard.visualizations.js +217 -0
- package/dist/browser/ui/AgentRunList.js +360 -128
- package/dist/browser/ui/AgentToolRegistry.js +9 -9
- package/dist/browser/ui/hooks/index.js +611 -161
- package/dist/browser/ui/hooks/useAgentList.js +1 -1
- package/dist/browser/ui/hooks/useAgentMutations.js +444 -9
- package/dist/browser/ui/hooks/useRunList.js +26 -11
- package/dist/browser/ui/hooks/useToolList.js +1 -1
- package/dist/browser/ui/index.js +2161 -1258
- package/dist/browser/ui/modals/AgentActionsModal.js +13 -13
- package/dist/browser/ui/modals/CreateAgentModal.js +15 -15
- package/dist/browser/ui/modals/index.js +297 -297
- package/dist/browser/ui/renderers/agent-list.markdown.js +14 -5
- package/dist/browser/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/browser/ui/renderers/dashboard.markdown.js +207 -36
- package/dist/browser/ui/renderers/index.js +359 -163
- package/dist/browser/ui/renderers/run-list.markdown.js +9 -4
- package/dist/browser/ui/renderers/tool-registry.markdown.js +15 -4
- package/dist/browser/ui/views/AgentListView.js +7 -7
- package/dist/browser/ui/views/RunDataTable.js +326 -0
- package/dist/browser/ui/views/RunListView.js +360 -128
- package/dist/browser/ui/views/ToolRegistryView.js +9 -9
- package/dist/browser/ui/views/index.js +478 -246
- package/dist/browser/ui/views/run-data-table.columns.js +271 -0
- package/dist/browser/ui/views/run-list.shared.js +177 -0
- package/dist/browser/visualizations/catalog.js +134 -0
- package/dist/browser/visualizations/index.js +187 -0
- package/dist/browser/visualizations/selectors.js +181 -0
- package/dist/docs/agent-console.docblock.js +11 -8
- package/dist/docs/index.js +11 -8
- package/dist/example.js +2 -3
- package/dist/example.test.d.ts +1 -0
- package/dist/handlers/agent.handlers.d.ts +2 -0
- package/dist/handlers/agent.handlers.js +1883 -2
- package/dist/handlers/index.d.ts +2 -4
- package/dist/handlers/index.js +2142 -8
- package/dist/handlers/mock-handlers.test.d.ts +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +4075 -3161
- package/dist/node/agent/agent.event.js +1 -1
- package/dist/node/agent/agent.handler.js +730 -1
- package/dist/node/agent/agent.operation.js +1 -1
- package/dist/node/agent/index.js +74 -73
- package/dist/node/agent.feature.js +179 -0
- package/dist/node/docs/agent-console.docblock.js +11 -8
- package/dist/node/docs/index.js +11 -8
- package/dist/node/example.js +2 -3
- package/dist/node/handlers/agent.handlers.js +1883 -2
- package/dist/node/handlers/index.js +2142 -8
- package/dist/node/index.js +4075 -3161
- package/dist/node/presentations/index.js +51 -51
- package/dist/node/run/index.js +380 -374
- package/dist/node/run/run.event.js +2 -2
- package/dist/node/run/run.handler.js +666 -1
- package/dist/node/run/run.presentation.js +2 -2
- package/dist/node/shared/index.js +293 -1
- package/dist/node/shared/mock-runs.js +5 -0
- package/dist/node/tool/index.js +161 -161
- package/dist/node/tool/tool.event.js +1 -1
- package/dist/node/tool/tool.handler.js +479 -3
- package/dist/node/tool/tool.presentation.js +2 -2
- package/dist/node/ui/AgentDashboard.js +1816 -931
- package/dist/node/ui/AgentDashboard.visualizations.js +217 -0
- package/dist/node/ui/AgentRunList.js +360 -128
- package/dist/node/ui/AgentToolRegistry.js +9 -9
- package/dist/node/ui/hooks/index.js +611 -161
- package/dist/node/ui/hooks/useAgentList.js +1 -1
- package/dist/node/ui/hooks/useAgentMutations.js +444 -9
- package/dist/node/ui/hooks/useRunList.js +26 -11
- package/dist/node/ui/hooks/useToolList.js +1 -1
- package/dist/node/ui/index.js +2161 -1258
- package/dist/node/ui/modals/AgentActionsModal.js +13 -13
- package/dist/node/ui/modals/CreateAgentModal.js +15 -15
- package/dist/node/ui/modals/index.js +297 -297
- package/dist/node/ui/renderers/agent-list.markdown.js +14 -5
- package/dist/node/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/node/ui/renderers/dashboard.markdown.js +207 -36
- package/dist/node/ui/renderers/index.js +359 -163
- package/dist/node/ui/renderers/run-list.markdown.js +9 -4
- package/dist/node/ui/renderers/tool-registry.markdown.js +15 -4
- package/dist/node/ui/views/AgentListView.js +7 -7
- package/dist/node/ui/views/RunDataTable.js +326 -0
- package/dist/node/ui/views/RunListView.js +360 -128
- package/dist/node/ui/views/ToolRegistryView.js +9 -9
- package/dist/node/ui/views/index.js +478 -246
- package/dist/node/ui/views/run-data-table.columns.js +271 -0
- package/dist/node/ui/views/run-list.shared.js +177 -0
- package/dist/node/visualizations/catalog.js +134 -0
- package/dist/node/visualizations/index.js +187 -0
- package/dist/node/visualizations/selectors.js +181 -0
- package/dist/presentations/index.d.ts +3 -5
- package/dist/presentations/index.js +51 -51
- package/dist/proof/index.d.ts +2 -0
- package/dist/proof/meetup-proof.d.ts +10 -0
- package/dist/proof/meetup-proof.runtime.d.ts +22 -0
- package/dist/proof/meetup-proof.scenario.d.ts +2 -0
- package/dist/proof/meetup-proof.suite.d.ts +1 -0
- package/dist/proof/meetup-proof.test.d.ts +1 -0
- package/dist/run/index.d.ts +7 -7
- package/dist/run/index.js +380 -374
- package/dist/run/run.event.js +2 -2
- package/dist/run/run.handler.d.ts +7 -0
- package/dist/run/run.handler.js +666 -1
- package/dist/run/run.presentation.js +2 -2
- package/dist/shared/demo-dashboard-data.d.ts +16 -0
- package/dist/shared/demo-runtime-seed.d.ts +17 -0
- package/dist/shared/demo-runtime.d.ts +8 -0
- package/dist/shared/demo-runtime.test.d.ts +1 -0
- package/dist/shared/index.d.ts +4 -1
- package/dist/shared/index.js +293 -1
- package/dist/shared/mock-runs.d.ts +4 -0
- package/dist/shared/mock-runs.js +5 -0
- package/dist/tool/index.d.ts +7 -7
- package/dist/tool/index.js +161 -161
- package/dist/tool/tool.event.js +1 -1
- package/dist/tool/tool.handler.d.ts +3 -0
- package/dist/tool/tool.handler.js +479 -3
- package/dist/tool/tool.presentation.js +2 -2
- package/dist/ui/AgentDashboard.js +1816 -931
- package/dist/ui/AgentDashboard.sandbox.test.d.ts +1 -0
- package/dist/ui/AgentDashboard.visualizations.d.ts +4 -0
- package/dist/ui/AgentDashboard.visualizations.js +218 -0
- package/dist/ui/AgentRunList.js +360 -128
- package/dist/ui/AgentToolRegistry.js +9 -9
- package/dist/ui/hooks/index.d.ts +4 -4
- package/dist/ui/hooks/index.js +611 -161
- package/dist/ui/hooks/useAgentList.d.ts +5 -0
- package/dist/ui/hooks/useAgentList.js +1 -1
- package/dist/ui/hooks/useAgentMutations.d.ts +9 -2
- package/dist/ui/hooks/useAgentMutations.js +444 -9
- package/dist/ui/hooks/useRunList.d.ts +13 -2
- package/dist/ui/hooks/useRunList.js +26 -11
- package/dist/ui/hooks/useToolList.d.ts +5 -0
- package/dist/ui/hooks/useToolList.js +1 -1
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +2161 -1258
- package/dist/ui/modals/AgentActionsModal.js +13 -13
- package/dist/ui/modals/CreateAgentModal.js +15 -15
- package/dist/ui/modals/index.d.ts +1 -1
- package/dist/ui/modals/index.js +297 -297
- package/dist/ui/renderers/agent-list.markdown.d.ts +5 -0
- package/dist/ui/renderers/agent-list.markdown.js +14 -5
- package/dist/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/ui/renderers/dashboard.markdown.d.ts +5 -0
- package/dist/ui/renderers/dashboard.markdown.js +207 -36
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.js +359 -163
- package/dist/ui/renderers/run-list.markdown.d.ts +5 -0
- package/dist/ui/renderers/run-list.markdown.js +9 -4
- package/dist/ui/renderers/tool-registry.markdown.d.ts +6 -1
- package/dist/ui/renderers/tool-registry.markdown.js +15 -4
- package/dist/ui/views/AgentListView.js +7 -7
- package/dist/ui/views/RunDataTable.d.ts +18 -0
- package/dist/ui/views/RunDataTable.js +327 -0
- package/dist/ui/views/RunListView.js +360 -128
- package/dist/ui/views/ToolRegistryView.js +9 -9
- package/dist/ui/views/index.js +478 -246
- package/dist/ui/views/run-data-table.columns.d.ts +3 -0
- package/dist/ui/views/run-data-table.columns.js +272 -0
- package/dist/ui/views/run-list.shared.d.ts +14 -0
- package/dist/ui/views/run-list.shared.js +178 -0
- package/dist/visualizations/catalog.d.ts +10 -0
- package/dist/visualizations/catalog.js +135 -0
- package/dist/visualizations/index.d.ts +2 -0
- package/dist/visualizations/index.js +188 -0
- package/dist/visualizations/selectors.d.ts +3 -0
- package/dist/visualizations/selectors.js +182 -0
- package/dist/visualizations/selectors.test.d.ts +1 -0
- package/package.json +114 -12
- package/proofs/agent-console-meetup.replay.json +220 -0
- package/src/agent/agent.entity.ts +111 -111
- package/src/agent/agent.enum.ts +12 -12
- package/src/agent/agent.event.ts +91 -91
- package/src/agent/agent.handler.ts +144 -127
- package/src/agent/agent.operation.ts +400 -400
- package/src/agent/agent.presentation.ts +62 -62
- package/src/agent/agent.schema.ts +175 -175
- package/src/agent/agent.test-spec.ts +48 -48
- package/src/agent/index.ts +46 -51
- package/src/agent.capability.ts +11 -11
- package/src/agent.feature.ts +134 -131
- package/src/docs/agent-console.docblock.ts +52 -49
- package/src/example.test.ts +75 -0
- package/src/example.ts +34 -35
- package/src/handlers/agent.handlers.ts +576 -522
- package/src/handlers/index.ts +30 -14
- package/src/handlers/mock-handlers.test.ts +77 -0
- package/src/index.ts +10 -9
- package/src/presentations/index.ts +11 -13
- package/src/proof/index.ts +2 -0
- package/src/proof/meetup-proof.runtime.ts +196 -0
- package/src/proof/meetup-proof.scenario.ts +99 -0
- package/src/proof/meetup-proof.suite.ts +29 -0
- package/src/proof/meetup-proof.test.ts +28 -0
- package/src/proof/meetup-proof.ts +130 -0
- package/src/run/index.ts +49 -54
- package/src/run/run.entity.ts +137 -137
- package/src/run/run.enum.ts +18 -18
- package/src/run/run.event.ts +174 -174
- package/src/run/run.handler.ts +113 -96
- package/src/run/run.operation.ts +474 -474
- package/src/run/run.presentation.ts +42 -42
- package/src/run/run.schema.ts +126 -126
- package/src/run/run.test-spec.ts +48 -48
- package/src/seeders/index.ts +21 -21
- package/src/shared/demo-dashboard-data.ts +58 -0
- package/src/shared/demo-runtime-seed.ts +139 -0
- package/src/shared/demo-runtime.test.ts +169 -0
- package/src/shared/demo-runtime.ts +260 -0
- package/src/shared/index.ts +12 -1
- package/src/shared/mock-agents.ts +76 -76
- package/src/shared/mock-runs.ts +107 -102
- package/src/shared/mock-tools.ts +140 -140
- package/src/shared/overlay-types.ts +23 -23
- package/src/tool/index.ts +39 -44
- package/src/tool/tool.entity.ts +73 -73
- package/src/tool/tool.enum.ts +13 -13
- package/src/tool/tool.event.ts +80 -80
- package/src/tool/tool.handler.ts +124 -107
- package/src/tool/tool.operation.ts +328 -328
- package/src/tool/tool.presentation.ts +43 -43
- package/src/tool/tool.schema.ts +106 -106
- package/src/tool/tool.test-spec.ts +48 -48
- package/src/ui/AgentDashboard.sandbox.test.tsx +312 -0
- package/src/ui/AgentDashboard.tsx +351 -348
- package/src/ui/AgentDashboard.visualizations.tsx +35 -0
- package/src/ui/hooks/index.ts +7 -7
- package/src/ui/hooks/useAgentList.ts +57 -56
- package/src/ui/hooks/useAgentMutations.ts +168 -159
- package/src/ui/hooks/useRunList.ts +90 -57
- package/src/ui/hooks/useToolList.ts +102 -101
- package/src/ui/index.ts +6 -9
- package/src/ui/modals/AgentActionsModal.tsx +262 -262
- package/src/ui/modals/CreateAgentModal.tsx +232 -232
- package/src/ui/modals/index.ts +1 -1
- package/src/ui/overlays/demo-overlays.ts +52 -52
- package/src/ui/renderers/agent-list.markdown.ts +81 -61
- package/src/ui/renderers/agent-list.renderer.tsx +14 -14
- package/src/ui/renderers/dashboard.markdown.ts +135 -139
- package/src/ui/renderers/index.ts +3 -4
- package/src/ui/renderers/run-list.markdown.ts +56 -47
- package/src/ui/renderers/tool-registry.markdown.ts +79 -66
- package/src/ui/views/AgentListView.tsx +90 -90
- package/src/ui/views/RunDataTable.tsx +74 -0
- package/src/ui/views/RunListView.tsx +84 -158
- package/src/ui/views/ToolRegistryView.tsx +113 -113
- package/src/ui/views/run-data-table.columns.tsx +102 -0
- package/src/ui/views/run-list.shared.tsx +139 -0
- package/src/visualizations/catalog.ts +132 -0
- package/src/visualizations/index.ts +2 -0
- package/src/visualizations/selectors.test.ts +12 -0
- package/src/visualizations/selectors.ts +70 -0
- package/tsconfig.json +7 -8
- package/tsdown.config.js +24 -3
|
@@ -3,87 +3,100 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Uses dynamic import for handlers to ensure correct build order.
|
|
5
5
|
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
|
|
9
|
+
AGENT_CONSOLE_DEMO_PROJECT_ID,
|
|
10
|
+
createAgentConsoleDemoHandlers,
|
|
11
|
+
} from '@contractspec/example.agent-console/shared';
|
|
6
12
|
import type { PresentationSpec } from '@contractspec/lib.contracts-spec/presentations';
|
|
7
13
|
import type { PresentationRenderer } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
|
|
8
|
-
import { mockListToolsHandler } from '@contractspec/example.agent-console/handlers';
|
|
9
14
|
|
|
10
15
|
interface ToolItem {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
version: string;
|
|
20
|
+
category: string;
|
|
21
|
+
status: string;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
/**
|
|
20
|
-
* Markdown renderer for agent-console.tool.
|
|
25
|
+
* Markdown renderer for agent-console.tool.list presentation
|
|
21
26
|
* Only handles ToolRegistryView component
|
|
22
27
|
*/
|
|
23
28
|
export const toolRegistryMarkdownRenderer: PresentationRenderer<{
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
mimeType: string;
|
|
30
|
+
body: string;
|
|
26
31
|
}> = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
target: 'markdown',
|
|
33
|
+
render: async (desc: PresentationSpec, ctx) => {
|
|
34
|
+
// Only handle ToolRegistryView
|
|
35
|
+
if (
|
|
36
|
+
desc.source.type !== 'component' ||
|
|
37
|
+
desc.source.componentKey !== 'ToolRegistryView'
|
|
38
|
+
) {
|
|
39
|
+
throw new Error('toolRegistryMarkdownRenderer: not ToolRegistryView');
|
|
40
|
+
}
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const data = Array.isArray(ctx?.data)
|
|
43
|
+
? {
|
|
44
|
+
items: ctx.data as ToolItem[],
|
|
45
|
+
total: ctx.data.length,
|
|
46
|
+
hasMore: false,
|
|
47
|
+
}
|
|
48
|
+
: await createAgentConsoleDemoHandlers({
|
|
49
|
+
projectId: AGENT_CONSOLE_DEMO_PROJECT_ID,
|
|
50
|
+
}).listTools({
|
|
51
|
+
projectId: AGENT_CONSOLE_DEMO_PROJECT_ID,
|
|
52
|
+
organizationId: AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
|
|
53
|
+
limit: 50,
|
|
54
|
+
offset: 0,
|
|
55
|
+
});
|
|
43
56
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
// Generate markdown
|
|
58
|
+
const lines: string[] = [
|
|
59
|
+
`# ${desc.meta.description ?? 'Tool Registry'}`,
|
|
60
|
+
'',
|
|
61
|
+
`> ${desc.meta.key} v${desc.meta.version}`,
|
|
62
|
+
'',
|
|
63
|
+
`**Total Tools:** ${data.total}`,
|
|
64
|
+
'',
|
|
65
|
+
];
|
|
53
66
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
// Group by category
|
|
68
|
+
const byCategory: Record<string, ToolItem[]> = {};
|
|
69
|
+
for (const tool of data.items as ToolItem[]) {
|
|
70
|
+
const cat = tool.category;
|
|
71
|
+
if (!byCategory[cat]) byCategory[cat] = [];
|
|
72
|
+
byCategory[cat].push(tool);
|
|
73
|
+
}
|
|
61
74
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
for (const [category, tools] of Object.entries(byCategory).sort()) {
|
|
76
|
+
lines.push(`## ${category} (${tools.length})`);
|
|
77
|
+
lines.push('');
|
|
65
78
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
for (const tool of tools) {
|
|
80
|
+
const statusIcon =
|
|
81
|
+
tool.status === 'ACTIVE'
|
|
82
|
+
? '✅'
|
|
83
|
+
: tool.status === 'DEPRECATED'
|
|
84
|
+
? '⚠️'
|
|
85
|
+
: '❌';
|
|
86
|
+
lines.push(`### ${statusIcon} ${tool.name} v${tool.version}`);
|
|
87
|
+
lines.push('');
|
|
88
|
+
lines.push(`> \`${tool.id}\``);
|
|
89
|
+
lines.push('');
|
|
90
|
+
if (tool.description) {
|
|
91
|
+
lines.push(tool.description);
|
|
92
|
+
lines.push('');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
83
96
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
return {
|
|
98
|
+
mimeType: 'text/markdown',
|
|
99
|
+
body: lines.join('\n'),
|
|
100
|
+
};
|
|
101
|
+
},
|
|
89
102
|
};
|
|
@@ -7,107 +7,107 @@
|
|
|
7
7
|
* Uses design-system components with correct props.
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
Button,
|
|
11
|
+
EmptyState,
|
|
12
|
+
EntityCard,
|
|
13
|
+
ErrorState,
|
|
14
|
+
LoaderBlock,
|
|
15
|
+
StatCard,
|
|
16
|
+
StatCardGroup,
|
|
17
|
+
StatusChip,
|
|
18
18
|
} from '@contractspec/lib.design-system';
|
|
19
|
-
import {
|
|
19
|
+
import { type Agent, useAgentList } from '../hooks/useAgentList';
|
|
20
20
|
|
|
21
21
|
function getStatusTone(
|
|
22
|
-
|
|
22
|
+
status: Agent['status']
|
|
23
23
|
): 'success' | 'warning' | 'neutral' {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
switch (status) {
|
|
25
|
+
case 'ACTIVE':
|
|
26
|
+
return 'success';
|
|
27
|
+
case 'PAUSED':
|
|
28
|
+
case 'DRAFT':
|
|
29
|
+
return 'warning';
|
|
30
|
+
case 'ARCHIVED':
|
|
31
|
+
return 'neutral';
|
|
32
|
+
default:
|
|
33
|
+
return 'neutral';
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export function AgentListView() {
|
|
38
|
-
|
|
38
|
+
const { data, loading, error, stats, refetch } = useAgentList();
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (loading && !data) {
|
|
41
|
+
return <LoaderBlock label="Loading agents..." />;
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
if (error) {
|
|
45
|
+
return (
|
|
46
|
+
<ErrorState
|
|
47
|
+
title="Failed to load agents"
|
|
48
|
+
description={error.message}
|
|
49
|
+
onRetry={refetch}
|
|
50
|
+
retryLabel="Retry"
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
if (!data?.items.length) {
|
|
56
|
+
return (
|
|
57
|
+
<EmptyState
|
|
58
|
+
title="No agents yet"
|
|
59
|
+
description="Create your first AI agent to get started."
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
return (
|
|
65
|
+
<div className="space-y-6">
|
|
66
|
+
{/* Stats */}
|
|
67
|
+
{stats && (
|
|
68
|
+
<StatCardGroup>
|
|
69
|
+
<StatCard label="Total Agents" value={stats.total} />
|
|
70
|
+
<StatCard label="Active" value={stats.active} />
|
|
71
|
+
<StatCard label="Paused" value={stats.paused} />
|
|
72
|
+
<StatCard label="Draft" value={stats.draft} />
|
|
73
|
+
</StatCardGroup>
|
|
74
|
+
)}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
{/* Actions */}
|
|
77
|
+
<div className="flex items-center justify-between">
|
|
78
|
+
<h3 className="font-semibold text-lg">Agents</h3>
|
|
79
|
+
<Button onPress={() => alert('Create Agent clicked!')}>
|
|
80
|
+
Create Agent
|
|
81
|
+
</Button>
|
|
82
|
+
</div>
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
84
|
+
{/* Agent List */}
|
|
85
|
+
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
|
86
|
+
{data.items.map((agent) => (
|
|
87
|
+
<EntityCard
|
|
88
|
+
key={agent.id}
|
|
89
|
+
cardTitle={agent.name}
|
|
90
|
+
cardSubtitle={agent.modelName}
|
|
91
|
+
meta={
|
|
92
|
+
<p className="text-muted-foreground text-sm">
|
|
93
|
+
{agent.description}
|
|
94
|
+
</p>
|
|
95
|
+
}
|
|
96
|
+
chips={
|
|
97
|
+
<StatusChip
|
|
98
|
+
tone={getStatusTone(agent.status)}
|
|
99
|
+
label={agent.status}
|
|
100
|
+
/>
|
|
101
|
+
}
|
|
102
|
+
footer={
|
|
103
|
+
<span className="text-muted-foreground text-xs">
|
|
104
|
+
Created {agent.createdAt.toLocaleDateString()}
|
|
105
|
+
</span>
|
|
106
|
+
}
|
|
107
|
+
onClick={() => alert(`View agent: ${agent.name}`)}
|
|
108
|
+
/>
|
|
109
|
+
))}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
113
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { DataTable } from '@contractspec/lib.design-system';
|
|
4
|
+
import type { ContractTableSort } from '@contractspec/lib.presentation-runtime-core';
|
|
5
|
+
import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import type { Run } from '../hooks/useRunList';
|
|
8
|
+
import { createRunTableColumns } from './run-data-table.columns';
|
|
9
|
+
import { RunExpandedContent, RunTableToolbar } from './run-list.shared';
|
|
10
|
+
|
|
11
|
+
interface RunDataTableProps {
|
|
12
|
+
runs: Run[];
|
|
13
|
+
totalItems: number;
|
|
14
|
+
pageIndex: number;
|
|
15
|
+
pageSize: number;
|
|
16
|
+
sorting: ContractTableSort[];
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
onSortingChange: (nextSorting: ContractTableSort[]) => void;
|
|
19
|
+
onPaginationChange: (nextPagination: {
|
|
20
|
+
pageIndex: number;
|
|
21
|
+
pageSize: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
onRunClick?: (runId: string) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function RunDataTable({
|
|
27
|
+
runs,
|
|
28
|
+
totalItems,
|
|
29
|
+
pageIndex,
|
|
30
|
+
pageSize,
|
|
31
|
+
sorting,
|
|
32
|
+
loading,
|
|
33
|
+
onSortingChange,
|
|
34
|
+
onPaginationChange,
|
|
35
|
+
onRunClick,
|
|
36
|
+
}: RunDataTableProps) {
|
|
37
|
+
const columns = React.useMemo(() => createRunTableColumns(), []);
|
|
38
|
+
const controller = useContractTable<Run>({
|
|
39
|
+
data: runs,
|
|
40
|
+
columns,
|
|
41
|
+
executionMode: 'server',
|
|
42
|
+
totalItems,
|
|
43
|
+
state: {
|
|
44
|
+
sorting,
|
|
45
|
+
pagination: { pageIndex, pageSize },
|
|
46
|
+
},
|
|
47
|
+
onSortingChange,
|
|
48
|
+
onPaginationChange,
|
|
49
|
+
initialState: {
|
|
50
|
+
columnVisibility: { estimatedCostUsd: false },
|
|
51
|
+
},
|
|
52
|
+
getRowId: (run) => run.id,
|
|
53
|
+
renderExpandedContent: (run) => <RunExpandedContent run={run} />,
|
|
54
|
+
getCanExpand: () => true,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<DataTable
|
|
59
|
+
controller={controller}
|
|
60
|
+
title="Run History"
|
|
61
|
+
description="Server-mode ContractSpec table with shared pagination, sorting, visibility, and expansion."
|
|
62
|
+
loading={loading}
|
|
63
|
+
onRowPress={(row) => onRunClick?.(row.id)}
|
|
64
|
+
toolbar={
|
|
65
|
+
<RunTableToolbar controller={controller} totalRuns={totalItems} />
|
|
66
|
+
}
|
|
67
|
+
emptyState={
|
|
68
|
+
<div className="rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm">
|
|
69
|
+
No runs yet
|
|
70
|
+
</div>
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|