@inupedia/spotlight-vue 0.7.7 → 0.8.0

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.
package/dist/config.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import type { AgentUiContext, SpotlightCommandCatalog, SpotlightCommandCatalogVideoChannel, SpotlightSkill } from "@inupedia/spotlight-protocol";
2
- import type { ClientTool, SpotlightClientConfig } from "@inupedia/spotlight-client";
2
+ import type { ClientTool, SpotlightClientConfig, SpotlightResourceProvider } from "@inupedia/spotlight-client";
3
3
  import type { SpotlightUiPrompts } from "./remote/meta.js";
4
4
  import type { ToolResult } from "./types/toolResult.js";
5
5
  export type SpotlightConfig = SpotlightClientConfig & {
6
6
  /** Browser tools registered with defineClientTool(). */
7
- tools: ClientTool[] | (() => ClientTool[]);
7
+ tools?: ClientTool[] | (() => ClientTool[]);
8
+ /** Large dynamic business catalogs exposed through generated Resource Tools. */
9
+ resources?: SpotlightResourceProvider[] | (() => SpotlightResourceProvider[]);
8
10
  /** Immutable frontend build identifier used to bind the production manifest. */
9
11
  frontendBuildId?: string;
10
12
  /** Consumer-owned Skills sent to the server for LangGraph planning. */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,mCAAmC,EACnC,cAAc,EACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG;IACpD,wDAAwD;IACxD,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,UAAU,EAAE,CAAC,CAAC;I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AQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B,KAAK,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,+BAA+B,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;CACnE,CAAC;AAEF,iDAAiD;AACjD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,CAoB7E;AAED,eAAO,MAAM,oBAAoB,eAA6B,CAAC;AAE/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG;IAClC,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC,CAAC;AAEF,6FAA6F;AAC7F,MAAM,MAAM,yBAAyB,GACjC,CAAC,qBAAqB,GAAG;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,GACrD,CAAC,eAAe,GAAG,qBAAqB,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC"}
package/dist/config.js CHANGED
@@ -1,20 +1,22 @@
1
- function i(t) {
1
+ function e(t) {
2
2
  const o = t;
3
3
  if (!o.projectId?.trim())
4
4
  throw new Error("Spotlight config: projectId is required");
5
5
  if (!o.serverUrl?.trim())
6
6
  throw new Error("Spotlight config: serverUrl is required");
7
- if (!o.tools)
8
- throw new Error("Spotlight config: tools are required");
9
- if (typeof o.tools != "function") {
7
+ if (!o.tools && !o.resources)
8
+ throw new Error("Spotlight config: tools or resources are required");
9
+ if (o.tools && typeof o.tools != "function") {
10
10
  const r = o.tools;
11
11
  if (!Array.isArray(r) || r.length === 0)
12
- throw new Error("Spotlight config: at least one client tool is required");
12
+ throw new Error(
13
+ "Spotlight config: tools must not be empty when provided"
14
+ );
13
15
  }
14
16
  return o;
15
17
  }
16
- const e = /* @__PURE__ */ Symbol("spotlight-config");
18
+ const i = /* @__PURE__ */ Symbol("spotlight-config");
17
19
  export {
18
- e as SPOTLIGHT_CONFIG_KEY,
19
- i as defineSpotlightConfig
20
+ i as SPOTLIGHT_CONFIG_KEY,
21
+ e as defineSpotlightConfig
20
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,YAAY,EAAE,MAAM,KAAK,CAAC;AAC7C,OAAO,EAEL,wBAAwB,EAIxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC/B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,aAAa,CACjC,CAAC;AAC3B,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACtF,eAAO,MAAM,0BAA0B,EAAE,YAAY,CAAC,2BAA2B,CAC/C,CAAC;AACnC,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,kBAAkB,CACtC,CAAC;AAOjC,wBAAgB,kBAAkB,IAAI,eAAe,CAOpD;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAMhD;AAED,wBAAgB,uBAAuB,IAAI,2BAA2B,CAOrE;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,CAO1D;AAED,sCAAsC;AACtC,wBAA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,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,CAAC"}
package/dist/plugin.js CHANGED
@@ -1,78 +1,89 @@
1
- import { createSpotlightHttp as g, createClientToolRegistry as c, createSpotlightAppClient as u, createClientToolManifest as h } from "@inupedia/spotlight-client";
2
- import { defineSpotlightConfig as d, SPOTLIGHT_CONFIG_KEY as S } from "./config.js";
3
- import { mountSpotlightShell as T, unmountSpotlightShellForTests as m } from "./mountShell.js";
4
- const C = /* @__PURE__ */ Symbol("spotlight-http"), I = /* @__PURE__ */ Symbol("spotlight-client-tools"), v = /* @__PURE__ */ Symbol("spotlight-app-client");
5
- let p = null, i = null, n = null, r = null;
6
- function f() {
1
+ import { createSpotlightHttp as g, createClientToolRegistry as u, createSpotlightAppClient as T, createClientToolManifest as m } from "@inupedia/spotlight-client";
2
+ import { defineSpotlightConfig as C, SPOTLIGHT_CONFIG_KEY as v } from "./config.js";
3
+ import { mountSpotlightShell as I, unmountSpotlightShellForTests as y } from "./mountShell.js";
4
+ const E = /* @__PURE__ */ Symbol("spotlight-http"), _ = /* @__PURE__ */ Symbol("spotlight-client-tools"), b = /* @__PURE__ */ Symbol("spotlight-app-client");
5
+ let p = null, i = null, n = null, s = null;
6
+ function d() {
7
7
  if (!p)
8
8
  throw new Error(
9
9
  "Spotlight is not installed. Call app.use(SpotlightVue, { config }) in main.ts"
10
10
  );
11
11
  return p;
12
12
  }
13
- function P() {
13
+ function H() {
14
14
  if (!i) {
15
- const o = f();
15
+ const o = d();
16
16
  i = g(o);
17
17
  }
18
18
  return i;
19
19
  }
20
- function A() {
20
+ function L() {
21
21
  if (!n) {
22
- const o = f(), l = typeof o.tools == "function" ? o.tools() : o.tools;
23
- n = c(l);
22
+ const o = d(), l = [
23
+ ...typeof o.tools == "function" ? o.tools() : o.tools ?? [],
24
+ ...(typeof o.resources == "function" ? o.resources() : o.resources ?? []).flatMap((e) => e.tools)
25
+ ];
26
+ n = u(l);
24
27
  }
25
28
  return n;
26
29
  }
27
- function H() {
28
- if (!r)
30
+ function O() {
31
+ if (!s)
29
32
  throw new Error(
30
33
  "Spotlight App Client is not initialized. Call app.use(SpotlightVue, { config })"
31
34
  );
32
- return r;
35
+ return s;
33
36
  }
34
- function k() {
35
- m(), p = null, i = null, n = null, r = null;
37
+ function w() {
38
+ y(), p = null, i = null, n = null, s = null;
36
39
  }
37
- const L = {
40
+ const K = {
38
41
  install(o, l) {
39
- const e = o, t = d(
42
+ const e = o, t = C(
40
43
  "config" in l && l.config ? l.config : l
41
- ), s = typeof t.tools == "function" ? t.tools() : t.tools;
42
- if (!Array.isArray(s) || s.length === 0)
44
+ ), h = typeof t.tools == "function" ? t.tools() : t.tools ?? [], c = typeof t.resources == "function" ? t.resources() : t.resources ?? [], r = [
45
+ ...h,
46
+ ...c.flatMap((f) => f.tools)
47
+ ];
48
+ if (!Array.isArray(r) || r.length === 0)
43
49
  throw new Error(
44
50
  "Spotlight config: at least one client tool is required after tools() resolves"
45
51
  );
46
- p = t, i = g(t), n = c(s);
47
- const a = t.frontendBuildId?.trim() || "development";
48
- r = u({
52
+ p = t, i = g(t), n = u(r);
53
+ const S = t.frontendBuildId?.trim() || "development";
54
+ s = T({
49
55
  serverUrl: t.serverUrl,
50
56
  apiKey: t.apiKey,
51
57
  projectId: t.projectId,
52
58
  clientInfo: {
53
59
  name: "spotlight-vue",
54
60
  title: "Spotlight Vue",
55
- version: "0.7.1"
61
+ version: "0.8.0"
56
62
  },
57
- toolManifest: () => h({
63
+ toolManifest: () => m({
58
64
  projectId: t.projectId,
59
- frontendBuildId: a,
60
- tools: s
65
+ frontendBuildId: S,
66
+ tools: r
61
67
  }),
62
- skills: () => t.getSkillsForRun?.() ?? (typeof t.skills == "function" ? t.skills() : t.skills) ?? []
63
- }), e.provide(S, t), e.provide(C, i), e.provide(I, n), e.provide(v, r), e.config.globalProperties.$spotlightEnabled = l.enabled !== !1, e.config.globalProperties.$spotlightAvatarEnabled = l.avatarEnabled === !0, T(e, l);
68
+ skills: () => [
69
+ ...t.getSkillsForRun?.() ?? (typeof t.skills == "function" ? t.skills() : t.skills) ?? [],
70
+ ...c.flatMap(
71
+ (a) => a.skill ? [a.skill] : []
72
+ )
73
+ ]
74
+ }), e.provide(v, t), e.provide(E, i), e.provide(_, n), e.provide(b, s), e.config.globalProperties.$spotlightEnabled = l.enabled !== !1, e.config.globalProperties.$spotlightAvatarEnabled = l.avatarEnabled === !0, I(e, l);
64
75
  }
65
76
  };
66
77
  export {
67
- v as SPOTLIGHT_APP_CLIENT_KEY,
68
- I as SPOTLIGHT_CLIENT_TOOLS_KEY,
69
- S as SPOTLIGHT_CONFIG_KEY,
70
- C as SPOTLIGHT_HTTP_KEY,
71
- L as SpotlightVue,
72
- d as defineSpotlightConfig,
73
- H as getSpotlightAppClient,
74
- A as getSpotlightClientTools,
75
- f as getSpotlightConfig,
76
- P as getSpotlightHttp,
77
- k as resetSpotlightRuntimeForTests
78
+ b as SPOTLIGHT_APP_CLIENT_KEY,
79
+ _ as SPOTLIGHT_CLIENT_TOOLS_KEY,
80
+ v as SPOTLIGHT_CONFIG_KEY,
81
+ E as SPOTLIGHT_HTTP_KEY,
82
+ K as SpotlightVue,
83
+ C as defineSpotlightConfig,
84
+ O as getSpotlightAppClient,
85
+ L as getSpotlightClientTools,
86
+ d as getSpotlightConfig,
87
+ H as getSpotlightHttp,
88
+ w as resetSpotlightRuntimeForTests
78
89
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hostToolRunner.d.ts","sourceRoot":"","sources":["../../src/remote/hostToolRunner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEhD,wBAAsB,uBAAuB,CAAC,MAAM,CAAC,EAAE,WAAW,0EAYjE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE;IAAE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,UAAU,CAAC,EAAE,cAAc,CAAA;CAAE,GACtE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CA6B9B;AAED,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"hostToolRunner.d.ts","sourceRoot":"","sources":["../../src/remote/hostToolRunner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEhD,wBAAsB,uBAAuB,CAAC,MAAM,CAAC,EAAE,WAAW,0EA0BjE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE;IAAE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,UAAU,CAAC,EAAE,cAAc,CAAA;CAAE,GACtE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CA0C9B;AAED,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
@@ -1,35 +1,45 @@
1
- import { createClientToolManifest as s } from "@inupedia/spotlight-client";
2
- import { getSpotlightConfig as i, getSpotlightClientTools as a } from "../plugin.js";
3
- const c = {};
4
- async function m(t) {
5
- const e = i(), n = c, r = e.frontendBuildId?.trim() || n?.VITE_BUILD_SHA?.trim() || "development";
6
- return await s({
7
- projectId: e.projectId,
1
+ import { createClientToolManifest as i } from "@inupedia/spotlight-client";
2
+ import { getSpotlightConfig as a, getSpotlightClientTools as u } from "../plugin.js";
3
+ const f = {};
4
+ async function _(o) {
5
+ const t = a(), s = f, r = t.frontendBuildId?.trim() || s?.VITE_BUILD_SHA?.trim() || "development", e = typeof t.resources == "function" ? t.resources() : t.resources ?? [], n = [
6
+ ...typeof t.tools == "function" ? t.tools() : t.tools ?? [],
7
+ ...e.flatMap((c) => c.tools)
8
+ ];
9
+ return await i({
10
+ projectId: t.projectId,
8
11
  frontendBuildId: r,
9
- tools: typeof e.tools == "function" ? e.tools() : e.tools
12
+ tools: n
10
13
  });
11
14
  }
12
- async function d(t, e, n) {
13
- const r = a();
14
- if (!n.allowedHostNames.has(t.name) || !r.has(t.name))
15
+ async function T(o, t, s) {
16
+ const r = u();
17
+ if (!s.allowedHostNames.has(o.name) || !r.has(o.name))
15
18
  return {
16
19
  success: !1,
17
- error: `Client tool is not registered: ${t.name}`,
20
+ error: `Client tool is not registered: ${o.name}`,
18
21
  errorCode: "UNKNOWN_TOOL",
19
22
  trace: [],
20
23
  executionTarget: "host"
21
24
  };
22
25
  try {
23
- return {
26
+ const e = await r.executeResult(o.name, o.input);
27
+ return e.success ? {
24
28
  success: !0,
25
- data: await r.execute(t.name, t.input),
29
+ data: e,
30
+ trace: [],
31
+ executionTarget: "host"
32
+ } : {
33
+ success: !1,
34
+ error: e.error.message,
35
+ errorCode: e.error.code === "TOOL_INPUT_INVALID" || e.error.code === "TOOL_OUTPUT_INVALID" ? e.error.code : "TOOL_RUN_FAILED",
26
36
  trace: [],
27
37
  executionTarget: "host"
28
38
  };
29
- } catch (o) {
39
+ } catch (e) {
30
40
  return {
31
41
  success: !1,
32
- error: o instanceof Error ? o.message : String(o),
42
+ error: e instanceof Error ? e.message : String(e),
33
43
  errorCode: "TOOL_RUN_FAILED",
34
44
  trace: [],
35
45
  executionTarget: "host"
@@ -37,6 +47,6 @@ async function d(t, e, n) {
37
47
  }
38
48
  }
39
49
  export {
40
- m as ensureHostToolsManifest,
41
- d as executeRemoteHostTool
50
+ _ as ensureHostToolsManifest,
51
+ T as executeRemoteHostTool
42
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/store/pipeline/errors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,EAC1D,GAAG,EAAE,MAAM,GACV,IAAI,CAQN;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC,GACxD,MAAM,CAwCR"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/store/pipeline/errors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,EAC1D,GAAG,EAAE,MAAM,GACV,IAAI,CAQN;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC,GACxD,MAAM,CA0CR"}
@@ -1,10 +1,10 @@
1
- import { SPOTLIGHT_PIPELINE_STEP_IDS as a } from "./constants.js";
2
- import { findActiveStep as _ } from "./steps.js";
3
- function $(e, r) {
4
- const o = _(e.getSteps());
5
- o ? e.setStep(o.id, "error", r) : e.setStep(a.understand, "error", r), e.setError(r);
1
+ import { SPOTLIGHT_PIPELINE_STEP_IDS as E } from "./constants.js";
2
+ import { findActiveStep as s } from "./steps.js";
3
+ function L(e, r) {
4
+ const o = s(e.getSteps());
5
+ o ? e.setStep(o.id, "error", r) : e.setStep(E.understand, "error", r), e.setError(r);
6
6
  }
7
- function d(e) {
7
+ function N(e) {
8
8
  const r = {
9
9
  UNKNOWN_TOOL: "系统里还没有注册这个操作",
10
10
  HOST_TOOL_NOT_MANIFEST: "该操作未在本页 host 工具清单中注册",
@@ -12,19 +12,21 @@ function d(e) {
12
12
  PREREQUISITE_FAILED: "前置步骤执行失败",
13
13
  PRECONDITION_FAILED: "当前页面状态不满足执行条件",
14
14
  TOOL_APPROVAL_REQUIRED: "该操作需要用户明确批准",
15
+ TOOL_INPUT_INVALID: "工具参数不完整或格式不正确",
16
+ TOOL_OUTPUT_INVALID: "工具返回结果不符合约定格式",
15
17
  TOOL_RUN_FAILED: "工具执行时发生运行错误",
16
18
  TOOL_TIMEOUT: "工具执行超时"
17
- }, o = e.errorCode ? r[e.errorCode] : "工具执行失败", c = e.error?.trim() || "未知错误", n = e.trace ?? [], t = n.at(-1), i = n.filter(
19
+ }, o = e.errorCode ? r[e.errorCode] : "工具执行失败", T = e.error?.trim() || "未知错误", n = e.trace ?? [], t = n.at(-1), c = n.filter(
18
20
  (l) => l.type === "retry_scheduled"
19
- ).length, O = n.some(
21
+ ).length, i = n.some(
20
22
  (l) => l.type === "rollback_applied"
21
- ), E = t ? t.detail ? `${t.type}:${t.tool}:${t.detail}` : `${t.type}:${t.tool}` : null, T = [
22
- i > 0 ? `系统已自动重试 ${i} 次` : null,
23
- O ? "已执行回滚清理" : null
24
- ].filter(Boolean).join(","), s = T ? `。恢复动作:${T}` : "";
25
- return E ? `${o}:${c}${s}。定位线索:${E}` : `${o}:${c}${s}`;
23
+ ), O = t ? t.detail ? `${t.type}:${t.tool}:${t.detail}` : `${t.type}:${t.tool}` : null, _ = [
24
+ c > 0 ? `系统已自动重试 ${c} 次` : null,
25
+ i ? "已执行回滚清理" : null
26
+ ].filter(Boolean).join(","), I = _ ? `。恢复动作:${_}` : "";
27
+ return O ? `${o}:${T}${I}。定位线索:${O}` : `${o}:${T}${I}`;
26
28
  }
27
29
  export {
28
- $ as applyPipelineError,
29
- d as formatToolFailure
30
+ L as applyPipelineError,
31
+ N as formatToolFailure
30
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.7.7",
3
+ "version": "0.8.0",
4
4
  "description": "Thin Vue runtime for Inupedia Spotlight Client Tools",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -91,8 +91,8 @@
91
91
  "dependencies": {
92
92
  "prettier": "^3.8.1",
93
93
  "yaml": "^2.8.4",
94
- "@inupedia/spotlight-client": "0.7.7",
95
- "@inupedia/spotlight-protocol": "0.7.7"
94
+ "@inupedia/spotlight-client": "0.8.0",
95
+ "@inupedia/spotlight-protocol": "0.8.0"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "@inspira-ui/plugins": "^0.0.2",