@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.
@@ -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;;;;EAyCtE"}
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 n } from "vue";
1
+ import { computed as u } from "vue";
2
2
  function t(e) {
3
- const u = e.voiceKeyLabel ?? "`", r = n(() => e.pipelinePhase.value === "error" ? "error" : e.loading.value || e.pipelinePhase.value === "running" ? "running" : e.pipelinePhase.value === "done" ? "done" : "idle"), i = n(() => e.voiceHoldActive?.value ? `正在录音,松开 ${u} 结束并转写…` : e.speechPending?.value ? "语音识别中,请稍候…" : r.value === "running" ? "Agent 正在分析场景、路由工具和上下文…" : r.value === "done" ? "继续追问,或者换个角度继续盘它…" : r.value === "error" ? "刚才那轮跑岔了,换个问法再试试…" : "输入问题或从下方选择历史…"), l = n(() => e.voiceHoldActive?.value ? "语音录制中" : e.speechPending?.value ? "语音识别中" : r.value === "running" ? "Agent 执行中" : r.value === "done" ? "已完成" : r.value === "error" ? "执行异常" : "等待提问");
4
- return { uiState: r, placeholder: i, badgeLabel: l };
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";
@@ -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,EAAE,sBAAsB,EAAE,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,+BAA+B,GAC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"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 N } from "@inupedia/spotlight-client";
2
- import { TOOL_NAMES as b } from "../constants/toolNames.js";
3
- import { getSkillsPoolForRun as x } from "../skills/index.js";
4
- import { useAgentSessionStore as w } from "../session/agentSession.js";
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 O, splitIntentStepContent as $, splitToolStepContent as H, composeToolStepContent as L } from "../store/pipeline/displayText.js";
8
- import { getSpotlightHostAdapter as A, getSpotlightConfig as q } from "../plugin.js";
9
- import { executeRemoteHostTool as F, ensureHostToolsManifest as I } from "./hostToolRunner.js";
10
- import { getSpotlightServerBase as g, buildSpotlightJsonHeaders as m, getSpotlightProjectId as J } from "./httpConfig.js";
11
- import { ensureSpotlightMeta as W } from "./meta.js";
12
- const y = /* @__PURE__ */ new WeakMap();
13
- function D(t) {
14
- return t.type !== "host_action_request" && t.type !== "run_completed" && t.type !== "run_error" && t.type !== "ping";
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(t, e, o) {
17
- const s = t.getSteps().find((i) => i.id === e);
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: e, label: o, status: "pending" };
20
- return t.setSteps([...t.getSteps(), n]), n;
18
+ const n = { id: t, label: o, status: "pending" };
19
+ return e.setSteps([...e.getSteps(), n]), n;
21
20
  }
