@contractspec/example.agent-console 3.8.8 → 3.8.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/.turbo/turbo-build.log +225 -222
  2. package/CHANGELOG.md +34 -0
  3. package/dist/agent/agent.entity.js +1 -127
  4. package/dist/agent/agent.enum.js +1 -25
  5. package/dist/agent/agent.event.js +1 -116
  6. package/dist/agent/agent.handler.js +1 -1030
  7. package/dist/agent/agent.operation.js +1 -735
  8. package/dist/agent/agent.presentation.js +1 -282
  9. package/dist/agent/agent.schema.js +1 -215
  10. package/dist/agent/agent.test-spec.js +1 -58
  11. package/dist/agent/index.js +1 -1248
  12. package/dist/agent.capability.js +1 -19
  13. package/dist/agent.feature.js +1 -305
  14. package/dist/browser/agent/agent.entity.js +1 -127
  15. package/dist/browser/agent/agent.enum.js +1 -25
  16. package/dist/browser/agent/agent.event.js +1 -116
  17. package/dist/browser/agent/agent.handler.js +1 -1030
  18. package/dist/browser/agent/agent.operation.js +1 -735
  19. package/dist/browser/agent/agent.presentation.js +1 -282
  20. package/dist/browser/agent/agent.schema.js +1 -215
  21. package/dist/browser/agent/agent.test-spec.js +1 -58
  22. package/dist/browser/agent/index.js +1 -1248
  23. package/dist/browser/agent.capability.js +1 -19
  24. package/dist/browser/agent.feature.js +1 -305
  25. package/dist/browser/docs/agent-console.docblock.js +5 -49
  26. package/dist/browser/docs/index.js +5 -49
  27. package/dist/browser/example.js +1 -41
  28. package/dist/browser/handlers/agent.handlers.js +6 -2143
  29. package/dist/browser/handlers/index.js +6 -2943
  30. package/dist/browser/index.js +14 -6828
  31. package/dist/browser/presentations/index.js +1 -693
  32. package/dist/browser/run/index.js +1 -1363
  33. package/dist/browser/run/run.entity.js +1 -160
  34. package/dist/browser/run/run.enum.js +1 -34
  35. package/dist/browser/run/run.event.js +1 -217
  36. package/dist/browser/run/run.handler.js +1 -919
  37. package/dist/browser/run/run.operation.js +1 -667
  38. package/dist/browser/run/run.presentation.js +1 -223
  39. package/dist/browser/run/run.schema.js +1 -179
  40. package/dist/browser/run/run.test-spec.js +1 -58
  41. package/dist/browser/seeders/index.js +2 -21
  42. package/dist/browser/shared/index.js +1 -626
  43. package/dist/browser/shared/mock-agents.js +1 -82
  44. package/dist/browser/shared/mock-runs.js +1 -113
  45. package/dist/browser/shared/mock-tools.js +1 -146
  46. package/dist/browser/tool/index.js +1 -949
  47. package/dist/browser/tool/tool.entity.js +1 -90
  48. package/dist/browser/tool/tool.enum.js +1 -26
  49. package/dist/browser/tool/tool.event.js +1 -99
  50. package/dist/browser/tool/tool.handler.js +1 -699
  51. package/dist/browser/tool/tool.operation.js +1 -482
  52. package/dist/browser/tool/tool.presentation.js +1 -188
  53. package/dist/browser/tool/tool.schema.js +1 -141
  54. package/dist/browser/tool/tool.test-spec.js +1 -58
  55. package/dist/browser/ui/AgentDashboard.js +1 -2527
  56. package/dist/browser/ui/AgentDashboard.visualizations.js +1 -217
  57. package/dist/browser/ui/AgentRunList.js +1 -482
  58. package/dist/browser/ui/AgentToolRegistry.js +1 -212
  59. package/dist/browser/ui/ExecutionConsoleHost.js +1 -0
  60. package/dist/browser/ui/hooks/index.js +1 -740
  61. package/dist/browser/ui/hooks/useAgentList.js +1 -55
  62. package/dist/browser/ui/hooks/useAgentMutations.js +1 -530
  63. package/dist/browser/ui/hooks/useRunList.js +1 -70
  64. package/dist/browser/ui/hooks/useToolList.js +1 -85
  65. package/dist/browser/ui/index.js +5 -3018
  66. package/dist/browser/ui/modals/AgentActionsModal.js +1 -304
  67. package/dist/browser/ui/modals/CreateAgentModal.js +1 -243
  68. package/dist/browser/ui/modals/index.js +1 -546
  69. package/dist/browser/ui/overlays/demo-overlays.js +1 -64
  70. package/dist/browser/ui/overlays/index.js +1 -64
  71. package/dist/browser/ui/renderers/agent-list.markdown.js +2 -64
  72. package/dist/browser/ui/renderers/agent-list.renderer.js +1 -180
  73. package/dist/browser/ui/renderers/dashboard.markdown.js +2 -288
  74. package/dist/browser/ui/renderers/index.js +5 -642
  75. package/dist/browser/ui/renderers/run-list.markdown.js +2 -50
  76. package/dist/browser/ui/renderers/tool-registry.markdown.js +2 -64
  77. package/dist/browser/ui/views/AgentListView.js +1 -165
  78. package/dist/browser/ui/views/RunDataTable.js +1 -326
  79. package/dist/browser/ui/views/RunListView.js +1 -479
  80. package/dist/browser/ui/views/ToolRegistryView.js +1 -209
  81. package/dist/browser/ui/views/index.js +1 -851
  82. package/dist/browser/ui/views/run-data-table.columns.js +1 -271
  83. package/dist/browser/ui/views/run-list.shared.js +1 -177
  84. package/dist/browser/visualizations/catalog.js +1 -134
  85. package/dist/browser/visualizations/index.js +1 -187
  86. package/dist/browser/visualizations/selectors.js +1 -181
  87. package/dist/docs/agent-console.docblock.js +5 -49
  88. package/dist/docs/index.js +5 -49
  89. package/dist/example.js +1 -41
  90. package/dist/handlers/agent.handlers.js +6 -2143
  91. package/dist/handlers/index.js +6 -2943
  92. package/dist/index.js +14 -6828
  93. package/dist/node/agent/agent.entity.js +1 -127
  94. package/dist/node/agent/agent.enum.js +1 -25
  95. package/dist/node/agent/agent.event.js +1 -116
  96. package/dist/node/agent/agent.handler.js +1 -1030
  97. package/dist/node/agent/agent.operation.js +1 -735
  98. package/dist/node/agent/agent.presentation.js +1 -282
  99. package/dist/node/agent/agent.schema.js +1 -215
  100. package/dist/node/agent/agent.test-spec.js +1 -58
  101. package/dist/node/agent/index.js +1 -1248
  102. package/dist/node/agent.capability.js +1 -19
  103. package/dist/node/agent.feature.js +1 -305
  104. package/dist/node/docs/agent-console.docblock.js +5 -49
  105. package/dist/node/docs/index.js +5 -49
  106. package/dist/node/example.js +1 -41
  107. package/dist/node/handlers/agent.handlers.js +6 -2143
  108. package/dist/node/handlers/index.js +6 -2943
  109. package/dist/node/index.js +14 -6828
  110. package/dist/node/presentations/index.js +1 -693
  111. package/dist/node/run/index.js +1 -1363
  112. package/dist/node/run/run.entity.js +1 -160
  113. package/dist/node/run/run.enum.js +1 -34
  114. package/dist/node/run/run.event.js +1 -217
  115. package/dist/node/run/run.handler.js +1 -919
  116. package/dist/node/run/run.operation.js +1 -667
  117. package/dist/node/run/run.presentation.js +1 -223
  118. package/dist/node/run/run.schema.js +1 -179
  119. package/dist/node/run/run.test-spec.js +1 -58
  120. package/dist/node/seeders/index.js +2 -21
  121. package/dist/node/shared/index.js +1 -626
  122. package/dist/node/shared/mock-agents.js +1 -82
  123. package/dist/node/shared/mock-runs.js +1 -113
  124. package/dist/node/shared/mock-tools.js +1 -146
  125. package/dist/node/tool/index.js +1 -949
  126. package/dist/node/tool/tool.entity.js +1 -90
  127. package/dist/node/tool/tool.enum.js +1 -26
  128. package/dist/node/tool/tool.event.js +1 -99
  129. package/dist/node/tool/tool.handler.js +1 -699
  130. package/dist/node/tool/tool.operation.js +1 -482
  131. package/dist/node/tool/tool.presentation.js +1 -188
  132. package/dist/node/tool/tool.schema.js +1 -141
  133. package/dist/node/tool/tool.test-spec.js +1 -58
  134. package/dist/node/ui/AgentDashboard.js +1 -2527
  135. package/dist/node/ui/AgentDashboard.visualizations.js +1 -217
  136. package/dist/node/ui/AgentRunList.js +1 -482
  137. package/dist/node/ui/AgentToolRegistry.js +1 -212
  138. package/dist/node/ui/ExecutionConsoleHost.js +1 -0
  139. package/dist/node/ui/hooks/index.js +1 -740
  140. package/dist/node/ui/hooks/useAgentList.js +1 -55
  141. package/dist/node/ui/hooks/useAgentMutations.js +1 -530
  142. package/dist/node/ui/hooks/useRunList.js +1 -70
  143. package/dist/node/ui/hooks/useToolList.js +1 -85
  144. package/dist/node/ui/index.js +5 -3018
  145. package/dist/node/ui/modals/AgentActionsModal.js +1 -304
  146. package/dist/node/ui/modals/CreateAgentModal.js +1 -243
  147. package/dist/node/ui/modals/index.js +1 -546
  148. package/dist/node/ui/overlays/demo-overlays.js +1 -64
  149. package/dist/node/ui/overlays/index.js +1 -64
  150. package/dist/node/ui/renderers/agent-list.markdown.js +2 -64
  151. package/dist/node/ui/renderers/agent-list.renderer.js +1 -180
  152. package/dist/node/ui/renderers/dashboard.markdown.js +2 -288
  153. package/dist/node/ui/renderers/index.js +5 -642
  154. package/dist/node/ui/renderers/run-list.markdown.js +2 -50
  155. package/dist/node/ui/renderers/tool-registry.markdown.js +2 -64
  156. package/dist/node/ui/views/AgentListView.js +1 -165
  157. package/dist/node/ui/views/RunDataTable.js +1 -326
  158. package/dist/node/ui/views/RunListView.js +1 -479
  159. package/dist/node/ui/views/ToolRegistryView.js +1 -209
  160. package/dist/node/ui/views/index.js +1 -851
  161. package/dist/node/ui/views/run-data-table.columns.js +1 -271
  162. package/dist/node/ui/views/run-list.shared.js +1 -177
  163. package/dist/node/visualizations/catalog.js +1 -134
  164. package/dist/node/visualizations/index.js +1 -187
  165. package/dist/node/visualizations/selectors.js +1 -181
  166. package/dist/presentations/index.js +1 -693
  167. package/dist/run/index.js +1 -1363
  168. package/dist/run/run.entity.js +1 -160
  169. package/dist/run/run.enum.js +1 -34
  170. package/dist/run/run.event.js +1 -217
  171. package/dist/run/run.handler.js +1 -919
  172. package/dist/run/run.operation.js +1 -667
  173. package/dist/run/run.presentation.js +1 -223
  174. package/dist/run/run.schema.js +1 -179
  175. package/dist/run/run.test-spec.js +1 -58
  176. package/dist/seeders/index.js +2 -21
  177. package/dist/shared/index.js +1 -626
  178. package/dist/shared/mock-agents.js +1 -82
  179. package/dist/shared/mock-runs.js +1 -113
  180. package/dist/shared/mock-tools.js +1 -146
  181. package/dist/tool/index.js +1 -949
  182. package/dist/tool/tool.entity.js +1 -90
  183. package/dist/tool/tool.enum.js +1 -26
  184. package/dist/tool/tool.event.js +1 -99
  185. package/dist/tool/tool.handler.js +1 -699
  186. package/dist/tool/tool.operation.js +1 -482
  187. package/dist/tool/tool.presentation.js +1 -188
  188. package/dist/tool/tool.schema.js +1 -141
  189. package/dist/tool/tool.test-spec.js +1 -58
  190. package/dist/ui/AgentDashboard.js +1 -2527
  191. package/dist/ui/AgentDashboard.visualizations.js +1 -217
  192. package/dist/ui/AgentRunList.js +1 -482
  193. package/dist/ui/AgentToolRegistry.js +1 -212
  194. package/dist/ui/ExecutionConsoleHost.d.ts +1 -0
  195. package/dist/ui/ExecutionConsoleHost.js +2 -0
  196. package/dist/ui/ExecutionConsoleHost.test.d.ts +1 -0
  197. package/dist/ui/hooks/index.js +1 -740
  198. package/dist/ui/hooks/useAgentList.js +1 -55
  199. package/dist/ui/hooks/useAgentMutations.js +1 -530
  200. package/dist/ui/hooks/useRunList.js +1 -70
  201. package/dist/ui/hooks/useToolList.js +1 -85
  202. package/dist/ui/index.d.ts +1 -0
  203. package/dist/ui/index.js +5 -3018
  204. package/dist/ui/modals/AgentActionsModal.js +1 -304
  205. package/dist/ui/modals/CreateAgentModal.js +1 -243
  206. package/dist/ui/modals/index.js +1 -546
  207. package/dist/ui/overlays/demo-overlays.js +1 -64
  208. package/dist/ui/overlays/index.js +1 -64
  209. package/dist/ui/renderers/agent-list.markdown.js +2 -64
  210. package/dist/ui/renderers/agent-list.renderer.js +1 -180
  211. package/dist/ui/renderers/dashboard.markdown.js +2 -288
  212. package/dist/ui/renderers/index.js +5 -642
  213. package/dist/ui/renderers/run-list.markdown.js +2 -50
  214. package/dist/ui/renderers/tool-registry.markdown.js +2 -64
  215. package/dist/ui/views/AgentListView.js +1 -165
  216. package/dist/ui/views/RunDataTable.js +1 -326
  217. package/dist/ui/views/RunListView.js +1 -479
  218. package/dist/ui/views/ToolRegistryView.js +1 -209
  219. package/dist/ui/views/index.js +1 -851
  220. package/dist/ui/views/run-data-table.columns.js +1 -271
  221. package/dist/ui/views/run-list.shared.js +1 -177
  222. package/dist/visualizations/catalog.js +1 -134
  223. package/dist/visualizations/index.js +1 -187
  224. package/dist/visualizations/selectors.js +1 -181
  225. package/package.json +29 -13
  226. package/src/ui/ExecutionConsoleHost.test.tsx +110 -0
  227. package/src/ui/ExecutionConsoleHost.tsx +14 -0
  228. package/src/ui/index.ts +1 -1
