@inupedia/spotlight-vue 0.5.6 → 0.5.8

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
@@ -7,7 +7,7 @@ export type SpotlightConfig = SpotlightClientConfig & {
7
7
  tools: ClientTool[] | (() => ClientTool[]);
8
8
  /** Immutable frontend build identifier used to bind the production manifest. */
9
9
  frontendBuildId?: string;
10
- /** Skills sent on each create-run (metadata only; bodies loaded server-side). */
10
+ /** Consumer-owned Skills sent to the server for LangGraph planning. */
11
11
  skills?: SpotlightSkill[] | (() => SpotlightSkill[]);
12
12
  /** Preferred: host resolves bundled + inline skills per run. */
13
13
  getSkillsForRun?: () => SpotlightSkill[];
@@ -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;IAC3C,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,cAAc,EAAE,CAAC,CAAC;IACrD,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,cAAc,EAAE,CAAC;IACzC,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,uBAAuB,GAAG,IAAI,GAAG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BAA2B,CAAC,CA4FtC;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,MAAM,iBAQ3D;AAED,wBAAgB,iCAAiC,CAAC,MAAM,CAAC,EAAE,WAAW,QAMrE"}
@@ -1,28 +1,30 @@
1
- import { useAgentSessionStore as k } from "../session/agentSession.js";
2
- import { useSpotlightMemoryPreferenceStore as A } from "../store/memoryPreferenceStore.js";
3
- import { useSpotlightRuntimeStore as M } from "../store/runtimeStore.js";
1
+ import { serializeSkillsForRemote as A } from "@inupedia/spotlight-client";
2
+ import { useAgentSessionStore as b } from "../session/agentSession.js";
3
+ import { useSpotlightMemoryPreferenceStore as M } from "../store/memoryPreferenceStore.js";
4
+ import { useSpotlightRuntimeStore as $ } from "../store/runtimeStore.js";
4
5
  import { SPOTLIGHT_PIPELINE_STEP_IDS as s } from "../store/pipeline/constants.js";
5
- import { isLoopPlanningChunk as $, splitIntentStepContent as L, splitToolStepContent as O, composeToolStepContent as H } from "../store/pipeline/displayText.js";
6
- import { getSpotlightConfig as R } from "../plugin.js";
7
- import { executeRemoteHostTool as q, ensureHostToolsManifest as P } from "./hostToolRunner.js";
8
- import { getSpotlightServerBase as I, buildSpotlightJsonHeaders as g, getSpotlightProjectId as D } from "./httpConfig.js";
9
- import { ensureSpotlightMeta as J } from "./meta.js";
6
+ import { isLoopPlanningChunk as L, splitIntentStepContent as O, splitToolStepContent as H, composeToolStepContent as q } from "../store/pipeline/displayText.js";
7
+ import { getSpotlightConfig as k } from "../plugin.js";
8
+ import { getSkillsPoolForRun as D } from "../skills/index.js";
9
+ import { executeRemoteHostTool as J, ensureHostToolsManifest as P } from "./hostToolRunner.js";
10
+ import { getSpotlightServerBase as I, buildSpotlightJsonHeaders as g, getSpotlightProjectId as W } from "./httpConfig.js";
11
+ import { ensureSpotlightMeta as F } from "./meta.js";
10
12
  const T = /* @__PURE__ */ new WeakMap();
11
- function W(t) {
13
+ function j(t) {
12
14
  return t.type !== "host_action_request" && t.type !== "run_completed" && t.type !== "run_error" && t.type !== "ping" && t.type !== "memory_decision";
13
15
  }
14
16
  function c(t, e, o) {
15
- const n = t.getSteps().find((a) => a.id === e);
16
- if (n) return n;
17
- const r = { id: e, label: o, status: "pending" };
18
- return t.setSteps([...t.getSteps(), r]), r;
17
+ const r = t.getSteps().find((a) => a.id === e);
18
+ if (r) return r;
19
+ const n = { id: e, label: o, status: "pending" };
20
+ return t.setSteps([...t.getSteps(), n]), n;
19
21
  }
20
- function j() {
22
+ function z() {
21
23
  return new Promise((t) => {
22
24
  requestAnimationFrame(() => t());
23
25
  });
24
26
  }
25
- function F(t) {
27
+ function B(t) {
26
28
  const e = t.summary?.trim();
27
29
  if (e && e.length > 48 && !e.startsWith("{") && !e.startsWith("["))
28
30
  return e;
@@ -34,8 +36,8 @@ function F(t) {
34
36
  }
35
37
  return e || "";
36
38
  }
37
- function B(t) {
38
- const e = F(t.result);
39
+ function G(t) {
40
+ const e = B(t.result);
39
41
  return {
40
42
  id: t.result.call.id,
41
43
  name: t.result.call.name,
@@ -48,7 +50,7 @@ function B(t) {
48
50
  status: t.result.success ? "done" : "error"
49
51
  };
50
52
  }
51
- function G(t) {
53
+ function U(t) {
52
54
  return {
53
55
  id: t.call.id,
54
56
  name: t.call.name,
@@ -57,7 +59,7 @@ function G(t) {
57
59
  status: "running"
58
60
  };
59
61
  }
60
- function U(t, e) {
62
+ function V(t, e) {
61
63
  const o = e.success ? "前端操作已执行。" : e.error || "前端操作执行失败。";
62
64
  return {
63
65
  id: t.id,
@@ -71,35 +73,35 @@ function U(t, e) {
71
73
  status: e.success ? "done" : "error"
72
74
  };
73
75
  }
74
- function z(t) {
76
+ function Y(t) {
75
77
  return t.startsWith("panel.") || t.startsWith("navigate.") || t.startsWith("session.");
76
78
  }
77
- function V(t, e, o) {
78
- if (!z(e.request.call.name)) return;
79
+ function K(t, e, o) {
80
+ if (!Y(e.request.call.name)) return;
79
81
  c(t, s.tool, "执行工具与回答");
80
- const n = U(e.request.call, o);
81
- t.appendToolCallsToStep(s.tool, [n]), t.setStep(
82
+ const r = V(e.request.call, o);
83
+ t.appendToolCallsToStep(s.tool, [r]), t.setStep(
82
84
  s.tool,
83
85
  o.success ? "done" : "error",
84
- n.resultText
86
+ r.resultText
85
87
  );
86
88
  }
87
89
  function m(t, e) {
88
90
  if (e !== s.tool) return;
89
- const o = t.getSteps().find((n) => n.id === e);
91
+ const o = t.getSteps().find((r) => r.id === e);
90
92
  !o || o.status === "active" || o.status === "done" || t.setStep(e, "active", o.content);
91
93
  }
92
- function b(t, e) {
94
+ function R(t, e) {
93
95
  return e || (t === s.tool ? "执行工具与回答" : t);
94
96
  }
95
- function Y(t) {
97
+ function Q(t) {
96
98
  const e = t.getSteps().find((o) => o.id === s.agent);
97
99
  return e?.label === "检索知识" ? "知识问答" : e?.label === "选择工具" ? "执行工具与回答" : "生成回答";
98
100
  }
99
- function u(t, e, o, n, r) {
100
- c(t, e, o), t.setStep(e, n, r);
101
+ function u(t, e, o, r, n) {
102
+ c(t, e, o), t.setStep(e, r, n);
101
103
  }
102
- function K(t, e) {
104
+ function X(t, e) {
103
105
  const o = e.summary?.trim();
104
106
  switch (e.phase) {
105
107
  case "routing":
@@ -170,7 +172,7 @@ function K(t, e) {
170
172
  return;
171
173
  }
172
174
  }
173
- async function Q(t, e) {
175
+ async function Z(t, e) {
174
176
  if (e.type !== "ping") {
175
177
  if (e.type === "step_sync")
176
178
  t.setSteps(
@@ -178,32 +180,32 @@ async function Q(t, e) {
178
180
  id: o.id,
179
181
  label: o.label,
180
182
  status: o.status,
181
- content: t.getSteps().find((n) => n.id === o.id)?.content
183
+ content: t.getSteps().find((r) => r.id === o.id)?.content
182
184
  }))
183
185
  );
184
186
  else if (e.type === "step_status")
185
187
  c(t, e.stepId, e.label ?? e.stepId), t.setStep(e.stepId, e.status, e.content);
186
188
  else if (e.type === "step_content") {
187
- let o = e.stepId, n = e.content;
188
- if (o === s.intent && $(n))
189
+ let o = e.stepId, r = e.content;
190
+ if (o === s.intent && L(r))
189
191
  o = s.tool;
190
192
  else if (o === s.intent && e.mode === "replace") {
191
- const { intent: r, misplacedPlanning: a } = L(n);
192
- n = r, a.trim() && (c(t, s.tool, "执行工具与回答"), t.appendChunkToStep(
193
+ const { intent: n, misplacedPlanning: a } = O(r);
194
+ r = n, a.trim() && (c(t, s.tool, "执行工具与回答"), t.appendChunkToStep(
193
195
  s.tool,
194
196
  a
195
197
  ));
196
198
  }
197
- c(t, o, b(o, e.label)), e.mode === "replace" ? t.setStep(
199
+ c(t, o, R(o, e.label)), e.mode === "replace" ? t.setStep(
198
200
  o,
199
- t.getSteps().find((r) => r.id === o)?.status ?? "active",
200
- n
201
- ) : (m(t, o), t.appendChunkToStep(o, n), await j());
201
+ t.getSteps().find((n) => n.id === o)?.status ?? "active",
202
+ r
203
+ ) : (m(t, o), t.appendChunkToStep(o, r), await z());
202
204
  } else if (e.type === "step_artifact")
203
- c(t, e.stepId, b(e.stepId, e.label)), m(t, e.stepId), e.artifact === "tool_calls" && e.toolCalls?.length ? t.appendToolCallsToStep(e.stepId, e.toolCalls) : e.artifact === "attachments" && e.attachments?.length ? t.appendAttachmentsToStep(e.stepId, e.attachments) : e.artifact === "files" && e.files?.length ? t.appendFilesToStep(e.stepId, e.files) : e.artifact === "artifacts" && e.artifacts?.length ? t.appendArtifactsToStep(e.stepId, e.artifacts) : e.artifact === "chat_items" && e.chatItems?.length && t.appendChatItemsToStep(e.stepId, e.chatItems);
205
+ c(t, e.stepId, R(e.stepId, e.label)), m(t, e.stepId), e.artifact === "tool_calls" && e.toolCalls?.length ? t.appendToolCallsToStep(e.stepId, e.toolCalls) : e.artifact === "attachments" && e.attachments?.length ? t.appendAttachmentsToStep(e.stepId, e.attachments) : e.artifact === "files" && e.files?.length ? t.appendFilesToStep(e.stepId, e.files) : e.artifact === "artifacts" && e.artifacts?.length ? t.appendArtifactsToStep(e.stepId, e.artifacts) : e.artifact === "chat_items" && e.chatItems?.length && t.appendChatItemsToStep(e.stepId, e.chatItems);
204
206
  else if (e.type === "tool_start")
205
207
  c(t, s.tool, "执行工具与回答"), m(t, s.tool), t.appendToolCallsToStep(s.tool, [
206
- G(e)
208
+ U(e)
207
209
  ]);
208
210
  else if (e.type === "tool_progress")
209
211
  c(t, s.tool, "执行工具与回答"), m(t, s.tool), t.appendToolCallsToStep(s.tool, [
@@ -218,7 +220,7 @@ async function Q(t, e) {
218
220
  ]);
219
221
  else if (e.type === "tool_result")
220
222
  c(t, s.tool, "执行工具与回答"), m(t, s.tool), t.appendToolCallsToStep(s.tool, [
221
- B(e)
223
+ G(e)
222
224
  ]), e.result.attachments?.length && t.appendAttachmentsToStep(
223
225
  s.tool,
224
226
  e.result.attachments
@@ -246,7 +248,7 @@ async function Q(t, e) {
246
248
  `
247
249
  );
248
250
  else if (e.type === "turn_transition")
249
- K(t, e);
251
+ X(t, e);
250
252
  else if (e.type === "memory_decision") {
251
253
  c(t, s.breakdown, "问题拆解");
252
254
  const o = {
@@ -264,21 +266,21 @@ async function Q(t, e) {
264
266
  c(
265
267
  t,
266
268
  s.tool,
267
- Y(t)
269
+ Q(t)
268
270
  );
269
- const o = t.getSteps().find((S) => S.id === s.tool), { planning: n, answer: r } = O(o?.content ?? ""), a = e.content.trim(), i = r.trim();
271
+ const o = t.getSteps().find((S) => S.id === s.tool), { planning: r, answer: n } = H(o?.content ?? ""), a = e.content.trim(), i = n.trim();
270
272
  i && a && (i === a || a.startsWith(
271
273
  i.slice(0, Math.min(i.length, 80))
272
274
  )) ? t.setStep(s.tool, "done") : t.setStep(
273
275
  s.tool,
274
276
  "done",
275
- H(n, a)
277
+ q(r, a)
276
278
  );
277
279
  }
278
- W(e) && t.appendExecutionEvent?.(e);
280
+ j(e) && t.appendExecutionEvent?.(e);
279
281
  }
280
282
  }
281
- async function X(t) {
283
+ async function v(t) {
282
284
  await fetch(
283
285
  `${I()}/v1/runs/${encodeURIComponent(t.runId)}/host-results`,
284
286
  {
@@ -296,10 +298,10 @@ async function X(t) {
296
298
  }
297
299
  );
298
300
  }
299
- function Z(t) {
301
+ function tt(t) {
300
302
  const e = t.split(/\n\n/u), o = e.pop() ?? "";
301
- return { events: e.flatMap((r) => {
302
- const a = r.split(/\n/u).find((i) => i.startsWith("data: "));
303
+ return { events: e.flatMap((n) => {
304
+ const a = n.split(/\n/u).find((i) => i.startsWith("data: "));
303
305
  if (!a) return [];
304
306
  try {
305
307
  return [JSON.parse(a.slice(6))];
@@ -308,61 +310,62 @@ function Z(t) {
308
310
  }
309
311
  }), rest: o };
310
312
  }
311
- async function ct(t) {
313
+ async function pt(t) {
312
314
  await Promise.allSettled([
313
315
  P(),
314
- J(t)
316
+ F(t)
315
317
  ]);
316
318
  }
317
- async function v(t, e, o) {
318
- const n = k(), r = M(), a = A(), i = await P();
319
+ async function et(t, e, o) {
320
+ const r = b(), n = $(), a = M(), i = await P();
319
321
  return {
320
322
  hostManifest: i,
321
323
  payload: {
322
- projectId: D(),
323
- sessionId: n.sessionId,
324
- memorySubjectId: R().getMemorySubjectId?.() ?? void 0,
324
+ projectId: W(),
325
+ sessionId: r.sessionId,
326
+ memorySubjectId: k().getMemorySubjectId?.() ?? void 0,
325
327
  userQuestion: t,
326
328
  memoryRefreshRequested: o?.forceMemoryRefresh === !0,
327
- uiContext: R().getUiContext?.() ?? {},
329
+ uiContext: k().getUiContext?.() ?? {},
328
330
  sessionState: {
329
- sessionId: n.sessionId,
330
- activeTaskId: n.activeTaskId,
331
- activeTopic: n.activeTopic,
332
- pendingTask: n.pendingTask,
333
- conversationSummary: n.conversationSummary,
334
- summarizedTurnCount: n.summarizedTurnCount,
335
- conversationHistory: n.conversationHistory,
336
- lastAssistantReply: n.getLastAssistantContent(),
337
- invokedSkills: n.invokedSkills,
338
- skillPermissionGrants: n.skillPermissionGrants,
331
+ sessionId: r.sessionId,
332
+ activeTaskId: r.activeTaskId,
333
+ activeTopic: r.activeTopic,
334
+ pendingTask: r.pendingTask,
335
+ conversationSummary: r.conversationSummary,
336
+ summarizedTurnCount: r.summarizedTurnCount,
337
+ conversationHistory: r.conversationHistory,
338
+ lastAssistantReply: r.getLastAssistantContent(),
339
+ invokedSkills: r.invokedSkills,
340
+ skillPermissionGrants: r.skillPermissionGrants,
339
341
  memoryReadEnabled: a.enabled,
340
342
  memoryWriteEnabled: !0
341
343
  },
342
344
  runtimeState: {
343
- activeDomain: r.activeDomain,
344
- activeTarget: r.activeTarget,
345
- activeAction: r.activeAction,
346
- resumableAction: r.resumableAction,
347
- lastResolvedTarget: r.lastResolvedTarget
345
+ activeDomain: n.activeDomain,
346
+ activeTarget: n.activeTarget,
347
+ activeAction: n.activeAction,
348
+ resumableAction: n.resumableAction,
349
+ lastResolvedTarget: n.lastResolvedTarget
348
350
  },
349
351
  clientToolsManifestVersion: i.manifestDigest,
350
352
  clientToolManifest: i,
353
+ skills: A(D()),
351
354
  frontendBuildId: i.frontendBuildId,
352
355
  manifestDigest: i.manifestDigest
353
356
  }
354
357
  };
355
358
  }
356
- async function ut(t, e, o) {
357
- const n = I(), r = e.getSignal(), { payload: a, hostManifest: i } = await v(
359
+ async function ft(t, e, o) {
360
+ const r = I(), n = e.getSignal(), { payload: a, hostManifest: i } = await et(
358
361
  t,
359
- r,
362
+ n,
360
363
  o
361
- ), S = new Set(i.tools.map((d) => d.name)), p = await fetch(`${n}/v1/runs`, {
364
+ ), S = new Set(i.tools.map((d) => d.name)), p = await fetch(`${r}/v1/runs`, {
362
365
  method: "POST",
363
366
  headers: g(),
364
367
  body: JSON.stringify(a),
365
- signal: r
368
+ signal: n
366
369
  });
367
370
  if (!p.ok) {
368
371
  const d = await p.text().catch(() => "");
@@ -371,7 +374,7 @@ async function ut(t, e, o) {
371
374
  );
372
375
  }
373
376
  const { runId: f } = await p.json();
374
- r && (T.set(r, f), r.addEventListener(
377
+ n && (T.set(n, f), n.addEventListener(
375
378
  "abort",
376
379
  () => {
377
380
  N(f);
@@ -379,10 +382,10 @@ async function ut(t, e, o) {
379
382
  { once: !0 }
380
383
  ));
381
384
  const y = await fetch(
382
- `${n}/v1/runs/${encodeURIComponent(f)}/events`,
385
+ `${r}/v1/runs/${encodeURIComponent(f)}/events`,
383
386
  {
384
387
  headers: g(),
385
- signal: r
388
+ signal: n
386
389
  }
387
390
  );
388
391
  if (!y.ok || !y.body)
@@ -394,26 +397,26 @@ async function ut(t, e, o) {
394
397
  const { done: d, value: E } = await C.read();
395
398
  if (d) break;
396
399
  h += x.decode(E, { stream: !0 });
397
- const w = Z(h);
400
+ const w = tt(h);
398
401
  h = w.rest;
399
402
  for (const l of w.events) {
400
403
  if (l.type === "host_action_request") {
401
- const _ = await q(l.request.call, e, {
404
+ const _ = await J(l.request.call, e, {
402
405
  allowedHostNames: S,
403
406
  hostEffect: l.request.hostEffect
404
407
  });
405
- V(e, l, _), await X({
408
+ K(e, l, _), await v({
406
409
  runId: f,
407
410
  correlationId: l.request.correlationId,
408
411
  result: _,
409
- signal: r
412
+ signal: n
410
413
  });
411
414
  continue;
412
415
  }
413
416
  if (l.type === "run_error")
414
417
  throw new Error(l.error);
415
- if (await Q(e, l), l.type === "run_completed")
416
- return l.sessionPatch && k().applySessionPatch(l.sessionPatch), {
418
+ if (await Z(e, l), l.type === "run_completed")
419
+ return l.sessionPatch && b().applySessionPatch(l.sessionPatch), {
417
420
  command: null,
418
421
  memoryReplay: l.memoryReplay ?? null,
419
422
  memoryDecision: l.memoryDecision ?? null,
@@ -437,16 +440,16 @@ async function N(t) {
437
440
  }
438
441
  );
439
442
  }
440
- function dt(t) {
443
+ function yt(t) {
441
444
  if (!t) return;
442
445
  const e = T.get(t);
443
446
  e && (T.delete(t), N(e));
444
447
  }
445
448
  export {
446
- K as applyLangGraphTransition,
449
+ X as applyLangGraphTransition,
447
450
  N as cancelRemoteSpotlightRun,
448
- dt as cancelRemoteSpotlightRunForSignal,
449
- Y as responseStepLabel,
450
- ut as runRemoteSpotlightPipeline,
451
- ct as warmupSpotlightRemoteContext
451
+ yt as cancelRemoteSpotlightRunForSignal,
452
+ Q as responseStepLabel,
453
+ ft as runRemoteSpotlightPipeline,
454
+ pt as warmupSpotlightRemoteContext
452
455
  };
@@ -1 +1 @@
1
- {"version":3,"file":"skillFrontmatterParse.d.ts","sourceRoot":"","sources":["../../src/skills/skillFrontmatterParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,8BAA8B,CAAC;AAoNtC,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,cAAc,CAoEhB"}
1
+ {"version":3,"file":"skillFrontmatterParse.d.ts","sourceRoot":"","sources":["../../src/skills/skillFrontmatterParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,8BAA8B,CAAC;AAoNtC,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,cAAc,CAsEhB"}
@@ -1,31 +1,31 @@
1
- import { parse as W } from "yaml";
2
- function N(n) {
3
- return typeof n == "object" && n !== null && !Array.isArray(n);
1
+ import { parse as C } from "yaml";
2
+ function W(e) {
3
+ return typeof e == "object" && e !== null && !Array.isArray(e);
4
4
  }
5
- function C(n) {
6
- const e = n.replace(/\r\n/g, `
5
+ function F(e) {
6
+ const n = e.replace(/\r\n/g, `
7
7
  `).trim();
8
- if (!e.startsWith(`---
8
+ if (!n.startsWith(`---
9
9
  `))
10
- return { frontmatter: "", body: e };
11
- const t = e.indexOf(`
10
+ return { frontmatter: "", body: n };
11
+ const t = n.indexOf(`
12
12
  ---
13
13
  `, 4);
14
- return t === -1 ? { frontmatter: "", body: e } : {
15
- frontmatter: e.slice(4, t).trim(),
16
- body: e.slice(t + 5).trim()
14
+ return t === -1 ? { frontmatter: "", body: n } : {
15
+ frontmatter: n.slice(4, t).trim(),
16
+ body: n.slice(t + 5).trim()
17
17
  };
18
18
  }
19
- function F(n) {
20
- const e = n.trim();
21
- if (!e) return {};
19
+ function B(e) {
20
+ const n = e.trim();
21
+ if (!n) return {};
22
22
  try {
23
- const o = W(e);
24
- if (N(o)) return o;
23
+ const o = C(n);
24
+ if (W(o)) return o;
25
25
  } catch {
26
26
  }
27
27
  const t = {};
28
- for (const o of n.split(`
28
+ for (const o of e.split(`
29
29
  `)) {
30
30
  const r = o.trim();
31
31
  if (!r || r.startsWith("#")) continue;
@@ -36,16 +36,16 @@ function F(n) {
36
36
  }
37
37
  return t;
38
38
  }
39
- function B(n) {
40
- const { frontmatter: e, body: t } = C(n);
41
- return { data: F(e), body: t };
39
+ function D(e) {
40
+ const { frontmatter: n, body: t } = F(e);
41
+ return { data: B(n), body: t };
42
42
  }
43
- function l(n) {
44
- return n.startsWith('"') && n.endsWith('"') || n.startsWith("'") && n.endsWith("'") ? n.slice(1, -1).trim() : n;
43
+ function l(e) {
44
+ return e.startsWith('"') && e.endsWith('"') || e.startsWith("'") && e.endsWith("'") ? e.slice(1, -1).trim() : e;
45
45
  }
46
- function s(n, ...e) {
47
- for (const t of e) {
48
- const o = n[t];
46
+ function s(e, ...n) {
47
+ for (const t of n) {
48
+ const o = e[t];
49
49
  if (typeof o == "string") {
50
50
  const r = l(o.trim());
51
51
  if (r) return r;
@@ -53,29 +53,29 @@ function s(n, ...e) {
53
53
  if (typeof o == "number" && Number.isFinite(o)) return String(o);
54
54
  }
55
55
  }
56
- function D(n) {
57
- if (n != null) {
58
- if (Array.isArray(n)) {
59
- const e = n.filter((t) => typeof t == "string").map((t) => l(t.trim())).filter(Boolean);
60
- return e.length ? e : void 0;
56
+ function H(e) {
57
+ if (e != null) {
58
+ if (Array.isArray(e)) {
59
+ const n = e.filter((t) => typeof t == "string").map((t) => l(t.trim())).filter(Boolean);
60
+ return n.length ? n : void 0;
61
61
  }
62
- if (typeof n == "string") {
63
- const e = n.replace(/^\[/, "").replace(/\]$/, "").trim();
64
- if (!e) return;
65
- const t = e.split(",").map((o) => l(o.trim())).filter(Boolean);
62
+ if (typeof e == "string") {
63
+ const n = e.replace(/^\[/, "").replace(/\]$/, "").trim();
64
+ if (!n) return;
65
+ const t = n.split(",").map((o) => l(o.trim())).filter(Boolean);
66
66
  return t.length ? t : void 0;
67
67
  }
68
68
  }
69
69
  }
70
- function a(n, ...e) {
71
- for (const t of e) {
72
- const o = D(n[t]);
70
+ function a(e, ...n) {
71
+ for (const t of n) {
72
+ const o = H(e[t]);
73
73
  if (o?.length) return o;
74
74
  }
75
75
  }
76
- function A(n, ...e) {
77
- for (const t of e) {
78
- const o = n[t];
76
+ function N(e, ...n) {
77
+ for (const t of n) {
78
+ const o = e[t];
79
79
  if (typeof o == "boolean") return o;
80
80
  if (typeof o == "string") {
81
81
  const r = o.trim().toLowerCase();
@@ -84,22 +84,22 @@ function A(n, ...e) {
84
84
  }
85
85
  }
86
86
  }
87
- const H = /* @__PURE__ */ new Set([
87
+ const M = /* @__PURE__ */ new Set([
88
88
  "direct_answer",
89
89
  "tool_answer",
90
90
  "clarify"
91
91
  ]);
92
- function M(n) {
93
- const e = s(
94
- n,
92
+ function O(e) {
93
+ const n = s(
94
+ e,
95
95
  "spotlight-response-strategy",
96
96
  "response-strategy",
97
97
  "responseStrategy"
98
98
  );
99
- if (e)
100
- return H.has(e) ? e : void 0;
99
+ if (n)
100
+ return M.has(n) ? n : void 0;
101
101
  }
102
- const O = /* @__PURE__ */ new Set([
102
+ const $ = /* @__PURE__ */ new Set([
103
103
  "video_channel",
104
104
  "bim_model",
105
105
  "device",
@@ -107,96 +107,96 @@ const O = /* @__PURE__ */ new Set([
107
107
  "panel",
108
108
  "scene_target"
109
109
  ]);
110
- function $(n) {
111
- const e = a(
112
- n,
110
+ function P(e) {
111
+ const n = a(
112
+ e,
113
113
  "spotlight-asset-types",
114
114
  "asset-types",
115
115
  "assetTypes"
116
116
  );
117
- if (!e) return;
118
- const t = e.filter(
119
- (o) => O.has(o)
117
+ if (!n) return;
118
+ const t = n.filter(
119
+ (o) => $.has(o)
120
120
  );
121
121
  return t.length ? Array.from(new Set(t)) : void 0;
122
122
  }
123
- function P(n) {
124
- const e = s(n, "context", "execution-context", "executionContext");
125
- if (!e) return;
126
- const t = e.toLowerCase();
123
+ function R(e) {
124
+ const n = s(e, "context", "execution-context", "executionContext");
125
+ if (!n) return;
126
+ const t = n.toLowerCase();
127
127
  if (t === "fork") return "fork";
128
128
  if (t === "inline") return "inline";
129
129
  }
130
- function R(n) {
131
- const e = n.hooks;
132
- if (N(e)) return e;
130
+ function U(e) {
131
+ const n = e.hooks;
132
+ if (W(n)) return n;
133
133
  }
134
- function U(n) {
135
- const e = n.replace(/\\/g, "/").split("/").filter(Boolean), t = e[e.length - 1];
136
- if (t && /^SKILL\.md$/iu.test(t) && e.length >= 2)
137
- return e[e.length - 2];
134
+ function j(e) {
135
+ const n = e.replace(/\\/g, "/").split("/").filter(Boolean), t = n[n.length - 1];
136
+ if (t && /^SKILL\.md$/iu.test(t) && n.length >= 2)
137
+ return n[n.length - 2];
138
138
  if (t?.toLowerCase().endsWith(".skill.md"))
139
139
  return t.replace(/\.SKILL\.md$/iu, "");
140
140
  }
141
- function j(n) {
142
- return n.split(`
141
+ function z(e) {
142
+ return e.split(`
143
143
  `).map((t) => t.trim()).find((t) => t && !t.startsWith("#")) ?? "未提供技能描述";
144
144
  }
145
- function K(n, e) {
146
- const { data: t, body: o } = B(n), r = s(t, "name"), c = s(t, "id") ?? U(e);
145
+ function V(e, n) {
146
+ const { data: t, body: o } = D(e), r = s(t, "name"), c = s(t, "id") ?? j(n);
147
147
  if (!c)
148
- throw new Error(`技能文件缺少 id 且无法从路径推断:${e}`);
149
- const f = s(t, "description") ?? j(o), i = {
148
+ throw new Error(`技能文件缺少 id 且无法从路径推断:${n}`);
149
+ const f = s(t, "description") ?? z(o), i = {
150
150
  name: c,
151
151
  description: f
152
- };
153
- r && (i.displayName = r);
154
- const u = s(t, "when_to_use", "whenToUse");
155
- u && (i.whenToUse = u);
156
- const d = a(t, "allowed-tools", "allowedTools");
157
- d && (i.allowedTools = d);
158
- const p = s(t, "argument-hint", "argumentHint");
159
- p && (i.argumentHint = p);
160
- const m = a(
152
+ }, u = o.trim();
153
+ u && (i.skillInstructionBody = u), r && (i.displayName = r);
154
+ const d = s(t, "when_to_use", "whenToUse");
155
+ d && (i.whenToUse = d);
156
+ const p = a(t, "allowed-tools", "allowedTools");
157
+ p && (i.allowedTools = p);
158
+ const m = s(t, "argument-hint", "argumentHint");
159
+ m && (i.argumentHint = m);
160
+ const y = a(
161
161
  t,
162
162
  "arguments",
163
163
  "argument-names",
164
164
  "argumentNames"
165
165
  );
166
- m && (i.argNames = m);
167
- const y = a(t, "keywords");
168
- y && (i.keywords = y);
169
- const g = M(t);
170
- g && (i.responseStrategy = g);
171
- const h = $(t);
172
- h && (i.assetTypes = h);
173
- const k = a(t, "capability-examples", "capabilityExamples");
174
- k && (i.capabilityExamples = k);
175
- const S = s(t, "version");
176
- S && (i.version = S);
177
- const v = s(t, "model");
178
- v && (i.model = v);
179
- const w = A(
166
+ y && (i.argNames = y);
167
+ const g = a(t, "keywords");
168
+ g && (i.keywords = g);
169
+ const h = O(t);
170
+ h && (i.responseStrategy = h);
171
+ const k = P(t);
172
+ k && (i.assetTypes = k);
173
+ const S = a(t, "capability-examples", "capabilityExamples");
174
+ S && (i.capabilityExamples = S);
175
+ const v = s(t, "version");
176
+ v && (i.version = v);
177
+ const w = s(t, "model");
178
+ w && (i.model = w);
179
+ const b = N(
180
180
  t,
181
181
  "disable-model-invocation",
182
182
  "disableModelInvocation"
183
183
  );
184
- w !== void 0 && (i.disableModelInvocation = w);
185
- const b = A(t, "user-invocable", "userInvocable");
186
- b !== void 0 && (i.userInvocable = b);
187
- const x = a(t, "paths");
188
- x && (i.paths = x);
189
- const T = P(t);
190
- T && (i.executionContext = T);
184
+ b !== void 0 && (i.disableModelInvocation = b);
185
+ const x = N(t, "user-invocable", "userInvocable");
186
+ x !== void 0 && (i.userInvocable = x);
187
+ const T = a(t, "paths");
188
+ T && (i.paths = T);
189
+ const I = R(t);
190
+ I && (i.executionContext = I);
191
191
  const E = s(t, "agent");
192
192
  E && (i.agent = E);
193
- const I = s(t, "effort") ?? (typeof t.effort == "number" && Number.isFinite(t.effort) ? String(t.effort) : void 0);
194
- I && (i.effort = I);
195
- const L = R(t);
196
- L && (i.hooks = L);
197
- const _ = s(t, "shell");
198
- return _ && (i.shell = _), i;
193
+ const L = s(t, "effort") ?? (typeof t.effort == "number" && Number.isFinite(t.effort) ? String(t.effort) : void 0);
194
+ L && (i.effort = L);
195
+ const _ = U(t);
196
+ _ && (i.hooks = _);
197
+ const A = s(t, "shell");
198
+ return A && (i.shell = A), i;
199
199
  }
200
200
  export {
201
- K as parseSpotlightSkillMarkdownFields
201
+ V as parseSpotlightSkillMarkdownFields
202
202
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
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.5.6",
95
- "@inupedia/spotlight-protocol": "0.5.6"
94
+ "@inupedia/spotlight-protocol": "0.5.8",
95
+ "@inupedia/spotlight-client": "0.5.8"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "@inspira-ui/plugins": "^0.0.2",