@kafca/agentdock 0.1.45 → 0.1.47
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/README.md +11 -0
- package/dist/renderer/assets/{Badge-BIojwD6s.js → Badge-BYREM3t3.js} +1 -1
- package/dist/renderer/assets/Chat-Dtb5X7sB.js +2 -0
- package/dist/renderer/assets/{ChatMarkdown-DqszsPB_.js → ChatMarkdown-_slLloCh.js} +1 -1
- package/dist/renderer/assets/Config-pHichs7H.js +21 -0
- package/dist/renderer/assets/CronList-CJQMeCjz.js +1 -0
- package/dist/renderer/assets/Dashboard-CY77Imde.js +26 -0
- package/dist/renderer/assets/{EmptyState-BqCx1oWr.js → EmptyState-DCqmct2y.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-BwK8Gpfa.js → KnowledgeDetail-DFrxa-pv.js} +1 -1
- package/dist/renderer/assets/KnowledgeHome-DL-vAfrH.js +11 -0
- package/dist/renderer/assets/Logs-jw9Uv590.js +1 -0
- package/dist/renderer/assets/{Modal-D2U4r2V0.js → Modal-ChSm7tk6.js} +1 -1
- package/dist/renderer/assets/MonitorList-DrEwyS71.js +1 -0
- package/dist/renderer/assets/{Page-urf5GcT_.js → Page-DhD-zgMU.js} +1 -1
- package/dist/renderer/assets/ProjectDetail-BVSjpfpL.js +11 -0
- package/dist/renderer/assets/ProjectList-CHGbTJjk.js +1 -0
- package/dist/renderer/assets/{Select-CAscWpy5.js → Select-rHs9CSam.js} +1 -1
- package/dist/renderer/assets/SessionChat-CDc2FNMA.js +1 -0
- package/dist/renderer/assets/SessionList-Mr1uAnRW.js +1 -0
- package/dist/renderer/assets/ThreadChat-Detu5UfN.js +23 -0
- package/dist/renderer/assets/Workspace-MRRg8ndJ.js +19 -0
- package/dist/renderer/assets/{arrow-left-7HrNuS-V.js → arrow-left-BU2NB2LA.js} +1 -1
- package/dist/renderer/assets/{book-open-BDoAu82s.js → book-open-D-TGvWwa.js} +1 -1
- package/dist/renderer/assets/bot-IYNh8tH5.js +6 -0
- package/dist/renderer/assets/{check-DGlyq4xX.js → check-CCZ0JO_S.js} +1 -1
- package/dist/renderer/assets/{chevron-down-Bb_3EHq9.js → chevron-down-00bRZi15.js} +1 -1
- package/dist/renderer/assets/{circle-DIpqZnYw.js → circle-CpQ8x4k_.js} +1 -1
- package/dist/renderer/assets/{desktop-Ci1fnRDR.js → desktop-D0k2aGSj.js} +1 -1
- package/dist/renderer/assets/{desktop-Do_UrC-o.js → desktop-JQkhNOF4.js} +1 -1
- package/dist/renderer/assets/{funnel-Bbf0ERLP.js → funnel-UbcrCBCp.js} +1 -1
- package/dist/renderer/assets/{heart-CGqU-qfw.js → heart-DvLsV7tL.js} +1 -1
- package/dist/renderer/assets/{index-Df-Trovt.js → index-B2L4G-b_.js} +1 -1
- package/dist/renderer/assets/index-CO4fGqmv.css +11 -0
- package/dist/renderer/assets/{index-DwhTjLA1.js → index-dy-g2Bh4.js} +3 -3
- package/dist/renderer/assets/{pencil-CHiy1MvK.js → pencil-qBYOgW5M.js} +1 -1
- package/dist/renderer/assets/{play-CGYnmC4Q.js → play-Dn6b4AGj.js} +1 -1
- package/dist/renderer/assets/{plus-B_Q5-Oj7.js → plus-CaApUwEm.js} +1 -1
- package/dist/renderer/assets/projects-BwF5RlNV.js +1 -0
- package/dist/renderer/assets/save-CN6yvTfD.js +11 -0
- package/dist/renderer/assets/{search-D8Dkhsyq.js → search-Dn2MxYiO.js} +1 -1
- package/dist/renderer/assets/{server-Cd96R7WL.js → server-DpcVLHeh.js} +1 -1
- package/dist/renderer/assets/{session-utils-BNUbQBfF.js → session-utils-DnD2Q_y1.js} +1 -1
- package/dist/renderer/assets/{sessions-BACfV8s1.js → sessions-eK5D4FLt.js} +1 -1
- package/dist/renderer/assets/{shield-check-Cnn-yQUA.js → shield-check-DSSJkacw.js} +1 -1
- package/dist/renderer/assets/{trash-2-oWCxwQ9D.js → trash-2-DmYJlEvO.js} +1 -1
- package/dist/renderer/assets/user-Cvf_uiyQ.js +6 -0
- package/dist/renderer/assets/{wifi-off-DHxnNkdY.js → wifi-off-CCTloj-V.js} +1 -1
- package/dist/renderer/index.html +2 -2
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-session-coordinator.js +2 -1
- package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +1 -1
- package/dist-electron/services/local-ai-core/src/agents/shared/launch-utils.js +22 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound.js +55 -1
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +132 -348
- package/dist-electron/services/local-ai-core/src/channel/shared/base-channel-gateway.js +303 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +131 -382
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +2 -1
- package/dist-electron/services/local-ai-core/src/runtime/channel-service.js +150 -0
- package/dist-electron/services/local-ai-core/src/runtime/env-utils.js +12 -0
- package/dist-electron/services/local-ai-core/src/runtime/external-service.js +234 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/automation-handler.js +34 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/capabilities-handler.js +12 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/channel-handler.js +65 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/external-handler.js +17 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/knowledge-handler.js +65 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/openai-handler.js +496 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/provider-handler.js +24 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +68 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/runtimes-handler.js +37 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/scheduler-handler.js +34 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/security-handler.js +49 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/task-handler.js +27 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/thread-handler.js +42 -0
- package/dist-electron/services/local-ai-core/src/runtime/handlers/workspace-handler.js +29 -0
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +40 -592
- package/dist-electron/services/local-ai-core/src/runtime/server-helpers.js +96 -0
- package/dist-electron/services/local-ai-core/src/runtime/server.js +107 -1084
- package/dist-electron/services/local-ai-core/src/runtime/standalone.js +13 -1
- package/dist-electron/src/pages/Projects/project-provider-config.js +75 -0
- package/dist-electron/tests/contracts/architecture-docs.test.js +1 -0
- package/dist-electron/tests/electron/agent-runtime-detector.test.js +18 -0
- package/dist-electron/tests/electron/knowledge-skill-script.test.js +15 -5
- package/dist-electron/tests/electron/lac-cli.test.js +591 -688
- package/dist-electron/tests/electron/plugin-kernel.test.js +47 -31
- package/dist-electron/tests/electron/project-provider-config.test.js +71 -0
- package/dist-electron/tests/electron/workspace-task-store.test.js +19 -9
- package/dist-electron/tests/integration/lark-gateway.test.js +80 -0
- package/dist-electron/tests/integration/local-core-cors.test.js +22 -0
- package/package.json +1 -1
- package/dist/renderer/assets/Chat-wjBR3XEX.js +0 -2
- package/dist/renderer/assets/Config-BDCHs5A2.js +0 -21
- package/dist/renderer/assets/CronList-CEWQYTov.js +0 -1
- package/dist/renderer/assets/Dashboard-DrWftfk3.js +0 -26
- package/dist/renderer/assets/KnowledgeHome-hhDTZMDO.js +0 -11
- package/dist/renderer/assets/Logs-C9xPEhFT.js +0 -1
- package/dist/renderer/assets/MonitorList-CayKbfwJ.js +0 -1
- package/dist/renderer/assets/ProjectDetail-B1GyAr7a.js +0 -11
- package/dist/renderer/assets/ProjectList-BoipQypE.js +0 -1
- package/dist/renderer/assets/SessionChat-BAVy5221.js +0 -1
- package/dist/renderer/assets/SessionList-BZpuMvh0.js +0 -1
- package/dist/renderer/assets/ThreadChat-JX7m9biG.js +0 -23
- package/dist/renderer/assets/Workspace-CFW8otjU.js +0 -14
- package/dist/renderer/assets/index-RaTga2BC.css +0 -11
- package/dist/renderer/assets/plug-Mexu4gyV.js +0 -6
- package/dist/renderer/assets/projects-C6bbkC-O.js +0 -1
- package/dist/renderer/assets/save-CJ_QFPw0.js +0 -6
- package/dist/renderer/assets/user-BzE9BwsY.js +0 -11
|
@@ -437,7 +437,12 @@ OPENAI_API_KEY = "override-openai-key"
|
|
|
437
437
|
strict_1.default.equal(route?.agentType, 'pi');
|
|
438
438
|
strict_1.default.equal(route?.config.command, process.execPath);
|
|
439
439
|
strict_1.default.match(route?.config.args[0] || '', /pi-acp[/\\]dist[/\\]index\.js$/);
|
|
440
|
-
|
|
440
|
+
if (process.platform === 'win32') {
|
|
441
|
+
strict_1.default.match(route?.config.env.PI_ACP_PI_COMMAND || '', /[\\/]node_modules[\\/]\.bin[\\/]pi\.CMD$/i);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
strict_1.default.match(route?.config.env.PI_ACP_PI_COMMAND || '', /@mariozechner[/\\]pi-coding-agent[/\\]dist[/\\]cli\.js$/);
|
|
445
|
+
}
|
|
441
446
|
strict_1.default.equal(route?.config.env.OPENAI_API_KEY, 'override-openai-key');
|
|
442
447
|
strict_1.default.match(route?.config.env.PI_CODING_AGENT_DIR || '', /[\\/]\.pi-agent[\\/]pi-workspace$/);
|
|
443
448
|
strict_1.default.deepEqual(await runtime.workspaceRouter.listWorkspaces(), [
|
|
@@ -735,14 +740,14 @@ model = "deepseek-v4-flash"
|
|
|
735
740
|
});
|
|
736
741
|
await controller.init();
|
|
737
742
|
strict_1.default.equal(started, true);
|
|
738
|
-
strict_1.default.deepEqual(await controller.
|
|
739
|
-
strict_1.default.deepEqual(await controller.
|
|
743
|
+
strict_1.default.deepEqual(await controller.kernel.getCapabilitySnapshot(), capabilitySnapshot);
|
|
744
|
+
strict_1.default.deepEqual(await controller.channelService.getQrCode('test-channel', 'workspace-1', 'instance-1'), {
|
|
740
745
|
ticket: 'ticket:workspace-1',
|
|
741
746
|
expiresIn: 60,
|
|
742
747
|
qrCodeUrl: 'https://example.test/qr',
|
|
743
748
|
instanceId: 'instance-1',
|
|
744
749
|
});
|
|
745
|
-
strict_1.default.deepEqual(await controller.
|
|
750
|
+
strict_1.default.deepEqual(await controller.channelService.checkQrCodeStatus('test-channel', 'workspace-1', 'signed-ticket'), {
|
|
746
751
|
status: 'signed',
|
|
747
752
|
});
|
|
748
753
|
await controller.saveStructuredConfigFile({ projects: [] });
|
|
@@ -936,8 +941,12 @@ model = "deepseek-v4-flash"
|
|
|
936
941
|
});
|
|
937
942
|
(0, node_test_1.default)('server QR routes dispatch through generic channel bindings', async () => {
|
|
938
943
|
const calls = [];
|
|
939
|
-
const
|
|
940
|
-
getChannelQrCode:
|
|
944
|
+
const controller = Object.assign(new node_events_1.EventEmitter(), {
|
|
945
|
+
getChannelQrCode: undefined,
|
|
946
|
+
checkChannelQrCodeStatus: undefined,
|
|
947
|
+
});
|
|
948
|
+
const channelService = {
|
|
949
|
+
getQrCode: async (platform, workspaceId, instanceId) => {
|
|
941
950
|
calls.push(`get:${platform}:${workspaceId}:${instanceId || ''}`);
|
|
942
951
|
return {
|
|
943
952
|
ticket: 'ticket-1',
|
|
@@ -946,11 +955,12 @@ model = "deepseek-v4-flash"
|
|
|
946
955
|
instanceId,
|
|
947
956
|
};
|
|
948
957
|
},
|
|
949
|
-
|
|
958
|
+
checkQrCodeStatus: async (platform, workspaceId, ticket, instanceId) => {
|
|
950
959
|
calls.push(`check:${platform}:${workspaceId}:${ticket}:${instanceId || ''}`);
|
|
951
960
|
return { status: 'signed' };
|
|
952
961
|
},
|
|
953
|
-
}
|
|
962
|
+
};
|
|
963
|
+
const bindings = { controller, channelService };
|
|
954
964
|
const server = new server_js_1.LocalAiCoreServer(bindings, { port: 0 });
|
|
955
965
|
const qrResponse = await invokeServer(server, 'POST', '/api/local/v1/platforms/slack/workspace-1/qrcode?instance_id=bot-1');
|
|
956
966
|
strict_1.default.equal(qrResponse.body.data.ticket, 'ticket-1');
|
|
@@ -962,7 +972,8 @@ model = "deepseek-v4-flash"
|
|
|
962
972
|
]);
|
|
963
973
|
});
|
|
964
974
|
(0, node_test_1.default)('server unknown routes return structured error responses', async () => {
|
|
965
|
-
const
|
|
975
|
+
const controller = new node_events_1.EventEmitter();
|
|
976
|
+
const bindings = { controller };
|
|
966
977
|
const server = new server_js_1.LocalAiCoreServer(bindings, { port: 0 });
|
|
967
978
|
const response = await invokeServer(server, 'GET', '/api/local/v1/not-found');
|
|
968
979
|
strict_1.default.equal(response.statusCode, 404);
|
|
@@ -973,24 +984,7 @@ model = "deepseek-v4-flash"
|
|
|
973
984
|
});
|
|
974
985
|
(0, node_test_1.default)('server diagnostics routes dispatch through generic bindings', async () => {
|
|
975
986
|
const calls = [];
|
|
976
|
-
const
|
|
977
|
-
listDiagnosticErrors: async () => {
|
|
978
|
-
calls.push('errors');
|
|
979
|
-
return [{
|
|
980
|
-
key: 'channel.weixin:channel_session_expired:workspace-1',
|
|
981
|
-
count: 2,
|
|
982
|
-
firstSeenAt: '2026-05-12T00:00:00.000Z',
|
|
983
|
-
lastSeenAt: '2026-05-12T00:05:00.000Z',
|
|
984
|
-
errorInfo: {
|
|
985
|
-
code: 'channel_session_expired',
|
|
986
|
-
message: 'WeChat login expired.',
|
|
987
|
-
userMessage: 'Channel login has expired.',
|
|
988
|
-
severity: 'error',
|
|
989
|
-
retryable: false,
|
|
990
|
-
suggestedAction: 'Reconnect the channel.',
|
|
991
|
-
},
|
|
992
|
-
}];
|
|
993
|
-
},
|
|
987
|
+
const controller = Object.assign(new node_events_1.EventEmitter(), {
|
|
994
988
|
runDiagnosticsDoctor: async () => {
|
|
995
989
|
calls.push('doctor');
|
|
996
990
|
return {
|
|
@@ -1012,6 +1006,26 @@ model = "deepseek-v4-flash"
|
|
|
1012
1006
|
};
|
|
1013
1007
|
},
|
|
1014
1008
|
});
|
|
1009
|
+
const errorReporter = {
|
|
1010
|
+
list: async () => {
|
|
1011
|
+
calls.push('errors');
|
|
1012
|
+
return [{
|
|
1013
|
+
key: 'channel.weixin:channel_session_expired:workspace-1',
|
|
1014
|
+
count: 2,
|
|
1015
|
+
firstSeenAt: '2026-05-12T00:00:00.000Z',
|
|
1016
|
+
lastSeenAt: '2026-05-12T00:05:00.000Z',
|
|
1017
|
+
errorInfo: {
|
|
1018
|
+
code: 'channel_session_expired',
|
|
1019
|
+
message: 'WeChat login expired.',
|
|
1020
|
+
userMessage: 'Channel login has expired.',
|
|
1021
|
+
severity: 'error',
|
|
1022
|
+
retryable: false,
|
|
1023
|
+
suggestedAction: 'Reconnect the channel.',
|
|
1024
|
+
},
|
|
1025
|
+
}];
|
|
1026
|
+
},
|
|
1027
|
+
};
|
|
1028
|
+
const bindings = { controller, errorReporter };
|
|
1015
1029
|
const server = new server_js_1.LocalAiCoreServer(bindings, { port: 0 });
|
|
1016
1030
|
const errorsResponse = await invokeServer(server, 'GET', '/api/local/v1/diagnostics/errors');
|
|
1017
1031
|
const doctorResponse = await invokeServer(server, 'POST', '/api/local/v1/diagnostics/doctor');
|
|
@@ -1023,8 +1037,9 @@ model = "deepseek-v4-flash"
|
|
|
1023
1037
|
});
|
|
1024
1038
|
(0, node_test_1.default)('server OpenAI-compatible chat route maps metadata to sandbox yolo external run', async () => {
|
|
1025
1039
|
let externalInput;
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1040
|
+
const controller = new node_events_1.EventEmitter();
|
|
1041
|
+
const externalService = {
|
|
1042
|
+
createRun: async (input) => {
|
|
1028
1043
|
externalInput = input;
|
|
1029
1044
|
return {
|
|
1030
1045
|
project: {},
|
|
@@ -1036,7 +1051,7 @@ model = "deepseek-v4-flash"
|
|
|
1036
1051
|
events_url: '/api/local/v1/external/runs/run-1/events',
|
|
1037
1052
|
};
|
|
1038
1053
|
},
|
|
1039
|
-
|
|
1054
|
+
getRunSnapshot: async () => ({
|
|
1040
1055
|
runId: 'run-1',
|
|
1041
1056
|
task: {
|
|
1042
1057
|
taskId: 'task-1',
|
|
@@ -1069,7 +1084,8 @@ model = "deepseek-v4-flash"
|
|
|
1069
1084
|
}],
|
|
1070
1085
|
},
|
|
1071
1086
|
}),
|
|
1072
|
-
}
|
|
1087
|
+
};
|
|
1088
|
+
const bindings = { controller, externalService };
|
|
1073
1089
|
const server = new server_js_1.LocalAiCoreServer(bindings, { port: 0 });
|
|
1074
1090
|
const response = await invokeServer(server, 'POST', '/api/local/v1/openai/chat/completions', {
|
|
1075
1091
|
model: 'model-1',
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
7
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
8
|
+
const project_provider_config_1 = require("../../src/pages/Projects/project-provider-config");
|
|
9
|
+
function createConfig() {
|
|
10
|
+
return {
|
|
11
|
+
projects: [{
|
|
12
|
+
name: 'agentdock',
|
|
13
|
+
agent: {
|
|
14
|
+
type: 'localcore-acp',
|
|
15
|
+
options: {
|
|
16
|
+
model: 'old-model',
|
|
17
|
+
provider_id: 'old-provider',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
platforms: [],
|
|
21
|
+
}],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
(0, node_test_1.default)('project provider selection updates agent provider_id without mutating the original config', () => {
|
|
25
|
+
const config = createConfig();
|
|
26
|
+
const next = (0, project_provider_config_1.selectProjectProvider)(config, 'agentdock', 'deepseek');
|
|
27
|
+
strict_1.default.equal((0, project_provider_config_1.getProjectProviderId)(next, 'agentdock'), 'deepseek');
|
|
28
|
+
strict_1.default.equal((0, project_provider_config_1.getProjectProviderId)(config, 'agentdock'), 'old-provider');
|
|
29
|
+
strict_1.default.equal(next.projects?.[0]?.agent.options?.model, 'old-model');
|
|
30
|
+
});
|
|
31
|
+
(0, node_test_1.default)('project model selection updates only the project model override', () => {
|
|
32
|
+
const config = createConfig();
|
|
33
|
+
const next = (0, project_provider_config_1.selectProjectModel)(config, 'agentdock', 'deepseek-chat');
|
|
34
|
+
strict_1.default.equal(next.projects?.[0]?.agent.options?.model, 'deepseek-chat');
|
|
35
|
+
strict_1.default.equal(next.projects?.[0]?.agent.options?.provider_id, 'old-provider');
|
|
36
|
+
strict_1.default.equal(config.projects?.[0]?.agent.options?.model, 'old-model');
|
|
37
|
+
});
|
|
38
|
+
(0, node_test_1.default)('project provider selection reports missing projects clearly', () => {
|
|
39
|
+
strict_1.default.throws(() => (0, project_provider_config_1.selectProjectProvider)(createConfig(), 'missing', 'deepseek'), /Project not found in config: missing/);
|
|
40
|
+
});
|
|
41
|
+
(0, node_test_1.default)('provider removal clears references from every project without mutating the original config', () => {
|
|
42
|
+
const config = createConfig();
|
|
43
|
+
config.projects?.push({
|
|
44
|
+
name: 'project-2',
|
|
45
|
+
agent: {
|
|
46
|
+
type: 'localcore-acp',
|
|
47
|
+
options: {
|
|
48
|
+
model: 'other-model',
|
|
49
|
+
provider_id: 'old-provider',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
platforms: [],
|
|
53
|
+
});
|
|
54
|
+
config.projects?.push({
|
|
55
|
+
name: 'project-3',
|
|
56
|
+
agent: {
|
|
57
|
+
type: 'localcore-acp',
|
|
58
|
+
options: {
|
|
59
|
+
model: 'third-model',
|
|
60
|
+
provider_id: 'keep-provider',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
platforms: [],
|
|
64
|
+
});
|
|
65
|
+
const next = (0, project_provider_config_1.removeProviderReferences)(config, 'old-provider');
|
|
66
|
+
strict_1.default.equal((0, project_provider_config_1.getProjectProviderId)(next, 'agentdock'), '');
|
|
67
|
+
strict_1.default.equal((0, project_provider_config_1.getProjectProviderId)(next, 'project-2'), '');
|
|
68
|
+
strict_1.default.equal((0, project_provider_config_1.getProjectProviderId)(next, 'project-3'), 'keep-provider');
|
|
69
|
+
strict_1.default.equal((0, project_provider_config_1.getProjectProviderId)(config, 'agentdock'), 'old-provider');
|
|
70
|
+
strict_1.default.equal((0, project_provider_config_1.getProjectProviderId)(config, 'project-2'), 'old-provider');
|
|
71
|
+
});
|
|
@@ -16,6 +16,7 @@ const scheduler_service_js_1 = require("../../services/local-ai-core/src/schedul
|
|
|
16
16
|
const lark_schedule_adapter_js_1 = require("../../services/local-ai-core/src/scheduler/lark-schedule-adapter.js");
|
|
17
17
|
const bootstrap_js_1 = require("../../services/local-ai-core/src/kernel/bootstrap.js");
|
|
18
18
|
const local_core_controller_js_1 = require("../../services/local-ai-core/src/runtime/local-core-controller.js");
|
|
19
|
+
const env_utils_js_1 = require("../../services/local-ai-core/src/runtime/env-utils.js");
|
|
19
20
|
(0, node_test_1.default)('workspace registry entries persist in LocalCoreAcpStore', () => {
|
|
20
21
|
const userDataPath = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'workspace-registry-'));
|
|
21
22
|
try {
|
|
@@ -130,9 +131,9 @@ const local_core_controller_js_1 = require("../../services/local-ai-core/src/run
|
|
|
130
131
|
const config = await controller.readConfigFile();
|
|
131
132
|
strict_1.default.equal(config.parsed?.projects?.[0]?.agent.options?.provider_id, 'deepseek');
|
|
132
133
|
strict_1.default.equal(config.parsed?.projects?.[0]?.agent.providers, undefined);
|
|
133
|
-
const providers =
|
|
134
|
-
strict_1.default.equal(providers
|
|
135
|
-
strict_1.default.equal(providers
|
|
134
|
+
const providers = controller.store.listModelProviders();
|
|
135
|
+
strict_1.default.equal(providers[0]?.id, 'deepseek');
|
|
136
|
+
strict_1.default.equal(providers[0]?.name, 'deepseek');
|
|
136
137
|
await controller.close();
|
|
137
138
|
}
|
|
138
139
|
finally {
|
|
@@ -148,7 +149,7 @@ const local_core_controller_js_1 = require("../../services/local-ai-core/src/run
|
|
|
148
149
|
log: () => { },
|
|
149
150
|
});
|
|
150
151
|
const controller = new local_core_controller_js_1.LocalCoreController(userDataPath, runtime);
|
|
151
|
-
const provider =
|
|
152
|
+
const provider = controller.store.upsertModelProvider({
|
|
152
153
|
name: 'deepseek',
|
|
153
154
|
api_key: 'secret',
|
|
154
155
|
base_url: 'https://api.deepseek.com',
|
|
@@ -167,7 +168,7 @@ const local_core_controller_js_1 = require("../../services/local-ai-core/src/run
|
|
|
167
168
|
platforms: [],
|
|
168
169
|
}],
|
|
169
170
|
});
|
|
170
|
-
const workspaces = await controller.listWorkspaces();
|
|
171
|
+
const workspaces = await controller.workspaceRouter.listWorkspaces();
|
|
171
172
|
strict_1.default.equal(workspaces[0]?.id, 'workspace-a');
|
|
172
173
|
strict_1.default.equal(workspaces[0]?.agentType, 'pi');
|
|
173
174
|
await controller.close();
|
|
@@ -197,7 +198,7 @@ const local_core_controller_js_1 = require("../../services/local-ai-core/src/run
|
|
|
197
198
|
created_at: now,
|
|
198
199
|
updated_at: now,
|
|
199
200
|
});
|
|
200
|
-
const job = await controller.
|
|
201
|
+
const job = await controller.scheduledJobs.createJob({
|
|
201
202
|
workspaceId: 'workspace-a',
|
|
202
203
|
threadId: thread.id,
|
|
203
204
|
executionMode: 'side-thread',
|
|
@@ -240,7 +241,7 @@ const local_core_controller_js_1 = require("../../services/local-ai-core/src/run
|
|
|
240
241
|
created_at: now,
|
|
241
242
|
updated_at: now,
|
|
242
243
|
});
|
|
243
|
-
const job = await controller.
|
|
244
|
+
const job = await controller.scheduledJobs.createJob({
|
|
244
245
|
workspaceId: 'workspace-a',
|
|
245
246
|
threadId: thread.id,
|
|
246
247
|
executionMode: 'side-thread',
|
|
@@ -583,8 +584,12 @@ const local_core_controller_js_1 = require("../../services/local-ai-core/src/run
|
|
|
583
584
|
const previousHome = process.env.HOME;
|
|
584
585
|
process.env.HOME = '/home/agentdock-test';
|
|
585
586
|
try {
|
|
586
|
-
const
|
|
587
|
-
|
|
587
|
+
const existingPath = ['/usr/bin', '/bin'].join(node_path_1.delimiter);
|
|
588
|
+
const path = (0, local_core_acp_session_coordinator_js_1.buildAgentPath)(existingPath, '/opt/agentdock/bin');
|
|
589
|
+
const expectedEntries = process.platform === 'win32'
|
|
590
|
+
? ['/opt/agentdock/bin', '/usr/bin', '/bin']
|
|
591
|
+
: ['/opt/agentdock/bin', '/home/agentdock-test/.local/bin', '/home/agentdock-test/bin', '/usr/bin', '/bin'];
|
|
592
|
+
strict_1.default.equal(path, expectedEntries.join(node_path_1.delimiter));
|
|
588
593
|
}
|
|
589
594
|
finally {
|
|
590
595
|
if (previousHome === undefined) {
|
|
@@ -595,6 +600,11 @@ const local_core_controller_js_1 = require("../../services/local-ai-core/src/run
|
|
|
595
600
|
}
|
|
596
601
|
}
|
|
597
602
|
});
|
|
603
|
+
(0, node_test_1.default)('ACP runtime reads Windows Path env regardless of key casing', () => {
|
|
604
|
+
strict_1.default.equal((0, env_utils_js_1.getPathEnv)({ Path: 'C:\\Windows\\System32;C:\\Program Files\\nodejs' }), 'C:\\Windows\\System32;C:\\Program Files\\nodejs');
|
|
605
|
+
strict_1.default.equal((0, env_utils_js_1.getPathEnv)({ PATH: '/usr/bin:/bin' }), '/usr/bin:/bin');
|
|
606
|
+
strict_1.default.equal((0, env_utils_js_1.getPathEnv)({ Path: 'C:\\Windows\\System32', PATH: 'D:\\agentdock\\bin' }), 'D:\\agentdock\\bin');
|
|
607
|
+
});
|
|
598
608
|
(0, node_test_1.default)('ACP transport reports missing agent commands without an unhandled process error', async () => {
|
|
599
609
|
const closed = new Promise((resolve) => {
|
|
600
610
|
const transport = new local_core_acp_transport_js_1.LocalCoreAcpTransport({
|
|
@@ -1483,6 +1483,86 @@ function findLarkPostMdText(content) {
|
|
|
1483
1483
|
});
|
|
1484
1484
|
strict_1.default.equal(sentMessages.length, 0);
|
|
1485
1485
|
});
|
|
1486
|
+
(0, node_test_1.default)('lark post messages from numbered lists are delivered as text', async () => {
|
|
1487
|
+
const sentMessages = [];
|
|
1488
|
+
const gateway = new local_core_lark_gateway_js_1.LocalCoreLarkGateway({
|
|
1489
|
+
store: {
|
|
1490
|
+
expirePendingPairings: () => { },
|
|
1491
|
+
getAuthorizedUser: () => ({
|
|
1492
|
+
id: 'auth-1',
|
|
1493
|
+
workspace_id: 'project-1',
|
|
1494
|
+
platform: 'lark:lark-1',
|
|
1495
|
+
platform_user_id: 'user-1',
|
|
1496
|
+
chat_id: 'chat-1',
|
|
1497
|
+
display_name: 'User',
|
|
1498
|
+
thread_id: 'thread-1',
|
|
1499
|
+
}),
|
|
1500
|
+
getPlatformThreadBinding: () => ({
|
|
1501
|
+
workspace_id: 'project-1',
|
|
1502
|
+
platform: 'lark:lark-1',
|
|
1503
|
+
chat_id: 'chat-1',
|
|
1504
|
+
platform_user_id: 'user-1',
|
|
1505
|
+
thread_id: 'thread-1',
|
|
1506
|
+
last_platform_message_id: null,
|
|
1507
|
+
}),
|
|
1508
|
+
getLatestRunForThread: () => null,
|
|
1509
|
+
clearPlatformThreadMessageId: () => { },
|
|
1510
|
+
},
|
|
1511
|
+
readConfig: async () => ({ projects: [] }),
|
|
1512
|
+
getWorkspaceRouter: () => ({
|
|
1513
|
+
getThreadSessionKey: (threadId) => `session:${threadId}`,
|
|
1514
|
+
sendThreadMessage: async (threadId, content) => {
|
|
1515
|
+
sentMessages.push({ threadId, content });
|
|
1516
|
+
return { runId: 'run-1' };
|
|
1517
|
+
},
|
|
1518
|
+
}),
|
|
1519
|
+
eventBus: { emit: () => { }, on: () => () => { } },
|
|
1520
|
+
});
|
|
1521
|
+
const internals = gateway;
|
|
1522
|
+
internals.runtime.set('project-1::lark-1', {
|
|
1523
|
+
workspaceId: 'project-1',
|
|
1524
|
+
instanceId: 'lark-1',
|
|
1525
|
+
platformKey: 'lark:lark-1',
|
|
1526
|
+
enabled: true,
|
|
1527
|
+
status: 'running',
|
|
1528
|
+
connected: true,
|
|
1529
|
+
appId: 'app-1',
|
|
1530
|
+
client: {
|
|
1531
|
+
im: {
|
|
1532
|
+
messageReaction: {
|
|
1533
|
+
create: async () => ({ data: { reaction_id: 'reaction-1' } }),
|
|
1534
|
+
},
|
|
1535
|
+
},
|
|
1536
|
+
},
|
|
1537
|
+
});
|
|
1538
|
+
await internals.handleMessageEvent('project-1', 'lark-1', 'lark:lark-1', {
|
|
1539
|
+
event: {
|
|
1540
|
+
sender: {
|
|
1541
|
+
sender_id: { user_id: 'user-1' },
|
|
1542
|
+
},
|
|
1543
|
+
message: {
|
|
1544
|
+
message_id: 'msg-post-numbered-list',
|
|
1545
|
+
message_type: 'post',
|
|
1546
|
+
chat_id: 'chat-1',
|
|
1547
|
+
chat_type: 'p2p',
|
|
1548
|
+
content: JSON.stringify({
|
|
1549
|
+
title: '',
|
|
1550
|
+
content: [
|
|
1551
|
+
[
|
|
1552
|
+
{ tag: 'text', text: '1. hi' },
|
|
1553
|
+
],
|
|
1554
|
+
[
|
|
1555
|
+
{ tag: 'text', text: '2. hello' },
|
|
1556
|
+
],
|
|
1557
|
+
],
|
|
1558
|
+
}),
|
|
1559
|
+
},
|
|
1560
|
+
},
|
|
1561
|
+
});
|
|
1562
|
+
strict_1.default.equal(sentMessages.length, 1);
|
|
1563
|
+
strict_1.default.equal(sentMessages[0]?.threadId, 'thread-1');
|
|
1564
|
+
strict_1.default.match(sentMessages[0]?.content, /\[User Message\]\n1\. hi\n2\. hello\n\[\/User Message\]/);
|
|
1565
|
+
});
|
|
1486
1566
|
(0, node_test_1.default)('lark inbound messages create a chat binding when an authorized user has an old direct thread', async () => {
|
|
1487
1567
|
const bindings = [];
|
|
1488
1568
|
const createdThreads = [];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
7
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
8
|
+
const server_helpers_js_1 = require("../../services/local-ai-core/src/runtime/server-helpers.js");
|
|
9
|
+
class HeaderRecorder {
|
|
10
|
+
headers = new Map();
|
|
11
|
+
setHeader(name, value) {
|
|
12
|
+
this.headers.set(name, value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
(0, node_test_1.default)('local core CORS preflight allows provider update PUT requests', () => {
|
|
16
|
+
const req = { headers: { origin: 'http://127.0.0.1:5173' } };
|
|
17
|
+
const res = new HeaderRecorder();
|
|
18
|
+
(0, server_helpers_js_1.setCorsHeaders)(req, res);
|
|
19
|
+
strict_1.default.equal(res.headers.get('Access-Control-Allow-Origin'), 'http://127.0.0.1:5173');
|
|
20
|
+
strict_1.default.match(String(res.headers.get('Access-Control-Allow-Methods')), /(?:^|,)PUT(?:,|$)/);
|
|
21
|
+
strict_1.default.match(String(res.headers.get('Access-Control-Allow-Headers')), /Content-Type/);
|
|
22
|
+
});
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{u as ze,x as Me,r,j as s,C as pe,I as ye,M as U,B as C,g as ee,R as De,T as Ae}from"./index-DwhTjLA1.js";import{M as je}from"./Modal-D2U4r2V0.js";import{E as $}from"./EmptyState-BqCx1oWr.js";import{C as Le,A as Be}from"./ChatMarkdown-DqszsPB_.js";import{l as Ke}from"./projects-C6bbkC-O.js";import{l as Ue,g as $e,s as qe,a as be,r as Fe,d as Oe}from"./sessions-BACfV8s1.js";import{s as We,a as we,b as w,L as P,t as He}from"./session-utils-BNUbQBfF.js";import{S as Ve}from"./search-D8Dkhsyq.js";import{P as Ge}from"./pencil-CHiy1MvK.js";import{T as Je}from"./trash-2-oWCxwQ9D.js";import{B as Qe,U as Xe}from"./user-BzE9BwsY.js";import"./index-Df-Trovt.js";import"./check-DGlyq4xX.js";const Ye=1500,Ze=9e4;function es(a){return String(a||"").startsWith("web:")}function ss(a){return(a||[]).map((c,y)=>({id:`${c.timestamp||y}-${c.role}-${y}`,role:c.role==="user"?"user":"assistant",content:c.content,timestamp:c.timestamp,kind:c.kind}))}function ts(a){return a.map(c=>`${c.role}:${c.kind||"final"}:${c.timestamp||""}:${c.content}`).join(`
|
|
2
|
-
`)}function as(a){return a.filter(c=>c.role!=="user").length}function ns(a,c){var y;return(y=a.last_message)!=null&&y.content?a.last_message.content.replace(/\n/g," "):c("sessions.noMessages")}function ve(a){return(a instanceof Error?a.message:String(a||"")).trim().toLowerCase().includes("no active session found")}function rs(a,c){return(a instanceof Error?a.message:String(a||"")).trim().toLowerCase()?ve(a)?c("sessions.sessionUnavailable"):a instanceof Error?a.message:c("sessions.sendFailed"):c("sessions.sendFailed")}function js(){const{t:a}=ze(),[c,y]=Me(),[se,ke]=r.useState([]),[te,ae]=r.useState({}),[i,G]=r.useState(c.get("project")||""),[j,R]=r.useState([]),[n,h]=r.useState(null),[I,v]=r.useState([]),[J,ne]=r.useState(""),[T,Q]=r.useState(""),[Ne,re]=r.useState(!0),[Se,ie]=r.useState(!1),[Ce,le]=r.useState(!1),[X,oe]=r.useState(!1),[_,E]=r.useState("idle"),[ce,k]=r.useState(""),[z,q]=r.useState(null),[F,Y]=r.useState(""),[M,O]=r.useState(null),[de,W]=r.useState(null),me=r.useRef(null),x=r.useRef({project:"",sessionId:""}),H=r.useRef(null),V=r.useRef(null),b=c.get("project")||"",D=c.get("session")||"",ue=r.useMemo(()=>new Set(Object.values(te)),[te]),N=r.useMemo(()=>{const e=J.trim().toLowerCase();return e?j.filter(t=>We(t,e)):j},[J,j]),A=!!(n&&(n.live||ue.has(n.id))),_e=!!(i&&A&&T.trim()&&!X&&_!=="sending"&&_!=="activating"&&_!=="polling"),f=r.useCallback((e,t)=>{const l=new URLSearchParams;e&&l.set("project",e),t&&l.set("session",t),y(l,{replace:!0})},[y]),d=r.useCallback((e="idle")=>{H.current&&(window.clearTimeout(H.current),H.current=null),V.current=null,E(e)},[]),xe=r.useCallback(e=>{R(t=>{const l=t.some(o=>o.id===e.id)?t.map(o=>o.id===e.id?{...o,...e}:o):[...t,e];return we(l)})},[]),fe=r.useCallback(async()=>{re(!0);try{const{projects:e}=await Ke();ke(e||[])}finally{re(!1)}},[]),u=r.useCallback(async e=>{if(!e)return R([]),ae({}),[];ie(!0);try{const{sessions:t,active_keys:l}=await Ue(e),o=we((t||[]).filter(m=>!es(m.session_key)));return ae(l||{}),x.current.project===e&&R(o),o}finally{ie(!1)}},[]),S=r.useCallback(async(e,t,l)=>{if(!e||!t)return h(null),v([]),null;l!=null&&l.silent||le(!0);try{const o=await $e(e,t,200);return x.current.project!==e||x.current.sessionId!==t||(xe(o),h({id:o.id,project:e,sessionKey:o.session_key,name:o.name||w(o),live:o.live,isDraft:!1,detail:o}),v(ss(o.history)),k("")),o}catch(o){return x.current.project===e&&x.current.sessionId===t&&k(o instanceof Error?o.message:a("sessions.loadFailed")),null}finally{l!=null&&l.silent||le(!1)}},[xe,a]),Z=r.useCallback(e=>{V.current=e,H.current=window.setTimeout(async()=>{const t=V.current;if(!t)return;if(Date.now()-t.startedAt>=Ze){d("timed_out"),k(a("sessions.pollTimeout")),await u(t.project);return}const l=await S(t.project,t.sessionId,{silent:!0});if(!l||!V.current){d(),await u(t.project);return}if(x.current.project!==t.project||x.current.sessionId!==t.sessionId){d();return}const o=ts(l.history),m=as(l.history)>t.assistantCountBefore,g=m&&o===t.lastSignature?t.stableCount+1:0,K={...t,lastSignature:o,stableCount:g};if(m&&g>=2){d(),await u(t.project);return}E("polling"),Z(K)},Ye)},[S,u,d,a]),he=r.useCallback((e,t,l)=>{d(),E("polling"),Z({project:e,sessionId:t,assistantCountBefore:l,stableCount:0,lastSignature:"",startedAt:Date.now()})},[Z,d]),Ee=r.useCallback(async e=>{if(d(),G(e),ne(""),k(""),Q(""),!e){x.current={project:"",sessionId:""},h(null),v([]),R([]),f("");return}x.current={project:e,sessionId:""},h(null),v([]),f(e),await u(e)},[u,d,f]),L=r.useCallback(async e=>{if(e.isDraft||e.live||!e.id)return e;E("activating");try{await qe(e.project,{session_key:e.sessionKey,session_id:e.id}),await u(e.project);const t=await S(e.project,e.id,{silent:!0}),l={...e,live:(t==null?void 0:t.live)??!0,isDraft:!1,detail:t??e.detail,name:(t==null?void 0:t.name)||e.name};return h(l),l}finally{E("idle")}},[S,u]),B=r.useCallback(async(e,t)=>{d(),k(""),x.current={project:e,sessionId:t.id},G(e),f(e,t.id),h({id:t.id,project:e,sessionKey:t.session_key,name:w(t),live:t.live,isDraft:!1,detail:null});const l=await S(e,t.id);l&&!l.live&&await L({id:l.id,project:e,sessionKey:l.session_key,name:l.name||w(l),live:l.live,isDraft:!1,detail:l})},[L,S,d,f]),Pe=r.useCallback(async()=>{d(),i&&(await u(i),n!=null&&n.id&&(x.current={project:i,sessionId:n.id},await S(i,n.id)))},[n==null?void 0:n.id,S,u,i,d]),ge=r.useCallback(async()=>{if(!T.trim()||!i)return;if(!A){k(a("sessions.sessionUnavailable"));return}const e=T.trim(),t=`${crypto.randomUUID()}-user`,l={id:t,role:"user",content:e,timestamp:new Date().toISOString()};Q(""),oe(!0),E("sending"),k("");try{const o=n||N[0];if(!o)throw new Error(a("sessions.noAvailableChatTarget"));let m=n&&n.id===o.id?n:{id:o.id,project:i,sessionKey:"session_key"in o?o.session_key:o.sessionKey,name:"session_key"in o?w(o):o.name,live:o.live,isDraft:!1,detail:null};(!n||n.id!==m.id)&&(x.current={project:i,sessionId:m.id},f(i,m.id),h(m)),m=await L(m),v(p=>[...p,l]);try{await be(i,{session_key:m.sessionKey,message:e})}catch(p){if(!ve(p)||!m.id)throw p;m=await L({...m,live:!1}),await be(i,{session_key:m.sessionKey,message:e})}const g=m.id;if(!g)throw new Error(a("sessions.createFailed"));const K=I.filter(p=>p.role!=="user").length;x.current={project:i,sessionId:g},h(p=>p&&{...p,id:g,isDraft:!1}),f(i,g),he(i,g,K),await u(i)}catch(o){d(),v(g=>g.filter(K=>K.id!==t));const m=rs(o,a);k(m)}finally{oe(!1)}},[n,A,L,T,N,I,u,i,he,d,a,f]),Re=r.useCallback(async()=>{if(!(!z||!i||!F.trim())){W("rename");try{await Fe(i,z.id,{name:F.trim()});const t=(await u(i)).find(l=>l.id===z.id);t&&(n==null?void 0:n.id)===t.id&&h(l=>l&&{...l,name:w(t)}),q(null),Y("")}finally{W(null)}}},[n==null?void 0:n.id,u,F,z,i]),Ie=r.useCallback(async()=>{if(!(!M||!i)){W("delete");try{await Oe(i,M.id);const e=await u(i);(n==null?void 0:n.id)===M.id&&(d(),x.current={project:i,sessionId:""},h(null),v([]),f(i)),e.length===0&&v([]),O(null)}finally{W(null)}}},[n==null?void 0:n.id,M,u,i,d,f]);r.useEffect(()=>{fe()},[fe]),r.useEffect(()=>{b&&(i&&i===b||G(b))},[b,i]),r.useEffect(()=>{if(!i){R([]);return}x.current.project=i,u(i)},[u,i]),r.useEffect(()=>{!i||D||n!=null&&n.id||N.length===0||B(i,N[0])},[n==null?void 0:n.id,N,B,D,i]),r.useEffect(()=>{if(!b||!D||i!==b)return;const e=j.find(t=>t.id===D);if(!e){j.length>0&&f(b,j[0].id);return}(n==null?void 0:n.id)!==e.id&&B(b,e)},[n==null?void 0:n.id,B,b,D,i,j,f]),r.useEffect(()=>{var e;(e=me.current)==null||e.scrollIntoView({behavior:"smooth"})},[I]),r.useEffect(()=>()=>d(),[d]);const Te=(n==null?void 0:n.name)||a("sessions.activeChat");return s.jsxs("div",{className:"grid min-h-[calc(100vh-8rem)] grid-cols-1 gap-4 xl:grid-cols-[22rem_minmax(0,1fr)] animate-fade-in",children:[s.jsxs(pe,{className:"flex flex-col gap-4 p-4 xl:h-[calc(100vh-8rem)] xl:overflow-hidden",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.2em] text-gray-400",children:a("sessions.selectProject")}),s.jsxs("select",{value:i,onChange:e=>void Ee(e.target.value),className:"mt-2 w-full rounded-xl border border-gray-300/90 bg-white/90 px-3 py-2 text-sm text-gray-900 transition-all focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/45 dark:border-white/[0.1] dark:bg-[rgba(0,0,0,0.45)] dark:text-white",children:[s.jsx("option",{value:"",children:a("sessions.allProjects")}),se.map(e=>s.jsx("option",{value:e.name,children:e.name},e.name))]})]})}),s.jsxs("div",{className:"relative",children:[s.jsx(ye,{value:J,onChange:e=>ne(e.target.value),placeholder:a("common.search"),className:"pl-9","aria-label":a("common.search")}),s.jsx(Ve,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[s.jsx("span",{children:a("sessions.historyTitle")}),s.jsx("span",{children:N.length})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto space-y-2 pr-1",children:Ne?s.jsx("div",{className:"flex h-32 items-center justify-center text-gray-400",children:s.jsx(P,{className:"animate-spin",size:18})}):i?Se&&j.length===0?s.jsx("div",{className:"flex h-32 items-center justify-center text-gray-400",children:s.jsx(P,{className:"animate-spin",size:18})}):j.length===0?s.jsx($,{message:a("sessions.noSessions"),icon:U}):N.length===0?s.jsx($,{message:a("sessions.noSessions"),icon:U}):N.map(e=>{const t=e.id===(n==null?void 0:n.id);return s.jsxs("div",{className:ee("rounded-2xl border p-3 transition-all",t?"border-accent/45 bg-accent/10 shadow-[0_0_20px_-12px_rgba(139,92,246,0.55)]":"border-gray-200/80 bg-white/70 hover:border-accent/30 dark:border-white/[0.08] dark:bg-white/[0.03]"),children:[s.jsxs("button",{type:"button",onClick:()=>void B(i,e),className:"w-full text-left","data-testid":"web-chat-session-open",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:w(e)}),e.live||ue.has(e.id)?s.jsx("span",{className:"rounded-full bg-violet-50 px-2 py-0.5 text-[10px] text-violet-600 dark:bg-violet-950/20 dark:text-violet-300",children:"live"}):s.jsx("span",{className:"rounded-full bg-gray-100 px-2 py-0.5 text-[10px] text-gray-400 dark:bg-white/[0.06] dark:text-gray-500",children:"history"})]}),s.jsx("p",{className:"mt-1 truncate text-xs text-gray-500 dark:text-gray-400",children:He(e.updated_at||e.created_at,a("sessions.justNow"))})]}),s.jsx("span",{className:"shrink-0 text-[10px] text-gray-400",children:e.history_count})]}),s.jsx("p",{className:"mt-2 line-clamp-2 text-xs text-gray-500 dark:text-gray-400",children:ns(e,a)})]}),s.jsxs("div",{className:"mt-3 flex items-center justify-end gap-1",children:[s.jsx(C,{size:"sm",variant:"ghost",onClick:()=>{q({id:e.id,name:w(e)}),Y(w(e))},"data-testid":"web-chat-session-rename",children:s.jsx(Ge,{size:14})}),s.jsx(C,{size:"sm",variant:"ghost",onClick:()=>O({id:e.id,name:w(e)}),"data-testid":"web-chat-session-delete",children:s.jsx(Je,{size:14})})]})]},e.id)}):s.jsx($,{message:a("sessions.projectRequired"),icon:U})})]})]}),s.jsxs(pe,{className:"flex min-h-[32rem] flex-col p-0 xl:h-[calc(100vh-8rem)]",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-gray-200/80 px-5 py-4 dark:border-white/[0.08]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("h2",{className:"truncate text-lg font-semibold text-gray-900 dark:text-white",children:Te})}),s.jsx("p",{className:"mt-1 truncate text-sm text-gray-500 dark:text-gray-400",children:n?n.project:a("sessions.sendHint")})]}),s.jsxs(C,{size:"sm",variant:"secondary",onClick:()=>void Pe(),"data-testid":"web-chat-refresh",children:[s.jsx(De,{size:14})," ",a("common.refresh")]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-5",children:i?Ce?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400",children:s.jsx(P,{className:"animate-spin",size:22})}):I.length===0?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx($,{message:a(n?"sessions.noMessages":"sessions.sendHint"),icon:U})}):s.jsxs("div",{className:"space-y-5",children:[I.map(e=>{const t=e.role==="user";return s.jsxs("div",{className:ee("flex gap-3",t?"justify-end":"justify-start"),children:[!t&&s.jsx("div",{className:"mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-accent/10",children:s.jsx(Qe,{size:16,className:"text-accent"})}),s.jsx("div",{className:ee("max-w-[85%] rounded-2xl px-5 py-3.5 text-sm",t?"bg-accent text-white rounded-br-md":"border border-gray-200 bg-white text-gray-900 shadow-sm dark:border-white/[0.08] dark:bg-[rgba(0,0,0,0.42)] dark:text-gray-100 rounded-bl-md"),children:s.jsx(Le,{content:e.content,isUser:t})}),t&&s.jsx("div",{className:"mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-200 dark:bg-white/[0.08]",children:s.jsx(Xe,{size:16,className:"text-gray-500 dark:text-gray-300"})})]},e.id)}),s.jsx("div",{ref:me})]}):s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx($,{message:a("sessions.emptySelection"),icon:U})})}),s.jsxs("div",{className:"border-t border-gray-200/80 px-5 py-4 dark:border-white/[0.08]",children:[ce&&s.jsx("div",{className:"mb-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-600 dark:border-red-900/40 dark:bg-red-950/20 dark:text-red-300",children:ce}),_==="polling"&&s.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400",children:[s.jsx(P,{size:14,className:"animate-spin"}),s.jsx("span",{children:a("sessions.waitingForReply")})]}),_==="activating"&&s.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400",children:[s.jsx(P,{size:14,className:"animate-spin"}),s.jsx("span",{children:a("sessions.preparingChat")})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ae,{value:T,onChange:e=>Q(e.target.value),onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),ge())},rows:3,placeholder:a(i?"sessions.messageInput":"sessions.projectRequired"),disabled:!i||!A||X||_==="polling"||_==="activating",className:"min-h-[104px] rounded-[24px] border-gray-200 bg-white px-4 pb-16 pt-3 text-[15px] leading-6 shadow-[0_12px_34px_rgba(15,23,42,0.08)] dark:border-white/[0.08] dark:bg-[rgba(0,0,0,0.42)] sm:min-h-[112px] sm:px-5 sm:pt-4","data-testid":"web-chat-input"}),s.jsx(C,{onClick:()=>void ge(),disabled:!_e,size:"icon","aria-label":a("sessions.send"),className:"absolute bottom-3 right-3 h-11 w-11 rounded-full bg-slate-900 px-0 text-white shadow-none hover:bg-slate-800 disabled:bg-slate-300 disabled:text-white disabled:opacity-100 dark:bg-slate-100 dark:text-slate-950 dark:hover:bg-white dark:disabled:bg-white/20 dark:disabled:text-white/55 sm:h-12 sm:w-12","data-testid":"web-chat-send",children:X?s.jsx(P,{size:18,className:"animate-spin"}):s.jsx(Be,{size:22,strokeWidth:2.2})})]}),!A&&n&&s.jsx("div",{className:"mt-3 rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-500 dark:border-white/[0.08] dark:bg-white/[0.03] dark:text-gray-400",children:a("sessions.notLiveHint")})]})]}),s.jsx(je,{open:!!z,onClose:()=>q(null),title:a("sessions.renameTitle"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(ye,{value:F,onChange:e=>Y(e.target.value),placeholder:a("sessions.renamePlaceholder"),"data-testid":"web-chat-rename-input"}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(C,{variant:"secondary",onClick:()=>q(null),children:a("common.cancel")}),s.jsx(C,{onClick:()=>void Re(),loading:de==="rename","data-testid":"web-chat-rename-save",children:a("common.save")})]})]})}),s.jsx(je,{open:!!M,onClose:()=>O(null),title:a("sessions.deleteConfirmTitle"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("sessions.deleteConfirmBody")}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(C,{variant:"secondary",onClick:()=>O(null),children:a("common.cancel")}),s.jsx(C,{variant:"danger",onClick:()=>void Ie(),loading:de==="delete","data-testid":"web-chat-delete-confirm",children:a("common.delete")})]})]})})]})}export{js as default};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{c as m,u as B,r as n,j as e,B as c,R as E,L as $,$ as H,I as q,a0 as T,a1 as V}from"./index-DwhTjLA1.js";import{g as F,q as X,v as R,w as G,x as J}from"./desktop-Ci1fnRDR.js";import{B as x}from"./Badge-BIojwD6s.js";import{P as O,S as o,a as C}from"./Page-urf5GcT_.js";import{S as Q}from"./shield-check-Cnn-yQUA.js";import{S as W}from"./save-CJ_QFPw0.js";import{P as Y}from"./plug-Mexu4gyV.js";/**
|
|
2
|
-
* @license lucide-react v0.487.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Z=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],ee=m("file-code",Z);/**
|
|
7
|
-
* @license lucide-react v0.487.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const se=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],te=m("rotate-ccw",se);/**
|
|
12
|
-
* @license lucide-react v0.487.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ae=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],ne=m("scroll-text",ae);/**
|
|
17
|
-
* @license lucide-react v0.487.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const re=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],ie=m("stethoscope",re);function oe(a){return a==="api_ready"?"success":a==="error"?"danger":a==="starting"?"warning":"neutral"}function he(){const{t:a}=B(),[t,h]=n.useState(null),[l,M]=n.useState(null),[p,f]=n.useState([]),[d,I]=n.useState(null),[u,j]=n.useState(""),[D,v]=n.useState(""),[P,y]=n.useState(!0),[w,N]=n.useState(!1),[z,k]=n.useState(!1),[b,i]=n.useState(""),g=n.useCallback(async()=>{y(!0);try{const[s,r,S]=await Promise.allSettled([F(),X(),R()]);s.status==="fulfilled"&&(h(s.value),j(s.value.settings.knowledge.baseUrl||""),v(s.value.settings.knowledge.baseUrl||"")),r.status==="fulfilled"&&M(r.value),S.status==="fulfilled"&&f(S.value)}finally{y(!1)}},[]);n.useEffect(()=>{g()},[g]);const A=async()=>{if(confirm(a("system.restartConfirm")))try{await T(),i(a("common.success")),await g()}catch(s){i(s.message)}},L=async()=>{if(confirm(a("system.reloadConfirm")))try{await V(),i(a("common.success")),await g()}catch(s){i(s.message)}},U=async()=>{N(!0);try{const s=await G({knowledge:{baseUrl:u,authMode:(t==null?void 0:t.settings.knowledge.authMode)||"none",token:(t==null?void 0:t.settings.knowledge.token)||"",headerName:(t==null?void 0:t.settings.knowledge.headerName)||"X-API-Key",defaultCollection:(t==null?void 0:t.settings.knowledge.defaultCollection)||"personal_knowledge"}});h(r=>r&&{...r,settings:s}),v(s.knowledge.baseUrl||""),i(a("common.success"))}catch(s){i(s.message)}finally{N(!1)}},_=async()=>{k(!0);try{const s=await J();I(s),f(await R()),i(`Diagnostics completed with ${s.status} status.`)}catch(s){i(s.message)}finally{k(!1)}},K=u!==D;return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(O,{title:a("nav.system"),description:"Runtime health, logs, and plugin diagnostics. Advanced config is available read-only from the diagnostics drawer.",actions:e.jsxs(e.Fragment,{children:[e.jsxs(c,{variant:"secondary",onClick:L,children:[e.jsx(E,{size:16})," ",a("system.reload")]}),e.jsxs(c,{variant:"danger",onClick:A,children:[e.jsx(te,{size:16})," ",a("system.restart")]}),e.jsx($,{to:"/system/logs",children:e.jsxs(c,{variant:"secondary",children:[e.jsx(ne,{size:16})," ",a("system.logs")]})})]})}),b?e.jsx("div",{role:"status",className:"rounded-lg border border-primary/20 bg-primary/10 px-4 py-3 text-sm text-primary",children:b}):null,e.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[e.jsxs(o,{title:"Runtime",description:P?"Loading...":"Local service status.",children:[e.jsx(C,{tone:oe(t==null?void 0:t.phase),children:(t==null?void 0:t.phase)||"unknown"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:t!=null&&t.pendingRestart?"Restart required to apply saved changes.":"No pending restart."})]}),e.jsx(o,{title:"Config",description:"Active config file location.",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ee,{size:18,className:"mt-0.5 text-primary"}),e.jsx("p",{className:"break-all font-mono text-xs leading-5 text-muted-foreground",children:(t==null?void 0:t.settings.configPath)||(t==null?void 0:t.configFile.path)||"-"})]})}),e.jsxs(o,{title:"Plugins",description:"Health summary only.",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:l?`${l.enabledPluginCount}/${l.pluginCount}`:"-"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"enabled plugins"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-2",children:[e.jsx(o,{title:"Diagnostics",description:"Structured runtime and channel health checks.",actions:e.jsxs(c,{size:"sm",variant:"secondary",onClick:()=>void _(),loading:z,children:[e.jsx(ie,{size:14})," Run doctor"]}),children:d?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{tone:d.status==="pass"?"success":d.status==="warn"?"warning":"danger",children:d.status}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Checked ",new Date(d.checkedAt).toLocaleString()]})]}),e.jsx("div",{className:"space-y-2",children:d.checks.map(s=>{var r;return e.jsx("div",{className:"rounded-lg border border-border px-3 py-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:s.label}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:s.summary}),(r=s.errorInfo)!=null&&r.suggestedAction?e.jsx("p",{className:"mt-1 text-xs leading-5 text-amber-700 dark:text-amber-200",children:s.errorInfo.suggestedAction}):null]}),e.jsx(x,{variant:s.status==="pass"?"success":s.status==="warn"?"warning":"danger",children:s.status})]})},s.id)})})]}):e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(Q,{size:16,className:"mt-0.5 shrink-0"}),e.jsx("p",{children:"Run doctor to validate config, runtime readiness, channel health, and log access."})]})}),e.jsx(o,{title:"Recent Errors",description:"Aggregated runtime and channel failures from the current window.",children:p.length===0?e.jsx("div",{className:"py-8 text-sm text-muted-foreground",children:"No aggregated errors in the current diagnostics window."}):e.jsx("div",{className:"space-y-3",children:p.map(s=>e.jsx("div",{className:"rounded-lg border border-border px-3 py-3",children:e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(H,{size:14,className:"text-amber-500"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:s.errorInfo.userMessage}),e.jsx(x,{variant:s.errorInfo.severity==="error"?"danger":s.errorInfo.severity==="warning"?"warning":"info",children:s.errorInfo.code})]}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:s.errorInfo.message}),s.errorInfo.suggestedAction?e.jsx("p",{className:"mt-1 text-xs leading-5 text-amber-700 dark:text-amber-200",children:s.errorInfo.suggestedAction}):null,e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[s.count," occurrence(s), last seen ",new Date(s.lastSeenAt).toLocaleString()]})]})})},s.key))})})]}),e.jsx(o,{title:"Knowledge",description:"System-wide knowledge API connection.",actions:e.jsxs(c,{size:"sm",onClick:()=>void U(),loading:w,disabled:!K&&!w,children:[e.jsx(W,{size:14})," Save"]}),children:e.jsx(q,{label:"Knowledge base URL",value:u,onChange:s=>j(s.target.value),placeholder:"http://127.0.0.1:16007"})}),e.jsx(o,{title:a("system.plugins"),description:"Plugin state is read-only in the daily UI. Use backend config for advanced changes.",children:l?l.plugins.length===0?e.jsx("div",{className:"py-8 text-sm text-muted-foreground",children:"No plugins registered."}):e.jsx("div",{className:"divide-y divide-border",children:l.plugins.map(s=>e.jsxs("div",{className:"flex items-start justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{size:15,className:"text-muted-foreground"}),e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:s.pluginId})]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.health.summary||s.manifest.provides.join(", ")||"No declared capabilities"})]}),e.jsx(x,{variant:s.health.status==="healthy"?"success":s.health.status==="failed"?"danger":"warning",children:s.health.status})]},s.pluginId))}):e.jsx("div",{className:"py-8 text-sm text-muted-foreground",children:"Loading..."})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{J as R,l as b,K as z,N as D,O as W,P as O,u as B,r as n,j as t,s as F,B as c,G as L,C as U,E as k,I as f,T as G}from"./index-DwhTjLA1.js";import{B as u}from"./Badge-BIojwD6s.js";import{M as H}from"./Modal-D2U4r2V0.js";import{S as w}from"./Select-CAscWpy5.js";import{E as K}from"./EmptyState-BqCx1oWr.js";import{P as _}from"./Page-urf5GcT_.js";import{P as q}from"./plus-B_Q5-Oj7.js";import{P as Q}from"./play-CGYnmC4Q.js";import{P as V}from"./pencil-CHiy1MvK.js";import{T as X}from"./trash-2-oWCxwQ9D.js";import"./index-Df-Trovt.js";import"./chevron-down-Bb_3EHq9.js";import"./check-DGlyq4xX.js";const Y=a=>R(),Z=a=>D(a),$=(a,o)=>z(a,o),ee=a=>W(a),te=a=>O(a),ae=()=>b().then(a=>a.workspaces),x={workspaceId:"",executionMode:"same-thread",triggerType:"cron",cronExpr:"0 9 * * *",runAt:"",promptTemplate:"",description:"",chatId:"",platformUserId:"",threadId:"",enabled:!0};function se(a){return a?{workspaceId:a.workspaceId,executionMode:a.executionMode,triggerType:a.triggerType,cronExpr:a.cronExpr||"0 9 * * *",runAt:a.runAt?String(a.runAt).slice(0,16):"",promptTemplate:a.promptTemplate,description:a.description,chatId:a.route.channelId,platformUserId:a.route.participantId||"",threadId:a.route.threadId||"",enabled:a.enabled}:x}function re(a){return{workspaceId:a.workspaceId,platform:"local",route:{type:"local.thread",channelId:a.workspaceId||"local",...a.threadId?{threadId:a.threadId}:{}},executionMode:a.executionMode||"same-thread",triggerType:a.triggerType,...a.triggerType==="cron"?{cronExpr:a.cronExpr,runAt:void 0}:{runAt:new Date(a.runAt).toISOString(),cronExpr:void 0},promptTemplate:a.promptTemplate,description:a.description,enabled:a.enabled}}function ye(){const{t:a}=B(),[o,I]=n.useState([]),[m,T]=n.useState([]),[C,y]=n.useState(!0),[S,d]=n.useState(!1),[j,v]=n.useState(!1),[p,h]=n.useState(null),[s,r]=n.useState(x),E=n.useMemo(()=>m.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id)),[m]),i=n.useCallback(async()=>{y(!0);try{const[e,l]=await Promise.all([Y(),ae()]);I(e.jobs||[]),T(l),r(g=>g.workspaceId||l.length===0?g:{...g,workspaceId:l[0].id})}finally{y(!1)}},[]);n.useEffect(()=>{i();const e=F(l=>{(l.type==="scheduler.job.updated"||l.type==="scheduler.run.updated")&&i()});return()=>e()},[i]);const J=()=>{var e;h(null),r({...x,workspaceId:((e=m[0])==null?void 0:e.id)||""}),d(!0)},N=e=>{h(e),r(se(e)),d(!0)},A=async()=>{if(!(!s.workspaceId||!s.promptTemplate.trim())&&!(s.triggerType==="once"&&!s.runAt)){v(!0);try{const e=re(s);p?await $(p.id,e):await Z(e),d(!1),h(null),r(x),await i()}finally{v(!1)}}},M=async e=>{confirm(a("common.confirmDelete"))&&(await ee(e),await i())},P=async e=>{await te(e),await i()};return C&&o.length===0?t.jsx("div",{className:"flex items-center justify-center h-64 text-gray-400 animate-pulse",children:a("common.loading")}):t.jsxs("div",{className:"space-y-4 animate-fade-in",children:[t.jsx(_,{title:a("cron.title"),description:"Create simple scheduled prompts for a workspace.",actions:t.jsxs(c,{onClick:J,children:[t.jsx(q,{size:16})," ",a("cron.add")]})}),o.length===0?t.jsx(K,{message:a("cron.noJobs"),icon:L}):t.jsx("div",{className:"space-y-3",children:o.map(e=>t.jsx(U,{children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-white text-sm",children:e.description||e.id}),t.jsx(u,{variant:e.enabled?"success":"default",children:e.enabled?a("cron.enabled"):"disabled"}),t.jsx(u,{variant:"default",children:e.triggerType}),t.jsx(u,{variant:"default",children:e.platform}),e.lastStatus&&t.jsx(u,{variant:e.lastStatus==="failed"?"danger":"default",children:e.lastStatus})]}),t.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400 mt-2",children:[t.jsxs("span",{children:[t.jsx("strong",{children:"Workspace:"})," ",e.workspaceId]}),t.jsxs("span",{children:[t.jsx("strong",{children:"Execution:"})," ",e.executionMode]}),t.jsxs("span",{children:[t.jsx("strong",{children:"Route:"})," ",e.route.channelId," / ",e.route.participantId]}),t.jsxs("span",{children:[t.jsxs("strong",{children:[e.triggerType==="cron"?a("cron.expression"):"Run at",":"]})," ",e.triggerType==="cron"?e.cronExpr:k(e.runAt||"")]}),e.route.threadId&&t.jsxs("span",{children:[t.jsx("strong",{children:"Thread:"})," ",e.route.threadId]}),e.lastRunAt&&t.jsxs("span",{children:[t.jsxs("strong",{children:[a("cron.lastRun"),":"]})," ",k(e.lastRunAt)]})]}),t.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mt-2 whitespace-pre-wrap",children:e.promptTemplate}),e.lastError&&t.jsx("p",{className:"text-xs text-red-500 mt-2",children:e.lastError})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c,{size:"sm",variant:"secondary",onClick:()=>void P(e.id),children:t.jsx(Q,{size:14})}),t.jsx(c,{size:"sm",variant:"secondary",onClick:()=>N(e),children:t.jsx(V,{size:14})}),t.jsx(c,{size:"sm",variant:"danger",onClick:()=>void M(e.id),children:t.jsx(X,{size:14})})]})]})},e.id))}),t.jsx(H,{open:S,onClose:()=>d(!1),title:p?"Edit scheduler job":a("cron.add"),children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs(w,{label:"Workspace",value:s.workspaceId,onChange:e=>r({...s,workspaceId:e.target.value}),children:[t.jsx("option",{value:"",children:"Select workspace"}),E]}),t.jsxs(w,{label:"Schedule type",value:s.triggerType,onChange:e=>r({...s,triggerType:e.target.value}),children:[t.jsx("option",{value:"cron",children:"Repeating"}),t.jsx("option",{value:"once",children:"One time"})]}),s.triggerType==="cron"?t.jsx(f,{label:a("cron.expression"),value:s.cronExpr,onChange:e=>r({...s,cronExpr:e.target.value}),placeholder:"0 9 * * *"}):t.jsx(f,{label:"Run at",type:"datetime-local",value:s.runAt,onChange:e=>r({...s,runAt:e.target.value})}),t.jsx(f,{label:a("cron.description"),value:s.description,onChange:e=>r({...s,description:e.target.value})}),t.jsx(G,{label:a("cron.prompt"),value:s.promptTemplate,onChange:e=>r({...s,promptTemplate:e.target.value}),rows:4,placeholder:"Summarize today's blockers and post a status update."}),t.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:s.enabled,onChange:e=>r({...s,enabled:e.target.checked})}),a("cron.enabled")]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[t.jsx(c,{variant:"secondary",onClick:()=>d(!1),children:a("common.cancel")}),t.jsx(c,{onClick:()=>void A(),disabled:j,children:a(p?"common.save":"cron.add")})]})]})})]})}export{ye as default};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{c as b,u as te,r,a as ae,l as re,b as w,d as ie,e as ne,j as e,M as de,W as le,F as W,C as f,B as ce,R as oe,f as me,L as R,S as xe}from"./index-DwhTjLA1.js";import{B as d}from"./Badge-BIojwD6s.js";import{E as j}from"./EmptyState-BqCx1oWr.js";import{P as he}from"./Page-urf5GcT_.js";import{l as ue}from"./projects-C6bbkC-O.js";import{l as ge,r as pe,o as fe,a as je}from"./desktop-Ci1fnRDR.js";import{S as be,A as H}from"./server-Cd96R7WL.js";import{B as ke}from"./book-open-BDoAu82s.js";import{S as V}from"./shield-check-Cnn-yQUA.js";/**
|
|
2
|
-
* @license lucide-react v0.487.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ve=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ye=b("activity",ve);/**
|
|
7
|
-
* @license lucide-react v0.487.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Ne=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],we=b("calendar-clock",Ne);/**
|
|
12
|
-
* @license lucide-react v0.487.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Ae=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Re=b("circle-check",Ae);/**
|
|
17
|
-
* @license lucide-react v0.487.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Se=[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]],F=b("cpu",Se);/**
|
|
22
|
-
* @license lucide-react v0.487.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const _e=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],Le=b("list-checks",_e);function Me({title:t,description:a,to:m,icon:h,primary:l}){return e.jsxs(R,{to:m,className:["group flex min-h-[118px] flex-col justify-between rounded-2xl p-5 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-ring",l?"bg-black/[0.07] text-foreground hover:bg-black/[0.09] dark:bg-white/[0.10] dark:hover:bg-white/[0.13]":"bg-white/54 text-foreground hover:bg-white/72 dark:bg-white/[0.055] dark:hover:bg-white/[0.085]"].join(" "),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-white/70 text-primary shadow-[0_1px_1px_rgba(0,0,0,0.04)] dark:bg-white/[0.08]",children:e.jsx(h,{size:20})}),e.jsx(H,{size:17,className:"mt-1 text-muted-foreground/45 transition-colors group-hover:text-foreground"})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:t}),e.jsx("p",{className:"mt-2 max-w-sm text-sm leading-5 text-muted-foreground",children:a})]})]})}function Ee(t){return t.readiness==="ready"?"success":t.readiness==="failed"?"danger":t.readiness==="degraded"?"warning":t.status==="installed"?"success":t.status==="error"?"danger":"warning"}function Ce(t){return t.readiness||(t.status==="installed"?"ready":"unknown")}function A({title:t,description:a,tasks:m,empty:h,urgent:l}){return e.jsxs(f,{className:"overflow-hidden p-0",children:[e.jsx("div",{className:"border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:t}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a})]}),e.jsx(d,{variant:l&&m.length>0?"warning":"secondary",children:m.length})]})}),m.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:h,icon:Le})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:m.map(c=>e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:c.title}),e.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[c.workspaceId," · ",c.runtimeId]})]}),e.jsx(d,{variant:c.status==="failed"?"danger":c.status==="completed"?"success":"info",children:c.status})]}),e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Updated ",new Date(c.updatedAt).toLocaleString()]})]},c.taskId))})]})}function ze({approvals:t}){return e.jsxs(f,{className:"overflow-hidden p-0",children:[e.jsx("div",{className:"border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"待审批"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"高风险操作会在这里等待确认或拒绝。"})]}),e.jsx(d,{variant:t.length>0?"warning":"secondary",children:t.length})]})}),t.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:"暂无待审批操作",icon:V})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:t.map(a=>e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),e.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[a.workspaceId," · ",a.kind]})]}),e.jsx(d,{variant:a.riskLevel==="high"?"danger":"warning",children:a.riskLevel})]}),e.jsx("p",{className:"mt-2 line-clamp-2 text-xs leading-5 text-muted-foreground",children:a.description})]},a.approvalId))})]})}function De({events:t}){return e.jsxs(f,{className:"overflow-hidden p-0",children:[e.jsxs("div",{className:"border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"审计记录"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"最近的任务、审批和权限事件。"})]}),t.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:"暂无审计记录",icon:V})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:t.map(a=>e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.summary}),e.jsxs("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:[a.type," · ",a.actor||"system"]})]}),a.riskLevel?e.jsx(d,{variant:a.riskLevel==="high"?"danger":"secondary",children:a.riskLevel}):null]}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]},a.auditId))})]})}function Ve(){const{t}=te(),[a,m]=r.useState([]),[h,l]=r.useState([]),[c,S]=r.useState([]),[U,_]=r.useState([]),[K,L]=r.useState([]),[O,M]=r.useState([]),[Q,E]=r.useState([]),[G,C]=r.useState(!0),[J,z]=r.useState(!1),[X,g]=r.useState(!1),[D,T]=r.useState(""),[P,p]=r.useState(""),{desktopRuntime:o,desktopWorkspace:I,knowledgeModule:q,schedulerModule:$}=ae(),B=h.filter(s=>s.installed),k=[{title:"继续聊天",description:"打开本地对话,继续当前项目里的 agent 线程。",to:"/chat",icon:de,primary:!0},{title:"工作区",description:"管理项目、平台、模型和本地运行配置。",to:I?"/workspace":"/projects",icon:I?le:W}];q&&k.push({title:"知识库",description:"上传文档,维护可被检索的项目资料。",to:"/knowledge",icon:ke}),$&&k.push({title:"定时任务",description:"查看和管理自动执行的计划任务。",to:"/cron",icon:we}),(!q||!$)&&k.push({title:"系统设置",description:"查看配置、日志和桌面应用偏好。",to:"/system",icon:xe});const v=r.useCallback(async()=>{var s;C(!0),T(""),p("");try{if(o){const[u,i]=await Promise.all([re(),ge().then(x=>({status:"fulfilled",runtimes:x}),x=>({status:"rejected",error:x}))]),[N,y,Z]=await Promise.all([w({status:["created","queued","running"],limit:6}),w({status:"waiting_for_user",limit:6}),w({status:["completed","failed","cancelled"],limit:6})]),[ee,se]=await Promise.all([ie({status:"pending",limit:6}),ne({limit:6})]);S(N.tasks||[]),_(y.tasks||[]),L(Z.tasks||[]),M(ee.approvals||[]),E(se.events||[]),m((u.workspaces||[]).map(x=>({name:x.name,agent_type:x.agentType,platforms:x.platforms,sessions_count:x.sessionsCount,heartbeat_enabled:x.heartbeatEnabled}))),i.status==="fulfilled"?l(i.runtimes):(l([]),p(((s=i.error)==null?void 0:s.message)||String(i.error)));return}const n=await ue();m(n.projects||[]),l([]),S([]),_([]),L([]),M([]),E([])}catch(n){T(n.message||String(n))}finally{C(!1)}},[o]),Y=r.useCallback(async()=>{z(!0),g(!0),p("");try{l(await pe())}catch(s){p(s.message||String(s))}finally{z(!1),g(!1)}},[]);return r.useEffect(()=>{v();const s=()=>v();window.addEventListener("cc:refresh",s);const n=o?fe(()=>{v()}):()=>{},u=o?je(i=>{if(i.type==="runtime.detect.started"){g(!0);return}if(i.type==="runtime.detect.completed"){g(!1),l(i.runtimes);return}if(i.type==="runtime.detect.failed"){g(!1),p(i.error);return}i.type==="runtime.status.changed"&&l(N=>N.map(y=>y.runtimeId===i.runtime.runtimeId?i.runtime:y))}):()=>{};return()=>{window.removeEventListener("cc:refresh",s),n(),u()}},[o,v]),G&&a.length===0?e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:e.jsx(ye,{className:"animate-pulse",size:24})}):e.jsxs("div",{className:"animate-fade-in space-y-8",children:[e.jsx(he,{title:"概览",description:"继续最近的工作,或进入项目、知识和自动化配置。当前版本 v0.1.45"}),D?e.jsx("div",{role:"alert",className:"rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-200",children:D}):null,e.jsxs("section",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-end justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold tracking-tight text-foreground",children:"快速开始"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"常用入口会保留在最前面。"})]})}),e.jsx("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:k.map(s=>e.jsx(Me,{...s},s.to))})]}),o?e.jsxs(f,{className:"overflow-hidden p-0",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07] sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"本机 Agent Runtime"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"显示本机 runtime 安装检测状态,不执行安装或登录检查。"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(d,{variant:B.length>0?"success":"default",children:[B.length," installed"]}),X?e.jsx(d,{variant:"info",children:"checking"}):null,e.jsxs(ce,{variant:"outline",size:"sm",loading:J,onClick:Y,title:"刷新 runtime 检测",children:[e.jsx(oe,{size:15}),"刷新"]})]})]}),P?e.jsxs("div",{className:"px-5 py-4 text-sm text-amber-700 dark:text-amber-200",children:["检测失败:",P]}):h.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:"还没有 runtime 检测结果",icon:F})}):e.jsx("div",{className:"grid grid-cols-1 gap-3 p-5 md:grid-cols-2 xl:grid-cols-3",children:h.map(s=>{var n,u;return e.jsxs("div",{className:"rounded-2xl border border-black/[0.08] bg-white/50 p-4 shadow-[0_8px_24px_rgba(15,23,42,0.05)] dark:border-white/[0.08] dark:bg-white/[0.055]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:["flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",s.status==="installed"?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-300":s.status==="error"?"bg-red-500/10 text-red-600 dark:text-red-200":"bg-amber-500/10 text-amber-700 dark:text-amber-200"].join(" "),children:e.jsx(F,{size:19})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:s.displayName}),e.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:s.agentType})]})]}),s.status==="installed"?e.jsx(Re,{size:18,className:"mt-0.5 shrink-0 text-emerald-500"}):e.jsx(me,{size:18,className:"mt-0.5 shrink-0 text-amber-500"})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx(d,{variant:s.status==="installed"?"success":s.status==="error"?"danger":"warning",children:s.status}),e.jsx(d,{variant:Ee(s),children:Ce(s)}),e.jsx(d,{children:s.source}),s.version?e.jsxs(d,{variant:"secondary",children:["v",s.version]}):null]}),e.jsx("p",{className:"mt-3 text-sm leading-5 text-muted-foreground",children:s.summary}),s.lastLaunchError?e.jsx("p",{className:"mt-2 text-xs leading-5 text-red-600 dark:text-red-200",children:s.lastLaunchError.userMessage}):s.issues[0]?e.jsx("p",{className:"mt-2 text-xs leading-5 text-amber-700 dark:text-amber-200",children:s.issues[0].message}):null,(n=s.lastLaunchError)!=null&&n.suggestedAction?e.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:s.lastLaunchError.suggestedAction}):null,s.binaryPath||s.command?e.jsx("p",{className:"mt-3 truncate rounded-lg bg-black/[0.045] px-2.5 py-2 font-mono text-xs text-muted-foreground dark:bg-white/[0.06]",children:s.binaryPath||s.command}):null,s.recommendedActions[0]&&!((u=s.lastLaunchError)!=null&&u.suggestedAction)?e.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:s.recommendedActions[0].description}):null,e.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:["Last checked ",new Date(s.lastCheckedAt||s.detectedAt).toLocaleString()]})]},s.agentType)})})]}):null,o?e.jsxs("section",{className:"grid grid-cols-1 gap-4 xl:grid-cols-3",children:[e.jsx(A,{title:"运行中任务",description:"正在排队或执行的 agent 工作。",tasks:c,empty:"暂无运行中的任务"}),e.jsx(A,{title:"等待处理",description:"需要用户输入或审批的任务。",tasks:U,empty:"暂无等待处理的任务",urgent:!0}),e.jsx(A,{title:"最近完成",description:"最近结束、失败或取消的任务。",tasks:K,empty:"暂无最近任务"})]}):null,o?e.jsxs("section",{className:"grid grid-cols-1 gap-4 xl:grid-cols-2",children:[e.jsx(ze,{approvals:O}),e.jsx(De,{events:Q})]}):null,e.jsxs(f,{className:"p-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-black/[0.08] px-5 py-4 dark:border-white/[0.07]",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:t("nav.projects")}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"最近配置和会话概览。"})]}),e.jsx(R,{to:o?"/workspace":"/projects",className:"text-sm font-medium text-primary transition-colors hover:text-primary/80",children:t("common.viewAll")})]}),a.length===0?e.jsx("div",{className:"p-5",children:e.jsx(j,{message:t("projects.noProjects"),icon:W})}):e.jsx("div",{className:"divide-y divide-black/[0.08] dark:divide-white/[0.07]",children:a.slice(0,6).map(s=>{var n;return e.jsxs(R,{to:o?`/workspace?project=${encodeURIComponent(s.name)}`:`/projects/${s.name}`,className:"group flex items-center justify-between gap-3 px-5 py-4 transition-colors duration-200 hover:bg-black/[0.04] dark:hover:bg-white/[0.06]",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:e.jsx(be,{size:17})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:s.name}),e.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[s.agent_type," · ",((n=s.platforms)==null?void 0:n.join(", "))||"no platform"," · ",s.sessions_count," sessions"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.heartbeat_enabled?e.jsx(d,{variant:"success",children:"heartbeat"}):null,e.jsx(H,{size:16,className:"text-muted-foreground/45 transition-colors group-hover:text-foreground"})]})]},s.name)})})]})]})}export{Ve as default};
|