morpheus-cli 0.8.5 → 0.8.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/dist/channels/telegram.js +43 -0
- package/dist/config/manager.js +3 -1
- package/dist/config/schemas.js +2 -0
- package/dist/http/api.js +70 -13
- package/dist/http/routers/chronos.js +12 -1
- package/dist/http/webhooks-router.js +11 -3
- package/dist/runtime/ISubagent.js +1 -0
- package/dist/runtime/apoc.js +49 -39
- package/dist/runtime/audit/repository.js +193 -6
- package/dist/runtime/chronos/repository.js +35 -0
- package/dist/runtime/keymaker.js +6 -30
- package/dist/runtime/memory/sati/index.js +22 -1
- package/dist/runtime/memory/sati/repository.js +39 -1
- package/dist/runtime/memory/sqlite.js +16 -3
- package/dist/runtime/neo.js +78 -34
- package/dist/runtime/oracle.js +68 -19
- package/dist/runtime/skills/tool.js +25 -0
- package/dist/runtime/subagent-utils.js +89 -0
- package/dist/runtime/tasks/repository.js +51 -0
- package/dist/runtime/tasks/worker.js +12 -2
- package/dist/runtime/telephonist.js +17 -9
- package/dist/runtime/tools/delegation-utils.js +120 -0
- package/dist/runtime/tools/index.js +0 -2
- package/dist/runtime/tools/time-verify-tools.js +15 -8
- package/dist/runtime/trinity.js +50 -34
- package/dist/runtime/webhooks/repository.js +31 -0
- package/dist/types/config.js +2 -0
- package/dist/types/pagination.js +1 -0
- package/dist/ui/assets/AuditDashboard-5sA8Sd8S.js +1 -0
- package/dist/ui/assets/Chat-CjxeAQmd.js +41 -0
- package/dist/ui/assets/Chronos-BAjeLobF.js +1 -0
- package/dist/ui/assets/{ConfirmationModal-MyIaIK_Z.js → ConfirmationModal-fvgnOWTY.js} +1 -1
- package/dist/ui/assets/{Dashboard-C52jjru9.js → Dashboard-Ca5mSefz.js} +1 -1
- package/dist/ui/assets/{DeleteConfirmationModal-B0nDocEK.js → DeleteConfirmationModal-A8EmnHoa.js} +1 -1
- package/dist/ui/assets/{Logs-fDrGC9Lq.js → Logs-CYu7se7R.js} +1 -1
- package/dist/ui/assets/MCPManager-DsDA_ZVT.js +1 -0
- package/dist/ui/assets/ModelPricing-DnSm_Nh-.js +1 -0
- package/dist/ui/assets/Notifications-CiljQzvM.js +1 -0
- package/dist/ui/assets/Pagination-JsiwxVNQ.js +1 -0
- package/dist/ui/assets/SatiMemories-rnO2b0LG.js +1 -0
- package/dist/ui/assets/SessionAudit-Dfvhge3Z.js +9 -0
- package/dist/ui/assets/{Settings-Cgd4dJdc.js → Settings-OQlHAJoy.js} +6 -4
- package/dist/ui/assets/Skills-Crsybug0.js +7 -0
- package/dist/ui/assets/Smiths-wm90jRDT.js +1 -0
- package/dist/ui/assets/Tasks-C5FMu_Yu.js +1 -0
- package/dist/ui/assets/TrinityDatabases-BzYfecKI.js +1 -0
- package/dist/ui/assets/{UsageStats-EEwfbJ6C.js → UsageStats-CBo2vW2n.js} +1 -1
- package/dist/ui/assets/{WebhookManager-CyVUcscY.js → WebhookManager-0tDFkfHd.js} +1 -1
- package/dist/ui/assets/audit-B-F8XPLi.js +1 -0
- package/dist/ui/assets/chronos-BvMxfBQH.js +1 -0
- package/dist/ui/assets/{config-cslLZS3q.js → config-DteVgNGR.js} +1 -1
- package/dist/ui/assets/index-Cwqr-n0Y.js +10 -0
- package/dist/ui/assets/index-DcfyUdLI.css +1 -0
- package/dist/ui/assets/{mcp-M0iDC0mj.js → mcp-DxzodOdH.js} +1 -1
- package/dist/ui/assets/{skills-BvaaqiOT.js → skills--hAyQnmG.js} +1 -1
- package/dist/ui/assets/{stats-DALk3GOj.js → stats-Cibaisqd.js} +1 -1
- package/dist/ui/assets/vendor-icons-BVuQI-6R.js +1 -0
- package/dist/ui/index.html +3 -3
- package/dist/ui/sw.js +1 -1
- package/package.json +2 -1
- package/dist/runtime/tools/apoc-tool.js +0 -157
- package/dist/runtime/tools/neo-tool.js +0 -172
- package/dist/runtime/tools/trinity-tool.js +0 -157
- package/dist/ui/assets/Chat-Cx2OgATp.js +0 -38
- package/dist/ui/assets/Chronos--mut48fM.js +0 -1
- package/dist/ui/assets/MCPManager-CtRQzwM8.js +0 -1
- package/dist/ui/assets/ModelPricing-d4EYrGko.js +0 -1
- package/dist/ui/assets/Notifications-Dkqug57C.js +0 -1
- package/dist/ui/assets/SatiMemories-DykYVHgi.js +0 -1
- package/dist/ui/assets/SessionAudit-Bk0-DpW0.js +0 -9
- package/dist/ui/assets/Skills-DSi313oC.js +0 -7
- package/dist/ui/assets/Smiths-DLys0BWT.js +0 -1
- package/dist/ui/assets/Tasks-B1MbPNUQ.js +0 -1
- package/dist/ui/assets/TrinityDatabases-B5SeHOLt.js +0 -1
- package/dist/ui/assets/chronos-BVRpP__j.js +0 -1
- package/dist/ui/assets/index-CpVvCthh.js +0 -10
- package/dist/ui/assets/index-QQyZIsmH.css +0 -1
- package/dist/ui/assets/vendor-icons-DLvvGkeN.js +0 -1
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { tool } from "@langchain/core/tools";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { TaskRepository } from "../tasks/repository.js";
|
|
4
|
-
import { TaskRequestContext } from "../tasks/context.js";
|
|
5
|
-
import { compositeDelegationError, isLikelyCompositeDelegationTask } from "./delegation-guard.js";
|
|
6
|
-
import { DisplayManager } from "../display.js";
|
|
7
|
-
import { ConfigManager } from "../../config/manager.js";
|
|
8
|
-
import { Neo } from "../neo.js";
|
|
9
|
-
import { ChannelRegistry } from "../../channels/registry.js";
|
|
10
|
-
import { AuditRepository } from "../audit/repository.js";
|
|
11
|
-
const NEO_BUILTIN_CAPABILITIES = `
|
|
12
|
-
Neo built-in capabilities (always available — no MCP required):
|
|
13
|
-
• Config: morpheus_config_query, morpheus_config_update — read/write Morpheus configuration (LLM, channels, UI, etc.)
|
|
14
|
-
• Diagnostics: diagnostic_check — full system health report (config, databases, LLM provider, logs)
|
|
15
|
-
• Analytics: message_count, token_usage, provider_model_usage — message counts and token/cost usage stats
|
|
16
|
-
• Tasks: task_query — look up task status by id or session
|
|
17
|
-
• MCP Management: mcp_list, mcp_manage — list/add/update/delete/enable/disable MCP servers; use action "reload" to reload tools across all agents after config changes
|
|
18
|
-
• Webhooks: webhook_list, webhook_manage — create/update/delete webhooks; create returns api_key`.trim();
|
|
19
|
-
const NEO_BASE_DESCRIPTION = `Delegate execution to Neo asynchronously.
|
|
20
|
-
|
|
21
|
-
This tool creates a background task and returns an acknowledgement with task id.
|
|
22
|
-
Use it for any request that requires Neo's built-in capabilities or a runtime MCP tool listed below.
|
|
23
|
-
Each delegated task must contain one atomic objective.
|
|
24
|
-
|
|
25
|
-
${NEO_BUILTIN_CAPABILITIES}`;
|
|
26
|
-
function normalizeDescription(text) {
|
|
27
|
-
if (!text)
|
|
28
|
-
return "No description";
|
|
29
|
-
return text.replace(/\s+/g, " ").trim();
|
|
30
|
-
}
|
|
31
|
-
function buildCatalogSection(mcpTools) {
|
|
32
|
-
if (mcpTools.length === 0) {
|
|
33
|
-
return "\n\nRuntime MCP tools: none currently loaded.";
|
|
34
|
-
}
|
|
35
|
-
const maxItems = 500;
|
|
36
|
-
const lines = mcpTools.slice(0, maxItems).map((t) => {
|
|
37
|
-
const desc = normalizeDescription(t.description).slice(0, 120);
|
|
38
|
-
return `- ${t.name}: ${desc}`;
|
|
39
|
-
});
|
|
40
|
-
const hidden = mcpTools.length - lines.length;
|
|
41
|
-
if (hidden > 0) {
|
|
42
|
-
lines.push(`- ... and ${hidden} more tools`);
|
|
43
|
-
}
|
|
44
|
-
return `\n\nRuntime MCP tools:\n${lines.join("\n")}`;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Returns true when Neo is configured to execute synchronously (inline).
|
|
48
|
-
*/
|
|
49
|
-
function isNeoSync() {
|
|
50
|
-
const config = ConfigManager.getInstance().get();
|
|
51
|
-
return config.neo?.execution_mode === 'sync';
|
|
52
|
-
}
|
|
53
|
-
export function updateNeoDelegateToolDescription(tools) {
|
|
54
|
-
const full = `${NEO_BASE_DESCRIPTION}${buildCatalogSection(tools)}`;
|
|
55
|
-
NeoDelegateTool.description = full;
|
|
56
|
-
}
|
|
57
|
-
export const NeoDelegateTool = tool(async ({ task, context }) => {
|
|
58
|
-
try {
|
|
59
|
-
const display = DisplayManager.getInstance();
|
|
60
|
-
if (isLikelyCompositeDelegationTask(task)) {
|
|
61
|
-
display.log(`Neo delegation rejected (non-atomic task): ${task.slice(0, 140)}`, {
|
|
62
|
-
source: "NeoDelegateTool",
|
|
63
|
-
level: "warning",
|
|
64
|
-
});
|
|
65
|
-
return compositeDelegationError();
|
|
66
|
-
}
|
|
67
|
-
// ── Sync mode: execute inline and return result directly ──
|
|
68
|
-
if (isNeoSync()) {
|
|
69
|
-
display.log(`Neo executing synchronously: ${task.slice(0, 80)}...`, {
|
|
70
|
-
source: "NeoDelegateTool",
|
|
71
|
-
level: "info",
|
|
72
|
-
});
|
|
73
|
-
const ctx = TaskRequestContext.get();
|
|
74
|
-
const sessionId = ctx?.session_id ?? "default";
|
|
75
|
-
// Notify originating channel that the agent is working
|
|
76
|
-
if (ctx?.origin_channel && ctx.origin_user_id && ctx.origin_channel !== 'api' && ctx.origin_channel !== 'ui') {
|
|
77
|
-
ChannelRegistry.sendToUser(ctx.origin_channel, ctx.origin_user_id, '🥷 Neo is executing your request...')
|
|
78
|
-
.catch(() => { });
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
const neo = Neo.getInstance();
|
|
82
|
-
const result = await neo.execute(task, context, sessionId, {
|
|
83
|
-
origin_channel: ctx?.origin_channel ?? "api",
|
|
84
|
-
session_id: sessionId,
|
|
85
|
-
origin_message_id: ctx?.origin_message_id,
|
|
86
|
-
origin_user_id: ctx?.origin_user_id,
|
|
87
|
-
});
|
|
88
|
-
TaskRequestContext.incrementSyncDelegation();
|
|
89
|
-
display.log(`Neo sync execution completed.`, {
|
|
90
|
-
source: "NeoDelegateTool",
|
|
91
|
-
level: "info",
|
|
92
|
-
});
|
|
93
|
-
if (result.usage) {
|
|
94
|
-
AuditRepository.getInstance().insert({
|
|
95
|
-
session_id: sessionId,
|
|
96
|
-
event_type: 'llm_call',
|
|
97
|
-
agent: 'neo',
|
|
98
|
-
provider: result.usage.provider,
|
|
99
|
-
model: result.usage.model,
|
|
100
|
-
input_tokens: result.usage.inputTokens,
|
|
101
|
-
output_tokens: result.usage.outputTokens,
|
|
102
|
-
duration_ms: result.usage.durationMs,
|
|
103
|
-
status: 'success',
|
|
104
|
-
metadata: { step_count: result.usage.stepCount, mode: 'sync' },
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return result.output;
|
|
108
|
-
}
|
|
109
|
-
catch (syncErr) {
|
|
110
|
-
// Still count as sync delegation so Oracle passes through the error message
|
|
111
|
-
TaskRequestContext.incrementSyncDelegation();
|
|
112
|
-
display.log(`Neo sync execution failed: ${syncErr.message}`, {
|
|
113
|
-
source: "NeoDelegateTool",
|
|
114
|
-
level: "error",
|
|
115
|
-
});
|
|
116
|
-
return `❌ Neo error: ${syncErr.message}`;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
// ── Async mode (default): create background task ──
|
|
120
|
-
const existingAck = TaskRequestContext.findDuplicateDelegation("neo", task);
|
|
121
|
-
if (existingAck) {
|
|
122
|
-
display.log(`Neo delegation deduplicated. Reusing task ${existingAck.task_id}.`, {
|
|
123
|
-
source: "NeoDelegateTool",
|
|
124
|
-
level: "info",
|
|
125
|
-
});
|
|
126
|
-
return `Task ${existingAck.task_id} already queued for ${existingAck.agent} execution.`;
|
|
127
|
-
}
|
|
128
|
-
if (!TaskRequestContext.canEnqueueDelegation()) {
|
|
129
|
-
display.log(`Neo delegation blocked by per-turn limit.`, {
|
|
130
|
-
source: "NeoDelegateTool",
|
|
131
|
-
level: "warning",
|
|
132
|
-
});
|
|
133
|
-
return "Delegation limit reached for this user turn. Split the request or wait for current tasks.";
|
|
134
|
-
}
|
|
135
|
-
const ctx = TaskRequestContext.get();
|
|
136
|
-
const repository = TaskRepository.getInstance();
|
|
137
|
-
const created = repository.createTask({
|
|
138
|
-
agent: "neo",
|
|
139
|
-
input: task,
|
|
140
|
-
context: context ?? null,
|
|
141
|
-
origin_channel: ctx?.origin_channel ?? "api",
|
|
142
|
-
session_id: ctx?.session_id ?? "default",
|
|
143
|
-
origin_message_id: ctx?.origin_message_id ?? null,
|
|
144
|
-
origin_user_id: ctx?.origin_user_id ?? null,
|
|
145
|
-
max_attempts: 3,
|
|
146
|
-
});
|
|
147
|
-
TaskRequestContext.setDelegationAck({ task_id: created.id, agent: "neo", task });
|
|
148
|
-
display.log(`Neo task created: ${created.id}`, {
|
|
149
|
-
source: "NeoDelegateTool",
|
|
150
|
-
level: "info",
|
|
151
|
-
meta: {
|
|
152
|
-
agent: created.agent,
|
|
153
|
-
origin_channel: created.origin_channel,
|
|
154
|
-
session_id: created.session_id,
|
|
155
|
-
input: created.input,
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return `Task ${created.id} queued for Neo execution.`;
|
|
159
|
-
}
|
|
160
|
-
catch (err) {
|
|
161
|
-
const display = DisplayManager.getInstance();
|
|
162
|
-
display.log(`NeoDelegateTool error: ${err.message}`, { source: "NeoDelegateTool", level: "error" });
|
|
163
|
-
return `Neo task enqueue failed: ${err.message}`;
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
name: "neo_delegate",
|
|
167
|
-
description: NEO_BASE_DESCRIPTION,
|
|
168
|
-
schema: z.object({
|
|
169
|
-
task: z.string().describe("Clear task objective for Neo to execute **in the user's language**"),
|
|
170
|
-
context: z.string().optional().describe("Optional context from conversation **in the user's language**"),
|
|
171
|
-
}),
|
|
172
|
-
});
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { tool } from "@langchain/core/tools";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { TaskRepository } from "../tasks/repository.js";
|
|
4
|
-
import { TaskRequestContext } from "../tasks/context.js";
|
|
5
|
-
import { compositeDelegationError, isLikelyCompositeDelegationTask } from "./delegation-guard.js";
|
|
6
|
-
import { DisplayManager } from "../display.js";
|
|
7
|
-
import { ConfigManager } from "../../config/manager.js";
|
|
8
|
-
import { Trinity } from "../trinity.js";
|
|
9
|
-
import { ChannelRegistry } from "../../channels/registry.js";
|
|
10
|
-
import { AuditRepository } from "../audit/repository.js";
|
|
11
|
-
const TRINITY_BASE_DESCRIPTION = `Delegate a database task to Trinity, the specialized database subagent, asynchronously.
|
|
12
|
-
|
|
13
|
-
This tool enqueues a background task and returns an acknowledgement with task id.
|
|
14
|
-
Trinity interprets natural language database requests, generates the appropriate query, and returns results.
|
|
15
|
-
|
|
16
|
-
Use this tool when the user asks for ANY of the following:
|
|
17
|
-
- Querying data from a registered database (SELECT, find, aggregate)
|
|
18
|
-
- Checking database status or schema
|
|
19
|
-
- Running reports or analytics against a database
|
|
20
|
-
- Listing tables, collections, or fields
|
|
21
|
-
- Counting records or summarizing data`;
|
|
22
|
-
function buildDatabaseCatalog(databases) {
|
|
23
|
-
if (databases.length === 0) {
|
|
24
|
-
return '\n\nNo databases currently registered. Register databases via /api/trinity/databases.';
|
|
25
|
-
}
|
|
26
|
-
const lines = databases.map((db) => {
|
|
27
|
-
const schema = db.schema_json ? JSON.parse(db.schema_json) : null;
|
|
28
|
-
const tables = schema?.tables?.map((t) => t.name).join(', ') || 'schema not loaded';
|
|
29
|
-
return `- [${db.id}] ${db.name} (${db.type}): ${tables}`;
|
|
30
|
-
});
|
|
31
|
-
return `\n\nRegistered databases:\n${lines.join('\n')}`;
|
|
32
|
-
}
|
|
33
|
-
export function updateTrinityDelegateToolDescription(databases) {
|
|
34
|
-
const full = `${TRINITY_BASE_DESCRIPTION}${buildDatabaseCatalog(databases)}`;
|
|
35
|
-
TrinityDelegateTool.description = full;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Returns true when Trinity is configured to execute synchronously (inline).
|
|
39
|
-
*/
|
|
40
|
-
function isTrinitySync() {
|
|
41
|
-
const config = ConfigManager.getInstance().get();
|
|
42
|
-
return config.trinity?.execution_mode === 'sync';
|
|
43
|
-
}
|
|
44
|
-
export const TrinityDelegateTool = tool(async ({ task, context }) => {
|
|
45
|
-
try {
|
|
46
|
-
const display = DisplayManager.getInstance();
|
|
47
|
-
if (isLikelyCompositeDelegationTask(task)) {
|
|
48
|
-
display.log(`Trinity delegation rejected (non-atomic task): ${task.slice(0, 140)}`, {
|
|
49
|
-
source: 'TrinityDelegateTool',
|
|
50
|
-
level: 'warning',
|
|
51
|
-
});
|
|
52
|
-
return compositeDelegationError();
|
|
53
|
-
}
|
|
54
|
-
// ── Sync mode: execute inline and return result directly ──
|
|
55
|
-
if (isTrinitySync()) {
|
|
56
|
-
display.log(`Trinity executing synchronously: ${task.slice(0, 80)}...`, {
|
|
57
|
-
source: 'TrinityDelegateTool',
|
|
58
|
-
level: 'info',
|
|
59
|
-
});
|
|
60
|
-
const ctx = TaskRequestContext.get();
|
|
61
|
-
const sessionId = ctx?.session_id ?? 'default';
|
|
62
|
-
// Notify originating channel that the agent is working
|
|
63
|
-
if (ctx?.origin_channel && ctx.origin_user_id && ctx.origin_channel !== 'api' && ctx.origin_channel !== 'ui') {
|
|
64
|
-
ChannelRegistry.sendToUser(ctx.origin_channel, ctx.origin_user_id, '👩💻 Trinity is executing your request...')
|
|
65
|
-
.catch(() => { });
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const trinity = Trinity.getInstance();
|
|
69
|
-
const result = await trinity.execute(task, context, sessionId);
|
|
70
|
-
TaskRequestContext.incrementSyncDelegation();
|
|
71
|
-
display.log(`Trinity sync execution completed.`, {
|
|
72
|
-
source: 'TrinityDelegateTool',
|
|
73
|
-
level: 'info',
|
|
74
|
-
});
|
|
75
|
-
if (result.usage) {
|
|
76
|
-
AuditRepository.getInstance().insert({
|
|
77
|
-
session_id: sessionId,
|
|
78
|
-
event_type: 'llm_call',
|
|
79
|
-
agent: 'trinity',
|
|
80
|
-
provider: result.usage.provider,
|
|
81
|
-
model: result.usage.model,
|
|
82
|
-
input_tokens: result.usage.inputTokens,
|
|
83
|
-
output_tokens: result.usage.outputTokens,
|
|
84
|
-
duration_ms: result.usage.durationMs,
|
|
85
|
-
status: 'success',
|
|
86
|
-
metadata: { step_count: result.usage.stepCount, mode: 'sync' },
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return result.output;
|
|
90
|
-
}
|
|
91
|
-
catch (syncErr) {
|
|
92
|
-
// Still count as sync delegation so Oracle passes through the error message
|
|
93
|
-
TaskRequestContext.incrementSyncDelegation();
|
|
94
|
-
display.log(`Trinity sync execution failed: ${syncErr.message}`, {
|
|
95
|
-
source: 'TrinityDelegateTool',
|
|
96
|
-
level: 'error',
|
|
97
|
-
});
|
|
98
|
-
return `❌ Trinity error: ${syncErr.message}`;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// ── Async mode (default): create background task ──
|
|
102
|
-
const existingAck = TaskRequestContext.findDuplicateDelegation('trinit', task);
|
|
103
|
-
if (existingAck) {
|
|
104
|
-
display.log(`Trinity delegation deduplicated. Reusing task ${existingAck.task_id}.`, {
|
|
105
|
-
source: 'TrinityDelegateTool',
|
|
106
|
-
level: 'info',
|
|
107
|
-
});
|
|
108
|
-
return `Task ${existingAck.task_id} already queued for ${existingAck.agent} execution.`;
|
|
109
|
-
}
|
|
110
|
-
if (!TaskRequestContext.canEnqueueDelegation()) {
|
|
111
|
-
display.log(`Trinity delegation blocked by per-turn limit.`, {
|
|
112
|
-
source: 'TrinityDelegateTool',
|
|
113
|
-
level: 'warning',
|
|
114
|
-
});
|
|
115
|
-
return 'Delegation limit reached for this user turn. Split the request or wait for current tasks.';
|
|
116
|
-
}
|
|
117
|
-
const ctx = TaskRequestContext.get();
|
|
118
|
-
const repository = TaskRepository.getInstance();
|
|
119
|
-
const created = repository.createTask({
|
|
120
|
-
agent: 'trinit',
|
|
121
|
-
input: task,
|
|
122
|
-
context: context ?? null,
|
|
123
|
-
origin_channel: ctx?.origin_channel ?? 'api',
|
|
124
|
-
session_id: ctx?.session_id ?? 'default',
|
|
125
|
-
origin_message_id: ctx?.origin_message_id ?? null,
|
|
126
|
-
origin_user_id: ctx?.origin_user_id ?? null,
|
|
127
|
-
max_attempts: 3,
|
|
128
|
-
});
|
|
129
|
-
TaskRequestContext.setDelegationAck({ task_id: created.id, agent: 'trinit', task });
|
|
130
|
-
display.log(`Trinity task created: ${created.id}`, {
|
|
131
|
-
source: 'TrinityDelegateTool',
|
|
132
|
-
level: 'info',
|
|
133
|
-
meta: {
|
|
134
|
-
agent: created.agent,
|
|
135
|
-
origin_channel: created.origin_channel,
|
|
136
|
-
session_id: created.session_id,
|
|
137
|
-
input: created.input,
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
return `Task ${created.id} queued for Trinity execution.`;
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
const display = DisplayManager.getInstance();
|
|
144
|
-
display.log(`TrinityDelegateTool error: ${err.message}`, {
|
|
145
|
-
source: 'TrinityDelegateTool',
|
|
146
|
-
level: 'error',
|
|
147
|
-
});
|
|
148
|
-
return `Trinity task enqueue failed: ${err.message}`;
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
name: 'trinity_delegate',
|
|
152
|
-
description: TRINITY_BASE_DESCRIPTION,
|
|
153
|
-
schema: z.object({
|
|
154
|
-
task: z.string().describe('Clear description of the database task **in the user\'s language**'),
|
|
155
|
-
context: z.string().optional().describe('Optional context from the conversation to help Trinity understand the goal **in the user\'s language**'),
|
|
156
|
-
}),
|
|
157
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{j as e,A as $,m as F}from"./vendor-motion-C3CZ8ZlO.js";import{c as L,r as o}from"./vendor-react-DikRIOlj.js";import{r as B,s as _,t as K,u as G,X as U,v as q,w as H,x as X,y as V,z as Q,p as I,E as P,q as R,F as D,M as Y,G as M,U as Z,I as ee}from"./vendor-icons-DLvvGkeN.js";import{g as re,i as te,c as w}from"./index-CpVvCthh.js";import{M as ae,r as se}from"./vendor-markdown-BN_Np5Ta.js";import{C as ie}from"./ConfirmationModal-MyIaIK_Z.js";import"./vendor-utils-D4NnWbOU.js";function ne(r){const s=Date.now()-r;return s<6e4?"just now":s<36e5?`${Math.floor(s/6e4)}m ago`:s<864e5?`${Math.floor(s/36e5)}h ago`:s<6048e5?`${Math.floor(s/864e5)}d ago`:new Date(r).toLocaleDateString()}const oe=({sessions:r,activeSessionId:s,onSelectSession:a,onCreateSession:i,onArchiveSession:m,onDeleteSession:l,onRenameSession:d,isOpen:g,toggleSidebar:h})=>{const p=L(),[f,u]=o.useState(null),[n,x]=o.useState(""),k=o.useRef(null);o.useEffect(()=>{f&&k.current&&k.current.focus()},[f]);const v=(c,N)=>{c.stopPropagation(),u(N.id),x(N.title||"Untitled Session")},j=c=>{c?.stopPropagation(),f&&n.trim()&&(d(f,n.trim()),u(null))},z=c=>{c?.stopPropagation(),u(null)},E=c=>{c.key==="Enter"?j():c.key==="Escape"&&z()};return g?e.jsxs("div",{className:"w-72 bg-white dark:bg-black border-r border-gray-300 dark:border-matrix-primary flex flex-col h-full shrink-0 transition-colors duration-300",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-300 dark:border-matrix-primary shrink-0",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-matrix-highlight",children:"Sessions"}),e.jsx("button",{onClick:h,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-matrix-primary/20 text-gray-400 dark:text-matrix-secondary/60 transition-colors",title:"Collapse sidebar",children:e.jsx(K,{size:16})})]}),e.jsx("div",{className:"px-3 py-2.5 shrink-0",children:e.jsxs("button",{onClick:i,className:"w-full flex items-center justify-center gap-2 bg-azure-primary text-white dark:bg-matrix-highlight dark:text-black py-2 px-4 rounded-xl hover:bg-azure-secondary dark:hover:bg-matrix-secondary transition-colors text-sm font-medium shadow-sm",children:[e.jsx(_,{size:16}),"New Chat"]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-2 pb-3 space-y-0.5",children:[r.length===0&&e.jsx("div",{className:"text-center text-gray-400 dark:text-matrix-secondary/40 mt-12 text-sm px-4",children:"No sessions yet. Start a new chat!"}),r.map(c=>{const N=s===c.id,S=f===c.id;return e.jsxs("div",{onClick:()=>!S&&a(c.id),className:`
|
|
2
|
-
group relative flex items-center gap-2 px-3 py-2.5 rounded-xl cursor-pointer transition-all
|
|
3
|
-
${N?"bg-azure-primary/10 dark:bg-matrix-primary/15 text-azure-primary dark:text-matrix-highlight":"hover:bg-gray-100 dark:hover:bg-matrix-primary/10 text-gray-700 dark:text-matrix-secondary"}
|
|
4
|
-
`,children:[e.jsx("div",{className:"flex-1 min-w-0",children:S?e.jsx("div",{onClick:t=>t.stopPropagation(),children:e.jsx("input",{ref:k,type:"text",value:n,onChange:t=>x(t.target.value),onKeyDown:E,className:"w-full text-sm px-1.5 py-0.5 bg-white dark:bg-black border border-azure-primary dark:border-matrix-highlight rounded-lg focus:outline-none dark:text-matrix-highlight"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm font-medium truncate leading-snug",children:c.title||"Untitled Session"}),e.jsx("div",{className:"text-xs text-gray-400 dark:text-matrix-secondary/50 mt-0.5",children:ne(c.started_at)})]})}),e.jsx("div",{className:`flex items-center gap-0.5 shrink-0 transition-opacity ${N||S?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:t=>t.stopPropagation(),children:S?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:j,className:"p-1.5 rounded-lg text-emerald-600 hover:bg-emerald-50 dark:text-emerald-400 dark:hover:bg-emerald-900/20 transition-colors",title:"Save",children:e.jsx(G,{size:13})}),e.jsx("button",{onClick:z,className:"p-1.5 rounded-lg text-red-500 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20 transition-colors",title:"Cancel",children:e.jsx(U,{size:13})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t=>v(t,c),className:"p-1.5 rounded-lg text-gray-400 hover:text-blue-500 hover:bg-blue-50 dark:text-matrix-secondary/50 dark:hover:text-blue-400 dark:hover:bg-blue-900/20 transition-colors",title:"Rename",children:e.jsx(q,{size:13})}),e.jsx("button",{onClick:()=>p(`/sessions/${c.id}/audit`),className:"p-1.5 rounded-lg text-gray-400 hover:text-violet-500 hover:bg-violet-50 dark:text-matrix-secondary/50 dark:hover:text-violet-400 dark:hover:bg-violet-900/20 transition-colors",title:"Audit",children:e.jsx(H,{size:13})}),e.jsx("button",{onClick:()=>m(c.id),className:"p-1.5 rounded-lg text-gray-400 hover:text-amber-500 hover:bg-amber-50 dark:text-matrix-secondary/50 dark:hover:text-amber-400 dark:hover:bg-amber-900/20 transition-colors",title:"Archive",children:e.jsx(X,{size:13})}),e.jsx("button",{onClick:()=>l(c.id),className:"p-1.5 rounded-lg text-gray-400 hover:text-red-500 hover:bg-red-50 dark:text-matrix-secondary/50 dark:hover:text-red-400 dark:hover:bg-red-900/20 transition-colors",title:"Delete",children:e.jsx(V,{size:13})})]})})]},c.id)})]})]}):e.jsxs("div",{className:"w-14 bg-white dark:bg-black border-r border-gray-300 dark:border-matrix-primary flex flex-col items-center py-3 gap-3 shrink-0 transition-colors duration-300",children:[e.jsx("button",{onClick:h,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-matrix-primary/20 text-gray-400 dark:text-matrix-secondary/60 transition-colors",title:"Expand sidebar",children:e.jsx(B,{size:18})}),e.jsx("div",{className:"w-8 h-px bg-gray-200 dark:bg-matrix-primary/20"}),e.jsx("button",{onClick:i,className:"p-2.5 bg-azure-primary text-white dark:bg-matrix-highlight dark:text-black rounded-xl hover:bg-azure-secondary dark:hover:bg-matrix-secondary shadow-sm transition-colors",title:"New chat",children:e.jsx(_,{size:18})})]})};function A(r){if(r==null)return"";if(typeof r=="string")try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}try{return JSON.stringify(r,null,2)}catch{return String(r)}}const le=({group:r})=>{const[s,a]=o.useState(!1),i=r.result!==null,m=r.result?.content??"",l=m.startsWith("Error")||m.startsWith("❌");return e.jsxs("div",{className:"rounded-lg border border-gray-300 dark:border-matrix-primary/70 bg-white dark:bg-black overflow-hidden text-sm mb-1",children:[e.jsxs("button",{onClick:()=>a(!s),className:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-gray-50 dark:hover:bg-zinc-900/60 transition-colors",children:[e.jsx(Q,{size:12,className:"text-amber-500 dark:text-amber-400/80 flex-shrink-0"}),e.jsx("span",{className:"flex-1 font-mono text-xs text-gray-600 dark:text-matrix-secondary/80 truncate",children:r.call.name}),i?l?e.jsx(I,{size:12,className:"text-red-500 dark:text-red-400 flex-shrink-0"}):e.jsx(P,{size:12,className:"text-emerald-500 dark:text-emerald-400 flex-shrink-0"}):e.jsx(R,{size:12,className:"text-gray-400 animate-spin flex-shrink-0"}),e.jsx(D,{size:12,className:`text-gray-400 dark:text-matrix-secondary/40 flex-shrink-0 transition-transform duration-200 ${s?"rotate-180":""}`})]}),e.jsx($,{initial:!1,children:s&&e.jsx(F.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15,ease:"easeInOut"},className:"overflow-hidden",children:e.jsxs("div",{className:"px-3 pb-2.5 pt-1 border-t border-gray-100 dark:border-matrix-primary/20 space-y-2",children:[Object.keys(r.call.args??{}).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/40 uppercase tracking-wider mb-1",children:"args"}),e.jsx("pre",{className:"text-xs font-mono text-gray-600 dark:text-matrix-secondary/80 whitespace-pre-wrap break-all bg-gray-50 dark:bg-zinc-900 rounded-md p-2 border border-gray-100 dark:border-matrix-primary/20 max-h-36 overflow-y-auto",children:A(r.call.args)})]}),i&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/40 uppercase tracking-wider mb-1",children:"result"}),e.jsx("pre",{className:"text-xs font-mono text-gray-600 dark:text-matrix-secondary/80 whitespace-pre-wrap break-all bg-gray-50 dark:bg-zinc-900 rounded-md p-2 border border-gray-100 dark:border-matrix-primary/20 max-h-44 overflow-y-auto",children:A(m)})]})]})})})]})},de={apoc_delegate:{label:"Apoc",emoji:"🧑🔬",colorClass:"text-amber-600 dark:text-amber-400",bgClass:"bg-amber-50 dark:bg-amber-900/10"},neo_delegate:{label:"Neo",emoji:"🥷",colorClass:"text-violet-600 dark:text-violet-400",bgClass:"bg-violet-50 dark:bg-violet-900/10"},trinity_delegate:{label:"Trinity",emoji:"👩💻",colorClass:"text-teal-600 dark:text-teal-400",bgClass:"bg-teal-50 dark:bg-teal-900/10"},smith_delegate:{label:"Smith",emoji:"🕶️",colorClass:"text-gray-500 dark:text-gray-400",bgClass:"bg-gray-50 dark:bg-zinc-900"}};function O(r){return r?.task??r?.prompt??""}function ce(r){if(typeof r!="string")return String(r);try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}}const xe=({group:r})=>{const[s,a]=o.useState(!1),i=de[r.call.name]??{label:r.call.name,emoji:"🤖",colorClass:"text-gray-500",bgClass:"bg-gray-50 dark:bg-zinc-900"},m=r.result!==null,l=r.result?.content??"",d=l.startsWith("❌")||l.toLowerCase().startsWith("error"),g=O(r.call.args).slice(0,100),h=r.call.args?.smith??null;return e.jsxs("div",{className:`rounded-lg border border-gray-300 dark:border-matrix-primary/70 overflow-hidden text-sm mb-1 ${i.bgClass}`,children:[e.jsxs("button",{onClick:()=>a(!s),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:brightness-95 dark:hover:brightness-110 transition-all",children:[e.jsx("span",{className:"text-base flex-shrink-0 leading-none",children:i.emoji}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:`text-xs font-semibold ${i.colorClass}`,children:[i.label,h?` · ${h}`:""]}),g&&e.jsx("div",{className:"text-xs text-gray-500 dark:text-matrix-secondary/60 truncate mt-0.5",children:g})]}),m?d?e.jsx(I,{size:14,className:"text-red-500 dark:text-red-400 flex-shrink-0"}):e.jsx(P,{size:14,className:"text-emerald-500 dark:text-emerald-400 flex-shrink-0"}):e.jsx(R,{size:14,className:"text-gray-400 animate-spin flex-shrink-0"}),e.jsx(D,{size:13,className:`text-gray-400 dark:text-matrix-secondary/40 flex-shrink-0 transition-transform duration-200 ${s?"rotate-180":""}`})]}),e.jsx($,{initial:!1,children:s&&e.jsx(F.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeInOut"},className:"overflow-hidden",children:e.jsxs("div",{className:"px-3 pb-2.5 pt-1 border-t border-gray-200 dark:border-matrix-primary/20 space-y-2",children:[O(r.call.args)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/40 uppercase tracking-wider mb-1",children:"task"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-matrix-secondary/80 bg-white dark:bg-black rounded-md p-2 border border-gray-100 dark:border-matrix-primary/20 whitespace-pre-wrap",children:O(r.call.args)})]}),m&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/40 uppercase tracking-wider mb-1",children:"result"}),e.jsx("pre",{className:"text-xs font-mono text-gray-600 dark:text-matrix-secondary/80 whitespace-pre-wrap break-all bg-white dark:bg-black rounded-md p-2 border border-gray-100 dark:border-matrix-primary/20 max-h-56 overflow-y-auto",children:ce(l)})]})]})})})]})};function me(r){return r==null||r===0?null:r<1e3?`${r}ms`:`${(r/1e3).toFixed(1)}s`}function T(r){return r>=1e3?`${(r/1e3).toFixed(1)}k`:String(r)}const he=({message:r})=>{const s=r.usage_metadata,a=s?.input_tokens??s?.prompt_tokens??0,i=s?.output_tokens??s?.completion_tokens??0,m=a>0||i>0,l=me(r.duration_ms),d=r.model;if(!m&&!l&&!d)return null;const g=d?(d.includes(":")?d.split(":").pop():d)?.split("-").slice(0,4).join("-")??d:null;return e.jsxs("div",{className:"mt-2 pt-1.5 border-t border-gray-100 dark:border-matrix-primary/20 flex flex-wrap items-center gap-x-3 gap-y-0.5",children:[g&&e.jsx("span",{className:"text-[11px] font-mono text-gray-400 dark:text-matrix-secondary/40 truncate max-w-[180px]",title:d??"",children:g}),m&&e.jsxs("span",{className:"text-[11px] font-mono text-gray-400 dark:text-matrix-secondary/40",children:["↑",T(a)," ↓",T(i)]}),l&&e.jsx("span",{className:"text-[11px] font-mono text-gray-400 dark:text-matrix-secondary/40",children:l})]})};function ge(r){try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}}function pe(r){return r.session_id?.startsWith("sati-evaluation-")===!0||r.tool_name?.toLowerCase().includes("sati")===!0}const ue=({message:r})=>{const[s,a]=o.useState(!1),i=pe(r),m=i?r.tool_name==="sati_evaluation_output"?"Sati · memory update":"Sati · analysis":r.tool_name??"tool result";return e.jsxs("details",{open:s,onToggle:l=>a(l.target.open),className:"w-full",children:[e.jsxs("summary",{className:"list-none cursor-pointer select-none flex items-center gap-2 text-xs text-gray-400 dark:text-matrix-secondary/40 hover:text-gray-500 dark:hover:text-matrix-secondary/60 transition-colors py-0.5",children:[e.jsx("div",{className:"flex-1 h-px bg-gray-200 dark:bg-matrix-primary/20"}),e.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap px-2",children:[e.jsx("span",{children:i?"🧠":"🔧"}),e.jsx("span",{children:m}),e.jsx(D,{size:11,className:`transition-transform duration-200 ${s?"rotate-180":""}`})]}),e.jsx("div",{className:"flex-1 h-px bg-gray-200 dark:bg-matrix-primary/20"})]}),s&&e.jsx("pre",{className:"mt-2 px-3 py-2.5 whitespace-pre-wrap break-all text-xs font-mono text-gray-600 dark:text-matrix-secondary/80 border border-gray-300 dark:border-matrix-primary/60 rounded-lg bg-gray-50 dark:bg-zinc-900 max-h-48 overflow-y-auto",children:ge(r.content)})]})},ye={table:({children:r})=>e.jsx("div",{className:"my-2 overflow-x-auto rounded-lg border border-gray-200 dark:border-matrix-primary/60",children:e.jsx("table",{className:"min-w-full text-xs border-collapse",children:r})}),thead:({children:r})=>e.jsx("thead",{className:"bg-gray-100 dark:bg-zinc-900 text-gray-600 dark:text-matrix-secondary/70",children:r}),tbody:({children:r})=>e.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-matrix-primary/20",children:r}),tr:({children:r})=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-zinc-900/60 transition-colors",children:r}),th:({children:r})=>e.jsx("th",{className:"px-3 py-2 text-left font-semibold whitespace-nowrap border-b border-gray-200 dark:border-matrix-primary/40",children:r}),td:({children:r})=>e.jsx("td",{className:"px-3 py-2 text-gray-700 dark:text-matrix-secondary align-top",children:r})},be=({messages:r,onSendMessage:s,isLoading:a,activeSessionId:i,activeSession:m,onToggleSidebar:l})=>{const[d,g]=o.useState(""),h=o.useRef(null),p=o.useRef(null);o.useEffect(()=>{h.current?.scrollIntoView({behavior:"smooth"})},[r,a]),o.useEffect(()=>{const n=p.current;n&&(n.style.height="auto",n.style.height=n.scrollHeight+"px")},[d]);const f=()=>{!d.trim()||a||(s(d.trim()),g(""),p.current&&(p.current.style.height="auto"))},u=n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),f())};return e.jsxs("div",{className:"flex-1 flex flex-col h-full bg-white dark:bg-black overflow-hidden transition-colors duration-300",children:[l&&e.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 shrink-0 bg-white dark:bg-black border-b border-gray-300 dark:border-matrix-primary",children:[e.jsx("button",{onClick:l,className:"p-2 -ml-1 rounded-lg hover:bg-gray-100 dark:hover:bg-matrix-primary/20 text-gray-500 dark:text-matrix-secondary transition-colors","aria-label":"Open sessions",children:e.jsx(Y,{size:20})}),e.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-matrix-highlight truncate flex-1",children:m?.title??(i?"Chat":"Morpheus")})]}),i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-4 py-5 space-y-4",children:[re(r).map(n=>{const{message:x,toolGroups:k}=n;if(x.type==="tool")return e.jsx("div",{className:"px-2 py-0.5",children:e.jsx(ue,{message:x})},n.index);const v=x.type==="human";return e.jsxs("div",{className:`flex items-end gap-2.5 ${v?"justify-end":"justify-start"}`,children:[!v&&e.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center bg-azure-primary/10 text-azure-primary dark:bg-matrix-primary/20 dark:text-matrix-highlight mb-0.5",children:e.jsx(M,{size:14})}),e.jsxs("div",{className:`
|
|
5
|
-
max-w-[85%] md:max-w-[72%] min-w-0
|
|
6
|
-
${v?"bg-azure-primary text-white dark:bg-matrix-primary dark:text-black rounded-2xl rounded-br-sm px-4 py-2.5":"bg-gray-50 dark:bg-zinc-900 border border-gray-300 dark:border-matrix-primary/60 text-gray-800 dark:text-matrix-secondary rounded-2xl rounded-bl-sm px-4 py-3"}
|
|
7
|
-
`,children:[v&&e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:x.content}),x.type==="ai"&&e.jsxs(e.Fragment,{children:[k&&k.length>0&&e.jsx("div",{className:"mb-2.5 space-y-1",children:k.map(j=>te(j.call.name)?e.jsx(xe,{group:j},j.call.id):e.jsx(le,{group:j},j.call.id))}),x.content&&e.jsx("div",{className:`
|
|
8
|
-
prose prose-sm dark:prose-invert max-w-none
|
|
9
|
-
prose-p:my-1.5 prose-p:leading-relaxed
|
|
10
|
-
prose-headings:my-2 prose-headings:font-semibold
|
|
11
|
-
prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5
|
|
12
|
-
prose-pre:my-2 prose-pre:rounded-lg prose-pre:text-xs
|
|
13
|
-
prose-code:text-[0.8em] prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:font-mono
|
|
14
|
-
prose-table:my-0 prose-thead:border-0 prose-tbody:border-0
|
|
15
|
-
prose-tr:border-0 prose-th:p-0 prose-td:p-0
|
|
16
|
-
dark:prose-p:text-matrix-secondary
|
|
17
|
-
dark:prose-headings:text-matrix-highlight
|
|
18
|
-
dark:prose-strong:text-matrix-highlight
|
|
19
|
-
dark:prose-li:text-matrix-secondary
|
|
20
|
-
dark:prose-code:text-matrix-highlight dark:prose-code:bg-black/60
|
|
21
|
-
dark:prose-pre:bg-black dark:prose-pre:border dark:prose-pre:border-matrix-primary/30
|
|
22
|
-
`,children:e.jsx(ae,{remarkPlugins:[se],components:ye,children:x.content})}),e.jsx(he,{message:x})]})]}),v&&e.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center bg-gray-200 dark:bg-matrix-primary/30 text-gray-500 dark:text-matrix-secondary mb-0.5",children:e.jsx(Z,{size:14})})]},n.index)}),a&&e.jsxs("div",{className:"flex items-end gap-2.5 justify-start",children:[e.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center bg-azure-primary/10 text-azure-primary dark:bg-matrix-primary/20 dark:text-matrix-highlight mb-0.5",children:e.jsx(M,{size:14})}),e.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 border border-gray-300 dark:border-matrix-primary/60 rounded-2xl rounded-bl-sm px-4 py-3 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-azure-primary dark:bg-matrix-highlight animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-azure-primary dark:bg-matrix-highlight animate-bounce",style:{animationDelay:"160ms"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-azure-primary dark:bg-matrix-highlight animate-bounce",style:{animationDelay:"320ms"}})]})]}),e.jsx("div",{ref:h})]}),e.jsxs("div",{className:"shrink-0 px-4 pt-3 pb-4 bg-white dark:bg-black border-t border-gray-300 dark:border-matrix-primary",children:[e.jsxs("form",{onSubmit:n=>{n.preventDefault(),f()},className:"max-w-3xl mx-auto flex items-end gap-2",children:[e.jsx("textarea",{ref:p,value:d,onChange:n=>g(n.target.value),onKeyDown:u,placeholder:"Message Morpheus…",rows:1,disabled:a,className:`
|
|
23
|
-
flex-1 resize-none max-h-40 overflow-y-auto
|
|
24
|
-
bg-gray-100 dark:bg-zinc-900
|
|
25
|
-
border border-gray-300 dark:border-matrix-primary/60
|
|
26
|
-
rounded-xl px-4 py-3
|
|
27
|
-
text-sm leading-relaxed
|
|
28
|
-
text-gray-800 dark:text-matrix-secondary
|
|
29
|
-
placeholder-gray-400 dark:placeholder-matrix-secondary/40
|
|
30
|
-
focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-transparent
|
|
31
|
-
disabled:opacity-50
|
|
32
|
-
transition-all duration-200
|
|
33
|
-
`}),e.jsx("button",{type:"submit",disabled:!d.trim()||a,className:"flex-shrink-0 p-3 rounded-xl bg-azure-primary text-white dark:bg-matrix-secondary dark:text-black hover:bg-azure-secondary dark:hover:bg-matrix-highlight disabled:opacity-40 disabled:cursor-not-allowed transition-colors shadow-sm",children:e.jsx(ee,{size:18})})]}),e.jsx("p",{className:"mt-1.5 text-center text-[11px] text-gray-300 dark:text-matrix-secondary/25 select-none",children:"Enter to send · Shift+Enter for newline"})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-azure-primary/10 dark:bg-matrix-primary/10 flex items-center justify-center",children:e.jsx(M,{size:30,className:"text-azure-primary/60 dark:text-matrix-highlight/50"})}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-base font-semibold text-gray-700 dark:text-matrix-highlight",children:"Morpheus is ready"}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-matrix-secondary/60 max-w-[240px] leading-relaxed",children:"Select a session from the sidebar or start a new chat."})]})]})]})},Ce=()=>{const[r,s]=o.useState([]),[a,i]=o.useState(null),[m,l]=o.useState([]),[d,g]=o.useState(!1),[h,p]=o.useState(()=>typeof window<"u"?window.innerWidth>=768:!0),f=o.useRef(!1);o.useEffect(()=>{f.current=d},[d]),o.useEffect(()=>{if(!a)return;const t=setInterval(async()=>{if(!f.current)try{const b=(await w.getMessages(a)).filter(C=>C.type!=="system");l(C=>{if(b.length!==C.length)return b;const J=b.at(-1)?.created_at??0,W=C.at(-1)?.created_at??0;return J>W?b:C})}catch{}},3e3);return()=>clearInterval(t)},[a]);const[u,n]=o.useState({isOpen:!1,title:"",description:"",onConfirm:()=>{}}),x=async()=>{try{const t=await w.getSessions();s(t)}catch(t){console.error("Failed to load sessions:",t)}};o.useEffect(()=>{x()},[]),o.useEffect(()=>{a?(k(a),sessionStorage.setItem("morpheus.chat.uiSessionId",a)):l([])},[a]);const k=async t=>{try{const y=await w.getMessages(t);l(y.filter(b=>b.type!=="system"))}catch(y){console.error("Failed to load messages:",y)}},v=async()=>{try{const t=await w.createSession();await x(),i(t.id),window.innerWidth<768&&p(!1)}catch(t){console.error("Failed to create session:",t)}},j=t=>{i(t),window.innerWidth<768&&p(!1)},z=async t=>{if(!a)return;const y={type:"human",content:t};l(b=>[...b,y]),g(!0);try{await w.sendMessage(a,t),await k(a),await x()}catch(b){console.error("Failed to send message:",b)}finally{g(!1)}},E=t=>{n({isOpen:!0,title:"Archive Session",description:"Are you sure you want to archive this session? It will be moved to the archives.",confirmJson:"Archive",onConfirm:async()=>{try{await w.archiveSession(t),a===t&&i(null),await x()}catch(y){console.error("Failed to archive session:",y)}}})},c=t=>{n({isOpen:!0,title:"Delete Session",description:"Are you sure you want to DELETE this session? This action cannot be undone.",confirmJson:"Delete",variant:"destructive",onConfirm:async()=>{try{await w.deleteSession(t),a===t&&i(null),await x()}catch(y){console.error("Failed to delete session:",y)}}})},N=async(t,y)=>{try{await w.renameSession(t,y),await x()}catch(b){console.error("Failed to rename session:",b)}},S=r.find(t=>t.id===a)??null;return e.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-white dark:bg-black relative",children:[h&&e.jsx("div",{className:"fixed inset-0 bg-black/40 z-20 md:hidden",onClick:()=>p(!1)}),e.jsx("div",{className:`
|
|
34
|
-
fixed top-16 bottom-0 left-0 z-40 flex
|
|
35
|
-
md:relative md:inset-auto md:z-auto md:translate-x-0
|
|
36
|
-
transition-transform duration-300 ease-out
|
|
37
|
-
${h?"translate-x-0":"-translate-x-full"}
|
|
38
|
-
`,children:e.jsx(oe,{sessions:r,activeSessionId:a,onSelectSession:j,onCreateSession:v,onArchiveSession:E,onDeleteSession:c,onRenameSession:N,isOpen:h,toggleSidebar:()=>p(!h)})}),e.jsx("div",{className:"flex-1 flex flex-col h-full overflow-hidden min-w-0",children:e.jsx(be,{messages:m,onSendMessage:z,isLoading:d,activeSessionId:a,activeSession:S,onToggleSidebar:()=>p(!h)})}),e.jsx(ie,{isOpen:u.isOpen,onClose:()=>n(t=>({...t,isOpen:!1})),onConfirm:u.onConfirm,title:u.title,description:u.description,confirmJson:u.confirmJson,variant:u.variant})]})};export{Ce as ChatPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as d}from"./vendor-react-DikRIOlj.js";import{a as P,b as I,c as g,u as O}from"./chronos-BVRpP__j.js";import{D as R}from"./DeleteConfirmationModal-B0nDocEK.js";import{ac as J,ad as M,ae as U,af as B,ag as H,y as W,h as T,X as $,a3 as q}from"./vendor-icons-DLvvGkeN.js";import{m as f}from"./vendor-utils-D4NnWbOU.js";import{T as C,S}from"./SelectInput-KVLsnfra.js";import"./index-CpVvCthh.js";const F={running:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",success:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",failed:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",timeout:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"};function Y({jobId:s}){const{data:i,isLoading:m}=P(s,50);return m?e.jsx("div",{className:"p-4 dark:bg-zinc-900 rounded text-sm dark:text-matrix-secondary animate-pulse",children:"Loading history…"}):!i||i.length===0?e.jsx("div",{className:"p-4 dark:bg-zinc-900 rounded text-sm dark:text-matrix-secondary italic",children:"No executions yet."}):e.jsx("div",{className:"rounded border border-azure-border dark:border-matrix-primary dark:bg-zinc-900 overflow-hidden",children:e.jsxs("table",{className:"w-full text-xs font-mono",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary",children:[e.jsx("th",{className:"text-left px-3 py-2 text-azure-text-muted dark:text-matrix-tertiary",children:"Triggered At"}),e.jsx("th",{className:"text-left px-3 py-2 text-azure-text-muted dark:text-matrix-tertiary",children:"Completed At"}),e.jsx("th",{className:"text-left px-3 py-2 text-azure-text-muted dark:text-matrix-tertiary",children:"Status"}),e.jsx("th",{className:"text-left px-3 py-2 text-azure-text-muted dark:text-matrix-tertiary",children:"Error"})]})}),e.jsx("tbody",{children:i.map(r=>e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 last:border-0",children:[e.jsx("td",{className:"px-3 py-2 dark:text-matrix-secondary",children:new Date(r.triggered_at).toLocaleString()}),e.jsx("td",{className:"px-3 py-2 dark:text-matrix-secondary",children:r.completed_at?new Date(r.completed_at).toLocaleString():"—"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold uppercase ${F[r.status]}`,children:r.status})}),e.jsx("td",{className:"px-3 py-2 dark:text-red-400 max-w-xs truncate",children:r.error??"—"})]},r.id))})]})})}function X({enabled:s}){return e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold uppercase ${s?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-500 dark:bg-zinc-800 dark:text-matrix-tertiary"}`,children:s?"Enabled":"Disabled"})}function E(s,i){return s.length>i?`${s.slice(0,i)}…`:s}function _(s){return s?new Date(s).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function Z({onEdit:s}){const{data:i,isLoading:m}=I(),[r,c]=d.useState(null),[u,l]=d.useState(null),[n,h]=d.useState(null),o=async t=>{l(t.id);try{t.enabled?await g.disableJob(t.id):await g.enableJob(t.id),await f(p=>typeof p=="string"&&p.startsWith("/chronos"))}finally{l(null)}},x=async()=>{if(n){l(n.id);try{await g.deleteJob(n.id),await f(t=>typeof t=="string"&&t.startsWith("/chronos"))}finally{l(null),h(null)}}};return m?e.jsx("div",{className:"rounded border border-azure-border dark:border-matrix-primary p-8 text-center dark:text-matrix-secondary animate-pulse",children:"Loading jobs…"}):!i||i.length===0?e.jsxs("div",{className:"rounded border border-azure-border dark:border-matrix-primary p-8 text-center dark:text-matrix-secondary",children:["No Chronos jobs yet. Click ",e.jsx("strong",{className:"dark:text-matrix-highlight",children:"New Job"})," to get started."]}):e.jsxs("div",{className:"rounded border border-azure-border dark:border-matrix-primary overflow-hidden",children:[e.jsxs("table",{className:"w-full text-sm font-mono",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-zinc-900",children:[e.jsx("th",{className:"text-left px-4 py-3 text-azure-text-muted dark:text-matrix-tertiary font-medium",children:"Prompt"}),e.jsx("th",{className:"text-left px-4 py-3 text-azure-text-muted dark:text-matrix-tertiary font-medium hidden md:table-cell",children:"Schedule"}),e.jsx("th",{className:"text-left px-4 py-3 text-azure-text-muted dark:text-matrix-tertiary font-medium hidden lg:table-cell",children:"Next Run"}),e.jsx("th",{className:"text-left px-4 py-3 text-azure-text-muted dark:text-matrix-tertiary font-medium hidden lg:table-cell",children:"Last Run"}),e.jsx("th",{className:"text-left px-4 py-3 text-azure-text-muted dark:text-matrix-tertiary font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-azure-text-muted dark:text-matrix-tertiary font-medium text-right",children:"Actions"})]})}),e.jsx("tbody",{children:i.map(t=>e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 last:border-0 hover:bg-azure-hover dark:hover:bg-matrix-primary/10 transition-colors",children:[e.jsxs("td",{className:"px-4 py-3 dark:text-matrix-secondary max-w-xs",children:[e.jsx("span",{title:t.prompt,children:E(t.prompt,50)}),e.jsx("div",{className:"text-xs text-azure-text-muted dark:text-matrix-tertiary",children:t.created_by})]}),e.jsxs("td",{className:"px-4 py-3 dark:text-matrix-secondary hidden md:table-cell text-xs",children:[e.jsx("div",{className:"capitalize",children:t.schedule_type}),e.jsx("div",{className:"text-azure-text-muted dark:text-matrix-tertiary truncate max-w-[140px]",title:t.schedule_expression,children:t.schedule_expression})]}),e.jsx("td",{className:"px-4 py-3 dark:text-matrix-secondary hidden lg:table-cell text-xs",children:_(t.next_run_at)}),e.jsx("td",{className:"px-4 py-3 dark:text-matrix-secondary hidden lg:table-cell text-xs",children:_(t.last_run_at)}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(X,{enabled:t.enabled})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("button",{title:r===t.id?"Hide history":"View history",onClick:()=>c(r===t.id?null:t.id),className:"p-1.5 rounded dark:text-matrix-tertiary dark:hover:text-matrix-highlight hover:bg-azure-hover dark:hover:bg-matrix-primary/20 transition-colors",children:r===t.id?e.jsx(J,{className:"w-4 h-4"}):e.jsx(M,{className:"w-4 h-4"})}),e.jsx("button",{title:"Edit",onClick:()=>s(t),className:"p-1.5 rounded dark:text-matrix-tertiary dark:hover:text-matrix-highlight hover:bg-azure-hover dark:hover:bg-matrix-primary/20 transition-colors",children:e.jsx(U,{className:"w-4 h-4"})}),e.jsx("button",{title:t.enabled?"Disable":"Enable",onClick:()=>o(t),disabled:u===t.id,className:"p-1.5 rounded dark:text-matrix-tertiary dark:hover:text-matrix-highlight hover:bg-azure-hover dark:hover:bg-matrix-primary/20 transition-colors disabled:opacity-40",children:t.enabled?e.jsx(B,{className:"w-4 h-4"}):e.jsx(H,{className:"w-4 h-4"})}),e.jsx("button",{title:"Delete",onClick:()=>h(t),disabled:u===t.id,className:"p-1.5 rounded text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-40",children:e.jsx(W,{className:"w-4 h-4"})})]})})]},t.id),r===t.id&&e.jsx("tr",{className:"bg-azure-surface dark:bg-zinc-900/50",children:e.jsxs("td",{colSpan:6,className:"px-4 py-3",children:[e.jsx("div",{className:"text-xs font-bold dark:text-matrix-highlight mb-2",children:"Execution History"}),e.jsx(Y,{jobId:t.id})]})},`${t.id}-history`)]}))})]}),e.jsx(R,{isOpen:!!n,onClose:()=>h(null),onConfirm:x,title:"Delete Chronos Job",message:n?`Delete job "${E(n.prompt,60)}"? This action cannot be undone.`:""})]})}function K({scheduleExpression:s,scheduleType:i,timezone:m}){const[r,c]=d.useState(null),[u,l]=d.useState(null),n=d.useRef(null);if(d.useEffect(()=>{if(!s.trim()){c(null),l(null);return}return n.current&&clearTimeout(n.current),n.current=setTimeout(async()=>{try{const o=await g.preview(s,i,m);c(o),l(null)}catch(o){l(o.message??"Invalid expression"),c(null)}},500),()=>{n.current&&clearTimeout(n.current)}},[s,i,m]),!s.trim())return null;const h=(o,x)=>{try{return new Date(o).toLocaleString("pt-BR",{timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return new Date(o).toLocaleString()}};return e.jsx("div",{className:"mt-2 rounded border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-zinc-900 p-3 text-sm",children:u?e.jsxs("p",{className:"text-red-500 dark:text-red-400 flex items-center gap-1.5",children:[e.jsx("span",{children:"⚠"})," ",u]}):r?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-azure-text-secondary dark:text-matrix-secondary",children:[e.jsx(T,{className:"w-3.5 h-3.5 text-azure-primary dark:text-matrix-highlight shrink-0"}),e.jsx("span",{className:"font-medium dark:text-matrix-highlight",children:"Next run:"}),e.jsx("span",{children:h(r.next_run_at,m||"UTC")})]}),r.human_readable&&e.jsx("p",{className:"text-azure-text-muted dark:text-matrix-secondary/70 pl-5",children:r.human_readable}),r.next_occurrences.length>0&&e.jsx("div",{className:"pl-5 space-y-0.5",children:r.next_occurrences.map((o,x)=>e.jsxs("p",{className:"text-azure-text-muted dark:text-matrix-tertiary text-xs",children:["#",x+2,": ",o]},x))})]}):e.jsx("p",{className:"text-azure-text-muted dark:text-matrix-tertiary italic",children:"Parsing…"})})}const V=["UTC","America/Sao_Paulo","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","America/Toronto","America/Mexico_City","America/Buenos_Aires","America/Bogota","America/Lima","America/Santiago","Europe/London","Europe/Paris","Europe/Berlin","Europe/Rome","Europe/Madrid","Europe/Lisbon","Europe/Moscow","Europe/Istanbul","Asia/Dubai","Asia/Kolkata","Asia/Bangkok","Asia/Singapore","Asia/Tokyo","Asia/Shanghai","Asia/Seoul","Asia/Jakarta","Australia/Sydney","Australia/Melbourne","Pacific/Auckland","Africa/Cairo","Africa/Johannesburg","Africa/Lagos"],G=[{value:"telegram",label:"Telegram"},{value:"discord",label:"Discord"}],Q=[{value:"once",label:"Once"},{value:"cron",label:"Recurring (Cron)"},{value:"interval",label:"Recurring (Interval)"}],ee={once:'e.g. "in 30 minutes", "tomorrow at 9am", "2026-03-01T09:00:00"',cron:'e.g. "0 9 * * 1-5" (weekdays at 9am)',interval:'e.g. "every 30 minutes", "every sunday at 9am", "every weekday"'};function te({isOpen:s,onClose:i,onCreated:m,editJob:r}){const c=!!r,{data:u}=O(),[l,n]=d.useState(""),[h,o]=d.useState("once"),[x,t]=d.useState(""),[p,k]=d.useState("UTC"),[N,j]=d.useState([]),[v,b]=d.useState(null),[z,w]=d.useState(!1),A=a=>{j(y=>y.includes(a)?y.filter(L=>L!==a):[...y,a])};d.useEffect(()=>{r?(n(r.prompt),o(r.schedule_type),t(r.schedule_expression),k(r.timezone),j(r.notify_channels??[])):(n(""),o("once"),t(""),k(u?.timezone??"UTC"),j([])),b(null)},[r,s,u?.timezone]);const D=async()=>{if(b(null),!l.trim()){b("Prompt is required");return}if(!x.trim()){b("Schedule expression is required");return}w(!0);try{if(c&&r){const a={prompt:l,schedule_expression:x,timezone:p,notify_channels:N};await g.updateJob(r.id,a)}else{const a={prompt:l,schedule_type:h,schedule_expression:x,timezone:p,notify_channels:N};await g.createJob(a)}await f(a=>typeof a=="string"&&a.startsWith("/chronos")),m(),i()}catch(a){b(a.message??"Failed to save job")}finally{w(!1)}};return s?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:i}),e.jsxs("div",{className:"relative z-10 w-full max-w-lg mx-4 rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-azure-border dark:border-matrix-primary",children:[e.jsx("h2",{className:"text-lg font-bold text-azure-text-primary dark:text-matrix-highlight font-mono",children:c?"Edit Chronos Job":"New Chronos Job"}),e.jsx("button",{onClick:i,className:"p-1 rounded text-azure-text-muted dark:text-matrix-tertiary hover:text-azure-text-primary dark:hover:text-matrix-highlight transition-colors",children:e.jsx($,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsx(C,{label:"Prompt",value:l,onChange:a=>n(a.target.value),placeholder:"What should the Oracle do when this job triggers?"}),!c&&e.jsx(S,{label:"Schedule Type",value:h,onChange:a=>o(a.target.value),options:Q}),e.jsxs("div",{children:[e.jsx(C,{label:"Schedule Expression",value:x,onChange:a=>t(a.target.value),placeholder:ee[h]}),e.jsx(K,{scheduleExpression:x,scheduleType:h,timezone:p})]}),e.jsx(S,{label:"Timezone",value:p,onChange:a=>k(a.target.value),options:V.map(a=>({value:a,label:a}))}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-2",children:["Notify Channels ",e.jsx("span",{className:"text-xs font-normal opacity-60",children:"(empty = all active channels)"})]}),e.jsx("div",{className:"flex gap-4",children:G.map(({value:a,label:y})=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:N.includes(a),onChange:()=>A(a),className:"rounded border-azure-border dark:border-matrix-primary accent-azure-primary dark:accent-matrix-highlight"}),e.jsx("span",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary capitalize",children:y})]},a))})]}),v&&e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v})]}),e.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-azure-border dark:border-matrix-primary",children:[e.jsx("button",{onClick:i,className:"px-4 py-2 rounded text-sm border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary hover:bg-azure-hover dark:hover:bg-matrix-primary/20 transition-colors font-mono",children:"Cancel"}),e.jsx("button",{onClick:D,disabled:z,className:"px-4 py-2 rounded text-sm bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight font-bold hover:opacity-90 disabled:opacity-50 transition-opacity font-mono",children:z?"Saving…":c?"Update":"Create"})]})]})]}):null}function ce(){const[s,i]=d.useState(!1),[m,r]=d.useState(null),c=n=>{r(n),i(!0)},u=()=>{i(!1),r(null)},l=()=>{f(n=>typeof n=="string"&&n.startsWith("/chronos"))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(T,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Chronos"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Temporal Intent Engine — schedule prompts for the Oracle."})]})]}),e.jsxs("button",{onClick:()=>{r(null),i(!0)},className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 transition-opacity",children:[e.jsx(q,{className:"w-4 h-4"}),"New Job"]})]}),e.jsx(Z,{onEdit:c}),e.jsx(te,{isOpen:s,onClose:u,onCreated:l,editJob:m})]})}export{ce as ChronosPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as i}from"./vendor-react-DikRIOlj.js";import{o as J,s as L,a as Z,l as R,u as ee}from"./vendor-utils-D4NnWbOU.js";import{m as k}from"./mcp-M0iDC0mj.js";import{D as H,d as U,e as q,j as _}from"./index-CpVvCthh.js";import{z as re,$ as te,v as ae,a0 as se,a1 as oe,y as de,T as ne,a2 as ie,E as le,p as ce,P as me}from"./vendor-icons-DLvvGkeN.js";const xe=({label:r,values:s,onChange:t,placeholder:b})=>{const h=s.length>0?s:[""],m=(u,o)=>{const n=[...h];n[u]=o,t(n.filter(d=>d.trim().length>0))},c=()=>t([...h,""]),x=u=>{const o=h.filter((n,d)=>d!==u);t(o.filter(n=>n.trim().length>0))};return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-semibold text-azure-text-primary dark:text-matrix-secondary",children:r}),h.map((u,o)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:"flex-1 rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:u,placeholder:b,onChange:n=>m(o,n.target.value)}),e.jsx("button",{type:"button",className:"rounded-md border border-red-300 px-3 py-2 text-sm text-red-600 hover:border-red-400 hover:text-red-500 dark:border-red-900 dark:text-red-400",onClick:()=>x(o),children:"Remove"})]},`${r}-${o}`)),e.jsx("button",{type:"button",className:"text-sm font-semibold text-azure-primary hover:text-azure-secondary dark:text-matrix-highlight hover:dark:text-matrix-secondary",onClick:c,children:"Add argument"})]})},O=({label:r,values:s,onChange:t,keyPlaceholder:b,valuePlaceholder:h})=>{const m=i.useMemo(()=>s.length>0?s:[{key:"",value:""}],[s]),c=(o,n,d)=>{const v=[...m];v[o]={...v[o],[n]:d},t(v.filter(f=>f.key.trim().length>0||f.value.trim().length>0))},x=()=>t([...m,{key:"",value:""}]),u=o=>{const n=m.filter((d,v)=>v!==o);t(n.filter(d=>d.key.trim().length>0||d.value.trim().length>0))};return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-semibold text-azure-text-primary dark:text-matrix-secondary",children:r}),m.map((o,n)=>e.jsxs("div",{className:"grid gap-2 md:grid-cols-5",children:[e.jsx("input",{className:"col-span-2 rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:o.key,placeholder:b,onChange:d=>c(n,"key",d.target.value)}),e.jsx("input",{className:"col-span-2 rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:o.value,placeholder:h,onChange:d=>c(n,"value",d.target.value)}),e.jsx("button",{type:"button",className:"rounded-md border border-red-300 px-3 py-2 text-sm text-red-600 hover:border-red-400 hover:text-red-500 dark:border-red-900 dark:text-red-400",onClick:()=>u(n),children:"Remove"})]},`${r}-${n}`)),e.jsx("button",{type:"button",className:"text-sm font-semibold text-azure-primary hover:text-azure-secondary dark:text-matrix-highlight hover:dark:text-matrix-secondary",onClick:x,children:"Add entry"})]})},ue=({transport:r,command:s,url:t,args:b,env:h,headers:m,onCommandChange:c,onUrlChange:x,onArgsChange:u,onEnvChange:o,onHeadersChange:n})=>e.jsxs("div",{className:"space-y-4",children:[r==="stdio"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["Command",e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:s,onChange:d=>c(d.target.value),placeholder:"npx"})]}),e.jsx(xe,{label:"Arguments",values:b,onChange:u,placeholder:"--flag"})]}),r==="http"&&e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["URL",e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:t,onChange:d=>x(d.target.value),placeholder:"https://example.com/mcp"})]}),e.jsx(O,{label:"Environment Variables",values:h,onChange:o,keyPlaceholder:"KEY",valuePlaceholder:"value"}),r==="http"&&e.jsx(O,{label:"Headers",values:m,onChange:n,keyPlaceholder:"Header",valuePlaceholder:"value"})]}),he=J({name:L().min(1,"Name is required"),transport:Z([R("stdio"),R("http")]),command:L().optional(),url:L().optional()}),D=r=>r?Object.entries(r).map(([s,t])=>({key:s,value:t})):[],A=r=>r.reduce((s,t)=>(t.key.trim().length===0||(s[t.key]=t.value),s),{}),pe=({open:r,mode:s,initial:t,onClose:b,onSubmit:h})=>{const[m,c]=i.useState(t?.name??""),[x,u]=i.useState(t?.config.transport??"stdio"),[o,n]=i.useState(t?.config.transport==="stdio"?t.config.command:""),[d,v]=i.useState(t?.config.transport==="http"?t.config.url:""),[f,N]=i.useState(t?.config.args??[]),[j,C]=i.useState(D(t?.config.env)),[p,T]=i.useState(t?.config.transport==="http"?D(t.config.headers):[]),[w,z]=i.useState(null);i.useEffect(()=>{r&&(c(t?.name??""),u(t?.config.transport??"stdio"),n(t?.config.transport==="stdio"?t.config.command:""),v(t?.config.transport==="http"?t.config.url:""),N(t?.config.args??[]),C(D(t?.config.env)),T(t?.config.transport==="http"?D(t.config.headers):[]),z(null))},[r,t]);const P=s==="create",M=async()=>{const y=he.safeParse({name:m,transport:x,command:o,url:d});if(!y.success){z(y.error.issues[0]?.message??"Invalid form");return}if(x==="stdio"&&(!o||o.trim().length===0)){z("Command is required for stdio transport.");return}if(x==="http"&&(!d||d.trim().length===0)){z("URL is required for http transport.");return}const E=x==="stdio"?{transport:"stdio",command:o.trim(),args:f.length>0?f:void 0,env:j.length>0?A(j):void 0}:{transport:"http",url:d.trim(),headers:p.length>0?A(p):void 0,env:j.length>0?A(j):void 0};z(null),await h(m.trim(),E)},$=i.useMemo(()=>s==="create"?"Add MCP Server":"Edit MCP Server",[s]);return e.jsx(H,{open:r,onOpenChange:b,children:e.jsxs(U,{children:[e.jsx(q,{children:e.jsx(_,{children:$})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["Name",e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none disabled:bg-azure-border dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary dark:disabled:bg-matrix-primary/50",value:m,onChange:y=>c(y.target.value),placeholder:"coolify",disabled:!P})]}),e.jsxs("label",{className:"block space-y-2 text-sm text-azure-text-primary dark:text-matrix-secondary",children:["Transport",e.jsxs("select",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:x,onChange:y=>u(y.target.value),children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"http",children:"http"})]})]}),e.jsx(ue,{transport:x,command:o,url:d,args:f,env:j,headers:p,onCommandChange:n,onUrlChange:v,onArgsChange:N,onEnvChange:C,onHeadersChange:T}),w&&e.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/50 dark:text-red-400",children:w}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md border border-azure-border px-4 py-2 text-sm text-azure-text-primary hover:border-azure-primary hover:text-azure-primary dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:b,children:"Cancel"}),e.jsx("button",{type:"button",className:"rounded-md bg-azure-primary px-4 py-2 text-sm font-semibold text-white shadow hover:bg-azure-secondary dark:bg-matrix-highlight dark:text-matrix-bg hover:dark:bg-matrix-secondary",onClick:M,children:"Save"})]})]})]})})};function be({transport:r}){return r==="stdio"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium border rounded px-1.5 py-0.5 text-amber-500 bg-amber-500/10 border-amber-500/30",children:[e.jsx(ne,{className:"w-2.5 h-2.5"}),"stdio"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium border rounded px-1.5 py-0.5 text-cyan-500 bg-cyan-500/10 border-cyan-500/30",children:[e.jsx(ie,{className:"w-2.5 h-2.5"}),"http"]})}function ge({result:r}){return r?r.ok?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-emerald-500",children:[e.jsx(le,{className:"w-3 h-3"}),r.toolCount," tool",r.toolCount!==1?"s":""]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-red-500",children:[e.jsx(ce,{className:"w-3 h-3"}),"failed"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-zinc-400 dark:text-zinc-600",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-400 dark:bg-zinc-600"}),"unchecked"]})}const ye=({server:r,probeResult:s,onEdit:t,onDelete:b,onToggle:h})=>{const m=s?.ok,c=s&&!s.ok,x=r.config.env?Object.entries(r.config.env):[];return e.jsxs("div",{className:`rounded-lg border flex flex-col bg-white dark:bg-black transition-all ${r.enabled?c?"border-red-400/40 dark:border-red-500/30":m?"border-emerald-400/50 dark:border-emerald-500/30":"border-azure-primary/40 dark:border-matrix-primary":"border-azure-border dark:border-matrix-primary/30"}`,children:[e.jsxs("div",{className:"p-4 flex items-start gap-3",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${r.enabled?m?"bg-emerald-500/10":c?"bg-red-500/10":"bg-azure-primary/10 dark:bg-matrix-highlight/10":"bg-azure-surface dark:bg-zinc-900"}`,children:e.jsx(re,{className:`w-4 h-4 ${r.enabled?m?"text-emerald-500":c?"text-red-500":"text-azure-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:`font-semibold truncate ${r.enabled?"text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary"}`,children:r.name}),e.jsx(be,{transport:r.config.transport}),!r.enabled&&e.jsx("span",{className:"text-[10px] font-medium text-zinc-400 dark:text-zinc-500 bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded px-1.5 py-0.5 shrink-0",children:"disabled"})]}),e.jsx("div",{className:"mt-1",children:e.jsx(ge,{result:s})})]})]}),e.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[r.config.transport==="stdio"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-1",children:"Command"}),e.jsxs("code",{className:"block text-xs font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2.5 py-1.5 break-all",children:[r.config.command,r.config.args&&r.config.args.length>0&&e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary",children:[" ",r.config.args.join(" ")]})]})]}),r.config.transport==="http"&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-1",children:"URL"}),e.jsx("code",{className:"block text-xs font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2.5 py-1.5 break-all",children:r.config.url})]}),x.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-1",children:["Env vars (",x.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:x.map(([u])=>e.jsx("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/30 rounded px-1.5 py-0.5",children:u},u))})]}),c&&s.error&&e.jsxs("div",{className:"flex items-start gap-2 text-xs text-red-500 bg-red-500/10 border border-red-500/20 rounded p-2",children:[e.jsx(te,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all line-clamp-2",title:s.error,children:s.error})]})]}),e.jsxs("div",{className:"mt-auto px-4 py-3 border-t border-azure-border dark:border-matrix-primary/30 flex items-center justify-between gap-2",children:[r.config._comment?e.jsx("p",{className:"text-xs text-azure-text-secondary dark:text-matrix-tertiary truncate min-w-0",children:r.config._comment}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>t(r),className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary/50 text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"Edit",children:e.jsx(ae,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:()=>h(r,!r.enabled),className:`p-1.5 rounded border transition-colors ${r.enabled?"border-emerald-300 dark:border-emerald-700/60 text-emerald-500 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-900/20":"border-azure-border dark:border-matrix-primary/40 text-zinc-400 dark:text-zinc-600 hover:text-azure-text dark:hover:text-matrix-secondary hover:border-azure-border dark:hover:border-matrix-primary"}`,title:r.enabled?"Disable":"Enable",children:r.enabled?e.jsx(se,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>b(r),className:"p-1.5 rounded border border-red-200 dark:border-red-800/50 text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-500 transition-colors",title:"Delete",children:e.jsx(de,{className:"w-3.5 h-3.5"})})]})]})]})},Ce=()=>{const{data:r,error:s,mutate:t,isLoading:b}=ee("/api/mcp/servers",()=>k.fetchServers()),[h,m]=i.useState(""),[c,x]=i.useState("all"),[u,o]=i.useState(!1),[n,d]=i.useState(null),[v,f]=i.useState(!1),[N,j]=i.useState(null),[C,p]=i.useState(null),[T,w]=i.useState({}),[z,P]=i.useState(!1),[M,$]=i.useState(!1),[y,E]=i.useState(null),I=r?.servers??[];i.useEffect(()=>{k.fetchStats().then(a=>{E(a);const g={};for(const l of a.servers)g[l.name]={name:l.name,ok:l.ok,toolCount:l.toolCount,error:l.error};w(g)}).catch(()=>{})},[]);const F=i.useMemo(()=>I.filter(a=>{const g=a.name.toLowerCase().includes(h.toLowerCase()),l=c==="all"||a.config.transport===c;return g&&l}),[I,h,c]),K=()=>{d(null),o(!0)},V=a=>{d(a),o(!0)},S=async()=>{const a=await k.fetchStats();E(a);const g={};for(const l of a.servers)g[l.name]={name:l.name,ok:l.ok,toolCount:l.toolCount,error:l.error};return w(g),a},B=async(a,g)=>{try{n?await k.updateServer(n.name,g):await k.addServer(a,g),o(!1),d(null),await t(),await k.reloadTools();const l=await S();p({type:"success",message:`MCP server saved. Tools reloaded: ${l.totalTools} total.`})}catch(l){p({type:"error",message:l.message||"Failed to save MCP server."})}},Q=async a=>{j(a),f(!0)},W=async()=>{if(N)try{await k.deleteServer(N.name),await t(),f(!1),j(null),await k.reloadTools();const a=await S();p({type:"success",message:`MCP server deleted. Tools reloaded: ${a.totalTools} total.`})}catch(a){p({type:"error",message:a.message||"Failed to delete MCP server."})}},G=async()=>{P(!0);try{const a=await S();p({type:"success",message:`Status checked: ${a.totalTools} tools from ${a.servers.length} servers.`})}catch(a){p({type:"error",message:a.message||"Failed to check MCP status."})}finally{P(!1)}},X=async()=>{$(!0);try{await k.reloadTools();const a=await S();p({type:"success",message:`MCP tools reloaded: ${a.totalTools} tools from ${a.servers.length} servers.`})}catch(a){p({type:"error",message:a.message||"Failed to reload MCP tools."})}finally{$(!1)}},Y=async(a,g)=>{try{await k.toggleServer(a.name,g),await t(),await k.reloadTools();const l=await S();p({type:"success",message:`MCP server ${g?"enabled":"disabled"}. Tools reloaded: ${l.totalTools} total.`})}catch(l){p({type:"error",message:l.message||"Failed to toggle MCP server."})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(me,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"MCP Servers"}),y&&y.totalTools>0&&e.jsxs("span",{className:"rounded-full bg-azure-primary/10 px-2.5 py-0.5 text-xs font-semibold text-azure-primary dark:bg-matrix-highlight/20 dark:text-matrix-highlight",children:[y.totalTools," tools cached"]})]}),e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:["Manage MCP servers stored in mcps.json."," ",y?.lastLoadedAt&&e.jsxs("span",{className:"dark:text-matrix-tertiary",children:["Last loaded: ",new Date(y.lastLoadedAt).toLocaleTimeString()]})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",disabled:z,className:"rounded-md border border-azure-border px-4 py-2 text-sm font-semibold text-azure-text-primary shadow hover:border-azure-primary hover:text-azure-primary disabled:opacity-50 dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:G,children:z?"Checking…":"Check Status"}),e.jsx("button",{type:"button",disabled:M,className:"rounded-md border border-azure-border px-4 py-2 text-sm font-semibold text-azure-text-primary shadow hover:border-azure-primary hover:text-azure-primary disabled:opacity-50 dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:X,children:M?"Reloading…":"Reload MCPs"}),e.jsx("button",{type:"button",className:"rounded-md bg-azure-primary px-4 py-2 text-sm font-semibold text-white shadow hover:bg-azure-secondary dark:bg-matrix-highlight dark:text-matrix-bg hover:dark:bg-matrix-secondary",onClick:K,children:"Add Server"})]})]}),C&&e.jsx("div",{className:`p-4 rounded border ${C.type==="success"?"border-azure-primary text-azure-primary bg-azure-primary/10 dark:border-matrix-highlight dark:text-matrix-highlight dark:bg-matrix-highlight/10":"border-red-500 text-red-500 bg-red-900/10"}`,children:C.message}),e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center",children:[e.jsx("input",{className:"w-full rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:h,onChange:a=>m(a.target.value),placeholder:"Search by name"}),e.jsxs("select",{className:"rounded-md border border-azure-border bg-azure-surface px-3 py-2 text-sm text-azure-text-primary shadow-sm focus:border-azure-primary focus:outline-none dark:border-matrix-primary dark:bg-black dark:text-matrix-secondary",value:c,onChange:a=>x(a.target.value),children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"http",children:"http"})]})]}),b&&e.jsx("div",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary",children:"Loading MCP servers..."}),s&&e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:"Failed to load MCP servers."}),!b&&F.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-azure-border bg-azure-surface/60 p-6 text-center text-sm text-azure-text-secondary dark:border-matrix-primary dark:bg-zinc-950/60 dark:text-matrix-secondary",children:"No MCP servers found. Add a server to get started."}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:F.map(a=>e.jsx(ye,{server:a,probeResult:T[a.name],onEdit:V,onDelete:Q,onToggle:Y},`${a.name}-${a.enabled?"on":"off"}`))}),e.jsx(pe,{open:u,mode:n?"edit":"create",initial:n??void 0,onClose:()=>o(!1),onSubmit:B}),e.jsx(H,{open:v,onOpenChange:f,children:e.jsxs(U,{children:[e.jsx(q,{children:e.jsx(_,{children:"Confirm Deletion"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary",children:["Are you sure you want to delete the MCP server ",e.jsxs("span",{className:"font-semibold text-azure-text-primary dark:text-matrix-highlight",children:['"',N?.name,'"']}),"? This action cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md border border-azure-border px-4 py-2 text-sm text-azure-text-primary hover:border-azure-primary hover:text-azure-primary dark:border-matrix-primary dark:text-matrix-secondary hover:dark:border-matrix-highlight hover:dark:text-matrix-highlight",onClick:()=>f(!1),children:"Cancel"}),e.jsx("button",{type:"button",className:"rounded-md bg-red-500 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-red-400 dark:bg-red-600 hover:dark:bg-red-500",onClick:W,children:"Delete"})]})]})]})})]})};export{Ce as MCPManager};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,m}from"./vendor-motion-C3CZ8ZlO.js";import{r as o}from"./vendor-react-DikRIOlj.js";import{u as M}from"./vendor-utils-D4NnWbOU.js";import{h as p,D as j,d as v,e as z,j as N}from"./index-CpVvCthh.js";import{i as E,a3 as F,v as I,y as R}from"./vendor-icons-DLvvGkeN.js";const h={list:()=>p.get("/model-pricing"),upsert:a=>p.post("/model-pricing",a),update:(a,i,u)=>p.put(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(i)}`,u),delete:(a,i)=>p.delete(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(i)}`)},T={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},w={hidden:{opacity:0,y:10},show:{opacity:1,y:0}},O=["anthropic","openai","google","openrouter","ollama","other"],_=()=>({provider:"",model:"",input_price_per_1m:0,output_price_per_1m:0}),W=()=>{const{data:a=[],mutate:i}=M("/api/model-pricing",()=>h.list()),[u,n]=o.useState(!1),[l,b]=o.useState(null),[t,s]=o.useState(_()),[d,c]=o.useState(null),[g,y]=o.useState(null),[k,f]=o.useState(!1),x=(r,D)=>{y({type:r,message:D}),setTimeout(()=>y(null),3e3)},C=()=>{b(null),s(_()),n(!0)},S=r=>{b(r),s({...r}),n(!0)},P=async()=>{if(!(!t.provider.trim()||!t.model.trim())){f(!0);try{await h.upsert(t),await i(),n(!1),x("success",l?"Pricing updated.":"Pricing created.")}catch{x("error","Failed to save pricing entry.")}finally{f(!1)}}},$=async()=>{if(d)try{await h.delete(d.provider,d.model),await i(),c(null),x("success","Pricing entry deleted.")}catch{x("error","Failed to delete pricing entry.")}};return e.jsxs(m.div,{variants:T,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(m.div,{variants:w,className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(E,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Model Pricing"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Manage per-model pricing to estimate LLM costs in Usage Stats."})]})]}),e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 transition-opacity",children:[e.jsx(F,{className:"w-4 h-4"})," Add Pricing"]})]}),g&&e.jsx(m.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:`px-4 py-3 rounded-lg text-sm font-medium border ${g.type==="success"?"bg-green-50 dark:bg-green-900/20 border-green-300 dark:border-green-700 text-green-800 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 border-red-300 dark:border-red-700 text-red-800 dark:text-red-400"}`,children:g.message}),e.jsx(m.div,{variants:w,className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-azure-surface dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary",children:e.jsx("tr",{children:["Provider","Model","Input ($/1M tokens)","Output ($/1M tokens)","Actions"].map(r=>e.jsx("th",{className:"px-4 py-3 text-left font-semibold text-azure-text-secondary dark:text-matrix-secondary",children:r},r))})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-azure-text-secondary dark:text-matrix-secondary",children:'No pricing entries. Click "Add Pricing" to get started.'})}):a.map(r=>e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 hover:bg-azure-surface/50 dark:hover:bg-zinc-800/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text capitalize",children:r.provider}),e.jsx("td",{className:"px-4 py-3 font-mono text-azure-text-primary dark:text-matrix-highlight text-xs",children:r.model}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.input_price_per_1m.toFixed(4)]}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.output_price_per_1m.toFixed(4)]}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>S(r),className:"p-1.5 rounded hover:bg-azure-border dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",title:"Edit",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c(r),className:"p-1.5 rounded hover:bg-red-50 dark:hover:bg-red-900/20 text-azure-text-secondary dark:text-matrix-secondary hover:text-red-600 dark:hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(R,{className:"w-4 h-4"})})]})})]},`${r.provider}/${r.model}`))})]})}),e.jsx(j,{open:u,onOpenChange:n,children:e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(N,{children:l?"Edit Pricing":"Add Pricing"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Provider"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm capitalize",children:t.provider}):e.jsxs("select",{value:t.provider,onChange:r=>s({...t,provider:r.target.value}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight",children:[e.jsx("option",{value:"",children:"Select provider..."}),O.map(r=>e.jsx("option",{value:r,children:r},r))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Model"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm font-mono",children:t.model}):e.jsx("input",{type:"text",value:t.model,onChange:r=>s({...t,model:r.target.value}),placeholder:"e.g. gpt-4o",className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Input price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.input_price_per_1m,onChange:r=>s({...t,input_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Output price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.output_price_per_1m,onChange:r=>s({...t,output_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:()=>n(!1),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:P,disabled:k||!t.provider.trim()||!t.model.trim(),className:"px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:k?"Saving...":"Save"})]})]})]})}),e.jsx(j,{open:!!d,onOpenChange:r=>!r&&c(null),children:e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(N,{children:"Delete Pricing Entry"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("p",{className:"text-sm text-azure-text-primary dark:text-matrix-text",children:["Are you sure you want to delete the pricing for"," ",e.jsxs("span",{className:"font-mono font-semibold text-azure-primary dark:text-matrix-highlight",children:[d?.provider,"/",d?.model]}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>c(null),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:$,className:"px-4 py-2 rounded-lg bg-red-600 text-white text-sm font-medium hover:bg-red-700 transition-colors",children:"Delete"})]})]})]})})]})};export{W as ModelPricing};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,m as x}from"./vendor-motion-C3CZ8ZlO.js";import{r as c,L as j}from"./vendor-react-DikRIOlj.js";import{u as f}from"./vendor-utils-D4NnWbOU.js";import{w as m,D as N,e as w,j as z}from"./index-CpVvCthh.js";import{B as h,a5 as v,a6 as C,a7 as S,V as D,o as _,p as R,h as O}from"./vendor-icons-DLvvGkeN.js";const A={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},p={hidden:{opacity:0,y:10},show:{opacity:1,y:0}},u=({status:r})=>r==="completed"?e.jsxs("div",{className:"flex items-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(_,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Completed"})]}):r==="failed"?e.jsxs("div",{className:"flex items-center gap-1.5 text-red-600 dark:text-red-400",children:[e.jsx(R,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Failed"})]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-yellow-600 dark:text-yellow-400",children:[e.jsx(O,{className:"w-4 h-4 animate-pulse"}),e.jsx("span",{className:"text-xs",children:"Pending"})]}),d=r=>new Date(r).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),B=r=>{try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}},P=()=>{const[r,b]=c.useState(!1),[a,o]=c.useState(null),{data:s=[],mutate:g}=f(["/webhooks/notifications",r],()=>m.listNotifications({unreadOnly:r}),{refreshInterval:5e3}),i=s.filter(t=>!t.read).length,n=async t=>{t.length!==0&&(await m.markRead(t),await g())},y=()=>{const t=s.filter(l=>!l.read).map(l=>l.id);n(t)},k=async t=>{o(t),t.read||await n([t.id])};return e.jsxs(x.div,{variants:A,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(x.div,{variants:p,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:[e.jsx(h,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"}),i>0&&e.jsx("span",{className:"absolute -top-1.5 -right-1.5 bg-red-500 text-white text-[10px] font-bold rounded-full w-4 h-4 flex items-center justify-center leading-none",children:i>9?"9+":i})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Notifications"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Webhook execution results from the Oracle agent."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(j,{to:"/webhooks",className:"flex items-center gap-2 text-sm text-azure-text-secondary dark:text-matrix-dim hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:[e.jsx(v,{className:"w-4 h-4"}),"Back to Webhooks"]}),e.jsxs("button",{onClick:()=>b(!r),className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm transition-colors ${r?"border-azure-primary dark:border-matrix-highlight bg-azure-active dark:bg-matrix-primary/20 text-azure-primary dark:text-matrix-highlight":"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-dim hover:bg-azure-surface dark:hover:bg-zinc-800"}`,children:[e.jsx(C,{className:"w-4 h-4"}),"Unread only"]}),i>0&&e.jsxs("button",{onClick:y,className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-sm text-azure-text-secondary dark:text-matrix-dim hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:[e.jsx(S,{className:"w-4 h-4"}),"Mark all read"]})]})]}),e.jsx(x.div,{variants:p,className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-azure-surface dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary",children:e.jsx("tr",{children:["","Webhook","Status","Created","Completed","Actions"].map(t=>e.jsx("th",{className:"px-4 py-3 text-left font-semibold text-azure-text-secondary dark:text-matrix-dim",children:t},t))})}),e.jsx("tbody",{children:s.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-azure-text-secondary dark:text-matrix-dim",children:r?"No unread notifications.":"No notifications yet."})}):s.map(t=>e.jsxs("tr",{className:`border-b border-azure-border dark:border-matrix-primary/30 hover:bg-azure-surface/50 dark:hover:bg-zinc-800/50 transition-colors ${t.read?"":"bg-blue-50/40 dark:bg-blue-900/10"}`,children:[e.jsx("td",{className:"px-4 py-3 w-6",children:!t.read&&e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-blue-500 dark:bg-matrix-highlight"})}),e.jsx("td",{className:"px-4 py-3 font-mono font-medium text-azure-text-primary dark:text-matrix-text",children:t.webhook_name}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(u,{status:t.status})}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-dim whitespace-nowrap",children:d(t.created_at)}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-dim whitespace-nowrap",children:t.completed_at?d(t.completed_at):"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("button",{onClick:()=>k(t),title:"View details",className:"p-1.5 rounded hover:bg-azure-border dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-dim hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:e.jsx(D,{className:"w-4 h-4"})})})]},t.id))})]})})}),e.jsxs(N,{open:!!a,onOpenChange:t=>!t&&o(null),children:[e.jsx(w,{children:e.jsxs(z,{className:"text-azure-text-primary dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(h,{className:"w-4 h-4"}),a?.webhook_name]})}),a&&e.jsxs("div",{className:"p-6 space-y-4 overflow-y-auto max-h-[65vh]",children:[e.jsxs("div",{className:"flex items-center gap-4 text-xs text-azure-text-secondary dark:text-matrix-dim",children:[e.jsx(u,{status:a.status}),e.jsx("span",{children:d(a.created_at)}),a.completed_at&&e.jsxs("span",{children:["→ ",d(a.completed_at)]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-azure-text-secondary dark:text-matrix-dim mb-1.5",children:"Received Payload"}),e.jsx("pre",{className:"bg-azure-bg dark:bg-zinc-950 rounded-lg p-3 text-xs font-mono overflow-auto max-h-44 text-azure-text-primary dark:text-matrix-text border border-azure-border dark:border-matrix-primary/30 whitespace-pre-wrap",children:B(a.payload)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-azure-text-secondary dark:text-matrix-dim mb-1.5",children:"Agent Result"}),e.jsx("div",{className:"bg-azure-bg dark:bg-zinc-950 rounded-lg p-3 text-xs font-mono overflow-auto max-h-64 text-azure-text-primary dark:text-matrix-text border border-azure-border dark:border-matrix-primary/30 whitespace-pre-wrap",children:a.result??e.jsx("span",{className:"text-yellow-600 dark:text-yellow-400 animate-pulse",children:"Processing…"})})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{onClick:()=>o(null),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-dim text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Close"})})]})]})]})};export{P as Notifications};
|