@inupedia/spotlight-vue 0.2.14 → 0.3.0
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/createSpotlight.d.ts +32 -0
- package/dist/createSpotlight.d.ts.map +1 -0
- package/dist/createSpotlight.js +47 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -56
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +102 -86
- package/package.json +3 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { InjectionKey, Plugin } from "vue";
|
|
2
|
+
import { type CapabilityConnectInputV1, type CapabilityConnectResultV1, type SpotlightProjectV1 } from "@inupedia/spotlight-client";
|
|
3
|
+
import type { CapabilityBuildInfoV1 } from "@inupedia/spotlight-client/vite";
|
|
4
|
+
export interface SpotlightCapabilityRuntimeV1 {
|
|
5
|
+
readonly project: SpotlightProjectV1;
|
|
6
|
+
connect(input: CapabilityConnectInputV1): Promise<CapabilityConnectResultV1>;
|
|
7
|
+
disconnect(sessionId: string): void;
|
|
8
|
+
pendingBuild(): Readonly<CapabilityBuildInfoV1> | undefined;
|
|
9
|
+
notifyBuild(buildInfo: Readonly<CapabilityBuildInfoV1>): void;
|
|
10
|
+
}
|
|
11
|
+
export declare const SPOTLIGHT_CAPABILITY_RUNTIME_KEY: InjectionKey<SpotlightCapabilityRuntimeV1>;
|
|
12
|
+
export declare function getSpotlightCapabilityRuntime(): SpotlightCapabilityRuntimeV1 | undefined;
|
|
13
|
+
export interface CreateSpotlightOptionsV1 {
|
|
14
|
+
endpoint: string;
|
|
15
|
+
project: SpotlightProjectV1;
|
|
16
|
+
capabilities?: {
|
|
17
|
+
capabilityBuildInfo: Readonly<CapabilityBuildInfoV1>;
|
|
18
|
+
openUploadStream: NonNullable<CreateSpotlightOptionsV1["openUploadStream"]>;
|
|
19
|
+
};
|
|
20
|
+
capabilityBuildInfo?: Readonly<CapabilityBuildInfoV1>;
|
|
21
|
+
openUploadStream?: () => Promise<{
|
|
22
|
+
digest: string;
|
|
23
|
+
byteLength: number;
|
|
24
|
+
contentType: "application/gzip";
|
|
25
|
+
stream: ReadableStream<Uint8Array>;
|
|
26
|
+
}>;
|
|
27
|
+
fetch?: typeof globalThis.fetch;
|
|
28
|
+
createWebSocket?: (url: string) => WebSocket;
|
|
29
|
+
}
|
|
30
|
+
export type SpotlightPluginV1 = Plugin & SpotlightCapabilityRuntimeV1;
|
|
31
|
+
export declare function createSpotlight(options: CreateSpotlightOptionsV1): SpotlightPluginV1;
|
|
32
|
+
//# sourceMappingURL=createSpotlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSpotlight.d.ts","sourceRoot":"","sources":["../src/createSpotlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC7E,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,YAAY,IAAI,QAAQ,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IAC5D,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC;CAC/D;AAED,eAAO,MAAM,gCAAgC,EAAE,YAAY,CAAC,4BAA4B,CAChD,CAAC;AAGzC,wBAAgB,6BAA6B,IAAI,4BAA4B,GAAG,SAAS,CAExF;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,YAAY,CAAC,EAAE;QACb,mBAAmB,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QACrD,gBAAgB,EAAE,WAAW,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC,CAAC;KAC7E,CAAC;IACF,mBAAmB,CAAC,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IACtD,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC;QAC/B,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,kBAAkB,CAAC;QAChC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;CAC9C;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,4BAA4B,CAAC;AAEtE,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,CAoDpF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createFrontendToolRegistry as u, createCapabilityClient as f } from "@inupedia/spotlight-client";
|
|
2
|
+
const g = /* @__PURE__ */ Symbol("spotlight-capability-runtime");
|
|
3
|
+
let p;
|
|
4
|
+
function y() {
|
|
5
|
+
return p;
|
|
6
|
+
}
|
|
7
|
+
function S(e) {
|
|
8
|
+
const s = u(e.project), i = /* @__PURE__ */ new Map();
|
|
9
|
+
let c, n, l;
|
|
10
|
+
const b = () => n ??= e.capabilities ? Promise.resolve(e.capabilities) : e.capabilityBuildInfo && e.openUploadStream ? Promise.resolve({ capabilityBuildInfo: e.capabilityBuildInfo, openUploadStream: e.openUploadStream }) : Promise.reject(new Error("Spotlight capabilities are missing. Pass the virtual:spotlight/capabilities module to createSpotlight().")), a = Object.assign(
|
|
11
|
+
{
|
|
12
|
+
project: e.project,
|
|
13
|
+
async connect(t) {
|
|
14
|
+
const r = i.get(t.sessionId);
|
|
15
|
+
if (r) return r;
|
|
16
|
+
const o = await b();
|
|
17
|
+
l ??= f({
|
|
18
|
+
endpoint: e.endpoint,
|
|
19
|
+
project: e.project,
|
|
20
|
+
registry: s,
|
|
21
|
+
buildInfo: o.capabilityBuildInfo,
|
|
22
|
+
openUploadStream: o.openUploadStream,
|
|
23
|
+
fetch: e.fetch,
|
|
24
|
+
createWebSocket: e.createWebSocket
|
|
25
|
+
});
|
|
26
|
+
const d = await l.connect(t);
|
|
27
|
+
return i.set(t.sessionId, d), d;
|
|
28
|
+
},
|
|
29
|
+
disconnect(t) {
|
|
30
|
+
i.get(t)?.channel?.close(), i.delete(t);
|
|
31
|
+
},
|
|
32
|
+
pendingBuild: () => c,
|
|
33
|
+
notifyBuild(t) {
|
|
34
|
+
i.size > 0 || t.artifactDigest !== e.capabilityBuildInfo?.artifactDigest ? c = Object.freeze({ ...t }) : (n = void 0, l = void 0);
|
|
35
|
+
},
|
|
36
|
+
install(t) {
|
|
37
|
+
p = a, t.provide(g, a);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return Object.freeze(a), a;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
g as SPOTLIGHT_CAPABILITY_RUNTIME_KEY,
|
|
45
|
+
S as createSpotlight,
|
|
46
|
+
y as getSpotlightCapabilityRuntime
|
|
47
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ export type { ToolResult, ToolTraceEvent } from "./types/toolResult.js";
|
|
|
37
37
|
export type { SessionControlIntent } from "./types/session.js";
|
|
38
38
|
export type { HandlerApi, SpotlightContext } from "./store/pipeline/types.js";
|
|
39
39
|
export type { SpotlightVideoChannelId } from "./store/types.js";
|
|
40
|
+
export { createSpotlight, SPOTLIGHT_CAPABILITY_RUNTIME_KEY, type CreateSpotlightOptionsV1, type SpotlightCapabilityRuntimeV1, type SpotlightPluginV1, } from "./createSpotlight.js";
|
|
40
41
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,EACtC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,GAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,6BAA6B,EAC7B,KAAK,oCAAoC,GAC1C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,2BAA2B,GACjC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,E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K,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,GACvB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,111 +1,114 @@
|
|
|
1
1
|
import { SPOTLIGHT_CONFIG_KEY as e, defineSpotlightConfig as r } from "./config.js";
|
|
2
2
|
import { resolveSpotlightConfig as i } from "./resolveConfig.js";
|
|
3
|
-
import { defineSpotlightApp as
|
|
3
|
+
import { defineSpotlightApp as n, readSpotlightEnv as S } from "./host/defineApp.js";
|
|
4
4
|
import { defineSpotlightHost as m } from "./host/defineHost.js";
|
|
5
5
|
import { defineSpotlightCapabilityHost as a } from "./host/capabilityHost.js";
|
|
6
|
-
import { getDefaultSpotlightHostCore as
|
|
6
|
+
import { getDefaultSpotlightHostCore as f, useSpotlightAction as x, useSpotlightReadable as h } from "./composables/useSpotlightHostCore.js";
|
|
7
7
|
import { normalizeSkillsOption as E } from "./host/normalizeSkills.js";
|
|
8
|
-
import { mergeSpotlightSkills as
|
|
9
|
-
import { SPOTLIGHT_HOST_ADAPTER_KEY as
|
|
10
|
-
import { useSpotlightStore as
|
|
11
|
-
import { INVESTMENT_SUB_INTENT_LABELS as
|
|
12
|
-
import { useSpotlightRuntimeStore as
|
|
8
|
+
import { mergeSpotlightSkills as I } from "./host/mergeSkills.js";
|
|
9
|
+
import { SPOTLIGHT_HOST_ADAPTER_KEY as L, SPOTLIGHT_HTTP_KEY as C, SpotlightVue as P, getSpotlightConfig as c, getSpotlightHostAdapter as O, getSpotlightHttp as N } from "./plugin.js";
|
|
10
|
+
import { useSpotlightStore as k } from "./store/spotlightStore.js";
|
|
11
|
+
import { INVESTMENT_SUB_INTENT_LABELS as R, InvestmentSubIntent as b, PROGRESS_SUB_INTENT_LABELS as w, ProgressSubIntent as B, QUALITY_SUB_INTENT_LABELS as M, QualitySubIntent as G, SAFETY_SUB_INTENT_LABELS as U, SPOTLIGHT_INTENT_LABELS as y, SUB_INTENT_CONFIG as F, SafetySubIntent as K, SpotlightCommandDomain as W, SpotlightCommandScope as D, SpotlightIntent as Y } from "./store/types.js";
|
|
12
|
+
import { useSpotlightRuntimeStore as z } from "./store/runtimeStore.js";
|
|
13
13
|
import { useAgentSessionStore as J } from "./session/agentSession.js";
|
|
14
14
|
import { readSpotlightMemoryEnabled as j, useSpotlightMemoryPreferenceStore as q } from "./store/memoryPreferenceStore.js";
|
|
15
15
|
import { getSkillsPoolForRun as Z, loadBundledSkillsFromGlob as $ } from "./skills/index.js";
|
|
16
16
|
import { cancelRemoteSpotlightRunForSignal as ot, runRemoteSpotlightPipeline as et, warmupSpotlightRemoteContext as rt } from "./remote/runPipeline.js";
|
|
17
|
-
import { ensureSpotlightMeta as it, getSpotlightUiPrompts as
|
|
17
|
+
import { ensureSpotlightMeta as it, getSpotlightUiPrompts as lt } from "./remote/meta.js";
|
|
18
18
|
import { extractTranscriptionText as St, normalizeSpeakText as st, spotlightSynthesizeSpeech as mt, spotlightTranscribeAudio as gt } from "./remote/audio.js";
|
|
19
|
-
import { getSpotlightJson as
|
|
19
|
+
import { getSpotlightJson as Tt, postSpotlightJson as ft } from "./remote/serverJson.js";
|
|
20
20
|
import { TOOL_NAMES as ht } from "./constants/toolNames.js";
|
|
21
|
-
import { TOOL_STEP_ANSWER_DELIMITER as Et, composeToolStepContent as
|
|
22
|
-
import { isInternalKnowledgeEvidenceTool as
|
|
23
|
-
import { SPOTLIGHT_PIPELINE_STEP_IDS as
|
|
24
|
-
import { formatSpotlightKnowledgeMarkdown as Mt, initSpotlightMarkdownPreview as Gt, preprocessKnowledgeMarkdown as
|
|
25
|
-
import { formatToolFailure as
|
|
21
|
+
import { TOOL_STEP_ANSWER_DELIMITER as Et, composeToolStepContent as _t, getIntentStepDisplayContent as It, humanizeSpotlightStepContent as dt, isLoopPlanningChunk as Lt, isToolExecutionStep as Ct, sanitizeToolStepAnswerText as Pt, splitIntentStepContent as ct, splitToolStepContent as Ot } from "./store/pipeline/displayText.js";
|
|
22
|
+
import { isInternalKnowledgeEvidenceTool as At, isUserFacingKnowledgeTool as kt, partitionToolCalls as Ht } from "./store/pipeline/toolDisplay.js";
|
|
23
|
+
import { SPOTLIGHT_PIPELINE_STEP_IDS as bt, SPOTLIGHT_PIPELINE_STEP_LABELS as wt } from "./store/pipeline/constants.js";
|
|
24
|
+
import { formatSpotlightKnowledgeMarkdown as Mt, initSpotlightMarkdownPreview as Gt, preprocessKnowledgeMarkdown as Ut } from "./store/pipeline/spotlightMarkdown.js";
|
|
25
|
+
import { formatToolFailure as Ft } from "./store/pipeline/errors.js";
|
|
26
26
|
import { getSuggestedQuestions as Wt } from "./store/capabilities.js";
|
|
27
|
-
import { useSpotlightPanelUi as
|
|
28
|
-
import { useSpotlightCommandShortcuts as
|
|
27
|
+
import { useSpotlightPanelUi as Yt } from "./composables/useSpotlightPanelUi.js";
|
|
28
|
+
import { useSpotlightCommandShortcuts as zt } from "./composables/useSpotlightCommandShortcuts.js";
|
|
29
29
|
import { isGenericHostExecutionReply as Jt } from "./avatar/speech/live2dAnswerSpeechPolicy.js";
|
|
30
30
|
import { COMMON_WORKFLOW_STEPS as jt, buildCommonSteps as qt, buildCommonWorkflowSteps as Xt } from "./workflow/shared.js";
|
|
31
31
|
import { runHostTool as $t } from "./workflow/runHostTool.js";
|
|
32
32
|
import { buildOperateWorkflowSteps as oo, createOperateExecutor as eo, isOperateWorkflowContext as ro } from "./workflow/operate.js";
|
|
33
33
|
import { createOperateDefinition as io } from "./workflow/createOperateDefinition.js";
|
|
34
|
-
import { buildOperateCommandContext as
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
34
|
+
import { buildOperateCommandContext as no, buildRepeatLastAnswerContext as So, buildSessionControlWorkflowSteps as so, createRunSessionHostTool as mo, createSessionControlExecutor as go } from "./workflow/sessionControl.js";
|
|
35
|
+
import { SPOTLIGHT_CAPABILITY_RUNTIME_KEY as To, createSpotlight as fo } from "./createSpotlight.js";
|
|
36
|
+
import { formatSkillsWithinBudget as ho } from "./skills/skillListing.js";
|
|
37
|
+
import { getBypassMatchedSkills as Eo, getModelInvokableSkills as _o } from "./skills/matching.js";
|
|
38
|
+
import { parseSpotlightSkillMarkdown as Lo } from "./skills/parser.js";
|
|
38
39
|
export {
|
|
39
40
|
jt as COMMON_WORKFLOW_STEPS,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
R as INVESTMENT_SUB_INTENT_LABELS,
|
|
42
|
+
b as InvestmentSubIntent,
|
|
43
|
+
w as PROGRESS_SUB_INTENT_LABELS,
|
|
43
44
|
B as ProgressSubIntent,
|
|
44
45
|
M as QUALITY_SUB_INTENT_LABELS,
|
|
45
46
|
G as QualitySubIntent,
|
|
46
|
-
|
|
47
|
+
U as SAFETY_SUB_INTENT_LABELS,
|
|
48
|
+
To as SPOTLIGHT_CAPABILITY_RUNTIME_KEY,
|
|
47
49
|
e as SPOTLIGHT_CONFIG_KEY,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
L as SPOTLIGHT_HOST_ADAPTER_KEY,
|
|
51
|
+
C as SPOTLIGHT_HTTP_KEY,
|
|
52
|
+
y as SPOTLIGHT_INTENT_LABELS,
|
|
53
|
+
bt as SPOTLIGHT_PIPELINE_STEP_IDS,
|
|
54
|
+
wt as SPOTLIGHT_PIPELINE_STEP_LABELS,
|
|
55
|
+
F as SUB_INTENT_CONFIG,
|
|
54
56
|
K as SafetySubIntent,
|
|
55
57
|
W as SpotlightCommandDomain,
|
|
56
58
|
D as SpotlightCommandScope,
|
|
57
|
-
|
|
59
|
+
Y as SpotlightIntent,
|
|
58
60
|
P as SpotlightVue,
|
|
59
61
|
ht as TOOL_NAMES,
|
|
60
62
|
Et as TOOL_STEP_ANSWER_DELIMITER,
|
|
61
63
|
qt as buildCommonSteps,
|
|
62
64
|
Xt as buildCommonWorkflowSteps,
|
|
63
|
-
|
|
65
|
+
no as buildOperateCommandContext,
|
|
64
66
|
oo as buildOperateWorkflowSteps,
|
|
65
67
|
So as buildRepeatLastAnswerContext,
|
|
66
68
|
so as buildSessionControlWorkflowSteps,
|
|
67
69
|
ot as cancelRemoteSpotlightRunForSignal,
|
|
68
|
-
|
|
70
|
+
_t as composeToolStepContent,
|
|
69
71
|
io as createOperateDefinition,
|
|
70
72
|
eo as createOperateExecutor,
|
|
71
73
|
mo as createRunSessionHostTool,
|
|
72
74
|
go as createSessionControlExecutor,
|
|
73
|
-
|
|
75
|
+
fo as createSpotlight,
|
|
76
|
+
n as defineSpotlightApp,
|
|
74
77
|
a as defineSpotlightCapabilityHost,
|
|
75
78
|
r as defineSpotlightConfig,
|
|
76
79
|
m as defineSpotlightHost,
|
|
77
80
|
it as ensureSpotlightMeta,
|
|
78
81
|
St as extractTranscriptionText,
|
|
79
|
-
|
|
82
|
+
ho as formatSkillsWithinBudget,
|
|
80
83
|
Mt as formatSpotlightKnowledgeMarkdown,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
Ft as formatToolFailure,
|
|
85
|
+
Eo as getBypassMatchedSkills,
|
|
86
|
+
f as getDefaultSpotlightHostCore,
|
|
87
|
+
It as getIntentStepDisplayContent,
|
|
88
|
+
_o as getModelInvokableSkills,
|
|
86
89
|
Z as getSkillsPoolForRun,
|
|
87
90
|
c as getSpotlightConfig,
|
|
88
91
|
O as getSpotlightHostAdapter,
|
|
89
92
|
N as getSpotlightHttp,
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
Tt as getSpotlightJson,
|
|
94
|
+
lt as getSpotlightUiPrompts,
|
|
92
95
|
Wt as getSuggestedQuestions,
|
|
93
|
-
|
|
96
|
+
dt as humanizeSpotlightStepContent,
|
|
94
97
|
Gt as initSpotlightMarkdownPreview,
|
|
95
98
|
Jt as isGenericHostExecutionReply,
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
At as isInternalKnowledgeEvidenceTool,
|
|
100
|
+
Lt as isLoopPlanningChunk,
|
|
98
101
|
ro as isOperateWorkflowContext,
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
Ct as isToolExecutionStep,
|
|
103
|
+
kt as isUserFacingKnowledgeTool,
|
|
101
104
|
$ as loadBundledSkillsFromGlob,
|
|
102
|
-
|
|
105
|
+
I as mergeSpotlightSkills,
|
|
103
106
|
E as normalizeSkillsOption,
|
|
104
107
|
st as normalizeSpeakText,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
Lo as parseSpotlightSkillMarkdown,
|
|
109
|
+
Ht as partitionToolCalls,
|
|
110
|
+
ft as postSpotlightJson,
|
|
111
|
+
Ut as preprocessKnowledgeMarkdown,
|
|
109
112
|
S as readSpotlightEnv,
|
|
110
113
|
j as readSpotlightMemoryEnabled,
|
|
111
114
|
i as resolveSpotlightConfig,
|
|
@@ -118,11 +121,11 @@ export {
|
|
|
118
121
|
gt as spotlightTranscribeAudio,
|
|
119
122
|
J as useAgentSessionStore,
|
|
120
123
|
x as useSpotlightAction,
|
|
121
|
-
|
|
124
|
+
zt as useSpotlightCommandShortcuts,
|
|
122
125
|
q as useSpotlightMemoryPreferenceStore,
|
|
123
|
-
|
|
126
|
+
Yt as useSpotlightPanelUi,
|
|
124
127
|
h as useSpotlightReadable,
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
z as useSpotlightRuntimeStore,
|
|
129
|
+
k as useSpotlightStore,
|
|
127
130
|
rt as warmupSpotlightRemoteContext
|
|
128
131
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAob9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AA8DD,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,2BAA2B,CAAC,CA+FtC;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,MAAM,iBAQ3D;AAED,wBAAgB,iCAAiC,CAAC,MAAM,CAAC,EAAE,WAAW,QAMrE"}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { serializeSkillsForRemote as
|
|
2
|
-
import { getSkillsPoolForRun as
|
|
1
|
+
import { serializeSkillsForRemote as E } from "@inupedia/spotlight-client";
|
|
2
|
+
import { getSkillsPoolForRun as A } from "../skills/index.js";
|
|
3
3
|
import { useAgentSessionStore as R } from "../session/agentSession.js";
|
|
4
|
-
import { useSpotlightMemoryPreferenceStore as
|
|
5
|
-
import { useSpotlightRuntimeStore as
|
|
4
|
+
import { useSpotlightMemoryPreferenceStore as L } from "../store/memoryPreferenceStore.js";
|
|
5
|
+
import { useSpotlightRuntimeStore as $ } from "../store/runtimeStore.js";
|
|
6
6
|
import { SPOTLIGHT_PIPELINE_STEP_IDS as r } from "../store/pipeline/constants.js";
|
|
7
|
-
import { isLoopPlanningChunk as
|
|
8
|
-
import { getSpotlightConfig as
|
|
9
|
-
import { executeRemoteHostTool as
|
|
10
|
-
import { getSpotlightServerBase as g, buildSpotlightJsonHeaders as y, getSpotlightProjectId as
|
|
11
|
-
import { ensureSpotlightMeta as
|
|
7
|
+
import { isLoopPlanningChunk as O, splitIntentStepContent as H, splitToolStepContent as M, composeToolStepContent as F } from "../store/pipeline/displayText.js";
|
|
8
|
+
import { getSpotlightConfig as q } from "../plugin.js";
|
|
9
|
+
import { executeRemoteHostTool as J, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
|
|
10
|
+
import { getSpotlightServerBase as g, buildSpotlightJsonHeaders as y, getSpotlightProjectId as W } from "./httpConfig.js";
|
|
11
|
+
import { ensureSpotlightMeta as D } from "./meta.js";
|
|
12
|
+
import { getSpotlightCapabilityRuntime as U } from "../createSpotlight.js";
|
|
12
13
|
const h = /* @__PURE__ */ new WeakMap();
|
|
13
|
-
function
|
|
14
|
+
function j(e) {
|
|
14
15
|
return e.type !== "host_action_request" && e.type !== "run_completed" && e.type !== "run_error" && e.type !== "ping";
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function c(e, t, o) {
|
|
17
18
|
const s = e.getSteps().find((n) => n.id === t);
|
|
18
19
|
if (s) return s;
|
|
19
20
|
const a = { id: t, label: o, status: "pending" };
|
|
20
21
|
return e.setSteps([...e.getSteps(), a]), a;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function B() {
|
|
23
24
|
return new Promise((e) => {
|
|
24
25
|
requestAnimationFrame(() => e());
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function z(e) {
|
|
28
29
|
const t = e.summary?.trim();
|
|
29
30
|
if (t && t.length > 48 && !t.startsWith("{") && !t.startsWith("["))
|
|
30
31
|
return t;
|
|
@@ -36,8 +37,8 @@ function U(e) {
|
|
|
36
37
|
}
|
|
37
38
|
return t || "";
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
const t =
|
|
40
|
+
function G(e) {
|
|
41
|
+
const t = z(e.result);
|
|
41
42
|
return {
|
|
42
43
|
id: e.result.call.id,
|
|
43
44
|
name: e.result.call.name,
|
|
@@ -50,7 +51,7 @@ function z(e) {
|
|
|
50
51
|
status: e.result.success ? "done" : "error"
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function V(e) {
|
|
54
55
|
return {
|
|
55
56
|
id: e.call.id,
|
|
56
57
|
name: e.call.name,
|
|
@@ -59,7 +60,7 @@ function G(e) {
|
|
|
59
60
|
status: "running"
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function Q(e, t) {
|
|
63
64
|
const o = t.success ? "前端操作已执行。" : t.error || "前端操作执行失败。";
|
|
64
65
|
return {
|
|
65
66
|
id: e.id,
|
|
@@ -73,13 +74,13 @@ function B(e, t) {
|
|
|
73
74
|
status: t.success ? "done" : "error"
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
+
function Y(e) {
|
|
77
78
|
return e.startsWith("panel.") || e.startsWith("navigate.") || e.startsWith("session.");
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
-
if (!
|
|
81
|
-
|
|
82
|
-
const s =
|
|
80
|
+
function K(e, t, o) {
|
|
81
|
+
if (!Y(t.request.call.name)) return;
|
|
82
|
+
c(e, r.tool, "执行工具与回答");
|
|
83
|
+
const s = Q(t.request.call, o);
|
|
83
84
|
e.appendToolCallsToStep(r.tool, [s]), e.setStep(
|
|
84
85
|
r.tool,
|
|
85
86
|
o.success ? "done" : "error",
|
|
@@ -94,7 +95,7 @@ function p(e, t) {
|
|
|
94
95
|
function w(e, t) {
|
|
95
96
|
return t || (e === r.tool ? "执行工具与回答" : e);
|
|
96
97
|
}
|
|
97
|
-
async function
|
|
98
|
+
async function X(e, t) {
|
|
98
99
|
if (t.type !== "ping") {
|
|
99
100
|
if (t.type === "step_sync")
|
|
100
101
|
e.setSteps(
|
|
@@ -106,31 +107,31 @@ async function Y(e, t) {
|
|
|
106
107
|
}))
|
|
107
108
|
);
|
|
108
109
|
else if (t.type === "step_status")
|
|
109
|
-
|
|
110
|
+
c(e, t.stepId, t.label ?? t.stepId), e.setStep(t.stepId, t.status, t.content);
|
|
110
111
|
else if (t.type === "step_content") {
|
|
111
112
|
let o = t.stepId, s = t.content;
|
|
112
|
-
if (o === r.intent &&
|
|
113
|
+
if (o === r.intent && O(s))
|
|
113
114
|
o = r.tool;
|
|
114
115
|
else if (o === r.intent && t.mode === "replace") {
|
|
115
|
-
const { intent: a, misplacedPlanning: n } =
|
|
116
|
-
s = a, n.trim() && (
|
|
116
|
+
const { intent: a, misplacedPlanning: n } = H(s);
|
|
117
|
+
s = a, n.trim() && (c(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
|
|
117
118
|
r.tool,
|
|
118
119
|
n
|
|
119
120
|
));
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
+
c(e, o, w(o, t.label)), t.mode === "replace" ? e.setStep(
|
|
122
123
|
o,
|
|
123
124
|
e.getSteps().find((a) => a.id === o)?.status ?? "active",
|
|
124
125
|
s
|
|
125
|
-
) : (p(e, o), e.appendChunkToStep(o, s), await
|
|
126
|
+
) : (p(e, o), e.appendChunkToStep(o, s), await B());
|
|
126
127
|
} else if (t.type === "step_artifact")
|
|
127
|
-
|
|
128
|
+
c(e, t.stepId, w(t.stepId, t.label)), p(e, t.stepId), t.artifact === "tool_calls" && t.toolCalls?.length ? e.appendToolCallsToStep(t.stepId, t.toolCalls) : t.artifact === "attachments" && t.attachments?.length ? e.appendAttachmentsToStep(t.stepId, t.attachments) : t.artifact === "files" && t.files?.length ? e.appendFilesToStep(t.stepId, t.files) : t.artifact === "artifacts" && t.artifacts?.length ? e.appendArtifactsToStep(t.stepId, t.artifacts) : t.artifact === "chat_items" && t.chatItems?.length && e.appendChatItemsToStep(t.stepId, t.chatItems);
|
|
128
129
|
else if (t.type === "tool_start")
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
c(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
131
|
+
V(t)
|
|
131
132
|
]);
|
|
132
133
|
else if (t.type === "tool_progress")
|
|
133
|
-
|
|
134
|
+
c(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
134
135
|
{
|
|
135
136
|
id: t.call.id,
|
|
136
137
|
name: t.call.name,
|
|
@@ -141,8 +142,8 @@ async function Y(e, t) {
|
|
|
141
142
|
}
|
|
142
143
|
]);
|
|
143
144
|
else if (t.type === "tool_result")
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
c(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
146
|
+
G(t)
|
|
146
147
|
]), t.result.attachments?.length && e.appendAttachmentsToStep(
|
|
147
148
|
r.tool,
|
|
148
149
|
t.result.attachments
|
|
@@ -163,33 +164,33 @@ async function Y(e, t) {
|
|
|
163
164
|
at: t.at
|
|
164
165
|
});
|
|
165
166
|
} else if (t.type === "fork_progress")
|
|
166
|
-
|
|
167
|
+
c(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
|
|
167
168
|
r.tool,
|
|
168
169
|
`
|
|
169
170
|
[fork ${t.agentId}] 第 ${t.iteration} 轮 · ${t.phase}:${t.summary}
|
|
170
171
|
`
|
|
171
172
|
);
|
|
172
173
|
else if (t.type === "turn_transition")
|
|
173
|
-
t.phase === "memory_replay" && (
|
|
174
|
+
t.phase === "memory_replay" && (c(e, r.breakdown, "问题拆解"), e.setStep(
|
|
174
175
|
r.breakdown,
|
|
175
176
|
"done",
|
|
176
177
|
t.summary ?? "Memory 缓存命中,跳过 LLM 规划。"
|
|
177
178
|
));
|
|
178
179
|
else if (t.type === "assistant_response") {
|
|
179
|
-
|
|
180
|
-
const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: a } =
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
c(e, r.tool, "执行工具与回答");
|
|
181
|
+
const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: a } = M(o?.content ?? ""), n = t.content.trim(), l = a.trim();
|
|
182
|
+
l && n && (l === n || n.startsWith(
|
|
183
|
+
l.slice(0, Math.min(l.length, 80))
|
|
183
184
|
)) ? e.setStep(r.tool, "done") : e.setStep(
|
|
184
185
|
r.tool,
|
|
185
186
|
"done",
|
|
186
|
-
|
|
187
|
+
F(s, n)
|
|
187
188
|
);
|
|
188
189
|
}
|
|
189
|
-
|
|
190
|
+
j(t) && e.appendExecutionEvent?.(t);
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
|
-
async function
|
|
193
|
+
async function Z(e) {
|
|
193
194
|
await fetch(
|
|
194
195
|
`${g()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
|
|
195
196
|
{
|
|
@@ -207,10 +208,10 @@ async function K(e) {
|
|
|
207
208
|
}
|
|
208
209
|
);
|
|
209
210
|
}
|
|
210
|
-
function
|
|
211
|
+
function v(e) {
|
|
211
212
|
const t = e.split(/\n\n/u), o = t.pop() ?? "";
|
|
212
213
|
return { events: t.flatMap((a) => {
|
|
213
|
-
const n = a.split(/\n/u).find((
|
|
214
|
+
const n = a.split(/\n/u).find((l) => l.startsWith("data: "));
|
|
214
215
|
if (!n) return [];
|
|
215
216
|
try {
|
|
216
217
|
return [JSON.parse(n.slice(6))];
|
|
@@ -219,21 +220,30 @@ function X(e) {
|
|
|
219
220
|
}
|
|
220
221
|
}), rest: o };
|
|
221
222
|
}
|
|
222
|
-
async function
|
|
223
|
+
async function mt(e) {
|
|
223
224
|
await Promise.allSettled([
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
_(e),
|
|
226
|
+
D(e)
|
|
226
227
|
]);
|
|
227
228
|
}
|
|
228
|
-
async function
|
|
229
|
-
const o = R(), s =
|
|
229
|
+
async function tt(e, t) {
|
|
230
|
+
const o = R(), s = $(), a = L(), n = await _(t), l = U(), u = l ? await l.connect({
|
|
231
|
+
sessionId: o.sessionId,
|
|
232
|
+
browserInstanceId: k("spotlight.browser-instance", localStorage),
|
|
233
|
+
tabInstanceId: k("spotlight.tab-instance", sessionStorage),
|
|
234
|
+
signal: t
|
|
235
|
+
}) : void 0;
|
|
230
236
|
return {
|
|
231
237
|
hostManifest: n,
|
|
232
238
|
payload: {
|
|
233
|
-
projectId:
|
|
239
|
+
projectId: W(),
|
|
234
240
|
sessionId: o.sessionId,
|
|
241
|
+
...u ? {
|
|
242
|
+
capabilitySnapshotId: u.handshake.capabilitySnapshotId,
|
|
243
|
+
sessionBindingVersion: u.handshake.sessionBindingVersion
|
|
244
|
+
} : {},
|
|
235
245
|
userQuestion: e,
|
|
236
|
-
uiContext:
|
|
246
|
+
uiContext: q().getUiContext?.() ?? {},
|
|
237
247
|
sessionState: {
|
|
238
248
|
sessionId: o.sessionId,
|
|
239
249
|
activeTaskId: o.activeTaskId,
|
|
@@ -256,15 +266,21 @@ async function Z(e, t) {
|
|
|
256
266
|
lastResolvedTarget: s.lastResolvedTarget
|
|
257
267
|
},
|
|
258
268
|
clientToolsManifestVersion: n.version,
|
|
259
|
-
skills:
|
|
269
|
+
skills: E(A())
|
|
260
270
|
}
|
|
261
271
|
};
|
|
262
272
|
}
|
|
263
|
-
|
|
264
|
-
const o =
|
|
273
|
+
function k(e, t) {
|
|
274
|
+
const o = t.getItem(e);
|
|
275
|
+
if (o) return o;
|
|
276
|
+
const s = globalThis.crypto.randomUUID();
|
|
277
|
+
return t.setItem(e, s), s;
|
|
278
|
+
}
|
|
279
|
+
async function ft(e, t) {
|
|
280
|
+
const o = g(), s = t.getSignal(), { payload: a, hostManifest: n } = await tt(
|
|
265
281
|
e,
|
|
266
282
|
s
|
|
267
|
-
),
|
|
283
|
+
), l = new Set(n.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
|
|
268
284
|
method: "POST",
|
|
269
285
|
headers: y(),
|
|
270
286
|
body: JSON.stringify(a),
|
|
@@ -280,7 +296,7 @@ async function dt(e, t) {
|
|
|
280
296
|
s && (h.set(s, m), s.addEventListener(
|
|
281
297
|
"abort",
|
|
282
298
|
() => {
|
|
283
|
-
|
|
299
|
+
P(m);
|
|
284
300
|
},
|
|
285
301
|
{ once: !0 }
|
|
286
302
|
));
|
|
@@ -293,37 +309,37 @@ async function dt(e, t) {
|
|
|
293
309
|
);
|
|
294
310
|
if (!f.ok || !f.body)
|
|
295
311
|
throw new Error(`Spotlight 后端事件流连接失败:${f.status}`);
|
|
296
|
-
const T = f.body.getReader(),
|
|
297
|
-
let S = "",
|
|
312
|
+
const T = f.body.getReader(), x = new TextDecoder();
|
|
313
|
+
let S = "", I = null;
|
|
298
314
|
try {
|
|
299
315
|
for (; ; ) {
|
|
300
316
|
const { done: d, value: N } = await T.read();
|
|
301
317
|
if (d) break;
|
|
302
|
-
S +=
|
|
303
|
-
const
|
|
304
|
-
S =
|
|
305
|
-
for (const
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
allowedHostNames:
|
|
309
|
-
hostEffect:
|
|
318
|
+
S += x.decode(N, { stream: !0 });
|
|
319
|
+
const C = v(S);
|
|
320
|
+
S = C.rest;
|
|
321
|
+
for (const i of C.events) {
|
|
322
|
+
if (i.type === "host_action_request") {
|
|
323
|
+
const b = await J(i.request.call, t, {
|
|
324
|
+
allowedHostNames: l,
|
|
325
|
+
hostEffect: i.request.hostEffect
|
|
310
326
|
});
|
|
311
|
-
|
|
327
|
+
K(t, i, b), await Z({
|
|
312
328
|
runId: m,
|
|
313
|
-
correlationId:
|
|
314
|
-
result:
|
|
329
|
+
correlationId: i.request.correlationId,
|
|
330
|
+
result: b,
|
|
315
331
|
signal: s
|
|
316
332
|
});
|
|
317
333
|
continue;
|
|
318
334
|
}
|
|
319
|
-
if (
|
|
320
|
-
throw new Error(
|
|
321
|
-
if (await
|
|
322
|
-
return
|
|
335
|
+
if (i.type === "run_error")
|
|
336
|
+
throw new Error(i.error);
|
|
337
|
+
if (await X(t, i), i.type === "run_completed")
|
|
338
|
+
return i.sessionPatch && R().applySessionPatch(i.sessionPatch), I = i, {
|
|
323
339
|
command: null,
|
|
324
|
-
usedLegacyFallback:
|
|
325
|
-
memoryReplay:
|
|
326
|
-
assistantReply:
|
|
340
|
+
usedLegacyFallback: i.usedQueryLoop,
|
|
341
|
+
memoryReplay: i.memoryReplay ?? null,
|
|
342
|
+
assistantReply: i.assistantReply
|
|
327
343
|
};
|
|
328
344
|
}
|
|
329
345
|
}
|
|
@@ -332,10 +348,10 @@ async function dt(e, t) {
|
|
|
332
348
|
}
|
|
333
349
|
return {
|
|
334
350
|
command: null,
|
|
335
|
-
usedLegacyFallback:
|
|
351
|
+
usedLegacyFallback: I?.usedQueryLoop ?? !0
|
|
336
352
|
};
|
|
337
353
|
}
|
|
338
|
-
async function
|
|
354
|
+
async function P(e) {
|
|
339
355
|
await fetch(
|
|
340
356
|
`${g()}/v1/runs/${encodeURIComponent(e)}`,
|
|
341
357
|
{
|
|
@@ -344,14 +360,14 @@ async function _(e) {
|
|
|
344
360
|
}
|
|
345
361
|
);
|
|
346
362
|
}
|
|
347
|
-
function
|
|
363
|
+
function yt(e) {
|
|
348
364
|
if (!e) return;
|
|
349
365
|
const t = h.get(e);
|
|
350
|
-
t && (h.delete(e),
|
|
366
|
+
t && (h.delete(e), P(t));
|
|
351
367
|
}
|
|
352
368
|
export {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
369
|
+
P as cancelRemoteSpotlightRun,
|
|
370
|
+
yt as cancelRemoteSpotlightRunForSignal,
|
|
371
|
+
ft as runRemoteSpotlightPipeline,
|
|
372
|
+
mt as warmupSpotlightRemoteContext
|
|
357
373
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inupedia/spotlight-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Vue plugin and config entry for Inupedia Spotlight (monorepo workspace package)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"dependencies": {
|
|
96
96
|
"prettier": "^3.8.1",
|
|
97
97
|
"yaml": "^2.8.4",
|
|
98
|
-
"@inupedia/spotlight-client": "0.
|
|
99
|
-
"@inupedia/spotlight-protocol": "0.
|
|
98
|
+
"@inupedia/spotlight-client": "0.3.0",
|
|
99
|
+
"@inupedia/spotlight-protocol": "0.3.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@inspira-ui/plugins": "^0.0.2",
|