@kafca/agentdock 0.1.25 → 0.1.27
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 +1 -0
- package/dist/renderer/assets/{Badge-Bn2h-Qkf.js → Badge-DQ08JYYn.js} +1 -1
- package/dist/renderer/assets/{Chat-Cgo9aneg.js → Chat-BIiYTa43.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-CYzHfSiR.js → ChatMarkdown-ZDQtUMi8.js} +1 -1
- package/dist/renderer/assets/{Config-DljB2-eP.js → Config-fKb09gkV.js} +1 -1
- package/dist/renderer/assets/{CronList-DeVbiY9a.js → CronList-CN53SBez.js} +1 -1
- package/dist/renderer/assets/{Dashboard-fSqx5sm8.js → Dashboard-B0Yap4m6.js} +2 -2
- package/dist/renderer/assets/{EmptyState-DgqKDwlq.js → EmptyState-D5ZGA0rk.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-u8s2SmPV.js → KnowledgeDetail-CE5Ajepr.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-BdQw8nbY.js → KnowledgeHome-5a_kCXgU.js} +1 -1
- package/dist/renderer/assets/{Logs-DSbndMpy.js → Logs-uKKWMLFZ.js} +1 -1
- package/dist/renderer/assets/{Modal-0d0EmAuK.js → Modal-Dd9JhtQ0.js} +1 -1
- package/dist/renderer/assets/{Page-CVbOH_Kh.js → Page-BKLPuVQM.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-C91tF7uA.js → ProjectDetail-C8gFzvH_.js} +1 -1
- package/dist/renderer/assets/{ProjectList-D78Pc-BQ.js → ProjectList-CXk3dMu_.js} +1 -1
- package/dist/renderer/assets/{Select-BbKzAIuO.js → Select-DB5PGz8e.js} +1 -1
- package/dist/renderer/assets/{SessionChat-BERvL5e4.js → SessionChat-DumN9Ty3.js} +1 -1
- package/dist/renderer/assets/{SessionList-Bomz335M.js → SessionList-Cu5kPOxP.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-CLr3amU2.js → ThreadChat-ru807VqH.js} +1 -1
- package/dist/renderer/assets/{Workspace-In91z4W2.js → Workspace-DWcMBl5r.js} +1 -1
- package/dist/renderer/assets/{arrow-left-FBnVKKBl.js → arrow-left-Q025lHNq.js} +1 -1
- package/dist/renderer/assets/{book-open-4_CuP6Sa.js → book-open-mUQUDLh5.js} +1 -1
- package/dist/renderer/assets/{check-vsoVjvac.js → check-ByINMPna.js} +1 -1
- package/dist/renderer/assets/{chevron-down-DFpmFTJW.js → chevron-down-Blmwp-nN.js} +1 -1
- package/dist/renderer/assets/{circle-vRULegER.js → circle-BkvRVWGX.js} +1 -1
- package/dist/renderer/assets/{desktop-ul0Tpzyc.js → desktop-BzWqZMbk.js} +1 -1
- package/dist/renderer/assets/{funnel-Gu0E_hJ_.js → funnel-Cuwc5I2B.js} +1 -1
- package/dist/renderer/assets/{heart-DsdofOHf.js → heart-2tbx0mrd.js} +1 -1
- package/dist/renderer/assets/{index-BD3aCyBa.js → index-BTAl8hYv.js} +2 -2
- package/dist/renderer/assets/{index-pJUFobU7.js → index-DqU6J2AY.js} +1 -1
- package/dist/renderer/assets/{pencil-DbKmV8nD.js → pencil-BWKBGhOm.js} +1 -1
- package/dist/renderer/assets/{play-BDMsRxSm.js → play-OezKUkaH.js} +1 -1
- package/dist/renderer/assets/{plug-t2dMl78-.js → plug-DyNXq963.js} +1 -1
- package/dist/renderer/assets/{plus-BUb6zOAe.js → plus-CvLYqMSE.js} +1 -1
- package/dist/renderer/assets/projects-C4VoB4se.js +1 -0
- package/dist/renderer/assets/{save-C-_5rQdv.js → save-59vRfz-l.js} +1 -1
- package/dist/renderer/assets/{search-R3ekHFPM.js → search-D1h9ECCh.js} +1 -1
- package/dist/renderer/assets/{server-BTuvHf5n.js → server-BXnqzaxz.js} +1 -1
- package/dist/renderer/assets/{session-utils-ClX6VPFG.js → session-utils-BNlJyXg0.js} +1 -1
- package/dist/renderer/assets/{sessions-AFKIC-ub.js → sessions-Ctb3Ta0D.js} +1 -1
- package/dist/renderer/assets/{shield-check-CqMW8CHe.js → shield-check-CRHdsNpf.js} +1 -1
- package/dist/renderer/assets/{trash-2-BNLcHyUw.js → trash-2-BVq2TEtl.js} +1 -1
- package/dist/renderer/assets/{user-BCCN8FYK.js → user-CRRZk-V5.js} +1 -1
- package/dist/renderer/assets/{wifi-off-BsNsx3oX.js → wifi-off-LF_KkdXM.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/electron/local-core-refactor.test.js +244 -19
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +33 -34
- package/dist-electron/services/local-ai-core/src/channel/lark/runtime-state.js +98 -19
- package/package.json +1 -1
- package/dist/renderer/assets/projects-4F6D_Q8t.js +0 -1
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLarkTurnState = createLarkTurnState;
|
|
4
4
|
exports.foldToolResultForLark = foldToolResultForLark;
|
|
5
|
+
exports.summarizeToolCallForLark = summarizeToolCallForLark;
|
|
5
6
|
exports.isPendingToolProgressForLark = isPendingToolProgressForLark;
|
|
6
7
|
exports.consumeLarkBridgeEvent = consumeLarkBridgeEvent;
|
|
7
8
|
exports.renderLarkBridgeEventMessage = renderLarkBridgeEventMessage;
|
|
9
|
+
exports.renderLarkBridgeEventMessages = renderLarkBridgeEventMessages;
|
|
8
10
|
exports.getLarkRenderedMessageId = getLarkRenderedMessageId;
|
|
9
11
|
exports.setLarkRenderedMessageId = setLarkRenderedMessageId;
|
|
10
12
|
function createLarkTurnState(sessionKey, sourceMessageId) {
|
|
@@ -17,6 +19,9 @@ function createLarkTurnState(sessionKey, sourceMessageId) {
|
|
|
17
19
|
finalText: '',
|
|
18
20
|
progressMessageIds: {},
|
|
19
21
|
thinkingSteps: [],
|
|
22
|
+
pendingThoughtKey: undefined,
|
|
23
|
+
pendingThoughtText: undefined,
|
|
24
|
+
thoughtSegmentSequence: 0,
|
|
20
25
|
toolCalls: [],
|
|
21
26
|
statusLines: [],
|
|
22
27
|
buttonRows: [],
|
|
@@ -34,6 +39,17 @@ function foldToolResultForLark(content) {
|
|
|
34
39
|
return normalized;
|
|
35
40
|
return parts.slice(0, 2).join(' - ');
|
|
36
41
|
}
|
|
42
|
+
function summarizeToolCallForLark(event, content) {
|
|
43
|
+
const toolCall = event.toolCall;
|
|
44
|
+
if (toolCall) {
|
|
45
|
+
const name = String(toolCall.name || '').trim() || summarizeToolContentForLark(content);
|
|
46
|
+
const input = formatToolInputForLark(toolCall.input);
|
|
47
|
+
return [name.startsWith('🔧 ') ? name : `🔧 ${name}`, input ? `参数:${input}` : '']
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.join('\n\n');
|
|
50
|
+
}
|
|
51
|
+
return summarizeToolContentForLark(content);
|
|
52
|
+
}
|
|
37
53
|
function isPendingToolProgressForLark(content) {
|
|
38
54
|
const normalized = foldToolResultForLark(content).toLowerCase();
|
|
39
55
|
return normalized.startsWith('🔧 ') && normalized.includes(' - pending');
|
|
@@ -50,6 +66,9 @@ function consumeLarkBridgeEvent(turn, event, options) {
|
|
|
50
66
|
turn.previewText = '';
|
|
51
67
|
turn.finalText = '';
|
|
52
68
|
turn.thinkingSteps = [];
|
|
69
|
+
turn.pendingThoughtKey = undefined;
|
|
70
|
+
turn.pendingThoughtText = undefined;
|
|
71
|
+
turn.thoughtSegmentSequence = 0;
|
|
53
72
|
turn.toolCalls = [];
|
|
54
73
|
turn.buttonRows = [];
|
|
55
74
|
turn.statusLines = [];
|
|
@@ -61,6 +80,12 @@ function consumeLarkBridgeEvent(turn, event, options) {
|
|
|
61
80
|
return;
|
|
62
81
|
}
|
|
63
82
|
if (event.type === 'preview_start' || event.type === 'update_message') {
|
|
83
|
+
if (content.startsWith('💭 ')) {
|
|
84
|
+
turn.pendingThoughtKey = event.previewHandle || 'thinking-preview';
|
|
85
|
+
turn.pendingThoughtText = content;
|
|
86
|
+
pushUniqueLarkTurnLine(turn.thinkingSteps, content.slice(3).trim());
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
64
89
|
turn.previewText = content;
|
|
65
90
|
return;
|
|
66
91
|
}
|
|
@@ -82,6 +107,8 @@ function consumeLarkBridgeEvent(turn, event, options) {
|
|
|
82
107
|
return;
|
|
83
108
|
}
|
|
84
109
|
if (content.startsWith('💭 ')) {
|
|
110
|
+
turn.pendingThoughtKey = progressKey('thinking', event);
|
|
111
|
+
turn.pendingThoughtText = content;
|
|
85
112
|
pushUniqueLarkTurnLine(turn.thinkingSteps, content.slice(3).trim());
|
|
86
113
|
return;
|
|
87
114
|
}
|
|
@@ -100,34 +127,28 @@ function renderLarkBridgeEventMessage(turn, event) {
|
|
|
100
127
|
const content = foldToolResultForLark(String(event.content || '').trim());
|
|
101
128
|
if (event.type === 'preview_start' || event.type === 'update_message') {
|
|
102
129
|
if (content.startsWith('💭 ')) {
|
|
103
|
-
return
|
|
130
|
+
return { key: 'noop', text: '', buttonRows: [], isFinal: false };
|
|
104
131
|
}
|
|
105
132
|
if (content.startsWith('🔧 ')) {
|
|
106
133
|
if (isPendingToolProgressForLark(content)) {
|
|
107
134
|
return { key: 'noop', text: '', buttonRows: [], isFinal: false };
|
|
108
135
|
}
|
|
109
|
-
return
|
|
136
|
+
return renderToolMessage(progressKey('tool', event), summarizeToolCallForLark(event, content));
|
|
110
137
|
}
|
|
111
|
-
return {
|
|
112
|
-
key: 'final',
|
|
113
|
-
text: content,
|
|
114
|
-
buttonRows: turn.buttonRows,
|
|
115
|
-
isFinal: true,
|
|
116
|
-
finalSource: 'stream',
|
|
117
|
-
};
|
|
138
|
+
return { key: 'noop', text: '', buttonRows: [], isFinal: false };
|
|
118
139
|
}
|
|
119
140
|
if (event.type === 'status') {
|
|
120
141
|
return renderProgressMessage(progressKey('status', event), content.startsWith('⏳ ') ? content : `⏳ ${content}`);
|
|
121
142
|
}
|
|
122
143
|
if (event.type === 'reply') {
|
|
123
144
|
if (content.startsWith('💭 ')) {
|
|
124
|
-
return
|
|
145
|
+
return { key: 'noop', text: '', buttonRows: [], isFinal: false };
|
|
125
146
|
}
|
|
126
147
|
if (content.startsWith('🔧 ')) {
|
|
127
148
|
if (isPendingToolProgressForLark(content)) {
|
|
128
149
|
return { key: 'noop', text: '', buttonRows: [], isFinal: false };
|
|
129
150
|
}
|
|
130
|
-
return
|
|
151
|
+
return renderToolMessage(progressKey('tool', event), summarizeToolCallForLark(event, content));
|
|
131
152
|
}
|
|
132
153
|
if (content.startsWith('⏳ ') || content.startsWith('📤 ')) {
|
|
133
154
|
return renderProgressMessage(progressKey('status', event), content);
|
|
@@ -150,23 +171,37 @@ function renderLarkBridgeEventMessage(turn, event) {
|
|
|
150
171
|
isFinal: false,
|
|
151
172
|
};
|
|
152
173
|
}
|
|
174
|
+
function renderLarkBridgeEventMessages(turn, event) {
|
|
175
|
+
const rendered = renderLarkBridgeEventMessage(turn, event);
|
|
176
|
+
if (isThoughtBridgeEvent(event)) {
|
|
177
|
+
return [rendered];
|
|
178
|
+
}
|
|
179
|
+
const pendingThought = takePendingLarkThoughtRender(turn);
|
|
180
|
+
return pendingThought ? [pendingThought, rendered] : [rendered];
|
|
181
|
+
}
|
|
182
|
+
function takePendingLarkThoughtRender(turn) {
|
|
183
|
+
const text = String(turn.pendingThoughtText || '').trim();
|
|
184
|
+
if (!text) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
turn.thoughtSegmentSequence += 1;
|
|
188
|
+
const baseKey = turn.pendingThoughtKey || 'thinking-preview';
|
|
189
|
+
const rendered = renderProgressMessage(`thinking:${baseKey}:${turn.thoughtSegmentSequence}`, text);
|
|
190
|
+
turn.pendingThoughtKey = undefined;
|
|
191
|
+
turn.pendingThoughtText = undefined;
|
|
192
|
+
return rendered;
|
|
193
|
+
}
|
|
153
194
|
function getLarkRenderedMessageId(turn, rendered) {
|
|
154
195
|
if (rendered.isFinal) {
|
|
155
|
-
|
|
156
|
-
return turn.replyMessageId;
|
|
157
|
-
}
|
|
158
|
-
return turn.finalMessageId || turn.messageId;
|
|
196
|
+
return turn.finalMessageId || turn.replyMessageId;
|
|
159
197
|
}
|
|
160
198
|
return turn.progressMessageIds[rendered.key];
|
|
161
199
|
}
|
|
162
200
|
function setLarkRenderedMessageId(turn, rendered, messageId) {
|
|
163
201
|
if (rendered.isFinal) {
|
|
164
|
-
if (rendered.finalSource === 'reply') {
|
|
165
|
-
turn.replyMessageId = messageId;
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
202
|
turn.finalMessageId = messageId;
|
|
169
203
|
turn.messageId = messageId;
|
|
204
|
+
turn.replyMessageId = messageId;
|
|
170
205
|
return;
|
|
171
206
|
}
|
|
172
207
|
turn.progressMessageIds[rendered.key] = messageId;
|
|
@@ -179,6 +214,12 @@ function renderProgressMessage(key, text) {
|
|
|
179
214
|
isFinal: false,
|
|
180
215
|
};
|
|
181
216
|
}
|
|
217
|
+
function renderToolMessage(key, text) {
|
|
218
|
+
return {
|
|
219
|
+
...renderProgressMessage(key, text),
|
|
220
|
+
updatePolicy: 'create-only',
|
|
221
|
+
};
|
|
222
|
+
}
|
|
182
223
|
function progressKey(prefix, event) {
|
|
183
224
|
const stableId = String(event.messageId || event.previewHandle || '').trim();
|
|
184
225
|
if (stableId) {
|
|
@@ -187,6 +228,44 @@ function progressKey(prefix, event) {
|
|
|
187
228
|
const content = String(event.content || '').trim().replace(/\s+/g, ' ');
|
|
188
229
|
return `${prefix}:${content.slice(0, 120)}`;
|
|
189
230
|
}
|
|
231
|
+
function isThoughtBridgeEvent(event) {
|
|
232
|
+
if (event.type !== 'preview_start' && event.type !== 'update_message' && event.type !== 'reply') {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
return String(event.content || '').trim().startsWith('💭 ');
|
|
236
|
+
}
|
|
237
|
+
function summarizeToolContentForLark(content) {
|
|
238
|
+
const normalized = String(content || '').trim();
|
|
239
|
+
if (!normalized.startsWith('🔧 ')) {
|
|
240
|
+
return normalized;
|
|
241
|
+
}
|
|
242
|
+
const withoutOutput = normalized.split(' - ')[0]?.trim() || normalized;
|
|
243
|
+
return withoutOutput
|
|
244
|
+
.replace(/\s+-\s*(running|pending|completed|failed|error|cancelled|canceled)\s*$/i, '')
|
|
245
|
+
.replace(/:\s*(running|pending|completed|failed|error|cancelled|canceled)\s*$/i, '')
|
|
246
|
+
.trim();
|
|
247
|
+
}
|
|
248
|
+
function formatToolInputForLark(input) {
|
|
249
|
+
if (input == null) {
|
|
250
|
+
return '';
|
|
251
|
+
}
|
|
252
|
+
if (typeof input === 'string') {
|
|
253
|
+
return inlineCode(input);
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
return inlineCode(JSON.stringify(input));
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return inlineCode(String(input));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function inlineCode(value) {
|
|
263
|
+
const normalized = value.trim();
|
|
264
|
+
if (!normalized) {
|
|
265
|
+
return '';
|
|
266
|
+
}
|
|
267
|
+
return `\`${normalized.replace(/`/g, '\\`')}\``;
|
|
268
|
+
}
|
|
190
269
|
function pushUniqueLarkTurnLine(target, value) {
|
|
191
270
|
const normalized = value.trim();
|
|
192
271
|
if (!normalized) {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as t}from"./index-BD3aCyBa.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};
|