@contractspec/example.agent-console 3.7.5 → 3.7.7
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 +18 -18
- package/AGENTS.md +50 -31
- package/CHANGELOG.md +12 -0
- package/README.md +69 -77
- package/dist/agent/agent.event.js +1 -1
- package/dist/agent/agent.operation.js +1 -1
- package/dist/agent/index.d.ts +5 -5
- package/dist/agent/index.js +1 -1
- package/dist/browser/agent/agent.event.js +1 -1
- package/dist/browser/agent/agent.operation.js +1 -1
- package/dist/browser/agent/index.js +1 -1
- package/dist/browser/index.js +2145 -2145
- package/dist/browser/presentations/index.js +4 -4
- package/dist/browser/run/index.js +536 -536
- package/dist/browser/run/run.event.js +2 -2
- package/dist/browser/run/run.presentation.js +2 -2
- package/dist/browser/tool/index.js +260 -260
- package/dist/browser/tool/tool.event.js +1 -1
- package/dist/browser/tool/tool.presentation.js +2 -2
- package/dist/browser/ui/AgentDashboard.js +956 -956
- package/dist/browser/ui/AgentRunList.js +16 -16
- package/dist/browser/ui/AgentToolRegistry.js +9 -9
- package/dist/browser/ui/hooks/index.js +153 -153
- package/dist/browser/ui/hooks/useAgentList.js +1 -1
- package/dist/browser/ui/hooks/useAgentMutations.js +1 -1
- package/dist/browser/ui/hooks/useRunList.js +1 -1
- package/dist/browser/ui/hooks/useToolList.js +1 -1
- package/dist/browser/ui/index.js +1222 -1222
- package/dist/browser/ui/modals/AgentActionsModal.js +13 -13
- package/dist/browser/ui/modals/CreateAgentModal.js +15 -15
- package/dist/browser/ui/modals/index.js +297 -297
- package/dist/browser/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/browser/ui/renderers/index.js +157 -157
- package/dist/browser/ui/views/AgentListView.js +7 -7
- package/dist/browser/ui/views/RunListView.js +16 -16
- package/dist/browser/ui/views/ToolRegistryView.js +9 -9
- package/dist/browser/ui/views/index.js +97 -97
- package/dist/handlers/index.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2145 -2145
- package/dist/node/agent/agent.event.js +1 -1
- package/dist/node/agent/agent.operation.js +1 -1
- package/dist/node/agent/index.js +1 -1
- package/dist/node/index.js +2145 -2145
- package/dist/node/presentations/index.js +4 -4
- package/dist/node/run/index.js +536 -536
- package/dist/node/run/run.event.js +2 -2
- package/dist/node/run/run.presentation.js +2 -2
- package/dist/node/tool/index.js +260 -260
- package/dist/node/tool/tool.event.js +1 -1
- package/dist/node/tool/tool.presentation.js +2 -2
- package/dist/node/ui/AgentDashboard.js +956 -956
- package/dist/node/ui/AgentRunList.js +16 -16
- package/dist/node/ui/AgentToolRegistry.js +9 -9
- package/dist/node/ui/hooks/index.js +153 -153
- package/dist/node/ui/hooks/useAgentList.js +1 -1
- package/dist/node/ui/hooks/useAgentMutations.js +1 -1
- package/dist/node/ui/hooks/useRunList.js +1 -1
- package/dist/node/ui/hooks/useToolList.js +1 -1
- package/dist/node/ui/index.js +1222 -1222
- package/dist/node/ui/modals/AgentActionsModal.js +13 -13
- package/dist/node/ui/modals/CreateAgentModal.js +15 -15
- package/dist/node/ui/modals/index.js +297 -297
- package/dist/node/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/node/ui/renderers/index.js +157 -157
- package/dist/node/ui/views/AgentListView.js +7 -7
- package/dist/node/ui/views/RunListView.js +16 -16
- package/dist/node/ui/views/ToolRegistryView.js +9 -9
- package/dist/node/ui/views/index.js +97 -97
- package/dist/presentations/index.d.ts +3 -5
- package/dist/presentations/index.js +4 -4
- package/dist/run/index.d.ts +7 -7
- package/dist/run/index.js +536 -536
- package/dist/run/run.event.js +2 -2
- package/dist/run/run.handler.d.ts +3 -0
- package/dist/run/run.presentation.js +2 -2
- package/dist/shared/index.d.ts +1 -1
- package/dist/tool/index.d.ts +7 -7
- package/dist/tool/index.js +260 -260
- package/dist/tool/tool.event.js +1 -1
- package/dist/tool/tool.handler.d.ts +1 -1
- package/dist/tool/tool.presentation.js +2 -2
- package/dist/ui/AgentDashboard.js +956 -956
- package/dist/ui/AgentRunList.js +16 -16
- package/dist/ui/AgentToolRegistry.js +9 -9
- package/dist/ui/hooks/index.d.ts +4 -4
- package/dist/ui/hooks/index.js +153 -153
- package/dist/ui/hooks/useAgentList.d.ts +5 -0
- package/dist/ui/hooks/useAgentList.js +1 -1
- package/dist/ui/hooks/useAgentMutations.d.ts +9 -2
- package/dist/ui/hooks/useAgentMutations.js +1 -1
- package/dist/ui/hooks/useRunList.d.ts +5 -0
- package/dist/ui/hooks/useRunList.js +1 -1
- package/dist/ui/hooks/useToolList.d.ts +5 -0
- package/dist/ui/hooks/useToolList.js +1 -1
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +1222 -1222
- package/dist/ui/modals/AgentActionsModal.js +13 -13
- package/dist/ui/modals/CreateAgentModal.js +15 -15
- package/dist/ui/modals/index.d.ts +1 -1
- package/dist/ui/modals/index.js +297 -297
- package/dist/ui/renderers/agent-list.markdown.d.ts +5 -0
- package/dist/ui/renderers/agent-list.renderer.js +7 -7
- package/dist/ui/renderers/dashboard.markdown.d.ts +5 -0
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.js +157 -157
- package/dist/ui/renderers/run-list.markdown.d.ts +5 -0
- package/dist/ui/renderers/tool-registry.markdown.d.ts +5 -0
- package/dist/ui/views/AgentListView.js +7 -7
- package/dist/ui/views/RunListView.js +16 -16
- package/dist/ui/views/ToolRegistryView.js +9 -9
- package/dist/ui/views/index.js +97 -97
- package/package.json +10 -10
- package/src/agent/agent.entity.ts +111 -111
- package/src/agent/agent.enum.ts +12 -12
- package/src/agent/agent.event.ts +91 -91
- package/src/agent/agent.handler.ts +123 -123
- package/src/agent/agent.operation.ts +400 -400
- package/src/agent/agent.presentation.ts +62 -62
- package/src/agent/agent.schema.ts +175 -175
- package/src/agent/agent.test-spec.ts +48 -48
- package/src/agent/index.ts +46 -51
- package/src/agent.capability.ts +11 -11
- package/src/agent.feature.ts +131 -131
- package/src/docs/agent-console.docblock.ts +42 -42
- package/src/example.ts +35 -35
- package/src/handlers/agent.handlers.ts +522 -521
- package/src/handlers/index.ts +12 -12
- package/src/index.ts +8 -9
- package/src/presentations/index.ts +11 -13
- package/src/run/index.ts +49 -54
- package/src/run/run.entity.ts +137 -137
- package/src/run/run.enum.ts +18 -18
- package/src/run/run.event.ts +174 -174
- package/src/run/run.handler.ts +92 -91
- package/src/run/run.operation.ts +474 -474
- package/src/run/run.presentation.ts +42 -42
- package/src/run/run.schema.ts +126 -126
- package/src/run/run.test-spec.ts +48 -48
- package/src/seeders/index.ts +21 -21
- package/src/shared/index.ts +1 -1
- package/src/shared/mock-agents.ts +76 -76
- package/src/shared/mock-runs.ts +102 -102
- package/src/shared/mock-tools.ts +140 -140
- package/src/shared/overlay-types.ts +23 -23
- package/src/tool/index.ts +39 -44
- package/src/tool/tool.entity.ts +73 -73
- package/src/tool/tool.enum.ts +13 -13
- package/src/tool/tool.event.ts +80 -80
- package/src/tool/tool.handler.ts +102 -102
- package/src/tool/tool.operation.ts +328 -328
- package/src/tool/tool.presentation.ts +43 -43
- package/src/tool/tool.schema.ts +106 -106
- package/src/tool/tool.test-spec.ts +48 -48
- package/src/ui/AgentDashboard.tsx +348 -348
- package/src/ui/hooks/index.ts +7 -7
- package/src/ui/hooks/useAgentList.ts +57 -56
- package/src/ui/hooks/useAgentMutations.ts +160 -159
- package/src/ui/hooks/useRunList.ts +58 -57
- package/src/ui/hooks/useToolList.ts +102 -101
- package/src/ui/index.ts +6 -9
- package/src/ui/modals/AgentActionsModal.tsx +262 -262
- package/src/ui/modals/CreateAgentModal.tsx +232 -232
- package/src/ui/modals/index.ts +1 -1
- package/src/ui/overlays/demo-overlays.ts +52 -52
- package/src/ui/renderers/agent-list.markdown.ts +61 -60
- package/src/ui/renderers/agent-list.renderer.tsx +14 -14
- package/src/ui/renderers/dashboard.markdown.ts +140 -139
- package/src/ui/renderers/index.ts +3 -4
- package/src/ui/renderers/run-list.markdown.ts +48 -47
- package/src/ui/renderers/tool-registry.markdown.ts +66 -65
- package/src/ui/views/AgentListView.tsx +90 -90
- package/src/ui/views/RunListView.tsx +141 -141
- package/src/ui/views/ToolRegistryView.tsx +113 -113
- package/tsconfig.json +7 -8
- package/tsdown.config.js +7 -3
package/src/handlers/index.ts
CHANGED
|
@@ -4,26 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
// Agent handlers and types
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
type AgentSummary,
|
|
8
|
+
mockCreateAgentHandler,
|
|
9
|
+
mockGetAgentHandler,
|
|
10
|
+
mockListAgentsHandler,
|
|
11
11
|
} from '../agent/agent.handler';
|
|
12
12
|
|
|
13
13
|
// Run handlers and types
|
|
14
14
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
mockExecuteAgentHandler,
|
|
16
|
+
mockGetRunHandler,
|
|
17
|
+
mockListRunsHandler,
|
|
18
|
+
type RunSummary,
|
|
19
19
|
} from '../run/run.handler';
|
|
20
20
|
|
|
21
21
|
// Tool handlers and types
|
|
22
22
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
mockCreateToolHandler,
|
|
24
|
+
mockGetToolHandler,
|
|
25
|
+
mockListToolsHandler,
|
|
26
|
+
type ToolSummary,
|
|
27
27
|
} from '../tool/tool.handler';
|
|
28
28
|
|
|
29
29
|
// Runtime handlers (PGLite)
|
package/src/index.ts
CHANGED
|
@@ -17,16 +17,15 @@
|
|
|
17
17
|
|
|
18
18
|
// Domain exports
|
|
19
19
|
export * from './agent';
|
|
20
|
-
export * from './run';
|
|
21
|
-
export * from './tool';
|
|
22
|
-
export * from './shared';
|
|
23
|
-
export * from './ui';
|
|
24
|
-
export {
|
|
25
|
-
createAgentHandlers,
|
|
26
|
-
type AgentHandlers,
|
|
27
|
-
} from './handlers/agent.handlers';
|
|
28
|
-
|
|
29
20
|
// Feature spec export
|
|
30
21
|
export * from './agent.feature';
|
|
31
22
|
export { default as example } from './example';
|
|
23
|
+
export {
|
|
24
|
+
type AgentHandlers,
|
|
25
|
+
createAgentHandlers,
|
|
26
|
+
} from './handlers/agent.handlers';
|
|
27
|
+
export * from './run';
|
|
28
|
+
export * from './shared';
|
|
29
|
+
export * from './tool';
|
|
30
|
+
export * from './ui';
|
|
32
31
|
import './docs';
|
|
@@ -4,23 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
// Agent presentations
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
AgentConsoleDashboardPresentation,
|
|
8
|
+
AgentDetailPresentation,
|
|
9
|
+
AgentListPresentation,
|
|
10
10
|
} from '../agent/agent.presentation';
|
|
11
|
-
|
|
12
11
|
// Run presentations
|
|
12
|
+
// Alias: RunMetricsPresentation -> RunDetailPresentation (for backward compatibility)
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
RunDetailPresentation,
|
|
15
|
+
RunDetailPresentation as RunMetricsPresentation,
|
|
16
|
+
RunListPresentation,
|
|
16
17
|
} from '../run/run.presentation';
|
|
17
|
-
// Alias: RunMetricsPresentation -> RunDetailPresentation (for backward compatibility)
|
|
18
|
-
export { RunDetailPresentation as RunMetricsPresentation } from '../run/run.presentation';
|
|
19
|
-
|
|
20
18
|
// Tool presentations
|
|
19
|
+
// Alias: ToolRegistryPresentation -> ToolListPresentation (for backward compatibility)
|
|
21
20
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
ToolDetailPresentation,
|
|
22
|
+
ToolListPresentation,
|
|
23
|
+
ToolListPresentation as ToolRegistryPresentation,
|
|
24
24
|
} from '../tool/tool.presentation';
|
|
25
|
-
// Alias: ToolRegistryPresentation -> ToolListPresentation (for backward compatibility)
|
|
26
|
-
export { ToolListPresentation as ToolRegistryPresentation } from '../tool/tool.presentation';
|
package/src/run/index.ts
CHANGED
|
@@ -2,67 +2,62 @@
|
|
|
2
2
|
* Run domain - Agent execution and monitoring.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
// Entities
|
|
6
|
+
export {
|
|
7
|
+
LogLevelEntityEnum,
|
|
8
|
+
RunEntity,
|
|
9
|
+
RunLogEntity,
|
|
10
|
+
RunStatusEntityEnum,
|
|
11
|
+
RunStepEntity,
|
|
12
|
+
RunStepTypeEntityEnum,
|
|
13
|
+
} from './run.entity';
|
|
5
14
|
// Enums
|
|
6
15
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
GranularityEnum,
|
|
17
|
+
LogLevelEnum,
|
|
18
|
+
RunStatusEnum,
|
|
19
|
+
RunStepTypeEnum,
|
|
11
20
|
} from './run.enum';
|
|
12
|
-
|
|
13
|
-
// Schema models
|
|
14
|
-
export {
|
|
15
|
-
RunInputModel,
|
|
16
|
-
RunStepModel,
|
|
17
|
-
RunLogModel,
|
|
18
|
-
RunAgentRefModel,
|
|
19
|
-
RunModel,
|
|
20
|
-
RunSummaryModel,
|
|
21
|
-
TimelineDataPointModel,
|
|
22
|
-
} from './run.schema';
|
|
23
|
-
|
|
24
|
-
// Contracts
|
|
25
|
-
export {
|
|
26
|
-
ExecuteAgentCommand,
|
|
27
|
-
CancelRunCommand,
|
|
28
|
-
GetRunQuery,
|
|
29
|
-
ListRunsQuery,
|
|
30
|
-
GetRunStepsQuery,
|
|
31
|
-
GetRunLogsQuery,
|
|
32
|
-
GetRunMetricsQuery,
|
|
33
|
-
} from './run.operation';
|
|
34
|
-
|
|
35
21
|
// Events
|
|
36
22
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
MessageGeneratedEvent,
|
|
24
|
+
RunCancelledEvent,
|
|
25
|
+
RunCompletedEvent,
|
|
26
|
+
RunFailedEvent,
|
|
27
|
+
RunStartedEvent,
|
|
28
|
+
ToolCompletedEvent,
|
|
29
|
+
ToolInvokedEvent,
|
|
44
30
|
} from './run.event';
|
|
45
|
-
|
|
46
|
-
// Entities
|
|
31
|
+
// Handlers
|
|
47
32
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
33
|
+
type ListRunsInput,
|
|
34
|
+
type ListRunsOutput,
|
|
35
|
+
mockCancelRunHandler,
|
|
36
|
+
mockExecuteAgentHandler,
|
|
37
|
+
mockGetRunHandler,
|
|
38
|
+
mockListRunsHandler,
|
|
39
|
+
type RunSummary,
|
|
40
|
+
} from './run.handler';
|
|
41
|
+
// Contracts
|
|
42
|
+
export {
|
|
43
|
+
CancelRunCommand,
|
|
44
|
+
ExecuteAgentCommand,
|
|
45
|
+
GetRunLogsQuery,
|
|
46
|
+
GetRunMetricsQuery,
|
|
47
|
+
GetRunQuery,
|
|
48
|
+
GetRunStepsQuery,
|
|
49
|
+
ListRunsQuery,
|
|
50
|
+
} from './run.operation';
|
|
55
51
|
|
|
56
52
|
// Presentations
|
|
57
|
-
export {
|
|
58
|
-
|
|
59
|
-
// Handlers
|
|
53
|
+
export { RunDetailPresentation, RunListPresentation } from './run.presentation';
|
|
54
|
+
// Schema models
|
|
60
55
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} from './run.
|
|
56
|
+
RunAgentRefModel,
|
|
57
|
+
RunInputModel,
|
|
58
|
+
RunLogModel,
|
|
59
|
+
RunModel,
|
|
60
|
+
RunStepModel,
|
|
61
|
+
RunSummaryModel,
|
|
62
|
+
TimelineDataPointModel,
|
|
63
|
+
} from './run.schema';
|
package/src/run/run.entity.ts
CHANGED
|
@@ -1,175 +1,175 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineEntityEnum,
|
|
4
|
+
field,
|
|
5
|
+
index,
|
|
6
6
|
} from '@contractspec/lib.schema';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Run status enum for entities.
|
|
10
10
|
*/
|
|
11
11
|
export const RunStatusEntityEnum = defineEntityEnum({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
name: 'RunStatus',
|
|
13
|
+
values: [
|
|
14
|
+
'QUEUED',
|
|
15
|
+
'IN_PROGRESS',
|
|
16
|
+
'COMPLETED',
|
|
17
|
+
'FAILED',
|
|
18
|
+
'CANCELLED',
|
|
19
|
+
'EXPIRED',
|
|
20
|
+
],
|
|
21
|
+
description: 'Status of an agent run',
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Run step type enum for entities.
|
|
26
26
|
*/
|
|
27
27
|
export const RunStepTypeEntityEnum = defineEntityEnum({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
name: 'RunStepType',
|
|
29
|
+
values: ['MESSAGE_CREATION', 'TOOL_CALL', 'TOOL_RESULT', 'ERROR'],
|
|
30
|
+
description: 'Type of run step',
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Log level enum for entities.
|
|
35
35
|
*/
|
|
36
36
|
export const LogLevelEntityEnum = defineEntityEnum({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
name: 'LogLevel',
|
|
38
|
+
values: ['DEBUG', 'INFO', 'WARN', 'ERROR'],
|
|
39
|
+
description: 'Log level',
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Run entity - Represents an agent execution.
|
|
44
44
|
*/
|
|
45
45
|
export const RunEntity = defineEntity({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
46
|
+
name: 'Run',
|
|
47
|
+
schema: 'agent_console',
|
|
48
|
+
description: 'An execution of an agent with input/output and metrics.',
|
|
49
|
+
fields: {
|
|
50
|
+
id: field.id(),
|
|
51
|
+
organizationId: field.string({ description: 'Organization ID' }),
|
|
52
|
+
agentId: field.foreignKey({ description: 'Agent being executed' }),
|
|
53
|
+
userId: field.string({
|
|
54
|
+
isOptional: true,
|
|
55
|
+
description: 'User who initiated the run',
|
|
56
|
+
}),
|
|
57
|
+
sessionId: field.string({
|
|
58
|
+
isOptional: true,
|
|
59
|
+
description: 'Conversation session ID',
|
|
60
|
+
}),
|
|
61
|
+
input: field.json({ description: 'Input data for the run' }),
|
|
62
|
+
output: field.json({
|
|
63
|
+
isOptional: true,
|
|
64
|
+
description: 'Output result from the run',
|
|
65
|
+
}),
|
|
66
|
+
status: field.enum('RunStatus', { default: 'QUEUED' }),
|
|
67
|
+
errorMessage: field.string({
|
|
68
|
+
isOptional: true,
|
|
69
|
+
description: 'Error message if failed',
|
|
70
|
+
}),
|
|
71
|
+
errorCode: field.string({
|
|
72
|
+
isOptional: true,
|
|
73
|
+
description: 'Error code if failed',
|
|
74
|
+
}),
|
|
75
|
+
totalTokens: field.int({ default: 0, description: 'Total tokens used' }),
|
|
76
|
+
promptTokens: field.int({ default: 0, description: 'Prompt tokens used' }),
|
|
77
|
+
completionTokens: field.int({
|
|
78
|
+
default: 0,
|
|
79
|
+
description: 'Completion tokens used',
|
|
80
|
+
}),
|
|
81
|
+
totalIterations: field.int({
|
|
82
|
+
default: 0,
|
|
83
|
+
description: 'Number of iterations',
|
|
84
|
+
}),
|
|
85
|
+
durationMs: field.int({
|
|
86
|
+
isOptional: true,
|
|
87
|
+
description: 'Execution duration in ms',
|
|
88
|
+
}),
|
|
89
|
+
estimatedCostUsd: field.float({
|
|
90
|
+
isOptional: true,
|
|
91
|
+
description: 'Estimated cost in USD',
|
|
92
|
+
}),
|
|
93
|
+
queuedAt: field.dateTime({ description: 'When run was queued' }),
|
|
94
|
+
startedAt: field.dateTime({
|
|
95
|
+
isOptional: true,
|
|
96
|
+
description: 'When run started executing',
|
|
97
|
+
}),
|
|
98
|
+
completedAt: field.dateTime({
|
|
99
|
+
isOptional: true,
|
|
100
|
+
description: 'When run completed',
|
|
101
|
+
}),
|
|
102
|
+
metadata: field.json({
|
|
103
|
+
isOptional: true,
|
|
104
|
+
description: 'Additional metadata',
|
|
105
|
+
}),
|
|
106
|
+
agent: field.belongsTo('Agent', ['agentId'], ['id']),
|
|
107
|
+
steps: field.hasMany('RunStep', { description: 'Execution steps' }),
|
|
108
|
+
logs: field.hasMany('RunLog', { description: 'Execution logs' }),
|
|
109
|
+
},
|
|
110
|
+
indexes: [
|
|
111
|
+
index.on(['organizationId', 'agentId', 'queuedAt']),
|
|
112
|
+
index.on(['organizationId', 'status']),
|
|
113
|
+
index.on(['agentId', 'status']),
|
|
114
|
+
index.on(['sessionId']),
|
|
115
|
+
],
|
|
116
|
+
enums: [RunStatusEntityEnum],
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* RunStep entity - Individual step in a run.
|
|
121
121
|
*/
|
|
122
122
|
export const RunStepEntity = defineEntity({
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
123
|
+
name: 'RunStep',
|
|
124
|
+
schema: 'agent_console',
|
|
125
|
+
description: 'An individual step in an agent run.',
|
|
126
|
+
fields: {
|
|
127
|
+
id: field.id(),
|
|
128
|
+
runId: field.foreignKey({ description: 'Parent run' }),
|
|
129
|
+
stepNumber: field.int({ description: 'Step sequence number' }),
|
|
130
|
+
type: field.enum('RunStepType'),
|
|
131
|
+
toolId: field.string({
|
|
132
|
+
isOptional: true,
|
|
133
|
+
description: 'Tool used in this step',
|
|
134
|
+
}),
|
|
135
|
+
toolName: field.string({ isOptional: true, description: 'Tool name' }),
|
|
136
|
+
input: field.json({ isOptional: true, description: 'Step input' }),
|
|
137
|
+
output: field.json({ isOptional: true, description: 'Step output' }),
|
|
138
|
+
status: field.enum('RunStatus'),
|
|
139
|
+
errorMessage: field.string({ isOptional: true }),
|
|
140
|
+
tokensUsed: field.int({ default: 0 }),
|
|
141
|
+
durationMs: field.int({ isOptional: true }),
|
|
142
|
+
startedAt: field.dateTime(),
|
|
143
|
+
completedAt: field.dateTime({ isOptional: true }),
|
|
144
|
+
run: field.belongsTo('Run', ['runId'], ['id']),
|
|
145
|
+
},
|
|
146
|
+
indexes: [index.on(['runId', 'stepNumber'])],
|
|
147
|
+
enums: [RunStepTypeEntityEnum],
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* RunLog entity - Log entry for a run.
|
|
152
152
|
*/
|
|
153
153
|
export const RunLogEntity = defineEntity({
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
154
|
+
name: 'RunLog',
|
|
155
|
+
schema: 'agent_console',
|
|
156
|
+
description: 'A log entry for an agent run.',
|
|
157
|
+
fields: {
|
|
158
|
+
id: field.id(),
|
|
159
|
+
runId: field.foreignKey({ description: 'Parent run' }),
|
|
160
|
+
stepId: field.string({ isOptional: true, description: 'Related step' }),
|
|
161
|
+
level: field.enum('LogLevel'),
|
|
162
|
+
message: field.string({ description: 'Log message' }),
|
|
163
|
+
data: field.json({ isOptional: true, description: 'Additional log data' }),
|
|
164
|
+
source: field.string({
|
|
165
|
+
isOptional: true,
|
|
166
|
+
description: 'Log source component',
|
|
167
|
+
}),
|
|
168
|
+
traceId: field.string({ isOptional: true }),
|
|
169
|
+
spanId: field.string({ isOptional: true }),
|
|
170
|
+
timestamp: field.dateTime(),
|
|
171
|
+
run: field.belongsTo('Run', ['runId'], ['id']),
|
|
172
|
+
},
|
|
173
|
+
indexes: [index.on(['runId', 'timestamp']), index.on(['runId', 'level'])],
|
|
174
|
+
enums: [LogLevelEntityEnum],
|
|
175
175
|
});
|
package/src/run/run.enum.ts
CHANGED
|
@@ -4,40 +4,40 @@ import { defineEnum } from '@contractspec/lib.schema';
|
|
|
4
4
|
* Run status enum.
|
|
5
5
|
*/
|
|
6
6
|
export const RunStatusEnum = defineEnum('RunStatus', [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
'QUEUED',
|
|
8
|
+
'IN_PROGRESS',
|
|
9
|
+
'COMPLETED',
|
|
10
|
+
'FAILED',
|
|
11
|
+
'CANCELLED',
|
|
12
|
+
'EXPIRED',
|
|
13
13
|
]);
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Run step type enum.
|
|
17
17
|
*/
|
|
18
18
|
export const RunStepTypeEnum = defineEnum('RunStepType', [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
'MESSAGE_CREATION',
|
|
20
|
+
'TOOL_CALL',
|
|
21
|
+
'TOOL_RESULT',
|
|
22
|
+
'ERROR',
|
|
23
23
|
]);
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Log level enum.
|
|
27
27
|
*/
|
|
28
28
|
export const LogLevelEnum = defineEnum('LogLevel', [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
'DEBUG',
|
|
30
|
+
'INFO',
|
|
31
|
+
'WARN',
|
|
32
|
+
'ERROR',
|
|
33
33
|
]);
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Granularity enum for metrics.
|
|
37
37
|
*/
|
|
38
38
|
export const GranularityEnum = defineEnum('Granularity', [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
'hour',
|
|
40
|
+
'day',
|
|
41
|
+
'week',
|
|
42
|
+
'month',
|
|
43
43
|
]);
|