@inupedia/spotlight-vue 0.9.1 → 0.9.4
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/assets/spotlight-vue.css +1 -1
- package/dist/components/SpotlightCommandPanel.vue.d.ts.map +1 -1
- package/dist/components/SpotlightCommandPanel.vue.js +1 -1
- package/dist/components/SpotlightCommandPanel2.vue.js +337 -191
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +103 -97
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +15 -13
- package/dist/store/modelStore.d.ts +16 -0
- package/dist/store/modelStore.d.ts.map +1 -0
- package/dist/store/modelStore.js +63 -0
- package/package.json +4 -3
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { useAgentSessionStore as g } from "../session/agentSession.js";
|
|
2
2
|
import { useSpotlightMemoryPreferenceStore as N } from "../store/memoryPreferenceStore.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useSpotlightModelStore as C } from "../store/modelStore.js";
|
|
4
|
+
import { useSpotlightRuntimeStore as P } from "../store/runtimeStore.js";
|
|
5
|
+
import { SPOTLIGHT_PIPELINE_STEP_IDS as l } from "../store/pipeline/constants.js";
|
|
6
|
+
import { toolLaneStepId as h, resolveToolLane as E, toolLaneStepLabel as b } from "../store/pipeline/toolLane.js";
|
|
6
7
|
import { getSpotlightAppClient as k, getSpotlightConfig as S } from "../plugin.js";
|
|
7
|
-
import { executeRemoteHostTool as
|
|
8
|
+
import { executeRemoteHostTool as M, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
|
|
8
9
|
import { getSpotlightProjectId as A } from "./httpConfig.js";
|
|
9
10
|
import { ensureSpotlightMeta as L } from "./meta.js";
|
|
10
11
|
const R = /* @__PURE__ */ new WeakMap();
|
|
11
|
-
function
|
|
12
|
-
const t = e.getSteps().find((i) => i.id ===
|
|
12
|
+
function f(e, o, s) {
|
|
13
|
+
const t = e.getSteps().find((i) => i.id === o);
|
|
13
14
|
if (t) return t;
|
|
14
|
-
const
|
|
15
|
-
return e.setSteps([...e.getSteps(),
|
|
15
|
+
const n = { id: o, label: s, status: "pending" };
|
|
16
|
+
return e.setSteps([...e.getSteps(), n]), n;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function q() {
|
|
18
19
|
return new Promise((e) => {
|
|
19
20
|
requestAnimationFrame(() => e());
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function O(e) {
|
|
23
24
|
return Array.isArray(e) ? e.flatMap((s, t) => {
|
|
24
25
|
if (!s || typeof s != "object") return [];
|
|
25
|
-
const
|
|
26
|
+
const n = s, i = typeof n.content == "string" ? n.content.trim() : "";
|
|
26
27
|
if (!i) return [];
|
|
27
|
-
const
|
|
28
|
-
return [[
|
|
28
|
+
const a = typeof n.title == "string" && n.title.trim() || typeof n.url == "string" && n.url.trim() || `资料 ${t + 1}`, c = typeof n.url == "string" ? n.url.trim() : "";
|
|
29
|
+
return [[a, c && c !== a ? c : "", i].filter(Boolean).join(`
|
|
29
30
|
`)];
|
|
30
31
|
}).join(`
|
|
31
32
|
|
|
32
33
|
`) : "";
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
const s =
|
|
35
|
+
function j(e, o) {
|
|
36
|
+
const s = o.success ? "前端操作已执行。" : o.error || "前端操作执行失败。";
|
|
36
37
|
return {
|
|
37
38
|
id: e.id,
|
|
38
39
|
name: e.name,
|
|
@@ -40,46 +41,46 @@ function O(e, n) {
|
|
|
40
41
|
argsText: JSON.stringify(e.input ?? {}, null, 2),
|
|
41
42
|
resultText: s,
|
|
42
43
|
summary: s,
|
|
43
|
-
errorCode:
|
|
44
|
-
trace:
|
|
45
|
-
status:
|
|
44
|
+
errorCode: o.errorCode,
|
|
45
|
+
trace: o.trace,
|
|
46
|
+
status: o.success ? "done" : "error"
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
49
|
+
function H(e, o) {
|
|
50
|
+
return E(e, o?.sideEffectByName?.get(e));
|
|
50
51
|
}
|
|
51
|
-
function p(e,
|
|
52
|
-
const t = e.getSteps().find((
|
|
53
|
-
!t || t.status === "done" || t.status === "error" || e.setStep(
|
|
52
|
+
function p(e, o, s) {
|
|
53
|
+
const t = e.getSteps().find((n) => n.id === o);
|
|
54
|
+
!t || t.status === "done" || t.status === "error" || e.setStep(o, "done", t.content ?? s);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
p(e,
|
|
57
|
-
const s = h(
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
!
|
|
56
|
+
function B(e, o) {
|
|
57
|
+
p(e, l.understand);
|
|
58
|
+
const s = h(o), t = b(o);
|
|
59
|
+
f(e, s, t);
|
|
60
|
+
const n = e.getSteps().find((i) => i.id === s);
|
|
61
|
+
!n || n.status === "active" || n.status === "done" || e.setStep(s, "active", n.content);
|
|
61
62
|
}
|
|
62
|
-
function I(e,
|
|
63
|
-
const t =
|
|
64
|
-
return
|
|
63
|
+
function I(e, o, s) {
|
|
64
|
+
const t = H(o, s);
|
|
65
|
+
return B(e, t), h(t);
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
e.appendToolCallsToStep(
|
|
67
|
+
function D(e, o, s, t) {
|
|
68
|
+
const n = I(e, o.name, t);
|
|
69
|
+
e.appendToolCallsToStep(n, [j(o, s)]);
|
|
69
70
|
}
|
|
70
|
-
function T(e,
|
|
71
|
-
|
|
71
|
+
function T(e, o, s, t, n) {
|
|
72
|
+
f(e, o, s), e.setStep(o, t, n);
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
const
|
|
74
|
+
function F(e) {
|
|
75
|
+
const o = e.status === "completed" ? "done" : e.status === "failed" ? "error" : "running";
|
|
75
76
|
return e.type === "knowledge_search" ? {
|
|
76
77
|
id: e.id,
|
|
77
78
|
name: e.tool,
|
|
78
79
|
displayName: e.displayName,
|
|
79
80
|
argsText: JSON.stringify({ query: e.query }, null, 2),
|
|
80
|
-
resultText:
|
|
81
|
+
resultText: O(e.result),
|
|
81
82
|
summary: e.summary,
|
|
82
|
-
status:
|
|
83
|
+
status: o
|
|
83
84
|
} : {
|
|
84
85
|
id: e.id,
|
|
85
86
|
name: e.tool,
|
|
@@ -89,64 +90,64 @@ function D(e) {
|
|
|
89
90
|
summary: e.summary ?? e.error?.message,
|
|
90
91
|
errorCode: e.error?.code,
|
|
91
92
|
trace: e.trace,
|
|
92
|
-
status:
|
|
93
|
+
status: o
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
|
-
async function
|
|
96
|
-
if (
|
|
97
|
-
if (
|
|
96
|
+
async function $(e, o, s) {
|
|
97
|
+
if (o.type !== "ping") {
|
|
98
|
+
if (o.type === "turn.started") {
|
|
98
99
|
T(
|
|
99
100
|
e,
|
|
100
|
-
|
|
101
|
+
l.understand,
|
|
101
102
|
"理解问题",
|
|
102
103
|
"active",
|
|
103
104
|
"正在理解您的问题。"
|
|
104
105
|
);
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
|
-
if (
|
|
108
|
-
const t =
|
|
108
|
+
if (o.type === "item.started" || o.type === "item.updated" || o.type === "item.completed") {
|
|
109
|
+
const t = o.item;
|
|
109
110
|
if (t.type === "reasoning") {
|
|
110
111
|
if (t.category === "voice")
|
|
111
112
|
return;
|
|
112
113
|
if (t.category === "routing" || t.category === "memory")
|
|
113
114
|
T(
|
|
114
115
|
e,
|
|
115
|
-
|
|
116
|
+
l.understand,
|
|
116
117
|
"理解问题",
|
|
117
|
-
|
|
118
|
+
o.type === "item.completed" ? "done" : "active",
|
|
118
119
|
t.summary
|
|
119
120
|
);
|
|
120
121
|
else {
|
|
121
|
-
const
|
|
122
|
-
|
|
122
|
+
const n = /页面|操作|执行/u.test(t.summary), i = n ? l.act : l.gather;
|
|
123
|
+
f(e, i, n ? "操作页面" : "获取信息"), e.setStep(
|
|
123
124
|
i,
|
|
124
|
-
|
|
125
|
+
o.type === "item.completed" ? "done" : "active",
|
|
125
126
|
t.summary
|
|
126
127
|
);
|
|
127
128
|
}
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
131
|
if (t.type === "skill_use") {
|
|
131
|
-
const
|
|
132
|
+
const n = "skills", i = f(e, n, "使用 Skill"), a = `- ${t.displayName}${t.skill === t.displayName ? "" : `(${t.skill})`}`, c = i.content?.includes(a) ? i.content : [i.content, a].filter(Boolean).join(`
|
|
132
133
|
`);
|
|
133
|
-
e.setStep(
|
|
134
|
+
e.setStep(n, t.status === "failed" ? "error" : "done", c), g().setInvokedSkills([
|
|
134
135
|
...g().invokedSkills.filter(
|
|
135
136
|
(d) => d.skillName !== t.skill
|
|
136
137
|
),
|
|
137
|
-
{ skillName: t.skill, invokedAt:
|
|
138
|
+
{ skillName: t.skill, invokedAt: o.at }
|
|
138
139
|
]);
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
141
142
|
if (t.type === "tool_call" || t.type === "knowledge_search") {
|
|
142
|
-
const
|
|
143
|
-
e.appendToolCallsToStep(i, [
|
|
143
|
+
const n = (t.type === "tool_call", t.tool), i = I(e, n, s);
|
|
144
|
+
e.appendToolCallsToStep(i, [F(t)]), (t.status === "completed" || t.status === "failed") && p(e, i);
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
146
147
|
if (t.type === "memory") {
|
|
147
148
|
T(
|
|
148
149
|
e,
|
|
149
|
-
|
|
150
|
+
l.understand,
|
|
150
151
|
"理解问题",
|
|
151
152
|
t.action === "reuse" ? "done" : "active",
|
|
152
153
|
t.summary
|
|
@@ -154,7 +155,7 @@ async function F(e, n, s) {
|
|
|
154
155
|
return;
|
|
155
156
|
}
|
|
156
157
|
if (t.type === "agent_message") {
|
|
157
|
-
p(e,
|
|
158
|
+
p(e, l.understand), p(e, l.gather), p(e, l.act), f(e, l.answer, "回答"), e.setStep(l.answer, "done", t.text.trim());
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
161
|
if (t.type === "voice_sentence")
|
|
@@ -162,17 +163,21 @@ async function F(e, n, s) {
|
|
|
162
163
|
t.type === "error" && e.setError(t.message);
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
|
-
|
|
166
|
+
o.type === "turn.failed" && e.setError(o.error.message);
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
|
-
async function
|
|
169
|
+
async function oe(e) {
|
|
169
170
|
await Promise.allSettled([
|
|
170
171
|
k().initialize(e),
|
|
171
172
|
L(e)
|
|
172
173
|
]);
|
|
173
174
|
}
|
|
174
|
-
async function J(e,
|
|
175
|
-
const t = g(),
|
|
175
|
+
async function J(e, o, s) {
|
|
176
|
+
const t = g(), n = P(), i = N(), a = C();
|
|
177
|
+
if (await a.loadModels(), !a.selectedModel)
|
|
178
|
+
throw new Error(
|
|
179
|
+
a.error ? `无法加载可用模型列表:${a.error}` : "当前没有可用模型,请先刷新模型列表。"
|
|
180
|
+
);
|
|
176
181
|
return {
|
|
177
182
|
hostManifest: await _(),
|
|
178
183
|
payload: {
|
|
@@ -181,6 +186,7 @@ async function J(e, n, s) {
|
|
|
181
186
|
interactionMode: s?.interactionMode ?? "text",
|
|
182
187
|
memorySubjectId: S().getMemorySubjectId?.() ?? void 0,
|
|
183
188
|
memoryRefreshRequested: s?.forceMemoryRefresh === !0,
|
|
189
|
+
model: a.selectedModel || void 0,
|
|
184
190
|
uiContext: S().getUiContext?.() ?? {},
|
|
185
191
|
sessionState: {
|
|
186
192
|
sessionId: t.sessionId,
|
|
@@ -198,55 +204,55 @@ async function J(e, n, s) {
|
|
|
198
204
|
memoryWriteEnabled: !0
|
|
199
205
|
},
|
|
200
206
|
runtimeState: {
|
|
201
|
-
activeDomain:
|
|
202
|
-
activeTarget:
|
|
203
|
-
activeAction:
|
|
204
|
-
resumableAction:
|
|
205
|
-
lastResolvedTarget:
|
|
207
|
+
activeDomain: n.activeDomain,
|
|
208
|
+
activeTarget: n.activeTarget,
|
|
209
|
+
activeAction: n.activeAction,
|
|
210
|
+
resumableAction: n.resumableAction,
|
|
211
|
+
lastResolvedTarget: n.lastResolvedTarget
|
|
206
212
|
}
|
|
207
213
|
}
|
|
208
214
|
};
|
|
209
215
|
}
|
|
210
|
-
async function
|
|
211
|
-
const t =
|
|
216
|
+
async function ne(e, o, s) {
|
|
217
|
+
const t = o.getSignal(), { payload: n, hostManifest: i } = await J(
|
|
212
218
|
e,
|
|
213
219
|
t,
|
|
214
220
|
s
|
|
215
|
-
),
|
|
221
|
+
), a = new Set(i.tools.map((r) => r.name)), c = {
|
|
216
222
|
sideEffectByName: new Map(
|
|
217
223
|
i.tools.map((r) => [r.name, r.sideEffect])
|
|
218
224
|
)
|
|
219
|
-
}, d = k(), w = g(), x = await d.startThread(w.sessionId, t),
|
|
220
|
-
t && (R.set(t,
|
|
225
|
+
}, d = k(), w = g(), x = await d.startThread(w.sessionId, t), y = await d.startTurn(x.id, n, t);
|
|
226
|
+
t && (R.set(t, y.id), t.addEventListener(
|
|
221
227
|
"abort",
|
|
222
228
|
() => {
|
|
223
|
-
d.cancelTurn(
|
|
229
|
+
d.cancelTurn(y.id);
|
|
224
230
|
},
|
|
225
231
|
{ once: !0 }
|
|
226
232
|
));
|
|
227
|
-
for await (const r of d.streamTurn(
|
|
233
|
+
for await (const r of d.streamTurn(y.id, t)) {
|
|
228
234
|
if ((r.type === "item.started" || r.type === "item.updated" || r.type === "item.completed") && r.item.type === "voice_sentence" && s?.onVoiceSentence?.({
|
|
229
235
|
index: r.item.index,
|
|
230
236
|
text: r.item.text,
|
|
231
237
|
generation: r.item.generation
|
|
232
|
-
}), await
|
|
233
|
-
const
|
|
238
|
+
}), await $(o, r, c), (r.type === "item.started" || r.type === "item.updated") && r.item.type === "tool_call" && r.item.status === "waiting_for_client" && r.item.clientRequest) {
|
|
239
|
+
const u = {
|
|
234
240
|
id: r.item.id,
|
|
235
241
|
name: r.item.tool,
|
|
236
242
|
input: r.item.arguments,
|
|
237
243
|
displayName: r.item.displayName
|
|
238
244
|
}, m = !(r.item.clientRequest.approvalRequired === !0) || !!await S().approveTool?.({
|
|
239
|
-
name:
|
|
240
|
-
displayName:
|
|
241
|
-
input:
|
|
245
|
+
name: u.name,
|
|
246
|
+
displayName: u.displayName,
|
|
247
|
+
input: u.input,
|
|
242
248
|
reason: r.item.clientRequest.approvalReason
|
|
243
|
-
}) ? await
|
|
249
|
+
}) ? await M(u, o, { allowedHostNames: a }) : {
|
|
244
250
|
success: !1,
|
|
245
251
|
error: "Tool execution was not approved",
|
|
246
252
|
errorCode: "TOOL_APPROVAL_REQUIRED",
|
|
247
253
|
trace: []
|
|
248
254
|
};
|
|
249
|
-
|
|
255
|
+
D(o, u, m, c), await d.submitToolResult(y.id, {
|
|
250
256
|
correlationId: r.item.clientRequest.correlationId,
|
|
251
257
|
success: m.success,
|
|
252
258
|
output: m.data,
|
|
@@ -257,33 +263,33 @@ async function te(e, n, s) {
|
|
|
257
263
|
}, t);
|
|
258
264
|
continue;
|
|
259
265
|
}
|
|
260
|
-
if (await
|
|
266
|
+
if (await q(), r.type === "turn.failed")
|
|
261
267
|
throw new Error(r.error.message);
|
|
262
268
|
if (r.type === "turn.completed") {
|
|
263
|
-
const
|
|
269
|
+
const u = r.metadata ?? {}, v = u.sessionPatch;
|
|
264
270
|
return v && w.applySessionPatch(v), {
|
|
265
271
|
command: null,
|
|
266
|
-
memoryReplay:
|
|
267
|
-
memoryDecision:
|
|
272
|
+
memoryReplay: u.memoryReplay ?? null,
|
|
273
|
+
memoryDecision: u.memoryDecision ?? null,
|
|
268
274
|
assistantReply: r.finalResponse
|
|
269
275
|
};
|
|
270
276
|
}
|
|
271
277
|
}
|
|
272
278
|
return { command: null };
|
|
273
279
|
}
|
|
274
|
-
async function
|
|
280
|
+
async function z(e) {
|
|
275
281
|
await k().cancelTurn(e);
|
|
276
282
|
}
|
|
277
|
-
function
|
|
283
|
+
function re(e) {
|
|
278
284
|
if (!e) return;
|
|
279
|
-
const
|
|
280
|
-
|
|
285
|
+
const o = R.get(e);
|
|
286
|
+
o && (R.delete(e), z(o));
|
|
281
287
|
}
|
|
282
288
|
export {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
+
$ as applyLifecycleEvent,
|
|
290
|
+
z as cancelRemoteSpotlightRun,
|
|
291
|
+
re as cancelRemoteSpotlightRunForSignal,
|
|
292
|
+
ne as runRemoteSpotlightPipeline,
|
|
293
|
+
D as settleHostToolCall,
|
|
294
|
+
oe as warmupSpotlightRemoteContext
|
|
289
295
|
};
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { useSpotlightStore, SpotlightIntent, SPOTLIGHT_INTENT_LABELS, ProgressSubIntent, PROGRESS_SUB_INTENT_LABELS, InvestmentSubIntent, INVESTMENT_SUB_INTENT_LABELS, QualitySubIntent, QUALITY_SUB_INTENT_LABELS, SafetySubIntent, SAFETY_SUB_INTENT_LABELS, SUB_INTENT_CONFIG, type AgentStep, type IntentWithReason, type SubIntentConfig, type SpotlightSkillPermissionRequest, } from "./spotlightStore.js";
|
|
2
2
|
export { SpotlightCommandDomain, SpotlightCommandScope, type SpotlightCommand, type SpotlightCommandAction, type SpotlightCommandTarget, type SpotlightVideoChannelId, } from "./types.js";
|
|
3
3
|
export { useSpotlightRuntimeStore } from "./runtimeStore.js";
|
|
4
|
+
export { useSpotlightModelStore } from "./modelStore.js";
|
|
4
5
|
export { useAgentSessionStore } from "../session/agentSession.js";
|
|
5
6
|
export { useSpotlightMemoryPreferenceStore, readSpotlightMemoryEnabled, } from "./memoryPreferenceStore.js";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,+BAA+B,GACrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,+BAA+B,GACrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC"}
|
package/dist/store/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useSpotlightStore as S } from "./spotlightStore.js";
|
|
2
|
-
import { INVESTMENT_SUB_INTENT_LABELS as r, InvestmentSubIntent as n, PROGRESS_SUB_INTENT_LABELS as T, ProgressSubIntent as E, QUALITY_SUB_INTENT_LABELS as I, QualitySubIntent as _, SAFETY_SUB_INTENT_LABELS as
|
|
3
|
-
import { useSpotlightRuntimeStore as
|
|
2
|
+
import { INVESTMENT_SUB_INTENT_LABELS as r, InvestmentSubIntent as n, PROGRESS_SUB_INTENT_LABELS as T, ProgressSubIntent as E, QUALITY_SUB_INTENT_LABELS as I, QualitySubIntent as _, SAFETY_SUB_INTENT_LABELS as m, SPOTLIGHT_INTENT_LABELS as p, SUB_INTENT_CONFIG as N, SafetySubIntent as i, SpotlightCommandDomain as L, SpotlightCommandScope as l, SpotlightIntent as u } from "./types.js";
|
|
3
|
+
import { useSpotlightRuntimeStore as s } from "./runtimeStore.js";
|
|
4
|
+
import { useSpotlightModelStore as f } from "./modelStore.js";
|
|
4
5
|
import { useAgentSessionStore as A } from "../session/agentSession.js";
|
|
5
|
-
import { readSpotlightMemoryEnabled as
|
|
6
|
+
import { readSpotlightMemoryEnabled as x, useSpotlightMemoryPreferenceStore as U } from "./memoryPreferenceStore.js";
|
|
6
7
|
export {
|
|
7
8
|
r as INVESTMENT_SUB_INTENT_LABELS,
|
|
8
9
|
n as InvestmentSubIntent,
|
|
@@ -10,16 +11,17 @@ export {
|
|
|
10
11
|
E as ProgressSubIntent,
|
|
11
12
|
I as QUALITY_SUB_INTENT_LABELS,
|
|
12
13
|
_ as QualitySubIntent,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
m as SAFETY_SUB_INTENT_LABELS,
|
|
15
|
+
p as SPOTLIGHT_INTENT_LABELS,
|
|
16
|
+
N as SUB_INTENT_CONFIG,
|
|
17
|
+
i as SafetySubIntent,
|
|
18
|
+
L as SpotlightCommandDomain,
|
|
19
|
+
l as SpotlightCommandScope,
|
|
20
|
+
u as SpotlightIntent,
|
|
21
|
+
x as readSpotlightMemoryEnabled,
|
|
21
22
|
A as useAgentSessionStore,
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
U as useSpotlightMemoryPreferenceStore,
|
|
24
|
+
f as useSpotlightModelStore,
|
|
25
|
+
s as useSpotlightRuntimeStore,
|
|
24
26
|
S as useSpotlightStore
|
|
25
27
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type SpotlightModel = {
|
|
2
|
+
id: string;
|
|
3
|
+
ownedBy?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const useSpotlightModelStore: import("pinia").StoreDefinition<"spotlight-model", {
|
|
6
|
+
models: SpotlightModel[];
|
|
7
|
+
selectedModel: string;
|
|
8
|
+
modelsLoaded: boolean;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
error: string;
|
|
11
|
+
}, {}, {
|
|
12
|
+
loadModels(force?: boolean): Promise<void>;
|
|
13
|
+
selectModel(modelId: string): void;
|
|
14
|
+
persistSelection(): void;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=modelStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelStore.d.ts","sourceRoot":"","sources":["../../src/store/modelStore.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgB9D,eAAO,MAAM,sBAAsB;YAEjB,cAAc,EAAE;;;;;;;yBA+CT,MAAM;;EAe7B,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineStore as n } from "pinia";
|
|
2
|
+
import { getSpotlightConfig as c } from "../plugin.js";
|
|
3
|
+
import { appendSpotlightProjectQuery as m } from "../remote/httpConfig.js";
|
|
4
|
+
import { getSpotlightJson as h } from "../remote/serverJson.js";
|
|
5
|
+
let s = null;
|
|
6
|
+
function a() {
|
|
7
|
+
return `spotlight:model:${c().projectId}`;
|
|
8
|
+
}
|
|
9
|
+
function d() {
|
|
10
|
+
try {
|
|
11
|
+
return globalThis.localStorage?.getItem(a()) ?? "";
|
|
12
|
+
} catch {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const y = n("spotlight-model", {
|
|
17
|
+
state: () => ({
|
|
18
|
+
models: [],
|
|
19
|
+
selectedModel: d(),
|
|
20
|
+
modelsLoaded: !1,
|
|
21
|
+
loading: !1,
|
|
22
|
+
error: ""
|
|
23
|
+
}),
|
|
24
|
+
actions: {
|
|
25
|
+
async loadModels(l = !1) {
|
|
26
|
+
if (s) return s;
|
|
27
|
+
if (this.modelsLoaded && !l) return;
|
|
28
|
+
this.loading = !0, this.error = "";
|
|
29
|
+
const o = (async () => {
|
|
30
|
+
try {
|
|
31
|
+
const e = await h(m("/v1/meta/models")), r = Array.isArray(e.models) ? e.models.filter(
|
|
32
|
+
(t) => t && typeof t.id == "string" && t.id.trim()
|
|
33
|
+
) : [];
|
|
34
|
+
this.models = r;
|
|
35
|
+
const i = this.selectedModel || d();
|
|
36
|
+
this.selectedModel = r.some((t) => t.id === i) ? i : r.some((t) => t.id === e.defaultModel) ? e.defaultModel : r[0]?.id ?? "", this.modelsLoaded = !0, this.persistSelection();
|
|
37
|
+
} catch (e) {
|
|
38
|
+
this.error = e instanceof Error ? e.message : String(e);
|
|
39
|
+
} finally {
|
|
40
|
+
this.loading = !1;
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
43
|
+
s = o;
|
|
44
|
+
try {
|
|
45
|
+
await o;
|
|
46
|
+
} finally {
|
|
47
|
+
s === o && (s = null);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
selectModel(l) {
|
|
51
|
+
this.models.some((o) => o.id === l) && (this.selectedModel = l, this.persistSelection());
|
|
52
|
+
},
|
|
53
|
+
persistSelection() {
|
|
54
|
+
try {
|
|
55
|
+
this.selectedModel && globalThis.localStorage?.setItem(a(), this.selectedModel);
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
y as useSpotlightModelStore
|
|
63
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inupedia/spotlight-vue",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Thin Vue runtime for Inupedia Spotlight Client Tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -89,11 +89,12 @@
|
|
|
89
89
|
"dist"
|
|
90
90
|
],
|
|
91
91
|
"dependencies": {
|
|
92
|
+
"lucide-vue-next": "^0.543.0",
|
|
92
93
|
"prettier": "^3.8.1",
|
|
93
94
|
"uqr": "^0.1.3",
|
|
94
95
|
"yaml": "^2.8.4",
|
|
95
|
-
"@inupedia/spotlight-client": "0.9.
|
|
96
|
-
"@inupedia/spotlight-protocol": "0.9.
|
|
96
|
+
"@inupedia/spotlight-client": "0.9.4",
|
|
97
|
+
"@inupedia/spotlight-protocol": "0.9.4"
|
|
97
98
|
},
|
|
98
99
|
"peerDependencies": {
|
|
99
100
|
"@inspira-ui/plugins": "^0.0.2",
|