@inupedia/spotlight-vue 0.5.17 → 0.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/spotlight-vue.css +1 -1
- package/dist/components/SpotlightThinking.vue.d.ts.map +1 -1
- package/dist/components/SpotlightThinking.vue.js +1 -1
- package/dist/components/SpotlightThinking2.vue.js +352 -343
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -56
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +161 -147
- package/dist/store/pipeline/displayText.d.ts +16 -0
- package/dist/store/pipeline/displayText.d.ts.map +1 -1
- package/dist/store/pipeline/displayText.js +87 -48
- package/package.json +3 -3
|
@@ -1,44 +1,58 @@
|
|
|
1
|
-
import { serializeSkillsForRemote as
|
|
2
|
-
import { useAgentSessionStore as
|
|
1
|
+
import { serializeSkillsForRemote as H } from "@inupedia/spotlight-client";
|
|
2
|
+
import { useAgentSessionStore as E } from "../session/agentSession.js";
|
|
3
3
|
import { useSpotlightMemoryPreferenceStore as q } from "../store/memoryPreferenceStore.js";
|
|
4
4
|
import { useSpotlightRuntimeStore as D } from "../store/runtimeStore.js";
|
|
5
5
|
import { SPOTLIGHT_PIPELINE_STEP_IDS as r } from "../store/pipeline/constants.js";
|
|
6
6
|
import { isLoopPlanningChunk as F, splitIntentStepContent as J } from "../store/pipeline/displayText.js";
|
|
7
|
-
import { toolLaneStepId as
|
|
8
|
-
import { getSpotlightConfig as
|
|
7
|
+
import { toolLaneStepId as x, resolveToolLane as j, toolLaneStepLabel as B } from "../store/pipeline/toolLane.js";
|
|
8
|
+
import { getSpotlightConfig as N } from "../plugin.js";
|
|
9
9
|
import { getSkillsPoolForRun as W } from "../skills/index.js";
|
|
10
|
-
import { executeRemoteHostTool as z, ensureHostToolsManifest as
|
|
11
|
-
import { getSpotlightServerBase as
|
|
10
|
+
import { executeRemoteHostTool as z, ensureHostToolsManifest as L } from "./hostToolRunner.js";
|
|
11
|
+
import { getSpotlightServerBase as w, buildSpotlightJsonHeaders as h, getSpotlightProjectId as G } from "./httpConfig.js";
|
|
12
12
|
import { ensureSpotlightMeta as U } from "./meta.js";
|
|
13
|
-
const
|
|
13
|
+
const C = /* @__PURE__ */ new WeakMap();
|
|
14
14
|
function V(t) {
|
|
15
15
|
return t.type !== "host_action_request" && t.type !== "run_completed" && t.type !== "run_error" && t.type !== "ping" && t.type !== "memory_decision";
|
|
16
16
|
}
|
|
17
|
-
function d(t, e,
|
|
17
|
+
function d(t, e, n) {
|
|
18
18
|
const s = t.getSteps().find((a) => a.id === e);
|
|
19
19
|
if (s) return s;
|
|
20
|
-
const
|
|
21
|
-
return t.setSteps([...t.getSteps(),
|
|
20
|
+
const o = { id: e, label: n, status: "pending" };
|
|
21
|
+
return t.setSteps([...t.getSteps(), o]), o;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function $() {
|
|
24
24
|
return new Promise((t) => {
|
|
25
25
|
requestAnimationFrame(() => t());
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
function Y(t) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
return Array.isArray(t) ? t.flatMap((n, s) => {
|
|
30
|
+
if (!n || typeof n != "object") return [];
|
|
31
|
+
const o = n, a = typeof o.content == "string" ? o.content.trim() : "";
|
|
32
|
+
if (!a) return [];
|
|
33
|
+
const i = typeof o.title == "string" && o.title.trim() || typeof o.url == "string" && o.url.trim() || `资料 ${s + 1}`, m = typeof o.url == "string" ? o.url.trim() : "";
|
|
34
|
+
return [[i, m && m !== i ? m : "", a].filter(Boolean).join(`
|
|
35
|
+
`)];
|
|
36
|
+
}).join(`
|
|
37
|
+
|
|
38
|
+
`) : "";
|
|
39
|
+
}
|
|
40
|
+
function K(t) {
|
|
41
|
+
const e = Y(t.output);
|
|
42
|
+
if (e) return e;
|
|
43
|
+
const n = t.summary?.trim();
|
|
44
|
+
if (n && n.length > 48 && !n.startsWith("{") && !n.startsWith("["))
|
|
45
|
+
return n;
|
|
32
46
|
if (t.output != null && typeof t.output == "object")
|
|
33
47
|
try {
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
48
|
+
const s = JSON.stringify(t.output, null, 2);
|
|
49
|
+
if (s && s !== "{}") return s;
|
|
36
50
|
} catch {
|
|
37
51
|
}
|
|
38
|
-
return
|
|
52
|
+
return n || "";
|
|
39
53
|
}
|
|
40
|
-
function
|
|
41
|
-
const e =
|
|
54
|
+
function Q(t) {
|
|
55
|
+
const e = K(t.result);
|
|
42
56
|
return {
|
|
43
57
|
id: t.result.call.id,
|
|
44
58
|
name: t.result.call.name,
|
|
@@ -51,7 +65,7 @@ function K(t) {
|
|
|
51
65
|
status: t.result.success ? "done" : "error"
|
|
52
66
|
};
|
|
53
67
|
}
|
|
54
|
-
function
|
|
68
|
+
function X(t) {
|
|
55
69
|
return {
|
|
56
70
|
id: t.call.id,
|
|
57
71
|
name: t.call.name,
|
|
@@ -60,40 +74,40 @@ function Q(t) {
|
|
|
60
74
|
status: "running"
|
|
61
75
|
};
|
|
62
76
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
77
|
+
function Z(t, e) {
|
|
78
|
+
const n = e.success ? "前端操作已执行。" : e.error || "前端操作执行失败。";
|
|
65
79
|
return {
|
|
66
80
|
id: t.id,
|
|
67
81
|
name: t.name,
|
|
68
82
|
displayName: t.displayName,
|
|
69
83
|
argsText: JSON.stringify(t.input ?? {}, null, 2),
|
|
70
|
-
resultText:
|
|
71
|
-
summary:
|
|
84
|
+
resultText: n,
|
|
85
|
+
summary: n,
|
|
72
86
|
errorCode: e.errorCode,
|
|
73
87
|
trace: e.trace,
|
|
74
88
|
status: e.success ? "done" : "error"
|
|
75
89
|
};
|
|
76
90
|
}
|
|
77
|
-
function
|
|
91
|
+
function v(t, e) {
|
|
78
92
|
return j(t, e?.sideEffectByName?.get(t));
|
|
79
93
|
}
|
|
80
|
-
function c(t, e,
|
|
81
|
-
const s = t.getSteps().find((
|
|
82
|
-
!s || s.status === "done" || s.status === "error" || t.setStep(e, "done", s.content ??
|
|
94
|
+
function c(t, e, n) {
|
|
95
|
+
const s = t.getSteps().find((o) => o.id === e);
|
|
96
|
+
!s || s.status === "done" || s.status === "error" || t.setStep(e, "done", s.content ?? n);
|
|
83
97
|
}
|
|
84
|
-
function
|
|
98
|
+
function _(t, e) {
|
|
85
99
|
c(t, r.understand);
|
|
86
|
-
const
|
|
87
|
-
d(t,
|
|
88
|
-
const
|
|
89
|
-
!
|
|
100
|
+
const n = x(e), s = B(e);
|
|
101
|
+
d(t, n, s);
|
|
102
|
+
const o = t.getSteps().find((a) => a.id === n);
|
|
103
|
+
!o || o.status === "active" || o.status === "done" || t.setStep(n, "active", o.content);
|
|
90
104
|
}
|
|
91
|
-
function
|
|
92
|
-
const s =
|
|
93
|
-
return
|
|
105
|
+
function p(t, e, n) {
|
|
106
|
+
const s = v(e, n);
|
|
107
|
+
return _(t, s), x(s);
|
|
94
108
|
}
|
|
95
|
-
function
|
|
96
|
-
const s =
|
|
109
|
+
function tt(t, e, n) {
|
|
110
|
+
const s = p(t, e.name, n);
|
|
97
111
|
t.appendToolCallsToStep(s, [
|
|
98
112
|
{
|
|
99
113
|
id: e.id,
|
|
@@ -104,52 +118,52 @@ function v(t, e, o) {
|
|
|
104
118
|
}
|
|
105
119
|
]);
|
|
106
120
|
}
|
|
107
|
-
function
|
|
108
|
-
const
|
|
109
|
-
t.appendToolCallsToStep(
|
|
121
|
+
function et(t, e, n, s) {
|
|
122
|
+
const o = p(t, e.name, s);
|
|
123
|
+
t.appendToolCallsToStep(o, [Z(e, n)]);
|
|
110
124
|
}
|
|
111
|
-
function
|
|
125
|
+
function P(t, e) {
|
|
112
126
|
return e || (t === r.gather ? "获取信息" : t === r.act ? "操作页面" : t === r.answer ? "回答" : t === r.understand ? "理解问题" : t === r.tool ? "获取信息" : t);
|
|
113
127
|
}
|
|
114
|
-
function
|
|
115
|
-
d(t, e,
|
|
128
|
+
function f(t, e, n, s, o) {
|
|
129
|
+
d(t, e, n), t.setStep(e, s, o);
|
|
116
130
|
}
|
|
117
|
-
function
|
|
118
|
-
const
|
|
131
|
+
function st(t, e) {
|
|
132
|
+
const n = e.summary?.trim();
|
|
119
133
|
switch (e.phase) {
|
|
120
134
|
case "routing":
|
|
121
135
|
case "analyzing":
|
|
122
|
-
|
|
136
|
+
f(
|
|
123
137
|
t,
|
|
124
138
|
r.understand,
|
|
125
139
|
"理解问题",
|
|
126
140
|
"active",
|
|
127
|
-
|
|
141
|
+
n ?? "正在分析用户意图。"
|
|
128
142
|
);
|
|
129
143
|
return;
|
|
130
144
|
case "router_done":
|
|
131
|
-
|
|
145
|
+
f(
|
|
132
146
|
t,
|
|
133
147
|
r.understand,
|
|
134
148
|
"理解问题",
|
|
135
149
|
"done",
|
|
136
|
-
|
|
150
|
+
n ?? "意图分析已完成。"
|
|
137
151
|
);
|
|
138
152
|
return;
|
|
139
153
|
case "knowledge_agent_start":
|
|
140
|
-
c(t, r.understand),
|
|
154
|
+
c(t, r.understand), f(
|
|
141
155
|
t,
|
|
142
156
|
r.gather,
|
|
143
157
|
"获取信息",
|
|
144
158
|
"active",
|
|
145
|
-
|
|
159
|
+
n ?? "正在检索资料。"
|
|
146
160
|
);
|
|
147
161
|
return;
|
|
148
162
|
case "knowledge_agent_done":
|
|
149
163
|
c(
|
|
150
164
|
t,
|
|
151
165
|
r.gather,
|
|
152
|
-
|
|
166
|
+
n ?? "资料已就绪。"
|
|
153
167
|
);
|
|
154
168
|
return;
|
|
155
169
|
case "action_agent_start":
|
|
@@ -159,23 +173,23 @@ function et(t, e) {
|
|
|
159
173
|
c(t, r.gather), c(
|
|
160
174
|
t,
|
|
161
175
|
r.act,
|
|
162
|
-
|
|
176
|
+
n ?? "页面操作已完成。"
|
|
163
177
|
);
|
|
164
178
|
return;
|
|
165
179
|
case "memory_replay":
|
|
166
|
-
|
|
180
|
+
f(
|
|
167
181
|
t,
|
|
168
182
|
r.understand,
|
|
169
183
|
"理解问题",
|
|
170
184
|
"done",
|
|
171
|
-
|
|
185
|
+
n ?? "已复用项目记忆,跳过本轮检索。"
|
|
172
186
|
);
|
|
173
187
|
return;
|
|
174
188
|
default:
|
|
175
189
|
return;
|
|
176
190
|
}
|
|
177
191
|
}
|
|
178
|
-
async function
|
|
192
|
+
async function ot(t, e, n) {
|
|
179
193
|
if (e.type !== "ping") {
|
|
180
194
|
if (e.type === "step_sync")
|
|
181
195
|
t.setSteps(
|
|
@@ -183,46 +197,46 @@ async function st(t, e, o) {
|
|
|
183
197
|
id: s.id,
|
|
184
198
|
label: s.label,
|
|
185
199
|
status: s.status,
|
|
186
|
-
content: t.getSteps().find((
|
|
200
|
+
content: t.getSteps().find((o) => o.id === s.id)?.content
|
|
187
201
|
}))
|
|
188
202
|
);
|
|
189
203
|
else if (e.type === "step_status")
|
|
190
204
|
d(t, e.stepId, e.label ?? e.stepId), t.setStep(e.stepId, e.status, e.content);
|
|
191
205
|
else if (e.type === "step_content") {
|
|
192
|
-
let s = e.stepId,
|
|
193
|
-
if ((s === r.intent || s === r.understand) && F(
|
|
206
|
+
let s = e.stepId, o = e.content;
|
|
207
|
+
if ((s === r.intent || s === r.understand) && F(o))
|
|
194
208
|
s = r.gather;
|
|
195
209
|
else if ((s === r.intent || s === r.understand) && e.mode === "replace") {
|
|
196
|
-
const { intent: a, misplacedPlanning: i } = J(
|
|
197
|
-
|
|
210
|
+
const { intent: a, misplacedPlanning: i } = J(o);
|
|
211
|
+
o = a, i.trim() && (d(t, r.gather, "获取信息"), t.appendChunkToStep(
|
|
198
212
|
r.gather,
|
|
199
213
|
i
|
|
200
214
|
));
|
|
201
215
|
}
|
|
202
|
-
if (d(t, s,
|
|
216
|
+
if (d(t, s, P(s, e.label)), e.mode === "replace")
|
|
203
217
|
t.setStep(
|
|
204
218
|
s,
|
|
205
219
|
t.getSteps().find((a) => a.id === s)?.status ?? "active",
|
|
206
|
-
|
|
220
|
+
o
|
|
207
221
|
);
|
|
208
222
|
else {
|
|
209
223
|
if (s === r.tool || s === r.gather || s === r.act) {
|
|
210
224
|
const a = s === r.act ? "act" : "gather";
|
|
211
|
-
|
|
225
|
+
_(t, a);
|
|
212
226
|
}
|
|
213
|
-
t.appendChunkToStep(s,
|
|
227
|
+
t.appendChunkToStep(s, o), await $();
|
|
214
228
|
}
|
|
215
229
|
} else if (e.type === "step_artifact") {
|
|
216
230
|
const s = e.stepId === r.tool ? r.gather : e.stepId;
|
|
217
|
-
d(t, s,
|
|
231
|
+
d(t, s, P(s, e.label)), (s === r.gather || s === r.act) && _(
|
|
218
232
|
t,
|
|
219
233
|
s === r.act ? "act" : "gather"
|
|
220
234
|
), e.artifact === "tool_calls" && e.toolCalls?.length ? t.appendToolCallsToStep(s, e.toolCalls) : e.artifact === "attachments" && e.attachments?.length ? t.appendAttachmentsToStep(s, e.attachments) : e.artifact === "files" && e.files?.length ? t.appendFilesToStep(s, e.files) : e.artifact === "artifacts" && e.artifacts?.length ? t.appendArtifactsToStep(s, e.artifacts) : e.artifact === "chat_items" && e.chatItems?.length && t.appendChatItemsToStep(s, e.chatItems);
|
|
221
235
|
} else if (e.type === "tool_start") {
|
|
222
|
-
const s =
|
|
223
|
-
t.appendToolCallsToStep(s, [
|
|
236
|
+
const s = p(t, e.call.name, n);
|
|
237
|
+
t.appendToolCallsToStep(s, [X(e)]);
|
|
224
238
|
} else if (e.type === "tool_progress") {
|
|
225
|
-
const s =
|
|
239
|
+
const s = p(t, e.call.name, n);
|
|
226
240
|
t.appendToolCallsToStep(s, [
|
|
227
241
|
{
|
|
228
242
|
id: e.call.id,
|
|
@@ -234,8 +248,8 @@ async function st(t, e, o) {
|
|
|
234
248
|
}
|
|
235
249
|
]);
|
|
236
250
|
} else if (e.type === "tool_result") {
|
|
237
|
-
const s =
|
|
238
|
-
t.appendToolCallsToStep(s, [
|
|
251
|
+
const s = p(t, e.result.call.name, n);
|
|
252
|
+
t.appendToolCallsToStep(s, [Q(e)]), e.result.attachments?.length && t.appendAttachmentsToStep(s, e.result.attachments), e.result.files?.length && t.appendFilesToStep(s, e.result.files), e.result.toolCalls?.length && t.appendToolCallsToStep(s, e.result.toolCalls);
|
|
239
253
|
} else if (e.type === "skill_permission_request") {
|
|
240
254
|
const { useSpotlightStore: s } = await import("../store/spotlightStore.js");
|
|
241
255
|
s().setPendingSkillPermission({
|
|
@@ -254,15 +268,15 @@ async function st(t, e, o) {
|
|
|
254
268
|
`
|
|
255
269
|
);
|
|
256
270
|
} else if (e.type === "turn_transition")
|
|
257
|
-
|
|
271
|
+
st(t, e);
|
|
258
272
|
else if (e.type === "memory_decision") {
|
|
259
273
|
const s = {
|
|
260
274
|
reuse: "已复用项目记忆",
|
|
261
275
|
augment: "正在结合历史项目结论",
|
|
262
276
|
refresh: "资料可能变化,正在重新验证",
|
|
263
277
|
ignore: "未发现可直接使用的项目记忆"
|
|
264
|
-
},
|
|
265
|
-
|
|
278
|
+
}, o = t.getSteps().find((i) => i.id === r.understand), a = e.decision.action === "reuse" || o?.status === "done" ? "done" : "active";
|
|
279
|
+
f(
|
|
266
280
|
t,
|
|
267
281
|
r.understand,
|
|
268
282
|
"理解问题",
|
|
@@ -277,12 +291,12 @@ async function st(t, e, o) {
|
|
|
277
291
|
V(e) && t.appendExecutionEvent?.(e);
|
|
278
292
|
}
|
|
279
293
|
}
|
|
280
|
-
async function
|
|
294
|
+
async function nt(t) {
|
|
281
295
|
await fetch(
|
|
282
|
-
`${
|
|
296
|
+
`${w()}/v1/runs/${encodeURIComponent(t.runId)}/host-results`,
|
|
283
297
|
{
|
|
284
298
|
method: "POST",
|
|
285
|
-
headers:
|
|
299
|
+
headers: h(),
|
|
286
300
|
body: JSON.stringify({
|
|
287
301
|
correlationId: t.correlationId,
|
|
288
302
|
success: t.result.success,
|
|
@@ -295,35 +309,35 @@ async function ot(t) {
|
|
|
295
309
|
}
|
|
296
310
|
);
|
|
297
311
|
}
|
|
298
|
-
function
|
|
299
|
-
const e = t.split(/\n\n/u),
|
|
300
|
-
return { events: e.flatMap((
|
|
301
|
-
const a =
|
|
312
|
+
function rt(t) {
|
|
313
|
+
const e = t.split(/\n\n/u), n = e.pop() ?? "";
|
|
314
|
+
return { events: e.flatMap((o) => {
|
|
315
|
+
const a = o.split(/\n/u).find((i) => i.startsWith("data: "));
|
|
302
316
|
if (!a) return [];
|
|
303
317
|
try {
|
|
304
318
|
return [JSON.parse(a.slice(6))];
|
|
305
319
|
} catch {
|
|
306
320
|
return [];
|
|
307
321
|
}
|
|
308
|
-
}), rest:
|
|
322
|
+
}), rest: n };
|
|
309
323
|
}
|
|
310
|
-
async function
|
|
324
|
+
async function Tt(t) {
|
|
311
325
|
await Promise.allSettled([
|
|
312
|
-
|
|
326
|
+
L(),
|
|
313
327
|
U(t)
|
|
314
328
|
]);
|
|
315
329
|
}
|
|
316
|
-
async function
|
|
317
|
-
const s =
|
|
330
|
+
async function at(t, e, n) {
|
|
331
|
+
const s = E(), o = D(), a = q(), i = await L();
|
|
318
332
|
return {
|
|
319
333
|
hostManifest: i,
|
|
320
334
|
payload: {
|
|
321
335
|
projectId: G(),
|
|
322
336
|
sessionId: s.sessionId,
|
|
323
|
-
memorySubjectId:
|
|
337
|
+
memorySubjectId: N().getMemorySubjectId?.() ?? void 0,
|
|
324
338
|
userQuestion: t,
|
|
325
|
-
memoryRefreshRequested:
|
|
326
|
-
uiContext:
|
|
339
|
+
memoryRefreshRequested: n?.forceMemoryRefresh === !0,
|
|
340
|
+
uiContext: N().getUiContext?.() ?? {},
|
|
327
341
|
sessionState: {
|
|
328
342
|
sessionId: s.sessionId,
|
|
329
343
|
activeTaskId: s.activeTaskId,
|
|
@@ -340,86 +354,86 @@ async function rt(t, e, o) {
|
|
|
340
354
|
memoryWriteEnabled: !0
|
|
341
355
|
},
|
|
342
356
|
runtimeState: {
|
|
343
|
-
activeDomain:
|
|
344
|
-
activeTarget:
|
|
345
|
-
activeAction:
|
|
346
|
-
resumableAction:
|
|
347
|
-
lastResolvedTarget:
|
|
357
|
+
activeDomain: o.activeDomain,
|
|
358
|
+
activeTarget: o.activeTarget,
|
|
359
|
+
activeAction: o.activeAction,
|
|
360
|
+
resumableAction: o.resumableAction,
|
|
361
|
+
lastResolvedTarget: o.lastResolvedTarget
|
|
348
362
|
},
|
|
349
363
|
clientToolsManifestVersion: i.manifestDigest,
|
|
350
364
|
clientToolManifest: i,
|
|
351
|
-
skills:
|
|
365
|
+
skills: H(W()),
|
|
352
366
|
frontendBuildId: i.frontendBuildId,
|
|
353
367
|
manifestDigest: i.manifestDigest
|
|
354
368
|
}
|
|
355
369
|
};
|
|
356
370
|
}
|
|
357
|
-
async function
|
|
358
|
-
const s =
|
|
371
|
+
async function It(t, e, n) {
|
|
372
|
+
const s = w(), o = e.getSignal(), { payload: a, hostManifest: i } = await at(
|
|
359
373
|
t,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
),
|
|
374
|
+
o,
|
|
375
|
+
n
|
|
376
|
+
), m = new Set(i.tools.map((u) => u.name)), T = {
|
|
363
377
|
sideEffectByName: new Map(
|
|
364
378
|
i.tools.map((u) => [u.name, u.sideEffect])
|
|
365
379
|
)
|
|
366
|
-
},
|
|
380
|
+
}, g = await fetch(`${s}/v1/runs`, {
|
|
367
381
|
method: "POST",
|
|
368
|
-
headers:
|
|
382
|
+
headers: h(),
|
|
369
383
|
body: JSON.stringify(a),
|
|
370
|
-
signal:
|
|
384
|
+
signal: o
|
|
371
385
|
});
|
|
372
|
-
if (!
|
|
373
|
-
const u = await
|
|
386
|
+
if (!g.ok) {
|
|
387
|
+
const u = await g.text().catch(() => "");
|
|
374
388
|
throw new Error(
|
|
375
|
-
`Spotlight 后端创建 run 失败:${
|
|
389
|
+
`Spotlight 后端创建 run 失败:${g.status} ${u}`
|
|
376
390
|
);
|
|
377
391
|
}
|
|
378
|
-
const { runId:
|
|
379
|
-
|
|
392
|
+
const { runId: y } = await g.json();
|
|
393
|
+
o && (C.set(o, y), o.addEventListener(
|
|
380
394
|
"abort",
|
|
381
395
|
() => {
|
|
382
|
-
|
|
396
|
+
A(y);
|
|
383
397
|
},
|
|
384
398
|
{ once: !0 }
|
|
385
399
|
));
|
|
386
|
-
const
|
|
387
|
-
`${s}/v1/runs/${encodeURIComponent(
|
|
400
|
+
const S = await fetch(
|
|
401
|
+
`${s}/v1/runs/${encodeURIComponent(y)}/events`,
|
|
388
402
|
{
|
|
389
|
-
headers:
|
|
390
|
-
signal:
|
|
403
|
+
headers: h(),
|
|
404
|
+
signal: o
|
|
391
405
|
}
|
|
392
406
|
);
|
|
393
|
-
if (!
|
|
394
|
-
throw new Error(`Spotlight 后端事件流连接失败:${
|
|
395
|
-
const
|
|
396
|
-
let
|
|
407
|
+
if (!S.ok || !S.body)
|
|
408
|
+
throw new Error(`Spotlight 后端事件流连接失败:${S.status}`);
|
|
409
|
+
const R = S.body.getReader(), M = new TextDecoder();
|
|
410
|
+
let I = "";
|
|
397
411
|
try {
|
|
398
412
|
for (; ; ) {
|
|
399
|
-
const { done: u, value:
|
|
413
|
+
const { done: u, value: O } = await R.read();
|
|
400
414
|
if (u) break;
|
|
401
|
-
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
for (const l of
|
|
415
|
+
I += M.decode(O, { stream: !0 });
|
|
416
|
+
const b = rt(I);
|
|
417
|
+
I = b.rest;
|
|
418
|
+
for (const l of b.events) {
|
|
405
419
|
if (l.type === "host_action_request") {
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
allowedHostNames:
|
|
420
|
+
tt(e, l.request.call, T);
|
|
421
|
+
const k = await z(l.request.call, e, {
|
|
422
|
+
allowedHostNames: m,
|
|
409
423
|
hostEffect: l.request.hostEffect
|
|
410
424
|
});
|
|
411
|
-
|
|
412
|
-
runId:
|
|
425
|
+
et(e, l.request.call, k, T), await nt({
|
|
426
|
+
runId: y,
|
|
413
427
|
correlationId: l.request.correlationId,
|
|
414
|
-
result:
|
|
415
|
-
signal:
|
|
428
|
+
result: k,
|
|
429
|
+
signal: o
|
|
416
430
|
});
|
|
417
431
|
continue;
|
|
418
432
|
}
|
|
419
433
|
if (l.type === "run_error")
|
|
420
434
|
throw new Error(l.error);
|
|
421
|
-
if (await
|
|
422
|
-
return l.sessionPatch &&
|
|
435
|
+
if (await ot(e, l, T), await $(), l.type === "run_completed")
|
|
436
|
+
return l.sessionPatch && E().applySessionPatch(l.sessionPatch), {
|
|
423
437
|
command: null,
|
|
424
438
|
memoryReplay: l.memoryReplay ?? null,
|
|
425
439
|
memoryDecision: l.memoryDecision ?? null,
|
|
@@ -428,33 +442,33 @@ async function Tt(t, e, o) {
|
|
|
428
442
|
}
|
|
429
443
|
}
|
|
430
444
|
} finally {
|
|
431
|
-
|
|
445
|
+
R.releaseLock();
|
|
432
446
|
}
|
|
433
447
|
return {
|
|
434
448
|
command: null
|
|
435
449
|
};
|
|
436
450
|
}
|
|
437
|
-
async function
|
|
451
|
+
async function A(t) {
|
|
438
452
|
await fetch(
|
|
439
|
-
`${
|
|
453
|
+
`${w()}/v1/runs/${encodeURIComponent(t)}`,
|
|
440
454
|
{
|
|
441
455
|
method: "DELETE",
|
|
442
|
-
headers:
|
|
456
|
+
headers: h()
|
|
443
457
|
}
|
|
444
458
|
);
|
|
445
459
|
}
|
|
446
|
-
function
|
|
460
|
+
function Ct(t) {
|
|
447
461
|
if (!t) return;
|
|
448
|
-
const e =
|
|
449
|
-
e && (
|
|
462
|
+
const e = C.get(t);
|
|
463
|
+
e && (C.delete(t), A(e));
|
|
450
464
|
}
|
|
451
465
|
export {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
466
|
+
st as applyLangGraphTransition,
|
|
467
|
+
ot as applyRemoteEvent,
|
|
468
|
+
tt as beginHostToolCall,
|
|
469
|
+
A as cancelRemoteSpotlightRun,
|
|
470
|
+
Ct as cancelRemoteSpotlightRunForSignal,
|
|
471
|
+
It as runRemoteSpotlightPipeline,
|
|
472
|
+
et as settleHostToolCall,
|
|
473
|
+
Tt as warmupSpotlightRemoteContext
|
|
460
474
|
};
|
|
@@ -14,6 +14,22 @@ export declare function composeToolStepContent(planning: string, answer: string)
|
|
|
14
14
|
* 最终回答和流式回答都必须经过这里,避免中途把内部材料渲染给用户。
|
|
15
15
|
*/
|
|
16
16
|
export declare function sanitizeToolStepAnswerText(content: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Strip vendor evidence labels from displayed text.
|
|
19
|
+
* Never wipe the whole answer just because a label appears inside it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function stripInternalEvidenceAnswer(text: string): string;
|
|
22
|
+
export interface GatherProcessDisplay {
|
|
23
|
+
headline: string;
|
|
24
|
+
items: string[];
|
|
25
|
+
note: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Turn a gather/search summary into a headline + numbered sources.
|
|
29
|
+
* Accepts both the new multiline `1. 2. 3.` form and the old `A;B;C` dump.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseGatherProcessDisplay(content: string): GatherProcessDisplay | null;
|
|
32
|
+
export declare function formatGatherProcessText(content: string): string;
|
|
17
33
|
export declare function isToolExecutionStep(stepId: string): boolean;
|
|
18
34
|
export declare function isAnswerStep(stepId: string): boolean;
|
|
19
35
|
/** 判断是否为 query loop 写入的规划摘要块(「第 N 轮:…」)。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayText.d.ts","sourceRoot":"","sources":["../../../src/store/pipeline/displayText.ts"],"names":[],"mappings":"AAeA,kEAAkE;AAClE,eAAO,MAAM,0BAA0B,qCAAqC,CAAC;AAE7E,8CAA8C;AAC9C,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOpE;AAoCD,yCAAyC;AACzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE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