@inupedia/spotlight-vue 0.3.5 → 0.4.0
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 +7 -89
- 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 +88 -85
- package/dist/components/SpotlightRoot.vue.d.ts.map +1 -1
- package/dist/components/SpotlightRoot.vue.js +21 -19
- package/dist/components/SpotlightThinking.vue.d.ts +3 -0
- package/dist/components/SpotlightThinking.vue.d.ts.map +1 -1
- package/dist/components/SpotlightThinking.vue.js +1 -1
- package/dist/components/SpotlightThinking2.vue.js +459 -398
- package/dist/composables/useSpotlightPanelUi.d.ts +3 -1
- package/dist/composables/useSpotlightPanelUi.d.ts.map +1 -1
- package/dist/composables/useSpotlightPanelUi.js +8 -3
- package/dist/config.d.ts +9 -18
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -10
- package/dist/env.d.ts +11 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +14 -0
- package/dist/index.d.ts +3 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -126
- package/dist/plugin.d.ts +6 -5
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +35 -35
- package/dist/remote/hostToolRunner.d.ts +1 -1
- package/dist/remote/hostToolRunner.d.ts.map +1 -1
- package/dist/remote/hostToolRunner.js +38 -20
- package/dist/remote/runPipeline.d.ts +3 -8
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +133 -135
- package/dist/remote/types.d.ts +2 -0
- package/dist/remote/types.d.ts.map +1 -1
- package/dist/skills/skillPaths.js +5 -18
- package/dist/store/memoryPreferenceCopy.d.ts +6 -0
- package/dist/store/memoryPreferenceCopy.d.ts.map +1 -0
- package/dist/store/memoryPreferenceCopy.js +14 -0
- package/dist/store/memoryResultCopy.d.ts +6 -0
- package/dist/store/memoryResultCopy.d.ts.map +1 -0
- package/dist/store/memoryResultCopy.js +12 -0
- package/dist/store/spotlightStore.d.ts +78 -12
- package/dist/store/spotlightStore.d.ts.map +1 -1
- package/dist/store/spotlightStore.js +130 -124
- package/package.json +4 -8
- package/dist/composables/useSpotlightHostCore.d.ts +0 -8
- package/dist/composables/useSpotlightHostCore.d.ts.map +0 -1
- package/dist/composables/useSpotlightHostCore.js +0 -24
- package/dist/createSpotlight.d.ts +0 -38
- package/dist/createSpotlight.d.ts.map +0 -1
- package/dist/createSpotlight.js +0 -79
- package/dist/host/capabilityHost.d.ts +0 -38
- package/dist/host/capabilityHost.d.ts.map +0 -1
- package/dist/host/capabilityHost.js +0 -81
- package/dist/host/defineApp.d.ts +0 -16
- package/dist/host/defineApp.d.ts.map +0 -1
- package/dist/host/defineApp.js +0 -26
- package/dist/host/defineHost.d.ts +0 -55
- package/dist/host/defineHost.d.ts.map +0 -1
- package/dist/host/defineHost.js +0 -54
- package/dist/host/normalizeSkills.d.ts +0 -4
- package/dist/host/normalizeSkills.d.ts.map +0 -1
- package/dist/host/normalizeSkills.js +0 -10
- package/dist/host/skillExecution.d.ts +0 -9
- package/dist/host/skillExecution.d.ts.map +0 -1
- package/dist/host/skillExecution.js +0 -13
- package/dist/resolveConfig.d.ts +0 -21
- package/dist/resolveConfig.d.ts.map +0 -1
- package/dist/resolveConfig.js +0 -13
- package/dist/workflow/createOperateDefinition.d.ts +0 -22
- package/dist/workflow/createOperateDefinition.d.ts.map +0 -1
- package/dist/workflow/createOperateDefinition.js +0 -31
- package/dist/workflow/index.d.ts +0 -6
- package/dist/workflow/index.d.ts.map +0 -1
- package/dist/workflow/index.js +0 -20
- package/dist/workflow/operate.d.ts +0 -23
- package/dist/workflow/operate.d.ts.map +0 -1
- package/dist/workflow/operate.js +0 -95
- package/dist/workflow/runHostTool.d.ts +0 -4
- package/dist/workflow/runHostTool.d.ts.map +0 -1
- package/dist/workflow/runHostTool.js +0 -12
- package/dist/workflow/sessionControl.d.ts +0 -30
- package/dist/workflow/sessionControl.d.ts.map +0 -1
- package/dist/workflow/sessionControl.js +0 -112
- package/dist/workflow/shared.d.ts +0 -6
- package/dist/workflow/shared.d.ts.map +0 -1
- package/dist/workflow/shared.js +0 -14
|
@@ -1,24 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
sessionToolHandler: c
|
|
1
|
+
import { createClientToolManifest as s } from "@inupedia/spotlight-client";
|
|
2
|
+
import { getSpotlightConfig as i, getSpotlightClientTools as a } from "../plugin.js";
|
|
3
|
+
const c = {};
|
|
4
|
+
async function m(t) {
|
|
5
|
+
const e = i(), n = c, r = e.frontendBuildId?.trim() || n?.VITE_BUILD_SHA?.trim() || "development";
|
|
6
|
+
return await s({
|
|
7
|
+
projectId: e.projectId,
|
|
8
|
+
frontendBuildId: r,
|
|
9
|
+
tools: typeof e.tools == "function" ? e.tools() : e.tools
|
|
11
10
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
}
|
|
12
|
+
async function d(t, e, n) {
|
|
13
|
+
const r = a();
|
|
14
|
+
if (!n.allowedHostNames.has(t.name) || !r.has(t.name))
|
|
15
|
+
return {
|
|
16
|
+
success: !1,
|
|
17
|
+
error: `Client tool is not registered: ${t.name}`,
|
|
18
|
+
errorCode: "UNKNOWN_TOOL",
|
|
19
|
+
trace: [],
|
|
20
|
+
executionTarget: "host"
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
return {
|
|
24
|
+
success: !0,
|
|
25
|
+
data: await r.execute(t.name, t.input),
|
|
26
|
+
trace: [],
|
|
27
|
+
executionTarget: "host"
|
|
28
|
+
};
|
|
29
|
+
} catch (o) {
|
|
30
|
+
return {
|
|
31
|
+
success: !1,
|
|
32
|
+
error: o instanceof Error ? o.message : String(o),
|
|
33
|
+
errorCode: "TOOL_RUN_FAILED",
|
|
34
|
+
trace: [],
|
|
35
|
+
executionTarget: "host"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
20
38
|
}
|
|
21
39
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
40
|
+
m as ensureHostToolsManifest,
|
|
41
|
+
d as executeRemoteHostTool
|
|
24
42
|
};
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { HandlerApi } from "../store/pipeline/types.js";
|
|
2
2
|
import type { SpotlightPipelineRunOutcome } from "./types.js";
|
|
3
3
|
export declare function warmupSpotlightRemoteContext(signal?: AbortSignal): Promise<void>;
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}): Omit<T, "skills"> & {
|
|
8
|
-
capabilitySnapshotId?: string;
|
|
9
|
-
sessionBindingVersion?: number;
|
|
10
|
-
};
|
|
11
|
-
export declare function runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi): Promise<SpotlightPipelineRunOutcome>;
|
|
4
|
+
export declare function runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi, options?: {
|
|
5
|
+
forceMemoryRefresh?: boolean;
|
|
6
|
+
}): Promise<SpotlightPipelineRunOutcome>;
|
|
12
7
|
export declare function cancelRemoteSpotlightRun(runId: string): Promise<void>;
|
|
13
8
|
export declare function cancelRemoteSpotlightRunForSignal(signal?: AbortSignal): void;
|
|
14
9
|
//# sourceMappingURL=runPipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AA2c9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAiDD,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,UAAU,EACf,OAAO,CAAC,EAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAiGtC;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,MAAM,iBAQ3D;AAED,wBAAgB,iCAAiC,CAAC,MAAM,CAAC,EAAE,WAAW,QAMrE"}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { serializeSkillsForRemote as E
|
|
2
|
-
import { getSkillsPoolForRun as
|
|
1
|
+
import { serializeSkillsForRemote as E } from "@inupedia/spotlight-client";
|
|
2
|
+
import { getSkillsPoolForRun as A } from "../skills/index.js";
|
|
3
3
|
import { useAgentSessionStore as b } from "../session/agentSession.js";
|
|
4
|
-
import { useSpotlightMemoryPreferenceStore as
|
|
5
|
-
import { useSpotlightRuntimeStore as
|
|
4
|
+
import { useSpotlightMemoryPreferenceStore as L } from "../store/memoryPreferenceStore.js";
|
|
5
|
+
import { useSpotlightRuntimeStore as $ } from "../store/runtimeStore.js";
|
|
6
6
|
import { SPOTLIGHT_PIPELINE_STEP_IDS as r } from "../store/pipeline/constants.js";
|
|
7
|
-
import { isLoopPlanningChunk as
|
|
8
|
-
import { getSpotlightConfig as
|
|
9
|
-
import { executeRemoteHostTool as
|
|
10
|
-
import { getSpotlightServerBase as
|
|
11
|
-
import { ensureSpotlightMeta as
|
|
12
|
-
import { getSpotlightCapabilityRuntime as B } from "../createSpotlight.js";
|
|
7
|
+
import { isLoopPlanningChunk as M, splitIntentStepContent as O, splitToolStepContent as H, composeToolStepContent as q } from "../store/pipeline/displayText.js";
|
|
8
|
+
import { getSpotlightConfig as D } from "../plugin.js";
|
|
9
|
+
import { executeRemoteHostTool as F, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
|
|
10
|
+
import { getSpotlightServerBase as T, buildSpotlightJsonHeaders as y, getSpotlightProjectId as J } from "./httpConfig.js";
|
|
11
|
+
import { ensureSpotlightMeta as W } from "./meta.js";
|
|
13
12
|
const h = /* @__PURE__ */ new WeakMap();
|
|
14
|
-
function
|
|
15
|
-
return e.type !== "host_action_request" && e.type !== "run_completed" && e.type !== "run_error" && e.type !== "ping";
|
|
13
|
+
function j(e) {
|
|
14
|
+
return e.type !== "host_action_request" && e.type !== "run_completed" && e.type !== "run_error" && e.type !== "ping" && e.type !== "memory_decision";
|
|
16
15
|
}
|
|
17
16
|
function c(e, t, o) {
|
|
18
|
-
const s = e.getSteps().find((
|
|
17
|
+
const s = e.getSteps().find((l) => l.id === t);
|
|
19
18
|
if (s) return s;
|
|
20
|
-
const
|
|
21
|
-
return e.setSteps([...e.getSteps(),
|
|
19
|
+
const n = { id: t, label: o, status: "pending" };
|
|
20
|
+
return e.setSteps([...e.getSteps(), n]), n;
|
|
22
21
|
}
|
|
23
|
-
function
|
|
22
|
+
function B() {
|
|
24
23
|
return new Promise((e) => {
|
|
25
24
|
requestAnimationFrame(() => e());
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
|
-
function
|
|
27
|
+
function U(e) {
|
|
29
28
|
const t = e.summary?.trim();
|
|
30
29
|
if (t && t.length > 48 && !t.startsWith("{") && !t.startsWith("["))
|
|
31
30
|
return t;
|
|
@@ -37,8 +36,8 @@ function G(e) {
|
|
|
37
36
|
}
|
|
38
37
|
return t || "";
|
|
39
38
|
}
|
|
40
|
-
function
|
|
41
|
-
const t =
|
|
39
|
+
function z(e) {
|
|
40
|
+
const t = U(e.result);
|
|
42
41
|
return {
|
|
43
42
|
id: e.result.call.id,
|
|
44
43
|
name: e.result.call.name,
|
|
@@ -51,7 +50,7 @@ function V(e) {
|
|
|
51
50
|
status: e.result.success ? "done" : "error"
|
|
52
51
|
};
|
|
53
52
|
}
|
|
54
|
-
function
|
|
53
|
+
function G(e) {
|
|
55
54
|
return {
|
|
56
55
|
id: e.call.id,
|
|
57
56
|
name: e.call.name,
|
|
@@ -60,7 +59,7 @@ function Q(e) {
|
|
|
60
59
|
status: "running"
|
|
61
60
|
};
|
|
62
61
|
}
|
|
63
|
-
function
|
|
62
|
+
function Q(e, t) {
|
|
64
63
|
const o = t.success ? "前端操作已执行。" : t.error || "前端操作执行失败。";
|
|
65
64
|
return {
|
|
66
65
|
id: e.id,
|
|
@@ -74,28 +73,28 @@ function Y(e, t) {
|
|
|
74
73
|
status: t.success ? "done" : "error"
|
|
75
74
|
};
|
|
76
75
|
}
|
|
77
|
-
function
|
|
76
|
+
function V(e) {
|
|
78
77
|
return e.startsWith("panel.") || e.startsWith("navigate.") || e.startsWith("session.");
|
|
79
78
|
}
|
|
80
|
-
function
|
|
81
|
-
if (!
|
|
79
|
+
function Y(e, t, o) {
|
|
80
|
+
if (!V(t.request.call.name)) return;
|
|
82
81
|
c(e, r.tool, "执行工具与回答");
|
|
83
|
-
const s =
|
|
82
|
+
const s = Q(t.request.call, o);
|
|
84
83
|
e.appendToolCallsToStep(r.tool, [s]), e.setStep(
|
|
85
84
|
r.tool,
|
|
86
85
|
o.success ? "done" : "error",
|
|
87
86
|
s.resultText
|
|
88
87
|
);
|
|
89
88
|
}
|
|
90
|
-
function
|
|
89
|
+
function d(e, t) {
|
|
91
90
|
if (t !== r.tool) return;
|
|
92
91
|
const o = e.getSteps().find((s) => s.id === t);
|
|
93
92
|
!o || o.status === "active" || o.status === "done" || e.setStep(t, "active", o.content);
|
|
94
93
|
}
|
|
95
|
-
function
|
|
94
|
+
function R(e, t) {
|
|
96
95
|
return t || (e === r.tool ? "执行工具与回答" : e);
|
|
97
96
|
}
|
|
98
|
-
async function
|
|
97
|
+
async function K(e, t) {
|
|
99
98
|
if (t.type !== "ping") {
|
|
100
99
|
if (t.type === "step_sync")
|
|
101
100
|
e.setSteps(
|
|
@@ -110,28 +109,28 @@ async function Z(e, t) {
|
|
|
110
109
|
c(e, t.stepId, t.label ?? t.stepId), e.setStep(t.stepId, t.status, t.content);
|
|
111
110
|
else if (t.type === "step_content") {
|
|
112
111
|
let o = t.stepId, s = t.content;
|
|
113
|
-
if (o === r.intent &&
|
|
112
|
+
if (o === r.intent && M(s))
|
|
114
113
|
o = r.tool;
|
|
115
114
|
else if (o === r.intent && t.mode === "replace") {
|
|
116
|
-
const { intent:
|
|
117
|
-
s =
|
|
115
|
+
const { intent: n, misplacedPlanning: l } = O(s);
|
|
116
|
+
s = n, l.trim() && (c(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
|
|
118
117
|
r.tool,
|
|
119
|
-
|
|
118
|
+
l
|
|
120
119
|
));
|
|
121
120
|
}
|
|
122
|
-
c(e, o,
|
|
121
|
+
c(e, o, R(o, t.label)), t.mode === "replace" ? e.setStep(
|
|
123
122
|
o,
|
|
124
|
-
e.getSteps().find((
|
|
123
|
+
e.getSteps().find((n) => n.id === o)?.status ?? "active",
|
|
125
124
|
s
|
|
126
|
-
) : (
|
|
125
|
+
) : (d(e, o), e.appendChunkToStep(o, s), await B());
|
|
127
126
|
} else if (t.type === "step_artifact")
|
|
128
|
-
c(e, t.stepId,
|
|
127
|
+
c(e, t.stepId, R(t.stepId, t.label)), d(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);
|
|
129
128
|
else if (t.type === "tool_start")
|
|
130
|
-
c(e, r.tool, "执行工具与回答"),
|
|
131
|
-
|
|
129
|
+
c(e, r.tool, "执行工具与回答"), d(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
130
|
+
G(t)
|
|
132
131
|
]);
|
|
133
132
|
else if (t.type === "tool_progress")
|
|
134
|
-
c(e, r.tool, "执行工具与回答"),
|
|
133
|
+
c(e, r.tool, "执行工具与回答"), d(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
135
134
|
{
|
|
136
135
|
id: t.call.id,
|
|
137
136
|
name: t.call.name,
|
|
@@ -142,8 +141,8 @@ async function Z(e, t) {
|
|
|
142
141
|
}
|
|
143
142
|
]);
|
|
144
143
|
else if (t.type === "tool_result")
|
|
145
|
-
c(e, r.tool, "执行工具与回答"),
|
|
146
|
-
|
|
144
|
+
c(e, r.tool, "执行工具与回答"), d(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
145
|
+
z(t)
|
|
147
146
|
]), t.result.attachments?.length && e.appendAttachmentsToStep(
|
|
148
147
|
r.tool,
|
|
149
148
|
t.result.attachments
|
|
@@ -176,23 +175,36 @@ async function Z(e, t) {
|
|
|
176
175
|
"done",
|
|
177
176
|
t.summary ?? "Memory 缓存命中,跳过 LLM 规划。"
|
|
178
177
|
));
|
|
179
|
-
else if (t.type === "
|
|
178
|
+
else if (t.type === "memory_decision") {
|
|
179
|
+
c(e, r.breakdown, "问题拆解");
|
|
180
|
+
const o = {
|
|
181
|
+
reuse: "已复用项目记忆",
|
|
182
|
+
augment: "正在结合历史项目结论",
|
|
183
|
+
refresh: "资料可能变化,正在重新验证",
|
|
184
|
+
ignore: "未发现可直接使用的项目记忆"
|
|
185
|
+
};
|
|
186
|
+
e.setStep(
|
|
187
|
+
r.breakdown,
|
|
188
|
+
t.decision.action === "reuse" ? "done" : "active",
|
|
189
|
+
o[t.decision.action]
|
|
190
|
+
);
|
|
191
|
+
} else if (t.type === "assistant_response") {
|
|
180
192
|
c(e, r.tool, "执行工具与回答");
|
|
181
|
-
const o = e.getSteps().find((
|
|
182
|
-
a &&
|
|
193
|
+
const o = e.getSteps().find((S) => S.id === r.tool), { planning: s, answer: n } = H(o?.content ?? ""), l = t.content.trim(), a = n.trim();
|
|
194
|
+
a && l && (a === l || l.startsWith(
|
|
183
195
|
a.slice(0, Math.min(a.length, 80))
|
|
184
196
|
)) ? e.setStep(r.tool, "done") : e.setStep(
|
|
185
197
|
r.tool,
|
|
186
198
|
"done",
|
|
187
|
-
q(s,
|
|
199
|
+
q(s, l)
|
|
188
200
|
);
|
|
189
201
|
}
|
|
190
|
-
|
|
202
|
+
j(t) && e.appendExecutionEvent?.(t);
|
|
191
203
|
}
|
|
192
204
|
}
|
|
193
|
-
async function
|
|
205
|
+
async function X(e) {
|
|
194
206
|
await fetch(
|
|
195
|
-
`${
|
|
207
|
+
`${T()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
|
|
196
208
|
{
|
|
197
209
|
method: "POST",
|
|
198
210
|
headers: y(),
|
|
@@ -208,147 +220,134 @@ async function v(e) {
|
|
|
208
220
|
}
|
|
209
221
|
);
|
|
210
222
|
}
|
|
211
|
-
function
|
|
223
|
+
function Z(e) {
|
|
212
224
|
const t = e.split(/\n\n/u), o = t.pop() ?? "";
|
|
213
|
-
return { events: t.flatMap((
|
|
214
|
-
const
|
|
215
|
-
if (!
|
|
225
|
+
return { events: t.flatMap((n) => {
|
|
226
|
+
const l = n.split(/\n/u).find((a) => a.startsWith("data: "));
|
|
227
|
+
if (!l) return [];
|
|
216
228
|
try {
|
|
217
|
-
return [JSON.parse(
|
|
229
|
+
return [JSON.parse(l.slice(6))];
|
|
218
230
|
} catch {
|
|
219
231
|
return [];
|
|
220
232
|
}
|
|
221
233
|
}), rest: o };
|
|
222
234
|
}
|
|
223
|
-
async function
|
|
235
|
+
async function dt(e) {
|
|
224
236
|
await Promise.allSettled([
|
|
225
|
-
_(
|
|
226
|
-
|
|
237
|
+
_(),
|
|
238
|
+
W(e)
|
|
227
239
|
]);
|
|
228
240
|
}
|
|
229
|
-
function
|
|
230
|
-
|
|
231
|
-
const { skills: o, ...s } = e;
|
|
232
|
-
return { ...s, ...t };
|
|
233
|
-
}
|
|
234
|
-
async function ot(e, t) {
|
|
235
|
-
const o = b(), s = O(), l = $(), n = await _(t), a = B(), u = a ? await a.connect({
|
|
236
|
-
sessionId: o.sessionId,
|
|
237
|
-
browserInstanceId: R("spotlight.browser-instance", localStorage),
|
|
238
|
-
tabInstanceId: R("spotlight.tab-instance", sessionStorage),
|
|
239
|
-
signal: t
|
|
240
|
-
}) : void 0;
|
|
241
|
+
async function v(e, t, o) {
|
|
242
|
+
const s = b(), n = $(), l = L(), a = await _();
|
|
241
243
|
return {
|
|
242
|
-
hostManifest:
|
|
243
|
-
payload:
|
|
244
|
-
projectId:
|
|
245
|
-
sessionId:
|
|
244
|
+
hostManifest: a,
|
|
245
|
+
payload: {
|
|
246
|
+
projectId: J(),
|
|
247
|
+
sessionId: s.sessionId,
|
|
246
248
|
userQuestion: e,
|
|
247
|
-
|
|
249
|
+
memoryRefreshRequested: o?.forceMemoryRefresh === !0,
|
|
250
|
+
uiContext: D().getUiContext?.() ?? {},
|
|
248
251
|
sessionState: {
|
|
249
|
-
sessionId:
|
|
250
|
-
activeTaskId:
|
|
251
|
-
activeTopic:
|
|
252
|
-
pendingTask:
|
|
253
|
-
conversationSummary:
|
|
254
|
-
summarizedTurnCount:
|
|
255
|
-
conversationHistory:
|
|
256
|
-
lastAssistantReply:
|
|
257
|
-
invokedSkills:
|
|
258
|
-
skillPermissionGrants:
|
|
252
|
+
sessionId: s.sessionId,
|
|
253
|
+
activeTaskId: s.activeTaskId,
|
|
254
|
+
activeTopic: s.activeTopic,
|
|
255
|
+
pendingTask: s.pendingTask,
|
|
256
|
+
conversationSummary: s.conversationSummary,
|
|
257
|
+
summarizedTurnCount: s.summarizedTurnCount,
|
|
258
|
+
conversationHistory: s.conversationHistory,
|
|
259
|
+
lastAssistantReply: s.getLastAssistantContent(),
|
|
260
|
+
invokedSkills: s.invokedSkills,
|
|
261
|
+
skillPermissionGrants: s.skillPermissionGrants,
|
|
259
262
|
memoryReadEnabled: l.enabled,
|
|
260
263
|
memoryWriteEnabled: !0
|
|
261
264
|
},
|
|
262
265
|
runtimeState: {
|
|
263
|
-
activeDomain:
|
|
264
|
-
activeTarget:
|
|
265
|
-
activeAction:
|
|
266
|
-
resumableAction:
|
|
267
|
-
lastResolvedTarget:
|
|
266
|
+
activeDomain: n.activeDomain,
|
|
267
|
+
activeTarget: n.activeTarget,
|
|
268
|
+
activeAction: n.activeAction,
|
|
269
|
+
resumableAction: n.resumableAction,
|
|
270
|
+
lastResolvedTarget: n.lastResolvedTarget
|
|
268
271
|
},
|
|
269
|
-
clientToolsManifestVersion:
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
272
|
+
clientToolsManifestVersion: a.manifestDigest,
|
|
273
|
+
clientToolManifest: a,
|
|
274
|
+
frontendBuildId: a.frontendBuildId,
|
|
275
|
+
manifestDigest: a.manifestDigest,
|
|
276
|
+
skills: E(A())
|
|
277
|
+
}
|
|
275
278
|
};
|
|
276
279
|
}
|
|
277
|
-
function
|
|
278
|
-
const
|
|
279
|
-
if (o) return o;
|
|
280
|
-
const s = A();
|
|
281
|
-
return t.setItem(e, s), s;
|
|
282
|
-
}
|
|
283
|
-
async function St(e, t) {
|
|
284
|
-
const o = g(), s = t.getSignal(), { payload: l, hostManifest: n } = await ot(
|
|
280
|
+
async function mt(e, t, o) {
|
|
281
|
+
const s = T(), n = t.getSignal(), { payload: l, hostManifest: a } = await v(
|
|
285
282
|
e,
|
|
286
|
-
|
|
287
|
-
|
|
283
|
+
n,
|
|
284
|
+
o
|
|
285
|
+
), S = new Set(a.tools.map((u) => u.name)), m = await fetch(`${s}/v1/runs`, {
|
|
288
286
|
method: "POST",
|
|
289
287
|
headers: y(),
|
|
290
288
|
body: JSON.stringify(l),
|
|
291
|
-
signal:
|
|
289
|
+
signal: n
|
|
292
290
|
});
|
|
293
|
-
if (!
|
|
294
|
-
const
|
|
291
|
+
if (!m.ok) {
|
|
292
|
+
const u = await m.text().catch(() => "");
|
|
295
293
|
throw new Error(
|
|
296
|
-
`Spotlight 后端创建 run 失败:${
|
|
294
|
+
`Spotlight 后端创建 run 失败:${m.status} ${u}`
|
|
297
295
|
);
|
|
298
296
|
}
|
|
299
|
-
const { runId:
|
|
300
|
-
|
|
297
|
+
const { runId: p } = await m.json();
|
|
298
|
+
n && (h.set(n, p), n.addEventListener(
|
|
301
299
|
"abort",
|
|
302
300
|
() => {
|
|
303
|
-
P(
|
|
301
|
+
P(p);
|
|
304
302
|
},
|
|
305
303
|
{ once: !0 }
|
|
306
304
|
));
|
|
307
305
|
const f = await fetch(
|
|
308
|
-
`${
|
|
306
|
+
`${s}/v1/runs/${encodeURIComponent(p)}/events`,
|
|
309
307
|
{
|
|
310
308
|
headers: y(),
|
|
311
|
-
signal:
|
|
309
|
+
signal: n
|
|
312
310
|
}
|
|
313
311
|
);
|
|
314
312
|
if (!f.ok || !f.body)
|
|
315
313
|
throw new Error(`Spotlight 后端事件流连接失败:${f.status}`);
|
|
316
|
-
const
|
|
317
|
-
let
|
|
314
|
+
const C = f.body.getReader(), N = new TextDecoder();
|
|
315
|
+
let g = "", I = null;
|
|
318
316
|
try {
|
|
319
317
|
for (; ; ) {
|
|
320
|
-
const { done:
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
for (const i of
|
|
318
|
+
const { done: u, value: x } = await C.read();
|
|
319
|
+
if (u) break;
|
|
320
|
+
g += N.decode(x, { stream: !0 });
|
|
321
|
+
const k = Z(g);
|
|
322
|
+
g = k.rest;
|
|
323
|
+
for (const i of k.events) {
|
|
326
324
|
if (i.type === "host_action_request") {
|
|
327
|
-
const
|
|
328
|
-
allowedHostNames:
|
|
325
|
+
const w = await F(i.request.call, t, {
|
|
326
|
+
allowedHostNames: S,
|
|
329
327
|
hostEffect: i.request.hostEffect
|
|
330
328
|
});
|
|
331
|
-
|
|
332
|
-
runId:
|
|
329
|
+
Y(t, i, w), await X({
|
|
330
|
+
runId: p,
|
|
333
331
|
correlationId: i.request.correlationId,
|
|
334
|
-
result:
|
|
335
|
-
signal:
|
|
332
|
+
result: w,
|
|
333
|
+
signal: n
|
|
336
334
|
});
|
|
337
335
|
continue;
|
|
338
336
|
}
|
|
339
337
|
if (i.type === "run_error")
|
|
340
338
|
throw new Error(i.error);
|
|
341
|
-
if (await
|
|
339
|
+
if (await K(t, i), i.type === "run_completed")
|
|
342
340
|
return i.sessionPatch && b().applySessionPatch(i.sessionPatch), I = i, {
|
|
343
341
|
command: null,
|
|
344
342
|
usedLegacyFallback: i.usedQueryLoop,
|
|
345
343
|
memoryReplay: i.memoryReplay ?? null,
|
|
344
|
+
memoryDecision: i.memoryDecision ?? null,
|
|
346
345
|
assistantReply: i.assistantReply
|
|
347
346
|
};
|
|
348
347
|
}
|
|
349
348
|
}
|
|
350
349
|
} finally {
|
|
351
|
-
|
|
350
|
+
C.releaseLock();
|
|
352
351
|
}
|
|
353
352
|
return {
|
|
354
353
|
command: null,
|
|
@@ -357,22 +356,21 @@ async function St(e, t) {
|
|
|
357
356
|
}
|
|
358
357
|
async function P(e) {
|
|
359
358
|
await fetch(
|
|
360
|
-
`${
|
|
359
|
+
`${T()}/v1/runs/${encodeURIComponent(e)}`,
|
|
361
360
|
{
|
|
362
361
|
method: "DELETE",
|
|
363
362
|
headers: y()
|
|
364
363
|
}
|
|
365
364
|
);
|
|
366
365
|
}
|
|
367
|
-
function
|
|
366
|
+
function pt(e) {
|
|
368
367
|
if (!e) return;
|
|
369
368
|
const t = h.get(e);
|
|
370
369
|
t && (h.delete(e), P(t));
|
|
371
370
|
}
|
|
372
371
|
export {
|
|
373
372
|
P as cancelRemoteSpotlightRun,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
yt as warmupSpotlightRemoteContext
|
|
373
|
+
pt as cancelRemoteSpotlightRunForSignal,
|
|
374
|
+
mt as runRemoteSpotlightPipeline,
|
|
375
|
+
dt as warmupSpotlightRemoteContext
|
|
378
376
|
};
|
package/dist/remote/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SpotlightMemoryDecision } from "@inupedia/spotlight-protocol";
|
|
1
2
|
import type { SpotlightCommand } from "../store/types.js";
|
|
2
3
|
export type SpotlightPipelineRunOutcome = {
|
|
3
4
|
command: SpotlightCommand | null;
|
|
@@ -8,5 +9,6 @@ export type SpotlightPipelineRunOutcome = {
|
|
|
8
9
|
entryId: string;
|
|
9
10
|
kind: string;
|
|
10
11
|
} | null;
|
|
12
|
+
memoryDecision?: SpotlightMemoryDecision | null;
|
|
11
13
|
};
|
|
12
14
|
//# 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;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,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;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/remote/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,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,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,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;IACT,cAAc,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACjD,CAAC"}
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
if (
|
|
4
|
-
return
|
|
5
|
-
}
|
|
6
|
-
function n(r, o, i) {
|
|
7
|
-
const t = o.find((e) => e.name === r);
|
|
8
|
-
if (t) {
|
|
9
|
-
if (t.skillRoot)
|
|
10
|
-
return t.skillRoot.startsWith("/") ? t.skillRoot : `${i.replace(/\/$/, "")}/${t.skillRoot.replace(/^\.\//, "")}`;
|
|
11
|
-
if (t.sourcePath) {
|
|
12
|
-
const e = l(t.sourcePath);
|
|
13
|
-
if (e)
|
|
14
|
-
return e.startsWith("/") ? e : `${i.replace(/\/$/, "")}/${e.replace(/^\.\//, "")}`;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
function n(r) {
|
|
2
|
+
const e = r.replace(/\\/g, "/");
|
|
3
|
+
if (e.endsWith("/SKILL.md"))
|
|
4
|
+
return e.slice(0, -9);
|
|
17
5
|
}
|
|
18
6
|
export {
|
|
19
|
-
|
|
20
|
-
n as resolveSkillRoot
|
|
7
|
+
n as inferSkillRootFromSourcePath
|
|
21
8
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryPreferenceCopy.d.ts","sourceRoot":"","sources":["../../src/store/memoryPreferenceCopy.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,6BAAS,CAAC;AAKxD,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAaA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const r = "使用记忆", e = "关闭后不参考历史记忆,但仍允许系统积累项目知识。";
|
|
2
|
+
function E(t) {
|
|
3
|
+
return t ? {
|
|
4
|
+
ariaLabel: `使用记忆已开启。点击关闭;${e}`,
|
|
5
|
+
title: `已开启:回答会参考历史记忆。${e}`
|
|
6
|
+
} : {
|
|
7
|
+
ariaLabel: "使用记忆已关闭。点击开启;当前不参考历史记忆,但仍允许系统积累项目知识。",
|
|
8
|
+
title: "已关闭:回答不参考历史记忆,但仍允许系统积累项目知识。"
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
r as SPOTLIGHT_MEMORY_PREFERENCE_LABEL,
|
|
13
|
+
E as getSpotlightMemoryPreferenceCopy
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryResultCopy.d.ts","sourceRoot":"","sources":["../../src/store/memoryResultCopy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3E,wBAAgB,4BAA4B,CAC1C,MAAM,CAAC,EAAE,2BAA2B,GACnC;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAYA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function i(t) {
|
|
2
|
+
return t === "semantic" ? {
|
|
3
|
+
heading: "找到了高度相关的历史答案",
|
|
4
|
+
description: "问题语义与项目内已有问答高度相似,Spotlight 已直接复用该结论。"
|
|
5
|
+
} : {
|
|
6
|
+
heading: "找到了相同问题的历史答案",
|
|
7
|
+
description: "该问题与项目内已有问答一致,Spotlight 已直接复用该结论。"
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
i as getSpotlightMemoryResultCopy
|
|
12
|
+
};
|