@inupedia/spotlight-vue 0.5.9 → 0.5.10

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":"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
+ {"version":3,"file":"skillFrontmatterParse.d.ts","sourceRoot":"","sources":["../../src/skills/skillFrontmatterParse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,8BAA8B,CAAC;AAmOtC,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,cAAc,CAwEhB"}
@@ -1,81 +1,92 @@
1
- import { parse as C } from "yaml";
2
- function W(e) {
3
- return typeof e == "object" && e !== null && !Array.isArray(e);
1
+ import { parse as F } from "yaml";
2
+ function C(n) {
3
+ return typeof n == "object" && n !== null && !Array.isArray(n);
4
4
  }
5
- function F(e) {
6
- const n = e.replace(/\r\n/g, `
5
+ function B(n) {
6
+ const e = n.replace(/\r\n/g, `
7
7
  `).trim();
8
- if (!n.startsWith(`---
8
+ if (!e.startsWith(`---
9
9
  `))
10
- return { frontmatter: "", body: n };
11
- const t = n.indexOf(`
10
+ return { frontmatter: "", body: e };
11
+ const t = e.indexOf(`
12
12
  ---
13
13
  `, 4);
14
- return t === -1 ? { frontmatter: "", body: n } : {
15
- frontmatter: n.slice(4, t).trim(),
16
- body: n.slice(t + 5).trim()
14
+ return t === -1 ? { frontmatter: "", body: e } : {
15
+ frontmatter: e.slice(4, t).trim(),
16
+ body: e.slice(t + 5).trim()
17
17
  };
18
18
  }
19
- function B(e) {
20
- const n = e.trim();
21
- if (!n) return {};
19
+ function M(n) {
20
+ const e = n.trim();
21
+ if (!e) return {};
22
22
  try {
23
- const o = C(n);
24
- if (W(o)) return o;
23
+ const o = F(e);
24
+ if (C(o)) return o;
25
25
  } catch {
26
26
  }
27
27
  const t = {};
28
- for (const o of e.split(`
28
+ for (const o of n.split(`
29
29
  `)) {
30
30
  const r = o.trim();
31
31
  if (!r || r.startsWith("#")) continue;
32
32
  const c = r.indexOf(":");
33
33
  if (c <= 0) continue;
34
- const f = r.slice(0, c).trim(), i = r.slice(c + 1).trim();
35
- t[f] = i;
34
+ const l = r.slice(0, c).trim(), i = r.slice(c + 1).trim();
35
+ t[l] = i;
36
36
  }
37
37
  return t;
38
38
  }
39
- function D(e) {
40
- const { frontmatter: n, body: t } = F(e);
41
- return { data: B(n), body: t };
39
+ function O(n) {
40
+ const { frontmatter: e, body: t } = B(n);
41
+ return { data: M(e), body: t };
42
42
  }
43
- function l(e) {
44
- return e.startsWith('"') && e.endsWith('"') || e.startsWith("'") && e.endsWith("'") ? e.slice(1, -1).trim() : e;
43
+ function f(n) {
44
+ return n.startsWith('"') && n.endsWith('"') || n.startsWith("'") && n.endsWith("'") ? n.slice(1, -1).trim() : n;
45
45
  }
46
- function s(e, ...n) {
47
- for (const t of n) {
48
- const o = e[t];
46
+ function s(n, ...e) {
47
+ for (const t of e) {
48
+ const o = n[t];
49
49
  if (typeof o == "string") {
50
- const r = l(o.trim());
50
+ const r = f(o.trim());
51
51
  if (r) return r;
52
52
  }
53
53
  if (typeof o == "number" && Number.isFinite(o)) return String(o);
54
54
  }
55
55
  }
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;
56
+ function D(n) {
57
+ if (n != null) {
58
+ if (Array.isArray(n)) {
59
+ const e = n.filter((t) => typeof t == "string").map((t) => f(t.trim())).filter(Boolean);
60
+ return e.length ? e : void 0;
61
61
  }
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);
62
+ if (typeof n == "string") {
63
+ const e = n.replace(/^\[/, "").replace(/\]$/, "").trim();
64
+ if (!e) return;
65
+ const t = e.split(",").map((o) => f(o.trim())).filter(Boolean);
66
66
  return t.length ? t : void 0;
67
67
  }
68
68
  }
69
69
  }
70
- function a(e, ...n) {
71
- for (const t of n) {
72
- const o = H(e[t]);
70
+ function a(n, ...e) {
71
+ for (const t of e) {
72
+ const o = D(n[t]);
73
73
  if (o?.length) return o;
74
74
  }
75
75
  }
76
- function N(e, ...n) {
77
- for (const t of n) {
78
- const o = e[t];
76
+ function H(n) {
77
+ const e = a(n, "tool-examples", "toolExamples");
78
+ if (!e) return;
79
+ const t = e.flatMap((o) => {
80
+ const r = o.lastIndexOf("=>");
81
+ if (r <= 0) return [];
82
+ const c = o.slice(0, r).trim(), l = o.slice(r + 2).trim();
83
+ return c && l ? [{ example: c, toolName: l }] : [];
84
+ });
85
+ return t.length ? t : void 0;
86
+ }
87
+ function W(n, ...e) {
88
+ for (const t of e) {
89
+ const o = n[t];
79
90
  if (typeof o == "boolean") return o;
80
91
  if (typeof o == "string") {
81
92
  const r = o.trim().toLowerCase();
@@ -84,22 +95,22 @@ function N(e, ...n) {
84
95
  }
85
96
  }
86
97
  }
87
- const M = /* @__PURE__ */ new Set([
98
+ const $ = /* @__PURE__ */ new Set([
88
99
  "direct_answer",
89
100
  "tool_answer",
90
101
  "clarify"
91
102
  ]);
92
- function O(e) {
93
- const n = s(
94
- e,
103
+ function P(n) {
104
+ const e = s(
105
+ n,
95
106
  "spotlight-response-strategy",
96
107
  "response-strategy",
97
108
  "responseStrategy"
98
109
  );
99
- if (n)
100
- return M.has(n) ? n : void 0;
110
+ if (e)
111
+ return $.has(e) ? e : void 0;
101
112
  }
102
- const $ = /* @__PURE__ */ new Set([
113
+ const R = /* @__PURE__ */ new Set([
103
114
  "video_channel",
104
115
  "bim_model",
105
116
  "device",
@@ -107,48 +118,48 @@ const $ = /* @__PURE__ */ new Set([
107
118
  "panel",
108
119
  "scene_target"
109
120
  ]);
110
- function P(e) {
111
- const n = a(
112
- e,
121
+ function U(n) {
122
+ const e = a(
123
+ n,
113
124
  "spotlight-asset-types",
114
125
  "asset-types",
115
126
  "assetTypes"
116
127
  );
117
- if (!n) return;
118
- const t = n.filter(
119
- (o) => $.has(o)
128
+ if (!e) return;
129
+ const t = e.filter(
130
+ (o) => R.has(o)
120
131
  );
121
132
  return t.length ? Array.from(new Set(t)) : void 0;
122
133
  }
123
- function R(e) {
124
- const n = s(e, "context", "execution-context", "executionContext");
125
- if (!n) return;
126
- const t = n.toLowerCase();
134
+ function j(n) {
135
+ const e = s(n, "context", "execution-context", "executionContext");
136
+ if (!e) return;
137
+ const t = e.toLowerCase();
127
138
  if (t === "fork") return "fork";
128
139
  if (t === "inline") return "inline";
129
140
  }
130
- function U(e) {
131
- const n = e.hooks;
132
- if (W(n)) return n;
141
+ function z(n) {
142
+ const e = n.hooks;
143
+ if (C(e)) return e;
133
144
  }
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];
145
+ function K(n) {
146
+ const e = n.replace(/\\/g, "/").split("/").filter(Boolean), t = e[e.length - 1];
147
+ if (t && /^SKILL\.md$/iu.test(t) && e.length >= 2)
148
+ return e[e.length - 2];
138
149
  if (t?.toLowerCase().endsWith(".skill.md"))
139
150
  return t.replace(/\.SKILL\.md$/iu, "");
140
151
  }
141
- function z(e) {
142
- return e.split(`
152
+ function V(n) {
153
+ return n.split(`
143
154
  `).map((t) => t.trim()).find((t) => t && !t.startsWith("#")) ?? "未提供技能描述";
144
155
  }
145
- function V(e, n) {
146
- const { data: t, body: o } = D(e), r = s(t, "name"), c = s(t, "id") ?? j(n);
156
+ function G(n, e) {
157
+ const { data: t, body: o } = O(n), r = s(t, "name"), c = s(t, "id") ?? K(e);
147
158
  if (!c)
148
- throw new Error(`技能文件缺少 id 且无法从路径推断:${n}`);
149
- const f = s(t, "description") ?? z(o), i = {
159
+ throw new Error(`技能文件缺少 id 且无法从路径推断:${e}`);
160
+ const l = s(t, "description") ?? V(o), i = {
150
161
  name: c,
151
- description: f
162
+ description: l
152
163
  }, u = o.trim();
153
164
  u && (i.skillInstructionBody = u), r && (i.displayName = r);
154
165
  const d = s(t, "when_to_use", "whenToUse");
@@ -166,37 +177,39 @@ function V(e, n) {
166
177
  y && (i.argNames = y);
167
178
  const g = a(t, "keywords");
168
179
  g && (i.keywords = g);
169
- const h = O(t);
180
+ const h = P(t);
170
181
  h && (i.responseStrategy = h);
171
- const k = P(t);
182
+ const k = U(t);
172
183
  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);
184
+ const x = a(t, "capability-examples", "capabilityExamples");
185
+ x && (i.capabilityExamples = x);
186
+ const v = H(t);
187
+ v && (i.toolExamples = v);
188
+ const S = s(t, "version");
189
+ S && (i.version = S);
177
190
  const w = s(t, "model");
178
191
  w && (i.model = w);
179
- const b = N(
192
+ const b = W(
180
193
  t,
181
194
  "disable-model-invocation",
182
195
  "disableModelInvocation"
183
196
  );
184
197
  b !== void 0 && (i.disableModelInvocation = b);
185
- const x = N(t, "user-invocable", "userInvocable");
186
- x !== void 0 && (i.userInvocable = x);
198
+ const E = W(t, "user-invocable", "userInvocable");
199
+ E !== void 0 && (i.userInvocable = E);
187
200
  const T = a(t, "paths");
188
201
  T && (i.paths = T);
189
- const I = R(t);
202
+ const I = j(t);
190
203
  I && (i.executionContext = I);
191
- const E = s(t, "agent");
192
- E && (i.agent = E);
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;
204
+ const L = s(t, "agent");
205
+ L && (i.agent = L);
206
+ const _ = s(t, "effort") ?? (typeof t.effort == "number" && Number.isFinite(t.effort) ? String(t.effort) : void 0);
207
+ _ && (i.effort = _);
208
+ const A = z(t);
209
+ A && (i.hooks = A);
210
+ const N = s(t, "shell");
211
+ return N && (i.shell = N), i;
199
212
  }
200
213
  export {
201
- V as parseSpotlightSkillMarkdownFields
214
+ G as parseSpotlightSkillMarkdownFields
202
215
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
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.9",
95
- "@inupedia/spotlight-protocol": "0.5.9"
94
+ "@inupedia/spotlight-client": "0.5.10",
95
+ "@inupedia/spotlight-protocol": "0.5.10"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "@inspira-ui/plugins": "^0.0.2",