@inupedia/spotlight-vue 0.5.8 → 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;
|
|
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
|
|
2
|
-
function
|
|
3
|
-
return typeof
|
|
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
|
|
6
|
-
const
|
|
5
|
+
function B(n) {
|
|
6
|
+
const e = n.replace(/\r\n/g, `
|
|
7
7
|
`).trim();
|
|
8
|
-
if (!
|
|
8
|
+
if (!e.startsWith(`---
|
|
9
9
|
`))
|
|
10
|
-
return { frontmatter: "", body:
|
|
11
|
-
const t =
|
|
10
|
+
return { frontmatter: "", body: e };
|
|
11
|
+
const t = e.indexOf(`
|
|
12
12
|
---
|
|
13
13
|
`, 4);
|
|
14
|
-
return t === -1 ? { frontmatter: "", body:
|
|
15
|
-
frontmatter:
|
|
16
|
-
body:
|
|
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
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
19
|
+
function M(n) {
|
|
20
|
+
const e = n.trim();
|
|
21
|
+
if (!e) return {};
|
|
22
22
|
try {
|
|
23
|
-
const o =
|
|
24
|
-
if (
|
|
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
|
|
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
|
|
35
|
-
t[
|
|
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
|
|
40
|
-
const { frontmatter:
|
|
41
|
-
return { data:
|
|
39
|
+
function O(n) {
|
|
40
|
+
const { frontmatter: e, body: t } = B(n);
|
|
41
|
+
return { data: M(e), body: t };
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
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(
|
|
47
|
-
for (const t of
|
|
48
|
-
const o =
|
|
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 =
|
|
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
|
|
57
|
-
if (
|
|
58
|
-
if (Array.isArray(
|
|
59
|
-
const
|
|
60
|
-
return
|
|
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
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const t =
|
|
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(
|
|
71
|
-
for (const t of
|
|
72
|
-
const o =
|
|
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
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
98
|
+
const $ = /* @__PURE__ */ new Set([
|
|
88
99
|
"direct_answer",
|
|
89
100
|
"tool_answer",
|
|
90
101
|
"clarify"
|
|
91
102
|
]);
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
|
|
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 (
|
|
100
|
-
return
|
|
110
|
+
if (e)
|
|
111
|
+
return $.has(e) ? e : void 0;
|
|
101
112
|
}
|
|
102
|
-
const
|
|
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
|
|
111
|
-
const
|
|
112
|
-
|
|
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 (!
|
|
118
|
-
const t =
|
|
119
|
-
(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
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
-
const t =
|
|
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
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
141
|
+
function z(n) {
|
|
142
|
+
const e = n.hooks;
|
|
143
|
+
if (C(e)) return e;
|
|
133
144
|
}
|
|
134
|
-
function
|
|
135
|
-
const
|
|
136
|
-
if (t && /^SKILL\.md$/iu.test(t) &&
|
|
137
|
-
return
|
|
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
|
|
142
|
-
return
|
|
152
|
+
function V(n) {
|
|
153
|
+
return n.split(`
|
|
143
154
|
`).map((t) => t.trim()).find((t) => t && !t.startsWith("#")) ?? "未提供技能描述";
|
|
144
155
|
}
|
|
145
|
-
function
|
|
146
|
-
const { data: t, body: o } =
|
|
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 且无法从路径推断:${
|
|
149
|
-
const
|
|
159
|
+
throw new Error(`技能文件缺少 id 且无法从路径推断:${e}`);
|
|
160
|
+
const l = s(t, "description") ?? V(o), i = {
|
|
150
161
|
name: c,
|
|
151
|
-
description:
|
|
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 =
|
|
180
|
+
const h = P(t);
|
|
170
181
|
h && (i.responseStrategy = h);
|
|
171
|
-
const k =
|
|
182
|
+
const k = U(t);
|
|
172
183
|
k && (i.assetTypes = k);
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
const v =
|
|
176
|
-
v && (i.
|
|
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 =
|
|
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
|
|
186
|
-
|
|
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 =
|
|
202
|
+
const I = j(t);
|
|
190
203
|
I && (i.executionContext = I);
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
return
|
|
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
|
-
|
|
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.
|
|
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-
|
|
95
|
-
"@inupedia/spotlight-
|
|
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",
|