@inupedia/spotlight-vue 0.1.2 → 0.1.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;AA4X9D,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,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":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AA4X9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AA2CD,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"}
@@ -4,13 +4,13 @@ import { getSkillsPoolForRun as x } from "../skills/index.js";
4
4
  import { useAgentSessionStore as w } from "../session/agentSession.js";
5
5
  import { useSpotlightRuntimeStore as E } 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 $, splitToolStepContent as L, composeToolStepContent as H } from "../store/pipeline/displayText.js";
8
- import { getSpotlightConfig as A } from "../plugin.js";
9
- import { executeRemoteHostTool as q, ensureHostToolsManifest as I } from "./hostToolRunner.js";
10
- import { getSpotlightServerBase as g, buildSpotlightJsonHeaders as m, getSpotlightProjectId as F } from "./httpConfig.js";
11
- import { ensureSpotlightMeta as J } from "./meta.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
12
  const y = /* @__PURE__ */ new WeakMap();
13
- function M(t) {
13
+ function D(t) {
14
14
  return t.type !== "host_action_request" && t.type !== "run_completed" && t.type !== "run_error" && t.type !== "ping";
15
15
  }
16
16
  function a(t, e, o) {
@@ -19,12 +19,12 @@ function a(t, e, o) {
19
19
  const n = { id: e, label: o, status: "pending" };
20
20
  return t.setSteps([...t.getSteps(), n]), n;
21
21
  }
22
- function W() {
22
+ function M() {
23
23
  return new Promise((t) => {
24
24
  requestAnimationFrame(() => t());
25
25
  });
26
26
  }
27
- function D(t) {
27
+ function j(t) {
28
28
  const e = t.summary?.trim();
29
29
  if (e && e.length > 48 && !e.startsWith("{") && !e.startsWith("["))
30
30
  return e;
@@ -36,8 +36,8 @@ function D(t) {
36
36
  }
37
37
  return e || "";
38
38
  }
39
- function j(t) {
40
- const e = D(t.result);
39
+ function U(t) {
40
+ const e = j(t.result);
41
41
  return {
42
42
  id: t.result.call.id,
43
43
  name: t.result.call.name,
@@ -50,7 +50,7 @@ function j(t) {
50
50
  status: t.result.success ? "done" : "error"
51
51
  };
52
52
  }
53
- function U(t) {
53
+ function z(t) {
54
54
  return {
55
55
  id: t.call.id,
56
56
  name: t.call.name,
@@ -59,7 +59,7 @@ function U(t) {
59
59
  status: "running"
60
60
  };
61
61
  }
62
- function z(t, e) {
62
+ function G(t, e) {
63
63
  const o = e.success ? "前端操作已执行。" : e.error || "前端操作执行失败。";
64
64
  return {
65
65
  id: t.id,
@@ -73,20 +73,20 @@ function z(t, e) {
73
73
  status: e.success ? "done" : "error"
74
74
  };
75
75
  }
76
- function G(t) {
76
+ function B(t) {
77
77
  return t.startsWith("panel.") || t.startsWith("navigate.") || t.startsWith("session.");
78
78
  }
79
- function B(t, e, o) {
80
- if (!G(e.request.call.name)) return;
79
+ function Q(t, e, o) {
80
+ if (!B(e.request.call.name)) return;
81
81
  a(t, r.tool, "执行工具与回答");
82
- const s = z(e.request.call, o);
82
+ const s = G(e.request.call, o);
83
83
  t.appendToolCallsToStep(r.tool, [s]), t.setStep(
84
84
  r.tool,
85
85
  o.success ? "done" : "error",
86
86
  s.resultText
87
87
  );
88
88
  }
89
- async function Q(t, e) {
89
+ async function Y(t, e) {
90
90
  if (e.type !== "ping") {
91
91
  if (e.type === "step_sync")
92
92
  t.setSteps(
@@ -118,10 +118,10 @@ async function Q(t, e) {
118
118
  o,
119
119
  t.getSteps().find((n) => n.id === o)?.status ?? "active",
120
120
  s
121
- ) : (t.appendChunkToStep(o, s), await W());
121
+ ) : (t.appendChunkToStep(o, s), await M());
122
122
  } else if (e.type === "tool_start")
123
123
  a(t, r.tool, "执行工具与回答"), t.appendToolCallsToStep(r.tool, [
124
- U(e)
124
+ z(e)
125
125
  ]);
126
126
  else if (e.type === "tool_progress")
127
127
  a(t, r.tool, "执行工具与回答"), t.appendToolCallsToStep(r.tool, [
@@ -136,7 +136,7 @@ async function Q(t, e) {
136
136
  ]);
137
137
  else if (e.type === "tool_result")
138
138
  a(t, r.tool, "执行工具与回答"), t.appendToolCallsToStep(r.tool, [
139
- j(e)
139
+ U(e)
140
140
  ]), e.result.attachments?.length && t.appendAttachmentsToStep(
141
141
  r.tool,
142
142
  e.result.attachments
@@ -165,17 +165,17 @@ async function Q(t, e) {
165
165
  );
166
166
  else if (e.type === "assistant_response") {
167
167
  a(t, r.tool, "执行工具与回答");
168
- const o = t.getSteps().find((n) => n.id === r.tool), { planning: s } = L(o?.content ?? "");
168
+ const o = t.getSteps().find((n) => n.id === r.tool), { planning: s } = H(o?.content ?? "");
169
169
  t.setStep(
170
170
  r.tool,
171
171
  "done",
172
- H(s, e.content)
172
+ L(s, e.content)
173
173
  );
174
174
  }
175
- M(e) && t.appendExecutionEvent?.(e);
175
+ D(e) && t.appendExecutionEvent?.(e);
176
176
  }
177
177
  }
178
- async function V(t) {
178
+ async function K(t) {
179
179
  await fetch(
180
180
  `${g()}/v1/runs/${encodeURIComponent(t.runId)}/host-results`,
181
181
  {
@@ -193,7 +193,7 @@ async function V(t) {
193
193
  }
194
194
  );
195
195
  }
196
- function Y(t) {
196
+ function V(t) {
197
197
  const e = t.split(/\n\n/u), o = e.pop() ?? "";
198
198
  return { events: e.flatMap((n) => {
199
199
  const i = n.split(/\n/u).find((f) => f.startsWith("data: "));
@@ -205,21 +205,22 @@ function Y(t) {
205
205
  }
206
206
  }), rest: o };
207
207
  }
208
- async function at(t) {
208
+ async function ut(t) {
209
209
  await Promise.allSettled([
210
210
  I(t),
211
- J(t)
211
+ W(t)
212
212
  ]);
213
213
  }
214
- async function K(t, e) {
215
- const o = w(), s = E(), n = await I(e);
214
+ async function X(t, e) {
215
+ const o = w(), s = E(), n = await I(e), i = A().getClientToolDescriptors();
216
216
  return {
217
217
  hostManifest: n,
218
+ localClientTools: i,
218
219
  payload: {
219
- projectId: F(),
220
+ projectId: J(),
220
221
  sessionId: o.sessionId,
221
222
  userQuestion: t,
222
- uiContext: A().getUiContext?.() ?? {},
223
+ uiContext: q().getUiContext?.() ?? {},
223
224
  sessionState: {
224
225
  sessionId: o.sessionId,
225
226
  activeTaskId: o.activeTaskId,
@@ -239,16 +240,18 @@ async function K(t, e) {
239
240
  resumableAction: s.resumableAction,
240
241
  lastResolvedTarget: s.lastResolvedTarget
241
242
  },
242
- clientToolsManifestVersion: n.version,
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,
243
246
  skills: N(x())
244
247
  }
245
248
  };
246
249
  }
247
- async function ut(t, e) {
248
- const o = g(), s = e.getSignal(), { payload: n, hostManifest: i } = await K(
250
+ async function ct(t, e) {
251
+ const o = g(), s = e.getSignal(), { payload: n, localClientTools: i } = await X(
249
252
  t,
250
253
  s
251
- ), f = new Set(i.tools.map((u) => u.name)), c = await fetch(`${o}/v1/runs`, {
254
+ ), f = new Set(i.map((u) => u.name)), c = await fetch(`${o}/v1/runs`, {
252
255
  method: "POST",
253
256
  headers: m(),
254
257
  body: JSON.stringify(n),
@@ -284,15 +287,15 @@ async function ut(t, e) {
284
287
  const { done: u, value: _ } = await h.read();
285
288
  if (u) break;
286
289
  S += P.decode(_, { stream: !0 });
287
- const k = Y(S);
290
+ const k = V(S);
288
291
  S = k.rest;
289
292
  for (const l of k.events) {
290
293
  if (l.type === "host_action_request") {
291
- const C = await q(l.request.call, e, {
294
+ const C = await F(l.request.call, e, {
292
295
  allowedHostNames: f,
293
296
  hostEffect: l.request.hostEffect
294
297
  });
295
- B(e, l, C), await V({
298
+ Q(e, l, C), await K({
296
299
  runId: d,
297
300
  correlationId: l.request.correlationId,
298
301
  result: C,
@@ -302,7 +305,7 @@ async function ut(t, e) {
302
305
  }
303
306
  if (l.type === "run_error")
304
307
  throw new Error(l.error);
305
- if (await Q(e, l), l.type === "run_completed")
308
+ if (await Y(e, l), l.type === "run_completed")
306
309
  return l.sessionPatch?.invokedSkills && w().setInvokedSkills(
307
310
  l.sessionPatch.invokedSkills
308
311
  ), T = l, {
@@ -328,14 +331,14 @@ async function R(t) {
328
331
  }
329
332
  );
330
333
  }
331
- function ct(t) {
334
+ function dt(t) {
332
335
  if (!t) return;
333
336
  const e = y.get(t);
334
337
  e && (y.delete(t), R(e));
335
338
  }
336
339
  export {
337
340
  R as cancelRemoteSpotlightRun,
338
- ct as cancelRemoteSpotlightRunForSignal,
339
- ut as runRemoteSpotlightPipeline,
340
- at as warmupSpotlightRemoteContext
341
+ dt as cancelRemoteSpotlightRunForSignal,
342
+ ct as runRemoteSpotlightPipeline,
343
+ ut as warmupSpotlightRemoteContext
341
344
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.1.2",
3
+ "version": "0.1.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.1.2",
99
- "@inupedia/spotlight-protocol": "0.1.2"
98
+ "@inupedia/spotlight-client": "0.1.3",
99
+ "@inupedia/spotlight-protocol": "0.1.3"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@inspira-ui/plugins": "^0.0.2",