@inupedia/spotlight-vue 0.2.13 → 0.2.15

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.
@@ -1,8 +1,13 @@
1
1
  import { computed as u } from "vue";
2
- function t(e) {
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" ? "执行异常" : "等待提问");
2
+ function v(e) {
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.memoryDecision?.value ? {
4
+ reuse: "已复用项目记忆",
5
+ augment: "已结合项目记忆",
6
+ refresh: "已重新验证资料",
7
+ ignore: "已完成"
8
+ }[e.memoryDecision.value.action] : e.memoryReplay?.value ? e.memoryReplay.value.source === "semantic" ? "语义缓存命中" : "Memory 缓存命中" : "已完成" : r.value === "error" ? "执行异常" : "等待提问");
4
9
  return { uiState: r, placeholder: l, badgeLabel: a };
5
10
  }
6
11
  export {
7
- t as useSpotlightPanelUi
12
+ v as useSpotlightPanelUi
8
13
  };
@@ -1,7 +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 runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi): Promise<SpotlightPipelineRunOutcome>;
4
+ export declare function runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi, options?: {
5
+ forceMemoryRefresh?: boolean;
6
+ }): Promise<SpotlightPipelineRunOutcome>;
5
7
  export declare function cancelRemoteSpotlightRun(runId: string): Promise<void>;
6
8
  export declare function cancelRemoteSpotlightRunForSignal(signal?: AbortSignal): void;
7
9
  //# sourceMappingURL=runPipeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAmb9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAyCD,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,2BAA2B,CAAC,CA+FtC;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,MAAM,iBAQ3D;AAED,wBAAgB,iCAAiC,CAAC,MAAM,CAAC,EAAE,WAAW,QAMrE"}
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;AA8CD,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,30 +1,30 @@
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 { useSpotlightMemoryPreferenceStore as A } from "../store/memoryPreferenceStore.js";
5
- import { useSpotlightRuntimeStore as L } from "../store/runtimeStore.js";
1
+ import { serializeSkillsForRemote as E } from "@inupedia/spotlight-client";
2
+ import { getSkillsPoolForRun as A } from "../skills/index.js";
3
+ import { useAgentSessionStore as b } from "../session/agentSession.js";
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 $, splitIntentStepContent as O, splitToolStepContent as H, composeToolStepContent as M } from "../store/pipeline/displayText.js";
7
+ import { isLoopPlanningChunk as O, splitIntentStepContent as H, splitToolStepContent as M, composeToolStepContent as q } from "../store/pipeline/displayText.js";
8
8
  import { getSpotlightConfig as F } from "../plugin.js";
