@inupedia/spotlight-vue 0.3.0 → 0.3.2

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.
@@ -5,6 +5,7 @@ export interface SpotlightCapabilityRuntimeV1 {
5
5
  readonly project: SpotlightProjectV1;
6
6
  connect(input: CapabilityConnectInputV1): Promise<CapabilityConnectResultV1>;
7
7
  disconnect(sessionId: string): void;
8
+ dispose(): void;
8
9
  pendingBuild(): Readonly<CapabilityBuildInfoV1> | undefined;
9
10
  notifyBuild(buildInfo: Readonly<CapabilityBuildInfoV1>): void;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createSpotlight.d.ts","sourceRoot":"","sources":["../src/createSpotlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC7E,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,YAAY,IAAI,QAAQ,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IAC5D,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC;CAC/D;AAED,eAAO,MAAM,gCAAgC,EAAE,YAAY,CAAC,4BAA4B,CAChD,CAAC;AAGzC,wBAAgB,6BAA6B,IAAI,4BAA4B,GAAG,SAAS,CAExF;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,YAAY,CAAC,EAAE;QACb,mBAAmB,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QACrD,gBAAgB,EAAE,WAAW,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC,CAAC;KAC7E,CAAC;IACF,mBAAmB,CAAC,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IACtD,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC;QAC/B,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,kBAAkB,CAAC;QAChC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;CAC9C;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,4BAA4B,CAAC;AAEtE,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,CAoDpF"}
1
+ {"version":3,"file":"createSpotlight.d.ts","sourceRoot":"","sources":["../src/createSpotlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC7E,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC;IAChB,YAAY,IAAI,QAAQ,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IAC5D,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC;CAC/D;AAED,eAAO,MAAM,gCAAgC,EAAE,YAAY,CAAC,4BAA4B,CAChD,CAAC;AAGzC,wBAAgB,6BAA6B,IAAI,4BAA4B,GAAG,SAAS,CAExF;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,YAAY,CAAC,EAAE;QACb,mBAAmB,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QACrD,gBAAgB,EAAE,WAAW,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC,CAAC;KAC7E,CAAC;IACF,mBAAmB,CAAC,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IACtD,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC;QAC/B,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,kBAAkB,CAAC;QAChC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;CAC9C;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,4BAA4B,CAAC;AAEtE,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,CA2EpF"}
@@ -1,47 +1,69 @@
1
- import { createFrontendToolRegistry as u, createCapabilityClient as f } from "@inupedia/spotlight-client";
2
- const g = /* @__PURE__ */ Symbol("spotlight-capability-runtime");
3
- let p;
4
- function y() {
5
- return p;
1
+ import { createFrontendToolRegistry as j, subscribeCapabilityRuntimeV1 as B, createCapabilityClient as C, waitForCapabilityRuntimeV1 as S } from "@inupedia/spotlight-client";
2
+ const w = /* @__PURE__ */ Symbol("spotlight-capability-runtime");
3
+ let d;
4
+ function E() {
5
+ return d;
6
6
  }
7
- function S(e) {
8
- const s = u(e.project), i = /* @__PURE__ */ new Map();
9
- let c, n, l;
10
- const b = () => n ??= e.capabilities ? Promise.resolve(e.capabilities) : e.capabilityBuildInfo && e.openUploadStream ? Promise.resolve({ capabilityBuildInfo: e.capabilityBuildInfo, openUploadStream: e.openUploadStream }) : Promise.reject(new Error("Spotlight capabilities are missing. Pass the virtual:spotlight/capabilities module to createSpotlight().")), a = Object.assign(
7
+ function M(t) {
8
+ const m = j(t.project), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
9
+ let u, a, b, l;
10
+ const I = (e) => a || (t.capabilities ? a = Promise.resolve(t.capabilities) : t.capabilityBuildInfo && t.openUploadStream ? a = Promise.resolve({ capabilityBuildInfo: t.capabilityBuildInfo, openUploadStream: t.openUploadStream }) : S(t.project.projectId, e)), i = Object.assign(
11
11
  {
12
- project: e.project,
13
- async connect(t) {
14
- const r = i.get(t.sessionId);
15
- if (r) return r;
16
- const o = await b();
17
- l ??= f({
18
- endpoint: e.endpoint,
19
- project: e.project,
20
- registry: s,
21
- buildInfo: o.capabilityBuildInfo,
22
- openUploadStream: o.openUploadStream,
23
- fetch: e.fetch,
24
- createWebSocket: e.createWebSocket
25
- });
26
- const d = await l.connect(t);
27
- return i.set(t.sessionId, d), d;
12
+ project: t.project,
13
+ async connect(e) {
14
+ const s = r.get(e.sessionId);
15
+ if (s) return s;
16
+ const g = n.get(e.sessionId);
17
+ if (g) return g.promise;
18
+ const o = new AbortController(), y = () => o.abort(e.signal?.reason);
19
+ e.signal?.aborted ? o.abort(e.signal.reason) : e.signal?.addEventListener("abort", y, { once: !0 });
20
+ const v = () => e.signal?.removeEventListener("abort", y), p = (async () => {
21
+ const c = await I(o.signal);
22
+ b ??= C({
23
+ endpoint: t.endpoint,
24
+ project: t.project,
25
+ registry: m,
26
+ buildInfo: c.capabilityBuildInfo,
27
+ openUploadStream: c.openUploadStream,
28
+ fetch: t.fetch,
29
+ createWebSocket: t.createWebSocket
30
+ });
31
+ const f = await b.connect({ ...e, signal: o.signal });
32
+ if (o.signal.aborted)
33
+ throw f.channel?.close(), new DOMException("Capability connect aborted.", "AbortError");
34
+ return r.set(e.sessionId, f), f;
35
+ })();
36
+ n.set(e.sessionId, { promise: p, controller: o, cleanup: v });
37
+ try {
38
+ return await p;
39
+ } finally {
40
+ const c = n.get(e.sessionId);
41
+ c?.promise === p && (c.cleanup(), n.delete(e.sessionId));
42
+ }
28
43
  },
29
- disconnect(t) {
30
- i.get(t)?.channel?.close(), i.delete(t);
44
+ disconnect(e) {
45
+ n.get(e)?.controller.abort(new DOMException("Capability connect disconnected.", "AbortError")), r.get(e)?.channel?.close(), r.delete(e);
31
46
  },
32
- pendingBuild: () => c,
33
- notifyBuild(t) {
34
- i.size > 0 || t.artifactDigest !== e.capabilityBuildInfo?.artifactDigest ? c = Object.freeze({ ...t }) : (n = void 0, l = void 0);
47
+ dispose() {
48
+ for (const e of r.values()) e.channel?.close();
49
+ r.clear();
50
+ for (const e of n.values())
51
+ e.controller.abort(new DOMException("Spotlight disposed.", "AbortError")), e.cleanup();
52
+ n.clear(), l?.(), l = void 0, d === i && (d = void 0);
35
53
  },
36
- install(t) {
37
- p = a, t.provide(g, a);
54
+ pendingBuild: () => u,
55
+ notifyBuild(e) {
56
+ r.size > 0 || e.artifactDigest !== t.capabilityBuildInfo?.artifactDigest ? u = Object.freeze({ ...e }) : (a = void 0, b = void 0);
57
+ },
58
+ install(e) {
59
+ d = i, l?.(), l = B(t.project.projectId, (s) => i.notifyBuild(s)), e.provide(w, i);
38
60
  }
39
61
  }
40
62
  );
41
- return Object.freeze(a), a;
63
+ return Object.freeze(i), i;
42
64
  }
43
65
  export {
44
- g as SPOTLIGHT_CAPABILITY_RUNTIME_KEY,
45
- S as createSpotlight,
46
- y as getSpotlightCapabilityRuntime
66
+ w as SPOTLIGHT_CAPABILITY_RUNTIME_KEY,
67
+ M as createSpotlight,
68
+ E as getSpotlightCapabilityRuntime
47
69
  };
@@ -1,6 +1,13 @@
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 composeRunCapabilityPayload<T extends Record<string, unknown>>(legacyPayload: T, capability?: {
5
+ capabilitySnapshotId: string;
6
+ sessionBindingVersion: number;
7
+ }): Omit<T, "skills"> & {
8
+ capabilitySnapshotId?: string;
9
+ sessionBindingVersion?: number;
10
+ };
4
11
  export declare function runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi): Promise<SpotlightPipelineRunOutcome>;
5
12
  export declare function cancelRemoteSpotlightRun(runId: string): Promise<void>;
6
13
  export declare function cancelRemoteSpotlightRunForSignal(signal?: AbortSignal): void;
@@ -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;AA8DD,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,31 +1,31 @@
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) {
18
18
  const s = e.getSteps().find((n) => n.id === t);
19
19
  if (s) return s;
20
- const a = { id: t, label: o, status: "pending" };
21
- return e.setSteps([...e.getSteps(), a]), a;
20
+ const l = { id: t, label: o, status: "pending" };
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",
@@ -95,7 +95,7 @@ function p(e, t) {
95
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: a, misplacedPlanning: n } = H(s);
117
- s = a, n.trim() && (c(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
116
+ const { intent: l, misplacedPlanning: n } = M(s);
117
+ s = l, n.trim() && (c(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
118
118
  r.tool,
119
119
  n
120
120
  ));
121
121
  }
122
122
  c(e, o, w(o, t.label)), t.mode === "replace" ? e.setStep(
123
123
  o,
124
- e.getSteps().find((a) => a.id === o)?.status ?? "active",
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
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: a } = M(o?.content ?? ""), n = t.content.trim(), l = a.trim();
182
- l && n && (l === n || n.startsWith(
183
- l.slice(0, Math.min(l.length, 80))
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
+ a && n && (a === n || n.startsWith(
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,10 +208,10 @@ 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
- return { events: t.flatMap((a) => {
214
- const n = a.split(/\n/u).find((l) => l.startsWith("data: "));
213
+ return { events: t.flatMap((l) => {
214
+ const n = l.split(/\n/u).find((a) => a.startsWith("data: "));
215
215
  if (!n) return [];
216
216
  try {
217
217
  return [JSON.parse(n.slice(6))];
@@ -220,30 +220,31 @@ function v(e) {
220
220
  }
221
221
  }), rest: o };
222
222
  }
223
- async function mt(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
- async function tt(e, t) {
230
- const o = R(), s = $(), a = L(), n = await _(t), l = U(), u = l ? await l.connect({
229
+ function et(e, t) {
230
+ if (!t) return e;
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({
231
236
  sessionId: o.sessionId,
232
- browserInstanceId: k("spotlight.browser-instance", localStorage),
233
- tabInstanceId: k("spotlight.tab-instance", sessionStorage),
237
+ browserInstanceId: R("spotlight.browser-instance", localStorage),
238
+ tabInstanceId: R("spotlight.tab-instance", sessionStorage),
234
239
  signal: t
235
240
  }) : void 0;
236
241
  return {
237
242
  hostManifest: n,
238
- payload: {
239
- projectId: W(),
243
+ payload: et({
244
+ projectId: D(),
240
245
  sessionId: o.sessionId,
241
- ...u ? {
242
- capabilitySnapshotId: u.handshake.capabilitySnapshotId,
243
- sessionBindingVersion: u.handshake.sessionBindingVersion
244
- } : {},
245
246
  userQuestion: e,
246
- uiContext: q().getUiContext?.() ?? {},
247
+ uiContext: J().getUiContext?.() ?? {},
247
248
  sessionState: {
248
249
  sessionId: o.sessionId,
249
250
  activeTaskId: o.activeTaskId,
@@ -255,7 +256,7 @@ async function tt(e, t) {
255
256
  lastAssistantReply: o.getLastAssistantContent(),
256
257
  invokedSkills: o.invokedSkills,
257
258
  skillPermissionGrants: o.skillPermissionGrants,
258
- memoryReadEnabled: a.enabled,
259
+ memoryReadEnabled: l.enabled,
259
260
  memoryWriteEnabled: !0
260
261
  },
261
262
  runtimeState: {
@@ -266,24 +267,27 @@ async function tt(e, t) {
266
267
  lastResolvedTarget: s.lastResolvedTarget
267
268
  },
268
269
  clientToolsManifestVersion: n.version,
269
- skills: E(A())
270
- }
270
+ skills: E(L())
271
+ }, u ? {
272
+ capabilitySnapshotId: u.handshake.capabilitySnapshotId,
273
+ sessionBindingVersion: u.handshake.sessionBindingVersion
274
+ } : void 0)
271
275
  };
272
276
  }
273
- function k(e, t) {
277
+ function R(e, t) {
274
278
  const o = t.getItem(e);
275
279
  if (o) return o;
276
- const s = globalThis.crypto.randomUUID();
280
+ const s = A();
277
281
  return t.setItem(e, s), s;
278
282
  }
279
- async function ft(e, t) {
280
- const o = g(), s = t.getSignal(), { payload: a, hostManifest: n } = await tt(
283
+ async function St(e, t) {
284
+ const o = g(), s = t.getSignal(), { payload: l, hostManifest: n } = await ot(
281
285
  e,
282
286
  s
283
- ), l = new Set(n.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
287
+ ), a = new Set(n.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
284
288
  method: "POST",
285
289
  headers: y(),
286
- body: JSON.stringify(a),
290
+ body: JSON.stringify(l),
287
291
  signal: s
288
292
  });
289
293
  if (!u.ok) {
@@ -316,26 +320,26 @@ async function ft(e, t) {
316
320
  const { done: d, value: N } = await T.read();
317
321
  if (d) break;
318
322
  S += x.decode(N, { stream: !0 });
319
- const C = v(S);
323
+ const C = tt(S);
320
324
  S = C.rest;
321
325
  for (const i of C.events) {
322
326
  if (i.type === "host_action_request") {
323
- const b = await J(i.request.call, t, {
324
- allowedHostNames: l,
327
+ const k = await W(i.request.call, t, {
328
+ allowedHostNames: a,
325
329
  hostEffect: i.request.hostEffect
326
330
  });
327
- K(t, i, b), await Z({
331
+ X(t, i, k), await v({
328
332
  runId: m,
329
333
  correlationId: i.request.correlationId,
330
- result: b,
334
+ result: k,
331
335
  signal: s
332
336
  });
333
337
  continue;
334
338
  }
335
339
  if (i.type === "run_error")
336
340
  throw new Error(i.error);
337
- if (await X(t, i), i.type === "run_completed")
338
- 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, {
339
343
  command: null,
340
344
  usedLegacyFallback: i.usedQueryLoop,
341
345
  memoryReplay: i.memoryReplay ?? null,
@@ -360,14 +364,15 @@ async function P(e) {
360
364
  }
361
365
  );
362
366
  }
363
- function yt(e) {
367
+ function ht(e) {
364
368
  if (!e) return;
365
369
  const t = h.get(e);
366
370
  t && (h.delete(e), P(t));
367
371
  }
368
372
  export {
369
373
  P as cancelRemoteSpotlightRun,
370
- yt as cancelRemoteSpotlightRunForSignal,
371
- ft as runRemoteSpotlightPipeline,
372
- mt as warmupSpotlightRemoteContext
374
+ ht as cancelRemoteSpotlightRunForSignal,
375
+ et as composeRunCapabilityPayload,
376
+ St as runRemoteSpotlightPipeline,
377
+ yt as warmupSpotlightRemoteContext
373
378
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
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.0",
99
- "@inupedia/spotlight-protocol": "0.3.0"
98
+ "@inupedia/spotlight-client": "0.3.2",
99
+ "@inupedia/spotlight-protocol": "0.3.2"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@inspira-ui/plugins": "^0.0.2",