@contractspec/example.agent-console 1.46.1 → 1.48.0
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$colon$bundle.log +275 -128
- package/.turbo/turbo-build.log +274 -127
- package/CHANGELOG.md +52 -0
- package/dist/agent/agent.entity.d.ts +36 -36
- package/dist/agent/agent.entity.d.ts.map +1 -1
- package/dist/agent/agent.enum.d.ts +4 -4
- package/dist/agent/agent.enum.d.ts.map +1 -1
- package/dist/agent/agent.event.d.ts +31 -31
- package/dist/agent/agent.event.d.ts.map +1 -1
- package/dist/agent/agent.event.js +5 -5
- package/dist/agent/agent.event.js.map +1 -1
- package/dist/agent/agent.handler.js.map +1 -1
- package/dist/agent/agent.operation.d.ts +117 -117
- package/dist/agent/agent.operation.d.ts.map +1 -1
- package/dist/agent/agent.presentation.d.ts +4 -5
- package/dist/agent/agent.presentation.d.ts.map +1 -1
- package/dist/agent/agent.presentation.js +7 -7
- package/dist/agent/agent.presentation.js.map +1 -1
- package/dist/agent/agent.schema.d.ts +95 -95
- package/dist/agent/agent.schema.d.ts.map +1 -1
- package/dist/agent/agent.test-spec.d.ts +8 -0
- package/dist/agent/agent.test-spec.d.ts.map +1 -0
- package/dist/agent/agent.test-spec.js +65 -0
- package/dist/agent/agent.test-spec.js.map +1 -0
- package/dist/agent.capability.d.ts +7 -0
- package/dist/agent.capability.d.ts.map +1 -0
- package/dist/agent.capability.js +20 -0
- package/dist/agent.capability.js.map +1 -0
- package/dist/agent.feature.d.ts.map +1 -1
- package/dist/agent.feature.js +4 -2
- package/dist/agent.feature.js.map +1 -1
- package/dist/example.d.ts +2 -2
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +4 -2
- package/dist/example.js.map +1 -1
- package/dist/handlers/agent.handlers.d.ts +135 -0
- package/dist/handlers/agent.handlers.d.ts.map +1 -0
- package/dist/handlers/agent.handlers.js +263 -0
- package/dist/handlers/agent.handlers.js.map +1 -0
- package/dist/handlers/index.d.ts +2 -1
- package/dist/handlers/index.js +2 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +19 -1
- package/dist/run/run.entity.d.ts +56 -56
- package/dist/run/run.enum.d.ts +5 -5
- package/dist/run/run.event.d.ts +71 -71
- package/dist/run/run.event.js +8 -8
- package/dist/run/run.event.js.map +1 -1
- package/dist/run/run.operation.d.ts +175 -175
- package/dist/run/run.presentation.d.ts +3 -4
- package/dist/run/run.presentation.d.ts.map +1 -1
- package/dist/run/run.presentation.js +5 -5
- package/dist/run/run.presentation.js.map +1 -1
- package/dist/run/run.schema.d.ts +99 -99
- package/dist/run/run.test-spec.d.ts +8 -0
- package/dist/run/run.test-spec.d.ts.map +1 -0
- package/dist/run/run.test-spec.js +65 -0
- package/dist/run/run.test-spec.js.map +1 -0
- package/dist/seeders/index.d.ts +10 -0
- package/dist/seeders/index.d.ts.map +1 -0
- package/dist/seeders/index.js +20 -0
- package/dist/seeders/index.js.map +1 -0
- package/dist/shared/overlay-types.d.ts +34 -0
- package/dist/shared/overlay-types.d.ts.map +1 -0
- package/dist/shared/overlay-types.js +0 -0
- package/dist/tool/tool.entity.d.ts +24 -24
- package/dist/tool/tool.enum.d.ts +4 -4
- package/dist/tool/tool.event.d.ts +25 -25
- package/dist/tool/tool.event.js +4 -4
- package/dist/tool/tool.event.js.map +1 -1
- package/dist/tool/tool.handler.d.ts.map +1 -1
- package/dist/tool/tool.operation.d.ts +101 -101
- package/dist/tool/tool.presentation.d.ts +3 -4
- package/dist/tool/tool.presentation.d.ts.map +1 -1
- package/dist/tool/tool.presentation.js +5 -5
- package/dist/tool/tool.presentation.js.map +1 -1
- package/dist/tool/tool.schema.d.ts +52 -52
- package/dist/tool/tool.schema.d.ts.map +1 -1
- package/dist/tool/tool.test-spec.d.ts +8 -0
- package/dist/tool/tool.test-spec.d.ts.map +1 -0
- package/dist/tool/tool.test-spec.js +65 -0
- package/dist/tool/tool.test-spec.js.map +1 -0
- package/dist/ui/AgentDashboard.d.ts +7 -0
- package/dist/ui/AgentDashboard.d.ts.map +1 -0
- package/dist/ui/AgentDashboard.js +420 -0
- package/dist/ui/AgentDashboard.js.map +1 -0
- package/dist/ui/AgentRunList.d.ts +2 -0
- package/dist/ui/AgentRunList.js +5 -0
- package/dist/ui/AgentToolRegistry.d.ts +2 -0
- package/dist/ui/AgentToolRegistry.js +5 -0
- package/dist/ui/hooks/index.d.ts +6 -0
- package/dist/ui/hooks/index.js +8 -0
- package/dist/ui/hooks/useAgentList.d.ts +28 -0
- package/dist/ui/hooks/useAgentList.d.ts.map +1 -0
- package/dist/ui/hooks/useAgentList.js +66 -0
- package/dist/ui/hooks/useAgentList.js.map +1 -0
- package/dist/ui/hooks/useAgentMutations.d.ts +29 -0
- package/dist/ui/hooks/useAgentMutations.d.ts.map +1 -0
- package/dist/ui/hooks/useAgentMutations.js +124 -0
- package/dist/ui/hooks/useAgentMutations.js.map +1 -0
- package/dist/ui/hooks/useRunList.d.ts +24 -0
- package/dist/ui/hooks/useRunList.d.ts.map +1 -0
- package/dist/ui/hooks/useRunList.js +66 -0
- package/dist/ui/hooks/useRunList.js.map +1 -0
- package/dist/ui/hooks/useToolList.d.ts +40 -0
- package/dist/ui/hooks/useToolList.d.ts.map +1 -0
- package/dist/ui/hooks/useToolList.js +96 -0
- package/dist/ui/hooks/useToolList.js.map +1 -0
- package/dist/ui/index.d.ts +24 -0
- package/dist/ui/index.js +24 -0
- package/dist/ui/modals/AgentActionsModal.d.ts +27 -0
- package/dist/ui/modals/AgentActionsModal.d.ts.map +1 -0
- package/dist/ui/modals/AgentActionsModal.js +262 -0
- package/dist/ui/modals/AgentActionsModal.js.map +1 -0
- package/dist/ui/modals/CreateAgentModal.d.ts +25 -0
- package/dist/ui/modals/CreateAgentModal.d.ts.map +1 -0
- package/dist/ui/modals/CreateAgentModal.js +214 -0
- package/dist/ui/modals/CreateAgentModal.js.map +1 -0
- package/dist/ui/modals/index.d.ts +3 -0
- package/dist/ui/modals/index.js +4 -0
- package/dist/ui/overlays/demo-overlays.d.ts +19 -0
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -0
- package/dist/ui/overlays/demo-overlays.js +73 -0
- package/dist/ui/overlays/demo-overlays.js.map +1 -0
- package/dist/ui/overlays/index.d.ts +2 -0
- package/dist/ui/overlays/index.js +3 -0
- package/dist/ui/renderers/agent-list.markdown.d.ts +15 -0
- package/dist/ui/renderers/agent-list.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/agent-list.markdown.js +51 -0
- package/dist/ui/renderers/agent-list.markdown.js.map +1 -0
- package/dist/ui/renderers/agent-list.renderer.d.ts +11 -0
- package/dist/ui/renderers/agent-list.renderer.d.ts.map +1 -0
- package/dist/ui/renderers/agent-list.renderer.js +19 -0
- package/dist/ui/renderers/agent-list.renderer.js.map +1 -0
- package/dist/ui/renderers/dashboard.markdown.d.ts +15 -0
- package/dist/ui/renderers/dashboard.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/dashboard.markdown.js +100 -0
- package/dist/ui/renderers/dashboard.markdown.js.map +1 -0
- package/dist/ui/renderers/index.d.ts +6 -0
- package/dist/ui/renderers/index.js +7 -0
- package/dist/ui/renderers/run-list.markdown.d.ts +15 -0
- package/dist/ui/renderers/run-list.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/run-list.markdown.js +44 -0
- package/dist/ui/renderers/run-list.markdown.js.map +1 -0
- package/dist/ui/renderers/tool-registry.markdown.d.ts +15 -0
- package/dist/ui/renderers/tool-registry.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/tool-registry.markdown.js +55 -0
- package/dist/ui/renderers/tool-registry.markdown.js.map +1 -0
- package/dist/ui/views/AgentListView.d.ts +7 -0
- package/dist/ui/views/AgentListView.d.ts.map +1 -0
- package/dist/ui/views/AgentListView.js +93 -0
- package/dist/ui/views/AgentListView.js.map +1 -0
- package/dist/ui/views/RunListView.d.ts +14 -0
- package/dist/ui/views/RunListView.d.ts.map +1 -0
- package/dist/ui/views/RunListView.js +165 -0
- package/dist/ui/views/RunListView.js.map +1 -0
- package/dist/ui/views/ToolRegistryView.d.ts +14 -0
- package/dist/ui/views/ToolRegistryView.d.ts.map +1 -0
- package/dist/ui/views/ToolRegistryView.js +97 -0
- package/dist/ui/views/ToolRegistryView.js.map +1 -0
- package/dist/ui/views/index.d.ts +4 -0
- package/dist/ui/views/index.js +5 -0
- package/package.json +46 -10
- package/src/agent/agent.presentation.ts +7 -8
- package/src/agent/agent.test-spec.ts +55 -0
- package/src/agent.capability.ts +13 -0
- package/src/agent.feature.ts +3 -2
- package/src/example.ts +3 -3
- package/src/handlers/agent.handlers.ts +572 -0
- package/src/handlers/index.ts +3 -0
- package/src/index.ts +5 -0
- package/src/run/run.presentation.ts +5 -6
- package/src/run/run.test-spec.ts +55 -0
- package/src/seeders/index.ts +29 -0
- package/src/shared/overlay-types.ts +39 -0
- package/src/tool/tool.presentation.ts +5 -6
- package/src/tool/tool.test-spec.ts +55 -0
- package/src/ui/AgentDashboard.tsx +416 -0
- package/src/ui/AgentRunList.tsx +8 -0
- package/src/ui/AgentToolRegistry.tsx +8 -0
- package/src/ui/hooks/index.ts +14 -0
- package/src/ui/hooks/useAgentList.ts +80 -0
- package/src/ui/hooks/useAgentMutations.ts +156 -0
- package/src/ui/hooks/useRunList.ts +81 -0
- package/src/ui/hooks/useToolList.ts +122 -0
- package/src/ui/index.ts +21 -0
- package/src/ui/modals/AgentActionsModal.tsx +306 -0
- package/src/ui/modals/CreateAgentModal.tsx +257 -0
- package/src/ui/modals/index.ts +2 -0
- package/src/ui/overlays/demo-overlays.ts +77 -0
- package/src/ui/overlays/index.ts +1 -0
- package/src/ui/renderers/agent-list.markdown.ts +84 -0
- package/src/ui/renderers/agent-list.renderer.tsx +27 -0
- package/src/ui/renderers/dashboard.markdown.ts +169 -0
- package/src/ui/renderers/index.ts +12 -0
- package/src/ui/renderers/run-list.markdown.ts +75 -0
- package/src/ui/renderers/tool-registry.markdown.ts +91 -0
- package/src/ui/views/AgentListView.tsx +113 -0
- package/src/ui/views/RunListView.tsx +173 -0
- package/src/ui/views/ToolRegistryView.tsx +140 -0
- package/src/ui/views/index.ts +6 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useRunList } from "../hooks/useRunList.js";
|
|
4
|
+
import { EmptyState, ErrorState, LoaderBlock, StatCard, StatCardGroup, StatusChip } from "@contractspec/lib.design-system";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/ui/views/RunListView.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Run List View - Shows agent execution runs with stats
|
|
10
|
+
*/
|
|
11
|
+
function getStatusTone(status) {
|
|
12
|
+
switch (status) {
|
|
13
|
+
case "COMPLETED": return "success";
|
|
14
|
+
case "RUNNING": return "warning";
|
|
15
|
+
case "QUEUED": return "neutral";
|
|
16
|
+
case "FAILED":
|
|
17
|
+
case "CANCELLED": return "danger";
|
|
18
|
+
default: return "neutral";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function formatDuration(ms) {
|
|
22
|
+
if (!ms) return "-";
|
|
23
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
24
|
+
if (ms < 6e4) return `${(ms / 1e3).toFixed(1)}s`;
|
|
25
|
+
return `${(ms / 6e4).toFixed(1)}m`;
|
|
26
|
+
}
|
|
27
|
+
function formatTokens(tokens) {
|
|
28
|
+
if (tokens < 1e3) return tokens.toString();
|
|
29
|
+
if (tokens < 1e6) return `${(tokens / 1e3).toFixed(1)}K`;
|
|
30
|
+
return `${(tokens / 1e6).toFixed(2)}M`;
|
|
31
|
+
}
|
|
32
|
+
function formatCost(cost) {
|
|
33
|
+
if (!cost) return "-";
|
|
34
|
+
return `$${cost.toFixed(4)}`;
|
|
35
|
+
}
|
|
36
|
+
function RunListView({ agentId, onRunClick }) {
|
|
37
|
+
const { data, metrics, loading, error, refetch } = useRunList({ agentId });
|
|
38
|
+
if (loading && !data) return /* @__PURE__ */ jsx(LoaderBlock, { label: "Loading runs..." });
|
|
39
|
+
if (error) return /* @__PURE__ */ jsx(ErrorState, {
|
|
40
|
+
title: "Failed to load runs",
|
|
41
|
+
description: error.message,
|
|
42
|
+
onRetry: refetch,
|
|
43
|
+
retryLabel: "Retry"
|
|
44
|
+
});
|
|
45
|
+
if (!data?.items.length) return /* @__PURE__ */ jsx(EmptyState, {
|
|
46
|
+
title: "No runs yet",
|
|
47
|
+
description: "Execute an agent to see run history here."
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "space-y-6",
|
|
51
|
+
children: [
|
|
52
|
+
metrics && /* @__PURE__ */ jsxs(StatCardGroup, { children: [
|
|
53
|
+
/* @__PURE__ */ jsx(StatCard, {
|
|
54
|
+
label: "Total Runs",
|
|
55
|
+
value: metrics.totalRuns
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx(StatCard, {
|
|
58
|
+
label: "Success Rate",
|
|
59
|
+
value: `${(metrics.successRate * 100).toFixed(1)}%`
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ jsx(StatCard, {
|
|
62
|
+
label: "Total Tokens",
|
|
63
|
+
value: formatTokens(metrics.totalTokens)
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ jsx(StatCard, {
|
|
66
|
+
label: "Total Cost",
|
|
67
|
+
value: `$${metrics.totalCostUsd.toFixed(2)}`
|
|
68
|
+
})
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ jsx("div", {
|
|
71
|
+
className: "border-border rounded-lg border",
|
|
72
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
73
|
+
className: "w-full",
|
|
74
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
75
|
+
className: "border-border bg-muted/30 border-b",
|
|
76
|
+
children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
77
|
+
/* @__PURE__ */ jsx("th", {
|
|
78
|
+
className: "text-muted-foreground px-4 py-3 text-left text-sm font-medium",
|
|
79
|
+
children: "Run"
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsx("th", {
|
|
82
|
+
className: "text-muted-foreground px-4 py-3 text-left text-sm font-medium",
|
|
83
|
+
children: "Agent"
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx("th", {
|
|
86
|
+
className: "text-muted-foreground px-4 py-3 text-left text-sm font-medium",
|
|
87
|
+
children: "Status"
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ jsx("th", {
|
|
90
|
+
className: "text-muted-foreground px-4 py-3 text-right text-sm font-medium",
|
|
91
|
+
children: "Tokens"
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx("th", {
|
|
94
|
+
className: "text-muted-foreground px-4 py-3 text-right text-sm font-medium",
|
|
95
|
+
children: "Duration"
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx("th", {
|
|
98
|
+
className: "text-muted-foreground px-4 py-3 text-right text-sm font-medium",
|
|
99
|
+
children: "Cost"
|
|
100
|
+
})
|
|
101
|
+
] })
|
|
102
|
+
}), /* @__PURE__ */ jsx("tbody", {
|
|
103
|
+
className: "divide-border divide-y",
|
|
104
|
+
children: data.items.map((run) => /* @__PURE__ */ jsxs("tr", {
|
|
105
|
+
className: "hover:bg-muted/50 cursor-pointer transition-colors",
|
|
106
|
+
onClick: () => onRunClick?.(run.id),
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsxs("td", {
|
|
109
|
+
className: "px-4 py-3",
|
|
110
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
111
|
+
className: "font-mono text-sm",
|
|
112
|
+
children: run.id.slice(-8)
|
|
113
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
114
|
+
className: "text-muted-foreground text-xs",
|
|
115
|
+
children: run.queuedAt.toLocaleString()
|
|
116
|
+
})]
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ jsx("td", {
|
|
119
|
+
className: "px-4 py-3",
|
|
120
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
121
|
+
className: "font-medium",
|
|
122
|
+
children: run.agentName
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ jsx("td", {
|
|
126
|
+
className: "px-4 py-3",
|
|
127
|
+
children: /* @__PURE__ */ jsx(StatusChip, {
|
|
128
|
+
tone: getStatusTone(run.status),
|
|
129
|
+
label: run.status
|
|
130
|
+
})
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ jsx("td", {
|
|
133
|
+
className: "px-4 py-3 text-right font-mono text-sm",
|
|
134
|
+
children: formatTokens(run.totalTokens)
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ jsx("td", {
|
|
137
|
+
className: "px-4 py-3 text-right font-mono text-sm",
|
|
138
|
+
children: formatDuration(run.durationMs)
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ jsx("td", {
|
|
141
|
+
className: "px-4 py-3 text-right font-mono text-sm",
|
|
142
|
+
children: formatCost(run.estimatedCostUsd)
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
}, run.id))
|
|
146
|
+
})]
|
|
147
|
+
})
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ jsxs("div", {
|
|
150
|
+
className: "text-muted-foreground text-center text-sm",
|
|
151
|
+
children: [
|
|
152
|
+
"Showing ",
|
|
153
|
+
data.items.length,
|
|
154
|
+
" of ",
|
|
155
|
+
data.total,
|
|
156
|
+
" runs"
|
|
157
|
+
]
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
export { RunListView };
|
|
165
|
+
//# sourceMappingURL=RunListView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunListView.js","names":[],"sources":["../../../src/ui/views/RunListView.tsx"],"sourcesContent":["'use client';\n\n/**\n * Run List View - Shows agent execution runs with stats\n */\nimport {\n StatCard,\n StatCardGroup,\n StatusChip,\n EmptyState,\n LoaderBlock,\n ErrorState,\n} from '@contractspec/lib.design-system';\nimport { useRunList, type Run } from '../hooks/useRunList';\n\ninterface RunListViewProps {\n agentId?: string;\n onRunClick?: (runId: string) => void;\n}\n\nfunction getStatusTone(\n status: Run['status']\n): 'success' | 'warning' | 'neutral' | 'danger' {\n switch (status) {\n case 'COMPLETED':\n return 'success';\n case 'RUNNING':\n return 'warning';\n case 'QUEUED':\n return 'neutral';\n case 'FAILED':\n case 'CANCELLED':\n return 'danger';\n default:\n return 'neutral';\n }\n}\n\nfunction formatDuration(ms?: number): string {\n if (!ms) return '-';\n if (ms < 1000) return `${ms}ms`;\n if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;\n return `${(ms / 60000).toFixed(1)}m`;\n}\n\nfunction formatTokens(tokens: number): string {\n if (tokens < 1000) return tokens.toString();\n if (tokens < 1000000) return `${(tokens / 1000).toFixed(1)}K`;\n return `${(tokens / 1000000).toFixed(2)}M`;\n}\n\nfunction formatCost(cost?: number): string {\n if (!cost) return '-';\n return `$${cost.toFixed(4)}`;\n}\n\nexport function RunListView({ agentId, onRunClick }: RunListViewProps) {\n const { data, metrics, loading, error, refetch } = useRunList({ agentId });\n\n if (loading && !data) {\n return <LoaderBlock label=\"Loading runs...\" />;\n }\n\n if (error) {\n return (\n <ErrorState\n title=\"Failed to load runs\"\n description={error.message}\n onRetry={refetch}\n retryLabel=\"Retry\"\n />\n );\n }\n\n if (!data?.items.length) {\n return (\n <EmptyState\n title=\"No runs yet\"\n description=\"Execute an agent to see run history here.\"\n />\n );\n }\n\n return (\n <div className=\"space-y-6\">\n {/* Metrics Stats */}\n {metrics && (\n <StatCardGroup>\n <StatCard label=\"Total Runs\" value={metrics.totalRuns} />\n <StatCard\n label=\"Success Rate\"\n value={`${(metrics.successRate * 100).toFixed(1)}%`}\n />\n <StatCard\n label=\"Total Tokens\"\n value={formatTokens(metrics.totalTokens)}\n />\n <StatCard\n label=\"Total Cost\"\n value={`$${metrics.totalCostUsd.toFixed(2)}`}\n />\n </StatCardGroup>\n )}\n\n {/* Run List */}\n <div className=\"border-border rounded-lg border\">\n <table className=\"w-full\">\n <thead className=\"border-border bg-muted/30 border-b\">\n <tr>\n <th className=\"text-muted-foreground px-4 py-3 text-left text-sm font-medium\">\n Run\n </th>\n <th className=\"text-muted-foreground px-4 py-3 text-left text-sm font-medium\">\n Agent\n </th>\n <th className=\"text-muted-foreground px-4 py-3 text-left text-sm font-medium\">\n Status\n </th>\n <th className=\"text-muted-foreground px-4 py-3 text-right text-sm font-medium\">\n Tokens\n </th>\n <th className=\"text-muted-foreground px-4 py-3 text-right text-sm font-medium\">\n Duration\n </th>\n <th className=\"text-muted-foreground px-4 py-3 text-right text-sm font-medium\">\n Cost\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-border divide-y\">\n {data.items.map((run: Run) => (\n <tr\n key={run.id}\n className=\"hover:bg-muted/50 cursor-pointer transition-colors\"\n onClick={() => onRunClick?.(run.id)}\n >\n <td className=\"px-4 py-3\">\n <div className=\"font-mono text-sm\">{run.id.slice(-8)}</div>\n <div className=\"text-muted-foreground text-xs\">\n {run.queuedAt.toLocaleString()}\n </div>\n </td>\n <td className=\"px-4 py-3\">\n <span className=\"font-medium\">{run.agentName}</span>\n </td>\n <td className=\"px-4 py-3\">\n <StatusChip\n tone={getStatusTone(run.status)}\n label={run.status}\n />\n </td>\n <td className=\"px-4 py-3 text-right font-mono text-sm\">\n {formatTokens(run.totalTokens)}\n </td>\n <td className=\"px-4 py-3 text-right font-mono text-sm\">\n {formatDuration(run.durationMs)}\n </td>\n <td className=\"px-4 py-3 text-right font-mono text-sm\">\n {formatCost(run.estimatedCostUsd)}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n\n {/* Pagination */}\n <div className=\"text-muted-foreground text-center text-sm\">\n Showing {data.items.length} of {data.total} runs\n </div>\n </div>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/ui/views/ToolRegistryView.d.ts
|
|
4
|
+
interface ToolRegistryViewProps {
|
|
5
|
+
onToolClick?: (toolId: string) => void;
|
|
6
|
+
onCreateTool?: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare function ToolRegistryView({
|
|
9
|
+
onToolClick,
|
|
10
|
+
onCreateTool
|
|
11
|
+
}: ToolRegistryViewProps): react_jsx_runtime1.JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ToolRegistryView };
|
|
14
|
+
//# sourceMappingURL=ToolRegistryView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolRegistryView.d.ts","names":[],"sources":["../../../src/ui/views/ToolRegistryView.tsx"],"sourcesContent":[],"mappings":";;;UAiBU,qBAAA;;;AAkCc;AAHR,iBAAA,gBAAA,CAAgB;EAAA,WAAA;EAAA;AAAA,CAAA,EAG7B,qBAH6B,CAAA,EAGR,kBAAA,CAAA,GAAA,CAAA,OAHQ"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useToolList } from "../hooks/useToolList.js";
|
|
4
|
+
import { Button, EmptyState, EntityCard, ErrorState, LoaderBlock, StatCard, StatCardGroup, StatusChip } from "@contractspec/lib.design-system";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/ui/views/ToolRegistryView.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Tool Registry View - Shows available tools organized by category
|
|
10
|
+
*/
|
|
11
|
+
const categoryIcons = {
|
|
12
|
+
RETRIEVAL: "🔍",
|
|
13
|
+
COMPUTATION: "🧮",
|
|
14
|
+
COMMUNICATION: "📧",
|
|
15
|
+
INTEGRATION: "🔗",
|
|
16
|
+
UTILITY: "🛠️",
|
|
17
|
+
CUSTOM: "⚙️"
|
|
18
|
+
};
|
|
19
|
+
function getStatusTone(status) {
|
|
20
|
+
switch (status) {
|
|
21
|
+
case "ACTIVE": return "success";
|
|
22
|
+
case "DRAFT": return "neutral";
|
|
23
|
+
case "DEPRECATED": return "warning";
|
|
24
|
+
case "DISABLED": return "danger";
|
|
25
|
+
default: return "neutral";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function ToolRegistryView({ onToolClick, onCreateTool }) {
|
|
29
|
+
const { data, loading, error, groupedByCategory, categoryStats, refetch } = useToolList();
|
|
30
|
+
if (loading && !data) return /* @__PURE__ */ jsx(LoaderBlock, { label: "Loading tools..." });
|
|
31
|
+
if (error) return /* @__PURE__ */ jsx(ErrorState, {
|
|
32
|
+
title: "Failed to load tools",
|
|
33
|
+
description: error.message,
|
|
34
|
+
onRetry: refetch,
|
|
35
|
+
retryLabel: "Retry"
|
|
36
|
+
});
|
|
37
|
+
if (!data?.items.length) return /* @__PURE__ */ jsx(EmptyState, {
|
|
38
|
+
title: "No tools registered",
|
|
39
|
+
description: "Create your first tool to extend agent capabilities.",
|
|
40
|
+
primaryAction: onCreateTool ? /* @__PURE__ */ jsx(Button, {
|
|
41
|
+
onPress: onCreateTool,
|
|
42
|
+
children: "Create Tool"
|
|
43
|
+
}) : void 0
|
|
44
|
+
});
|
|
45
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: "space-y-8",
|
|
47
|
+
children: [/* @__PURE__ */ jsxs(StatCardGroup, { children: [/* @__PURE__ */ jsx(StatCard, {
|
|
48
|
+
label: "Total Tools",
|
|
49
|
+
value: data.total
|
|
50
|
+
}), categoryStats.slice(0, 3).map(({ category, count }) => /* @__PURE__ */ jsx(StatCard, {
|
|
51
|
+
label: `${categoryIcons[category] ?? ""} ${category}`,
|
|
52
|
+
value: count
|
|
53
|
+
}, category))] }), Object.entries(groupedByCategory).map(([category, tools]) => /* @__PURE__ */ jsxs("section", {
|
|
54
|
+
className: "space-y-4",
|
|
55
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
56
|
+
className: "flex items-center gap-2",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx("span", {
|
|
59
|
+
className: "text-2xl",
|
|
60
|
+
children: categoryIcons[category]
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx("h3", {
|
|
63
|
+
className: "text-lg font-semibold",
|
|
64
|
+
children: category
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "bg-muted text-muted-foreground rounded-full px-2 py-0.5 text-xs",
|
|
68
|
+
children: tools.length
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
72
|
+
className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3",
|
|
73
|
+
children: tools.map((tool) => /* @__PURE__ */ jsx(EntityCard, {
|
|
74
|
+
cardTitle: tool.name,
|
|
75
|
+
cardSubtitle: `v${tool.version}`,
|
|
76
|
+
meta: /* @__PURE__ */ jsx("p", {
|
|
77
|
+
className: "text-muted-foreground text-sm",
|
|
78
|
+
children: tool.description
|
|
79
|
+
}),
|
|
80
|
+
chips: /* @__PURE__ */ jsx(StatusChip, {
|
|
81
|
+
tone: getStatusTone(tool.status),
|
|
82
|
+
label: tool.status
|
|
83
|
+
}),
|
|
84
|
+
footer: /* @__PURE__ */ jsx("code", {
|
|
85
|
+
className: "text-muted-foreground text-xs",
|
|
86
|
+
children: tool.name
|
|
87
|
+
}),
|
|
88
|
+
onClick: onToolClick ? () => onToolClick(tool.id) : void 0
|
|
89
|
+
}, tool.id))
|
|
90
|
+
})]
|
|
91
|
+
}, category))]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { ToolRegistryView };
|
|
97
|
+
//# sourceMappingURL=ToolRegistryView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolRegistryView.js","names":[],"sources":["../../../src/ui/views/ToolRegistryView.tsx"],"sourcesContent":["'use client';\n\n/**\n * Tool Registry View - Shows available tools organized by category\n */\nimport {\n StatCard,\n StatCardGroup,\n StatusChip,\n EntityCard,\n EmptyState,\n LoaderBlock,\n ErrorState,\n Button,\n} from '@contractspec/lib.design-system';\nimport { useToolList, type Tool } from '../hooks/useToolList';\n\ninterface ToolRegistryViewProps {\n onToolClick?: (toolId: string) => void;\n onCreateTool?: () => void;\n}\n\nconst categoryIcons: Record<string, string> = {\n RETRIEVAL: '🔍',\n COMPUTATION: '🧮',\n COMMUNICATION: '📧',\n INTEGRATION: '🔗',\n UTILITY: '🛠️',\n CUSTOM: '⚙️',\n};\n\nfunction getStatusTone(\n status: Tool['status']\n): 'success' | 'warning' | 'neutral' | 'danger' {\n switch (status) {\n case 'ACTIVE':\n return 'success';\n case 'DRAFT':\n return 'neutral';\n case 'DEPRECATED':\n return 'warning';\n case 'DISABLED':\n return 'danger';\n default:\n return 'neutral';\n }\n}\n\nexport function ToolRegistryView({\n onToolClick,\n onCreateTool,\n}: ToolRegistryViewProps) {\n const { data, loading, error, groupedByCategory, categoryStats, refetch } =\n useToolList();\n\n if (loading && !data) {\n return <LoaderBlock label=\"Loading tools...\" />;\n }\n\n if (error) {\n return (\n <ErrorState\n title=\"Failed to load tools\"\n description={error.message}\n onRetry={refetch}\n retryLabel=\"Retry\"\n />\n );\n }\n\n if (!data?.items.length) {\n return (\n <EmptyState\n title=\"No tools registered\"\n description=\"Create your first tool to extend agent capabilities.\"\n primaryAction={\n onCreateTool ? (\n <Button onPress={onCreateTool}>Create Tool</Button>\n ) : undefined\n }\n />\n );\n }\n\n return (\n <div className=\"space-y-8\">\n {/* Category Stats */}\n <StatCardGroup>\n <StatCard label=\"Total Tools\" value={data.total} />\n {categoryStats.slice(0, 3).map(({ category, count }) => (\n <StatCard\n key={category}\n label={`${categoryIcons[category] ?? ''} ${category}`}\n value={count}\n />\n ))}\n </StatCardGroup>\n\n {/* Tools by Category */}\n {Object.entries(groupedByCategory).map(([category, tools]) => (\n <section key={category} className=\"space-y-4\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-2xl\">{categoryIcons[category]}</span>\n <h3 className=\"text-lg font-semibold\">{category}</h3>\n <span className=\"bg-muted text-muted-foreground rounded-full px-2 py-0.5 text-xs\">\n {(tools as Tool[]).length}\n </span>\n </div>\n\n <div className=\"grid gap-4 md:grid-cols-2 lg:grid-cols-3\">\n {(tools as Tool[]).map((tool) => (\n <EntityCard\n key={tool.id}\n cardTitle={tool.name}\n cardSubtitle={`v${tool.version}`}\n meta={\n <p className=\"text-muted-foreground text-sm\">\n {tool.description}\n </p>\n }\n chips={\n <StatusChip\n tone={getStatusTone(tool.status)}\n label={tool.status}\n />\n }\n footer={\n <code className=\"text-muted-foreground text-xs\">\n {tool.name}\n </code>\n }\n onClick={onToolClick ? () => onToolClick(tool.id) : undefined}\n />\n ))}\n </div>\n </section>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAsBA,MAAM,gBAAwC;CAC5C,WAAW;CACX,aAAa;CACb,eAAe;CACf,aAAa;CACb,SAAS;CACT,QAAQ;CACT;AAED,SAAS,cACP,QAC8C;AAC9C,SAAQ,QAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,aACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,QACE,QAAO;;;AAIb,SAAgB,iBAAiB,EAC/B,aACA,gBACwB;CACxB,MAAM,EAAE,MAAM,SAAS,OAAO,mBAAmB,eAAe,YAC9D,aAAa;AAEf,KAAI,WAAW,CAAC,KACd,QAAO,oBAAC,eAAY,OAAM,qBAAqB;AAGjD,KAAI,MACF,QACE,oBAAC;EACC,OAAM;EACN,aAAa,MAAM;EACnB,SAAS;EACT,YAAW;GACX;AAIN,KAAI,CAAC,MAAM,MAAM,OACf,QACE,oBAAC;EACC,OAAM;EACN,aAAY;EACZ,eACE,eACE,oBAAC;GAAO,SAAS;aAAc;IAAoB,GACjD;GAEN;AAIN,QACE,qBAAC;EAAI,WAAU;aAEb,qBAAC,4BACC,oBAAC;GAAS,OAAM;GAAc,OAAO,KAAK;IAAS,EAClD,cAAc,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,YAC1C,oBAAC;GAEC,OAAO,GAAG,cAAc,aAAa,GAAG,GAAG;GAC3C,OAAO;KAFF,SAGL,CACF,IACY,EAGf,OAAO,QAAQ,kBAAkB,CAAC,KAAK,CAAC,UAAU,WACjD,qBAAC;GAAuB,WAAU;cAChC,qBAAC;IAAI,WAAU;;KACb,oBAAC;MAAK,WAAU;gBAAY,cAAc;OAAiB;KAC3D,oBAAC;MAAG,WAAU;gBAAyB;OAAc;KACrD,oBAAC;MAAK,WAAU;gBACZ,MAAiB;OACd;;KACH,EAEN,oBAAC;IAAI,WAAU;cACX,MAAiB,KAAK,SACtB,oBAAC;KAEC,WAAW,KAAK;KAChB,cAAc,IAAI,KAAK;KACvB,MACE,oBAAC;MAAE,WAAU;gBACV,KAAK;OACJ;KAEN,OACE,oBAAC;MACC,MAAM,cAAc,KAAK,OAAO;MAChC,OAAO,KAAK;OACZ;KAEJ,QACE,oBAAC;MAAK,WAAU;gBACb,KAAK;OACD;KAET,SAAS,oBAAoB,YAAY,KAAK,GAAG,GAAG;OAnB/C,KAAK,GAoBV,CACF;KACE;KAlCM,SAmCJ,CACV;GACE"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.agent-console",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Agent Console example - AI agent orchestration with tools, runs, and logs",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
6
|
"types": "./dist/index.d.ts",
|
|
8
7
|
"exports": {
|
|
9
8
|
".": "./dist/index.js",
|
|
10
9
|
"./agent": "./dist/agent/index.js",
|
|
10
|
+
"./agent.capability": "./dist/agent.capability.js",
|
|
11
11
|
"./agent.feature": "./dist/agent.feature.js",
|
|
12
12
|
"./agent/agent.entity": "./dist/agent/agent.entity.js",
|
|
13
13
|
"./agent/agent.enum": "./dist/agent/agent.enum.js",
|
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
"./agent/agent.operation": "./dist/agent/agent.operation.js",
|
|
17
17
|
"./agent/agent.presentation": "./dist/agent/agent.presentation.js",
|
|
18
18
|
"./agent/agent.schema": "./dist/agent/agent.schema.js",
|
|
19
|
+
"./agent/agent.test-spec": "./dist/agent/agent.test-spec.js",
|
|
19
20
|
"./docs": "./dist/docs/index.js",
|
|
20
21
|
"./docs/agent-console.docblock": "./dist/docs/agent-console.docblock.js",
|
|
21
22
|
"./example": "./dist/example.js",
|
|
22
23
|
"./handlers": "./dist/handlers/index.js",
|
|
24
|
+
"./handlers/agent.handlers": "./dist/handlers/agent.handlers.js",
|
|
23
25
|
"./presentations": "./dist/presentations/index.js",
|
|
24
26
|
"./run": "./dist/run/index.js",
|
|
25
27
|
"./run/run.entity": "./dist/run/run.entity.js",
|
|
@@ -29,10 +31,13 @@
|
|
|
29
31
|
"./run/run.operation": "./dist/run/run.operation.js",
|
|
30
32
|
"./run/run.presentation": "./dist/run/run.presentation.js",
|
|
31
33
|
"./run/run.schema": "./dist/run/run.schema.js",
|
|
34
|
+
"./run/run.test-spec": "./dist/run/run.test-spec.js",
|
|
35
|
+
"./seeders": "./dist/seeders/index.js",
|
|
32
36
|
"./shared": "./dist/shared/index.js",
|
|
33
37
|
"./shared/mock-agents": "./dist/shared/mock-agents.js",
|
|
34
38
|
"./shared/mock-runs": "./dist/shared/mock-runs.js",
|
|
35
39
|
"./shared/mock-tools": "./dist/shared/mock-tools.js",
|
|
40
|
+
"./shared/overlay-types": "./dist/shared/overlay-types.js",
|
|
36
41
|
"./tool": "./dist/tool/index.js",
|
|
37
42
|
"./tool/tool.entity": "./dist/tool/tool.entity.js",
|
|
38
43
|
"./tool/tool.enum": "./dist/tool/tool.enum.js",
|
|
@@ -41,6 +46,31 @@
|
|
|
41
46
|
"./tool/tool.operation": "./dist/tool/tool.operation.js",
|
|
42
47
|
"./tool/tool.presentation": "./dist/tool/tool.presentation.js",
|
|
43
48
|
"./tool/tool.schema": "./dist/tool/tool.schema.js",
|
|
49
|
+
"./tool/tool.test-spec": "./dist/tool/tool.test-spec.js",
|
|
50
|
+
"./ui": "./dist/ui/index.js",
|
|
51
|
+
"./ui/AgentDashboard": "./dist/ui/AgentDashboard.js",
|
|
52
|
+
"./ui/AgentRunList": "./dist/ui/AgentRunList.js",
|
|
53
|
+
"./ui/AgentToolRegistry": "./dist/ui/AgentToolRegistry.js",
|
|
54
|
+
"./ui/hooks": "./dist/ui/hooks/index.js",
|
|
55
|
+
"./ui/hooks/useAgentList": "./dist/ui/hooks/useAgentList.js",
|
|
56
|
+
"./ui/hooks/useAgentMutations": "./dist/ui/hooks/useAgentMutations.js",
|
|
57
|
+
"./ui/hooks/useRunList": "./dist/ui/hooks/useRunList.js",
|
|
58
|
+
"./ui/hooks/useToolList": "./dist/ui/hooks/useToolList.js",
|
|
59
|
+
"./ui/modals": "./dist/ui/modals/index.js",
|
|
60
|
+
"./ui/modals/AgentActionsModal": "./dist/ui/modals/AgentActionsModal.js",
|
|
61
|
+
"./ui/modals/CreateAgentModal": "./dist/ui/modals/CreateAgentModal.js",
|
|
62
|
+
"./ui/overlays": "./dist/ui/overlays/index.js",
|
|
63
|
+
"./ui/overlays/demo-overlays": "./dist/ui/overlays/demo-overlays.js",
|
|
64
|
+
"./ui/renderers": "./dist/ui/renderers/index.js",
|
|
65
|
+
"./ui/renderers/agent-list.markdown": "./dist/ui/renderers/agent-list.markdown.js",
|
|
66
|
+
"./ui/renderers/agent-list.renderer": "./dist/ui/renderers/agent-list.renderer.js",
|
|
67
|
+
"./ui/renderers/dashboard.markdown": "./dist/ui/renderers/dashboard.markdown.js",
|
|
68
|
+
"./ui/renderers/run-list.markdown": "./dist/ui/renderers/run-list.markdown.js",
|
|
69
|
+
"./ui/renderers/tool-registry.markdown": "./dist/ui/renderers/tool-registry.markdown.js",
|
|
70
|
+
"./ui/views": "./dist/ui/views/index.js",
|
|
71
|
+
"./ui/views/AgentListView": "./dist/ui/views/AgentListView.js",
|
|
72
|
+
"./ui/views/RunListView": "./dist/ui/views/RunListView.js",
|
|
73
|
+
"./ui/views/ToolRegistryView": "./dist/ui/views/ToolRegistryView.js",
|
|
44
74
|
"./*": "./*"
|
|
45
75
|
},
|
|
46
76
|
"scripts": {
|
|
@@ -54,19 +84,25 @@
|
|
|
54
84
|
"lint": "bun lint:fix",
|
|
55
85
|
"lint:fix": "eslint src --fix",
|
|
56
86
|
"lint:check": "eslint src",
|
|
57
|
-
"test": "bun
|
|
87
|
+
"test": "bun test"
|
|
58
88
|
},
|
|
59
89
|
"dependencies": {
|
|
60
|
-
"@contractspec/lib.schema": "1.
|
|
61
|
-
"@contractspec/lib.contracts": "1.
|
|
90
|
+
"@contractspec/lib.schema": "1.48.0",
|
|
91
|
+
"@contractspec/lib.contracts": "1.48.0",
|
|
92
|
+
"@contractspec/lib.example-shared-ui": "1.2.0",
|
|
93
|
+
"@contractspec/lib.design-system": "1.48.0",
|
|
94
|
+
"@contractspec/lib.runtime-sandbox": "0.3.0",
|
|
95
|
+
"react": "19.2.3",
|
|
96
|
+
"react-dom": "19.2.3"
|
|
62
97
|
},
|
|
63
98
|
"devDependencies": {
|
|
64
|
-
"@contractspec/tool.tsdown": "1.
|
|
65
|
-
"@contractspec/tool.typescript": "1.
|
|
66
|
-
"tsdown": "^0.
|
|
67
|
-
"typescript": "^5.9.3"
|
|
99
|
+
"@contractspec/tool.tsdown": "1.48.0",
|
|
100
|
+
"@contractspec/tool.typescript": "1.48.0",
|
|
101
|
+
"tsdown": "^0.19.0",
|
|
102
|
+
"typescript": "^5.9.3",
|
|
103
|
+
"@types/react": "^19.2.8",
|
|
104
|
+
"@types/react-dom": "^19.2.2"
|
|
68
105
|
},
|
|
69
|
-
"module": "./dist/index.js",
|
|
70
106
|
"publishConfig": {
|
|
71
107
|
"exports": {
|
|
72
108
|
".": "./dist/index.js",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { StabilityEnum } from '@contractspec/lib.contracts';
|
|
1
|
+
import { StabilityEnum, definePresentation } from '@contractspec/lib.contracts';
|
|
3
2
|
import { AgentSummaryModel } from './agent.schema';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Presentation for displaying a list of AI agents.
|
|
7
6
|
*/
|
|
8
|
-
export const AgentListPresentation
|
|
7
|
+
export const AgentListPresentation = definePresentation({
|
|
9
8
|
meta: {
|
|
10
9
|
key: 'agent-console.agent.list',
|
|
11
10
|
version: '1.0.0',
|
|
@@ -27,12 +26,12 @@ export const AgentListPresentation: PresentationSpec = {
|
|
|
27
26
|
},
|
|
28
27
|
targets: ['react', 'markdown', 'application/json'],
|
|
29
28
|
policy: { flags: ['agent-console.enabled'] },
|
|
30
|
-
};
|
|
29
|
+
});
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* Presentation for agent detail view.
|
|
34
33
|
*/
|
|
35
|
-
export const AgentDetailPresentation
|
|
34
|
+
export const AgentDetailPresentation = definePresentation({
|
|
36
35
|
meta: {
|
|
37
36
|
key: 'agent-console.agent.detail',
|
|
38
37
|
version: '1.0.0',
|
|
@@ -53,12 +52,12 @@ export const AgentDetailPresentation: PresentationSpec = {
|
|
|
53
52
|
},
|
|
54
53
|
targets: ['react', 'markdown'],
|
|
55
54
|
policy: { flags: ['agent-console.enabled'] },
|
|
56
|
-
};
|
|
55
|
+
});
|
|
57
56
|
|
|
58
57
|
/**
|
|
59
58
|
* Dashboard presentation for Agent Console - overview of agents, runs, and tools.
|
|
60
59
|
*/
|
|
61
|
-
export const AgentConsoleDashboardPresentation
|
|
60
|
+
export const AgentConsoleDashboardPresentation = definePresentation({
|
|
62
61
|
meta: {
|
|
63
62
|
key: 'agent-console.dashboard',
|
|
64
63
|
version: '1.0.0',
|
|
@@ -78,4 +77,4 @@ export const AgentConsoleDashboardPresentation: PresentationSpec = {
|
|
|
78
77
|
},
|
|
79
78
|
targets: ['react', 'markdown'],
|
|
80
79
|
policy: { flags: ['agent-console.enabled'] },
|
|
81
|
-
};
|
|
80
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineTestSpec } from '@contractspec/lib.contracts';
|
|
2
|
+
|
|
3
|
+
export const agentListTest = defineTestSpec({
|
|
4
|
+
meta: {
|
|
5
|
+
key: 'test.agent-console.agent.list',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
owners: ['@agent-console-team'],
|
|
8
|
+
description: 'Test for listing agents',
|
|
9
|
+
stability: 'stable',
|
|
10
|
+
tags: ['test'],
|
|
11
|
+
},
|
|
12
|
+
target: {
|
|
13
|
+
type: 'operation',
|
|
14
|
+
operation: { key: 'agent-console.agent.list', version: '1.0.0' },
|
|
15
|
+
},
|
|
16
|
+
scenarios: [
|
|
17
|
+
{
|
|
18
|
+
key: 'success',
|
|
19
|
+
when: { operation: { key: 'agent-console.agent.list' } },
|
|
20
|
+
then: [{ type: 'expectOutput', match: {} }],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: 'error',
|
|
24
|
+
when: { operation: { key: 'agent-console.agent.list' } },
|
|
25
|
+
then: [{ type: 'expectError' }],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const agentGetTest = defineTestSpec({
|
|
31
|
+
meta: {
|
|
32
|
+
key: 'test.agent-console.agent.get',
|
|
33
|
+
version: '1.0.0',
|
|
34
|
+
owners: ['@agent-console-team'],
|
|
35
|
+
description: 'Test for getting agent',
|
|
36
|
+
stability: 'stable',
|
|
37
|
+
tags: ['test'],
|
|
38
|
+
},
|
|
39
|
+
target: {
|
|
40
|
+
type: 'operation',
|
|
41
|
+
operation: { key: 'agent-console.agent.get', version: '1.0.0' },
|
|
42
|
+
},
|
|
43
|
+
scenarios: [
|
|
44
|
+
{
|
|
45
|
+
key: 'success',
|
|
46
|
+
when: { operation: { key: 'agent-console.agent.get' } },
|
|
47
|
+
then: [{ type: 'expectOutput', match: {} }],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'error',
|
|
51
|
+
when: { operation: { key: 'agent-console.agent.get' } },
|
|
52
|
+
then: [{ type: 'expectError' }],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCapability, StabilityEnum } from '@contractspec/lib.contracts';
|
|
2
|
+
|
|
3
|
+
export const AgentCapability = defineCapability({
|
|
4
|
+
meta: {
|
|
5
|
+
key: 'agent',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
kind: 'ui',
|
|
8
|
+
stability: StabilityEnum.Experimental,
|
|
9
|
+
description: 'AI agent management and console capability',
|
|
10
|
+
owners: ['platform.core'],
|
|
11
|
+
tags: ['agent', 'ai', 'console'],
|
|
12
|
+
},
|
|
13
|
+
});
|
package/src/agent.feature.ts
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* Defines the feature module for agent orchestration capabilities.
|
|
5
5
|
*/
|
|
6
6
|
import type { FeatureModuleSpec } from '@contractspec/lib.contracts';
|
|
7
|
+
import { defineFeature } from '@contractspec/lib.contracts';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Agent Console feature module that bundles all agent, tool, and run
|
|
10
11
|
* operations, events, and presentations into an installable feature.
|
|
11
12
|
*/
|
|
12
|
-
export const AgentConsoleFeature: FeatureModuleSpec = {
|
|
13
|
+
export const AgentConsoleFeature: FeatureModuleSpec = defineFeature({
|
|
13
14
|
meta: {
|
|
14
15
|
key: 'agent-console',
|
|
15
16
|
version: '1.0.0',
|
|
@@ -143,4 +144,4 @@ export const AgentConsoleFeature: FeatureModuleSpec = {
|
|
|
143
144
|
],
|
|
144
145
|
provides: [{ key: 'agent', version: '1.0.0' }],
|
|
145
146
|
},
|
|
146
|
-
};
|
|
147
|
+
});
|
package/src/example.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineExample } from '@contractspec/lib.contracts';
|
|
2
2
|
|
|
3
|
-
const example
|
|
3
|
+
const example = defineExample({
|
|
4
4
|
meta: {
|
|
5
5
|
key: 'agent-console',
|
|
6
6
|
version: '1.0.0',
|
|
@@ -36,6 +36,6 @@ const example: ExampleSpec = {
|
|
|
36
36
|
studio: { enabled: true, installable: true },
|
|
37
37
|
mcp: { enabled: true },
|
|
38
38
|
},
|
|
39
|
-
};
|
|
39
|
+
});
|
|
40
40
|
|
|
41
41
|
export default example;
|