@contractspec/example.agent-console 3.8.8 → 3.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +225 -222
- package/CHANGELOG.md +34 -0
- package/dist/agent/agent.entity.js +1 -127
- package/dist/agent/agent.enum.js +1 -25
- package/dist/agent/agent.event.js +1 -116
- package/dist/agent/agent.handler.js +1 -1030
- package/dist/agent/agent.operation.js +1 -735
- package/dist/agent/agent.presentation.js +1 -282
- package/dist/agent/agent.schema.js +1 -215
- package/dist/agent/agent.test-spec.js +1 -58
- package/dist/agent/index.js +1 -1248
- package/dist/agent.capability.js +1 -19
- package/dist/agent.feature.js +1 -305
- package/dist/browser/agent/agent.entity.js +1 -127
- package/dist/browser/agent/agent.enum.js +1 -25
- package/dist/browser/agent/agent.event.js +1 -116
- package/dist/browser/agent/agent.handler.js +1 -1030
- package/dist/browser/agent/agent.operation.js +1 -735
- package/dist/browser/agent/agent.presentation.js +1 -282
- package/dist/browser/agent/agent.schema.js +1 -215
- package/dist/browser/agent/agent.test-spec.js +1 -58
- package/dist/browser/agent/index.js +1 -1248
- package/dist/browser/agent.capability.js +1 -19
- package/dist/browser/agent.feature.js +1 -305
- package/dist/browser/docs/agent-console.docblock.js +5 -49
- package/dist/browser/docs/index.js +5 -49
- package/dist/browser/example.js +1 -41
- package/dist/browser/handlers/agent.handlers.js +6 -2143
- package/dist/browser/handlers/index.js +6 -2943
- package/dist/browser/index.js +14 -6828
- package/dist/browser/presentations/index.js +1 -693
- package/dist/browser/run/index.js +1 -1363
- package/dist/browser/run/run.entity.js +1 -160
- package/dist/browser/run/run.enum.js +1 -34
- package/dist/browser/run/run.event.js +1 -217
- package/dist/browser/run/run.handler.js +1 -919
- package/dist/browser/run/run.operation.js +1 -667
- package/dist/browser/run/run.presentation.js +1 -223
- package/dist/browser/run/run.schema.js +1 -179
- package/dist/browser/run/run.test-spec.js +1 -58
- package/dist/browser/seeders/index.js +2 -21
- package/dist/browser/shared/index.js +1 -626
- package/dist/browser/shared/mock-agents.js +1 -82
- package/dist/browser/shared/mock-runs.js +1 -113
- package/dist/browser/shared/mock-tools.js +1 -146
- package/dist/browser/tool/index.js +1 -949
- package/dist/browser/tool/tool.entity.js +1 -90
- package/dist/browser/tool/tool.enum.js +1 -26
- package/dist/browser/tool/tool.event.js +1 -99
- package/dist/browser/tool/tool.handler.js +1 -699
- package/dist/browser/tool/tool.operation.js +1 -482
- package/dist/browser/tool/tool.presentation.js +1 -188
- package/dist/browser/tool/tool.schema.js +1 -141
- package/dist/browser/tool/tool.test-spec.js +1 -58
- package/dist/browser/ui/AgentDashboard.js +1 -2527
- package/dist/browser/ui/AgentDashboard.visualizations.js +1 -217
- package/dist/browser/ui/AgentRunList.js +1 -482
- package/dist/browser/ui/AgentToolRegistry.js +1 -212
- package/dist/browser/ui/ExecutionConsoleHost.js +1 -0
- package/dist/browser/ui/hooks/index.js +1 -740
- package/dist/browser/ui/hooks/useAgentList.js +1 -55
- package/dist/browser/ui/hooks/useAgentMutations.js +1 -530
- package/dist/browser/ui/hooks/useRunList.js +1 -70
- package/dist/browser/ui/hooks/useToolList.js +1 -85
- package/dist/browser/ui/index.js +5 -3018
- package/dist/browser/ui/modals/AgentActionsModal.js +1 -304
- package/dist/browser/ui/modals/CreateAgentModal.js +1 -243
- package/dist/browser/ui/modals/index.js +1 -546
- package/dist/browser/ui/overlays/demo-overlays.js +1 -64
- package/dist/browser/ui/overlays/index.js +1 -64
- package/dist/browser/ui/renderers/agent-list.markdown.js +2 -64
- package/dist/browser/ui/renderers/agent-list.renderer.js +1 -180
- package/dist/browser/ui/renderers/dashboard.markdown.js +2 -288
- package/dist/browser/ui/renderers/index.js +5 -642
- package/dist/browser/ui/renderers/run-list.markdown.js +2 -50
- package/dist/browser/ui/renderers/tool-registry.markdown.js +2 -64
- package/dist/browser/ui/views/AgentListView.js +1 -165
- package/dist/browser/ui/views/RunDataTable.js +1 -326
- package/dist/browser/ui/views/RunListView.js +1 -479
- package/dist/browser/ui/views/ToolRegistryView.js +1 -209
- package/dist/browser/ui/views/index.js +1 -851
- package/dist/browser/ui/views/run-data-table.columns.js +1 -271
- package/dist/browser/ui/views/run-list.shared.js +1 -177
- package/dist/browser/visualizations/catalog.js +1 -134
- package/dist/browser/visualizations/index.js +1 -187
- package/dist/browser/visualizations/selectors.js +1 -181
- package/dist/docs/agent-console.docblock.js +5 -49
- package/dist/docs/index.js +5 -49
- package/dist/example.js +1 -41
- package/dist/handlers/agent.handlers.js +6 -2143
- package/dist/handlers/index.js +6 -2943
- package/dist/index.js +14 -6828
- package/dist/node/agent/agent.entity.js +1 -127
- package/dist/node/agent/agent.enum.js +1 -25
- package/dist/node/agent/agent.event.js +1 -116
- package/dist/node/agent/agent.handler.js +1 -1030
- package/dist/node/agent/agent.operation.js +1 -735
- package/dist/node/agent/agent.presentation.js +1 -282
- package/dist/node/agent/agent.schema.js +1 -215
- package/dist/node/agent/agent.test-spec.js +1 -58
- package/dist/node/agent/index.js +1 -1248
- package/dist/node/agent.capability.js +1 -19
- package/dist/node/agent.feature.js +1 -305
- package/dist/node/docs/agent-console.docblock.js +5 -49
- package/dist/node/docs/index.js +5 -49
- package/dist/node/example.js +1 -41
- package/dist/node/handlers/agent.handlers.js +6 -2143
- package/dist/node/handlers/index.js +6 -2943
- package/dist/node/index.js +14 -6828
- package/dist/node/presentations/index.js +1 -693
- package/dist/node/run/index.js +1 -1363
- package/dist/node/run/run.entity.js +1 -160
- package/dist/node/run/run.enum.js +1 -34
- package/dist/node/run/run.event.js +1 -217
- package/dist/node/run/run.handler.js +1 -919
- package/dist/node/run/run.operation.js +1 -667
- package/dist/node/run/run.presentation.js +1 -223
- package/dist/node/run/run.schema.js +1 -179
- package/dist/node/run/run.test-spec.js +1 -58
- package/dist/node/seeders/index.js +2 -21
- package/dist/node/shared/index.js +1 -626
- package/dist/node/shared/mock-agents.js +1 -82
- package/dist/node/shared/mock-runs.js +1 -113
- package/dist/node/shared/mock-tools.js +1 -146
- package/dist/node/tool/index.js +1 -949
- package/dist/node/tool/tool.entity.js +1 -90
- package/dist/node/tool/tool.enum.js +1 -26
- package/dist/node/tool/tool.event.js +1 -99
- package/dist/node/tool/tool.handler.js +1 -699
- package/dist/node/tool/tool.operation.js +1 -482
- package/dist/node/tool/tool.presentation.js +1 -188
- package/dist/node/tool/tool.schema.js +1 -141
- package/dist/node/tool/tool.test-spec.js +1 -58
- package/dist/node/ui/AgentDashboard.js +1 -2527
- package/dist/node/ui/AgentDashboard.visualizations.js +1 -217
- package/dist/node/ui/AgentRunList.js +1 -482
- package/dist/node/ui/AgentToolRegistry.js +1 -212
- package/dist/node/ui/ExecutionConsoleHost.js +1 -0
- package/dist/node/ui/hooks/index.js +1 -740
- package/dist/node/ui/hooks/useAgentList.js +1 -55
- package/dist/node/ui/hooks/useAgentMutations.js +1 -530
- package/dist/node/ui/hooks/useRunList.js +1 -70
- package/dist/node/ui/hooks/useToolList.js +1 -85
- package/dist/node/ui/index.js +5 -3018
- package/dist/node/ui/modals/AgentActionsModal.js +1 -304
- package/dist/node/ui/modals/CreateAgentModal.js +1 -243
- package/dist/node/ui/modals/index.js +1 -546
- package/dist/node/ui/overlays/demo-overlays.js +1 -64
- package/dist/node/ui/overlays/index.js +1 -64
- package/dist/node/ui/renderers/agent-list.markdown.js +2 -64
- package/dist/node/ui/renderers/agent-list.renderer.js +1 -180
- package/dist/node/ui/renderers/dashboard.markdown.js +2 -288
- package/dist/node/ui/renderers/index.js +5 -642
- package/dist/node/ui/renderers/run-list.markdown.js +2 -50
- package/dist/node/ui/renderers/tool-registry.markdown.js +2 -64
- package/dist/node/ui/views/AgentListView.js +1 -165
- package/dist/node/ui/views/RunDataTable.js +1 -326
- package/dist/node/ui/views/RunListView.js +1 -479
- package/dist/node/ui/views/ToolRegistryView.js +1 -209
- package/dist/node/ui/views/index.js +1 -851
- package/dist/node/ui/views/run-data-table.columns.js +1 -271
- package/dist/node/ui/views/run-list.shared.js +1 -177
- package/dist/node/visualizations/catalog.js +1 -134
- package/dist/node/visualizations/index.js +1 -187
- package/dist/node/visualizations/selectors.js +1 -181
- package/dist/presentations/index.js +1 -693
- package/dist/run/index.js +1 -1363
- package/dist/run/run.entity.js +1 -160
- package/dist/run/run.enum.js +1 -34
- package/dist/run/run.event.js +1 -217
- package/dist/run/run.handler.js +1 -919
- package/dist/run/run.operation.js +1 -667
- package/dist/run/run.presentation.js +1 -223
- package/dist/run/run.schema.js +1 -179
- package/dist/run/run.test-spec.js +1 -58
- package/dist/seeders/index.js +2 -21
- package/dist/shared/index.js +1 -626
- package/dist/shared/mock-agents.js +1 -82
- package/dist/shared/mock-runs.js +1 -113
- package/dist/shared/mock-tools.js +1 -146
- package/dist/tool/index.js +1 -949
- package/dist/tool/tool.entity.js +1 -90
- package/dist/tool/tool.enum.js +1 -26
- package/dist/tool/tool.event.js +1 -99
- package/dist/tool/tool.handler.js +1 -699
- package/dist/tool/tool.operation.js +1 -482
- package/dist/tool/tool.presentation.js +1 -188
- package/dist/tool/tool.schema.js +1 -141
- package/dist/tool/tool.test-spec.js +1 -58
- package/dist/ui/AgentDashboard.js +1 -2527
- package/dist/ui/AgentDashboard.visualizations.js +1 -217
- package/dist/ui/AgentRunList.js +1 -482
- package/dist/ui/AgentToolRegistry.js +1 -212
- package/dist/ui/ExecutionConsoleHost.d.ts +1 -0
- package/dist/ui/ExecutionConsoleHost.js +2 -0
- package/dist/ui/ExecutionConsoleHost.test.d.ts +1 -0
- package/dist/ui/hooks/index.js +1 -740
- package/dist/ui/hooks/useAgentList.js +1 -55
- package/dist/ui/hooks/useAgentMutations.js +1 -530
- package/dist/ui/hooks/useRunList.js +1 -70
- package/dist/ui/hooks/useToolList.js +1 -85
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +5 -3018
- package/dist/ui/modals/AgentActionsModal.js +1 -304
- package/dist/ui/modals/CreateAgentModal.js +1 -243
- package/dist/ui/modals/index.js +1 -546
- package/dist/ui/overlays/demo-overlays.js +1 -64
- package/dist/ui/overlays/index.js +1 -64
- package/dist/ui/renderers/agent-list.markdown.js +2 -64
- package/dist/ui/renderers/agent-list.renderer.js +1 -180
- package/dist/ui/renderers/dashboard.markdown.js +2 -288
- package/dist/ui/renderers/index.js +5 -642
- package/dist/ui/renderers/run-list.markdown.js +2 -50
- package/dist/ui/renderers/tool-registry.markdown.js +2 -64
- package/dist/ui/views/AgentListView.js +1 -165
- package/dist/ui/views/RunDataTable.js +1 -326
- package/dist/ui/views/RunListView.js +1 -479
- package/dist/ui/views/ToolRegistryView.js +1 -209
- package/dist/ui/views/index.js +1 -851
- package/dist/ui/views/run-data-table.columns.js +1 -271
- package/dist/ui/views/run-list.shared.js +1 -177
- package/dist/visualizations/catalog.js +1 -134
- package/dist/visualizations/index.js +1 -187
- package/dist/visualizations/selectors.js +1 -181
- package/package.json +29 -13
- package/src/ui/ExecutionConsoleHost.test.tsx +110 -0
- package/src/ui/ExecutionConsoleHost.tsx +14 -0
- package/src/ui/index.ts +1 -1
package/dist/shared/index.js
CHANGED
|
@@ -1,627 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/shared/mock-agents.ts
|
|
3
|
-
var MOCK_AGENTS = [
|
|
4
|
-
{
|
|
5
|
-
id: "agent-1",
|
|
6
|
-
organizationId: "demo-org",
|
|
7
|
-
name: "Customer Support Bot",
|
|
8
|
-
slug: "customer-support-bot",
|
|
9
|
-
description: "Handles tier-1 customer inquiries and routes complex issues.",
|
|
10
|
-
status: "ACTIVE",
|
|
11
|
-
modelProvider: "OPENAI",
|
|
12
|
-
modelName: "gpt-4o-mini",
|
|
13
|
-
modelConfig: { temperature: 0.7 },
|
|
14
|
-
systemPrompt: "You are a helpful customer support assistant.",
|
|
15
|
-
toolChoice: "auto",
|
|
16
|
-
maxIterations: 10,
|
|
17
|
-
timeoutMs: 120000,
|
|
18
|
-
version: "1.0.0",
|
|
19
|
-
tags: ["support", "tier-1"],
|
|
20
|
-
createdAt: new Date("2024-01-15T10:00:00Z"),
|
|
21
|
-
updatedAt: new Date("2024-03-20T14:30:00Z")
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: "agent-2",
|
|
25
|
-
organizationId: "demo-org",
|
|
26
|
-
name: "Code Review Assistant",
|
|
27
|
-
slug: "code-review-assistant",
|
|
28
|
-
description: "Reviews pull requests and provides actionable feedback.",
|
|
29
|
-
status: "ACTIVE",
|
|
30
|
-
modelProvider: "ANTHROPIC",
|
|
31
|
-
modelName: "claude-sonnet-4-20250514",
|
|
32
|
-
modelConfig: { temperature: 0.3 },
|
|
33
|
-
systemPrompt: "You are a code review expert.",
|
|
34
|
-
toolChoice: "auto",
|
|
35
|
-
maxIterations: 15,
|
|
36
|
-
timeoutMs: 180000,
|
|
37
|
-
version: "2.1.0",
|
|
38
|
-
tags: ["code", "review", "dev"],
|
|
39
|
-
createdAt: new Date("2024-02-10T09:00:00Z"),
|
|
40
|
-
updatedAt: new Date("2024-04-05T11:15:00Z")
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: "agent-3",
|
|
44
|
-
organizationId: "demo-org",
|
|
45
|
-
name: "Data Analyst",
|
|
46
|
-
slug: "data-analyst",
|
|
47
|
-
description: "Queries databases and generates insights from data.",
|
|
48
|
-
status: "PAUSED",
|
|
49
|
-
modelProvider: "OPENAI",
|
|
50
|
-
modelName: "gpt-4o",
|
|
51
|
-
modelConfig: { temperature: 0.5 },
|
|
52
|
-
systemPrompt: "You are a data analyst expert in SQL and analytics.",
|
|
53
|
-
toolChoice: "required",
|
|
54
|
-
maxIterations: 20,
|
|
55
|
-
timeoutMs: 300000,
|
|
56
|
-
version: "1.2.0",
|
|
57
|
-
tags: ["data", "analytics", "sql"],
|
|
58
|
-
createdAt: new Date("2024-03-01T08:00:00Z"),
|
|
59
|
-
updatedAt: new Date("2024-04-10T16:45:00Z")
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: "agent-4",
|
|
63
|
-
organizationId: "demo-org",
|
|
64
|
-
name: "Meeting Scheduler",
|
|
65
|
-
slug: "meeting-scheduler",
|
|
66
|
-
description: "Schedules meetings and manages calendar conflicts.",
|
|
67
|
-
status: "DRAFT",
|
|
68
|
-
modelProvider: "GOOGLE",
|
|
69
|
-
modelName: "gemini-2.0-flash",
|
|
70
|
-
modelConfig: { temperature: 0.2 },
|
|
71
|
-
systemPrompt: "You help schedule and organize meetings efficiently.",
|
|
72
|
-
toolChoice: "auto",
|
|
73
|
-
maxIterations: 5,
|
|
74
|
-
timeoutMs: 60000,
|
|
75
|
-
version: "0.1.0",
|
|
76
|
-
tags: ["calendar", "scheduling"],
|
|
77
|
-
createdAt: new Date("2024-04-01T12:00:00Z"),
|
|
78
|
-
updatedAt: new Date("2024-04-01T12:00:00Z")
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
// src/shared/mock-tools.ts
|
|
83
|
-
var MOCK_TOOLS = [
|
|
84
|
-
{
|
|
85
|
-
id: "tool-1",
|
|
86
|
-
organizationId: "demo-org",
|
|
87
|
-
name: "Web Search",
|
|
88
|
-
slug: "web-search",
|
|
89
|
-
description: "Search the web for real-time information using Brave API.",
|
|
90
|
-
category: "RETRIEVAL",
|
|
91
|
-
status: "ACTIVE",
|
|
92
|
-
parametersSchema: {
|
|
93
|
-
type: "object",
|
|
94
|
-
properties: {
|
|
95
|
-
query: { type: "string", description: "Search query" },
|
|
96
|
-
numResults: { type: "number", default: 10 }
|
|
97
|
-
},
|
|
98
|
-
required: ["query"]
|
|
99
|
-
},
|
|
100
|
-
outputSchema: { type: "array", items: { type: "object" } },
|
|
101
|
-
implementationType: "http",
|
|
102
|
-
implementationConfig: {
|
|
103
|
-
url: "https://api.brave.com/search",
|
|
104
|
-
method: "GET"
|
|
105
|
-
},
|
|
106
|
-
maxInvocationsPerMinute: 60,
|
|
107
|
-
timeoutMs: 30000,
|
|
108
|
-
version: "1.0.0",
|
|
109
|
-
tags: ["search", "web"],
|
|
110
|
-
createdAt: new Date("2024-01-01T00:00:00Z"),
|
|
111
|
-
updatedAt: new Date("2024-02-15T10:00:00Z")
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
id: "tool-2",
|
|
115
|
-
organizationId: "demo-org",
|
|
116
|
-
name: "SQL Query",
|
|
117
|
-
slug: "sql-query",
|
|
118
|
-
description: "Execute read-only SQL queries against the data warehouse.",
|
|
119
|
-
category: "RETRIEVAL",
|
|
120
|
-
status: "ACTIVE",
|
|
121
|
-
parametersSchema: {
|
|
122
|
-
type: "object",
|
|
123
|
-
properties: {
|
|
124
|
-
query: { type: "string", description: "SQL query" },
|
|
125
|
-
maxRows: { type: "number", default: 100 }
|
|
126
|
-
},
|
|
127
|
-
required: ["query"]
|
|
128
|
-
},
|
|
129
|
-
outputSchema: { type: "object" },
|
|
130
|
-
implementationType: "function",
|
|
131
|
-
implementationConfig: { handler: "executeSqlQuery" },
|
|
132
|
-
maxInvocationsPerMinute: 30,
|
|
133
|
-
timeoutMs: 60000,
|
|
134
|
-
version: "1.1.0",
|
|
135
|
-
tags: ["sql", "database"],
|
|
136
|
-
createdAt: new Date("2024-01-05T00:00:00Z"),
|
|
137
|
-
updatedAt: new Date("2024-03-10T14:00:00Z")
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: "tool-3",
|
|
141
|
-
organizationId: "demo-org",
|
|
142
|
-
name: "Email Sender",
|
|
143
|
-
slug: "email-sender",
|
|
144
|
-
description: "Send emails via SMTP or API.",
|
|
145
|
-
category: "COMMUNICATION",
|
|
146
|
-
status: "ACTIVE",
|
|
147
|
-
parametersSchema: {
|
|
148
|
-
type: "object",
|
|
149
|
-
properties: {
|
|
150
|
-
to: { type: "string" },
|
|
151
|
-
subject: { type: "string" },
|
|
152
|
-
body: { type: "string" }
|
|
153
|
-
},
|
|
154
|
-
required: ["to", "subject", "body"]
|
|
155
|
-
},
|
|
156
|
-
implementationType: "http",
|
|
157
|
-
implementationConfig: { url: "/api/send-email", method: "POST" },
|
|
158
|
-
maxInvocationsPerMinute: 10,
|
|
159
|
-
timeoutMs: 30000,
|
|
160
|
-
version: "1.0.0",
|
|
161
|
-
tags: ["email", "communication"],
|
|
162
|
-
createdAt: new Date("2024-02-01T00:00:00Z"),
|
|
163
|
-
updatedAt: new Date("2024-02-01T00:00:00Z")
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: "tool-4",
|
|
167
|
-
organizationId: "demo-org",
|
|
168
|
-
name: "GitHub Integration",
|
|
169
|
-
slug: "github-integration",
|
|
170
|
-
description: "Interact with GitHub repositories, PRs, and issues.",
|
|
171
|
-
category: "INTEGRATION",
|
|
172
|
-
status: "ACTIVE",
|
|
173
|
-
parametersSchema: {
|
|
174
|
-
type: "object",
|
|
175
|
-
properties: {
|
|
176
|
-
action: {
|
|
177
|
-
type: "string",
|
|
178
|
-
enum: ["list_prs", "get_pr", "create_comment"]
|
|
179
|
-
},
|
|
180
|
-
repo: { type: "string" },
|
|
181
|
-
params: { type: "object" }
|
|
182
|
-
},
|
|
183
|
-
required: ["action", "repo"]
|
|
184
|
-
},
|
|
185
|
-
implementationType: "http",
|
|
186
|
-
implementationConfig: { url: "https://api.github.com", auth: "token" },
|
|
187
|
-
maxInvocationsPerMinute: 100,
|
|
188
|
-
timeoutMs: 15000,
|
|
189
|
-
version: "2.0.0",
|
|
190
|
-
tags: ["github", "integration", "code"],
|
|
191
|
-
createdAt: new Date("2024-02-20T00:00:00Z"),
|
|
192
|
-
updatedAt: new Date("2024-04-01T09:00:00Z")
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
id: "tool-5",
|
|
196
|
-
organizationId: "demo-org",
|
|
197
|
-
name: "Calculator",
|
|
198
|
-
slug: "calculator",
|
|
199
|
-
description: "Perform mathematical calculations.",
|
|
200
|
-
category: "COMPUTATION",
|
|
201
|
-
status: "ACTIVE",
|
|
202
|
-
parametersSchema: {
|
|
203
|
-
type: "object",
|
|
204
|
-
properties: {
|
|
205
|
-
expression: {
|
|
206
|
-
type: "string",
|
|
207
|
-
description: "Math expression to evaluate"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
required: ["expression"]
|
|
211
|
-
},
|
|
212
|
-
outputSchema: {
|
|
213
|
-
type: "object",
|
|
214
|
-
properties: { result: { type: "number" } }
|
|
215
|
-
},
|
|
216
|
-
implementationType: "function",
|
|
217
|
-
implementationConfig: { handler: "evaluateMath" },
|
|
218
|
-
timeoutMs: 5000,
|
|
219
|
-
version: "1.0.0",
|
|
220
|
-
tags: ["math", "utility"],
|
|
221
|
-
createdAt: new Date("2024-01-10T00:00:00Z"),
|
|
222
|
-
updatedAt: new Date("2024-01-10T00:00:00Z")
|
|
223
|
-
}
|
|
224
|
-
];
|
|
225
|
-
|
|
226
|
-
// src/shared/mock-runs.ts
|
|
227
|
-
var MOCK_RUNS = [
|
|
228
|
-
{
|
|
229
|
-
id: "run-1",
|
|
230
|
-
organizationId: "demo-org",
|
|
231
|
-
projectId: "demo-project",
|
|
232
|
-
agentId: "agent-1",
|
|
233
|
-
agentName: "Customer Support Bot",
|
|
234
|
-
userId: "user-1",
|
|
235
|
-
sessionId: "session-1",
|
|
236
|
-
input: { message: "How do I reset my password?", context: {} },
|
|
237
|
-
output: { response: "You can reset your password by clicking..." },
|
|
238
|
-
status: "COMPLETED",
|
|
239
|
-
totalTokens: 1250,
|
|
240
|
-
promptTokens: 800,
|
|
241
|
-
completionTokens: 450,
|
|
242
|
-
totalIterations: 3,
|
|
243
|
-
durationMs: 4500,
|
|
244
|
-
estimatedCostUsd: 0.0025,
|
|
245
|
-
queuedAt: new Date("2024-04-15T10:00:00Z"),
|
|
246
|
-
startedAt: new Date("2024-04-15T10:00:01Z"),
|
|
247
|
-
completedAt: new Date("2024-04-15T10:00:05Z"),
|
|
248
|
-
steps: [],
|
|
249
|
-
logs: []
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
id: "run-2",
|
|
253
|
-
organizationId: "demo-org",
|
|
254
|
-
projectId: "demo-project",
|
|
255
|
-
agentId: "agent-2",
|
|
256
|
-
agentName: "Code Review Assistant",
|
|
257
|
-
userId: "user-2",
|
|
258
|
-
input: { message: "Review PR #123", context: { prNumber: 123 } },
|
|
259
|
-
status: "IN_PROGRESS",
|
|
260
|
-
totalTokens: 3500,
|
|
261
|
-
promptTokens: 3000,
|
|
262
|
-
completionTokens: 500,
|
|
263
|
-
totalIterations: 5,
|
|
264
|
-
queuedAt: new Date("2024-04-15T10:30:00Z"),
|
|
265
|
-
startedAt: new Date("2024-04-15T10:30:02Z"),
|
|
266
|
-
steps: [],
|
|
267
|
-
logs: []
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
id: "run-3",
|
|
271
|
-
organizationId: "demo-org",
|
|
272
|
-
projectId: "demo-project",
|
|
273
|
-
agentId: "agent-1",
|
|
274
|
-
agentName: "Customer Support Bot",
|
|
275
|
-
userId: "user-1",
|
|
276
|
-
input: { message: "What are your business hours?" },
|
|
277
|
-
output: { response: "Our business hours are 9 AM to 5 PM EST..." },
|
|
278
|
-
status: "COMPLETED",
|
|
279
|
-
totalTokens: 800,
|
|
280
|
-
promptTokens: 500,
|
|
281
|
-
completionTokens: 300,
|
|
282
|
-
totalIterations: 2,
|
|
283
|
-
durationMs: 2100,
|
|
284
|
-
estimatedCostUsd: 0.0012,
|
|
285
|
-
queuedAt: new Date("2024-04-15T09:00:00Z"),
|
|
286
|
-
startedAt: new Date("2024-04-15T09:00:01Z"),
|
|
287
|
-
completedAt: new Date("2024-04-15T09:00:03Z"),
|
|
288
|
-
steps: [],
|
|
289
|
-
logs: []
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
id: "run-4",
|
|
293
|
-
organizationId: "demo-org",
|
|
294
|
-
projectId: "demo-project",
|
|
295
|
-
agentId: "agent-3",
|
|
296
|
-
agentName: "Data Analyst",
|
|
297
|
-
userId: "user-3",
|
|
298
|
-
input: { message: "Generate sales report for Q1" },
|
|
299
|
-
status: "FAILED",
|
|
300
|
-
errorMessage: "Database connection timeout",
|
|
301
|
-
errorCode: "DB_TIMEOUT",
|
|
302
|
-
totalTokens: 2000,
|
|
303
|
-
promptTokens: 1500,
|
|
304
|
-
completionTokens: 500,
|
|
305
|
-
totalIterations: 8,
|
|
306
|
-
durationMs: 45000,
|
|
307
|
-
queuedAt: new Date("2024-04-14T15:00:00Z"),
|
|
308
|
-
startedAt: new Date("2024-04-14T15:00:05Z"),
|
|
309
|
-
completedAt: new Date("2024-04-14T15:00:50Z"),
|
|
310
|
-
steps: [],
|
|
311
|
-
logs: []
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
id: "run-5",
|
|
315
|
-
organizationId: "demo-org",
|
|
316
|
-
projectId: "demo-project",
|
|
317
|
-
agentId: "agent-2",
|
|
318
|
-
agentName: "Code Review Assistant",
|
|
319
|
-
userId: "user-2",
|
|
320
|
-
input: { message: "Review PR #120" },
|
|
321
|
-
output: { response: "Code review complete. 3 suggestions..." },
|
|
322
|
-
status: "COMPLETED",
|
|
323
|
-
totalTokens: 5200,
|
|
324
|
-
promptTokens: 4000,
|
|
325
|
-
completionTokens: 1200,
|
|
326
|
-
totalIterations: 7,
|
|
327
|
-
durationMs: 15000,
|
|
328
|
-
estimatedCostUsd: 0.0156,
|
|
329
|
-
queuedAt: new Date("2024-04-14T11:00:00Z"),
|
|
330
|
-
startedAt: new Date("2024-04-14T11:00:03Z"),
|
|
331
|
-
completedAt: new Date("2024-04-14T11:00:18Z"),
|
|
332
|
-
steps: [],
|
|
333
|
-
logs: []
|
|
334
|
-
}
|
|
335
|
-
];
|
|
336
|
-
|
|
337
|
-
// src/shared/demo-runtime-seed.ts
|
|
338
|
-
var AGENT_CONSOLE_DEMO_ORGANIZATION_ID = "demo-org";
|
|
339
|
-
var AGENT_CONSOLE_DEMO_PROJECT_ID = "agent-console-demo";
|
|
340
|
-
function slugify(name) {
|
|
341
|
-
return name.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
342
|
-
}
|
|
343
|
-
function cloneAgent(agent) {
|
|
344
|
-
return { ...agent };
|
|
345
|
-
}
|
|
346
|
-
function cloneTool(tool) {
|
|
347
|
-
return { ...tool };
|
|
348
|
-
}
|
|
349
|
-
function cloneRun(run) {
|
|
350
|
-
return { ...run };
|
|
351
|
-
}
|
|
352
|
-
function createDefaultNow() {
|
|
353
|
-
let tick = 0;
|
|
354
|
-
const base = Date.parse("2026-03-20T09:00:00.000Z");
|
|
355
|
-
return () => new Date(base + tick++ * 60000);
|
|
356
|
-
}
|
|
357
|
-
function normalizeProvider(provider) {
|
|
358
|
-
return provider.toLowerCase();
|
|
359
|
-
}
|
|
360
|
-
function normalizeRunStatus(status) {
|
|
361
|
-
return status === "IN_PROGRESS" ? "RUNNING" : status;
|
|
362
|
-
}
|
|
363
|
-
function createSeedState(projectId, organizationId) {
|
|
364
|
-
const agents = MOCK_AGENTS.map((agent) => ({
|
|
365
|
-
id: agent.id,
|
|
366
|
-
projectId,
|
|
367
|
-
organizationId,
|
|
368
|
-
name: agent.name,
|
|
369
|
-
slug: agent.slug,
|
|
370
|
-
description: agent.description,
|
|
371
|
-
modelProvider: normalizeProvider(agent.modelProvider),
|
|
372
|
-
modelName: agent.modelName,
|
|
373
|
-
systemPrompt: agent.systemPrompt,
|
|
374
|
-
temperature: typeof agent.modelConfig?.temperature === "number" ? agent.modelConfig.temperature : 0.4,
|
|
375
|
-
maxTokens: 8192,
|
|
376
|
-
status: agent.status,
|
|
377
|
-
createdAt: agent.createdAt,
|
|
378
|
-
updatedAt: agent.updatedAt
|
|
379
|
-
}));
|
|
380
|
-
const tools = MOCK_TOOLS.map((tool) => ({
|
|
381
|
-
id: tool.id,
|
|
382
|
-
projectId,
|
|
383
|
-
organizationId,
|
|
384
|
-
name: tool.name,
|
|
385
|
-
description: tool.description,
|
|
386
|
-
version: tool.version,
|
|
387
|
-
category: tool.category,
|
|
388
|
-
status: tool.status,
|
|
389
|
-
inputSchema: JSON.stringify(tool.parametersSchema),
|
|
390
|
-
outputSchema: tool.outputSchema ? JSON.stringify(tool.outputSchema) : undefined,
|
|
391
|
-
endpoint: typeof tool.implementationConfig?.url === "string" ? tool.implementationConfig.url : undefined,
|
|
392
|
-
createdAt: tool.createdAt,
|
|
393
|
-
updatedAt: tool.updatedAt
|
|
394
|
-
}));
|
|
395
|
-
const agentNames = new Map(agents.map((agent) => [agent.id, agent.name]));
|
|
396
|
-
const runs = MOCK_RUNS.map((run) => ({
|
|
397
|
-
id: run.id,
|
|
398
|
-
projectId,
|
|
399
|
-
agentId: run.agentId,
|
|
400
|
-
agentName: agentNames.get(run.agentId) ?? run.agentName ?? "Unknown agent",
|
|
401
|
-
status: normalizeRunStatus(run.status),
|
|
402
|
-
input: JSON.stringify(run.input),
|
|
403
|
-
output: run.output ? JSON.stringify(run.output) : undefined,
|
|
404
|
-
totalTokens: run.totalTokens,
|
|
405
|
-
promptTokens: run.promptTokens,
|
|
406
|
-
completionTokens: run.completionTokens,
|
|
407
|
-
estimatedCostUsd: run.estimatedCostUsd ?? 0,
|
|
408
|
-
durationMs: run.durationMs,
|
|
409
|
-
errorMessage: run.errorMessage,
|
|
410
|
-
queuedAt: run.queuedAt,
|
|
411
|
-
startedAt: run.startedAt,
|
|
412
|
-
completedAt: run.completedAt
|
|
413
|
-
}));
|
|
414
|
-
return { agents, tools, runs };
|
|
415
|
-
}
|
|
416
|
-
function summarizeRunMetrics(runs) {
|
|
417
|
-
const totalRuns = runs.length;
|
|
418
|
-
const completedRuns = runs.filter((run) => run.status === "COMPLETED").length;
|
|
419
|
-
const completedDurations = runs.map((run) => run.durationMs).filter((duration) => typeof duration === "number");
|
|
420
|
-
return {
|
|
421
|
-
totalRuns,
|
|
422
|
-
successRate: totalRuns === 0 ? 0 : completedRuns / totalRuns,
|
|
423
|
-
averageDurationMs: completedDurations.length === 0 ? 0 : Math.round(completedDurations.reduce((sum, duration) => sum + duration, 0) / completedDurations.length),
|
|
424
|
-
totalTokens: runs.reduce((sum, run) => sum + run.totalTokens, 0),
|
|
425
|
-
totalCostUsd: runs.reduce((sum, run) => sum + run.estimatedCostUsd, 0)
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// src/shared/demo-runtime.ts
|
|
430
|
-
function createAgentConsoleDemoHandlers(options) {
|
|
431
|
-
const projectId = options.projectId;
|
|
432
|
-
const organizationId = options.organizationId ?? AGENT_CONSOLE_DEMO_ORGANIZATION_ID;
|
|
433
|
-
const now = options.now ?? createDefaultNow();
|
|
434
|
-
const state = createSeedState(projectId, organizationId);
|
|
435
|
-
let agentIndex = state.agents.length + 1;
|
|
436
|
-
let runIndex = state.runs.length + 1;
|
|
437
|
-
const nextId = (kind) => {
|
|
438
|
-
const nextIndex = kind === "agent" ? agentIndex++ : runIndex++;
|
|
439
|
-
return options.idFactory?.(kind, nextIndex) ?? `${kind}-demo-${nextIndex}`;
|
|
440
|
-
};
|
|
441
|
-
return {
|
|
442
|
-
async listAgents(input) {
|
|
443
|
-
const filtered = state.agents.filter((agent) => agent.projectId === input.projectId).filter((agent) => !input.organizationId || agent.organizationId === input.organizationId).filter((agent) => !input.status || input.status === "all" || agent.status === input.status).filter((agent) => {
|
|
444
|
-
if (!input.search)
|
|
445
|
-
return true;
|
|
446
|
-
const query = input.search.toLowerCase();
|
|
447
|
-
return agent.name.toLowerCase().includes(query) || (agent.description ?? "").toLowerCase().includes(query);
|
|
448
|
-
}).sort((left, right) => right.updatedAt.getTime() - left.updatedAt.getTime());
|
|
449
|
-
const limit = input.limit ?? 20;
|
|
450
|
-
const offset = input.offset ?? 0;
|
|
451
|
-
const items = filtered.slice(offset, offset + limit).map(cloneAgent);
|
|
452
|
-
return {
|
|
453
|
-
items,
|
|
454
|
-
total: filtered.length,
|
|
455
|
-
hasMore: offset + items.length < filtered.length
|
|
456
|
-
};
|
|
457
|
-
},
|
|
458
|
-
async getAgent(id) {
|
|
459
|
-
const agent = state.agents.find((item) => item.id === id);
|
|
460
|
-
return agent ? cloneAgent(agent) : null;
|
|
461
|
-
},
|
|
462
|
-
async createAgent(input, context) {
|
|
463
|
-
const name = input.name.trim();
|
|
464
|
-
const slug = slugify(name);
|
|
465
|
-
const duplicate = state.agents.find((agent2) => agent2.projectId === context.projectId && agent2.organizationId === context.organizationId && (agent2.slug === slug || agent2.name.toLowerCase() === name.toLowerCase()));
|
|
466
|
-
if (duplicate)
|
|
467
|
-
throw new Error("AGENT_NAME_OR_SLUG_EXISTS");
|
|
468
|
-
const timestamp = now();
|
|
469
|
-
const agent = {
|
|
470
|
-
id: nextId("agent"),
|
|
471
|
-
projectId: context.projectId,
|
|
472
|
-
organizationId: context.organizationId,
|
|
473
|
-
name,
|
|
474
|
-
slug,
|
|
475
|
-
description: input.description,
|
|
476
|
-
modelProvider: input.modelProvider ?? "openai",
|
|
477
|
-
modelName: input.modelName ?? "gpt-5.4",
|
|
478
|
-
systemPrompt: input.systemPrompt,
|
|
479
|
-
temperature: input.temperature ?? 0.4,
|
|
480
|
-
maxTokens: input.maxTokens ?? 8192,
|
|
481
|
-
status: "DRAFT",
|
|
482
|
-
createdAt: timestamp,
|
|
483
|
-
updatedAt: timestamp
|
|
484
|
-
};
|
|
485
|
-
state.agents.unshift(agent);
|
|
486
|
-
return cloneAgent(agent);
|
|
487
|
-
},
|
|
488
|
-
async updateAgent(input) {
|
|
489
|
-
const agent = state.agents.find((item) => item.id === input.id);
|
|
490
|
-
if (!agent)
|
|
491
|
-
throw new Error("AGENT_NOT_FOUND");
|
|
492
|
-
const nextName = input.name;
|
|
493
|
-
if (nextName && slugify(nextName) !== agent.slug) {
|
|
494
|
-
const duplicate = state.agents.find((item) => item.id !== agent.id && item.projectId === agent.projectId && item.organizationId === agent.organizationId && (item.slug === slugify(nextName) || item.name.toLowerCase() === nextName.toLowerCase()));
|
|
495
|
-
if (duplicate)
|
|
496
|
-
throw new Error("AGENT_NAME_OR_SLUG_EXISTS");
|
|
497
|
-
agent.slug = slugify(nextName);
|
|
498
|
-
agent.name = nextName;
|
|
499
|
-
}
|
|
500
|
-
if (input.description !== undefined)
|
|
501
|
-
agent.description = input.description;
|
|
502
|
-
if (input.status)
|
|
503
|
-
agent.status = input.status;
|
|
504
|
-
agent.updatedAt = now();
|
|
505
|
-
return cloneAgent(agent);
|
|
506
|
-
},
|
|
507
|
-
async executeAgent(input) {
|
|
508
|
-
const agent = state.agents.find((item) => item.id === input.agentId);
|
|
509
|
-
if (!agent)
|
|
510
|
-
throw new Error("AGENT_NOT_FOUND");
|
|
511
|
-
if (agent.status !== "ACTIVE")
|
|
512
|
-
throw new Error("AGENT_NOT_ACTIVE");
|
|
513
|
-
const queuedAt = now();
|
|
514
|
-
const startedAt = now();
|
|
515
|
-
const completedAt = now();
|
|
516
|
-
const durationMs = 2200 + input.message.length * 12;
|
|
517
|
-
const promptTokens = 600 + input.message.length * 3;
|
|
518
|
-
const completionTokens = 240 + agent.name.length * 4;
|
|
519
|
-
const run = {
|
|
520
|
-
id: nextId("run"),
|
|
521
|
-
projectId: input.context?.projectId ?? agent.projectId,
|
|
522
|
-
agentId: agent.id,
|
|
523
|
-
agentName: agent.name,
|
|
524
|
-
status: "COMPLETED",
|
|
525
|
-
input: input.message,
|
|
526
|
-
output: `Deterministic demo reply from ${agent.name}: ${input.message}`,
|
|
527
|
-
totalTokens: promptTokens + completionTokens,
|
|
528
|
-
promptTokens,
|
|
529
|
-
completionTokens,
|
|
530
|
-
estimatedCostUsd: Number(((promptTokens + completionTokens) / 1e6).toFixed(4)),
|
|
531
|
-
durationMs,
|
|
532
|
-
queuedAt,
|
|
533
|
-
startedAt,
|
|
534
|
-
completedAt
|
|
535
|
-
};
|
|
536
|
-
state.runs.unshift(run);
|
|
537
|
-
return cloneRun(run);
|
|
538
|
-
},
|
|
539
|
-
async listTools(input) {
|
|
540
|
-
const filtered = state.tools.filter((tool) => tool.projectId === input.projectId).filter((tool) => !input.organizationId || tool.organizationId === input.organizationId).filter((tool) => !input.category || input.category === "all" || tool.category === input.category).filter((tool) => !input.status || input.status === "all" || tool.status === input.status).filter((tool) => {
|
|
541
|
-
if (!input.search)
|
|
542
|
-
return true;
|
|
543
|
-
const query = input.search.toLowerCase();
|
|
544
|
-
return tool.name.toLowerCase().includes(query) || (tool.description ?? "").toLowerCase().includes(query);
|
|
545
|
-
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
546
|
-
const limit = input.limit ?? 50;
|
|
547
|
-
const offset = input.offset ?? 0;
|
|
548
|
-
const items = filtered.slice(offset, offset + limit).map(cloneTool);
|
|
549
|
-
return {
|
|
550
|
-
items,
|
|
551
|
-
total: filtered.length,
|
|
552
|
-
hasMore: offset + items.length < filtered.length
|
|
553
|
-
};
|
|
554
|
-
},
|
|
555
|
-
async listRuns(input) {
|
|
556
|
-
const filtered = state.runs.filter((run) => run.projectId === input.projectId).filter((run) => !input.agentId || run.agentId === input.agentId).filter((run) => !input.status || input.status === "all" || run.status === input.status).sort((left, right) => right.queuedAt.getTime() - left.queuedAt.getTime());
|
|
557
|
-
const limit = input.limit ?? 20;
|
|
558
|
-
const offset = input.offset ?? 0;
|
|
559
|
-
const items = filtered.slice(offset, offset + limit).map(cloneRun);
|
|
560
|
-
return {
|
|
561
|
-
items,
|
|
562
|
-
total: filtered.length,
|
|
563
|
-
hasMore: offset + items.length < filtered.length
|
|
564
|
-
};
|
|
565
|
-
},
|
|
566
|
-
async getRunMetrics(input) {
|
|
567
|
-
const filtered = state.runs.filter((run) => {
|
|
568
|
-
if (run.projectId !== input.projectId)
|
|
569
|
-
return false;
|
|
570
|
-
if (input.agentId && run.agentId !== input.agentId)
|
|
571
|
-
return false;
|
|
572
|
-
if (input.startDate && run.queuedAt < input.startDate)
|
|
573
|
-
return false;
|
|
574
|
-
if (input.endDate && run.queuedAt > input.endDate)
|
|
575
|
-
return false;
|
|
576
|
-
return true;
|
|
577
|
-
});
|
|
578
|
-
return summarizeRunMetrics(filtered);
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
// src/shared/demo-dashboard-data.ts
|
|
584
|
-
async function getAgentConsoleDashboardData(handlers, params) {
|
|
585
|
-
const organizationId = params.organizationId ?? AGENT_CONSOLE_DEMO_ORGANIZATION_ID;
|
|
586
|
-
const [agentsResult, runsResult, toolsResult] = await Promise.all([
|
|
587
|
-
handlers.listAgents({
|
|
588
|
-
projectId: params.projectId,
|
|
589
|
-
organizationId,
|
|
590
|
-
limit: 10
|
|
591
|
-
}),
|
|
592
|
-
handlers.listRuns({ projectId: params.projectId, limit: 10 }),
|
|
593
|
-
handlers.listTools({
|
|
594
|
-
projectId: params.projectId,
|
|
595
|
-
organizationId,
|
|
596
|
-
limit: 10
|
|
597
|
-
})
|
|
598
|
-
]);
|
|
599
|
-
return {
|
|
600
|
-
agents: agentsResult.items,
|
|
601
|
-
runs: runsResult.items,
|
|
602
|
-
tools: toolsResult.items,
|
|
603
|
-
summary: {
|
|
604
|
-
totalAgents: agentsResult.total,
|
|
605
|
-
totalRuns: runsResult.total,
|
|
606
|
-
totalTools: toolsResult.total
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
async function getFallbackAgentConsoleDashboardData() {
|
|
611
|
-
const handlers = createAgentConsoleDemoHandlers({
|
|
612
|
-
projectId: AGENT_CONSOLE_DEMO_PROJECT_ID
|
|
613
|
-
});
|
|
614
|
-
return getAgentConsoleDashboardData(handlers, {
|
|
615
|
-
projectId: AGENT_CONSOLE_DEMO_PROJECT_ID
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
export {
|
|
619
|
-
getFallbackAgentConsoleDashboardData,
|
|
620
|
-
getAgentConsoleDashboardData,
|
|
621
|
-
createAgentConsoleDemoHandlers,
|
|
622
|
-
MOCK_TOOLS,
|
|
623
|
-
MOCK_RUNS,
|
|
624
|
-
MOCK_AGENTS,
|
|
625
|
-
AGENT_CONSOLE_DEMO_PROJECT_ID,
|
|
626
|
-
AGENT_CONSOLE_DEMO_ORGANIZATION_ID
|
|
627
|
-
};
|
|
2
|
+
var D=[{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")}];var I=[{id:"tool-1",organizationId:"demo-org",name:"Web Search",slug:"web-search",description:"Search the web for real-time information using Brave API.",category:"RETRIEVAL",status:"ACTIVE",parametersSchema:{type:"object",properties:{query:{type:"string",description:"Search query"},numResults:{type:"number",default:10}},required:["query"]},outputSchema:{type:"array",items:{type:"object"}},implementationType:"http",implementationConfig:{url:"https://api.brave.com/search",method:"GET"},maxInvocationsPerMinute:60,timeoutMs:30000,version:"1.0.0",tags:["search","web"],createdAt:new Date("2024-01-01T00:00:00Z"),updatedAt:new Date("2024-02-15T10:00:00Z")},{id:"tool-2",organizationId:"demo-org",name:"SQL Query",slug:"sql-query",description:"Execute read-only SQL queries against the data warehouse.",category:"RETRIEVAL",status:"ACTIVE",parametersSchema:{type:"object",properties:{query:{type:"string",description:"SQL query"},maxRows:{type:"number",default:100}},required:["query"]},outputSchema:{type:"object"},implementationType:"function",implementationConfig:{handler:"executeSqlQuery"},maxInvocationsPerMinute:30,timeoutMs:60000,version:"1.1.0",tags:["sql","database"],createdAt:new Date("2024-01-05T00:00:00Z"),updatedAt:new Date("2024-03-10T14:00:00Z")},{id:"tool-3",organizationId:"demo-org",name:"Email Sender",slug:"email-sender",description:"Send emails via SMTP or API.",category:"COMMUNICATION",status:"ACTIVE",parametersSchema:{type:"object",properties:{to:{type:"string"},subject:{type:"string"},body:{type:"string"}},required:["to","subject","body"]},implementationType:"http",implementationConfig:{url:"/api/send-email",method:"POST"},maxInvocationsPerMinute:10,timeoutMs:30000,version:"1.0.0",tags:["email","communication"],createdAt:new Date("2024-02-01T00:00:00Z"),updatedAt:new Date("2024-02-01T00:00:00Z")},{id:"tool-4",organizationId:"demo-org",name:"GitHub Integration",slug:"github-integration",description:"Interact with GitHub repositories, PRs, and issues.",category:"INTEGRATION",status:"ACTIVE",parametersSchema:{type:"object",properties:{action:{type:"string",enum:["list_prs","get_pr","create_comment"]},repo:{type:"string"},params:{type:"object"}},required:["action","repo"]},implementationType:"http",implementationConfig:{url:"https://api.github.com",auth:"token"},maxInvocationsPerMinute:100,timeoutMs:15000,version:"2.0.0",tags:["github","integration","code"],createdAt:new Date("2024-02-20T00:00:00Z"),updatedAt:new Date("2024-04-01T09:00:00Z")},{id:"tool-5",organizationId:"demo-org",name:"Calculator",slug:"calculator",description:"Perform mathematical calculations.",category:"COMPUTATION",status:"ACTIVE",parametersSchema:{type:"object",properties:{expression:{type:"string",description:"Math expression to evaluate"}},required:["expression"]},outputSchema:{type:"object",properties:{result:{type:"number"}}},implementationType:"function",implementationConfig:{handler:"evaluateMath"},timeoutMs:5000,version:"1.0.0",tags:["math","utility"],createdAt:new Date("2024-01-10T00:00:00Z"),updatedAt:new Date("2024-01-10T00:00:00Z")}];var M=[{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 T="demo-org",C="agent-console-demo";function A(a){return a.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function y(a){return{...a}}function b(a){return{...a}}function h(a){return{...a}}function E(){let a=0,i=Date.parse("2026-03-20T09:00:00.000Z");return()=>new Date(i+a++*60000)}function Z(a){return a.toLowerCase()}function f(a){return a==="IN_PROGRESS"?"RUNNING":a}function v(a,i){let l=D.map((t)=>({id:t.id,projectId:a,organizationId:i,name:t.name,slug:t.slug,description:t.description,modelProvider:Z(t.modelProvider),modelName:t.modelName,systemPrompt:t.systemPrompt,temperature:typeof t.modelConfig?.temperature==="number"?t.modelConfig.temperature:0.4,maxTokens:8192,status:t.status,createdAt:t.createdAt,updatedAt:t.updatedAt})),g=I.map((t)=>({id:t.id,projectId:a,organizationId:i,name:t.name,description:t.description,version:t.version,category:t.category,status:t.status,inputSchema:JSON.stringify(t.parametersSchema),outputSchema:t.outputSchema?JSON.stringify(t.outputSchema):void 0,endpoint:typeof t.implementationConfig?.url==="string"?t.implementationConfig.url:void 0,createdAt:t.createdAt,updatedAt:t.updatedAt})),r=new Map(l.map((t)=>[t.id,t.name])),u=M.map((t)=>({id:t.id,projectId:a,agentId:t.agentId,agentName:r.get(t.agentId)??t.agentName??"Unknown agent",status:f(t.status),input:JSON.stringify(t.input),output:t.output?JSON.stringify(t.output):void 0,totalTokens:t.totalTokens,promptTokens:t.promptTokens,completionTokens:t.completionTokens,estimatedCostUsd:t.estimatedCostUsd??0,durationMs:t.durationMs,errorMessage:t.errorMessage,queuedAt:t.queuedAt,startedAt:t.startedAt,completedAt:t.completedAt}));return{agents:l,tools:g,runs:u}}function P(a){let i=a.length,l=a.filter((r)=>r.status==="COMPLETED").length,g=a.map((r)=>r.durationMs).filter((r)=>typeof r==="number");return{totalRuns:i,successRate:i===0?0:l/i,averageDurationMs:g.length===0?0:Math.round(g.reduce((r,u)=>r+u,0)/g.length),totalTokens:a.reduce((r,u)=>r+u.totalTokens,0),totalCostUsd:a.reduce((r,u)=>r+u.estimatedCostUsd,0)}}function S(a){let i=a.projectId,l=a.organizationId??T,g=a.now??E(),r=v(i,l),u=r.agents.length+1,t=r.runs.length+1,w=(e)=>{let o=e==="agent"?u++:t++;return a.idFactory?.(e,o)??`${e}-demo-${o}`};return{async listAgents(e){let o=r.agents.filter((s)=>s.projectId===e.projectId).filter((s)=>!e.organizationId||s.organizationId===e.organizationId).filter((s)=>!e.status||e.status==="all"||s.status===e.status).filter((s)=>{if(!e.search)return!0;let c=e.search.toLowerCase();return s.name.toLowerCase().includes(c)||(s.description??"").toLowerCase().includes(c)}).sort((s,c)=>c.updatedAt.getTime()-s.updatedAt.getTime()),d=e.limit??20,n=e.offset??0,m=o.slice(n,n+d).map(y);return{items:m,total:o.length,hasMore:n+m.length<o.length}},async getAgent(e){let o=r.agents.find((d)=>d.id===e);return o?y(o):null},async createAgent(e,o){let d=e.name.trim(),n=A(d);if(r.agents.find((p)=>p.projectId===o.projectId&&p.organizationId===o.organizationId&&(p.slug===n||p.name.toLowerCase()===d.toLowerCase())))throw Error("AGENT_NAME_OR_SLUG_EXISTS");let s=g(),c={id:w("agent"),projectId:o.projectId,organizationId:o.organizationId,name:d,slug:n,description:e.description,modelProvider:e.modelProvider??"openai",modelName:e.modelName??"gpt-5.4",systemPrompt:e.systemPrompt,temperature:e.temperature??0.4,maxTokens:e.maxTokens??8192,status:"DRAFT",createdAt:s,updatedAt:s};return r.agents.unshift(c),y(c)},async updateAgent(e){let o=r.agents.find((n)=>n.id===e.id);if(!o)throw Error("AGENT_NOT_FOUND");let d=e.name;if(d&&A(d)!==o.slug){if(r.agents.find((m)=>m.id!==o.id&&m.projectId===o.projectId&&m.organizationId===o.organizationId&&(m.slug===A(d)||m.name.toLowerCase()===d.toLowerCase())))throw Error("AGENT_NAME_OR_SLUG_EXISTS");o.slug=A(d),o.name=d}if(e.description!==void 0)o.description=e.description;if(e.status)o.status=e.status;return o.updatedAt=g(),y(o)},async executeAgent(e){let o=r.agents.find((R)=>R.id===e.agentId);if(!o)throw Error("AGENT_NOT_FOUND");if(o.status!=="ACTIVE")throw Error("AGENT_NOT_ACTIVE");let d=g(),n=g(),m=g(),s=2200+e.message.length*12,c=600+e.message.length*3,p=240+o.name.length*4,O={id:w("run"),projectId:e.context?.projectId??o.projectId,agentId:o.id,agentName:o.name,status:"COMPLETED",input:e.message,output:`Deterministic demo reply from ${o.name}: ${e.message}`,totalTokens:c+p,promptTokens:c,completionTokens:p,estimatedCostUsd:Number(((c+p)/1e6).toFixed(4)),durationMs:s,queuedAt:d,startedAt:n,completedAt:m};return r.runs.unshift(O),h(O)},async listTools(e){let o=r.tools.filter((s)=>s.projectId===e.projectId).filter((s)=>!e.organizationId||s.organizationId===e.organizationId).filter((s)=>!e.category||e.category==="all"||s.category===e.category).filter((s)=>!e.status||e.status==="all"||s.status===e.status).filter((s)=>{if(!e.search)return!0;let c=e.search.toLowerCase();return s.name.toLowerCase().includes(c)||(s.description??"").toLowerCase().includes(c)}).sort((s,c)=>s.name.localeCompare(c.name)),d=e.limit??50,n=e.offset??0,m=o.slice(n,n+d).map(b);return{items:m,total:o.length,hasMore:n+m.length<o.length}},async listRuns(e){let o=r.runs.filter((s)=>s.projectId===e.projectId).filter((s)=>!e.agentId||s.agentId===e.agentId).filter((s)=>!e.status||e.status==="all"||s.status===e.status).sort((s,c)=>c.queuedAt.getTime()-s.queuedAt.getTime()),d=e.limit??20,n=e.offset??0,m=o.slice(n,n+d).map(h);return{items:m,total:o.length,hasMore:n+m.length<o.length}},async getRunMetrics(e){let o=r.runs.filter((d)=>{if(d.projectId!==e.projectId)return!1;if(e.agentId&&d.agentId!==e.agentId)return!1;if(e.startDate&&d.queuedAt<e.startDate)return!1;if(e.endDate&&d.queuedAt>e.endDate)return!1;return!0});return P(o)}}}async function N(a,i){let l=i.organizationId??T,[g,r,u]=await Promise.all([a.listAgents({projectId:i.projectId,organizationId:l,limit:10}),a.listRuns({projectId:i.projectId,limit:10}),a.listTools({projectId:i.projectId,organizationId:l,limit:10})]);return{agents:g.items,runs:r.items,tools:u.items,summary:{totalAgents:g.total,totalRuns:r.total,totalTools:u.total}}}async function _(){let a=S({projectId:C});return N(a,{projectId:C})}export{_ as getFallbackAgentConsoleDashboardData,N as getAgentConsoleDashboardData,S as createAgentConsoleDemoHandlers,I as MOCK_TOOLS,M as MOCK_RUNS,D as MOCK_AGENTS,C as AGENT_CONSOLE_DEMO_PROJECT_ID,T as AGENT_CONSOLE_DEMO_ORGANIZATION_ID};
|