@inupedia/spotlight-vue 0.5.7 → 0.5.9

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,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.7",
3
+ "version": "0.5.9",
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.7",
95
- "@inupedia/spotlight-protocol": "0.5.7"
94
+ "@inupedia/spotlight-client": "0.5.9",
95
+ "@inupedia/spotlight-protocol": "0.5.9"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "@inspira-ui/plugins": "^0.0.2",