9
- import { executeRemoteHostTool as q, ensureHostToolsManifest as b } from "./hostToolRunner.js";
10
- import { getSpotlightServerBase as g, buildSpotlightJsonHeaders as y, getSpotlightProjectId as J } from "./httpConfig.js";
11
- import { ensureSpotlightMeta as W } from "./meta.js";
12
- const h = /* @__PURE__ */ new WeakMap();
13
- function D(e) {
14
- return e.type !== "host_action_request" && e.type !== "run_completed" && e.type !== "run_error" && e.type !== "ping";
9
+ import { executeRemoteHostTool as J, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
10
+ import { getSpotlightServerBase as T, buildSpotlightJsonHeaders as y, getSpotlightProjectId as W } from "./httpConfig.js";
11
+ import { ensureSpotlightMeta as D } from "./meta.js";
12
+ const g = /* @__PURE__ */ new WeakMap();
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";
15
15
  }
16
- function i(e, t, o) {
17
- const s = e.getSteps().find((n) => n.id === t);
16
+ function a(e, t, o) {
17
+ const s = e.getSteps().find((l) => l.id === t);
18
18
  if (s) return s;
19
- const a = { id: t, label: o, status: "pending" };
20
- return e.setSteps([...e.getSteps(), a]), a;
19
+ const n = { id: t, label: o, status: "pending" };
20
+ return e.setSteps([...e.getSteps(), n]), n;
21
21
  }
22
- function j() {
22
+ function U() {
23
23
  return new Promise((e) => {
24
24
  requestAnimationFrame(() => e());
25
25
  });
26
26
  }
27
- function U(e) {
27
+ function z(e) {
28
28
  const t = e.summary?.trim();
29
29
  if (t && t.length > 48 && !t.startsWith("{") && !t.startsWith("["))
30
30
  return t;
@@ -36,8 +36,8 @@ function U(e) {
36
36
  }
37
37
  return t || "";
38
38
  }
39
- function z(e) {
40
- const t = U(e.result);
39
+ function G(e) {
40
+ const t = z(e.result);
41
41
  return {
42
42
  id: e.result.call.id,
43
43
  name: e.result.call.name,
@@ -50,7 +50,7 @@ function z(e) {
50
50
  status: e.result.success ? "done" : "error"
51
51
  };
52
52
  }
53
- function G(e) {
53
+ function B(e) {
54
54
  return {
55
55
  id: e.call.id,
56
56
  name: e.call.name,
@@ -59,7 +59,7 @@ function G(e) {
59
59
  status: "running"
60
60
  };
61
61
  }
62
- function B(e, t) {
62
+ function Q(e, t) {
63
63
  const o = t.success ? "前端操作已执行。" : t.error || "前端操作执行失败。";
64
64
  return {
65
65
  id: e.id,
@@ -73,28 +73,28 @@ function B(e, t) {
73
73
  status: t.success ? "done" : "error"
74
74
  };
75
75
  }
76
- function Q(e) {
76
+ function V(e) {
77
77
  return e.startsWith("panel.") || e.startsWith("navigate.") || e.startsWith("session.");
78
78
  }
79
- function V(e, t, o) {
80
- if (!Q(t.request.call.name)) return;
81
- i(e, r.tool, "执行工具与回答");
82
- const s = B(t.request.call, o);
79
+ function Y(e, t, o) {
80
+ if (!V(t.request.call.name)) return;
81
+ a(e, r.tool, "执行工具与回答");
82
+ const s = Q(t.request.call, o);
83
83
  e.appendToolCallsToStep(r.tool, [s]), e.setStep(
84
84
  r.tool,
85
85
  o.success ? "done" : "error",
86
86
  s.resultText
87
87
  );
88
88
  }
89
- function p(e, t) {
89
+ function d(e, t) {
90
90
  if (t !== r.tool) return;
91
91
  const o = e.getSteps().find((s) => s.id === t);
92
92
  !o || o.status === "active" || o.status === "done" || e.setStep(t, "active", o.content);
93
93
  }
94
- function w(e, t) {
94
+ function R(e, t) {
95
95
  return t || (e === r.tool ? "执行工具与回答" : e);
96
96
  }
97
- async function Y(e, t) {
97
+ async function K(e, t) {
98
98
  if (t.type !== "ping") {
99
99
  if (t.type === "step_sync")
100
100
  e.setSteps(
@@ -106,31 +106,31 @@ async function Y(e, t) {
106
106
  }))
107
107
  );
108
108
  else if (t.type === "step_status")
109
- i(e, t.stepId, t.label ?? t.stepId), e.setStep(t.stepId, t.status, t.content);
109
+ a(e, t.stepId, t.label ?? t.stepId), e.setStep(t.stepId, t.status, t.content);
110
110
  else if (t.type === "step_content") {
111
111
  let o = t.stepId, s = t.content;
112
- if (o === r.intent && $(s))
112
+ if (o === r.intent && O(s))
113
113
  o = r.tool;
114
114
  else if (o === r.intent && t.mode === "replace") {
115
- const { intent: a, misplacedPlanning: n } = O(s);
116
- s = a, n.trim() && (i(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
115
+ const { intent: n, misplacedPlanning: l } = H(s);
116
+ s = n, l.trim() && (a(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
117
117
  r.tool,
118
- n
118
+ l
119
119
  ));
120
120
  }
121
- i(e, o, w(o, t.label)), t.mode === "replace" ? e.setStep(
121
+ a(e, o, R(o, t.label)), t.mode === "replace" ? e.setStep(
122
122
  o,
123
- e.getSteps().find((a) => a.id === o)?.status ?? "active",
123
+ e.getSteps().find((n) => n.id === o)?.status ?? "active",
124
124
  s
125
- ) : (p(e, o), e.appendChunkToStep(o, s), await j());
125
+ ) : (d(e, o), e.appendChunkToStep(o, s), await U());
126
126
  } else if (t.type === "step_artifact")
127
- i(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
+ a(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);
128
128
  else if (t.type === "tool_start")
129
- i(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
130
- G(t)
129
+ a(e, r.tool, "执行工具与回答"), d(e, r.tool), e.appendToolCallsToStep(r.tool, [
130
+ B(t)
131
131
  ]);
132
132
  else if (t.type === "tool_progress")
133
- i(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
133
+ a(e, r.tool, "执行工具与回答"), d(e, r.tool), e.appendToolCallsToStep(r.tool, [
134
134
  {
135
135
  id: t.call.id,
136
136
  name: t.call.name,
@@ -141,8 +141,8 @@ async function Y(e, t) {
141
141
  }
142
142
  ]);
143
143
  else if (t.type === "tool_result")
144
- i(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
145
- z(t)
144
+ a(e, r.tool, "执行工具与回答"), d(e, r.tool), e.appendToolCallsToStep(r.tool, [
145
+ G(t)
146
146
  ]), t.result.attachments?.length && e.appendAttachmentsToStep(
147
147
  r.tool,
148
148
  t.result.attachments
@@ -163,35 +163,48 @@ async function Y(e, t) {
163
163
  at: t.at
164
164
  });
165
165
  } else if (t.type === "fork_progress")
166
- i(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
166
+ a(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
167
167
  r.tool,
168
168
  `
169
169
  [fork ${t.agentId}] 第 ${t.iteration} 轮 · ${t.phase}:${t.summary}
170
170
  `
171
171
  );
172
172
  else if (t.type === "turn_transition")
173
- t.phase === "memory_replay" && (i(e, r.breakdown, "问题拆解"), e.setStep(
173
+ t.phase === "memory_replay" && (a(e, r.breakdown, "问题拆解"), e.setStep(
174
174
  r.breakdown,
175
175
  "done",
176
176
  t.summary ?? "Memory 缓存命中,跳过 LLM 规划。"
177
177
  ));
178
- else if (t.type === "assistant_response") {
179
- i(e, r.tool, "执行工具与回答");
180
- const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: a } = H(o?.content ?? ""), n = t.content.trim(), c = a.trim();
181
- c && n && (c === n || n.startsWith(
178
+ else if (t.type === "memory_decision") {
179
+ a(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") {
192
+ a(e, r.tool, "执行工具与回答");
193
+ const o = e.getSteps().find((S) => S.id === r.tool), { planning: s, answer: n } = M(o?.content ?? ""), l = t.content.trim(), c = n.trim();
194
+ c && l && (c === l || l.startsWith(
182
195
  c.slice(0, Math.min(c.length, 80))
183
196
  )) ? e.setStep(r.tool, "done") : e.setStep(
184
197
  r.tool,
185
198
  "done",
186
- M(s, n)
199
+ q(s, l)
187
200
  );
188
201
  }
189
- D(t) && e.appendExecutionEvent?.(t);
202
+ j(t) && e.appendExecutionEvent?.(t);
190
203
  }
191
204
  }
192
- async function K(e) {
205
+ async function X(e) {
193
206
  await fetch(
194
- `${g()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
207
+ `${T()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
195
208
  {
196
209
  method: "POST",
197
210
  headers: y(),
@@ -207,151 +220,154 @@ async function K(e) {
207
220
  }
208
221
  );
209
222
  }
210
- function X(e) {
223
+ function Z(e) {
211
224
  const t = e.split(/\n\n/u), o = t.pop() ?? "";
212
- return { events: t.flatMap((a) => {
213
- const n = a.split(/\n/u).find((c) => c.startsWith("data: "));
214
- if (!n) return [];
225
+ return { events: t.flatMap((n) => {
226
+ const l = n.split(/\n/u).find((c) => c.startsWith("data: "));
227
+ if (!l) return [];
215
228
  try {
216
- return [JSON.parse(n.slice(6))];
229
+ return [JSON.parse(l.slice(6))];
217
230
  } catch {
218
231
  return [];
219
232
  }
220
233
  }), rest: o };
221
234
  }
222
- async function ut(e) {
235
+ async function dt(e) {
223
236
  await Promise.allSettled([
224
- b(e),
225
- W(e)
237
+ _(e),
238
+ D(e)
226
239
  ]);
227
240
  }
228
- async function Z(e, t) {
229
- const o = R(), s = L(), a = A(), n = await b(t);
241
+ async function v(e, t, o) {
242
+ const s = b(), n = $(), l = L(), c = await _(t);
230
243
  return {
231
- hostManifest: n,
244
+ hostManifest: c,
232
245
  payload: {
233
- projectId: J(),
234
- sessionId: o.sessionId,
246
+ projectId: W(),
247
+ sessionId: s.sessionId,
235
248
  userQuestion: e,
249
+ memoryRefreshRequested: o?.forceMemoryRefresh === !0,
236
250
  uiContext: F().getUiContext?.() ?? {},
237
251
  sessionState: {
238
- sessionId: o.sessionId,
239
- activeTaskId: o.activeTaskId,
240
- activeTopic: o.activeTopic,
241
- pendingTask: o.pendingTask,
242
- conversationSummary: o.conversationSummary,
243
- summarizedTurnCount: o.summarizedTurnCount,
244
- conversationHistory: o.conversationHistory,
245
- lastAssistantReply: o.getLastAssistantContent(),
246
- invokedSkills: o.invokedSkills,
247
- skillPermissionGrants: o.skillPermissionGrants,
248
- memoryReadEnabled: a.enabled,
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,
262
+ memoryReadEnabled: l.enabled,
249
263
  memoryWriteEnabled: !0
250
264
  },
251
265
  runtimeState: {
252
- activeDomain: s.activeDomain,
253
- activeTarget: s.activeTarget,
254
- activeAction: s.activeAction,
255
- resumableAction: s.resumableAction,
256
- lastResolvedTarget: s.lastResolvedTarget
266
+ activeDomain: n.activeDomain,
267
+ activeTarget: n.activeTarget,
268
+ activeAction: n.activeAction,
269
+ resumableAction: n.resumableAction,
270
+ lastResolvedTarget: n.lastResolvedTarget
257
271
  },
258
- clientToolsManifestVersion: n.version,
259
- skills: x(E())
272
+ clientToolsManifestVersion: c.version,
273
+ skills: E(A())
260
274
  }
261
275
  };
262
276
  }
263
- async function dt(e, t) {
264
- const o = g(), s = t.getSignal(), { payload: a, hostManifest: n } = await Z(
277
+ async function pt(e, t, o) {
278
+ const s = T(), n = t.getSignal(), { payload: l, hostManifest: c } = await v(
265
279
  e,
266
- s
267
- ), c = new Set(n.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
280
+ n,
281
+ o
282
+ ), S = new Set(c.tools.map((u) => u.name)), p = await fetch(`${s}/v1/runs`, {
268
283
  method: "POST",
269
284
  headers: y(),
270
- body: JSON.stringify(a),
271
- signal: s
285
+ body: JSON.stringify(l),
286
+ signal: n
272
287
  });
273
- if (!u.ok) {
274
- const d = await u.text().catch(() => "");
288
+ if (!p.ok) {
289
+ const u = await p.text().catch(() => "");
275
290
  throw new Error(
276
- `Spotlight 后端创建 run 失败:${u.status} ${d}`
291
+ `Spotlight 后端创建 run 失败:${p.status} ${u}`
277
292
  );
278
293
  }
279
- const { runId: m } = await u.json();
280
- s && (h.set(s, m), s.addEventListener(
294
+ const { runId: m } = await p.json();
295
+ n && (g.set(n, m), n.addEventListener(
281
296
  "abort",
282
297
  () => {
283
- _(m);
298
+ P(m);
284
299
  },
285
300
  { once: !0 }
286
301
  ));
287
302
  const f = await fetch(
288
- `${o}/v1/runs/${encodeURIComponent(m)}/events`,
303
+ `${s}/v1/runs/${encodeURIComponent(m)}/events`,
289
304
  {
290
305
  headers: y(),
291
- signal: s
306
+ signal: n
292
307
  }
293
308
  );
294
309
  if (!f.ok || !f.body)
295
310
  throw new Error(`Spotlight 后端事件流连接失败:${f.status}`);
296
- const T = f.body.getReader(), P = new TextDecoder();
297
- let S = "", C = null;
311
+ const C = f.body.getReader(), N = new TextDecoder();
312
+ let h = "", I = null;
298
313
  try {
299
314
  for (; ; ) {
300
- const { done: d, value: N } = await T.read();
301
- if (d) break;
302
- S += P.decode(N, { stream: !0 });
303
- const I = X(S);
304
- S = I.rest;
305
- for (const l of I.events) {
306
- if (l.type === "host_action_request") {
307
- const k = await q(l.request.call, t, {
308
- allowedHostNames: c,
309
- hostEffect: l.request.hostEffect
315
+ const { done: u, value: x } = await C.read();
316
+ if (u) break;
317
+ h += N.decode(x, { stream: !0 });
318
+ const k = Z(h);
319
+ h = k.rest;
320
+ for (const i of k.events) {
321
+ if (i.type === "host_action_request") {
322
+ const w = await J(i.request.call, t, {
323
+ allowedHostNames: S,
324
+ hostEffect: i.request.hostEffect
310
325
  });
311
- V(t, l, k), await K({
326
+ Y(t, i, w), await X({
312
327
  runId: m,
313
- correlationId: l.request.correlationId,
314
- result: k,
315
- signal: s
328
+ correlationId: i.request.correlationId,
329
+ result: w,
330
+ signal: n
316
331
  });
317
332
  continue;
318
333
  }
319
- if (l.type === "run_error")
320
- throw new Error(l.error);
321
- if (await Y(t, l), l.type === "run_completed")
322
- return l.sessionPatch && R().applySessionPatch(l.sessionPatch), C = l, {
334
+ if (i.type === "run_error")
335
+ throw new Error(i.error);
336
+ if (await K(t, i), i.type === "run_completed")
337
+ return i.sessionPatch && b().applySessionPatch(i.sessionPatch), I = i, {
323
338
  command: null,
324
- usedLegacyFallback: l.usedQueryLoop,
325
- memoryReplay: l.memoryReplay ?? null,
326
- assistantReply: l.assistantReply
339
+ usedLegacyFallback: i.usedQueryLoop,
340
+ memoryReplay: i.memoryReplay ?? null,
341
+ memoryDecision: i.memoryDecision ?? null,
342
+ assistantReply: i.assistantReply
327
343
  };
328
344
  }
329
345
  }
330
346
  } finally {
331
- T.releaseLock();
347
+ C.releaseLock();
332
348
  }
333
349
  return {
334
350
  command: null,
335
- usedLegacyFallback: C?.usedQueryLoop ?? !0
351
+ usedLegacyFallback: I?.usedQueryLoop ?? !0
336
352
  };
337
353
  }
338
- async function _(e) {
354
+ async function P(e) {
339
355
  await fetch(
340
- `${g()}/v1/runs/${encodeURIComponent(e)}`,
356
+ `${T()}/v1/runs/${encodeURIComponent(e)}`,
341
357
  {
342
358
  method: "DELETE",
343
359
  headers: y()
344
360
  }
345
361
  );
346
362
  }
347
- function pt(e) {
363
+ function mt(e) {
348
364
  if (!e) return;
349
- const t = h.get(e);
350
- t && (h.delete(e), _(t));
365
+ const t = g.get(e);
366
+ t && (g.delete(e), P(t));
351
367
  }
352
368
  export {
353
- _ as cancelRemoteSpotlightRun,
354
- pt as cancelRemoteSpotlightRunForSignal,
355
- dt as runRemoteSpotlightPipeline,
356
- ut as warmupSpotlightRemoteContext
369
+ P as cancelRemoteSpotlightRun,
370
+ mt as cancelRemoteSpotlightRunForSignal,
371
+ pt as runRemoteSpotlightPipeline,
372
+ dt as warmupSpotlightRemoteContext
357
373
  };
@@ -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;CACV,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"}