@inupedia/spotlight-vue 0.3.1 → 0.3.3

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 +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;AAob9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,aAAa,EAAE,CAAC,EAChB,UAAU,CAAC,EAAE;IAAE,oBAAoB,EAAE,MAAM,CAAC;IAAC,qBAAqB,EAAE,MAAM,CAAA;CAAE,GAC3E,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAAE,CAIvF;AA6DD,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;AAob9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,aAAa,EAAE,CAAC,EAChB,UAAU,CAAC,EAAE;IAAE,oBAAoB,EAAE,MAAM,CAAC;IAAC,qBAAqB,EAAE,MAAM,CAAA;CAAE,GAC3E,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAAE,CAIvF;AA6DD,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,17 +1,17 @@
1
- import { serializeSkillsForRemote as E } from "@inupedia/spotlight-client";
2
- import { getSkillsPoolForRun as A } from "../skills/index.js";
3
- import { useAgentSessionStore as R } from "../session/agentSession.js";
4
- import { useSpotlightMemoryPreferenceStore as L } from "../store/memoryPreferenceStore.js";
5
- import { useSpotlightRuntimeStore as $ } from "../store/runtimeStore.js";
1
+ import { serializeSkillsForRemote as E, createRuntimeId as A } from "@inupedia/spotlight-client";
2
+ import { getSkillsPoolForRun as L } from "../skills/index.js";
3
+ import { useAgentSessionStore as b } from "../session/agentSession.js";
4
+ import { useSpotlightMemoryPreferenceStore as $ } from "../store/memoryPreferenceStore.js";
5
+ import { useSpotlightRuntimeStore as O } from "../store/runtimeStore.js";
6
6
  import { SPOTLIGHT_PIPELINE_STEP_IDS as r } from "../store/pipeline/constants.js";
