@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,
|
|
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
|
|
2
|
-
function
|
|
3
|
-
return typeof
|
|
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
|
|
6
|
-
const
|
|
5
|
+
function F(e) {
|
|
6
|
+
const n = e.replace(/\r\n/g, `
|
|
7
7
|
`).trim();
|
|
8
|
-
if (!
|
|
8
|
+
if (!n.startsWith(`---
|
|
9
9
|
`))
|
|
10
|
-
return { frontmatter: "", body:
|
|
11
|
-
const t =
|
|
10
|
+
return { frontmatter: "", body: n };
|
|
11
|
+
const t = n.indexOf(`
|
|
12
12
|
---
|
|
13
13
|
`, 4);
|
|
14
|
-
return t === -1 ? { frontmatter: "", body:
|
|
15
|
-
frontmatter:
|
|
16
|
-
body:
|
|
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
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
19
|
+
function B(e) {
|
|
20
|
+
const n = e.trim();
|
|
21
|
+
if (!n) return {};
|
|
22
22
|
try {
|
|
23
|
-
const o =
|
|
24
|
-
if (
|
|
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
|
|
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
|
|
40
|
-
const { frontmatter:
|
|
41
|
-
return { data:
|
|
39
|
+
function D(e) {
|
|
40
|
+
const { frontmatter: n, body: t } = F(e);
|
|
41
|
+
return { data: B(n), body: t };
|
|
42
42
|
}
|
|
43
|
-
function l(
|
|
44
|
-
return
|
|
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(
|
|
47
|
-
for (const t of
|
|
48
|
-
const o =
|
|
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
|
|
57
|
-
if (
|
|
58
|
-
if (Array.isArray(
|
|
59
|
-
const
|
|
60
|
-
return
|
|
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
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const t =
|
|
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(
|
|
71
|
-
for (const t of
|
|
72
|
-
const o =
|
|
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
|
|
77
|
-
for (const t of
|
|
78
|
-
const o =
|
|
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
|
|
87
|
+
const M = /* @__PURE__ */ new Set([
|
|
88
88
|
"direct_answer",
|
|
89
89
|
"tool_answer",
|
|
90
90
|
"clarify"
|
|
91
91
|
]);
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
|
|
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 (
|
|
100
|
-
return
|
|
99
|
+
if (n)
|
|
100
|
+
return M.has(n) ? n : void 0;
|
|
101
101
|
}
|
|
102
|
-
const
|
|
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
|
|
111
|
-
const
|
|
112
|
-
|
|
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 (!
|
|
118
|
-
const t =
|
|
119
|
-
(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
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
-
const t =
|
|
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
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
130
|
+
function U(e) {
|
|
131
|
+
const n = e.hooks;
|
|
132
|
+
if (W(n)) return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const
|
|
136
|
-
if (t && /^SKILL\.md$/iu.test(t) &&
|
|
137
|
-
return
|
|
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
|
|
142
|
-
return
|
|
141
|
+
function z(e) {
|
|
142
|
+
return e.split(`
|
|
143
143
|
`).map((t) => t.trim()).find((t) => t && !t.startsWith("#")) ?? "未提供技能描述";
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
const { data: t, body: o } =
|
|
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 且无法从路径推断:${
|
|
149
|
-
const f = s(t, "description") ??
|
|
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
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
const
|
|
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
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
const
|
|
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
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
|
|
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
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
return
|
|
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
|
-
|
|
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.
|
|
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.
|
|
95
|
-
"@inupedia/spotlight-protocol": "0.5.
|
|
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",
|