@kafca/agentdock 0.1.30 → 0.1.33
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/LICENSE.md +73 -0
- package/README.md +15 -0
- package/dist/renderer/assets/{Badge-DlVJI1Ys.js → Badge-VeSLCPPV.js} +1 -1
- package/dist/renderer/assets/{Chat-oa8OjaHQ.js → Chat-DWTQeTgn.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-C-N8KS5C.js → ChatMarkdown-C9gSQIVb.js} +1 -1
- package/dist/renderer/assets/{Config-D9sL_d4D.js → Config-CTA-pZNR.js} +1 -1
- package/dist/renderer/assets/{CronList-Z5JU3DHk.js → CronList-BngBCnFY.js} +1 -1
- package/dist/renderer/assets/{Dashboard-D3BwbG43.js → Dashboard-D4pGvDpc.js} +2 -2
- package/dist/renderer/assets/{EmptyState-QOj765Ul.js → EmptyState-DMf8rzDs.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-J7n01mPu.js → KnowledgeDetail-C1Ym_cHk.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-BFnH0NVk.js → KnowledgeHome-DPRiR72G.js} +1 -1
- package/dist/renderer/assets/{Logs-DfSUifXc.js → Logs-CRHecmzO.js} +1 -1
- package/dist/renderer/assets/{Modal-QjEGhyru.js → Modal-BDhhPv2l.js} +1 -1
- package/dist/renderer/assets/{Page-qdHFSw7x.js → Page-DdDZN7AE.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-DS_rfvhh.js → ProjectDetail-DCsr3LkW.js} +1 -1
- package/dist/renderer/assets/{ProjectList-COtyZd7H.js → ProjectList-Cnm-iLvg.js} +1 -1
- package/dist/renderer/assets/{Select-BQ8mncVu.js → Select-Dw4FCXhJ.js} +1 -1
- package/dist/renderer/assets/{SessionChat-DjVnjuQy.js → SessionChat-O-6abK8x.js} +1 -1
- package/dist/renderer/assets/{SessionList-88dgGZJ8.js → SessionList-5yptvVL9.js} +1 -1
- package/dist/renderer/assets/ThreadChat-CIM_o2HO.js +23 -0
- package/dist/renderer/assets/{Workspace-D_hzSJjX.js → Workspace-D9UeUCNr.js} +1 -1
- package/dist/renderer/assets/{arrow-left-BMpknulW.js → arrow-left-CKfxNOXE.js} +1 -1
- package/dist/renderer/assets/{book-open-CiaOeQbU.js → book-open-CQddlENV.js} +1 -1
- package/dist/renderer/assets/{check-CgwYH4GF.js → check-CZYvOmIS.js} +1 -1
- package/dist/renderer/assets/{chevron-down-BzD2S1OO.js → chevron-down-CVIWFoXF.js} +1 -1
- package/dist/renderer/assets/{circle-BDHD7g7l.js → circle-DSfdQM7k.js} +1 -1
- package/dist/renderer/assets/{desktop-BiR5LPL5.js → desktop-B9KUgeOV.js} +1 -1
- package/dist/renderer/assets/{desktop-BkMW-h5p.js → desktop-O8_6ZCVZ.js} +2 -2
- package/dist/renderer/assets/{funnel-Bruf5FYA.js → funnel-pB5NegZB.js} +1 -1
- package/dist/renderer/assets/{heart-D7Mz04B0.js → heart-BT5laZ_b.js} +1 -1
- package/dist/renderer/assets/{index-CL1e8m3U.js → index-BYyDk28K.js} +2 -2
- package/dist/renderer/assets/{index-gZIRr4_o.js → index-zTUUYax3.js} +1 -1
- package/dist/renderer/assets/{pencil-C6gzDMse.js → pencil-C0thxLi6.js} +1 -1
- package/dist/renderer/assets/{play-DqTXX-Pr.js → play-CmZ0kWtt.js} +1 -1
- package/dist/renderer/assets/{plug-ykmbeaO3.js → plug-CeDQatBe.js} +1 -1
- package/dist/renderer/assets/{plus-DHE60vMX.js → plus-Di__xFOZ.js} +1 -1
- package/dist/renderer/assets/projects-B-pbhhtH.js +1 -0
- package/dist/renderer/assets/{save-CGIvrdQI.js → save-BDatCjfO.js} +1 -1
- package/dist/renderer/assets/{search-D7IFAwyE.js → search-DnTOjP0C.js} +1 -1
- package/dist/renderer/assets/{server-aOsirp7I.js → server-Ey_iHY6m.js} +1 -1
- package/dist/renderer/assets/{session-utils-Dxfp4ohQ.js → session-utils-DWaM7Rkr.js} +1 -1
- package/dist/renderer/assets/{sessions-Db1XPbG2.js → sessions-CYYjLD5I.js} +1 -1
- package/dist/renderer/assets/{shield-check-ChXeQK-d.js → shield-check-Br8BQzcn.js} +1 -1
- package/dist/renderer/assets/{trash-2-CfN-c1zw.js → trash-2-7YD616fw.js} +1 -1
- package/dist/renderer/assets/{user-C7OHaBp4.js → user-BR_5jmr9.js} +1 -1
- package/dist/renderer/assets/{wifi-off-CpaJigye.js → wifi-off-By9QdREz.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +28 -4
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-response-processor.js +2 -4
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-turn-coordinator.js +102 -15
- package/dist-electron/services/local-ai-core/src/agents/claudecode/behavior.js +5 -0
- package/dist-electron/services/local-ai-core/src/agents/claudecode/definition.js +36 -0
- package/dist-electron/services/local-ai-core/src/agents/claudecode/index.js +15 -0
- package/dist-electron/services/local-ai-core/src/agents/codex/behavior.js +5 -0
- package/dist-electron/services/local-ai-core/src/agents/codex/definition.js +24 -0
- package/dist-electron/services/local-ai-core/src/agents/codex/index.js +15 -0
- package/dist-electron/services/local-ai-core/src/agents/hermes/behavior.js +29 -0
- package/dist-electron/services/local-ai-core/src/agents/hermes/definition.js +22 -0
- package/dist-electron/services/local-ai-core/src/agents/hermes/index.js +15 -0
- package/dist-electron/services/local-ai-core/src/agents/index.js +98 -0
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/behavior.js +5 -0
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/definition.js +14 -0
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/index.js +27 -0
- package/dist-electron/services/local-ai-core/src/agents/opencode/behavior.js +5 -0
- package/dist-electron/services/local-ai-core/src/agents/opencode/definition.js +18 -0
- package/dist-electron/services/local-ai-core/src/agents/opencode/index.js +15 -0
- package/dist-electron/services/local-ai-core/src/agents/opencode/launch.js +119 -0
- package/dist-electron/services/local-ai-core/src/agents/pi/behavior.js +5 -0
- package/dist-electron/services/local-ai-core/src/agents/pi/definition.js +23 -0
- package/dist-electron/services/local-ai-core/src/agents/pi/index.js +15 -0
- package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +139 -0
- package/dist-electron/services/local-ai-core/src/agents/shared/acp-behavior.js +11 -0
- package/dist-electron/services/local-ai-core/src/agents/shared/agent-plugin.js +60 -0
- package/dist-electron/services/local-ai-core/src/agents/shared/definition.js +12 -0
- package/dist-electron/services/local-ai-core/src/agents/shared/launch-utils.js +122 -0
- package/dist-electron/services/local-ai-core/src/agents/shared/progress-replay.js +19 -0
- package/dist-electron/services/local-ai-core/src/agents/shared/replay-prefix.js +68 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +0 -2
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +0 -1
- package/dist-electron/services/local-ai-core/src/cli/lac.js +2 -1
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +17 -11
- package/dist-electron/services/local-ai-core/src/plugins/builtin/agent-localcore-acp-plugin.js +9 -130
- package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +22 -397
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +9 -45
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +9 -4
- package/dist-electron/services/local-ai-core/src/runtime/local-core-runtime-state.js +62 -1
- package/dist-electron/services/local-ai-core/src/runtime/runtime-detection-service.js +2 -12
- package/dist-electron/services/local-ai-core/src/scheduler/lark-schedule-adapter.js +16 -7
- package/dist-electron/services/local-ai-core/src/scheduler/local-schedule-adapter.js +10 -2
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-job-route.js +24 -0
- package/dist-electron/services/local-ai-core/src/scheduler/weixin-schedule-adapter.js +15 -6
- package/dist-electron/shared/desktop.js +3 -1
- package/dist-electron/src/pages/Threads/thread-chat-model.js +27 -18
- package/dist-electron/src/pages/Threads/thread-chat-permission.test.js +57 -18
- package/dist-electron/{electron → tests/contracts}/local-core-contracts.test.js +1 -1
- package/dist-electron/{electron → tests/electron}/agent-runtime-detector.test.js +31 -1
- package/dist-electron/{electron → tests/electron}/lac-cli.test.js +6 -3
- package/dist-electron/{electron → tests/electron}/plugin-kernel.test.js +93 -13
- package/dist-electron/{electron → tests/electron}/renderer-packaging.test.js +11 -6
- package/dist-electron/{electron → tests/electron}/runtime-detection-service.test.js +1 -1
- package/dist-electron/{electron → tests/electron}/security-approval-store.test.js +2 -2
- package/dist-electron/{electron → tests/electron}/workspace-task-store.test.js +95 -7
- package/dist-electron/{electron → tests/integration}/channel-content.test.js +2 -2
- package/dist-electron/{electron → tests/integration}/local-core-acp-content.test.js +1 -1
- package/dist-electron/{electron → tests/integration}/local-core-refactor.test.js +437 -15
- package/package.json +3 -2
- package/dist/renderer/assets/ThreadChat-BCdbTxBo.js +0 -23
- package/dist/renderer/assets/projects-Bx5p10th.js +0 -1
- /package/dist-electron/{electron → tests/contracts}/architecture-docs.test.js +0 -0
- /package/dist-electron/{electron → tests/electron}/knowledge-skill-script.test.js +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProviderDefaultModelId = getProviderDefaultModelId;
|
|
4
|
+
exports.getFirstProviderModelId = getFirstProviderModelId;
|
|
5
|
+
exports.collectProviderEnv = collectProviderEnv;
|
|
6
|
+
exports.normalizeProviderId = normalizeProviderId;
|
|
7
|
+
exports.splitProviderModelRef = splitProviderModelRef;
|
|
8
|
+
exports.ensurePrivateDir = ensurePrivateDir;
|
|
9
|
+
exports.writeJsonFile = writeJsonFile;
|
|
10
|
+
exports.projectLocalStateDir = projectLocalStateDir;
|
|
11
|
+
exports.resolveBundledAcpCommand = resolveBundledAcpCommand;
|
|
12
|
+
exports.resolveBundledPackageJsonPath = resolveBundledPackageJsonPath;
|
|
13
|
+
const node_module_1 = require("node:module");
|
|
14
|
+
const node_fs_1 = require("node:fs");
|
|
15
|
+
const node_path_1 = require("node:path");
|
|
16
|
+
function getProviderDefaultModelId(provider) {
|
|
17
|
+
const directModel = String(provider.model || '').trim();
|
|
18
|
+
if (directModel) {
|
|
19
|
+
return directModel;
|
|
20
|
+
}
|
|
21
|
+
const firstModel = Array.isArray(provider.models)
|
|
22
|
+
? provider.models.find((entry) => String(entry?.model || '').trim())
|
|
23
|
+
: null;
|
|
24
|
+
return String(firstModel?.model || '').trim();
|
|
25
|
+
}
|
|
26
|
+
function getFirstProviderModelId(providers) {
|
|
27
|
+
for (const provider of providers) {
|
|
28
|
+
const modelId = getProviderDefaultModelId(provider);
|
|
29
|
+
if (modelId) {
|
|
30
|
+
return modelId;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
function collectProviderEnv(providers) {
|
|
36
|
+
const env = {};
|
|
37
|
+
for (const provider of providers) {
|
|
38
|
+
if (!provider.env || typeof provider.env !== 'object') {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
for (const [key, value] of Object.entries(provider.env)) {
|
|
42
|
+
const envKey = key.trim();
|
|
43
|
+
if (envKey) {
|
|
44
|
+
env[envKey] = String(value ?? '');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return env;
|
|
49
|
+
}
|
|
50
|
+
function normalizeProviderId(value) {
|
|
51
|
+
return String(value || '')
|
|
52
|
+
.trim()
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
55
|
+
.replace(/^-+|-+$/g, '');
|
|
56
|
+
}
|
|
57
|
+
function splitProviderModelRef(value) {
|
|
58
|
+
const trimmed = value.trim();
|
|
59
|
+
const slashIndex = trimmed.indexOf('/');
|
|
60
|
+
if (slashIndex <= 0 || slashIndex >= trimmed.length - 1) {
|
|
61
|
+
return ['', trimmed];
|
|
62
|
+
}
|
|
63
|
+
return [trimmed.slice(0, slashIndex), trimmed.slice(slashIndex + 1)];
|
|
64
|
+
}
|
|
65
|
+
function ensurePrivateDir(path) {
|
|
66
|
+
(0, node_fs_1.mkdirSync)(path, { recursive: true, mode: 0o700 });
|
|
67
|
+
(0, node_fs_1.chmodSync)(path, 0o700);
|
|
68
|
+
}
|
|
69
|
+
function writeJsonFile(path, value, mode = 0o600) {
|
|
70
|
+
(0, node_fs_1.writeFileSync)(path, `${JSON.stringify(value, null, 2)}\n`, { encoding: 'utf8', mode });
|
|
71
|
+
(0, node_fs_1.chmodSync)(path, mode);
|
|
72
|
+
}
|
|
73
|
+
function projectLocalStateDir(configState, folderName, projectName) {
|
|
74
|
+
const configDir = (0, node_path_1.dirname)(configState.path);
|
|
75
|
+
const safeProjectName = String(projectName || 'workspace')
|
|
76
|
+
.trim()
|
|
77
|
+
.replace(/[^a-zA-Z0-9._-]+/g, '-')
|
|
78
|
+
.replace(/^-+|-+$/g, '') || 'workspace';
|
|
79
|
+
return (0, node_path_1.resolve)(configDir, folderName, safeProjectName);
|
|
80
|
+
}
|
|
81
|
+
function resolveBundledAcpCommand(packageName, binName) {
|
|
82
|
+
const require = (0, node_module_1.createRequire)(__filename);
|
|
83
|
+
const packageJsonPath = resolveBundledPackageJsonPath(packageName);
|
|
84
|
+
const packageJson = require(packageJsonPath);
|
|
85
|
+
const binField = packageJson.bin;
|
|
86
|
+
const relativeBinPath = typeof binField === 'string'
|
|
87
|
+
? binField
|
|
88
|
+
: binField?.[binName];
|
|
89
|
+
if (!relativeBinPath) {
|
|
90
|
+
throw new Error(`Bundled package "${packageName}" does not declare the ${binName} bin.`);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
command: process.execPath,
|
|
94
|
+
args: [(0, node_path_1.resolve)((0, node_path_1.dirname)(packageJsonPath), relativeBinPath)],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function resolveBundledPackageJsonPath(packageName) {
|
|
98
|
+
const require = (0, node_module_1.createRequire)(__filename);
|
|
99
|
+
try {
|
|
100
|
+
return require.resolve(`${packageName}/package.json`);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error?.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') {
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const basePath of require.resolve.paths(packageName) || []) {
|
|
108
|
+
const packageJsonPath = (0, node_path_1.resolve)(basePath, ...packageName.split('/'), 'package.json');
|
|
109
|
+
if ((0, node_fs_1.existsSync)(packageJsonPath)) {
|
|
110
|
+
return packageJsonPath;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
let current = (0, node_path_1.dirname)(require.resolve(packageName));
|
|
114
|
+
while (current && current !== (0, node_path_1.dirname)(current)) {
|
|
115
|
+
const packageJsonPath = (0, node_path_1.resolve)(current, 'package.json');
|
|
116
|
+
if ((0, node_fs_1.existsSync)(packageJsonPath)) {
|
|
117
|
+
return packageJsonPath;
|
|
118
|
+
}
|
|
119
|
+
current = (0, node_path_1.dirname)(current);
|
|
120
|
+
}
|
|
121
|
+
throw new Error(`Bundled package "${packageName}" package.json could not be resolved.`);
|
|
122
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasPriorProgressMessage = hasPriorProgressMessage;
|
|
4
|
+
function hasPriorProgressMessage(input) {
|
|
5
|
+
const content = normalizeProgressContent(input.content);
|
|
6
|
+
if (!content) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const kind = input.kind;
|
|
10
|
+
return input.priorProgressMessages.some((message) => {
|
|
11
|
+
if (kind && message.kind && message.kind !== kind) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return normalizeProgressContent(message.content) === content;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function normalizeProgressContent(content) {
|
|
18
|
+
return String(content || '').replace(/\r\n/g, '\n').trim();
|
|
19
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripAssistantReplayPrefix = stripAssistantReplayPrefix;
|
|
4
|
+
function stripAssistantReplayPrefix(rawText, priorAssistantMessages) {
|
|
5
|
+
const replayPrefix = priorAssistantMessages.join('');
|
|
6
|
+
if (!replayPrefix || !rawText) {
|
|
7
|
+
return rawText;
|
|
8
|
+
}
|
|
9
|
+
if (replayPrefix.startsWith(rawText)) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
if (priorAssistantMessages.some((message) => message.startsWith(rawText))) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
if (rawText.startsWith(replayPrefix)) {
|
|
16
|
+
return rawText.slice(replayPrefix.length);
|
|
17
|
+
}
|
|
18
|
+
const anchoredText = stripAfterLatestPriorMessageAnchor(rawText, priorAssistantMessages);
|
|
19
|
+
if (anchoredText !== null) {
|
|
20
|
+
return anchoredText;
|
|
21
|
+
}
|
|
22
|
+
const overlap = longestSuffixPrefixOverlap(replayPrefix, rawText);
|
|
23
|
+
if (overlap > 0 && overlap === rawText.length) {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
return rawText;
|
|
27
|
+
}
|
|
28
|
+
function stripAfterLatestPriorMessageAnchor(rawText, priorAssistantMessages) {
|
|
29
|
+
let latestMatch = null;
|
|
30
|
+
for (const message of priorAssistantMessages) {
|
|
31
|
+
for (const anchor of createPriorMessageAnchors(message)) {
|
|
32
|
+
const index = rawText.lastIndexOf(anchor);
|
|
33
|
+
if (index < 0) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const match = { index, length: anchor.length };
|
|
37
|
+
if (!latestMatch || match.index + match.length > latestMatch.index + latestMatch.length) {
|
|
38
|
+
latestMatch = match;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!latestMatch) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return rawText.slice(latestMatch.index + latestMatch.length);
|
|
46
|
+
}
|
|
47
|
+
function createPriorMessageAnchors(message) {
|
|
48
|
+
const trimmed = message.trim();
|
|
49
|
+
if (trimmed.length < 32) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const anchors = [];
|
|
53
|
+
for (const length of [240, 160, 96, 48, 32]) {
|
|
54
|
+
if (trimmed.length >= length) {
|
|
55
|
+
anchors.push(trimmed.slice(-length));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return anchors;
|
|
59
|
+
}
|
|
60
|
+
function longestSuffixPrefixOverlap(prefix, value) {
|
|
61
|
+
const max = Math.min(prefix.length, value.length);
|
|
62
|
+
for (let size = max; size > 0; size -= 1) {
|
|
63
|
+
if (prefix.endsWith(value.slice(0, size))) {
|
|
64
|
+
return size;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
@@ -395,7 +395,6 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
395
395
|
const sessionKey = event.sessionKey;
|
|
396
396
|
const route = this.threadRouting.get(sessionKey);
|
|
397
397
|
if (!route) {
|
|
398
|
-
this.options.log?.(`localcore-lark bridge route miss for sessionKey=${sessionKey} type=${event.type}`);
|
|
399
398
|
return;
|
|
400
399
|
}
|
|
401
400
|
const routeInstanceId = route.instanceId || 'default';
|
|
@@ -481,7 +480,6 @@ class LocalCoreLarkGateway extends node_events_1.EventEmitter {
|
|
|
481
480
|
const shouldThrottle = event.type === 'update_message' &&
|
|
482
481
|
existingMessageId &&
|
|
483
482
|
Date.now() - (turn.lastPatchedAtByMessageId[existingMessageId] || 0) < (renderedMessage.isFinal ? LARK_FINAL_PATCH_INTERVAL_MS : LARK_PROGRESS_PATCH_INTERVAL_MS);
|
|
484
|
-
this.options.log?.(`localcore-lark bridge event type=${event.type} sessionKey=${sessionKey} hasMessageId=${Boolean(existingMessageId)} throttle=${shouldThrottle}`);
|
|
485
483
|
if (shouldThrottle) {
|
|
486
484
|
continue;
|
|
487
485
|
}
|
package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js
CHANGED
|
@@ -369,7 +369,6 @@ class LocalCoreWeixinGateway extends node_events_1.EventEmitter {
|
|
|
369
369
|
const sessionKey = event.sessionKey;
|
|
370
370
|
const route = this.threadRouting.get(sessionKey);
|
|
371
371
|
if (!route) {
|
|
372
|
-
this.options.log?.(`localcore-weixin bridge route miss for sessionKey=${sessionKey} type=${event.type}`);
|
|
373
372
|
return;
|
|
374
373
|
}
|
|
375
374
|
const routeInstanceId = route.instanceId || 'default';
|
|
@@ -7,6 +7,7 @@ exports.runCli = runCli;
|
|
|
7
7
|
const node_process_1 = __importDefault(require("node:process"));
|
|
8
8
|
const index_js_1 = require("../../../../packages/contracts/src/index.js");
|
|
9
9
|
const job_id_js_1 = require("../scheduler/job-id.js");
|
|
10
|
+
const scheduled_job_route_js_1 = require("../scheduler/scheduled-job-route.js");
|
|
10
11
|
const DEFAULT_BASE_URL = 'http://127.0.0.1:9831/api/local/v1';
|
|
11
12
|
async function runCli(argv, env = node_process_1.default.env, io = node_process_1.default) {
|
|
12
13
|
try {
|
|
@@ -118,7 +119,7 @@ async function handleList(flags, env, io, json) {
|
|
|
118
119
|
const suffix = workspaceId ? `?workspace_id=${encodeURIComponent(workspaceId)}` : '';
|
|
119
120
|
const response = await request(context.baseUrl, 'GET', `/scheduler/jobs${suffix}`);
|
|
120
121
|
const jobs = threadId
|
|
121
|
-
? response.jobs.filter((job) => job.route.threadId === threadId)
|
|
122
|
+
? response.jobs.filter((job) => job.route.threadId === threadId || (0, scheduled_job_route_js_1.scheduledJobMatchesCliContext)(job, context))
|
|
122
123
|
: response.jobs;
|
|
123
124
|
print(json, io.stdout, { jobs: jobs.map(presentJob) }, jobs.length === 0 ? 'No scheduler jobs.' : jobs.map(formatJobLine).join('\n'));
|
|
124
125
|
return 0;
|
|
@@ -8,7 +8,7 @@ const diagnostics_js_1 = require("./diagnostics.js");
|
|
|
8
8
|
const event_bus_js_1 = require("./event-bus.js");
|
|
9
9
|
const lifecycle_manager_js_1 = require("./lifecycle-manager.js");
|
|
10
10
|
const plugin_registry_js_1 = require("./plugin-registry.js");
|
|
11
|
-
const
|
|
11
|
+
const index_js_1 = require("../agents/index.js");
|
|
12
12
|
const channel_lark_plugin_js_1 = require("../plugins/builtin/channel-lark-plugin.js");
|
|
13
13
|
const channel_weixin_plugin_js_1 = require("../plugins/builtin/channel-weixin-plugin.js");
|
|
14
14
|
const knowledge_ai_vector_plugin_js_1 = require("../plugins/builtin/knowledge-ai-vector-plugin.js");
|
|
@@ -20,6 +20,7 @@ const scheduler_weixin_plugin_js_1 = require("../plugins/builtin/scheduler-weixi
|
|
|
20
20
|
const workspace_router_js_1 = require("../router/workspace-router.js");
|
|
21
21
|
const local_core_runtime_state_js_1 = require("../runtime/local-core-runtime-state.js");
|
|
22
22
|
const scheduler_service_js_1 = require("../scheduler/scheduler-service.js");
|
|
23
|
+
const scheduled_job_route_js_1 = require("../scheduler/scheduled-job-route.js");
|
|
23
24
|
function bootstrapLocalCoreKernel(options) {
|
|
24
25
|
const capabilities = new capability_registry_js_1.LocalCoreCapabilityRegistry();
|
|
25
26
|
const plugins = new plugin_registry_js_1.LocalCorePluginRegistry(options?.disabledPluginIds);
|
|
@@ -35,8 +36,8 @@ function bootstrapLocalCoreKernel(options) {
|
|
|
35
36
|
const lifecycle = new lifecycle_manager_js_1.LocalCoreLifecycleManager(plugins, context);
|
|
36
37
|
const diagnostics = new diagnostics_js_1.LocalCoreDiagnostics(plugins, lifecycle);
|
|
37
38
|
const builtIns = [
|
|
38
|
-
...
|
|
39
|
-
(0,
|
|
39
|
+
...(0, index_js_1.getStaticAgentRuntimeDefinitions)().map((definition) => (0, index_js_1.createBuiltinStaticAgentCapabilityPlugin)(definition.agentType, definition.displayName)),
|
|
40
|
+
(0, index_js_1.createBuiltinLocalCoreAcpAgentPlugin)(),
|
|
40
41
|
(0, scheduler_cron_plugin_js_1.createBuiltinCronSchedulerPlugin)(),
|
|
41
42
|
];
|
|
42
43
|
for (const plugin of builtIns) {
|
|
@@ -163,10 +164,11 @@ function bootstrapLocalCoreRuntime(options) {
|
|
|
163
164
|
}
|
|
164
165
|
const agentPlugins = [
|
|
165
166
|
localCoreAgentPlugin,
|
|
166
|
-
(0,
|
|
167
|
-
(0,
|
|
168
|
-
(0,
|
|
169
|
-
(0,
|
|
167
|
+
(0, index_js_1.createBuiltinPiAgentPlugin)(),
|
|
168
|
+
(0, index_js_1.createBuiltinOpencodeAgentPlugin)(),
|
|
169
|
+
(0, index_js_1.createBuiltinCodexAgentPlugin)(),
|
|
170
|
+
(0, index_js_1.createBuiltinClaudeCodeAgentPlugin)(),
|
|
171
|
+
(0, index_js_1.createBuiltinHermesAgentPlugin)(),
|
|
170
172
|
];
|
|
171
173
|
let workspaceRouter;
|
|
172
174
|
let weixinChannelRuntime;
|
|
@@ -264,16 +266,20 @@ function bootstrapLocalCoreRuntime(options) {
|
|
|
264
266
|
createJob: async ({ workspaceId, platform, route, name, schedule, scheduleDescription, message }) => scheduler.createJob({
|
|
265
267
|
workspaceId,
|
|
266
268
|
platform,
|
|
267
|
-
route,
|
|
269
|
+
route: (0, scheduled_job_route_js_1.withoutThreadRoute)(route),
|
|
268
270
|
triggerType: 'cron',
|
|
269
271
|
cronExpr: schedule,
|
|
270
272
|
promptTemplate: message,
|
|
271
273
|
description: `${name} · ${scheduleDescription}`,
|
|
272
274
|
enabled: true,
|
|
273
275
|
}),
|
|
274
|
-
listJobsForThread: async (threadId) =>
|
|
275
|
-
.
|
|
276
|
-
|
|
276
|
+
listJobsForThread: async (threadId) => {
|
|
277
|
+
const binding = store.getPlatformThreadBindingByThreadId(threadId);
|
|
278
|
+
return scheduler
|
|
279
|
+
.listJobs()
|
|
280
|
+
.filter((job) => job.route.threadId === threadId ||
|
|
281
|
+
(binding ? (0, scheduled_job_route_js_1.scheduledJobMatchesPlatformBinding)(job, binding) : false));
|
|
282
|
+
},
|
|
277
283
|
deleteJob: async (jobId) => {
|
|
278
284
|
scheduler.deleteJob(jobId);
|
|
279
285
|
},
|
package/dist-electron/services/local-ai-core/src/plugins/builtin/agent-localcore-acp-plugin.js
CHANGED
|
@@ -1,132 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBuiltinLocalCoreAcpAgentPlugin =
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
return {
|
|
13
|
-
agentType,
|
|
14
|
-
transport: desktop_js_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
15
|
-
displayName: agentType,
|
|
16
|
-
matchesProject(project) {
|
|
17
|
-
const normalizedAgentType = String(project.agent?.type || '').trim().toLowerCase();
|
|
18
|
-
return match(normalizedAgentType);
|
|
19
|
-
},
|
|
20
|
-
createRoute(configState, project) {
|
|
21
|
-
if (!this.matchesProject(project)) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
kind: desktop_js_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
26
|
-
agentType,
|
|
27
|
-
transport: desktop_js_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
28
|
-
config: {
|
|
29
|
-
...(0, workspace_route_config_js_1.toLocalCoreProjectConfig)(configState, project),
|
|
30
|
-
agentType,
|
|
31
|
-
},
|
|
32
|
-
supportsStreamingProbe: true,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function createBuiltinAgentPlugin(options) {
|
|
38
|
-
let runtime = null;
|
|
39
|
-
return {
|
|
40
|
-
manifest: {
|
|
41
|
-
id: options.pluginId,
|
|
42
|
-
kind: 'agent',
|
|
43
|
-
version: '0.1.0',
|
|
44
|
-
provides: [`agent:${options.agentType}`],
|
|
45
|
-
},
|
|
46
|
-
capabilities: {
|
|
47
|
-
agents: [
|
|
48
|
-
{
|
|
49
|
-
id: `agent.${options.agentType}`,
|
|
50
|
-
agentType: options.agentType,
|
|
51
|
-
displayName: options.displayName || options.agentType,
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
createRuntime(_ctx) {
|
|
56
|
-
if (!runtime) {
|
|
57
|
-
runtime = createRuntime(options.agentType, options.match);
|
|
58
|
-
}
|
|
59
|
-
return { runtime };
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function createBuiltinLocalCoreAcpAgentPlugin() {
|
|
64
|
-
const plugin = createBuiltinAgentPlugin({
|
|
65
|
-
pluginId: 'builtin.agent-localcore-acp',
|
|
66
|
-
agentType: desktop_js_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
67
|
-
match: (normalizedAgentType) => !normalizedAgentType || normalizedAgentType === 'acp' || normalizedAgentType === desktop_js_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
68
|
-
displayName: 'LocalCore ACP',
|
|
69
|
-
});
|
|
70
|
-
plugin.capabilities = {
|
|
71
|
-
...plugin.capabilities,
|
|
72
|
-
channels: [
|
|
73
|
-
{
|
|
74
|
-
id: `channel.${desktop_js_1.LOCALCORE_ACP_AGENT_TYPE}`,
|
|
75
|
-
platform: desktop_js_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
76
|
-
displayName: 'LocalCore ACP',
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
};
|
|
80
|
-
return plugin;
|
|
81
|
-
}
|
|
82
|
-
function createBuiltinOpencodeAgentPlugin() {
|
|
83
|
-
return createBuiltinAgentPlugin({
|
|
84
|
-
pluginId: 'builtin.agent-opencode',
|
|
85
|
-
agentType: 'opencode',
|
|
86
|
-
match: (normalizedAgentType) => normalizedAgentType === 'opencode',
|
|
87
|
-
displayName: 'OpenCode',
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function createBuiltinPiAgentPlugin() {
|
|
91
|
-
return createBuiltinAgentPlugin({
|
|
92
|
-
pluginId: 'builtin.agent-pi',
|
|
93
|
-
agentType: 'pi',
|
|
94
|
-
match: (normalizedAgentType) => normalizedAgentType === 'pi',
|
|
95
|
-
displayName: 'Pi',
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function createBuiltinCodexAgentPlugin() {
|
|
99
|
-
return createBuiltinAgentPlugin({
|
|
100
|
-
pluginId: 'builtin.agent-codex',
|
|
101
|
-
agentType: 'codex',
|
|
102
|
-
match: (normalizedAgentType) => normalizedAgentType === 'codex',
|
|
103
|
-
displayName: 'Codex',
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function createBuiltinClaudeCodeAgentPlugin() {
|
|
107
|
-
return createBuiltinAgentPlugin({
|
|
108
|
-
pluginId: 'builtin.agent-claudecode',
|
|
109
|
-
agentType: 'claudecode',
|
|
110
|
-
match: (normalizedAgentType) => normalizedAgentType === 'claudecode',
|
|
111
|
-
displayName: 'Claude Code',
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function createBuiltinStaticAgentCapabilityPlugin(agentType) {
|
|
115
|
-
return {
|
|
116
|
-
manifest: {
|
|
117
|
-
id: `builtin.agent-${agentType}`,
|
|
118
|
-
kind: 'agent',
|
|
119
|
-
version: '0.1.0',
|
|
120
|
-
provides: [`agent:${agentType}`],
|
|
121
|
-
},
|
|
122
|
-
capabilities: {
|
|
123
|
-
agents: [
|
|
124
|
-
{
|
|
125
|
-
id: `agent.${agentType}`,
|
|
126
|
-
agentType,
|
|
127
|
-
displayName: agentType,
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
}
|
|
3
|
+
exports.createBuiltinStaticAgentCapabilityPlugin = exports.createBuiltinPiAgentPlugin = exports.createBuiltinOpencodeAgentPlugin = exports.createBuiltinLocalCoreAcpAgentPlugin = exports.createBuiltinHermesAgentPlugin = exports.createBuiltinClaudeCodeAgentPlugin = exports.createBuiltinCodexAgentPlugin = void 0;
|
|
4
|
+
var index_js_1 = require("../../agents/index.js");
|
|
5
|
+
Object.defineProperty(exports, "createBuiltinCodexAgentPlugin", { enumerable: true, get: function () { return index_js_1.createBuiltinCodexAgentPlugin; } });
|
|
6
|
+
Object.defineProperty(exports, "createBuiltinClaudeCodeAgentPlugin", { enumerable: true, get: function () { return index_js_1.createBuiltinClaudeCodeAgentPlugin; } });
|
|
7
|
+
Object.defineProperty(exports, "createBuiltinHermesAgentPlugin", { enumerable: true, get: function () { return index_js_1.createBuiltinHermesAgentPlugin; } });
|
|
8
|
+
Object.defineProperty(exports, "createBuiltinLocalCoreAcpAgentPlugin", { enumerable: true, get: function () { return index_js_1.createBuiltinLocalCoreAcpAgentPlugin; } });
|
|
9
|
+
Object.defineProperty(exports, "createBuiltinOpencodeAgentPlugin", { enumerable: true, get: function () { return index_js_1.createBuiltinOpencodeAgentPlugin; } });
|
|
10
|
+
Object.defineProperty(exports, "createBuiltinPiAgentPlugin", { enumerable: true, get: function () { return index_js_1.createBuiltinPiAgentPlugin; } });
|
|
11
|
+
Object.defineProperty(exports, "createBuiltinStaticAgentCapabilityPlugin", { enumerable: true, get: function () { return index_js_1.createBuiltinStaticAgentCapabilityPlugin; } });
|