22
- function M() {
23
- return new Promise((t) => {
24
- requestAnimationFrame(() => t());
21
+ function D() {
22
+ return new Promise((e) => {
23
+ requestAnimationFrame(() => e());
25
24
  });
26
25
  }
27
- function j(t) {
28
- const e = t.summary?.trim();
29
- if (e && e.length > 48 && !e.startsWith("{") && !e.startsWith("["))
30
- return e;
31
- if (t.output != null && typeof t.output == "object")
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(t.output, null, 2);
32
+ const o = JSON.stringify(e.output, null, 2);
34
33
  if (o && o !== "{}") return o;
35
34
  } catch {
36
35
  }
37
- return e || "";
36
+ return t || "";
38
37
  }
39
- function U(t) {
40
- const e = j(t.result);
38
+ function U(e) {
39
+ const t = j(e.result);
41
40
  return {
42
- id: t.result.call.id,
43
- name: t.result.call.name,
44
- displayName: t.result.call.displayName,
45
- argsText: JSON.stringify(t.result.call.input ?? {}, null, 2),
46
- resultText: e,
47
- summary: t.result.summary,
48
- errorCode: t.result.errorCode,
49
- trace: t.result.trace,
50
- status: t.result.success ? "done" : "error"
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(t) {
52
+ function z(e) {
54
53
  return {
55
- id: t.call.id,
56
- name: t.call.name,
57
- displayName: t.call.displayName,
58
- argsText: JSON.stringify(t.call.input ?? {}, null, 2),
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(t, e) {
63
- const o = e.success ? "前端操作已执行。" : e.error || "前端操作执行失败。";
61
+ function G(e, t) {
62
+ const o = t.success ? "前端操作已执行。" : t.error || "前端操作执行失败。";
64
63
  return {
65
- id: t.id,
66
- name: t.name,
67
- displayName: t.displayName,
68
- argsText: JSON.stringify(t.input ?? {}, null, 2),
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: e.errorCode,
72
- trace: e.trace,
73
- status: e.success ? "done" : "error"
70
+ errorCode: t.errorCode,
71
+ trace: t.trace,
72
+ status: t.success ? "done" : "error"
74
73
  };
75
74
  }
76
- function B(t) {
77
- return t.startsWith("panel.") || t.startsWith("navigate.") || t.startsWith("session.");
75
+ function B(e) {
76
+ return e.startsWith("panel.") || e.startsWith("navigate.") || e.startsWith("session.");
78
77
  }
79
- function Q(t, e, o) {
80
- if (!B(e.request.call.name)) return;
81
- a(t, r.tool, "执行工具与回答");
82
- const s = G(e.request.call, o);
83
- t.appendToolCallsToStep(r.tool, [s]), t.setStep(
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
- async function Y(t, e) {
90
- if (e.type !== "ping") {
91
- if (e.type === "step_sync")
92
- t.setSteps(
93
- e.steps.map((o) => ({
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: t.getSteps().find((s) => s.id === o.id)?.content
104
+ content: e.getSteps().find((s) => s.id === o.id)?.content
98
105
  }))
99
106
  );
100
- else if (e.type === "step_status")
101
- a(t, e.stepId, e.label ?? e.stepId), t.setStep(e.stepId, e.status, e.content);
102
- else if (e.type === "step_content") {
103
- let o = e.stepId, s = e.content;
104
- if (o === r.intent && O(s))
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 && e.mode === "replace") {
107
- const { intent: n, misplacedPlanning: i } = $(s);
108
- s = n, i.trim() && (a(t, r.tool, "执行工具与回答"), t.appendChunkToStep(
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
- i
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.label ?? (o === r.tool ? "执行工具与回答" : o)
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
- ) : (t.appendChunkToStep(o, s), await M());
122
- } else if (e.type === "tool_start")
123
- a(t, r.tool, "执行工具与回答"), t.appendToolCallsToStep(r.tool, [
124
- z(e)
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 (e.type === "tool_progress")
127
- a(t, r.tool, "执行工具与回答"), t.appendToolCallsToStep(r.tool, [
131
+ else if (t.type === "tool_progress")
132
+ a(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
128
133
  {
129
- id: e.call.id,
130
- name: e.call.name,
131
- displayName: e.call.displayName,
132
- argsText: JSON.stringify(e.call.input ?? {}, null, 2),
133
- summary: e.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 (e.type === "tool_result")
138
- a(t, r.tool, "执行工具与回答"), t.appendToolCallsToStep(r.tool, [
139
- U(e)
140
- ]), e.result.attachments?.length && t.appendAttachmentsToStep(
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
- e.result.attachments
143
- ), e.result.files?.length && t.appendFilesToStep(
147
+ t.result.attachments
148
+ ), t.result.files?.length && e.appendFilesToStep(
144
149
  r.tool,
145
- e.result.files
146
- ), e.result.toolCalls?.length && e.result.call.name !== b.knowledge.answer && t.appendToolCallsToStep(
150
+ t.result.files
151
+ ), t.result.toolCalls?.length && e.appendToolCallsToStep(
147
152
  r.tool,
148
- e.result.toolCalls
153
+ t.result.toolCalls
149
154
  );
150
- else if (e.type === "skill_permission_request") {
155
+ else if (t.type === "skill_permission_request") {
151
156
  const { useSpotlightStore: o } = await import("../store/spotlightStore.js");
152
157
  o().setPendingSkillPermission({
153
- skillName: e.skillName,
154
- displayName: e.displayName,
155
- reason: e.reason,
156
- source: e.source,
157
- at: e.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 (e.type === "fork_progress")
160
- a(t, r.tool, "执行工具与回答"), t.appendChunkToStep(
164
+ } else if (t.type === "fork_progress")
165
+ a(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
161
166
  r.tool,
162
167
  `
163
- [fork ${e.agentId}] 第 ${e.iteration} 轮 · ${e.phase}:${e.summary}
168
+ [fork ${t.agentId}] 第 ${t.iteration} 轮 · ${t.phase}:${t.summary}
164
169
  `
165
170
  );
166
- else if (e.type === "assistant_response") {
167
- a(t, r.tool, "执行工具与回答");
168
- const o = t.getSteps().find((n) => n.id === r.tool), { planning: s } = H(o?.content ?? "");
169
- t.setStep(
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
- L(s, e.content)
185
+ H(s, l)
173
186
  );
174
187
  }
175
- D(e) && t.appendExecutionEvent?.(e);
188
+ W(t) && e.appendExecutionEvent?.(t);
176
189
  }
177
190
  }
178
- async function K(t) {
191
+ async function Y(e) {
179
192
  await fetch(
180
- `${g()}/v1/runs/${encodeURIComponent(t.runId)}/host-results`,
193
+ `${h()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
181
194
  {
182
195
  method: "POST",
183
- headers: m(),
196
+ headers: S(),
184
197
  body: JSON.stringify({
185
- correlationId: t.correlationId,
186
- success: t.result.success,
187
- output: t.result.data,
188
- error: t.result.error,
189
- errorCode: t.result.errorCode,
190
- trace: t.result.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: t.signal
205
+ signal: e.signal
193
206
  }
194
207
  );
195
208
  }
196
- function V(t) {
197
- const e = t.split(/\n\n/u), o = e.pop() ?? "";
198
- return { events: e.flatMap((n) => {
199
- const i = n.split(/\n/u).find((f) => f.startsWith("data: "));
200
- if (!i) return [];
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(i.slice(6))];
215
+ return [JSON.parse(l.slice(6))];
203
216
  } catch {
204
217
  return [];
205
218
  }
206
219
  }), rest: o };
207
220
  }
208
- async function ut(t) {
221
+ async function at(e) {
209
222
  await Promise.allSettled([
210
- I(t),
211
- W(t)
223
+ _(e),
224
+ J(e)
212
225
  ]);
213
226
  }
214
- async function X(t, e) {
215
- const o = w(), s = E(), n = await I(e), i = A().getClientToolDescriptors();
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: J(),
232
+ projectId: q(),
221
233
  sessionId: o.sessionId,
222
- userQuestion: t,
223
- uiContext: q().getUiContext?.() ?? {},
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
- // Prefer the host's actually registered tools so server allowlist matches
244
- // what executeHostTool can run locally (avoids manifest-version skew).
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(t, e) {
251
- const o = g(), s = e.getSignal(), { payload: n, localClientTools: i } = await X(
252
- t,
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
- ), f = new Set(i.map((u) => u.name)), c = await fetch(`${o}/v1/runs`, {
264
+ ), c = new Set(l.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
255
265
  method: "POST",
256
- headers: m(),
266
+ headers: S(),
257
267
  body: JSON.stringify(n),
258
268
  signal: s
259
269
  });
260
- if (!c.ok) {
261
- const u = await c.text().catch(() => "");
270
+ if (!u.ok) {
271
+ const d = await u.text().catch(() => "");
262
272
  throw new Error(
263
- `Spotlight 后端创建 run 失败:${c.status} ${u}`
273
+ `Spotlight 后端创建 run 失败:${u.status} ${d}`
264
274
  );
265
275
  }
266
- const { runId: d } = await c.json();
267
- s && (y.set(s, d), s.addEventListener(
276
+ const { runId: m } = await u.json();
277
+ s && (g.set(s, m), s.addEventListener(
268
278
  "abort",
269
279
  () => {
270
- R(d);
280
+ b(m);
271
281
  },
272
282
  { once: !0 }
273
283
  ));
274
- const p = await fetch(
275
- `${o}/v1/runs/${encodeURIComponent(d)}/events`,
284
+ const f = await fetch(
285
+ `${o}/v1/runs/${encodeURIComponent(m)}/events`,
276
286
  {
277
- headers: m(),
287
+ headers: S(),
278
288
  signal: s
279
289
  }
280
290
  );
281
- if (!p.ok || !p.body)
282
- throw new Error(`Spotlight 后端事件流连接失败:${p.status}`);
283
- const h = p.body.getReader(), P = new TextDecoder();
284
- let S = "", T = null;
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: u, value: _ } = await h.read();
288
- if (u) break;
289
- S += P.decode(_, { stream: !0 });
290
- const k = V(S);
291
- S = k.rest;
292
- for (const l of k.events) {
293
- if (l.type === "host_action_request") {
294
- const C = await F(l.request.call, e, {
295
- allowedHostNames: f,
296
- hostEffect: l.request.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(e, l, C), await K({
299
- runId: d,
300
- correlationId: l.request.correlationId,
301
- result: C,
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 (l.type === "run_error")
307
- throw new Error(l.error);
308
- if (await Y(e, l), l.type === "run_completed")
309
- return l.sessionPatch?.invokedSkills && w().setInvokedSkills(
310
- l.sessionPatch.invokedSkills
311
- ), T = l, {
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: l.usedQueryLoop
323
+ usedLegacyFallback: i.usedQueryLoop,
324
+ memoryReplay: i.memoryReplay ?? null
314
325
  };
315
326
  }
316
327
  }
317
328
  } finally {
318
- h.releaseLock();
329
+ T.releaseLock();
319
330
  }
320
331
  return {
321
332
  command: null,
322
- usedLegacyFallback: T?.usedQueryLoop ?? !0
333
+ usedLegacyFallback: k?.usedQueryLoop ?? !0
323
334
  };
324
335
  }
325
- async function R(t) {
336
+ async function b(e) {
326
337
  await fetch(
327
- `${g()}/v1/runs/${encodeURIComponent(t)}`,
338
+ `${h()}/v1/runs/${encodeURIComponent(e)}`,
328
339
  {
329
340
  method: "DELETE",
330
- headers: m()
341
+ headers: S()
331
342
  }
332
343
  );
333
344
  }
334
- function dt(t) {
335
- if (!t) return;
336
- const e = y.get(t);
337
- e && (y.delete(t), R(e));
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
- R as cancelRemoteSpotlightRun,
341
- dt as cancelRemoteSpotlightRunForSignal,
351
+ b as cancelRemoteSpotlightRun,
352
+ ut as cancelRemoteSpotlightRunForSignal,
342
353
  ct as runRemoteSpotlightPipeline,
343
- ut as warmupSpotlightRemoteContext
354
+ at as warmupSpotlightRemoteContext
344
355
  };
@@ -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;CAC7B,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"}