@contractspec/example.agent-console 3.8.8 → 3.8.10
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 +225 -222
- package/CHANGELOG.md +34 -0
- package/dist/agent/agent.entity.js +1 -127
- package/dist/agent/agent.enum.js +1 -25
- package/dist/agent/agent.event.js +1 -116
- package/dist/agent/agent.handler.js +1 -1030
- package/dist/agent/agent.operation.js +1 -735
- package/dist/agent/agent.presentation.js +1 -282
- package/dist/agent/agent.schema.js +1 -215
- package/dist/agent/agent.test-spec.js +1 -58
- package/dist/agent/index.js +1 -1248
- package/dist/agent.capability.js +1 -19
- package/dist/agent.feature.js +1 -305
- package/dist/browser/agent/agent.entity.js +1 -127
- package/dist/browser/agent/agent.enum.js +1 -25
- package/dist/browser/agent/agent.event.js +1 -116
- package/dist/browser/agent/agent.handler.js +1 -1030
- package/dist/browser/agent/agent.operation.js +1 -735
- package/dist/browser/agent/agent.presentation.js +1 -282
- package/dist/browser/agent/agent.schema.js +1 -215
- package/dist/browser/agent/agent.test-spec.js +1 -58
- package/dist/browser/agent/index.js +1 -1248
- package/dist/browser/agent.capability.js +1 -19
- package/dist/browser/agent.feature.js +1 -305
- package/dist/browser/docs/agent-console.docblock.js +5 -49
- package/dist/browser/docs/index.js +5 -49
- package/dist/browser/example.js +1 -41
- package/dist/browser/handlers/agent.handlers.js +6 -2143
- package/dist/browser/handlers/index.js +6 -2943
- package/dist/browser/index.js +14 -6828
- package/dist/browser/presentations/index.js +1 -693
- package/dist/browser/run/index.js +1 -1363
- package/dist/browser/run/run.entity.js +1 -160
- package/dist/browser/run/run.enum.js +1 -34
- package/dist/browser/run/run.event.js +1 -217
- package/dist/browser/run/run.handler.js +1 -919
- package/dist/browser/run/run.operation.js +1 -667
- package/dist/browser/run/run.presentation.js +1 -223
- package/dist/browser/run/run.schema.js +1 -179
- package/dist/browser/run/run.test-spec.js +1 -58
- package/dist/browser/seeders/index.js +2 -21
- package/dist/browser/shared/index.js +1 -626
- package/dist/browser/shared/mock-agents.js +1 -82
- package/dist/browser/shared/mock-runs.js +1 -113
- package/dist/browser/shared/mock-tools.js +1 -146
- package/dist/browser/tool/index.js +1 -949
- package/dist/browser/tool/tool.entity.js +1 -90
- package/dist/browser/tool/tool.enum.js +1 -26
- package/dist/browser/tool/tool.event.js +1 -99
- package/dist/browser/tool/tool.handler.js +1 -699
- package/dist/browser/tool/tool.operation.js +1 -482
- package/dist/browser/tool/tool.presentation.js +1 -188
- package/dist/browser/tool/tool.schema.js +1 -141
- package/dist/browser/tool/tool.test-spec.js +1 -58
- package/dist/browser/ui/AgentDashboard.js +1 -2527
- package/dist/browser/ui/AgentDashboard.visualizations.js +1 -217
- package/dist/browser/ui/AgentRunList.js +1 -482
- package/dist/browser/ui/AgentToolRegistry.js +1 -212
- package/dist/browser/ui/ExecutionConsoleHost.js +1 -0
- package/dist/browser/ui/hooks/index.js +1 -740
- package/dist/browser/ui/hooks/useAgentList.js +1 -55
- package/dist/browser/ui/hooks/useAgentMutations.js +1 -530
- package/dist/browser/ui/hooks/useRunList.js +1 -70
- package/dist/browser/ui/hooks/useToolList.js +1 -85
- package/dist/browser/ui/index.js +5 -3018
- package/dist/browser/ui/modals/AgentActionsModal.js +1 -304
- package/dist/browser/ui/modals/CreateAgentModal.js +1 -243
- package/dist/browser/ui/modals/index.js +1 -546
- package/dist/browser/ui/overlays/demo-overlays.js +1 -64
- package/dist/browser/ui/overlays/index.js +1 -64
- package/dist/browser/ui/renderers/agent-list.markdown.js +2 -64
- package/dist/browser/ui/renderers/agent-list.renderer.js +1 -180
- package/dist/browser/ui/renderers/dashboard.markdown.js +2 -288
- package/dist/browser/ui/renderers/index.js +5 -642
- package/dist/browser/ui/renderers/run-list.markdown.js +2 -50
- package/dist/browser/ui/renderers/tool-registry.markdown.js +2 -64
- package/dist/browser/ui/views/AgentListView.js +1 -165
- package/dist/browser/ui/views/RunDataTable.js +1 -326
- package/dist/browser/ui/views/RunListView.js +1 -479
- package/dist/browser/ui/views/ToolRegistryView.js +1 -209
- package/dist/browser/ui/views/index.js +1 -851
- package/dist/browser/ui/views/run-data-table.columns.js +1 -271
- package/dist/browser/ui/views/run-list.shared.js +1 -177
- package/dist/browser/visualizations/catalog.js +1 -134
- package/dist/browser/visualizations/index.js +1 -187
- package/dist/browser/visualizations/selectors.js +1 -181
- package/dist/docs/agent-console.docblock.js +5 -49
- package/dist/docs/index.js +5 -49
- package/dist/example.js +1 -41
- package/dist/handlers/agent.handlers.js +6 -2143
- package/dist/handlers/index.js +6 -2943
- package/dist/index.js +14 -6828
- package/dist/node/agent/agent.entity.js +1 -127
- package/dist/node/agent/agent.enum.js +1 -25
- package/dist/node/agent/agent.event.js +1 -116
- package/dist/node/agent/agent.handler.js +1 -1030
- package/dist/node/agent/agent.operation.js +1 -735
- package/dist/node/agent/agent.presentation.js +1 -282
- package/dist/node/agent/agent.schema.js +1 -215
- package/dist/node/agent/agent.test-spec.js +1 -58
- package/dist/node/agent/index.js +1 -1248
- package/dist/node/agent.capability.js +1 -19
- package/dist/node/agent.feature.js +1 -305
- package/dist/node/docs/agent-console.docblock.js +5 -49
- package/dist/node/docs/index.js +5 -49
- package/dist/node/example.js +1 -41
- package/dist/node/handlers/agent.handlers.js +6 -2143
- package/dist/node/handlers/index.js +6 -2943
- package/dist/node/index.js +14 -6828
- package/dist/node/presentations/index.js +1 -693
- package/dist/node/run/index.js +1 -1363
- package/dist/node/run/run.entity.js +1 -160
- package/dist/node/run/run.enum.js +1 -34
- package/dist/node/run/run.event.js +1 -217
- package/dist/node/run/run.handler.js +1 -919
- package/dist/node/run/run.operation.js +1 -667
- package/dist/node/run/run.presentation.js +1 -223
- package/dist/node/run/run.schema.js +1 -179
- package/dist/node/run/run.test-spec.js +1 -58
- package/dist/node/seeders/index.js +2 -21
- package/dist/node/shared/index.js +1 -626
- package/dist/node/shared/mock-agents.js +1 -82
- package/dist/node/shared/mock-runs.js +1 -113
- package/dist/node/shared/mock-tools.js +1 -146
- package/dist/node/tool/index.js +1 -949
- package/dist/node/tool/tool.entity.js +1 -90
- package/dist/node/tool/tool.enum.js +1 -26
- package/dist/node/tool/tool.event.js +1 -99
- package/dist/node/tool/tool.handler.js +1 -699
- package/dist/node/tool/tool.operation.js +1 -482
- package/dist/node/tool/tool.presentation.js +1 -188
- package/dist/node/tool/tool.schema.js +1 -141
- package/dist/node/tool/tool.test-spec.js +1 -58
- package/dist/node/ui/AgentDashboard.js +1 -2527
- package/dist/node/ui/AgentDashboard.visualizations.js +1 -217
- package/dist/node/ui/AgentRunList.js +1 -482
- package/dist/node/ui/AgentToolRegistry.js +1 -212
- package/dist/node/ui/ExecutionConsoleHost.js +1 -0
- package/dist/node/ui/hooks/index.js +1 -740
- package/dist/node/ui/hooks/useAgentList.js +1 -55
- package/dist/node/ui/hooks/useAgentMutations.js +1 -530
- package/dist/node/ui/hooks/useRunList.js +1 -70
- package/dist/node/ui/hooks/useToolList.js +1 -85
- package/dist/node/ui/index.js +5 -3018
- package/dist/node/ui/modals/AgentActionsModal.js +1 -304
- package/dist/node/ui/modals/CreateAgentModal.js +1 -243
- package/dist/node/ui/modals/index.js +1 -546
- package/dist/node/ui/overlays/demo-overlays.js +1 -64
- package/dist/node/ui/overlays/index.js +1 -64
- package/dist/node/ui/renderers/agent-list.markdown.js +2 -64
- package/dist/node/ui/renderers/agent-list.renderer.js +1 -180
- package/dist/node/ui/renderers/dashboard.markdown.js +2 -288
- package/dist/node/ui/renderers/index.js +5 -642
- package/dist/node/ui/renderers/run-list.markdown.js +2 -50
- package/dist/node/ui/renderers/tool-registry.markdown.js +2 -64
- package/dist/node/ui/views/AgentListView.js +1 -165
- package/dist/node/ui/views/RunDataTable.js +1 -326
- package/dist/node/ui/views/RunListView.js +1 -479
- package/dist/node/ui/views/ToolRegistryView.js +1 -209
- package/dist/node/ui/views/index.js +1 -851
- package/dist/node/ui/views/run-data-table.columns.js +1 -271
- package/dist/node/ui/views/run-list.shared.js +1 -177
- package/dist/node/visualizations/catalog.js +1 -134
- package/dist/node/visualizations/index.js +1 -187
- package/dist/node/visualizations/selectors.js +1 -181
- package/dist/presentations/index.js +1 -693
- package/dist/run/index.js +1 -1363
- package/dist/run/run.entity.js +1 -160
- package/dist/run/run.enum.js +1 -34
- package/dist/run/run.event.js +1 -217
- package/dist/run/run.handler.js +1 -919
- package/dist/run/run.operation.js +1 -667
- package/dist/run/run.presentation.js +1 -223
- package/dist/run/run.schema.js +1 -179
- package/dist/run/run.test-spec.js +1 -58
- package/dist/seeders/index.js +2 -21
- package/dist/shared/index.js +1 -626
- package/dist/shared/mock-agents.js +1 -82
- package/dist/shared/mock-runs.js +1 -113
- package/dist/shared/mock-tools.js +1 -146
- package/dist/tool/index.js +1 -949
- package/dist/tool/tool.entity.js +1 -90
- package/dist/tool/tool.enum.js +1 -26
- package/dist/tool/tool.event.js +1 -99
- package/dist/tool/tool.handler.js +1 -699
- package/dist/tool/tool.operation.js +1 -482
- package/dist/tool/tool.presentation.js +1 -188
- package/dist/tool/tool.schema.js +1 -141
- package/dist/tool/tool.test-spec.js +1 -58
- package/dist/ui/AgentDashboard.js +1 -2527
- package/dist/ui/AgentDashboard.visualizations.js +1 -217
- package/dist/ui/AgentRunList.js +1 -482
- package/dist/ui/AgentToolRegistry.js +1 -212
- package/dist/ui/ExecutionConsoleHost.d.ts +1 -0
- package/dist/ui/ExecutionConsoleHost.js +2 -0
- package/dist/ui/ExecutionConsoleHost.test.d.ts +1 -0
- package/dist/ui/hooks/index.js +1 -740
- package/dist/ui/hooks/useAgentList.js +1 -55
- package/dist/ui/hooks/useAgentMutations.js +1 -530
- package/dist/ui/hooks/useRunList.js +1 -70
- package/dist/ui/hooks/useToolList.js +1 -85
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +5 -3018
- package/dist/ui/modals/AgentActionsModal.js +1 -304
- package/dist/ui/modals/CreateAgentModal.js +1 -243
- package/dist/ui/modals/index.js +1 -546
- package/dist/ui/overlays/demo-overlays.js +1 -64
- package/dist/ui/overlays/index.js +1 -64
- package/dist/ui/renderers/agent-list.markdown.js +2 -64
- package/dist/ui/renderers/agent-list.renderer.js +1 -180
- package/dist/ui/renderers/dashboard.markdown.js +2 -288
- package/dist/ui/renderers/index.js +5 -642
- package/dist/ui/renderers/run-list.markdown.js +2 -50
- package/dist/ui/renderers/tool-registry.markdown.js +2 -64
- package/dist/ui/views/AgentListView.js +1 -165
- package/dist/ui/views/RunDataTable.js +1 -326
- package/dist/ui/views/RunListView.js +1 -479
- package/dist/ui/views/ToolRegistryView.js +1 -209
- package/dist/ui/views/index.js +1 -851
- package/dist/ui/views/run-data-table.columns.js +1 -271
- package/dist/ui/views/run-list.shared.js +1 -177
- package/dist/visualizations/catalog.js +1 -134
- package/dist/visualizations/index.js +1 -187
- package/dist/visualizations/selectors.js +1 -181
- package/package.json +29 -13
- package/src/ui/ExecutionConsoleHost.test.tsx +110 -0
- package/src/ui/ExecutionConsoleHost.tsx +14 -0
- package/src/ui/index.ts +1 -1
|
@@ -1,188 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
defineVisualization,
|
|
5
|
-
VisualizationRegistry
|
|
6
|
-
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
7
|
-
var RUN_LIST_REF = { key: "agent.run.list", version: "1.0.0" };
|
|
8
|
-
var META = {
|
|
9
|
-
version: "1.0.0",
|
|
10
|
-
domain: "ai-ops",
|
|
11
|
-
stability: "experimental",
|
|
12
|
-
owners: ["@example.agent-console"],
|
|
13
|
-
tags: ["agent-console", "visualization", "operations"]
|
|
14
|
-
};
|
|
15
|
-
var AgentRunStatusVisualization = defineVisualization({
|
|
16
|
-
meta: {
|
|
17
|
-
...META,
|
|
18
|
-
key: "agent-console.visualization.run-status",
|
|
19
|
-
title: "Run Status Breakdown",
|
|
20
|
-
description: "Distribution of run outcomes across the current sample.",
|
|
21
|
-
goal: "Make operational success and failure mix visible at a glance.",
|
|
22
|
-
context: "Agent operations overview."
|
|
23
|
-
},
|
|
24
|
-
source: { primary: RUN_LIST_REF, resultPath: "data" },
|
|
25
|
-
visualization: {
|
|
26
|
-
kind: "pie",
|
|
27
|
-
nameDimension: "status",
|
|
28
|
-
valueMeasure: "runs",
|
|
29
|
-
dimensions: [
|
|
30
|
-
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
31
|
-
],
|
|
32
|
-
measures: [
|
|
33
|
-
{ key: "runs", label: "Runs", dataPath: "runs", format: "number" }
|
|
34
|
-
],
|
|
35
|
-
table: { caption: "Run counts by status." }
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var AgentRunActivityVisualization = defineVisualization({
|
|
39
|
-
meta: {
|
|
40
|
-
...META,
|
|
41
|
-
key: "agent-console.visualization.run-activity",
|
|
42
|
-
title: "Recent Run Activity",
|
|
43
|
-
description: "Daily run volume across the current sample.",
|
|
44
|
-
goal: "Show whether agent activity is rising or slowing down.",
|
|
45
|
-
context: "Operations trend monitoring."
|
|
46
|
-
},
|
|
47
|
-
source: { primary: RUN_LIST_REF, resultPath: "data" },
|
|
48
|
-
visualization: {
|
|
49
|
-
kind: "cartesian",
|
|
50
|
-
variant: "line",
|
|
51
|
-
xDimension: "day",
|
|
52
|
-
yMeasures: ["runs"],
|
|
53
|
-
dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
|
|
54
|
-
measures: [
|
|
55
|
-
{
|
|
56
|
-
key: "runs",
|
|
57
|
-
label: "Runs",
|
|
58
|
-
dataPath: "runs",
|
|
59
|
-
format: "number",
|
|
60
|
-
color: "#0f766e"
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
table: { caption: "Daily run counts." }
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
var AgentRunEfficiencyVisualization = defineVisualization({
|
|
67
|
-
meta: {
|
|
68
|
-
...META,
|
|
69
|
-
key: "agent-console.visualization.run-efficiency",
|
|
70
|
-
title: "Duration vs Tokens",
|
|
71
|
-
description: "Scatter chart comparing token consumption and runtime.",
|
|
72
|
-
goal: "Reveal outlier runs that are slow relative to their token usage.",
|
|
73
|
-
context: "Operational performance diagnostics."
|
|
74
|
-
},
|
|
75
|
-
source: { primary: RUN_LIST_REF, resultPath: "data" },
|
|
76
|
-
visualization: {
|
|
77
|
-
kind: "cartesian",
|
|
78
|
-
variant: "scatter",
|
|
79
|
-
xDimension: "totalTokens",
|
|
80
|
-
yMeasures: ["durationMs"],
|
|
81
|
-
dimensions: [
|
|
82
|
-
{
|
|
83
|
-
key: "totalTokens",
|
|
84
|
-
label: "Total Tokens",
|
|
85
|
-
dataPath: "totalTokens",
|
|
86
|
-
type: "number"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
measures: [
|
|
90
|
-
{
|
|
91
|
-
key: "durationMs",
|
|
92
|
-
label: "Duration",
|
|
93
|
-
dataPath: "durationMs",
|
|
94
|
-
format: "duration",
|
|
95
|
-
color: "#7c3aed"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
key: "estimatedCostUsd",
|
|
99
|
-
label: "Cost",
|
|
100
|
-
dataPath: "estimatedCostUsd",
|
|
101
|
-
format: "currency"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
series: [
|
|
105
|
-
{
|
|
106
|
-
key: "runs",
|
|
107
|
-
label: "Runs",
|
|
108
|
-
measure: "durationMs",
|
|
109
|
-
type: "scatter",
|
|
110
|
-
color: "#7c3aed"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
table: { caption: "Run duration versus token usage." }
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var AgentVisualizationSpecs = [
|
|
117
|
-
AgentRunStatusVisualization,
|
|
118
|
-
AgentRunActivityVisualization,
|
|
119
|
-
AgentRunEfficiencyVisualization
|
|
120
|
-
];
|
|
121
|
-
var AgentVisualizationRegistry = new VisualizationRegistry([
|
|
122
|
-
...AgentVisualizationSpecs
|
|
123
|
-
]);
|
|
124
|
-
var AgentVisualizationRefs = AgentVisualizationSpecs.map((spec) => ({
|
|
125
|
-
key: spec.meta.key,
|
|
126
|
-
version: spec.meta.version
|
|
127
|
-
}));
|
|
128
|
-
|
|
129
|
-
// src/visualizations/selectors.ts
|
|
130
|
-
function dayKey(value) {
|
|
131
|
-
if (!value)
|
|
132
|
-
return "unknown";
|
|
133
|
-
return value.toISOString().slice(0, 10);
|
|
134
|
-
}
|
|
135
|
-
function createAgentVisualizationItems(runs) {
|
|
136
|
-
const statusCounts = new Map;
|
|
137
|
-
const activityCounts = new Map;
|
|
138
|
-
for (const run of runs) {
|
|
139
|
-
statusCounts.set(run.status, (statusCounts.get(run.status) ?? 0) + 1);
|
|
140
|
-
activityCounts.set(dayKey(run.startedAt ?? run.queuedAt), (activityCounts.get(dayKey(run.startedAt ?? run.queuedAt)) ?? 0) + 1);
|
|
141
|
-
}
|
|
142
|
-
return [
|
|
143
|
-
{
|
|
144
|
-
key: "run-status",
|
|
145
|
-
spec: AgentRunStatusVisualization,
|
|
146
|
-
data: {
|
|
147
|
-
data: Array.from(statusCounts.entries()).map(([status, count]) => ({
|
|
148
|
-
status,
|
|
149
|
-
runs: count
|
|
150
|
-
}))
|
|
151
|
-
},
|
|
152
|
-
title: "Run Status Breakdown",
|
|
153
|
-
description: "Completed, failed, running, and cancelled runs in the sample.",
|
|
154
|
-
height: 260
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
key: "run-activity",
|
|
158
|
-
spec: AgentRunActivityVisualization,
|
|
159
|
-
data: {
|
|
160
|
-
data: Array.from(activityCounts.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, runs: count }))
|
|
161
|
-
},
|
|
162
|
-
title: "Recent Run Activity",
|
|
163
|
-
description: "Daily run volume derived from run start times."
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
key: "run-efficiency",
|
|
167
|
-
spec: AgentRunEfficiencyVisualization,
|
|
168
|
-
data: {
|
|
169
|
-
data: runs.filter((run) => typeof run.durationMs === "number").map((run) => ({
|
|
170
|
-
totalTokens: run.totalTokens,
|
|
171
|
-
durationMs: run.durationMs ?? 0,
|
|
172
|
-
estimatedCostUsd: run.estimatedCostUsd
|
|
173
|
-
}))
|
|
174
|
-
},
|
|
175
|
-
title: "Duration vs Tokens",
|
|
176
|
-
description: "Operational scatter plot for spotting inefficient runs."
|
|
177
|
-
}
|
|
178
|
-
];
|
|
179
|
-
}
|
|
180
|
-
export {
|
|
181
|
-
createAgentVisualizationItems,
|
|
182
|
-
AgentVisualizationSpecs,
|
|
183
|
-
AgentVisualizationRegistry,
|
|
184
|
-
AgentVisualizationRefs,
|
|
185
|
-
AgentRunStatusVisualization,
|
|
186
|
-
AgentRunEfficiencyVisualization,
|
|
187
|
-
AgentRunActivityVisualization
|
|
188
|
-
};
|
|
2
|
+
import{defineVisualization as s,VisualizationRegistry as c}from"@contractspec/lib.contracts-spec/visualizations";var a={key:"agent.run.list",version:"1.0.0"},u={version:"1.0.0",domain:"ai-ops",stability:"experimental",owners:["@example.agent-console"],tags:["agent-console","visualization","operations"]},i=s({meta:{...u,key:"agent-console.visualization.run-status",title:"Run Status Breakdown",description:"Distribution of run outcomes across the current sample.",goal:"Make operational success and failure mix visible at a glance.",context:"Agent operations overview."},source:{primary:a,resultPath:"data"},visualization:{kind:"pie",nameDimension:"status",valueMeasure:"runs",dimensions:[{key:"status",label:"Status",dataPath:"status",type:"category"}],measures:[{key:"runs",label:"Runs",dataPath:"runs",format:"number"}],table:{caption:"Run counts by status."}}}),d=s({meta:{...u,key:"agent-console.visualization.run-activity",title:"Recent Run Activity",description:"Daily run volume across the current sample.",goal:"Show whether agent activity is rising or slowing down.",context:"Operations trend monitoring."},source:{primary:a,resultPath:"data"},visualization:{kind:"cartesian",variant:"line",xDimension:"day",yMeasures:["runs"],dimensions:[{key:"day",label:"Day",dataPath:"day",type:"time"}],measures:[{key:"runs",label:"Runs",dataPath:"runs",format:"number",color:"#0f766e"}],table:{caption:"Daily run counts."}}}),m=s({meta:{...u,key:"agent-console.visualization.run-efficiency",title:"Duration vs Tokens",description:"Scatter chart comparing token consumption and runtime.",goal:"Reveal outlier runs that are slow relative to their token usage.",context:"Operational performance diagnostics."},source:{primary:a,resultPath:"data"},visualization:{kind:"cartesian",variant:"scatter",xDimension:"totalTokens",yMeasures:["durationMs"],dimensions:[{key:"totalTokens",label:"Total Tokens",dataPath:"totalTokens",type:"number"}],measures:[{key:"durationMs",label:"Duration",dataPath:"durationMs",format:"duration",color:"#7c3aed"},{key:"estimatedCostUsd",label:"Cost",dataPath:"estimatedCostUsd",format:"currency"}],series:[{key:"runs",label:"Runs",measure:"durationMs",type:"scatter",color:"#7c3aed"}],table:{caption:"Run duration versus token usage."}}}),f=[i,d,m],l=new c([...f]),k=f.map((e)=>({key:e.meta.key,version:e.meta.version}));function p(e){if(!e)return"unknown";return e.toISOString().slice(0,10)}function h(e){let n=new Map,o=new Map;for(let t of e)n.set(t.status,(n.get(t.status)??0)+1),o.set(p(t.startedAt??t.queuedAt),(o.get(p(t.startedAt??t.queuedAt))??0)+1);return[{key:"run-status",spec:i,data:{data:Array.from(n.entries()).map(([t,r])=>({status:t,runs:r}))},title:"Run Status Breakdown",description:"Completed, failed, running, and cancelled runs in the sample.",height:260},{key:"run-activity",spec:d,data:{data:Array.from(o.entries()).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>({day:t,runs:r}))},title:"Recent Run Activity",description:"Daily run volume derived from run start times."},{key:"run-efficiency",spec:m,data:{data:e.filter((t)=>typeof t.durationMs==="number").map((t)=>({totalTokens:t.totalTokens,durationMs:t.durationMs??0,estimatedCostUsd:t.estimatedCostUsd}))},title:"Duration vs Tokens",description:"Operational scatter plot for spotting inefficient runs."}]}export{h as createAgentVisualizationItems,f as AgentVisualizationSpecs,l as AgentVisualizationRegistry,k as AgentVisualizationRefs,i as AgentRunStatusVisualization,m as AgentRunEfficiencyVisualization,d as AgentRunActivityVisualization};
|
|
@@ -1,182 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
defineVisualization,
|
|
5
|
-
VisualizationRegistry
|
|
6
|
-
} from "@contractspec/lib.contracts-spec/visualizations";
|
|
7
|
-
var RUN_LIST_REF = { key: "agent.run.list", version: "1.0.0" };
|
|
8
|
-
var META = {
|
|
9
|
-
version: "1.0.0",
|
|
10
|
-
domain: "ai-ops",
|
|
11
|
-
stability: "experimental",
|
|
12
|
-
owners: ["@example.agent-console"],
|
|
13
|
-
tags: ["agent-console", "visualization", "operations"]
|
|
14
|
-
};
|
|
15
|
-
var AgentRunStatusVisualization = defineVisualization({
|
|
16
|
-
meta: {
|
|
17
|
-
...META,
|
|
18
|
-
key: "agent-console.visualization.run-status",
|
|
19
|
-
title: "Run Status Breakdown",
|
|
20
|
-
description: "Distribution of run outcomes across the current sample.",
|
|
21
|
-
goal: "Make operational success and failure mix visible at a glance.",
|
|
22
|
-
context: "Agent operations overview."
|
|
23
|
-
},
|
|
24
|
-
source: { primary: RUN_LIST_REF, resultPath: "data" },
|
|
25
|
-
visualization: {
|
|
26
|
-
kind: "pie",
|
|
27
|
-
nameDimension: "status",
|
|
28
|
-
valueMeasure: "runs",
|
|
29
|
-
dimensions: [
|
|
30
|
-
{ key: "status", label: "Status", dataPath: "status", type: "category" }
|
|
31
|
-
],
|
|
32
|
-
measures: [
|
|
33
|
-
{ key: "runs", label: "Runs", dataPath: "runs", format: "number" }
|
|
34
|
-
],
|
|
35
|
-
table: { caption: "Run counts by status." }
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var AgentRunActivityVisualization = defineVisualization({
|
|
39
|
-
meta: {
|
|
40
|
-
...META,
|
|
41
|
-
key: "agent-console.visualization.run-activity",
|
|
42
|
-
title: "Recent Run Activity",
|
|
43
|
-
description: "Daily run volume across the current sample.",
|
|
44
|
-
goal: "Show whether agent activity is rising or slowing down.",
|
|
45
|
-
context: "Operations trend monitoring."
|
|
46
|
-
},
|
|
47
|
-
source: { primary: RUN_LIST_REF, resultPath: "data" },
|
|
48
|
-
visualization: {
|
|
49
|
-
kind: "cartesian",
|
|
50
|
-
variant: "line",
|
|
51
|
-
xDimension: "day",
|
|
52
|
-
yMeasures: ["runs"],
|
|
53
|
-
dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
|
|
54
|
-
measures: [
|
|
55
|
-
{
|
|
56
|
-
key: "runs",
|
|
57
|
-
label: "Runs",
|
|
58
|
-
dataPath: "runs",
|
|
59
|
-
format: "number",
|
|
60
|
-
color: "#0f766e"
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
table: { caption: "Daily run counts." }
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
var AgentRunEfficiencyVisualization = defineVisualization({
|
|
67
|
-
meta: {
|
|
68
|
-
...META,
|
|
69
|
-
key: "agent-console.visualization.run-efficiency",
|
|
70
|
-
title: "Duration vs Tokens",
|
|
71
|
-
description: "Scatter chart comparing token consumption and runtime.",
|
|
72
|
-
goal: "Reveal outlier runs that are slow relative to their token usage.",
|
|
73
|
-
context: "Operational performance diagnostics."
|
|
74
|
-
},
|
|
75
|
-
source: { primary: RUN_LIST_REF, resultPath: "data" },
|
|
76
|
-
visualization: {
|
|
77
|
-
kind: "cartesian",
|
|
78
|
-
variant: "scatter",
|
|
79
|
-
xDimension: "totalTokens",
|
|
80
|
-
yMeasures: ["durationMs"],
|
|
81
|
-
dimensions: [
|
|
82
|
-
{
|
|
83
|
-
key: "totalTokens",
|
|
84
|
-
label: "Total Tokens",
|
|
85
|
-
dataPath: "totalTokens",
|
|
86
|
-
type: "number"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
measures: [
|
|
90
|
-
{
|
|
91
|
-
key: "durationMs",
|
|
92
|
-
label: "Duration",
|
|
93
|
-
dataPath: "durationMs",
|
|
94
|
-
format: "duration",
|
|
95
|
-
color: "#7c3aed"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
key: "estimatedCostUsd",
|
|
99
|
-
label: "Cost",
|
|
100
|
-
dataPath: "estimatedCostUsd",
|
|
101
|
-
format: "currency"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
series: [
|
|
105
|
-
{
|
|
106
|
-
key: "runs",
|
|
107
|
-
label: "Runs",
|
|
108
|
-
measure: "durationMs",
|
|
109
|
-
type: "scatter",
|
|
110
|
-
color: "#7c3aed"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
table: { caption: "Run duration versus token usage." }
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var AgentVisualizationSpecs = [
|
|
117
|
-
AgentRunStatusVisualization,
|
|
118
|
-
AgentRunActivityVisualization,
|
|
119
|
-
AgentRunEfficiencyVisualization
|
|
120
|
-
];
|
|
121
|
-
var AgentVisualizationRegistry = new VisualizationRegistry([
|
|
122
|
-
...AgentVisualizationSpecs
|
|
123
|
-
]);
|
|
124
|
-
var AgentVisualizationRefs = AgentVisualizationSpecs.map((spec) => ({
|
|
125
|
-
key: spec.meta.key,
|
|
126
|
-
version: spec.meta.version
|
|
127
|
-
}));
|
|
128
|
-
|
|
129
|
-
// src/visualizations/selectors.ts
|
|
130
|
-
function dayKey(value) {
|
|
131
|
-
if (!value)
|
|
132
|
-
return "unknown";
|
|
133
|
-
return value.toISOString().slice(0, 10);
|
|
134
|
-
}
|
|
135
|
-
function createAgentVisualizationItems(runs) {
|
|
136
|
-
const statusCounts = new Map;
|
|
137
|
-
const activityCounts = new Map;
|
|
138
|
-
for (const run of runs) {
|
|
139
|
-
statusCounts.set(run.status, (statusCounts.get(run.status) ?? 0) + 1);
|
|
140
|
-
activityCounts.set(dayKey(run.startedAt ?? run.queuedAt), (activityCounts.get(dayKey(run.startedAt ?? run.queuedAt)) ?? 0) + 1);
|
|
141
|
-
}
|
|
142
|
-
return [
|
|
143
|
-
{
|
|
144
|
-
key: "run-status",
|
|
145
|
-
spec: AgentRunStatusVisualization,
|
|
146
|
-
data: {
|
|
147
|
-
data: Array.from(statusCounts.entries()).map(([status, count]) => ({
|
|
148
|
-
status,
|
|
149
|
-
runs: count
|
|
150
|
-
}))
|
|
151
|
-
},
|
|
152
|
-
title: "Run Status Breakdown",
|
|
153
|
-
description: "Completed, failed, running, and cancelled runs in the sample.",
|
|
154
|
-
height: 260
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
key: "run-activity",
|
|
158
|
-
spec: AgentRunActivityVisualization,
|
|
159
|
-
data: {
|
|
160
|
-
data: Array.from(activityCounts.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, runs: count }))
|
|
161
|
-
},
|
|
162
|
-
title: "Recent Run Activity",
|
|
163
|
-
description: "Daily run volume derived from run start times."
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
key: "run-efficiency",
|
|
167
|
-
spec: AgentRunEfficiencyVisualization,
|
|
168
|
-
data: {
|
|
169
|
-
data: runs.filter((run) => typeof run.durationMs === "number").map((run) => ({
|
|
170
|
-
totalTokens: run.totalTokens,
|
|
171
|
-
durationMs: run.durationMs ?? 0,
|
|
172
|
-
estimatedCostUsd: run.estimatedCostUsd
|
|
173
|
-
}))
|
|
174
|
-
},
|
|
175
|
-
title: "Duration vs Tokens",
|
|
176
|
-
description: "Operational scatter plot for spotting inefficient runs."
|
|
177
|
-
}
|
|
178
|
-
];
|
|
179
|
-
}
|
|
180
|
-
export {
|
|
181
|
-
createAgentVisualizationItems
|
|
182
|
-
};
|
|
2
|
+
import{defineVisualization as a,VisualizationRegistry as p}from"@contractspec/lib.contracts-spec/visualizations";var o={key:"agent.run.list",version:"1.0.0"},u={version:"1.0.0",domain:"ai-ops",stability:"experimental",owners:["@example.agent-console"],tags:["agent-console","visualization","operations"]},i=a({meta:{...u,key:"agent-console.visualization.run-status",title:"Run Status Breakdown",description:"Distribution of run outcomes across the current sample.",goal:"Make operational success and failure mix visible at a glance.",context:"Agent operations overview."},source:{primary:o,resultPath:"data"},visualization:{kind:"pie",nameDimension:"status",valueMeasure:"runs",dimensions:[{key:"status",label:"Status",dataPath:"status",type:"category"}],measures:[{key:"runs",label:"Runs",dataPath:"runs",format:"number"}],table:{caption:"Run counts by status."}}}),d=a({meta:{...u,key:"agent-console.visualization.run-activity",title:"Recent Run Activity",description:"Daily run volume across the current sample.",goal:"Show whether agent activity is rising or slowing down.",context:"Operations trend monitoring."},source:{primary:o,resultPath:"data"},visualization:{kind:"cartesian",variant:"line",xDimension:"day",yMeasures:["runs"],dimensions:[{key:"day",label:"Day",dataPath:"day",type:"time"}],measures:[{key:"runs",label:"Runs",dataPath:"runs",format:"number",color:"#0f766e"}],table:{caption:"Daily run counts."}}}),m=a({meta:{...u,key:"agent-console.visualization.run-efficiency",title:"Duration vs Tokens",description:"Scatter chart comparing token consumption and runtime.",goal:"Reveal outlier runs that are slow relative to their token usage.",context:"Operational performance diagnostics."},source:{primary:o,resultPath:"data"},visualization:{kind:"cartesian",variant:"scatter",xDimension:"totalTokens",yMeasures:["durationMs"],dimensions:[{key:"totalTokens",label:"Total Tokens",dataPath:"totalTokens",type:"number"}],measures:[{key:"durationMs",label:"Duration",dataPath:"durationMs",format:"duration",color:"#7c3aed"},{key:"estimatedCostUsd",label:"Cost",dataPath:"estimatedCostUsd",format:"currency"}],series:[{key:"runs",label:"Runs",measure:"durationMs",type:"scatter",color:"#7c3aed"}],table:{caption:"Run duration versus token usage."}}}),f=[i,d,m],l=new p([...f]),k=f.map((e)=>({key:e.meta.key,version:e.meta.version}));function c(e){if(!e)return"unknown";return e.toISOString().slice(0,10)}function h(e){let n=new Map,s=new Map;for(let t of e)n.set(t.status,(n.get(t.status)??0)+1),s.set(c(t.startedAt??t.queuedAt),(s.get(c(t.startedAt??t.queuedAt))??0)+1);return[{key:"run-status",spec:i,data:{data:Array.from(n.entries()).map(([t,r])=>({status:t,runs:r}))},title:"Run Status Breakdown",description:"Completed, failed, running, and cancelled runs in the sample.",height:260},{key:"run-activity",spec:d,data:{data:Array.from(s.entries()).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>({day:t,runs:r}))},title:"Recent Run Activity",description:"Daily run volume derived from run start times."},{key:"run-efficiency",spec:m,data:{data:e.filter((t)=>typeof t.durationMs==="number").map((t)=>({totalTokens:t.totalTokens,durationMs:t.durationMs??0,estimatedCostUsd:t.estimatedCostUsd}))},title:"Duration vs Tokens",description:"Operational scatter plot for spotting inefficient runs."}]}export{h as createAgentVisualizationItems};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.agent-console",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.10",
|
|
4
4
|
"description": "Agent Console example - AI agent orchestration with tools, runs, and logs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -334,6 +334,13 @@
|
|
|
334
334
|
"node": "./dist/node/ui/AgentToolRegistry.js",
|
|
335
335
|
"default": "./dist/ui/AgentToolRegistry.js"
|
|
336
336
|
},
|
|
337
|
+
"./ui/ExecutionConsoleHost": {
|
|
338
|
+
"types": "./dist/ui/ExecutionConsoleHost.d.ts",
|
|
339
|
+
"browser": "./dist/browser/ui/ExecutionConsoleHost.js",
|
|
340
|
+
"bun": "./dist/ui/ExecutionConsoleHost.js",
|
|
341
|
+
"node": "./dist/node/ui/ExecutionConsoleHost.js",
|
|
342
|
+
"default": "./dist/ui/ExecutionConsoleHost.js"
|
|
343
|
+
},
|
|
337
344
|
"./ui/hooks": {
|
|
338
345
|
"types": "./dist/ui/hooks/index.d.ts",
|
|
339
346
|
"browser": "./dist/browser/ui/hooks/index.js",
|
|
@@ -526,8 +533,8 @@
|
|
|
526
533
|
"dev": "contractspec-bun-build dev",
|
|
527
534
|
"clean": "rimraf dist .turbo",
|
|
528
535
|
"lint": "bun lint:fix",
|
|
529
|
-
"lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
|
|
530
|
-
"lint:check": "biome check .",
|
|
536
|
+
"lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
|
|
537
|
+
"lint:check": "node ../../../scripts/biome.cjs check .",
|
|
531
538
|
"test": "bun test",
|
|
532
539
|
"proof": "bun ../../../scripts/generate-agent-console-meetup-proof.ts",
|
|
533
540
|
"preflight": "bun run build && bun run typecheck && bun run test && bun ../../../scripts/check-agent-console-meetup-policy.ts && bun run proof",
|
|
@@ -535,22 +542,24 @@
|
|
|
535
542
|
"typecheck": "tsc --noEmit"
|
|
536
543
|
},
|
|
537
544
|
"dependencies": {
|
|
538
|
-
"@contractspec/lib.schema": "3.7.
|
|
539
|
-
"@contractspec/lib.contracts-spec": "5.0
|
|
540
|
-
"@contractspec/lib.example-shared-ui": "6.0.
|
|
541
|
-
"@contractspec/lib.design-system": "3.8.
|
|
542
|
-
"@contractspec/lib.runtime-sandbox": "2.7.
|
|
545
|
+
"@contractspec/lib.schema": "3.7.14",
|
|
546
|
+
"@contractspec/lib.contracts-spec": "5.2.0",
|
|
547
|
+
"@contractspec/lib.example-shared-ui": "6.0.18",
|
|
548
|
+
"@contractspec/lib.design-system": "3.8.11",
|
|
549
|
+
"@contractspec/lib.runtime-sandbox": "2.7.14",
|
|
550
|
+
"@contractspec/lib.ui-kit-web": "3.9.10",
|
|
551
|
+
"@contractspec/module.execution-console": "0.1.1",
|
|
543
552
|
"react": "19.2.0",
|
|
544
553
|
"react-dom": "19.2.0",
|
|
545
|
-
"@contractspec/lib.presentation-runtime-core": "3.9.
|
|
554
|
+
"@contractspec/lib.presentation-runtime-core": "3.9.6"
|
|
546
555
|
},
|
|
547
556
|
"devDependencies": {
|
|
548
|
-
"@contractspec/lib.harness": "0.2.
|
|
549
|
-
"@contractspec/tool.bun": "3.7.
|
|
550
|
-
"@contractspec/tool.typescript": "3.7.
|
|
557
|
+
"@contractspec/lib.harness": "0.2.11",
|
|
558
|
+
"@contractspec/tool.bun": "3.7.14",
|
|
559
|
+
"@contractspec/tool.typescript": "3.7.13",
|
|
551
560
|
"@types/react": "^19.2.14",
|
|
552
561
|
"@types/react-dom": "^19.2.2",
|
|
553
|
-
"happy-dom": "^20.8.
|
|
562
|
+
"happy-dom": "^20.8.9",
|
|
554
563
|
"typescript": "^5.9.3"
|
|
555
564
|
},
|
|
556
565
|
"publishConfig": {
|
|
@@ -884,6 +893,13 @@
|
|
|
884
893
|
"node": "./dist/node/ui/AgentToolRegistry.js",
|
|
885
894
|
"default": "./dist/ui/AgentToolRegistry.js"
|
|
886
895
|
},
|
|
896
|
+
"./ui/ExecutionConsoleHost": {
|
|
897
|
+
"types": "./dist/ui/ExecutionConsoleHost.d.ts",
|
|
898
|
+
"browser": "./dist/browser/ui/ExecutionConsoleHost.js",
|
|
899
|
+
"bun": "./dist/ui/ExecutionConsoleHost.js",
|
|
900
|
+
"node": "./dist/node/ui/ExecutionConsoleHost.js",
|
|
901
|
+
"default": "./dist/ui/ExecutionConsoleHost.js"
|
|
902
|
+
},
|
|
887
903
|
"./ui/hooks": {
|
|
888
904
|
"types": "./dist/ui/hooks/index.d.ts",
|
|
889
905
|
"browser": "./dist/browser/ui/hooks/index.js",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { afterEach, beforeAll, describe, expect, it } from 'bun:test';
|
|
2
|
+
import {
|
|
3
|
+
type TemplateDefinition,
|
|
4
|
+
TemplateRuntimeContext,
|
|
5
|
+
type TemplateRuntimeContextValue,
|
|
6
|
+
} from '@contractspec/lib.example-shared-ui';
|
|
7
|
+
import Window from 'happy-dom/lib/window/Window.js';
|
|
8
|
+
import { act } from 'react';
|
|
9
|
+
import { createRoot, type Root } from 'react-dom/client';
|
|
10
|
+
import type { AgentHandlers } from '../handlers/agent.handlers';
|
|
11
|
+
import {
|
|
12
|
+
AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
|
|
13
|
+
createAgentConsoleDemoHandlers,
|
|
14
|
+
} from '../shared';
|
|
15
|
+
import { ExecutionConsoleHost } from './ExecutionConsoleHost';
|
|
16
|
+
|
|
17
|
+
const PROJECT_ID = 'agent-console-execution-host';
|
|
18
|
+
const TEMPLATE: TemplateDefinition = {
|
|
19
|
+
id: 'agent-console',
|
|
20
|
+
name: 'Agent Console',
|
|
21
|
+
description: 'Deterministic execution console host smoke test.',
|
|
22
|
+
category: 'ai',
|
|
23
|
+
complexity: 'intermediate',
|
|
24
|
+
icon: '🤖',
|
|
25
|
+
features: ['agents', 'runs', 'tools', 'metrics'],
|
|
26
|
+
tags: ['sandbox', 'smoke'],
|
|
27
|
+
schema: { models: ['Agent', 'Run', 'Tool'], contracts: [] },
|
|
28
|
+
components: {
|
|
29
|
+
list: 'AgentListView',
|
|
30
|
+
detail: 'RunListView',
|
|
31
|
+
form: 'CreateAgentModal',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
beforeAll(() => {
|
|
36
|
+
const windowInstance = new Window({
|
|
37
|
+
url: 'https://sandbox.contractspec.local/sandbox?template=agent-console',
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(windowInstance, 'SyntaxError', {
|
|
40
|
+
value: SyntaxError,
|
|
41
|
+
configurable: true,
|
|
42
|
+
});
|
|
43
|
+
Object.assign(globalThis, {
|
|
44
|
+
window: windowInstance,
|
|
45
|
+
document: windowInstance.document,
|
|
46
|
+
navigator: windowInstance.navigator,
|
|
47
|
+
HTMLElement: windowInstance.HTMLElement,
|
|
48
|
+
HTMLButtonElement: windowInstance.HTMLButtonElement,
|
|
49
|
+
HTMLInputElement: windowInstance.HTMLInputElement,
|
|
50
|
+
HTMLTextAreaElement: windowInstance.HTMLTextAreaElement,
|
|
51
|
+
Node: windowInstance.Node,
|
|
52
|
+
Event: windowInstance.Event,
|
|
53
|
+
MouseEvent: windowInstance.MouseEvent,
|
|
54
|
+
KeyboardEvent: windowInstance.KeyboardEvent,
|
|
55
|
+
MutationObserver: windowInstance.MutationObserver,
|
|
56
|
+
getComputedStyle: windowInstance.getComputedStyle.bind(windowInstance),
|
|
57
|
+
requestAnimationFrame: (callback: FrameRequestCallback) =>
|
|
58
|
+
setTimeout(() => callback(Date.now()), 0),
|
|
59
|
+
cancelAnimationFrame: (id: number) => clearTimeout(id),
|
|
60
|
+
IS_REACT_ACT_ENVIRONMENT: true,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
afterEach(() => {
|
|
65
|
+
document.body.innerHTML = '';
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
function createContextValue(
|
|
69
|
+
handlers: AgentHandlers
|
|
70
|
+
): TemplateRuntimeContextValue<{ agent: AgentHandlers }> {
|
|
71
|
+
return {
|
|
72
|
+
template: TEMPLATE,
|
|
73
|
+
runtime: {},
|
|
74
|
+
installer: {
|
|
75
|
+
install: async () => {},
|
|
76
|
+
saveToStudio: async () => ({ projectId: PROJECT_ID, status: 'saved' }),
|
|
77
|
+
},
|
|
78
|
+
client: {} as never,
|
|
79
|
+
templateId: TEMPLATE.id,
|
|
80
|
+
projectId: PROJECT_ID,
|
|
81
|
+
engine: {} as never,
|
|
82
|
+
fetchData: async () => ({ data: null }),
|
|
83
|
+
handlers: { agent: handlers },
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
describe('ExecutionConsoleHost smoke', () => {
|
|
88
|
+
it('renders the agent dashboard and execution lane console together', async () => {
|
|
89
|
+
const container = document.createElement('div');
|
|
90
|
+
document.body.append(container);
|
|
91
|
+
const root: Root = createRoot(container);
|
|
92
|
+
const handlers = createAgentConsoleDemoHandlers({
|
|
93
|
+
projectId: PROJECT_ID,
|
|
94
|
+
organizationId: AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
await act(async () => {
|
|
98
|
+
root.render(
|
|
99
|
+
<TemplateRuntimeContext.Provider value={createContextValue(handlers)}>
|
|
100
|
+
<ExecutionConsoleHost />
|
|
101
|
+
</TemplateRuntimeContext.Provider>
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
expect(document.body.textContent).toContain('AI Agent Console');
|
|
106
|
+
expect(document.body.textContent).toContain('Timeline');
|
|
107
|
+
expect(document.body.textContent).toContain('Completion Loop');
|
|
108
|
+
expect(document.body.textContent).toContain('Export Evidence');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { VStack } from '@contractspec/lib.ui-kit-web/ui/stack';
|
|
4
|
+
import { ExecutionLaneConsoleDemo } from '@contractspec/module.execution-console';
|
|
5
|
+
import { AgentDashboard } from './AgentDashboard';
|
|
6
|
+
|
|
7
|
+
export function ExecutionConsoleHost() {
|
|
8
|
+
return (
|
|
9
|
+
<VStack gap="xl" align="stretch">
|
|
10
|
+
<AgentDashboard />
|
|
11
|
+
<ExecutionLaneConsoleDemo />
|
|
12
|
+
</VStack>
|
|
13
|
+
);
|
|
14
|
+
}
|
package/src/ui/index.ts
CHANGED