@@ -1,667 +1 @@
1
- // src/run/run.enum.ts
2
- import { defineEnum } from "@contractspec/lib.schema";
3
- var RunStatusEnum = defineEnum("RunStatus", [
4
- "QUEUED",
5
- "IN_PROGRESS",
6
- "COMPLETED",
7
- "FAILED",
8
- "CANCELLED",
9
- "EXPIRED"
10
- ]);
11
- var RunStepTypeEnum = defineEnum("RunStepType", [
12
- "MESSAGE_CREATION",
13
- "TOOL_CALL",
14
- "TOOL_RESULT",
15
- "ERROR"
16
- ]);
17
- var LogLevelEnum = defineEnum("LogLevel", [
18
- "DEBUG",
19
- "INFO",
20
- "WARN",
21
- "ERROR"
22
- ]);
23
- var GranularityEnum = defineEnum("Granularity", [
24
- "hour",
25
- "day",
26
- "week",
27
- "month"
28
- ]);
29
-
30
- // src/run/run.schema.ts
31
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
32
- var RunInputModel = defineSchemaModel({
33
- name: "RunInput",
34
- description: "Input data for agent execution",
35
- fields: {
36
- message: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
37
- context: { type: ScalarTypeEnum.JSONObject(), isOptional: true }
38
- }
39
- });
40
- var RunStepModel = defineSchemaModel({
41
- name: "RunStep",
42
- description: "Individual step within a run",
43
- fields: {
44
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
45
- stepNumber: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
46
- type: { type: RunStepTypeEnum, isOptional: false },
47
- toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
48
- toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
49
- input: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
50
- output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
51
- status: { type: RunStatusEnum, isOptional: false },
52
- errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
53
- tokensUsed: {
54
- type: ScalarTypeEnum.Int_unsecure(),
55
- isOptional: false,
56
- defaultValue: 0
57
- },
58
- durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
59
- startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
60
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
61
- }
62
- });
63
- var RunLogModel = defineSchemaModel({
64
- name: "RunLog",
65
- description: "Execution log entry",
66
- fields: {
67
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
68
- stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
69
- level: { type: LogLevelEnum, isOptional: false },
70
- message: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
71
- data: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
72
- source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
73
- traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
74
- spanId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
75
- timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
76
- }
77
- });
78
- var RunAgentRefModel = defineSchemaModel({
79
- name: "RunAgentRef",
80
- description: "Agent reference in a run",
81
- fields: {
82
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
83
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
84
- modelProvider: {
85
- type: ScalarTypeEnum.String_unsecure(),
86
- isOptional: false
87
- },
88
- modelName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
89
- }
90
- });
91
- var RunModel = defineSchemaModel({
92
- name: "Run",
93
- description: "Agent execution instance",
94
- fields: {
95
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
96
- organizationId: {
97
- type: ScalarTypeEnum.String_unsecure(),
98
- isOptional: false
99
- },
100
- agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
101
- userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
102
- sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
103
- input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
104
- output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
105
- status: { type: RunStatusEnum, isOptional: false },
106
- errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
107
- errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
108
- totalTokens: {
109
- type: ScalarTypeEnum.Int_unsecure(),
110
- isOptional: false,
111
- defaultValue: 0
112
- },
113
- promptTokens: {
114
- type: ScalarTypeEnum.Int_unsecure(),
115
- isOptional: false,
116
- defaultValue: 0
117
- },
118
- completionTokens: {
119
- type: ScalarTypeEnum.Int_unsecure(),
120
- isOptional: false,
121
- defaultValue: 0
122
- },
123
- totalIterations: {
124
- type: ScalarTypeEnum.Int_unsecure(),
125
- isOptional: false,
126
- defaultValue: 0
127
- },
128
- durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
129
- estimatedCostUsd: {
130
- type: ScalarTypeEnum.Float_unsecure(),
131
- isOptional: true
132
- },
133
- queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
134
- startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
135
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
136
- metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
137
- steps: { type: RunStepModel, isArray: true, isOptional: true },
138
- logs: { type: RunLogModel, isArray: true, isOptional: true },
139
- agent: { type: RunAgentRefModel, isOptional: true }
140
- }
141
- });
142
- var RunSummaryModel = defineSchemaModel({
143
- name: "RunSummary",
144
- description: "Summary of a run for list views",
145
- fields: {
146
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
147
- agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
148
- agentName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
149
- status: { type: RunStatusEnum, isOptional: false },
150
- totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
151
- durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
152
- estimatedCostUsd: {
153
- type: ScalarTypeEnum.Float_unsecure(),
154
- isOptional: true
155
- },
156
- queuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
157
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
158
- }
159
- });
160
- var TimelineDataPointModel = defineSchemaModel({
161
- name: "TimelineDataPoint",
162
- description: "Timeline data point for metrics",
163
- fields: {
164
- period: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
165
- runs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
166
- tokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
167
- costUsd: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
168
- avgDurationMs: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
169
- }
170
- });
171
-
172
- // src/run/run.operation.ts
173
- import {
174
- defineCommand,
175
- defineQuery
176
- } from "@contractspec/lib.contracts-spec/operations";
177
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
178
- var OWNERS = ["@agent-console-team"];
179
- var ExecuteAgentCommand = defineCommand({
180
- meta: {
181
- key: "agent.run.execute",
182
- version: "1.0.0",
183
- stability: "stable",
184
- owners: [...OWNERS],
185
- tags: ["run", "execute"],
186
- description: "Starts a new agent run with the given input.",
187
- goal: "Execute an AI agent with user input.",
188
- context: "Called from chat interface or API."
189
- },
190
- io: {
191
- input: defineSchemaModel2({
192
- name: "ExecuteAgentInput",
193
- fields: {
194
- agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
195
- input: { type: RunInputModel, isOptional: false },
196
- sessionId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
197
- metadata: { type: ScalarTypeEnum2.JSONObject(), isOptional: true },
198
- stream: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
199
- maxIterations: {
200
- type: ScalarTypeEnum2.Int_unsecure(),
201
- isOptional: true
202
- },
203
- timeoutMs: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true }
204
- }
205
- }),
206
- output: defineSchemaModel2({
207
- name: "ExecuteAgentOutput",
208
- fields: {
209
- runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
210
- status: { type: RunStatusEnum, isOptional: false },
211
- estimatedWaitMs: {
212
- type: ScalarTypeEnum2.Int_unsecure(),
213
- isOptional: true
214
- }
215
- }
216
- }),
217
- errors: {
218
- AGENT_NOT_FOUND: {
219
- description: "The specified agent does not exist",
220
- http: 404,
221
- gqlCode: "AGENT_NOT_FOUND",
222
- when: "Agent ID is invalid"
223
- },
224
- AGENT_NOT_ACTIVE: {
225
- description: "The specified agent is not active",
226
- http: 400,
227
- gqlCode: "AGENT_NOT_ACTIVE",
228
- when: "Agent is in draft/paused/archived state"
229
- }
230
- }
231
- },
232
- policy: { auth: "user" },
233
- sideEffects: {
234
- emits: [
235
- {
236
- key: "run.started",
237
- version: "1.0.0",
238
- stability: "stable",
239
- owners: [...OWNERS],
240
- tags: ["run", "started"],
241
- when: "Run is queued",
242
- payload: RunSummaryModel
243
- }
244
- ],
245
- audit: ["run.started"]
246
- },
247
- acceptance: {
248
- scenarios: [
249
- {
250
- key: "execute-agent-happy-path",
251
- given: ["Agent exists", "Agent is active"],
252
- when: ["User submits execution request"],
253
- then: ["Run is created", "RunStarted event is emitted"]
254
- },
255
- {
256
- key: "execute-agent-not-active",
257
- given: ["Agent exists but is not active"],
258
- when: ["User attempts to execute"],
259
- then: ["AGENT_NOT_ACTIVE error is returned"]
260
- }
261
- ],
262
- examples: [
263
- {
264
- key: "basic-execute",
265
- input: { agentId: "agent-123", input: { message: "Hello" } },
266
- output: { runId: "run-456", status: "pending", estimatedWaitMs: 5000 }
267
- }
268
- ]
269
- }
270
- });
271
- var CancelRunCommand = defineCommand({
272
- meta: {
273
- key: "agent.run.cancel",
274
- version: "1.0.0",
275
- stability: "stable",
276
- owners: [...OWNERS],
277
- tags: ["run", "cancel"],
278
- description: "Cancels an in-progress agent run.",
279
- goal: "Stop a running agent execution.",
280
- context: "Called when user wants to abort a long-running task."
281
- },
282
- io: {
283
- input: defineSchemaModel2({
284
- name: "CancelRunInput",
285
- fields: {
286
- runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
287
- reason: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
288
- }
289
- }),
290
- output: defineSchemaModel2({
291
- name: "CancelRunOutput",
292
- fields: {
293
- success: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
294
- status: { type: RunStatusEnum, isOptional: false }
295
- }
296
- }),
297
- errors: {
298
- RUN_NOT_FOUND: {
299
- description: "The specified run does not exist",
300
- http: 404,
301
- gqlCode: "RUN_NOT_FOUND",
302
- when: "Run ID is invalid"
303
- },
304
- RUN_NOT_CANCELLABLE: {
305
- description: "The run cannot be cancelled",
306
- http: 400,
307
- gqlCode: "RUN_NOT_CANCELLABLE",
308
- when: "Run is already completed/failed/cancelled"
309
- }
310
- }
311
- },
312
- policy: { auth: "user" },
313
- sideEffects: {
314
- emits: [
315
- {
316
- key: "run.cancelled",
317
- version: "1.0.0",
318
- stability: "stable",
319
- owners: [...OWNERS],
320
- tags: ["run", "cancelled"],
321
- when: "Run is cancelled",
322
- payload: RunSummaryModel
323
- }
324
- ],
325
- audit: ["run.cancelled"]
326
- },
327
- acceptance: {
328
- scenarios: [
329
- {
330
- key: "cancel-run-happy-path",
331
- given: ["Run exists", "Run is in progress"],
332
- when: ["User cancels run"],
333
- then: ["Run is cancelled", "RunCancelled event is emitted"]
334
- },
335
- {
336
- key: "cancel-run-already-completed",
337
- given: ["Run exists but is already completed"],
338
- when: ["User attempts to cancel"],
339
- then: ["RUN_NOT_CANCELLABLE error is returned"]
340
- }
341
- ],
342
- examples: [
343
- {
344
- key: "cancel-basic",
345
- input: { runId: "run-456", reason: "User requested" },
346
- output: { success: true, status: "cancelled" }
347
- }
348
- ]
349
- }
350
- });
351
- var GetRunQuery = defineQuery({
352
- meta: {
353
- key: "agent.run.get",
354
- version: "1.0.0",
355
- stability: "stable",
356
- owners: [...OWNERS],
357
- tags: ["run", "get"],
358
- description: "Retrieves a run by its ID with optional details.",
359
- goal: "View detailed run information.",
360
- context: "Run details page or monitoring."
361
- },
362
- io: {
363
- input: defineSchemaModel2({
364
- name: "GetRunInput",
365
- fields: {
366
- runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
367
- includeSteps: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
368
- includeLogs: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
369
- }
370
- }),
371
- output: RunModel,
372
- errors: {
373
- RUN_NOT_FOUND: {
374
- description: "The specified run does not exist",
375
- http: 404,
376
- gqlCode: "RUN_NOT_FOUND",
377
- when: "Run ID is invalid"
378
- }
379
- }
380
- },
381
- policy: { auth: "user" },
382
- acceptance: {
383
- scenarios: [
384
- {
385
- key: "get-run-happy-path",
386
- given: ["Run exists"],
387
- when: ["User requests run by ID"],
388
- then: ["Run details are returned"]
389
- }
390
- ],
391
- examples: [
392
- {
393
- key: "get-with-steps",
394
- input: { runId: "run-456", includeSteps: true, includeLogs: false },
395
- output: { id: "run-456", status: "completed", steps: [] }
396
- }
397
- ]
398
- }
399
- });
400
- var ListRunsQuery = defineQuery({
401
- meta: {
402
- key: "agent.run.list",
403
- version: "1.0.0",
404
- stability: "stable",
405
- owners: [...OWNERS],
406
- tags: ["run", "list"],
407
- description: "Lists runs with optional filtering.",
408
- goal: "Browse and search run history.",
409
- context: "Run history/dashboard view."
410
- },
411
- io: {
412
- input: defineSchemaModel2({
413
- name: "ListRunsInput",
414
- fields: {
415
- organizationId: {
416
- type: ScalarTypeEnum2.String_unsecure(),
417
- isOptional: true
418
- },
419
- agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
420
- userId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
421
- sessionId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
422
- status: { type: RunStatusEnum, isOptional: true },
423
- startDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
424
- endDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
425
- limit: {
426
- type: ScalarTypeEnum2.Int_unsecure(),
427
- isOptional: true,
428
- defaultValue: 20
429
- },
430
- offset: {
431
- type: ScalarTypeEnum2.Int_unsecure(),
432
- isOptional: true,
433
- defaultValue: 0
434
- }
435
- }
436
- }),
437
- output: defineSchemaModel2({
438
- name: "ListRunsOutput",
439
- fields: {
440
- items: { type: RunSummaryModel, isArray: true, isOptional: false },
441
- total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
442
- hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
443
- }
444
- })
445
- },
446
- policy: { auth: "user" },
447
- acceptance: {
448
- scenarios: [
449
- {
450
- key: "list-runs-happy-path",
451
- given: ["Organization has runs"],
452
- when: ["User lists runs"],
453
- then: ["Paginated list of runs is returned"]
454
- }
455
- ],
456
- examples: [
457
- {
458
- key: "list-by-agent",
459
- input: { agentId: "agent-123", limit: 20, offset: 0 },
460
- output: { items: [], total: 0, hasMore: false }
461
- }
462
- ]
463
- }
464
- });
465
- var GetRunStepsQuery = defineQuery({
466
- meta: {
467
- key: "agent.run.getSteps",
468
- version: "1.0.0",
469
- stability: "stable",
470
- owners: [...OWNERS],
471
- tags: ["run", "steps"],
472
- description: "Retrieves all steps for a specific run.",
473
- goal: "View step-by-step execution details.",
474
- context: "Run details page - steps tab."
475
- },
476
- io: {
477
- input: defineSchemaModel2({
478
- name: "GetRunStepsInput",
479
- fields: {
480
- runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
481
- }
482
- }),
483
- output: defineSchemaModel2({
484
- name: "GetRunStepsOutput",
485
- fields: {
486
- steps: { type: RunStepModel, isArray: true, isOptional: false }
487
- }
488
- })
489
- },
490
- policy: { auth: "user" },
491
- acceptance: {
492
- scenarios: [
493
- {
494
- key: "get-run-steps-happy-path",
495
- given: ["Run exists with steps"],
496
- when: ["User requests steps"],
497
- then: ["Steps list is returned"]
498
- }
499
- ],
500
- examples: [
501
- {
502
- key: "get-steps-basic",
503
- input: { runId: "run-456" },
504
- output: { steps: [] }
505
- }
506
- ]
507
- }
508
- });
509
- var GetRunLogsQuery = defineQuery({
510
- meta: {
511
- key: "agent.run.getLogs",
512
- version: "1.0.0",
513
- stability: "stable",
514
- owners: [...OWNERS],
515
- tags: ["run", "logs"],
516
- description: "Retrieves all logs for a specific run.",
517
- goal: "Debug and audit run execution.",
518
- context: "Run details page - logs tab."
519
- },
520
- io: {
521
- input: defineSchemaModel2({
522
- name: "GetRunLogsInput",
523
- fields: {
524
- runId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
525
- level: { type: LogLevelEnum, isOptional: true },
526
- stepId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
527
- limit: {
528
- type: ScalarTypeEnum2.Int_unsecure(),
529
- isOptional: true,
530
- defaultValue: 100
531
- },
532
- offset: {
533
- type: ScalarTypeEnum2.Int_unsecure(),
534
- isOptional: true,
535
- defaultValue: 0
536
- }
537
- }
538
- }),
539
- output: defineSchemaModel2({
540
- name: "GetRunLogsOutput",
541
- fields: {
542
- items: { type: RunLogModel, isArray: true, isOptional: false },
543
- total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
544
- hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: false }
545
- }
546
- })
547
- },
548
- policy: { auth: "user" },
549
- acceptance: {
550
- scenarios: [
551
- {
552
- key: "get-run-logs-happy-path",
553
- given: ["Run exists with logs"],
554
- when: ["User requests logs"],
555
- then: ["Paginated logs list is returned"]
556
- }
557
- ],
558
- examples: [
559
- {
560
- key: "get-logs-filtered",
561
- input: { runId: "run-456", level: "error", limit: 50 },
562
- output: { items: [], total: 0, hasMore: false }
563
- }
564
- ]
565
- }
566
- });
567
- var GetRunMetricsQuery = defineQuery({
568
- meta: {
569
- key: "agent.run.getMetrics",
570
- version: "1.0.0",
571
- stability: "stable",
572
- owners: [...OWNERS],
573
- tags: ["run", "metrics"],
574
- description: "Retrieves aggregated metrics for runs within a time period.",
575
- goal: "Monitor and analyze agent usage.",
576
- context: "Analytics dashboard."
577
- },
578
- io: {
579
- input: defineSchemaModel2({
580
- name: "GetRunMetricsInput",
581
- fields: {
582
- organizationId: {
583
- type: ScalarTypeEnum2.String_unsecure(),
584
- isOptional: false
585
- },
586
- agentId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
587
- startDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
588
- endDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
589
- granularity: {
590
- type: GranularityEnum,
591
- isOptional: true,
592
- defaultValue: "day"
593
- }
594
- }
595
- }),
596
- output: defineSchemaModel2({
597
- name: "GetRunMetricsOutput",
598
- fields: {
599
- totalRuns: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
600
- completedRuns: {
601
- type: ScalarTypeEnum2.Int_unsecure(),
602
- isOptional: false
603
- },
604
- failedRuns: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
605
- totalTokens: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
606
- totalCostUsd: {
607
- type: ScalarTypeEnum2.Float_unsecure(),
608
- isOptional: false
609
- },
610
- averageDurationMs: {
611
- type: ScalarTypeEnum2.Float_unsecure(),
612
- isOptional: false
613
- },
614
- successRate: {
615
- type: ScalarTypeEnum2.Float_unsecure(),
616
- isOptional: false
617
- },
618
- timeline: {
619
- type: TimelineDataPointModel,
620
- isArray: true,
621
- isOptional: false
622
- }
623
- }
624
- })
625
- },
626
- policy: { auth: "user" },
627
- acceptance: {
628
- scenarios: [
629
- {
630
- key: "get-run-metrics-happy-path",
631
- given: ["Organization has run history"],
632
- when: ["User requests metrics for date range"],
633
- then: ["Aggregated metrics are returned"]
634
- }
635
- ],
636
- examples: [
637
- {
638
- key: "get-daily-metrics",
639
- input: {
640
- organizationId: "org-123",
641
- startDate: "2025-01-01",
642
- endDate: "2025-01-31",
643
- granularity: "day"
644
- },
645
- output: {
646
- totalRuns: 100,
647
- completedRuns: 90,
648
- failedRuns: 10,
649
- totalTokens: 50000,
650
- totalCostUsd: 5,
651
- averageDurationMs: 2500,
652
- successRate: 0.9,
653
- timeline: []
654
- }
655
- }
656
- ]
657
- }
658
- });
659
- export {
660
- ListRunsQuery,
661
- GetRunStepsQuery,
662
- GetRunQuery,
663
- GetRunMetricsQuery,
664
- GetRunLogsQuery,
665
- ExecuteAgentCommand,
666
- CancelRunCommand
667
- };
1
+ import{defineEnum as F}from"@contractspec/lib.schema";var x=F("RunStatus",["QUEUED","IN_PROGRESS","COMPLETED","FAILED","CANCELLED","EXPIRED"]),V=F("RunStepType",["MESSAGE_CREATION","TOOL_CALL","TOOL_RESULT","ERROR"]),H=F("LogLevel",["DEBUG","INFO","WARN","ERROR"]),X=F("Granularity",["hour","day","week","month"]);import{defineSchemaModel as z,ScalarTypeEnum as j}from"@contractspec/lib.schema";var Y=z({name:"RunInput",description:"Input data for agent execution",fields:{message:{type:j.NonEmptyString(),isOptional:!1},context:{type:j.JSONObject(),isOptional:!0}}}),K=z({name:"RunStep",description:"Individual step within a run",fields:{id:{type:j.String_unsecure(),isOptional:!1},stepNumber:{type:j.Int_unsecure(),isOptional:!1},type:{type:V,isOptional:!1},toolId:{type:j.String_unsecure(),isOptional:!0},toolName:{type:j.String_unsecure(),isOptional:!0},input:{type:j.JSONObject(),isOptional:!0},output:{type:j.JSONObject(),isOptional:!0},status:{type:x,isOptional:!1},errorMessage:{type:j.String_unsecure(),isOptional:!0},tokensUsed:{type:j.Int_unsecure(),isOptional:!1,defaultValue:0},durationMs:{type:j.Int_unsecure(),isOptional:!0},startedAt:{type:j.DateTime(),isOptional:!1},completedAt:{type:j.DateTime(),isOptional:!0}}}),U=z({name:"RunLog",description:"Execution log entry",fields:{id:{type:j.String_unsecure(),isOptional:!1},stepId:{type:j.String_unsecure(),isOptional:!0},level:{type:H,isOptional:!1},message:{type:j.String_unsecure(),isOptional:!1},data:{type:j.JSONObject(),isOptional:!0},source:{type:j.String_unsecure(),isOptional:!0},traceId:{type:j.String_unsecure(),isOptional:!0},spanId:{type:j.String_unsecure(),isOptional:!0},timestamp:{type:j.DateTime(),isOptional:!1}}}),A=z({name:"RunAgentRef",description:"Agent reference in a run",fields:{id:{type:j.String_unsecure(),isOptional:!1},name:{type:j.NonEmptyString(),isOptional:!1},modelProvider:{type:j.String_unsecure(),isOptional:!1},modelName:{type:j.String_unsecure(),isOptional:!1}}}),Z=z({name:"Run",description:"Agent execution instance",fields:{id:{type:j.String_unsecure(),isOptional:!1},organizationId:{type:j.String_unsecure(),isOptional:!1},agentId:{type:j.String_unsecure(),isOptional:!1},userId:{type:j.String_unsecure(),isOptional:!0},sessionId:{type:j.String_unsecure(),isOptional:!0},input:{type:j.JSONObject(),isOptional:!1},output:{type:j.JSONObject(),isOptional:!0},status:{type:x,isOptional:!1},errorMessage:{type:j.String_unsecure(),isOptional:!0},errorCode:{type:j.String_unsecure(),isOptional:!0},totalTokens:{type:j.Int_unsecure(),isOptional:!1,defaultValue:0},promptTokens:{type:j.Int_unsecure(),isOptional:!1,defaultValue:0},completionTokens:{type:j.Int_unsecure(),isOptional:!1,defaultValue:0},totalIterations:{type:j.Int_unsecure(),isOptional:!1,defaultValue:0},durationMs:{type:j.Int_unsecure(),isOptional:!0},estimatedCostUsd:{type:j.Float_unsecure(),isOptional:!0},queuedAt:{type:j.DateTime(),isOptional:!1},startedAt:{type:j.DateTime(),isOptional:!0},completedAt:{type:j.DateTime(),isOptional:!0},metadata:{type:j.JSONObject(),isOptional:!0},steps:{type:K,isArray:!0,isOptional:!0},logs:{type:U,isArray:!0,isOptional:!0},agent:{type:A,isOptional:!0}}}),J=z({name:"RunSummary",description:"Summary of a run for list views",fields:{id:{type:j.String_unsecure(),isOptional:!1},agentId:{type:j.String_unsecure(),isOptional:!1},agentName:{type:j.NonEmptyString(),isOptional:!1},status:{type:x,isOptional:!1},totalTokens:{type:j.Int_unsecure(),isOptional:!1},durationMs:{type:j.Int_unsecure(),isOptional:!0},estimatedCostUsd:{type:j.Float_unsecure(),isOptional:!0},queuedAt:{type:j.DateTime(),isOptional:!1},completedAt:{type:j.DateTime(),isOptional:!0}}}),_=z({name:"TimelineDataPoint",description:"Timeline data point for metrics",fields:{period:{type:j.String_unsecure(),isOptional:!1},runs:{type:j.Int_unsecure(),isOptional:!1},tokens:{type:j.Int_unsecure(),isOptional:!1},costUsd:{type:j.Float_unsecure(),isOptional:!1},avgDurationMs:{type:j.Float_unsecure(),isOptional:!1}}});import{defineCommand as $,defineQuery as B}from"@contractspec/lib.contracts-spec/operations";import{defineSchemaModel as q,ScalarTypeEnum as k}from"@contractspec/lib.schema";var w=["@agent-console-team"],L=$({meta:{key:"agent.run.execute",version:"1.0.0",stability:"stable",owners:[...w],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:q({name:"ExecuteAgentInput",fields:{agentId:{type:k.String_unsecure(),isOptional:!1},input:{type:Y,isOptional:!1},sessionId:{type:k.String_unsecure(),isOptional:!0},metadata:{type:k.JSONObject(),isOptional:!0},stream:{type:k.Boolean(),isOptional:!0},maxIterations:{type:k.Int_unsecure(),isOptional:!0},timeoutMs:{type:k.Int_unsecure(),isOptional:!0}}}),output:q({name:"ExecuteAgentOutput",fields:{runId:{type:k.String_unsecure(),isOptional:!1},status:{type:x,isOptional:!1},estimatedWaitMs:{type:k.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:[...w],tags:["run","started"],when:"Run is queued",payload:J}],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}}]}}),N=$({meta:{key:"agent.run.cancel",version:"1.0.0",stability:"stable",owners:[...w],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:q({name:"CancelRunInput",fields:{runId:{type:k.String_unsecure(),isOptional:!1},reason:{type:k.String_unsecure(),isOptional:!0}}}),output:q({name:"CancelRunOutput",fields:{success:{type:k.Boolean(),isOptional:!1},status:{type:x,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:[...w],tags:["run","cancelled"],when:"Run is cancelled",payload:J}],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"}}]}}),O=B({meta:{key:"agent.run.get",version:"1.0.0",stability:"stable",owners:[...w],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:q({name:"GetRunInput",fields:{runId:{type:k.String_unsecure(),isOptional:!1},includeSteps:{type:k.Boolean(),isOptional:!0},includeLogs:{type:k.Boolean(),isOptional:!0}}}),output:Z,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:[]}}]}}),W=B({meta:{key:"agent.run.list",version:"1.0.0",stability:"stable",owners:[...w],tags:["run","list"],description:"Lists runs with optional filtering.",goal:"Browse and search run history.",context:"Run history/dashboard view."},io:{input:q({name:"ListRunsInput",fields:{organizationId:{type:k.String_unsecure(),isOptional:!0},agentId:{type:k.String_unsecure(),isOptional:!0},userId:{type:k.String_unsecure(),isOptional:!0},sessionId:{type:k.String_unsecure(),isOptional:!0},status:{type:x,isOptional:!0},startDate:{type:k.DateTime(),isOptional:!0},endDate:{type:k.DateTime(),isOptional:!0},limit:{type:k.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:k.Int_unsecure(),isOptional:!0,defaultValue:0}}}),output:q({name:"ListRunsOutput",fields:{items:{type:J,isArray:!0,isOptional:!1},total:{type:k.Int_unsecure(),isOptional:!1},hasMore:{type:k.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}}]}}),s=B({meta:{key:"agent.run.getSteps",version:"1.0.0",stability:"stable",owners:[...w],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:q({name:"GetRunStepsInput",fields:{runId:{type:k.String_unsecure(),isOptional:!1}}}),output:q({name:"GetRunStepsOutput",fields:{steps:{type:K,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:[]}}]}}),h=B({meta:{key:"agent.run.getLogs",version:"1.0.0",stability:"stable",owners:[...w],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:q({name:"GetRunLogsInput",fields:{runId:{type:k.String_unsecure(),isOptional:!1},level:{type:H,isOptional:!0},stepId:{type:k.String_unsecure(),isOptional:!0},limit:{type:k.Int_unsecure(),isOptional:!0,defaultValue:100},offset:{type:k.Int_unsecure(),isOptional:!0,defaultValue:0}}}),output:q({name:"GetRunLogsOutput",fields:{items:{type:U,isArray:!0,isOptional:!1},total:{type:k.Int_unsecure(),isOptional:!1},hasMore:{type:k.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}}]}}),R=B({meta:{key:"agent.run.getMetrics",version:"1.0.0",stability:"stable",owners:[...w],tags:["run","metrics"],description:"Retrieves aggregated metrics for runs within a time period.",goal:"Monitor and analyze agent usage.",context:"Analytics dashboard."},io:{input:q({name:"GetRunMetricsInput",fields:{organizationId:{type:k.String_unsecure(),isOptional:!1},agentId:{type:k.String_unsecure(),isOptional:!0},startDate:{type:k.DateTime(),isOptional:!1},endDate:{type:k.DateTime(),isOptional:!1},granularity:{type:X,isOptional:!0,defaultValue:"day"}}}),output:q({name:"GetRunMetricsOutput",fields:{totalRuns:{type:k.Int_unsecure(),isOptional:!1},completedRuns:{type:k.Int_unsecure(),isOptional:!1},failedRuns:{type:k.Int_unsecure(),isOptional:!1},totalTokens:{type:k.Int_unsecure(),isOptional:!1},totalCostUsd:{type:k.Float_unsecure(),isOptional:!1},averageDurationMs:{type:k.Float_unsecure(),isOptional:!1},successRate:{type:k.Float_unsecure(),isOptional:!1},timeline:{type:_,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:[]}}]}});export{W as ListRunsQuery,s as GetRunStepsQuery,O as GetRunQuery,R as GetRunMetricsQuery,h as GetRunLogsQuery,L as ExecuteAgentCommand,N as CancelRunCommand};