@contractspec/example.agent-console 3.8.9 → 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 +18 -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 +26 -10
- package/src/ui/ExecutionConsoleHost.test.tsx +110 -0
- package/src/ui/ExecutionConsoleHost.tsx +14 -0
- package/src/ui/index.ts +1 -1
package/dist/node/run/index.js
CHANGED
|
@@ -1,1363 +1 @@
|
|
|
1
|
-
// src/shared/mock-agents.ts
|
|
2
|
-
var MOCK_AGENTS = [
|
|
3
|
-
{
|
|
4
|
-
id: "agent-1",
|
|
5
|
-
organizationId: "demo-org",
|
|
6
|
-
name: "Customer Support Bot",
|
|
7
|
-
slug: "customer-support-bot",
|
|
8
|
-
description: "Handles tier-1 customer inquiries and routes complex issues.",
|
|
9
|
-
status: "ACTIVE",
|
|
10
|
-
modelProvider: "OPENAI",
|
|
11
|
-
modelName: "gpt-4o-mini",
|
|
12
|
-
modelConfig: { temperature: 0.7 },
|
|
13
|
-
systemPrompt: "You are a helpful customer support assistant.",
|
|
14
|
-
toolChoice: "auto",
|
|
15
|
-
maxIterations: 10,
|
|
16
|
-
timeoutMs: 120000,
|
|
17
|
-
version: "1.0.0",
|
|
18
|
-
tags: ["support", "tier-1"],
|
|
19
|
-
createdAt: new Date("2024-01-15T10:00:00Z"),
|
|
20
|
-
updatedAt: new Date("2024-03-20T14:30:00Z")
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "agent-2",
|
|
24
|
-
organizationId: "demo-org",
|
|
25
|
-
name: "Code Review Assistant",
|
|
26
|
-
slug: "code-review-assistant",
|
|
27
|
-
description: "Reviews pull requests and provides actionable feedback.",
|
|
28
|
-
status: "ACTIVE",
|
|
29
|
-
modelProvider: "ANTHROPIC",
|
|
30
|
-
modelName: "claude-sonnet-4-20250514",
|
|
31
|
-
modelConfig: { temperature: 0.3 },
|
|
32
|
-
systemPrompt: "You are a code review expert.",
|
|
33
|
-
toolChoice: "auto",
|
|
34
|
-
maxIterations: 15,
|
|
35
|
-
timeoutMs: 180000,
|
|
36
|
-
version: "2.1.0",
|
|
37
|
-
tags: ["code", "review", "dev"],
|
|
38
|
-
createdAt: new Date("2024-02-10T09:00:00Z"),
|
|
39
|
-
updatedAt: new Date("2024-04-05T11:15:00Z")
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: "agent-3",
|
|
43
|
-
organizationId: "demo-org",
|
|
44
|
-
name: "Data Analyst",
|
|
45
|
-
slug: "data-analyst",
|
|
46
|
-
description: "Queries databases and generates insights from data.",
|
|
47
|
-
status: "PAUSED",
|
|
48
|
-
modelProvider: "OPENAI",
|
|
49
|
-
modelName: "gpt-4o",
|
|
50
|
-
modelConfig: { temperature: 0.5 },
|
|
51
|
-
systemPrompt: "You are a data analyst expert in SQL and analytics.",
|
|
52
|
-
toolChoice: "required",
|
|
53
|
-
maxIterations: 20,
|
|
54
|
-
timeoutMs: 300000,
|
|
55
|
-
version: "1.2.0",
|
|
56
|
-
tags: ["data", "analytics", "sql"],
|
|
57
|
-
createdAt: new Date("2024-03-01T08:00:00Z"),
|
|
58
|
-
updatedAt: new Date("2024-04-10T16:45:00Z")
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: "agent-4",
|
|
62
|
-
organizationId: "demo-org",
|
|
63
|
-
name: "Meeting Scheduler",
|
|
64
|
-
slug: "meeting-scheduler",
|
|
65
|
-
description: "Schedules meetings and manages calendar conflicts.",
|
|
66
|
-
status: "DRAFT",
|
|
67
|
-
modelProvider: "GOOGLE",
|
|
68
|
-
modelName: "gemini-2.0-flash",
|
|
69
|
-
modelConfig: { temperature: 0.2 },
|
|
70
|
-
systemPrompt: "You help schedule and organize meetings efficiently.",
|
|
71
|
-
toolChoice: "auto",
|
|
72
|
-
maxIterations: 5,
|
|
73
|
-
timeoutMs: 60000,
|
|
74
|
-
version: "0.1.0",
|
|
75
|
-
tags: ["calendar", "scheduling"],
|
|
76
|
-
createdAt: new Date("2024-04-01T12:00:00Z"),
|
|
77
|
-
updatedAt: new Date("2024-04-01T12:00:00Z")
|
|
78
|
-
}
|
|
79
|
-
];
|
|
80
|
-
|
|
81
|
-
// src/run/run.enum.ts
|
|
82
|
-
import { defineEnum } from "@contractspec/lib.schema";
|
|
83
|
-
var RunStatusEnum = defineEnum("RunStatus", [
|
|
84
|
-
"QUEUED",
|
|
85
|
-
"IN_PROGRESS",
|
|
86
|
-
"COMPLETED",
|
|
87
|
-
"FAILED",
|
|
88
|
-
"CANCELLED",
|
|
89
|
-
"EXPIRED"
|
|
90
|
-
]);
|
|
91
|
-
var RunStepTypeEnum = defineEnum("RunStepType", [
|
|
92
|
-
"MESSAGE_CREATION",
|
|
93
|
-
"TOOL_CALL",
|
|
94
|
-
"TOOL_RESULT",
|
|
95
|
-
"ERROR"
|
|
96
|
-
]);
|
|
97
|
-
var LogLevelEnum = defineEnum("LogLevel", [
|
|
98
|
-
"DEBUG",
|
|
99
|
-
"INFO",
|
|
100
|
-
"WARN",
|
|
101
|
-
"ERROR"
|
|
102
|
-
]);
|
|
103
|
-
var GranularityEnum = defineEnum("Granularity", [
|
|
104
|
-
"hour",
|
|
105
|
-
"day",
|
|
106
|
-
"week",
|
|
107
|
-
"month"
|
|
108
|
-
]);
|
|
109
|
-
|
|
110
|
-
// src/run/run.schema.ts
|
|
111
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
112
|
-
var RunInputModel = defineSchemaModel({
|
|
113
|
-
name: "RunInput",
|
|
114
|
-
description: "Input data for agent execution",
|
|
115
|
-
fields: {
|
|
116
|
-
message: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
117
|
-
context: { type: ScalarTypeEnum.JSONObject(), isOptional: true }
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
var RunStepModel = defineSchemaModel({
|
|
121
|
-
name: "RunStep",
|
|
122
|
-
description: "Individual step within a run",
|
|
123
|
-
fields: {
|
|
124
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
125
|
-
stepNumber: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
126
|
-
type: { type: RunStepTypeEnum, isOptional: false },
|
|
127
|
-
toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
128
|
-
toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
129
|
-
input: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
130
|
-
output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
131
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
132
|
-
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
133
|
-
tokensUsed: {
|
|
134
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
135
|
-
isOptional: false,
|
|
136
|
-
defaultValue: 0
|
|
137
|
-
},
|
|
138
|
-
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
139
|
-
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
140
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
var RunLogModel = defineSchemaModel({
|
|
144
|
-
name: "RunLog",
|
|
145
|
-
description: "Execution log entry",
|
|
146
|
-
fields: {
|
|
147
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
148
|
-
stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
149
|
-
level: { type: LogLevelEnum, isOptional: false },
|
|
150
|
-
message: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
151
|
-
data: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
152
|
-
source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
153
|
-
traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
154
|
-
spanId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
155
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
var RunAgentRefModel = defineSchemaModel({
|
|
159
|
-
name: "RunAgentRef",
|
|
160
|
-
description: "Agent reference in a run",
|
|
161
|
-
fields: {
|
|
162
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
163
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
164
|
-
modelProvider: {
|
|
165
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
166
|
-
isOptional: false
|
|
167
|
-
},
|
|
168
|
-
modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
var RunModel = defineSchemaModel({
|
|
172
|
-
name: "Run",
|
|
173
|
-
description: "Agent execution instance",
|
|
174
|
-
fields: {
|
|
175
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
176
|
-
organizationId: {
|
|
177
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
178
|
-
isOptional: false
|
|
179
|
-
},
|
|
180
|
-
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
181
|
-
userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
182
|
-
sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
183
|
-
input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
|
|
184
|
-
output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
185
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
186
|
-
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
187
|
-
errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
188
|
-
totalTokens: {
|
|
189
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
190
|
-
isOptional: false,
|
|
191
|
-
defaultValue: 0
|
|
192
|
-
},
|
|
193
|
-
promptTokens: {
|
|
194
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
195
|
-
isOptional: false,
|
|
196
|
-
defaultValue: 0
|
|
197
|
-
},
|
|
198
|
-
completionTokens: {
|
|
199
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
200
|
-
isOptional: false,
|
|
201
|
-
defaultValue: 0
|
|
202
|
-
},
|
|
203
|
-
totalIterations: {
|
|
204
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
205
|
-
isOptional: false,
|
|
206
|
-
defaultValue: 0
|
|
207
|
-
},
|
|
208
|
-
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
209
|
-
estimatedCostUsd: {
|
|
210
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
211
|
-
isOptional: true
|
|
212
|
-
},
|
|
213
|
-
queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
214
|
-
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
215
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
216
|
-
metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
|
|
217
|
-
steps: { type: RunStepModel, isArray: true, isOptional: true },
|
|
218
|
-
logs: { type: RunLogModel, isArray: true, isOptional: true },
|
|
219
|
-
agent: { type: RunAgentRefModel, isOptional: true }
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
var RunSummaryModel = defineSchemaModel({
|
|
223
|
-
name: "RunSummary",
|
|
224
|
-
description: "Summary of a run for list views",
|
|
225
|
-
fields: {
|
|
226
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
227
|
-
agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
228
|
-
agentName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
229
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
230
|
-
totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
231
|
-
durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
232
|
-
estimatedCostUsd: {
|
|
233
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
234
|
-
isOptional: true
|
|
235
|
-
},
|
|
236
|
-
queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
237
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
var TimelineDataPointModel = defineSchemaModel({
|
|
241
|
-
name: "TimelineDataPoint",
|
|
242
|
-
description: "Timeline data point for metrics",
|
|
243
|
-
fields: {
|
|
244
|
-
period: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
245
|
-
runs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
246
|
-
tokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
247
|
-
costUsd: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
248
|
-
avgDurationMs: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
// src/run/run.operation.ts
|
|
253
|
-
import {
|
|
254
|
-
defineCommand,
|
|
255
|
-
defineQuery
|
|
256
|
-
} from "@contractspec/lib.contracts-spec/operations";
|
|
257
|
-
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
258
|
-
var OWNERS = ["@agent-console-team"];
|
|
259
|
-
var ExecuteAgentCommand = defineCommand({
|
|
260
|
-
meta: {
|
|
261
|
-
key: "agent.run.execute",
|
|
262
|
-
version: "1.0.0",
|
|
263
|
-
stability: "stable",
|
|
264
|
-
owners: [...OWNERS],
|
|
265
|
-
tags: ["run", "execute"],
|
|
266
|
-
description: "Starts a new agent run with the given input.",
|
|
267
|
-
goal: "Execute an AI agent with user input.",
|
|
268
|
-
context: "Called from chat interface or API."
|
|
269
|
-
},
|
|
270
|
-
io: {
|
|
271
|
-
input: defineSchemaModel2({
|
|
272
|
-
name: "ExecuteAgentInput",
|
|
273
|
-
fields: {
|
|
274
|
-
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
275
|
-
input: { type: RunInputModel, isOptional: false },
|
|
276
|
-
sessionId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
277
|
-
metadata: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
|
|
278
|
-
stream: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
279
|
-
maxIterations: {
|
|
280
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
281
|
-
isOptional: true
|
|
282
|
-
},
|
|
283
|
-
timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true }
|
|
284
|
-
}
|
|
285
|
-
}),
|
|
286
|
-
output: defineSchemaModel2({
|
|
287
|
-
name: "ExecuteAgentOutput",
|
|
288
|
-
fields: {
|
|
289
|
-
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
290
|
-
status: { type: RunStatusEnum, isOptional: false },
|
|
291
|
-
estimatedWaitMs: {
|
|
292
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
293
|
-
isOptional: true
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}),
|
|
297
|
-
errors: {
|
|
298
|
-
AGENT_NOT_FOUND: {
|
|
299
|
-
description: "The specified agent does not exist",
|
|
300
|
-
http: 404,
|
|
301
|
-
gqlCode: "AGENT_NOT_FOUND",
|
|
302
|
-
when: "Agent ID is invalid"
|
|
303
|
-
},
|
|
304
|
-
AGENT_NOT_ACTIVE: {
|
|
305
|
-
description: "The specified agent is not active",
|
|
306
|
-
http: 400,
|
|
307
|
-
gqlCode: "AGENT_NOT_ACTIVE",
|
|
308
|
-
when: "Agent is in draft/paused/archived state"
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
policy: { auth: "user" },
|
|
313
|
-
sideEffects: {
|
|
314
|
-
emits: [
|
|
315
|
-
{
|
|
316
|
-
key: "run.started",
|
|
317
|
-
version: "1.0.0",
|
|
318
|
-
stability: "stable",
|
|
319
|
-
owners: [...OWNERS],
|
|
320
|
-
tags: ["run", "started"],
|
|
321
|
-
when: "Run is queued",
|
|
322
|
-
payload: RunSummaryModel
|
|
323
|
-
}
|
|
324
|
-
],
|
|
325
|
-
audit: ["run.started"]
|
|
326
|
-
},
|
|
327
|
-
acceptance: {
|
|
328
|
-
scenarios: [
|
|
329
|
-
{
|
|
330
|
-
key: "execute-agent-happy-path",
|
|
331
|
-
given: ["Agent exists", "Agent is active"],
|
|
332
|
-
when: ["User submits execution request"],
|
|
333
|
-
then: ["Run is created", "RunStarted event is emitted"]
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
key: "execute-agent-not-active",
|
|
337
|
-
given: ["Agent exists but is not active"],
|
|
338
|
-
when: ["User attempts to execute"],
|
|
339
|
-
then: ["AGENT_NOT_ACTIVE error is returned"]
|
|
340
|
-
}
|
|
341
|
-
],
|
|
342
|
-
examples: [
|
|
343
|
-
{
|
|
344
|
-
key: "basic-execute",
|
|
345
|
-
input: { agentId: "agent-123", input: { message: "Hello" } },
|
|
346
|
-
output: { runId: "run-456", status: "pending", estimatedWaitMs: 5000 }
|
|
347
|
-
}
|
|
348
|
-
]
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
var CancelRunCommand = defineCommand({
|
|
352
|
-
meta: {
|
|
353
|
-
key: "agent.run.cancel",
|
|
354
|
-
version: "1.0.0",
|
|
355
|
-
stability: "stable",
|
|
356
|
-
owners: [...OWNERS],
|
|
357
|
-
tags: ["run", "cancel"],
|
|
358
|
-
description: "Cancels an in-progress agent run.",
|
|
359
|
-
goal: "Stop a running agent execution.",
|
|
360
|
-
context: "Called when user wants to abort a long-running task."
|
|
361
|
-
},
|
|
362
|
-
io: {
|
|
363
|
-
input: defineSchemaModel2({
|
|
364
|
-
name: "CancelRunInput",
|
|
365
|
-
fields: {
|
|
366
|
-
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
367
|
-
reason: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
368
|
-
}
|
|
369
|
-
}),
|
|
370
|
-
output: defineSchemaModel2({
|
|
371
|
-
name: "CancelRunOutput",
|
|
372
|
-
fields: {
|
|
373
|
-
success: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
374
|
-
status: { type: RunStatusEnum, isOptional: false }
|
|
375
|
-
}
|
|
376
|
-
}),
|
|
377
|
-
errors: {
|
|
378
|
-
RUN_NOT_FOUND: {
|
|
379
|
-
description: "The specified run does not exist",
|
|
380
|
-
http: 404,
|
|
381
|
-
gqlCode: "RUN_NOT_FOUND",
|
|
382
|
-
when: "Run ID is invalid"
|
|
383
|
-
},
|
|
384
|
-
RUN_NOT_CANCELLABLE: {
|
|
385
|
-
description: "The run cannot be cancelled",
|
|
386
|
-
http: 400,
|
|
387
|
-
gqlCode: "RUN_NOT_CANCELLABLE",
|
|
388
|
-
when: "Run is already completed/failed/cancelled"
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
policy: { auth: "user" },
|
|
393
|
-
sideEffects: {
|
|
394
|
-
emits: [
|
|
395
|
-
{
|
|
396
|
-
key: "run.cancelled",
|
|
397
|
-
version: "1.0.0",
|
|
398
|
-
stability: "stable",
|
|
399
|
-
owners: [...OWNERS],
|
|
400
|
-
tags: ["run", "cancelled"],
|
|
401
|
-
when: "Run is cancelled",
|
|
402
|
-
payload: RunSummaryModel
|
|
403
|
-
}
|
|
404
|
-
],
|
|
405
|
-
audit: ["run.cancelled"]
|
|
406
|
-
},
|
|
407
|
-
acceptance: {
|
|
408
|
-
scenarios: [
|
|
409
|
-
{
|
|
410
|
-
key: "cancel-run-happy-path",
|
|
411
|
-
given: ["Run exists", "Run is in progress"],
|
|
412
|
-
when: ["User cancels run"],
|
|
413
|
-
then: ["Run is cancelled", "RunCancelled event is emitted"]
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
key: "cancel-run-already-completed",
|
|
417
|
-
given: ["Run exists but is already completed"],
|
|
418
|
-
when: ["User attempts to cancel"],
|
|
419
|
-
then: ["RUN_NOT_CANCELLABLE error is returned"]
|
|
420
|
-
}
|
|
421
|
-
],
|
|
422
|
-
examples: [
|
|
423
|
-
{
|
|
424
|
-
key: "cancel-basic",
|
|
425
|
-
input: { runId: "run-456", reason: "User requested" },
|
|
426
|
-
output: { success: true, status: "cancelled" }
|
|
427
|
-
}
|
|
428
|
-
]
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
var GetRunQuery = defineQuery({
|
|
432
|
-
meta: {
|
|
433
|
-
key: "agent.run.get",
|
|
434
|
-
version: "1.0.0",
|
|
435
|
-
stability: "stable",
|
|
436
|
-
owners: [...OWNERS],
|
|
437
|
-
tags: ["run", "get"],
|
|
438
|
-
description: "Retrieves a run by its ID with optional details.",
|
|
439
|
-
goal: "View detailed run information.",
|
|
440
|
-
context: "Run details page or monitoring."
|
|
441
|
-
},
|
|
442
|
-
io: {
|
|
443
|
-
input: defineSchemaModel2({
|
|
444
|
-
name: "GetRunInput",
|
|
445
|
-
fields: {
|
|
446
|
-
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
447
|
-
includeSteps: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
448
|
-
includeLogs: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
|
|
449
|
-
}
|
|
450
|
-
}),
|
|
451
|
-
output: RunModel,
|
|
452
|
-
errors: {
|
|
453
|
-
RUN_NOT_FOUND: {
|
|
454
|
-
description: "The specified run does not exist",
|
|
455
|
-
http: 404,
|
|
456
|
-
gqlCode: "RUN_NOT_FOUND",
|
|
457
|
-
when: "Run ID is invalid"
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
},
|
|
461
|
-
policy: { auth: "user" },
|
|
462
|
-
acceptance: {
|
|
463
|
-
scenarios: [
|
|
464
|
-
{
|
|
465
|
-
key: "get-run-happy-path",
|
|
466
|
-
given: ["Run exists"],
|
|
467
|
-
when: ["User requests run by ID"],
|
|
468
|
-
then: ["Run details are returned"]
|
|
469
|
-
}
|
|
470
|
-
],
|
|
471
|
-
examples: [
|
|
472
|
-
{
|
|
473
|
-
key: "get-with-steps",
|
|
474
|
-
input: { runId: "run-456", includeSteps: true, includeLogs: false },
|
|
475
|
-
output: { id: "run-456", status: "completed", steps: [] }
|
|
476
|
-
}
|
|
477
|
-
]
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
var ListRunsQuery = defineQuery({
|
|
481
|
-
meta: {
|
|
482
|
-
key: "agent.run.list",
|
|
483
|
-
version: "1.0.0",
|
|
484
|
-
stability: "stable",
|
|
485
|
-
owners: [...OWNERS],
|
|
486
|
-
tags: ["run", "list"],
|
|
487
|
-
description: "Lists runs with optional filtering.",
|
|
488
|
-
goal: "Browse and search run history.",
|
|
489
|
-
context: "Run history/dashboard view."
|
|
490
|
-
},
|
|
491
|
-
io: {
|
|
492
|
-
input: defineSchemaModel2({
|
|
493
|
-
name: "ListRunsInput",
|
|
494
|
-
fields: {
|
|
495
|
-
organizationId: {
|
|
496
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
497
|
-
isOptional: true
|
|
498
|
-
},
|
|
499
|
-
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
500
|
-
userId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
501
|
-
sessionId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
502
|
-
status: { type: RunStatusEnum, isOptional: true },
|
|
503
|
-
startDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
504
|
-
endDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
505
|
-
limit: {
|
|
506
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
507
|
-
isOptional: true,
|
|
508
|
-
defaultValue: 20
|
|
509
|
-
},
|
|
510
|
-
offset: {
|
|
511
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
512
|
-
isOptional: true,
|
|
513
|
-
defaultValue: 0
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}),
|
|
517
|
-
output: defineSchemaModel2({
|
|
518
|
-
name: "ListRunsOutput",
|
|
519
|
-
fields: {
|
|
520
|
-
items: { type: RunSummaryModel, isArray: true, isOptional: false },
|
|
521
|
-
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
522
|
-
hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
|
|
523
|
-
}
|
|
524
|
-
})
|
|
525
|
-
},
|
|
526
|
-
policy: { auth: "user" },
|
|
527
|
-
acceptance: {
|
|
528
|
-
scenarios: [
|
|
529
|
-
{
|
|
530
|
-
key: "list-runs-happy-path",
|
|
531
|
-
given: ["Organization has runs"],
|
|
532
|
-
when: ["User lists runs"],
|
|
533
|
-
then: ["Paginated list of runs is returned"]
|
|
534
|
-
}
|
|
535
|
-
],
|
|
536
|
-
examples: [
|
|
537
|
-
{
|
|
538
|
-
key: "list-by-agent",
|
|
539
|
-
input: { agentId: "agent-123", limit: 20, offset: 0 },
|
|
540
|
-
output: { items: [], total: 0, hasMore: false }
|
|
541
|
-
}
|
|
542
|
-
]
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
var GetRunStepsQuery = defineQuery({
|
|
546
|
-
meta: {
|
|
547
|
-
key: "agent.run.getSteps",
|
|
548
|
-
version: "1.0.0",
|
|
549
|
-
stability: "stable",
|
|
550
|
-
owners: [...OWNERS],
|
|
551
|
-
tags: ["run", "steps"],
|
|
552
|
-
description: "Retrieves all steps for a specific run.",
|
|
553
|
-
goal: "View step-by-step execution details.",
|
|
554
|
-
context: "Run details page - steps tab."
|
|
555
|
-
},
|
|
556
|
-
io: {
|
|
557
|
-
input: defineSchemaModel2({
|
|
558
|
-
name: "GetRunStepsInput",
|
|
559
|
-
fields: {
|
|
560
|
-
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
561
|
-
}
|
|
562
|
-
}),
|
|
563
|
-
output: defineSchemaModel2({
|
|
564
|
-
name: "GetRunStepsOutput",
|
|
565
|
-
fields: {
|
|
566
|
-
steps: { type: RunStepModel, isArray: true, isOptional: false }
|
|
567
|
-
}
|
|
568
|
-
})
|
|
569
|
-
},
|
|
570
|
-
policy: { auth: "user" },
|
|
571
|
-
acceptance: {
|
|
572
|
-
scenarios: [
|
|
573
|
-
{
|
|
574
|
-
key: "get-run-steps-happy-path",
|
|
575
|
-
given: ["Run exists with steps"],
|
|
576
|
-
when: ["User requests steps"],
|
|
577
|
-
then: ["Steps list is returned"]
|
|
578
|
-
}
|
|
579
|
-
],
|
|
580
|
-
examples: [
|
|
581
|
-
{
|
|
582
|
-
key: "get-steps-basic",
|
|
583
|
-
input: { runId: "run-456" },
|
|
584
|
-
output: { steps: [] }
|
|
585
|
-
}
|
|
586
|
-
]
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
var GetRunLogsQuery = defineQuery({
|
|
590
|
-
meta: {
|
|
591
|
-
key: "agent.run.getLogs",
|
|
592
|
-
version: "1.0.0",
|
|
593
|
-
stability: "stable",
|
|
594
|
-
owners: [...OWNERS],
|
|
595
|
-
tags: ["run", "logs"],
|
|
596
|
-
description: "Retrieves all logs for a specific run.",
|
|
597
|
-
goal: "Debug and audit run execution.",
|
|
598
|
-
context: "Run details page - logs tab."
|
|
599
|
-
},
|
|
600
|
-
io: {
|
|
601
|
-
input: defineSchemaModel2({
|
|
602
|
-
name: "GetRunLogsInput",
|
|
603
|
-
fields: {
|
|
604
|
-
runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
605
|
-
level: { type: LogLevelEnum, isOptional: true },
|
|
606
|
-
stepId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
607
|
-
limit: {
|
|
608
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
609
|
-
isOptional: true,
|
|
610
|
-
defaultValue: 100
|
|
611
|
-
},
|
|
612
|
-
offset: {
|
|
613
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
614
|
-
isOptional: true,
|
|
615
|
-
defaultValue: 0
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
}),
|
|
619
|
-
output: defineSchemaModel2({
|
|
620
|
-
name: "GetRunLogsOutput",
|
|
621
|
-
fields: {
|
|
622
|
-
items: { type: RunLogModel, isArray: true, isOptional: false },
|
|
623
|
-
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
624
|
-
hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
|
|
625
|
-
}
|
|
626
|
-
})
|
|
627
|
-
},
|
|
628
|
-
policy: { auth: "user" },
|
|
629
|
-
acceptance: {
|
|
630
|
-
scenarios: [
|
|
631
|
-
{
|
|
632
|
-
key: "get-run-logs-happy-path",
|
|
633
|
-
given: ["Run exists with logs"],
|
|
634
|
-
when: ["User requests logs"],
|
|
635
|
-
then: ["Paginated logs list is returned"]
|
|
636
|
-
}
|
|
637
|
-
],
|
|
638
|
-
examples: [
|
|
639
|
-
{
|
|
640
|
-
key: "get-logs-filtered",
|
|
641
|
-
input: { runId: "run-456", level: "error", limit: 50 },
|
|
642
|
-
output: { items: [], total: 0, hasMore: false }
|
|
643
|
-
}
|
|
644
|
-
]
|
|
645
|
-
}
|
|
646
|
-
});
|
|
647
|
-
var GetRunMetricsQuery = defineQuery({
|
|
648
|
-
meta: {
|
|
649
|
-
key: "agent.run.getMetrics",
|
|
650
|
-
version: "1.0.0",
|
|
651
|
-
stability: "stable",
|
|
652
|
-
owners: [...OWNERS],
|
|
653
|
-
tags: ["run", "metrics"],
|
|
654
|
-
description: "Retrieves aggregated metrics for runs within a time period.",
|
|
655
|
-
goal: "Monitor and analyze agent usage.",
|
|
656
|
-
context: "Analytics dashboard."
|
|
657
|
-
},
|
|
658
|
-
io: {
|
|
659
|
-
input: defineSchemaModel2({
|
|
660
|
-
name: "GetRunMetricsInput",
|
|
661
|
-
fields: {
|
|
662
|
-
organizationId: {
|
|
663
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
664
|
-
isOptional: false
|
|
665
|
-
},
|
|
666
|
-
agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
667
|
-
startDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
668
|
-
endDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
669
|
-
granularity: {
|
|
670
|
-
type: GranularityEnum,
|
|
671
|
-
isOptional: true,
|
|
672
|
-
defaultValue: "day"
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
}),
|
|
676
|
-
output: defineSchemaModel2({
|
|
677
|
-
name: "GetRunMetricsOutput",
|
|
678
|
-
fields: {
|
|
679
|
-
totalRuns: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
680
|
-
completedRuns: {
|
|
681
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
682
|
-
isOptional: false
|
|
683
|
-
},
|
|
684
|
-
failedRuns: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
685
|
-
totalTokens: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
686
|
-
totalCostUsd: {
|
|
687
|
-
type: ScalarTypeEnum2.Float_unsecure(),
|
|
688
|
-
isOptional: false
|
|
689
|
-
},
|
|
690
|
-
averageDurationMs: {
|
|
691
|
-
type: ScalarTypeEnum2.Float_unsecure(),
|
|
692
|
-
isOptional: false
|
|
693
|
-
},
|
|
694
|
-
successRate: {
|
|
695
|
-
type: ScalarTypeEnum2.Float_unsecure(),
|
|
696
|
-
isOptional: false
|
|
697
|
-
},
|
|
698
|
-
timeline: {
|
|
699
|
-
type: TimelineDataPointModel,
|
|
700
|
-
isArray: true,
|
|
701
|
-
isOptional: false
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
})
|
|
705
|
-
},
|
|
706
|
-
policy: { auth: "user" },
|
|
707
|
-
acceptance: {
|
|
708
|
-
scenarios: [
|
|
709
|
-
{
|
|
710
|
-
key: "get-run-metrics-happy-path",
|
|
711
|
-
given: ["Organization has run history"],
|
|
712
|
-
when: ["User requests metrics for date range"],
|
|
713
|
-
then: ["Aggregated metrics are returned"]
|
|
714
|
-
}
|
|
715
|
-
],
|
|
716
|
-
examples: [
|
|
717
|
-
{
|
|
718
|
-
key: "get-daily-metrics",
|
|
719
|
-
input: {
|
|
720
|
-
organizationId: "org-123",
|
|
721
|
-
startDate: "2025-01-01",
|
|
722
|
-
endDate: "2025-01-31",
|
|
723
|
-
granularity: "day"
|
|
724
|
-
},
|
|
725
|
-
output: {
|
|
726
|
-
totalRuns: 100,
|
|
727
|
-
completedRuns: 90,
|
|
728
|
-
failedRuns: 10,
|
|
729
|
-
totalTokens: 50000,
|
|
730
|
-
totalCostUsd: 5,
|
|
731
|
-
averageDurationMs: 2500,
|
|
732
|
-
successRate: 0.9,
|
|
733
|
-
timeline: []
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
]
|
|
737
|
-
}
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
// src/shared/mock-runs.ts
|
|
741
|
-
var MOCK_RUNS = [
|
|
742
|
-
{
|
|
743
|
-
id: "run-1",
|
|
744
|
-
organizationId: "demo-org",
|
|
745
|
-
projectId: "demo-project",
|
|
746
|
-
agentId: "agent-1",
|
|
747
|
-
agentName: "Customer Support Bot",
|
|
748
|
-
userId: "user-1",
|
|
749
|
-
sessionId: "session-1",
|
|
750
|
-
input: { message: "How do I reset my password?", context: {} },
|
|
751
|
-
output: { response: "You can reset your password by clicking..." },
|
|
752
|
-
status: "COMPLETED",
|
|
753
|
-
totalTokens: 1250,
|
|
754
|
-
promptTokens: 800,
|
|
755
|
-
completionTokens: 450,
|
|
756
|
-
totalIterations: 3,
|
|
757
|
-
durationMs: 4500,
|
|
758
|
-
estimatedCostUsd: 0.0025,
|
|
759
|
-
queuedAt: new Date("2024-04-15T10:00:00Z"),
|
|
760
|
-
startedAt: new Date("2024-04-15T10:00:01Z"),
|
|
761
|
-
completedAt: new Date("2024-04-15T10:00:05Z"),
|
|
762
|
-
steps: [],
|
|
763
|
-
logs: []
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
id: "run-2",
|
|
767
|
-
organizationId: "demo-org",
|
|
768
|
-
projectId: "demo-project",
|
|
769
|
-
agentId: "agent-2",
|
|
770
|
-
agentName: "Code Review Assistant",
|
|
771
|
-
userId: "user-2",
|
|
772
|
-
input: { message: "Review PR #123", context: { prNumber: 123 } },
|
|
773
|
-
status: "IN_PROGRESS",
|
|
774
|
-
totalTokens: 3500,
|
|
775
|
-
promptTokens: 3000,
|
|
776
|
-
completionTokens: 500,
|
|
777
|
-
totalIterations: 5,
|
|
778
|
-
queuedAt: new Date("2024-04-15T10:30:00Z"),
|
|
779
|
-
startedAt: new Date("2024-04-15T10:30:02Z"),
|
|
780
|
-
steps: [],
|
|
781
|
-
logs: []
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
id: "run-3",
|
|
785
|
-
organizationId: "demo-org",
|
|
786
|
-
projectId: "demo-project",
|
|
787
|
-
agentId: "agent-1",
|
|
788
|
-
agentName: "Customer Support Bot",
|
|
789
|
-
userId: "user-1",
|
|
790
|
-
input: { message: "What are your business hours?" },
|
|
791
|
-
output: { response: "Our business hours are 9 AM to 5 PM EST..." },
|
|
792
|
-
status: "COMPLETED",
|
|
793
|
-
totalTokens: 800,
|
|
794
|
-
promptTokens: 500,
|
|
795
|
-
completionTokens: 300,
|
|
796
|
-
totalIterations: 2,
|
|
797
|
-
durationMs: 2100,
|
|
798
|
-
estimatedCostUsd: 0.0012,
|
|
799
|
-
queuedAt: new Date("2024-04-15T09:00:00Z"),
|
|
800
|
-
startedAt: new Date("2024-04-15T09:00:01Z"),
|
|
801
|
-
completedAt: new Date("2024-04-15T09:00:03Z"),
|
|
802
|
-
steps: [],
|
|
803
|
-
logs: []
|
|
804
|
-
},
|
|
805
|
-
{
|
|
806
|
-
id: "run-4",
|
|
807
|
-
organizationId: "demo-org",
|
|
808
|
-
projectId: "demo-project",
|
|
809
|
-
agentId: "agent-3",
|
|
810
|
-
agentName: "Data Analyst",
|
|
811
|
-
userId: "user-3",
|
|
812
|
-
input: { message: "Generate sales report for Q1" },
|
|
813
|
-
status: "FAILED",
|
|
814
|
-
errorMessage: "Database connection timeout",
|
|
815
|
-
errorCode: "DB_TIMEOUT",
|
|
816
|
-
totalTokens: 2000,
|
|
817
|
-
promptTokens: 1500,
|
|
818
|
-
completionTokens: 500,
|
|
819
|
-
totalIterations: 8,
|
|
820
|
-
durationMs: 45000,
|
|
821
|
-
queuedAt: new Date("2024-04-14T15:00:00Z"),
|
|
822
|
-
startedAt: new Date("2024-04-14T15:00:05Z"),
|
|
823
|
-
completedAt: new Date("2024-04-14T15:00:50Z"),
|
|
824
|
-
steps: [],
|
|
825
|
-
logs: []
|
|
826
|
-
},
|
|
827
|
-
{
|
|
828
|
-
id: "run-5",
|
|
829
|
-
organizationId: "demo-org",
|
|
830
|
-
projectId: "demo-project",
|
|
831
|
-
agentId: "agent-2",
|
|
832
|
-
agentName: "Code Review Assistant",
|
|
833
|
-
userId: "user-2",
|
|
834
|
-
input: { message: "Review PR #120" },
|
|
835
|
-
output: { response: "Code review complete. 3 suggestions..." },
|
|
836
|
-
status: "COMPLETED",
|
|
837
|
-
totalTokens: 5200,
|
|
838
|
-
promptTokens: 4000,
|
|
839
|
-
completionTokens: 1200,
|
|
840
|
-
totalIterations: 7,
|
|
841
|
-
durationMs: 15000,
|
|
842
|
-
estimatedCostUsd: 0.0156,
|
|
843
|
-
queuedAt: new Date("2024-04-14T11:00:00Z"),
|
|
844
|
-
startedAt: new Date("2024-04-14T11:00:03Z"),
|
|
845
|
-
completedAt: new Date("2024-04-14T11:00:18Z"),
|
|
846
|
-
steps: [],
|
|
847
|
-
logs: []
|
|
848
|
-
}
|
|
849
|
-
];
|
|
850
|
-
|
|
851
|
-
// src/run/run.handler.ts
|
|
852
|
-
var nextMockRunId = MOCK_RUNS.length + 1;
|
|
853
|
-
async function mockListRunsHandler(input) {
|
|
854
|
-
const { agentId, status, limit = 20, offset = 0 } = input;
|
|
855
|
-
let filtered = [...MOCK_RUNS];
|
|
856
|
-
if (agentId)
|
|
857
|
-
filtered = filtered.filter((r) => r.agentId === agentId);
|
|
858
|
-
if (status)
|
|
859
|
-
filtered = filtered.filter((r) => r.status === status);
|
|
860
|
-
const total = filtered.length;
|
|
861
|
-
const items = filtered.slice(offset, offset + limit).map((r) => {
|
|
862
|
-
const agent = MOCK_AGENTS.find((a) => a.id === r.agentId);
|
|
863
|
-
return {
|
|
864
|
-
id: r.id,
|
|
865
|
-
agentId: r.agentId,
|
|
866
|
-
agentName: agent?.name ?? "Unknown",
|
|
867
|
-
status: r.status,
|
|
868
|
-
totalTokens: r.totalTokens,
|
|
869
|
-
durationMs: r.durationMs,
|
|
870
|
-
estimatedCostUsd: r.estimatedCostUsd,
|
|
871
|
-
queuedAt: r.queuedAt,
|
|
872
|
-
completedAt: r.completedAt
|
|
873
|
-
};
|
|
874
|
-
});
|
|
875
|
-
return { items, total, hasMore: offset + limit < total };
|
|
876
|
-
}
|
|
877
|
-
async function mockGetRunHandler(input) {
|
|
878
|
-
const run = MOCK_RUNS.find((r) => r.id === input.runId);
|
|
879
|
-
if (!run)
|
|
880
|
-
throw new Error("RUN_NOT_FOUND");
|
|
881
|
-
const agent = MOCK_AGENTS.find((a) => a.id === run.agentId);
|
|
882
|
-
return {
|
|
883
|
-
...run,
|
|
884
|
-
agent: agent ? {
|
|
885
|
-
id: agent.id,
|
|
886
|
-
name: agent.name,
|
|
887
|
-
modelProvider: agent.modelProvider,
|
|
888
|
-
modelName: agent.modelName
|
|
889
|
-
} : undefined,
|
|
890
|
-
steps: input.includeSteps ? run.steps : undefined,
|
|
891
|
-
logs: input.includeLogs ? run.logs : undefined
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
async function mockExecuteAgentHandler(input) {
|
|
895
|
-
const agent = MOCK_AGENTS.find((a) => a.id === input.agentId);
|
|
896
|
-
if (!agent)
|
|
897
|
-
throw new Error("AGENT_NOT_FOUND");
|
|
898
|
-
if (agent.status !== "ACTIVE")
|
|
899
|
-
throw new Error("AGENT_NOT_ACTIVE");
|
|
900
|
-
return {
|
|
901
|
-
runId: `run-${nextMockRunId++}`,
|
|
902
|
-
status: "QUEUED",
|
|
903
|
-
estimatedWaitMs: 500
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
async function mockCancelRunHandler(input) {
|
|
907
|
-
const run = MOCK_RUNS.find((r) => r.id === input.runId);
|
|
908
|
-
if (!run)
|
|
909
|
-
throw new Error("RUN_NOT_FOUND");
|
|
910
|
-
if (!["QUEUED", "IN_PROGRESS"].includes(run.status))
|
|
911
|
-
throw new Error("RUN_NOT_CANCELLABLE");
|
|
912
|
-
return { success: true, status: "CANCELLED" };
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
// src/run/run.entity.ts
|
|
916
|
-
import {
|
|
917
|
-
defineEntity,
|
|
918
|
-
defineEntityEnum,
|
|
919
|
-
field,
|
|
920
|
-
index
|
|
921
|
-
} from "@contractspec/lib.schema";
|
|
922
|
-
var RunStatusEntityEnum = defineEntityEnum({
|
|
923
|
-
name: "RunStatus",
|
|
924
|
-
values: [
|
|
925
|
-
"QUEUED",
|
|
926
|
-
"IN_PROGRESS",
|
|
927
|
-
"COMPLETED",
|
|
928
|
-
"FAILED",
|
|
929
|
-
"CANCELLED",
|
|
930
|
-
"EXPIRED"
|
|
931
|
-
],
|
|
932
|
-
description: "Status of an agent run"
|
|
933
|
-
});
|
|
934
|
-
var RunStepTypeEntityEnum = defineEntityEnum({
|
|
935
|
-
name: "RunStepType",
|
|
936
|
-
values: ["MESSAGE_CREATION", "TOOL_CALL", "TOOL_RESULT", "ERROR"],
|
|
937
|
-
description: "Type of run step"
|
|
938
|
-
});
|
|
939
|
-
var LogLevelEntityEnum = defineEntityEnum({
|
|
940
|
-
name: "LogLevel",
|
|
941
|
-
values: ["DEBUG", "INFO", "WARN", "ERROR"],
|
|
942
|
-
description: "Log level"
|
|
943
|
-
});
|
|
944
|
-
var RunEntity = defineEntity({
|
|
945
|
-
name: "Run",
|
|
946
|
-
schema: "agent_console",
|
|
947
|
-
description: "An execution of an agent with input/output and metrics.",
|
|
948
|
-
fields: {
|
|
949
|
-
id: field.id(),
|
|
950
|
-
organizationId: field.string({ description: "Organization ID" }),
|
|
951
|
-
agentId: field.foreignKey({ description: "Agent being executed" }),
|
|
952
|
-
userId: field.string({
|
|
953
|
-
isOptional: true,
|
|
954
|
-
description: "User who initiated the run"
|
|
955
|
-
}),
|
|
956
|
-
sessionId: field.string({
|
|
957
|
-
isOptional: true,
|
|
958
|
-
description: "Conversation session ID"
|
|
959
|
-
}),
|
|
960
|
-
input: field.json({ description: "Input data for the run" }),
|
|
961
|
-
output: field.json({
|
|
962
|
-
isOptional: true,
|
|
963
|
-
description: "Output result from the run"
|
|
964
|
-
}),
|
|
965
|
-
status: field.enum("RunStatus", { default: "QUEUED" }),
|
|
966
|
-
errorMessage: field.string({
|
|
967
|
-
isOptional: true,
|
|
968
|
-
description: "Error message if failed"
|
|
969
|
-
}),
|
|
970
|
-
errorCode: field.string({
|
|
971
|
-
isOptional: true,
|
|
972
|
-
description: "Error code if failed"
|
|
973
|
-
}),
|
|
974
|
-
totalTokens: field.int({ default: 0, description: "Total tokens used" }),
|
|
975
|
-
promptTokens: field.int({ default: 0, description: "Prompt tokens used" }),
|
|
976
|
-
completionTokens: field.int({
|
|
977
|
-
default: 0,
|
|
978
|
-
description: "Completion tokens used"
|
|
979
|
-
}),
|
|
980
|
-
totalIterations: field.int({
|
|
981
|
-
default: 0,
|
|
982
|
-
description: "Number of iterations"
|
|
983
|
-
}),
|
|
984
|
-
durationMs: field.int({
|
|
985
|
-
isOptional: true,
|
|
986
|
-
description: "Execution duration in ms"
|
|
987
|
-
}),
|
|
988
|
-
estimatedCostUsd: field.float({
|
|
989
|
-
isOptional: true,
|
|
990
|
-
description: "Estimated cost in USD"
|
|
991
|
-
}),
|
|
992
|
-
queuedAt: field.dateTime({ description: "When run was queued" }),
|
|
993
|
-
startedAt: field.dateTime({
|
|
994
|
-
isOptional: true,
|
|
995
|
-
description: "When run started executing"
|
|
996
|
-
}),
|
|
997
|
-
completedAt: field.dateTime({
|
|
998
|
-
isOptional: true,
|
|
999
|
-
description: "When run completed"
|
|
1000
|
-
}),
|
|
1001
|
-
metadata: field.json({
|
|
1002
|
-
isOptional: true,
|
|
1003
|
-
description: "Additional metadata"
|
|
1004
|
-
}),
|
|
1005
|
-
agent: field.belongsTo("Agent", ["agentId"], ["id"]),
|
|
1006
|
-
steps: field.hasMany("RunStep", { description: "Execution steps" }),
|
|
1007
|
-
logs: field.hasMany("RunLog", { description: "Execution logs" })
|
|
1008
|
-
},
|
|
1009
|
-
indexes: [
|
|
1010
|
-
index.on(["organizationId", "agentId", "queuedAt"]),
|
|
1011
|
-
index.on(["organizationId", "status"]),
|
|
1012
|
-
index.on(["agentId", "status"]),
|
|
1013
|
-
index.on(["sessionId"])
|
|
1014
|
-
],
|
|
1015
|
-
enums: [RunStatusEntityEnum]
|
|
1016
|
-
});
|
|
1017
|
-
var RunStepEntity = defineEntity({
|
|
1018
|
-
name: "RunStep",
|
|
1019
|
-
schema: "agent_console",
|
|
1020
|
-
description: "An individual step in an agent run.",
|
|
1021
|
-
fields: {
|
|
1022
|
-
id: field.id(),
|
|
1023
|
-
runId: field.foreignKey({ description: "Parent run" }),
|
|
1024
|
-
stepNumber: field.int({ description: "Step sequence number" }),
|
|
1025
|
-
type: field.enum("RunStepType"),
|
|
1026
|
-
toolId: field.string({
|
|
1027
|
-
isOptional: true,
|
|
1028
|
-
description: "Tool used in this step"
|
|
1029
|
-
}),
|
|
1030
|
-
toolName: field.string({ isOptional: true, description: "Tool name" }),
|
|
1031
|
-
input: field.json({ isOptional: true, description: "Step input" }),
|
|
1032
|
-
output: field.json({ isOptional: true, description: "Step output" }),
|
|
1033
|
-
status: field.enum("RunStatus"),
|
|
1034
|
-
errorMessage: field.string({ isOptional: true }),
|
|
1035
|
-
tokensUsed: field.int({ default: 0 }),
|
|
1036
|
-
durationMs: field.int({ isOptional: true }),
|
|
1037
|
-
startedAt: field.dateTime(),
|
|
1038
|
-
completedAt: field.dateTime({ isOptional: true }),
|
|
1039
|
-
run: field.belongsTo("Run", ["runId"], ["id"])
|
|
1040
|
-
},
|
|
1041
|
-
indexes: [index.on(["runId", "stepNumber"])],
|
|
1042
|
-
enums: [RunStepTypeEntityEnum]
|
|
1043
|
-
});
|
|
1044
|
-
var RunLogEntity = defineEntity({
|
|
1045
|
-
name: "RunLog",
|
|
1046
|
-
schema: "agent_console",
|
|
1047
|
-
description: "A log entry for an agent run.",
|
|
1048
|
-
fields: {
|
|
1049
|
-
id: field.id(),
|
|
1050
|
-
runId: field.foreignKey({ description: "Parent run" }),
|
|
1051
|
-
stepId: field.string({ isOptional: true, description: "Related step" }),
|
|
1052
|
-
level: field.enum("LogLevel"),
|
|
1053
|
-
message: field.string({ description: "Log message" }),
|
|
1054
|
-
data: field.json({ isOptional: true, description: "Additional log data" }),
|
|
1055
|
-
source: field.string({
|
|
1056
|
-
isOptional: true,
|
|
1057
|
-
description: "Log source component"
|
|
1058
|
-
}),
|
|
1059
|
-
traceId: field.string({ isOptional: true }),
|
|
1060
|
-
spanId: field.string({ isOptional: true }),
|
|
1061
|
-
timestamp: field.dateTime(),
|
|
1062
|
-
run: field.belongsTo("Run", ["runId"], ["id"])
|
|
1063
|
-
},
|
|
1064
|
-
indexes: [index.on(["runId", "timestamp"]), index.on(["runId", "level"])],
|
|
1065
|
-
enums: [LogLevelEntityEnum]
|
|
1066
|
-
});
|
|
1067
|
-
|
|
1068
|
-
// src/run/run.event.ts
|
|
1069
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
1070
|
-
import {
|
|
1071
|
-
defineEnum as defineEnum2,
|
|
1072
|
-
defineSchemaModel as defineSchemaModel3,
|
|
1073
|
-
ScalarTypeEnum as ScalarTypeEnum3
|
|
1074
|
-
} from "@contractspec/lib.schema";
|
|
1075
|
-
var OWNERS2 = ["@agent-console-team"];
|
|
1076
|
-
var RunStartedPayload = defineSchemaModel3({
|
|
1077
|
-
name: "RunStartedPayload",
|
|
1078
|
-
description: "Payload for run started event",
|
|
1079
|
-
fields: {
|
|
1080
|
-
runId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1081
|
-
organizationId: {
|
|
1082
|
-
type: ScalarTypeEnum3.String_unsecure(),
|
|
1083
|
-
isOptional: false
|
|
1084
|
-
},
|
|
1085
|
-
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1086
|
-
agentName: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1087
|
-
userId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1088
|
-
sessionId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1089
|
-
input: { type: ScalarTypeEnum3.JSONObject(), isOptional: false },
|
|
1090
|
-
startedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
var RunStartedEvent = defineEvent({
|
|
1094
|
-
meta: {
|
|
1095
|
-
key: "agent.run.started",
|
|
1096
|
-
version: "1.0.0",
|
|
1097
|
-
description: "An agent run was started.",
|
|
1098
|
-
stability: "stable",
|
|
1099
|
-
owners: [...OWNERS2],
|
|
1100
|
-
tags: ["run", "started"]
|
|
1101
|
-
},
|
|
1102
|
-
payload: RunStartedPayload
|
|
1103
|
-
});
|
|
1104
|
-
var RunCompletedPayload = defineSchemaModel3({
|
|
1105
|
-
name: "RunCompletedPayload",
|
|
1106
|
-
description: "Payload for run completed event",
|
|
1107
|
-
fields: {
|
|
1108
|
-
runId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1109
|
-
organizationId: {
|
|
1110
|
-
type: ScalarTypeEnum3.String_unsecure(),
|
|
1111
|
-
isOptional: false
|
|
1112
|
-
},
|
|
1113
|
-
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1114
|
-
agentName: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1115
|
-
userId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1116
|
-
output: { type: ScalarTypeEnum3.JSONObject(), isOptional: false },
|
|
1117
|
-
totalTokens: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1118
|
-
promptTokens: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1119
|
-
completionTokens: {
|
|
1120
|
-
type: ScalarTypeEnum3.Int_unsecure(),
|
|
1121
|
-
isOptional: false
|
|
1122
|
-
},
|
|
1123
|
-
totalIterations: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1124
|
-
durationMs: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1125
|
-
estimatedCostUsd: {
|
|
1126
|
-
type: ScalarTypeEnum3.Float_unsecure(),
|
|
1127
|
-
isOptional: true
|
|
1128
|
-
},
|
|
1129
|
-
completedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
var RunCompletedEvent = defineEvent({
|
|
1133
|
-
meta: {
|
|
1134
|
-
key: "agent.run.completed",
|
|
1135
|
-
version: "1.0.0",
|
|
1136
|
-
description: "An agent run completed successfully.",
|
|
1137
|
-
stability: "stable",
|
|
1138
|
-
owners: [...OWNERS2],
|
|
1139
|
-
tags: ["run", "completed"]
|
|
1140
|
-
},
|
|
1141
|
-
payload: RunCompletedPayload
|
|
1142
|
-
});
|
|
1143
|
-
var RunFailedPayload = defineSchemaModel3({
|
|
1144
|
-
name: "RunFailedPayload",
|
|
1145
|
-
description: "Payload for run failed event",
|
|
1146
|
-
fields: {
|
|
1147
|
-
runId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1148
|
-
organizationId: {
|
|
1149
|
-
type: ScalarTypeEnum3.String_unsecure(),
|
|
1150
|
-
isOptional: false
|
|
1151
|
-
},
|
|
1152
|
-
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1153
|
-
agentName: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1154
|
-
userId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1155
|
-
errorMessage: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1156
|
-
errorCode: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1157
|
-
totalTokens: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1158
|
-
totalIterations: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1159
|
-
durationMs: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: true },
|
|
1160
|
-
failedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
1161
|
-
}
|
|
1162
|
-
});
|
|
1163
|
-
var RunFailedEvent = defineEvent({
|
|
1164
|
-
meta: {
|
|
1165
|
-
key: "agent.run.failed",
|
|
1166
|
-
version: "1.0.0",
|
|
1167
|
-
description: "An agent run encountered an error.",
|
|
1168
|
-
stability: "stable",
|
|
1169
|
-
owners: [...OWNERS2],
|
|
1170
|
-
tags: ["run", "failed"]
|
|
1171
|
-
},
|
|
1172
|
-
payload: RunFailedPayload
|
|
1173
|
-
});
|
|
1174
|
-
var RunCancelledPayload = defineSchemaModel3({
|
|
1175
|
-
name: "RunCancelledPayload",
|
|
1176
|
-
description: "Payload for run cancelled event",
|
|
1177
|
-
fields: {
|
|
1178
|
-
runId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1179
|
-
organizationId: {
|
|
1180
|
-
type: ScalarTypeEnum3.String_unsecure(),
|
|
1181
|
-
isOptional: false
|
|
1182
|
-
},
|
|
1183
|
-
agentId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1184
|
-
userId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1185
|
-
cancelledBy: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1186
|
-
reason: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1187
|
-
totalTokens: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1188
|
-
totalIterations: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1189
|
-
cancelledAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
1190
|
-
}
|
|
1191
|
-
});
|
|
1192
|
-
var RunCancelledEvent = defineEvent({
|
|
1193
|
-
meta: {
|
|
1194
|
-
key: "agent.run.cancelled",
|
|
1195
|
-
version: "1.0.0",
|
|
1196
|
-
description: "An agent run was cancelled by the user.",
|
|
1197
|
-
stability: "stable",
|
|
1198
|
-
owners: [...OWNERS2],
|
|
1199
|
-
tags: ["run", "cancelled"]
|
|
1200
|
-
},
|
|
1201
|
-
payload: RunCancelledPayload
|
|
1202
|
-
});
|
|
1203
|
-
var ToolInvokedPayload = defineSchemaModel3({
|
|
1204
|
-
name: "ToolInvokedPayload",
|
|
1205
|
-
description: "Payload for tool invoked event",
|
|
1206
|
-
fields: {
|
|
1207
|
-
runId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1208
|
-
stepId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1209
|
-
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1210
|
-
toolName: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1211
|
-
input: { type: ScalarTypeEnum3.JSONObject(), isOptional: false },
|
|
1212
|
-
invokedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
var ToolInvokedEvent = defineEvent({
|
|
1216
|
-
meta: {
|
|
1217
|
-
key: "agent.run.toolInvoked",
|
|
1218
|
-
version: "1.0.0",
|
|
1219
|
-
description: "A tool was invoked during an agent run.",
|
|
1220
|
-
stability: "stable",
|
|
1221
|
-
owners: [...OWNERS2],
|
|
1222
|
-
tags: ["run", "tool", "invoked"]
|
|
1223
|
-
},
|
|
1224
|
-
payload: ToolInvokedPayload
|
|
1225
|
-
});
|
|
1226
|
-
var ToolCompletedPayload = defineSchemaModel3({
|
|
1227
|
-
name: "ToolCompletedPayload",
|
|
1228
|
-
description: "Payload for tool completed event",
|
|
1229
|
-
fields: {
|
|
1230
|
-
runId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1231
|
-
stepId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1232
|
-
toolId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1233
|
-
toolName: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1234
|
-
success: { type: ScalarTypeEnum3.Boolean(), isOptional: false },
|
|
1235
|
-
output: { type: ScalarTypeEnum3.JSONObject(), isOptional: true },
|
|
1236
|
-
errorMessage: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
|
|
1237
|
-
durationMs: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1238
|
-
completedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1241
|
-
var ToolCompletedEvent = defineEvent({
|
|
1242
|
-
meta: {
|
|
1243
|
-
key: "agent.run.toolCompleted",
|
|
1244
|
-
version: "1.0.0",
|
|
1245
|
-
description: "A tool invocation completed during an agent run.",
|
|
1246
|
-
stability: "stable",
|
|
1247
|
-
owners: [...OWNERS2],
|
|
1248
|
-
tags: ["run", "tool", "completed"]
|
|
1249
|
-
},
|
|
1250
|
-
payload: ToolCompletedPayload
|
|
1251
|
-
});
|
|
1252
|
-
var MessageTypeEnum = defineEnum2("MessageType", ["assistant", "system"]);
|
|
1253
|
-
var MessageGeneratedPayload = defineSchemaModel3({
|
|
1254
|
-
name: "MessageGeneratedPayload",
|
|
1255
|
-
description: "Payload for message generated event",
|
|
1256
|
-
fields: {
|
|
1257
|
-
runId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1258
|
-
stepId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1259
|
-
messageType: { type: MessageTypeEnum, isOptional: false },
|
|
1260
|
-
content: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
1261
|
-
tokensUsed: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
|
|
1262
|
-
generatedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false }
|
|
1263
|
-
}
|
|
1264
|
-
});
|
|
1265
|
-
var MessageGeneratedEvent = defineEvent({
|
|
1266
|
-
meta: {
|
|
1267
|
-
key: "agent.run.messageGenerated",
|
|
1268
|
-
version: "1.0.0",
|
|
1269
|
-
description: "An agent generated a message during a run.",
|
|
1270
|
-
stability: "stable",
|
|
1271
|
-
owners: [...OWNERS2],
|
|
1272
|
-
tags: ["run", "message", "generated"]
|
|
1273
|
-
},
|
|
1274
|
-
payload: MessageGeneratedPayload
|
|
1275
|
-
});
|
|
1276
|
-
|
|
1277
|
-
// src/run/run.presentation.ts
|
|
1278
|
-
import {
|
|
1279
|
-
definePresentation,
|
|
1280
|
-
StabilityEnum
|
|
1281
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1282
|
-
var RunListPresentation = definePresentation({
|
|
1283
|
-
meta: {
|
|
1284
|
-
key: "agent-console.run.list",
|
|
1285
|
-
version: "1.0.0",
|
|
1286
|
-
title: "Run List",
|
|
1287
|
-
description: "List view of agent runs with status, tokens, and duration info",
|
|
1288
|
-
goal: "Provide an overview of agent execution history and performance.",
|
|
1289
|
-
context: "Run history dashboard.",
|
|
1290
|
-
domain: "agent-console",
|
|
1291
|
-
owners: ["@agent-console-team"],
|
|
1292
|
-
tags: ["run", "list", "dashboard"],
|
|
1293
|
-
stability: StabilityEnum.Experimental
|
|
1294
|
-
},
|
|
1295
|
-
source: {
|
|
1296
|
-
type: "component",
|
|
1297
|
-
framework: "react",
|
|
1298
|
-
componentKey: "RunListView",
|
|
1299
|
-
props: RunSummaryModel
|
|
1300
|
-
},
|
|
1301
|
-
targets: ["react", "markdown", "application/json"],
|
|
1302
|
-
policy: { flags: ["agent-console.enabled"] }
|
|
1303
|
-
});
|
|
1304
|
-
var RunDetailPresentation = definePresentation({
|
|
1305
|
-
meta: {
|
|
1306
|
-
key: "agent-console.run.detail",
|
|
1307
|
-
version: "1.0.0",
|
|
1308
|
-
title: "Run Details",
|
|
1309
|
-
description: "Detailed view of an agent run with steps, logs, and metrics",
|
|
1310
|
-
goal: "Allow users to inspect and debug a specific agent run.",
|
|
1311
|
-
context: "Detailed view of an agent run.",
|
|
1312
|
-
domain: "agent-console",
|
|
1313
|
-
owners: ["@agent-console-team"],
|
|
1314
|
-
tags: ["run", "detail"],
|
|
1315
|
-
stability: StabilityEnum.Experimental
|
|
1316
|
-
},
|
|
1317
|
-
source: {
|
|
1318
|
-
type: "component",
|
|
1319
|
-
framework: "react",
|
|
1320
|
-
componentKey: "RunDetailView"
|
|
1321
|
-
},
|
|
1322
|
-
targets: ["react", "markdown"],
|
|
1323
|
-
policy: { flags: ["agent-console.enabled"] }
|
|
1324
|
-
});
|
|
1325
|
-
export {
|
|
1326
|
-
mockListRunsHandler,
|
|
1327
|
-
mockGetRunHandler,
|
|
1328
|
-
mockExecuteAgentHandler,
|
|
1329
|
-
mockCancelRunHandler,
|
|
1330
|
-
ToolInvokedEvent,
|
|
1331
|
-
ToolCompletedEvent,
|
|
1332
|
-
TimelineDataPointModel,
|
|
1333
|
-
RunSummaryModel,
|
|
1334
|
-
RunStepTypeEnum,
|
|
1335
|
-
RunStepTypeEntityEnum,
|
|
1336
|
-
RunStepModel,
|
|
1337
|
-
RunStepEntity,
|
|
1338
|
-
RunStatusEnum,
|
|
1339
|
-
RunStatusEntityEnum,
|
|
1340
|
-
RunStartedEvent,
|
|
1341
|
-
RunModel,
|
|
1342
|
-
RunLogModel,
|
|
1343
|
-
RunLogEntity,
|
|
1344
|
-
RunListPresentation,
|
|
1345
|
-
RunInputModel,
|
|
1346
|
-
RunFailedEvent,
|
|
1347
|
-
RunEntity,
|
|
1348
|
-
RunDetailPresentation,
|
|
1349
|
-
RunCompletedEvent,
|
|
1350
|
-
RunCancelledEvent,
|
|
1351
|
-
RunAgentRefModel,
|
|
1352
|
-
MessageGeneratedEvent,
|
|
1353
|
-
LogLevelEnum,
|
|
1354
|
-
LogLevelEntityEnum,
|
|
1355
|
-
ListRunsQuery,
|
|
1356
|
-
GranularityEnum,
|
|
1357
|
-
GetRunStepsQuery,
|
|
1358
|
-
GetRunQuery,
|
|
1359
|
-
GetRunMetricsQuery,
|
|
1360
|
-
GetRunLogsQuery,
|
|
1361
|
-
ExecuteAgentCommand,
|
|
1362
|
-
CancelRunCommand
|
|
1363
|
-
};
|
|
1
|
+
var F=[{id:"agent-1",organizationId:"demo-org",name:"Customer Support Bot",slug:"customer-support-bot",description:"Handles tier-1 customer inquiries and routes complex issues.",status:"ACTIVE",modelProvider:"OPENAI",modelName:"gpt-4o-mini",modelConfig:{temperature:0.7},systemPrompt:"You are a helpful customer support assistant.",toolChoice:"auto",maxIterations:10,timeoutMs:120000,version:"1.0.0",tags:["support","tier-1"],createdAt:new Date("2024-01-15T10:00:00Z"),updatedAt:new Date("2024-03-20T14:30:00Z")},{id:"agent-2",organizationId:"demo-org",name:"Code Review Assistant",slug:"code-review-assistant",description:"Reviews pull requests and provides actionable feedback.",status:"ACTIVE",modelProvider:"ANTHROPIC",modelName:"claude-sonnet-4-20250514",modelConfig:{temperature:0.3},systemPrompt:"You are a code review expert.",toolChoice:"auto",maxIterations:15,timeoutMs:180000,version:"2.1.0",tags:["code","review","dev"],createdAt:new Date("2024-02-10T09:00:00Z"),updatedAt:new Date("2024-04-05T11:15:00Z")},{id:"agent-3",organizationId:"demo-org",name:"Data Analyst",slug:"data-analyst",description:"Queries databases and generates insights from data.",status:"PAUSED",modelProvider:"OPENAI",modelName:"gpt-4o",modelConfig:{temperature:0.5},systemPrompt:"You are a data analyst expert in SQL and analytics.",toolChoice:"required",maxIterations:20,timeoutMs:300000,version:"1.2.0",tags:["data","analytics","sql"],createdAt:new Date("2024-03-01T08:00:00Z"),updatedAt:new Date("2024-04-10T16:45:00Z")},{id:"agent-4",organizationId:"demo-org",name:"Meeting Scheduler",slug:"meeting-scheduler",description:"Schedules meetings and manages calendar conflicts.",status:"DRAFT",modelProvider:"GOOGLE",modelName:"gemini-2.0-flash",modelConfig:{temperature:0.2},systemPrompt:"You help schedule and organize meetings efficiently.",toolChoice:"auto",maxIterations:5,timeoutMs:60000,version:"0.1.0",tags:["calendar","scheduling"],createdAt:new Date("2024-04-01T12:00:00Z"),updatedAt:new Date("2024-04-01T12:00:00Z")}];import{defineEnum as U}from"@contractspec/lib.schema";var k=U("RunStatus",["QUEUED","IN_PROGRESS","COMPLETED","FAILED","CANCELLED","EXPIRED"]),X=U("RunStepType",["MESSAGE_CREATION","TOOL_CALL","TOOL_RESULT","ERROR"]),G=U("LogLevel",["DEBUG","INFO","WARN","ERROR"]),$=U("Granularity",["hour","day","week","month"]);import{defineSchemaModel as C,ScalarTypeEnum as s}from"@contractspec/lib.schema";var b=C({name:"RunInput",description:"Input data for agent execution",fields:{message:{type:s.NonEmptyString(),isOptional:!1},context:{type:s.JSONObject(),isOptional:!0}}}),V=C({name:"RunStep",description:"Individual step within a run",fields:{id:{type:s.String_unsecure(),isOptional:!1},stepNumber:{type:s.Int_unsecure(),isOptional:!1},type:{type:X,isOptional:!1},toolId:{type:s.String_unsecure(),isOptional:!0},toolName:{type:s.String_unsecure(),isOptional:!0},input:{type:s.JSONObject(),isOptional:!0},output:{type:s.JSONObject(),isOptional:!0},status:{type:k,isOptional:!1},errorMessage:{type:s.String_unsecure(),isOptional:!0},tokensUsed:{type:s.Int_unsecure(),isOptional:!1,defaultValue:0},durationMs:{type:s.Int_unsecure(),isOptional:!0},startedAt:{type:s.DateTime(),isOptional:!1},completedAt:{type:s.DateTime(),isOptional:!0}}}),Q=C({name:"RunLog",description:"Execution log entry",fields:{id:{type:s.String_unsecure(),isOptional:!1},stepId:{type:s.String_unsecure(),isOptional:!0},level:{type:G,isOptional:!1},message:{type:s.String_unsecure(),isOptional:!1},data:{type:s.JSONObject(),isOptional:!0},source:{type:s.String_unsecure(),isOptional:!0},traceId:{type:s.String_unsecure(),isOptional:!0},spanId:{type:s.String_unsecure(),isOptional:!0},timestamp:{type:s.DateTime(),isOptional:!1}}}),O=C({name:"RunAgentRef",description:"Agent reference in a run",fields:{id:{type:s.String_unsecure(),isOptional:!1},name:{type:s.NonEmptyString(),isOptional:!1},modelProvider:{type:s.String_unsecure(),isOptional:!1},modelName:{type:s.String_unsecure(),isOptional:!1}}}),_=C({name:"Run",description:"Agent execution instance",fields:{id:{type:s.String_unsecure(),isOptional:!1},organizationId:{type:s.String_unsecure(),isOptional:!1},agentId:{type:s.String_unsecure(),isOptional:!1},userId:{type:s.String_unsecure(),isOptional:!0},sessionId:{type:s.String_unsecure(),isOptional:!0},input:{type:s.JSONObject(),isOptional:!1},output:{type:s.JSONObject(),isOptional:!0},status:{type:k,isOptional:!1},errorMessage:{type:s.String_unsecure(),isOptional:!0},errorCode:{type:s.String_unsecure(),isOptional:!0},totalTokens:{type:s.Int_unsecure(),isOptional:!1,defaultValue:0},promptTokens:{type:s.Int_unsecure(),isOptional:!1,defaultValue:0},completionTokens:{type:s.Int_unsecure(),isOptional:!1,defaultValue:0},totalIterations:{type:s.Int_unsecure(),isOptional:!1,defaultValue:0},durationMs:{type:s.Int_unsecure(),isOptional:!0},estimatedCostUsd:{type:s.Float_unsecure(),isOptional:!0},queuedAt:{type:s.DateTime(),isOptional:!1},startedAt:{type:s.DateTime(),isOptional:!0},completedAt:{type:s.DateTime(),isOptional:!0},metadata:{type:s.JSONObject(),isOptional:!0},steps:{type:V,isArray:!0,isOptional:!0},logs:{type:Q,isArray:!0,isOptional:!0},agent:{type:O,isOptional:!0}}}),x=C({name:"RunSummary",description:"Summary of a run for list views",fields:{id:{type:s.String_unsecure(),isOptional:!1},agentId:{type:s.String_unsecure(),isOptional:!1},agentName:{type:s.NonEmptyString(),isOptional:!1},status:{type:k,isOptional:!1},totalTokens:{type:s.Int_unsecure(),isOptional:!1},durationMs:{type:s.Int_unsecure(),isOptional:!0},estimatedCostUsd:{type:s.Float_unsecure(),isOptional:!0},queuedAt:{type:s.DateTime(),isOptional:!1},completedAt:{type:s.DateTime(),isOptional:!0}}}),K=C({name:"TimelineDataPoint",description:"Timeline data point for metrics",fields:{period:{type:s.String_unsecure(),isOptional:!1},runs:{type:s.Int_unsecure(),isOptional:!1},tokens:{type:s.Int_unsecure(),isOptional:!1},costUsd:{type:s.Float_unsecure(),isOptional:!1},avgDurationMs:{type:s.Float_unsecure(),isOptional:!1}}});import{defineCommand as d,defineQuery as Y}from"@contractspec/lib.contracts-spec/operations";import{defineSchemaModel as w,ScalarTypeEnum as g}from"@contractspec/lib.schema";var v=["@agent-console-team"],W=d({meta:{key:"agent.run.execute",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","execute"],description:"Starts a new agent run with the given input.",goal:"Execute an AI agent with user input.",context:"Called from chat interface or API."},io:{input:w({name:"ExecuteAgentInput",fields:{agentId:{type:g.String_unsecure(),isOptional:!1},input:{type:b,isOptional:!1},sessionId:{type:g.String_unsecure(),isOptional:!0},metadata:{type:g.JSONObject(),isOptional:!0},stream:{type:g.Boolean(),isOptional:!0},maxIterations:{type:g.Int_unsecure(),isOptional:!0},timeoutMs:{type:g.Int_unsecure(),isOptional:!0}}}),output:w({name:"ExecuteAgentOutput",fields:{runId:{type:g.String_unsecure(),isOptional:!1},status:{type:k,isOptional:!1},estimatedWaitMs:{type:g.Int_unsecure(),isOptional:!0}}}),errors:{AGENT_NOT_FOUND:{description:"The specified agent does not exist",http:404,gqlCode:"AGENT_NOT_FOUND",when:"Agent ID is invalid"},AGENT_NOT_ACTIVE:{description:"The specified agent is not active",http:400,gqlCode:"AGENT_NOT_ACTIVE",when:"Agent is in draft/paused/archived state"}}},policy:{auth:"user"},sideEffects:{emits:[{key:"run.started",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","started"],when:"Run is queued",payload:x}],audit:["run.started"]},acceptance:{scenarios:[{key:"execute-agent-happy-path",given:["Agent exists","Agent is active"],when:["User submits execution request"],then:["Run is created","RunStarted event is emitted"]},{key:"execute-agent-not-active",given:["Agent exists but is not active"],when:["User attempts to execute"],then:["AGENT_NOT_ACTIVE error is returned"]}],examples:[{key:"basic-execute",input:{agentId:"agent-123",input:{message:"Hello"}},output:{runId:"run-456",status:"pending",estimatedWaitMs:5000}}]}}),h=d({meta:{key:"agent.run.cancel",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","cancel"],description:"Cancels an in-progress agent run.",goal:"Stop a running agent execution.",context:"Called when user wants to abort a long-running task."},io:{input:w({name:"CancelRunInput",fields:{runId:{type:g.String_unsecure(),isOptional:!1},reason:{type:g.String_unsecure(),isOptional:!0}}}),output:w({name:"CancelRunOutput",fields:{success:{type:g.Boolean(),isOptional:!1},status:{type:k,isOptional:!1}}}),errors:{RUN_NOT_FOUND:{description:"The specified run does not exist",http:404,gqlCode:"RUN_NOT_FOUND",when:"Run ID is invalid"},RUN_NOT_CANCELLABLE:{description:"The run cannot be cancelled",http:400,gqlCode:"RUN_NOT_CANCELLABLE",when:"Run is already completed/failed/cancelled"}}},policy:{auth:"user"},sideEffects:{emits:[{key:"run.cancelled",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","cancelled"],when:"Run is cancelled",payload:x}],audit:["run.cancelled"]},acceptance:{scenarios:[{key:"cancel-run-happy-path",given:["Run exists","Run is in progress"],when:["User cancels run"],then:["Run is cancelled","RunCancelled event is emitted"]},{key:"cancel-run-already-completed",given:["Run exists but is already completed"],when:["User attempts to cancel"],then:["RUN_NOT_CANCELLABLE error is returned"]}],examples:[{key:"cancel-basic",input:{runId:"run-456",reason:"User requested"},output:{success:!0,status:"cancelled"}}]}}),M=Y({meta:{key:"agent.run.get",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","get"],description:"Retrieves a run by its ID with optional details.",goal:"View detailed run information.",context:"Run details page or monitoring."},io:{input:w({name:"GetRunInput",fields:{runId:{type:g.String_unsecure(),isOptional:!1},includeSteps:{type:g.Boolean(),isOptional:!0},includeLogs:{type:g.Boolean(),isOptional:!0}}}),output:_,errors:{RUN_NOT_FOUND:{description:"The specified run does not exist",http:404,gqlCode:"RUN_NOT_FOUND",when:"Run ID is invalid"}}},policy:{auth:"user"},acceptance:{scenarios:[{key:"get-run-happy-path",given:["Run exists"],when:["User requests run by ID"],then:["Run details are returned"]}],examples:[{key:"get-with-steps",input:{runId:"run-456",includeSteps:!0,includeLogs:!1},output:{id:"run-456",status:"completed",steps:[]}}]}}),e=Y({meta:{key:"agent.run.list",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","list"],description:"Lists runs with optional filtering.",goal:"Browse and search run history.",context:"Run history/dashboard view."},io:{input:w({name:"ListRunsInput",fields:{organizationId:{type:g.String_unsecure(),isOptional:!0},agentId:{type:g.String_unsecure(),isOptional:!0},userId:{type:g.String_unsecure(),isOptional:!0},sessionId:{type:g.String_unsecure(),isOptional:!0},status:{type:k,isOptional:!0},startDate:{type:g.DateTime(),isOptional:!0},endDate:{type:g.DateTime(),isOptional:!0},limit:{type:g.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:g.Int_unsecure(),isOptional:!0,defaultValue:0}}}),output:w({name:"ListRunsOutput",fields:{items:{type:x,isArray:!0,isOptional:!1},total:{type:g.Int_unsecure(),isOptional:!1},hasMore:{type:g.Boolean(),isOptional:!1}}})},policy:{auth:"user"},acceptance:{scenarios:[{key:"list-runs-happy-path",given:["Organization has runs"],when:["User lists runs"],then:["Paginated list of runs is returned"]}],examples:[{key:"list-by-agent",input:{agentId:"agent-123",limit:20,offset:0},output:{items:[],total:0,hasMore:!1}}]}}),c=Y({meta:{key:"agent.run.getSteps",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","steps"],description:"Retrieves all steps for a specific run.",goal:"View step-by-step execution details.",context:"Run details page - steps tab."},io:{input:w({name:"GetRunStepsInput",fields:{runId:{type:g.String_unsecure(),isOptional:!1}}}),output:w({name:"GetRunStepsOutput",fields:{steps:{type:V,isArray:!0,isOptional:!1}}})},policy:{auth:"user"},acceptance:{scenarios:[{key:"get-run-steps-happy-path",given:["Run exists with steps"],when:["User requests steps"],then:["Steps list is returned"]}],examples:[{key:"get-steps-basic",input:{runId:"run-456"},output:{steps:[]}}]}}),y=Y({meta:{key:"agent.run.getLogs",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","logs"],description:"Retrieves all logs for a specific run.",goal:"Debug and audit run execution.",context:"Run details page - logs tab."},io:{input:w({name:"GetRunLogsInput",fields:{runId:{type:g.String_unsecure(),isOptional:!1},level:{type:G,isOptional:!0},stepId:{type:g.String_unsecure(),isOptional:!0},limit:{type:g.Int_unsecure(),isOptional:!0,defaultValue:100},offset:{type:g.Int_unsecure(),isOptional:!0,defaultValue:0}}}),output:w({name:"GetRunLogsOutput",fields:{items:{type:Q,isArray:!0,isOptional:!1},total:{type:g.Int_unsecure(),isOptional:!1},hasMore:{type:g.Boolean(),isOptional:!1}}})},policy:{auth:"user"},acceptance:{scenarios:[{key:"get-run-logs-happy-path",given:["Run exists with logs"],when:["User requests logs"],then:["Paginated logs list is returned"]}],examples:[{key:"get-logs-filtered",input:{runId:"run-456",level:"error",limit:50},output:{items:[],total:0,hasMore:!1}}]}}),E=Y({meta:{key:"agent.run.getMetrics",version:"1.0.0",stability:"stable",owners:[...v],tags:["run","metrics"],description:"Retrieves aggregated metrics for runs within a time period.",goal:"Monitor and analyze agent usage.",context:"Analytics dashboard."},io:{input:w({name:"GetRunMetricsInput",fields:{organizationId:{type:g.String_unsecure(),isOptional:!1},agentId:{type:g.String_unsecure(),isOptional:!0},startDate:{type:g.DateTime(),isOptional:!1},endDate:{type:g.DateTime(),isOptional:!1},granularity:{type:$,isOptional:!0,defaultValue:"day"}}}),output:w({name:"GetRunMetricsOutput",fields:{totalRuns:{type:g.Int_unsecure(),isOptional:!1},completedRuns:{type:g.Int_unsecure(),isOptional:!1},failedRuns:{type:g.Int_unsecure(),isOptional:!1},totalTokens:{type:g.Int_unsecure(),isOptional:!1},totalCostUsd:{type:g.Float_unsecure(),isOptional:!1},averageDurationMs:{type:g.Float_unsecure(),isOptional:!1},successRate:{type:g.Float_unsecure(),isOptional:!1},timeline:{type:K,isArray:!0,isOptional:!1}}})},policy:{auth:"user"},acceptance:{scenarios:[{key:"get-run-metrics-happy-path",given:["Organization has run history"],when:["User requests metrics for date range"],then:["Aggregated metrics are returned"]}],examples:[{key:"get-daily-metrics",input:{organizationId:"org-123",startDate:"2025-01-01",endDate:"2025-01-31",granularity:"day"},output:{totalRuns:100,completedRuns:90,failedRuns:10,totalTokens:50000,totalCostUsd:5,averageDurationMs:2500,successRate:0.9,timeline:[]}}]}});var B=[{id:"run-1",organizationId:"demo-org",projectId:"demo-project",agentId:"agent-1",agentName:"Customer Support Bot",userId:"user-1",sessionId:"session-1",input:{message:"How do I reset my password?",context:{}},output:{response:"You can reset your password by clicking..."},status:"COMPLETED",totalTokens:1250,promptTokens:800,completionTokens:450,totalIterations:3,durationMs:4500,estimatedCostUsd:0.0025,queuedAt:new Date("2024-04-15T10:00:00Z"),startedAt:new Date("2024-04-15T10:00:01Z"),completedAt:new Date("2024-04-15T10:00:05Z"),steps:[],logs:[]},{id:"run-2",organizationId:"demo-org",projectId:"demo-project",agentId:"agent-2",agentName:"Code Review Assistant",userId:"user-2",input:{message:"Review PR #123",context:{prNumber:123}},status:"IN_PROGRESS",totalTokens:3500,promptTokens:3000,completionTokens:500,totalIterations:5,queuedAt:new Date("2024-04-15T10:30:00Z"),startedAt:new Date("2024-04-15T10:30:02Z"),steps:[],logs:[]},{id:"run-3",organizationId:"demo-org",projectId:"demo-project",agentId:"agent-1",agentName:"Customer Support Bot",userId:"user-1",input:{message:"What are your business hours?"},output:{response:"Our business hours are 9 AM to 5 PM EST..."},status:"COMPLETED",totalTokens:800,promptTokens:500,completionTokens:300,totalIterations:2,durationMs:2100,estimatedCostUsd:0.0012,queuedAt:new Date("2024-04-15T09:00:00Z"),startedAt:new Date("2024-04-15T09:00:01Z"),completedAt:new Date("2024-04-15T09:00:03Z"),steps:[],logs:[]},{id:"run-4",organizationId:"demo-org",projectId:"demo-project",agentId:"agent-3",agentName:"Data Analyst",userId:"user-3",input:{message:"Generate sales report for Q1"},status:"FAILED",errorMessage:"Database connection timeout",errorCode:"DB_TIMEOUT",totalTokens:2000,promptTokens:1500,completionTokens:500,totalIterations:8,durationMs:45000,queuedAt:new Date("2024-04-14T15:00:00Z"),startedAt:new Date("2024-04-14T15:00:05Z"),completedAt:new Date("2024-04-14T15:00:50Z"),steps:[],logs:[]},{id:"run-5",organizationId:"demo-org",projectId:"demo-project",agentId:"agent-2",agentName:"Code Review Assistant",userId:"user-2",input:{message:"Review PR #120"},output:{response:"Code review complete. 3 suggestions..."},status:"COMPLETED",totalTokens:5200,promptTokens:4000,completionTokens:1200,totalIterations:7,durationMs:15000,estimatedCostUsd:0.0156,queuedAt:new Date("2024-04-14T11:00:00Z"),startedAt:new Date("2024-04-14T11:00:03Z"),completedAt:new Date("2024-04-14T11:00:18Z"),steps:[],logs:[]}];var a=B.length+1;async function l(Z){let{agentId:I,status:D,limit:H=20,offset:J=0}=Z,L=[...B];if(I)L=L.filter((A)=>A.agentId===I);if(D)L=L.filter((A)=>A.status===D);let i=L.length;return{items:L.slice(J,J+H).map((A)=>{let m=F.find((T)=>T.id===A.agentId);return{id:A.id,agentId:A.agentId,agentName:m?.name??"Unknown",status:A.status,totalTokens:A.totalTokens,durationMs:A.durationMs,estimatedCostUsd:A.estimatedCostUsd,queuedAt:A.queuedAt,completedAt:A.completedAt}}),total:i,hasMore:J+H<i}}async function S(Z){let I=B.find((H)=>H.id===Z.runId);if(!I)throw Error("RUN_NOT_FOUND");let D=F.find((H)=>H.id===I.agentId);return{...I,agent:D?{id:D.id,name:D.name,modelProvider:D.modelProvider,modelName:D.modelName}:void 0,steps:Z.includeSteps?I.steps:void 0,logs:Z.includeLogs?I.logs:void 0}}async function tt(Z){let I=F.find((D)=>D.id===Z.agentId);if(!I)throw Error("AGENT_NOT_FOUND");if(I.status!=="ACTIVE")throw Error("AGENT_NOT_ACTIVE");return{runId:`run-${a++}`,status:"QUEUED",estimatedWaitMs:500}}async function st(Z){let I=B.find((D)=>D.id===Z.runId);if(!I)throw Error("RUN_NOT_FOUND");if(!["QUEUED","IN_PROGRESS"].includes(I.status))throw Error("RUN_NOT_CANCELLABLE");return{success:!0,status:"CANCELLED"}}import{defineEntity as R,defineEntityEnum as N,field as o,index as P}from"@contractspec/lib.schema";var r=N({name:"RunStatus",values:["QUEUED","IN_PROGRESS","COMPLETED","FAILED","CANCELLED","EXPIRED"],description:"Status of an agent run"}),p=N({name:"RunStepType",values:["MESSAGE_CREATION","TOOL_CALL","TOOL_RESULT","ERROR"],description:"Type of run step"}),n=N({name:"LogLevel",values:["DEBUG","INFO","WARN","ERROR"],description:"Log level"}),ot=R({name:"Run",schema:"agent_console",description:"An execution of an agent with input/output and metrics.",fields:{id:o.id(),organizationId:o.string({description:"Organization ID"}),agentId:o.foreignKey({description:"Agent being executed"}),userId:o.string({isOptional:!0,description:"User who initiated the run"}),sessionId:o.string({isOptional:!0,description:"Conversation session ID"}),input:o.json({description:"Input data for the run"}),output:o.json({isOptional:!0,description:"Output result from the run"}),status:o.enum("RunStatus",{default:"QUEUED"}),errorMessage:o.string({isOptional:!0,description:"Error message if failed"}),errorCode:o.string({isOptional:!0,description:"Error code if failed"}),totalTokens:o.int({default:0,description:"Total tokens used"}),promptTokens:o.int({default:0,description:"Prompt tokens used"}),completionTokens:o.int({default:0,description:"Completion tokens used"}),totalIterations:o.int({default:0,description:"Number of iterations"}),durationMs:o.int({isOptional:!0,description:"Execution duration in ms"}),estimatedCostUsd:o.float({isOptional:!0,description:"Estimated cost in USD"}),queuedAt:o.dateTime({description:"When run was queued"}),startedAt:o.dateTime({isOptional:!0,description:"When run started executing"}),completedAt:o.dateTime({isOptional:!0,description:"When run completed"}),metadata:o.json({isOptional:!0,description:"Additional metadata"}),agent:o.belongsTo("Agent",["agentId"],["id"]),steps:o.hasMany("RunStep",{description:"Execution steps"}),logs:o.hasMany("RunLog",{description:"Execution logs"})},indexes:[P.on(["organizationId","agentId","queuedAt"]),P.on(["organizationId","status"]),P.on(["agentId","status"]),P.on(["sessionId"])],enums:[r]}),gt=R({name:"RunStep",schema:"agent_console",description:"An individual step in an agent run.",fields:{id:o.id(),runId:o.foreignKey({description:"Parent run"}),stepNumber:o.int({description:"Step sequence number"}),type:o.enum("RunStepType"),toolId:o.string({isOptional:!0,description:"Tool used in this step"}),toolName:o.string({isOptional:!0,description:"Tool name"}),input:o.json({isOptional:!0,description:"Step input"}),output:o.json({isOptional:!0,description:"Step output"}),status:o.enum("RunStatus"),errorMessage:o.string({isOptional:!0}),tokensUsed:o.int({default:0}),durationMs:o.int({isOptional:!0}),startedAt:o.dateTime(),completedAt:o.dateTime({isOptional:!0}),run:o.belongsTo("Run",["runId"],["id"])},indexes:[P.on(["runId","stepNumber"])],enums:[p]}),It=R({name:"RunLog",schema:"agent_console",description:"A log entry for an agent run.",fields:{id:o.id(),runId:o.foreignKey({description:"Parent run"}),stepId:o.string({isOptional:!0,description:"Related step"}),level:o.enum("LogLevel"),message:o.string({description:"Log message"}),data:o.json({isOptional:!0,description:"Additional log data"}),source:o.string({isOptional:!0,description:"Log source component"}),traceId:o.string({isOptional:!0}),spanId:o.string({isOptional:!0}),timestamp:o.dateTime(),run:o.belongsTo("Run",["runId"],["id"])},indexes:[P.on(["runId","timestamp"]),P.on(["runId","level"])],enums:[n]});import{defineEvent as j}from"@contractspec/lib.contracts-spec";import{defineEnum as At,defineSchemaModel as z,ScalarTypeEnum as t}from"@contractspec/lib.schema";var q=["@agent-console-team"],wt=z({name:"RunStartedPayload",description:"Payload for run started event",fields:{runId:{type:t.String_unsecure(),isOptional:!1},organizationId:{type:t.String_unsecure(),isOptional:!1},agentId:{type:t.String_unsecure(),isOptional:!1},agentName:{type:t.String_unsecure(),isOptional:!1},userId:{type:t.String_unsecure(),isOptional:!0},sessionId:{type:t.String_unsecure(),isOptional:!0},input:{type:t.JSONObject(),isOptional:!1},startedAt:{type:t.DateTime(),isOptional:!1}}}),Dt=j({meta:{key:"agent.run.started",version:"1.0.0",description:"An agent run was started.",stability:"stable",owners:[...q],tags:["run","started"]},payload:wt}),Zt=z({name:"RunCompletedPayload",description:"Payload for run completed event",fields:{runId:{type:t.String_unsecure(),isOptional:!1},organizationId:{type:t.String_unsecure(),isOptional:!1},agentId:{type:t.String_unsecure(),isOptional:!1},agentName:{type:t.String_unsecure(),isOptional:!1},userId:{type:t.String_unsecure(),isOptional:!0},output:{type:t.JSONObject(),isOptional:!1},totalTokens:{type:t.Int_unsecure(),isOptional:!1},promptTokens:{type:t.Int_unsecure(),isOptional:!1},completionTokens:{type:t.Int_unsecure(),isOptional:!1},totalIterations:{type:t.Int_unsecure(),isOptional:!1},durationMs:{type:t.Int_unsecure(),isOptional:!1},estimatedCostUsd:{type:t.Float_unsecure(),isOptional:!0},completedAt:{type:t.DateTime(),isOptional:!1}}}),kt=j({meta:{key:"agent.run.completed",version:"1.0.0",description:"An agent run completed successfully.",stability:"stable",owners:[...q],tags:["run","completed"]},payload:Zt}),vt=z({name:"RunFailedPayload",description:"Payload for run failed event",fields:{runId:{type:t.String_unsecure(),isOptional:!1},organizationId:{type:t.String_unsecure(),isOptional:!1},agentId:{type:t.String_unsecure(),isOptional:!1},agentName:{type:t.String_unsecure(),isOptional:!1},userId:{type:t.String_unsecure(),isOptional:!0},errorMessage:{type:t.String_unsecure(),isOptional:!1},errorCode:{type:t.String_unsecure(),isOptional:!0},totalTokens:{type:t.Int_unsecure(),isOptional:!1},totalIterations:{type:t.Int_unsecure(),isOptional:!1},durationMs:{type:t.Int_unsecure(),isOptional:!0},failedAt:{type:t.DateTime(),isOptional:!1}}}),Ct=j({meta:{key:"agent.run.failed",version:"1.0.0",description:"An agent run encountered an error.",stability:"stable",owners:[...q],tags:["run","failed"]},payload:vt}),xt=z({name:"RunCancelledPayload",description:"Payload for run cancelled event",fields:{runId:{type:t.String_unsecure(),isOptional:!1},organizationId:{type:t.String_unsecure(),isOptional:!1},agentId:{type:t.String_unsecure(),isOptional:!1},userId:{type:t.String_unsecure(),isOptional:!0},cancelledBy:{type:t.String_unsecure(),isOptional:!0},reason:{type:t.String_unsecure(),isOptional:!0},totalTokens:{type:t.Int_unsecure(),isOptional:!1},totalIterations:{type:t.Int_unsecure(),isOptional:!1},cancelledAt:{type:t.DateTime(),isOptional:!1}}}),Pt=j({meta:{key:"agent.run.cancelled",version:"1.0.0",description:"An agent run was cancelled by the user.",stability:"stable",owners:[...q],tags:["run","cancelled"]},payload:xt}),jt=z({name:"ToolInvokedPayload",description:"Payload for tool invoked event",fields:{runId:{type:t.String_unsecure(),isOptional:!1},stepId:{type:t.String_unsecure(),isOptional:!1},toolId:{type:t.String_unsecure(),isOptional:!1},toolName:{type:t.String_unsecure(),isOptional:!1},input:{type:t.JSONObject(),isOptional:!1},invokedAt:{type:t.DateTime(),isOptional:!1}}}),zt=j({meta:{key:"agent.run.toolInvoked",version:"1.0.0",description:"A tool was invoked during an agent run.",stability:"stable",owners:[...q],tags:["run","tool","invoked"]},payload:jt}),qt=z({name:"ToolCompletedPayload",description:"Payload for tool completed event",fields:{runId:{type:t.String_unsecure(),isOptional:!1},stepId:{type:t.String_unsecure(),isOptional:!1},toolId:{type:t.String_unsecure(),isOptional:!1},toolName:{type:t.String_unsecure(),isOptional:!1},success:{type:t.Boolean(),isOptional:!1},output:{type:t.JSONObject(),isOptional:!0},errorMessage:{type:t.String_unsecure(),isOptional:!0},durationMs:{type:t.Int_unsecure(),isOptional:!1},completedAt:{type:t.DateTime(),isOptional:!1}}}),Ht=j({meta:{key:"agent.run.toolCompleted",version:"1.0.0",description:"A tool invocation completed during an agent run.",stability:"stable",owners:[...q],tags:["run","tool","completed"]},payload:qt}),Lt=At("MessageType",["assistant","system"]),Gt=z({name:"MessageGeneratedPayload",description:"Payload for message generated event",fields:{runId:{type:t.String_unsecure(),isOptional:!1},stepId:{type:t.String_unsecure(),isOptional:!1},messageType:{type:Lt,isOptional:!1},content:{type:t.String_unsecure(),isOptional:!1},tokensUsed:{type:t.Int_unsecure(),isOptional:!1},generatedAt:{type:t.DateTime(),isOptional:!1}}}),Yt=j({meta:{key:"agent.run.messageGenerated",version:"1.0.0",description:"An agent generated a message during a run.",stability:"stable",owners:[...q],tags:["run","message","generated"]},payload:Gt});import{definePresentation as f,StabilityEnum as u}from"@contractspec/lib.contracts-spec";var Bt=f({meta:{key:"agent-console.run.list",version:"1.0.0",title:"Run List",description:"List view of agent runs with status, tokens, and duration info",goal:"Provide an overview of agent execution history and performance.",context:"Run history dashboard.",domain:"agent-console",owners:["@agent-console-team"],tags:["run","list","dashboard"],stability:u.Experimental},source:{type:"component",framework:"react",componentKey:"RunListView",props:x},targets:["react","markdown","application/json"],policy:{flags:["agent-console.enabled"]}}),Ft=f({meta:{key:"agent-console.run.detail",version:"1.0.0",title:"Run Details",description:"Detailed view of an agent run with steps, logs, and metrics",goal:"Allow users to inspect and debug a specific agent run.",context:"Detailed view of an agent run.",domain:"agent-console",owners:["@agent-console-team"],tags:["run","detail"],stability:u.Experimental},source:{type:"component",framework:"react",componentKey:"RunDetailView"},targets:["react","markdown"],policy:{flags:["agent-console.enabled"]}});export{l as mockListRunsHandler,S as mockGetRunHandler,tt as mockExecuteAgentHandler,st as mockCancelRunHandler,zt as ToolInvokedEvent,Ht as ToolCompletedEvent,K as TimelineDataPointModel,x as RunSummaryModel,X as RunStepTypeEnum,p as RunStepTypeEntityEnum,V as RunStepModel,gt as RunStepEntity,k as RunStatusEnum,r as RunStatusEntityEnum,Dt as RunStartedEvent,_ as RunModel,Q as RunLogModel,It as RunLogEntity,Bt as RunListPresentation,b as RunInputModel,Ct as RunFailedEvent,ot as RunEntity,Ft as RunDetailPresentation,kt as RunCompletedEvent,Pt as RunCancelledEvent,O as RunAgentRefModel,Yt as MessageGeneratedEvent,G as LogLevelEnum,n as LogLevelEntityEnum,e as ListRunsQuery,$ as GranularityEnum,c as GetRunStepsQuery,M as GetRunQuery,E as GetRunMetricsQuery,y as GetRunLogsQuery,W as ExecuteAgentCommand,h as CancelRunCommand};
|