@inupedia/spotlight-vue 0.1.3 → 0.1.5
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/SpotlightCommandPanel.vue.d.ts.map +1 -1
- package/dist/components/SpotlightCommandPanel.vue.js +1 -1
- package/dist/components/SpotlightCommandPanel2.vue.js +38 -37
- package/dist/components/SpotlightRoot.vue.d.ts.map +1 -1
- package/dist/components/SpotlightRoot.vue.js +13 -12
- package/dist/components/SpotlightThinking.vue.d.ts +5 -0
- package/dist/components/SpotlightThinking.vue.d.ts.map +1 -1
- package/dist/components/SpotlightThinking.vue.js +2 -2
- package/dist/components/SpotlightThinking2.vue.js +293 -288
- package/dist/composables/useSpotlightPanelUi.d.ts +6 -1
- package/dist/composables/useSpotlightPanelUi.d.ts.map +1 -1
- package/dist/composables/useSpotlightPanelUi.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +206 -195
- package/dist/remote/types.d.ts +5 -0
- package/dist/remote/types.d.ts.map +1 -1
- package/dist/store/runtime/types.d.ts +7 -2
- package/dist/store/runtime/types.d.ts.map +1 -1
- package/dist/store/spotlightStore.d.ts +857 -11
- package/dist/store/spotlightStore.d.ts.map +1 -1
- package/dist/store/spotlightStore.js +24 -19
- package/package.json +3 -3
|
@@ -3,6 +3,11 @@ export type SpotlightPanelUiState = "idle" | "running" | "done" | "error";
|
|
|
3
3
|
export type UseSpotlightPanelUiOptions = {
|
|
4
4
|
pipelinePhase: Ref<string>;
|
|
5
5
|
loading: Ref<boolean>;
|
|
6
|
+
memoryReplay?: Ref<{
|
|
7
|
+
source: "exact" | "semantic" | "session";
|
|
8
|
+
entryId: string;
|
|
9
|
+
kind: string;
|
|
10
|
+
} | null>;
|
|
6
11
|
voiceHoldActive?: Ref<boolean>;
|
|
7
12
|
speechPending?: Ref<boolean>;
|
|
8
13
|
voiceKeyLabel?: string;
|
|
@@ -10,6 +15,6 @@ export type UseSpotlightPanelUiOptions = {
|
|
|
10
15
|
export declare function useSpotlightPanelUi(options: UseSpotlightPanelUiOptions): {
|
|
11
16
|
uiState: import("vue").ComputedRef<SpotlightPanelUiState>;
|
|
12
17
|
placeholder: import("vue").ComputedRef<string>;
|
|
13
|
-
badgeLabel: import("vue").ComputedRef<"语音录制中" | "语音识别中" | "Agent 执行中" | "已完成" | "执行异常" | "等待提问">;
|
|
18
|
+
badgeLabel: import("vue").ComputedRef<"语音录制中" | "语音识别中" | "Agent 执行中" | "语义缓存命中" | "Memory 缓存命中" | "已完成" | "执行异常" | "等待提问">;
|
|
14
19
|
};
|
|
15
20
|
//# sourceMappingURL=useSpotlightPanelUi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSpotlightPanelUi.d.ts","sourceRoot":"","sources":["../../src/composables/useSpotlightPanelUi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEzC,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1E,MAAM,MAAM,0BAA0B,GAAG;IACvC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACtB,eAAe,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;;;;
|
|
1
|
+
{"version":3,"file":"useSpotlightPanelUi.d.ts","sourceRoot":"","sources":["../../src/composables/useSpotlightPanelUi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEzC,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1E,MAAM,MAAM,0BAA0B,GAAG;IACvC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACtB,YAAY,CAAC,EAAE,GAAG,CAAC;QACjB,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;QACzC,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC,CAAC;IACV,eAAe,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;;;;EAgDtE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as u } from "vue";
|
|
2
2
|
function t(e) {
|
|
3
|
-
const
|
|
4
|
-
return { uiState: r, placeholder:
|
|
3
|
+
const n = e.voiceKeyLabel ?? "`", r = u(() => e.pipelinePhase.value === "error" ? "error" : e.loading.value || e.pipelinePhase.value === "running" ? "running" : e.pipelinePhase.value === "done" ? "done" : "idle"), l = u(() => e.voiceHoldActive?.value ? `正在录音,松开 ${n} 结束并转写…` : e.speechPending?.value ? "语音识别中,请稍候…" : r.value === "running" ? "Agent 正在分析场景、路由工具和上下文…" : r.value === "done" ? "继续追问,或者换个角度继续盘它…" : r.value === "error" ? "刚才那轮跑岔了,换个问法再试试…" : "输入问题或从下方选择历史…"), a = u(() => e.voiceHoldActive?.value ? "语音录制中" : e.speechPending?.value ? "语音识别中" : r.value === "running" ? "Agent 执行中" : r.value === "done" ? e.memoryReplay?.value ? e.memoryReplay.value.source === "semantic" ? "语义缓存命中" : "Memory 缓存命中" : "已完成" : r.value === "error" ? "执行异常" : "等待提问");
|
|
4
|
+
return { uiState: r, placeholder: l, badgeLabel: a };
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
7
|
t as useSpotlightPanelUi
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defineSpotlightConfig, SPOTLIGHT_CONFIG_KEY, type SpotlightConfig, type SpotlightConfigInput, type SpotlightHostServicesRegistration, type SpotlightQuickPanelActions, type SpotlightVuePluginOptions, } from "./config.js";
|
|
2
|
-
export { resolveSpotlightConfig, type SpotlightHostRegistration } from "./resolveConfig.js";
|
|
2
|
+
export { resolveSpotlightConfig, type SpotlightHostRegistration, } from "./resolveConfig.js";
|
|
3
3
|
export { defineSpotlightApp, readSpotlightEnv, type DefineSpotlightAppOptions, type SpotlightEnvDefaults, } from "./host/defineApp.js";
|
|
4
4
|
export { defineSpotlightHost, type DefineSpotlightHostOptions, type SpotlightHostFactory, type SpotlightHostSkillsInput, } from "./host/defineHost.js";
|
|
5
5
|
export { normalizeSkillsOption, type SpotlightHostSkillsOption, } from "./host/normalizeSkills.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,EACtC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,GAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,EACtC,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AsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,eAAe,EACpB,KAAK,yBAAyB,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,GAC1B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,EAChC,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AA8a9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAsCD,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,2BAA2B,CAAC,CAgGtC;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,MAAM,iBAQ3D;AAED,wBAAgB,iCAAiC,CAAC,MAAM,CAAC,EAAE,WAAW,QAMrE"}
|
|
@@ -1,226 +1,238 @@
|
|
|
1
|
-
import { serializeSkillsForRemote as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useSpotlightRuntimeStore as E } from "../store/runtimeStore.js";
|
|
1
|
+
import { serializeSkillsForRemote as x } from "@inupedia/spotlight-client";
|
|
2
|
+
import { getSkillsPoolForRun as E } from "../skills/index.js";
|
|
3
|
+
import { useAgentSessionStore as R } from "../session/agentSession.js";
|
|
4
|
+
import { useSpotlightRuntimeStore as A } from "../store/runtimeStore.js";
|
|
6
5
|
import { SPOTLIGHT_PIPELINE_STEP_IDS as r } from "../store/pipeline/constants.js";
|
|
7
|
-
import { isLoopPlanningChunk as
|
|
8
|
-
import {
|
|
9
|
-
import { executeRemoteHostTool as
|
|
10
|
-
import { getSpotlightServerBase as
|
|
11
|
-
import { ensureSpotlightMeta as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
return
|
|
6
|
+
import { isLoopPlanningChunk as L, splitIntentStepContent as $, splitToolStepContent as O, composeToolStepContent as H } from "../store/pipeline/displayText.js";
|
|
7
|
+
import { getSpotlightConfig as F } from "../plugin.js";
|
|
8
|
+
import { executeRemoteHostTool as M, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
|
|
9
|
+
import { getSpotlightServerBase as h, buildSpotlightJsonHeaders as S, getSpotlightProjectId as q } from "./httpConfig.js";
|
|
10
|
+
import { ensureSpotlightMeta as J } from "./meta.js";
|
|
11
|
+
const g = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
function W(e) {
|
|
13
|
+
return e.type !== "host_action_request" && e.type !== "run_completed" && e.type !== "run_error" && e.type !== "ping";
|
|
15
14
|
}
|
|
16
|
-
function a(
|
|
17
|
-
const s =
|
|
15
|
+
function a(e, t, o) {
|
|
16
|
+
const s = e.getSteps().find((l) => l.id === t);
|
|
18
17
|
if (s) return s;
|
|
19
|
-
const n = { id:
|
|
20
|
-
return
|
|
18
|
+
const n = { id: t, label: o, status: "pending" };
|
|
19
|
+
return e.setSteps([...e.getSteps(), n]), n;
|
|
21
20
|
}
|
|
22
|
-
function
|
|
23
|
-
return new Promise((
|
|
24
|
-
requestAnimationFrame(() =>
|
|
21
|
+
function D() {
|
|
22
|
+
return new Promise((e) => {
|
|
23
|
+
requestAnimationFrame(() => e());
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
|
-
function j(
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
return
|
|
31
|
-
if (
|
|
26
|
+
function j(e) {
|
|
27
|
+
const t = e.summary?.trim();
|
|
28
|
+
if (t && t.length > 48 && !t.startsWith("{") && !t.startsWith("["))
|
|
29
|
+
return t;
|
|
30
|
+
if (e.output != null && typeof e.output == "object")
|
|
32
31
|
try {
|
|
33
|
-
const o = JSON.stringify(
|
|
32
|
+
const o = JSON.stringify(e.output, null, 2);
|
|
34
33
|
if (o && o !== "{}") return o;
|
|
35
34
|
} catch {
|
|
36
35
|
}
|
|
37
|
-
return
|
|
36
|
+
return t || "";
|
|
38
37
|
}
|
|
39
|
-
function U(
|
|
40
|
-
const
|
|
38
|
+
function U(e) {
|
|
39
|
+
const t = j(e.result);
|
|
41
40
|
return {
|
|
42
|
-
id:
|
|
43
|
-
name:
|
|
44
|
-
displayName:
|
|
45
|
-
argsText: JSON.stringify(
|
|
46
|
-
resultText:
|
|
47
|
-
summary:
|
|
48
|
-
errorCode:
|
|
49
|
-
trace:
|
|
50
|
-
status:
|
|
41
|
+
id: e.result.call.id,
|
|
42
|
+
name: e.result.call.name,
|
|
43
|
+
displayName: e.result.call.displayName,
|
|
44
|
+
argsText: JSON.stringify(e.result.call.input ?? {}, null, 2),
|
|
45
|
+
resultText: t,
|
|
46
|
+
summary: e.result.summary,
|
|
47
|
+
errorCode: e.result.errorCode,
|
|
48
|
+
trace: e.result.trace,
|
|
49
|
+
status: e.result.success ? "done" : "error"
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
|
-
function z(
|
|
52
|
+
function z(e) {
|
|
54
53
|
return {
|
|
55
|
-
id:
|
|
56
|
-
name:
|
|
57
|
-
displayName:
|
|
58
|
-
argsText: JSON.stringify(
|
|
54
|
+
id: e.call.id,
|
|
55
|
+
name: e.call.name,
|
|
56
|
+
displayName: e.call.displayName,
|
|
57
|
+
argsText: JSON.stringify(e.call.input ?? {}, null, 2),
|
|
59
58
|
status: "running"
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
|
-
function G(
|
|
63
|
-
const o =
|
|
61
|
+
function G(e, t) {
|
|
62
|
+
const o = t.success ? "前端操作已执行。" : t.error || "前端操作执行失败。";
|
|
64
63
|
return {
|
|
65
|
-
id:
|
|
66
|
-
name:
|
|
67
|
-
displayName:
|
|
68
|
-
argsText: JSON.stringify(
|
|
64
|
+
id: e.id,
|
|
65
|
+
name: e.name,
|
|
66
|
+
displayName: e.displayName,
|
|
67
|
+
argsText: JSON.stringify(e.input ?? {}, null, 2),
|
|
69
68
|
resultText: o,
|
|
70
69
|
summary: o,
|
|
71
|
-
errorCode:
|
|
72
|
-
trace:
|
|
73
|
-
status:
|
|
70
|
+
errorCode: t.errorCode,
|
|
71
|
+
trace: t.trace,
|
|
72
|
+
status: t.success ? "done" : "error"
|
|
74
73
|
};
|
|
75
74
|
}
|
|
76
|
-
function B(
|
|
77
|
-
return
|
|
75
|
+
function B(e) {
|
|
76
|
+
return e.startsWith("panel.") || e.startsWith("navigate.") || e.startsWith("session.");
|
|
78
77
|
}
|
|
79
|
-
function Q(
|
|
80
|
-
if (!B(
|
|
81
|
-
a(
|
|
82
|
-
const s = G(
|
|
83
|
-
|
|
78
|
+
function Q(e, t, o) {
|
|
79
|
+
if (!B(t.request.call.name)) return;
|
|
80
|
+
a(e, r.tool, "执行工具与回答");
|
|
81
|
+
const s = G(t.request.call, o);
|
|
82
|
+
e.appendToolCallsToStep(r.tool, [s]), e.setStep(
|
|
84
83
|
r.tool,
|
|
85
84
|
o.success ? "done" : "error",
|
|
86
85
|
s.resultText
|
|
87
86
|
);
|
|
88
87
|
}
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
function p(e, t) {
|
|
89
|
+
if (t !== r.tool) return;
|
|
90
|
+
const o = e.getSteps().find((s) => s.id === t);
|
|
91
|
+
!o || o.status === "active" || o.status === "done" || e.setStep(t, "active", o.content);
|
|
92
|
+
}
|
|
93
|
+
function w(e, t) {
|
|
94
|
+
return t || (e === r.tool ? "执行工具与回答" : e);
|
|
95
|
+
}
|
|
96
|
+
async function V(e, t) {
|
|
97
|
+
if (t.type !== "ping") {
|
|
98
|
+
if (t.type === "step_sync")
|
|
99
|
+
e.setSteps(
|
|
100
|
+
t.steps.map((o) => ({
|
|
94
101
|
id: o.id,
|
|
95
102
|
label: o.label,
|
|
96
103
|
status: o.status,
|
|
97
|
-
content:
|
|
104
|
+
content: e.getSteps().find((s) => s.id === o.id)?.content
|
|
98
105
|
}))
|
|
99
106
|
);
|
|
100
|
-
else if (
|
|
101
|
-
a(
|
|
102
|
-
else if (
|
|
103
|
-
let o =
|
|
104
|
-
if (o === r.intent &&
|
|
107
|
+
else if (t.type === "step_status")
|
|
108
|
+
a(e, t.stepId, t.label ?? t.stepId), e.setStep(t.stepId, t.status, t.content);
|
|
109
|
+
else if (t.type === "step_content") {
|
|
110
|
+
let o = t.stepId, s = t.content;
|
|
111
|
+
if (o === r.intent && L(s))
|
|
105
112
|
o = r.tool;
|
|
106
|
-
else if (o === r.intent &&
|
|
107
|
-
const { intent: n, misplacedPlanning:
|
|
108
|
-
s = n,
|
|
113
|
+
else if (o === r.intent && t.mode === "replace") {
|
|
114
|
+
const { intent: n, misplacedPlanning: l } = $(s);
|
|
115
|
+
s = n, l.trim() && (a(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
|
|
109
116
|
r.tool,
|
|
110
|
-
|
|
117
|
+
l
|
|
111
118
|
));
|
|
112
119
|
}
|
|
113
|
-
a(
|
|
114
|
-
t,
|
|
120
|
+
a(e, o, w(o, t.label)), t.mode === "replace" ? e.setStep(
|
|
115
121
|
o,
|
|
116
|
-
e.
|
|
117
|
-
), e.mode === "replace" ? t.setStep(
|
|
118
|
-
o,
|
|
119
|
-
t.getSteps().find((n) => n.id === o)?.status ?? "active",
|
|
122
|
+
e.getSteps().find((n) => n.id === o)?.status ?? "active",
|
|
120
123
|
s
|
|
121
|
-
) : (
|
|
122
|
-
} else if (
|
|
123
|
-
a(t,
|
|
124
|
-
|
|
124
|
+
) : (p(e, o), e.appendChunkToStep(o, s), await D());
|
|
125
|
+
} else if (t.type === "step_artifact")
|
|
126
|
+
a(e, t.stepId, w(t.stepId, t.label)), p(e, t.stepId), t.artifact === "tool_calls" && t.toolCalls?.length ? e.appendToolCallsToStep(t.stepId, t.toolCalls) : t.artifact === "attachments" && t.attachments?.length ? e.appendAttachmentsToStep(t.stepId, t.attachments) : t.artifact === "files" && t.files?.length ? e.appendFilesToStep(t.stepId, t.files) : t.artifact === "artifacts" && t.artifacts?.length ? e.appendArtifactsToStep(t.stepId, t.artifacts) : t.artifact === "chat_items" && t.chatItems?.length && e.appendChatItemsToStep(t.stepId, t.chatItems);
|
|
127
|
+
else if (t.type === "tool_start")
|
|
128
|
+
a(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
129
|
+
z(t)
|
|
125
130
|
]);
|
|
126
|
-
else if (
|
|
127
|
-
a(
|
|
131
|
+
else if (t.type === "tool_progress")
|
|
132
|
+
a(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
128
133
|
{
|
|
129
|
-
id:
|
|
130
|
-
name:
|
|
131
|
-
displayName:
|
|
132
|
-
argsText: JSON.stringify(
|
|
133
|
-
summary:
|
|
134
|
+
id: t.call.id,
|
|
135
|
+
name: t.call.name,
|
|
136
|
+
displayName: t.call.displayName,
|
|
137
|
+
argsText: JSON.stringify(t.call.input ?? {}, null, 2),
|
|
138
|
+
summary: t.summary,
|
|
134
139
|
status: "running"
|
|
135
140
|
}
|
|
136
141
|
]);
|
|
137
|
-
else if (
|
|
138
|
-
a(
|
|
139
|
-
U(
|
|
140
|
-
]),
|
|
142
|
+
else if (t.type === "tool_result")
|
|
143
|
+
a(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
144
|
+
U(t)
|
|
145
|
+
]), t.result.attachments?.length && e.appendAttachmentsToStep(
|
|
141
146
|
r.tool,
|
|
142
|
-
|
|
143
|
-
),
|
|
147
|
+
t.result.attachments
|
|
148
|
+
), t.result.files?.length && e.appendFilesToStep(
|
|
144
149
|
r.tool,
|
|
145
|
-
|
|
146
|
-
),
|
|
150
|
+
t.result.files
|
|
151
|
+
), t.result.toolCalls?.length && e.appendToolCallsToStep(
|
|
147
152
|
r.tool,
|
|
148
|
-
|
|
153
|
+
t.result.toolCalls
|
|
149
154
|
);
|
|
150
|
-
else if (
|
|
155
|
+
else if (t.type === "skill_permission_request") {
|
|
151
156
|
const { useSpotlightStore: o } = await import("../store/spotlightStore.js");
|
|
152
157
|
o().setPendingSkillPermission({
|
|
153
|
-
skillName:
|
|
154
|
-
displayName:
|
|
155
|
-
reason:
|
|
156
|
-
source:
|
|
157
|
-
at:
|
|
158
|
+
skillName: t.skillName,
|
|
159
|
+
displayName: t.displayName,
|
|
160
|
+
reason: t.reason,
|
|
161
|
+
source: t.source,
|
|
162
|
+
at: t.at
|
|
158
163
|
});
|
|
159
|
-
} else if (
|
|
160
|
-
a(
|
|
164
|
+
} else if (t.type === "fork_progress")
|
|
165
|
+
a(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
|
|
161
166
|
r.tool,
|
|
162
167
|
`
|
|
163
|
-
[fork ${
|
|
168
|
+
[fork ${t.agentId}] 第 ${t.iteration} 轮 · ${t.phase}:${t.summary}
|
|
164
169
|
`
|
|
165
170
|
);
|
|
166
|
-
else if (
|
|
167
|
-
a(
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
else if (t.type === "turn_transition")
|
|
172
|
+
t.phase === "memory_replay" && (a(e, r.breakdown, "问题拆解"), e.setStep(
|
|
173
|
+
r.breakdown,
|
|
174
|
+
"done",
|
|
175
|
+
t.summary ?? "Memory 缓存命中,跳过 LLM 规划。"
|
|
176
|
+
));
|
|
177
|
+
else if (t.type === "assistant_response") {
|
|
178
|
+
a(e, r.tool, "执行工具与回答");
|
|
179
|
+
const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: n } = O(o?.content ?? ""), l = t.content.trim(), c = n.trim();
|
|
180
|
+
c && l && (c === l || l.startsWith(
|
|
181
|
+
c.slice(0, Math.min(c.length, 80))
|
|
182
|
+
)) ? e.setStep(r.tool, "done") : e.setStep(
|
|
170
183
|
r.tool,
|
|
171
184
|
"done",
|
|
172
|
-
|
|
185
|
+
H(s, l)
|
|
173
186
|
);
|
|
174
187
|
}
|
|
175
|
-
|
|
188
|
+
W(t) && e.appendExecutionEvent?.(t);
|
|
176
189
|
}
|
|
177
190
|
}
|
|
178
|
-
async function
|
|
191
|
+
async function Y(e) {
|
|
179
192
|
await fetch(
|
|
180
|
-
`${
|
|
193
|
+
`${h()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
|
|
181
194
|
{
|
|
182
195
|
method: "POST",
|
|
183
|
-
headers:
|
|
196
|
+
headers: S(),
|
|
184
197
|
body: JSON.stringify({
|
|
185
|
-
correlationId:
|
|
186
|
-
success:
|
|
187
|
-
output:
|
|
188
|
-
error:
|
|
189
|
-
errorCode:
|
|
190
|
-
trace:
|
|
198
|
+
correlationId: e.correlationId,
|
|
199
|
+
success: e.result.success,
|
|
200
|
+
output: e.result.data,
|
|
201
|
+
error: e.result.error,
|
|
202
|
+
errorCode: e.result.errorCode,
|
|
203
|
+
trace: e.result.trace
|
|
191
204
|
}),
|
|
192
|
-
signal:
|
|
205
|
+
signal: e.signal
|
|
193
206
|
}
|
|
194
207
|
);
|
|
195
208
|
}
|
|
196
|
-
function
|
|
197
|
-
const
|
|
198
|
-
return { events:
|
|
199
|
-
const
|
|
200
|
-
if (!
|
|
209
|
+
function K(e) {
|
|
210
|
+
const t = e.split(/\n\n/u), o = t.pop() ?? "";
|
|
211
|
+
return { events: t.flatMap((n) => {
|
|
212
|
+
const l = n.split(/\n/u).find((c) => c.startsWith("data: "));
|
|
213
|
+
if (!l) return [];
|
|
201
214
|
try {
|
|
202
|
-
return [JSON.parse(
|
|
215
|
+
return [JSON.parse(l.slice(6))];
|
|
203
216
|
} catch {
|
|
204
217
|
return [];
|
|
205
218
|
}
|
|
206
219
|
}), rest: o };
|
|
207
220
|
}
|
|
208
|
-
async function
|
|
221
|
+
async function at(e) {
|
|
209
222
|
await Promise.allSettled([
|
|
210
|
-
|
|
211
|
-
|
|
223
|
+
_(e),
|
|
224
|
+
J(e)
|
|
212
225
|
]);
|
|
213
226
|
}
|
|
214
|
-
async function X(
|
|
215
|
-
const o =
|
|
227
|
+
async function X(e, t) {
|
|
228
|
+
const o = R(), s = A(), n = await _(t);
|
|
216
229
|
return {
|
|
217
230
|
hostManifest: n,
|
|
218
|
-
localClientTools: i,
|
|
219
231
|
payload: {
|
|
220
|
-
projectId:
|
|
232
|
+
projectId: q(),
|
|
221
233
|
sessionId: o.sessionId,
|
|
222
|
-
userQuestion:
|
|
223
|
-
uiContext:
|
|
234
|
+
userQuestion: e,
|
|
235
|
+
uiContext: F().getUiContext?.() ?? {},
|
|
224
236
|
sessionState: {
|
|
225
237
|
sessionId: o.sessionId,
|
|
226
238
|
activeTaskId: o.activeTaskId,
|
|
@@ -240,105 +252,104 @@ async function X(t, e) {
|
|
|
240
252
|
resumableAction: s.resumableAction,
|
|
241
253
|
lastResolvedTarget: s.lastResolvedTarget
|
|
242
254
|
},
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
clientTools: i,
|
|
246
|
-
skills: N(x())
|
|
255
|
+
clientToolsManifestVersion: n.version,
|
|
256
|
+
skills: x(E())
|
|
247
257
|
}
|
|
248
258
|
};
|
|
249
259
|
}
|
|
250
|
-
async function ct(
|
|
251
|
-
const o =
|
|
252
|
-
|
|
260
|
+
async function ct(e, t) {
|
|
261
|
+
const o = h(), s = t.getSignal(), { payload: n, hostManifest: l } = await X(
|
|
262
|
+
e,
|
|
253
263
|
s
|
|
254
|
-
),
|
|
264
|
+
), c = new Set(l.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
|
|
255
265
|
method: "POST",
|
|
256
|
-
headers:
|
|
266
|
+
headers: S(),
|
|
257
267
|
body: JSON.stringify(n),
|
|
258
268
|
signal: s
|
|
259
269
|
});
|
|
260
|
-
if (!
|
|
261
|
-
const
|
|
270
|
+
if (!u.ok) {
|
|
271
|
+
const d = await u.text().catch(() => "");
|
|
262
272
|
throw new Error(
|
|
263
|
-
`Spotlight 后端创建 run 失败:${
|
|
273
|
+
`Spotlight 后端创建 run 失败:${u.status} ${d}`
|
|
264
274
|
);
|
|
265
275
|
}
|
|
266
|
-
const { runId:
|
|
267
|
-
s && (
|
|
276
|
+
const { runId: m } = await u.json();
|
|
277
|
+
s && (g.set(s, m), s.addEventListener(
|
|
268
278
|
"abort",
|
|
269
279
|
() => {
|
|
270
|
-
|
|
280
|
+
b(m);
|
|
271
281
|
},
|
|
272
282
|
{ once: !0 }
|
|
273
283
|
));
|
|
274
|
-
const
|
|
275
|
-
`${o}/v1/runs/${encodeURIComponent(
|
|
284
|
+
const f = await fetch(
|
|
285
|
+
`${o}/v1/runs/${encodeURIComponent(m)}/events`,
|
|
276
286
|
{
|
|
277
|
-
headers:
|
|
287
|
+
headers: S(),
|
|
278
288
|
signal: s
|
|
279
289
|
}
|
|
280
290
|
);
|
|
281
|
-
if (!
|
|
282
|
-
throw new Error(`Spotlight 后端事件流连接失败:${
|
|
283
|
-
const
|
|
284
|
-
let
|
|
291
|
+
if (!f.ok || !f.body)
|
|
292
|
+
throw new Error(`Spotlight 后端事件流连接失败:${f.status}`);
|
|
293
|
+
const T = f.body.getReader(), P = new TextDecoder();
|
|
294
|
+
let y = "", k = null;
|
|
285
295
|
try {
|
|
286
296
|
for (; ; ) {
|
|
287
|
-
const { done:
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
for (const
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
allowedHostNames:
|
|
296
|
-
hostEffect:
|
|
297
|
+
const { done: d, value: N } = await T.read();
|
|
298
|
+
if (d) break;
|
|
299
|
+
y += P.decode(N, { stream: !0 });
|
|
300
|
+
const C = K(y);
|
|
301
|
+
y = C.rest;
|
|
302
|
+
for (const i of C.events) {
|
|
303
|
+
if (i.type === "host_action_request") {
|
|
304
|
+
const I = await M(i.request.call, t, {
|
|
305
|
+
allowedHostNames: c,
|
|
306
|
+
hostEffect: i.request.hostEffect
|
|
297
307
|
});
|
|
298
|
-
Q(
|
|
299
|
-
runId:
|
|
300
|
-
correlationId:
|
|
301
|
-
result:
|
|
308
|
+
Q(t, i, I), await Y({
|
|
309
|
+
runId: m,
|
|
310
|
+
correlationId: i.request.correlationId,
|
|
311
|
+
result: I,
|
|
302
312
|
signal: s
|
|
303
313
|
});
|
|
304
314
|
continue;
|
|
305
315
|
}
|
|
306
|
-
if (
|
|
307
|
-
throw new Error(
|
|
308
|
-
if (await
|
|
309
|
-
return
|
|
310
|
-
|
|
311
|
-
),
|
|
316
|
+
if (i.type === "run_error")
|
|
317
|
+
throw new Error(i.error);
|
|
318
|
+
if (await V(t, i), i.type === "run_completed")
|
|
319
|
+
return i.sessionPatch?.invokedSkills && R().setInvokedSkills(
|
|
320
|
+
i.sessionPatch.invokedSkills
|
|
321
|
+
), k = i, {
|
|
312
322
|
command: null,
|
|
313
|
-
usedLegacyFallback:
|
|
323
|
+
usedLegacyFallback: i.usedQueryLoop,
|
|
324
|
+
memoryReplay: i.memoryReplay ?? null
|
|
314
325
|
};
|
|
315
326
|
}
|
|
316
327
|
}
|
|
317
328
|
} finally {
|
|
318
|
-
|
|
329
|
+
T.releaseLock();
|
|
319
330
|
}
|
|
320
331
|
return {
|
|
321
332
|
command: null,
|
|
322
|
-
usedLegacyFallback:
|
|
333
|
+
usedLegacyFallback: k?.usedQueryLoop ?? !0
|
|
323
334
|
};
|
|
324
335
|
}
|
|
325
|
-
async function
|
|
336
|
+
async function b(e) {
|
|
326
337
|
await fetch(
|
|
327
|
-
`${
|
|
338
|
+
`${h()}/v1/runs/${encodeURIComponent(e)}`,
|
|
328
339
|
{
|
|
329
340
|
method: "DELETE",
|
|
330
|
-
headers:
|
|
341
|
+
headers: S()
|
|
331
342
|
}
|
|
332
343
|
);
|
|
333
344
|
}
|
|
334
|
-
function
|
|
335
|
-
if (!
|
|
336
|
-
const
|
|
337
|
-
|
|
345
|
+
function ut(e) {
|
|
346
|
+
if (!e) return;
|
|
347
|
+
const t = g.get(e);
|
|
348
|
+
t && (g.delete(e), b(t));
|
|
338
349
|
}
|
|
339
350
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
351
|
+
b as cancelRemoteSpotlightRun,
|
|
352
|
+
ut as cancelRemoteSpotlightRunForSignal,
|
|
342
353
|
ct as runRemoteSpotlightPipeline,
|
|
343
|
-
|
|
354
|
+
at as warmupSpotlightRemoteContext
|
|
344
355
|
};
|
package/dist/remote/types.d.ts
CHANGED
|
@@ -2,5 +2,10 @@ import type { SpotlightCommand } from "../store/types.js";
|
|
|
2
2
|
export type SpotlightPipelineRunOutcome = {
|
|
3
3
|
command: SpotlightCommand | null;
|
|
4
4
|
usedLegacyFallback: boolean;
|
|
5
|
+
memoryReplay?: {
|
|
6
|
+
source: "exact" | "semantic" | "session";
|
|
7
|
+
entryId: string;
|
|
8
|
+
kind: string;
|
|
9
|
+
} | null;
|
|
5
10
|
};
|
|
6
11
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/remote/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/remote/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE;QACb,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;QACzC,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC;CACV,CAAC"}
|