7
- import { isLoopPlanningChunk as O, splitIntentStepContent as H, splitToolStepContent as M, composeToolStepContent as F } from "../store/pipeline/displayText.js";
8
- import { getSpotlightConfig as q } from "../plugin.js";
9
- import { executeRemoteHostTool as J, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
10
- import { getSpotlightServerBase as g, buildSpotlightJsonHeaders as y, getSpotlightProjectId as W } from "./httpConfig.js";
11
- import { ensureSpotlightMeta as D } from "./meta.js";
12
- import { getSpotlightCapabilityRuntime as U } from "../createSpotlight.js";
7
+ import { isLoopPlanningChunk as H, splitIntentStepContent as M, splitToolStepContent as F, composeToolStepContent as q } from "../store/pipeline/displayText.js";
8
+ import { getSpotlightConfig as J } from "../plugin.js";
9
+ import { executeRemoteHostTool as W, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
10
+ import { getSpotlightServerBase as g, buildSpotlightJsonHeaders as y, getSpotlightProjectId as D } from "./httpConfig.js";
11
+ import { ensureSpotlightMeta as j } from "./meta.js";
12
+ import { getSpotlightCapabilityRuntime as B } from "../createSpotlight.js";
13
13
  const h = /* @__PURE__ */ new WeakMap();
14
- function j(e) {
14
+ function U(e) {
15
15
  return e.type !== "host_action_request" && e.type !== "run_completed" && e.type !== "run_error" && e.type !== "ping";
16
16
  }
17
17
  function c(e, t, o) {
@@ -20,12 +20,12 @@ function c(e, t, o) {
20
20
  const l = { id: t, label: o, status: "pending" };
21
21
  return e.setSteps([...e.getSteps(), l]), l;
22
22
  }
23
- function B() {
23
+ function z() {
24
24
  return new Promise((e) => {
25
25
  requestAnimationFrame(() => e());
26
26
  });
27
27
  }
28
- function z(e) {
28
+ function G(e) {
29
29
  const t = e.summary?.trim();
30
30
  if (t && t.length > 48 && !t.startsWith("{") && !t.startsWith("["))
31
31
  return t;
@@ -37,8 +37,8 @@ function z(e) {
37
37
  }
38
38
  return t || "";
39
39
  }
40
- function G(e) {
41
- const t = z(e.result);
40
+ function V(e) {
41
+ const t = G(e.result);
42
42
  return {
43
43
  id: e.result.call.id,
44
44
  name: e.result.call.name,
@@ -51,7 +51,7 @@ function G(e) {
51
51
  status: e.result.success ? "done" : "error"
52
52
  };
53
53
  }
54
- function V(e) {
54
+ function Q(e) {
55
55
  return {
56
56
  id: e.call.id,
57
57
  name: e.call.name,
@@ -60,7 +60,7 @@ function V(e) {
60
60
  status: "running"
61
61
  };
62
62
  }
63
- function Q(e, t) {
63
+ function Y(e, t) {
64
64
  const o = t.success ? "前端操作已执行。" : t.error || "前端操作执行失败。";
65
65
  return {
66
66
  id: e.id,
@@ -74,13 +74,13 @@ function Q(e, t) {
74
74
  status: t.success ? "done" : "error"
75
75
  };
76
76
  }
77
- function Y(e) {
77
+ function K(e) {
78
78
  return e.startsWith("panel.") || e.startsWith("navigate.") || e.startsWith("session.");
79
79
  }
80
- function K(e, t, o) {
81
- if (!Y(t.request.call.name)) return;
80
+ function X(e, t, o) {
81
+ if (!K(t.request.call.name)) return;
82
82
  c(e, r.tool, "执行工具与回答");
83
- const s = Q(t.request.call, o);
83
+ const s = Y(t.request.call, o);
84
84
  e.appendToolCallsToStep(r.tool, [s]), e.setStep(
85
85
  r.tool,
86
86
  o.success ? "done" : "error",
@@ -92,10 +92,10 @@ function p(e, t) {
92
92
  const o = e.getSteps().find((s) => s.id === t);
93
93
  !o || o.status === "active" || o.status === "done" || e.setStep(t, "active", o.content);
94
94
  }
95
- function k(e, t) {
95
+ function w(e, t) {
96
96
  return t || (e === r.tool ? "执行工具与回答" : e);
97
97
  }
98
- async function X(e, t) {
98
+ async function Z(e, t) {
99
99
  if (t.type !== "ping") {
100
100
  if (t.type === "step_sync")
101
101
  e.setSteps(
@@ -110,25 +110,25 @@ async function X(e, t) {
110
110
  c(e, t.stepId, t.label ?? t.stepId), e.setStep(t.stepId, t.status, t.content);
111
111
  else if (t.type === "step_content") {
112
112
  let o = t.stepId, s = t.content;
113
- if (o === r.intent && O(s))
113
+ if (o === r.intent && H(s))
114
114
  o = r.tool;
115
115
  else if (o === r.intent && t.mode === "replace") {
116
- const { intent: l, misplacedPlanning: n } = H(s);
116
+ const { intent: l, misplacedPlanning: n } = M(s);
117
117
  s = l, n.trim() && (c(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
118
118
  r.tool,
119
119
  n
120
120
  ));
121
121
  }
122
- c(e, o, k(o, t.label)), t.mode === "replace" ? e.setStep(
122
+ c(e, o, w(o, t.label)), t.mode === "replace" ? e.setStep(
123
123
  o,
124
124
  e.getSteps().find((l) => l.id === o)?.status ?? "active",
125
125
  s
126
- ) : (p(e, o), e.appendChunkToStep(o, s), await B());
126
+ ) : (p(e, o), e.appendChunkToStep(o, s), await z());
127
127
  } else if (t.type === "step_artifact")
128
- c(e, t.stepId, k(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);
128
+ c(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);
129
129
  else if (t.type === "tool_start")
130
130
  c(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
131
- V(t)
131
+ Q(t)
132
132
  ]);
133
133
  else if (t.type === "tool_progress")
134
134
  c(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
@@ -143,7 +143,7 @@ async function X(e, t) {
143
143
  ]);
144
144
  else if (t.type === "tool_result")
145
145
  c(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
146
- G(t)
146
+ V(t)
147
147
  ]), t.result.attachments?.length && e.appendAttachmentsToStep(
148
148
  r.tool,
149
149
  t.result.attachments
@@ -178,19 +178,19 @@ async function X(e, t) {
178
178
  ));
179
179
  else if (t.type === "assistant_response") {
180
180
  c(e, r.tool, "执行工具与回答");
181
- const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: l } = M(o?.content ?? ""), n = t.content.trim(), a = l.trim();
181
+ const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: l } = F(o?.content ?? ""), n = t.content.trim(), a = l.trim();
182
182
  a && n && (a === n || n.startsWith(
183
183
  a.slice(0, Math.min(a.length, 80))
184
184
  )) ? e.setStep(r.tool, "done") : e.setStep(
185
185
  r.tool,
186
186
  "done",
187
- F(s, n)
187
+ q(s, n)
188
188
  );
189
189
  }
190
- j(t) && e.appendExecutionEvent?.(t);
190
+ U(t) && e.appendExecutionEvent?.(t);
191
191
  }
192
192
  }
193
- async function Z(e) {
193
+ async function v(e) {
194
194
  await fetch(
195
195
  `${g()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
196
196
  {
@@ -208,7 +208,7 @@ async function Z(e) {
208
208
  }
209
209
  );
210
210
  }
211
- function v(e) {
211
+ function tt(e) {
212
212
  const t = e.split(/\n\n/u), o = t.pop() ?? "";
213
213
  return { events: t.flatMap((l) => {
214
214
  const n = l.split(/\n/u).find((a) => a.startsWith("data: "));
@@ -220,31 +220,31 @@ function v(e) {
220
220
  }
221
221
  }), rest: o };
222
222
  }
223
- async function ft(e) {
223
+ async function yt(e) {
224
224
  await Promise.allSettled([
225
225
  _(e),
226
- D(e)
226
+ j(e)
227
227
  ]);
228
228
  }
229
- function tt(e, t) {
229
+ function et(e, t) {
230
230
  if (!t) return e;
231
231
  const { skills: o, ...s } = e;
232
232
  return { ...s, ...t };
233
233
  }
234
- async function et(e, t) {
235
- const o = R(), s = $(), l = L(), n = await _(t), a = U(), u = a ? await a.connect({
234
+ async function ot(e, t) {
235
+ const o = b(), s = O(), l = $(), n = await _(t), a = B(), u = a ? await a.connect({
236
236
  sessionId: o.sessionId,
237
- browserInstanceId: w("spotlight.browser-instance", localStorage),
238
- tabInstanceId: w("spotlight.tab-instance", sessionStorage),
237
+ browserInstanceId: R("spotlight.browser-instance", localStorage),
238
+ tabInstanceId: R("spotlight.tab-instance", sessionStorage),
239
239
  signal: t
240
240
  }) : void 0;
241
241
  return {
242
242
  hostManifest: n,
243
- payload: tt({
244
- projectId: W(),
243
+ payload: et({
244
+ projectId: D(),
245
245
  sessionId: o.sessionId,
246
246
  userQuestion: e,
247
- uiContext: q().getUiContext?.() ?? {},
247
+ uiContext: J().getUiContext?.() ?? {},
248
248
  sessionState: {
249
249
  sessionId: o.sessionId,
250
250
  activeTaskId: o.activeTaskId,
@@ -267,21 +267,21 @@ async function et(e, t) {
267
267
  lastResolvedTarget: s.lastResolvedTarget
268
268
  },
269
269
  clientToolsManifestVersion: n.version,
270
- skills: E(A())
270
+ skills: E(L())
271
271
  }, u ? {
272
272
  capabilitySnapshotId: u.handshake.capabilitySnapshotId,
273
273
  sessionBindingVersion: u.handshake.sessionBindingVersion
274
274
  } : void 0)
275
275
  };
276
276
  }
277
- function w(e, t) {
277
+ function R(e, t) {
278
278
  const o = t.getItem(e);
279
279
  if (o) return o;
280
- const s = globalThis.crypto.randomUUID();
280
+ const s = A();
281
281
  return t.setItem(e, s), s;
282
282
  }
283
- async function yt(e, t) {
284
- const o = g(), s = t.getSignal(), { payload: l, hostManifest: n } = await et(
283
+ async function St(e, t) {
284
+ const o = g(), s = t.getSignal(), { payload: l, hostManifest: n } = await ot(
285
285
  e,
286
286
  s
287
287
  ), a = new Set(n.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
@@ -320,26 +320,26 @@ async function yt(e, t) {
320
320
  const { done: d, value: N } = await T.read();
321
321
  if (d) break;
322
322
  S += x.decode(N, { stream: !0 });
323
- const C = v(S);
323
+ const C = tt(S);
324
324
  S = C.rest;
325
325
  for (const i of C.events) {
326
326
  if (i.type === "host_action_request") {
327
- const b = await J(i.request.call, t, {
327
+ const k = await W(i.request.call, t, {
328
328
  allowedHostNames: a,
329
329
  hostEffect: i.request.hostEffect
330
330
  });
331
- K(t, i, b), await Z({
331
+ X(t, i, k), await v({
332
332
  runId: m,
333
333
  correlationId: i.request.correlationId,
334
- result: b,
334
+ result: k,
335
335
  signal: s
336
336
  });
337
337
  continue;
338
338
  }
339
339
  if (i.type === "run_error")
340
340
  throw new Error(i.error);
341
- if (await X(t, i), i.type === "run_completed")
342
- return i.sessionPatch && R().applySessionPatch(i.sessionPatch), I = i, {
341
+ if (await Z(t, i), i.type === "run_completed")
342
+ return i.sessionPatch && b().applySessionPatch(i.sessionPatch), I = i, {
343
343
  command: null,
344
344
  usedLegacyFallback: i.usedQueryLoop,
345
345
  memoryReplay: i.memoryReplay ?? null,
@@ -364,15 +364,15 @@ async function P(e) {
364
364
  }
365
365
  );
366
366
  }
367
- function St(e) {
367
+ function ht(e) {
368
368
  if (!e) return;
369
369
  const t = h.get(e);
370
370
  t && (h.delete(e), P(t));
371
371
  }
372
372
  export {
373
373
  P as cancelRemoteSpotlightRun,
374
- St as cancelRemoteSpotlightRunForSignal,
375
- tt as composeRunCapabilityPayload,
376
- yt as runRemoteSpotlightPipeline,
377
- ft as warmupSpotlightRemoteContext
374
+ ht as cancelRemoteSpotlightRunForSignal,
375
+ et as composeRunCapabilityPayload,
376
+ St as runRemoteSpotlightPipeline,
377
+ yt as warmupSpotlightRemoteContext
378
378
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Vue plugin and config entry for Inupedia Spotlight (monorepo workspace package)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -95,8 +95,8 @@
95
95
  "dependencies": {
96
96
  "prettier": "^3.8.1",
97
97
  "yaml": "^2.8.4",
98
- "@inupedia/spotlight-client": "0.3.1",
99
- "@inupedia/spotlight-protocol": "0.3.1"
98
+ "@inupedia/spotlight-client": "0.3.3",
99
+ "@inupedia/spotlight-protocol": "0.3.3"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@inspira-ui/plugins": "^0.0.2",