@inupedia/spotlight-vue 0.2.14 → 0.3.1
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 +33 -0
- package/dist/createSpotlight.d.ts.map +1 -0
- package/dist/createSpotlight.js +69 -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 +7 -0
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +116 -95
- package/package.json +3 -3
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
dispose(): void;
|
|
9
|
+
pendingBuild(): Readonly<CapabilityBuildInfoV1> | undefined;
|
|
10
|
+
notifyBuild(buildInfo: Readonly<CapabilityBuildInfoV1>): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const SPOTLIGHT_CAPABILITY_RUNTIME_KEY: InjectionKey<SpotlightCapabilityRuntimeV1>;
|
|
13
|
+
export declare function getSpotlightCapabilityRuntime(): SpotlightCapabilityRuntimeV1 | undefined;
|
|
14
|
+
export interface CreateSpotlightOptionsV1 {
|
|
15
|
+
endpoint: string;
|
|
16
|
+
project: SpotlightProjectV1;
|
|
17
|
+
capabilities?: {
|
|
18
|
+
capabilityBuildInfo: Readonly<CapabilityBuildInfoV1>;
|
|
19
|
+
openUploadStream: NonNullable<CreateSpotlightOptionsV1["openUploadStream"]>;
|
|
20
|
+
};
|
|
21
|
+
capabilityBuildInfo?: Readonly<CapabilityBuildInfoV1>;
|
|
22
|
+
openUploadStream?: () => Promise<{
|
|
23
|
+
digest: string;
|
|
24
|
+
byteLength: number;
|
|
25
|
+
contentType: "application/gzip";
|
|
26
|
+
stream: ReadableStream<Uint8Array>;
|
|
27
|
+
}>;
|
|
28
|
+
fetch?: typeof globalThis.fetch;
|
|
29
|
+
createWebSocket?: (url: string) => WebSocket;
|
|
30
|
+
}
|
|
31
|
+
export type SpotlightPluginV1 = Plugin & SpotlightCapabilityRuntimeV1;
|
|
32
|
+
export declare function createSpotlight(options: CreateSpotlightOptionsV1): SpotlightPluginV1;
|
|
33
|
+
//# 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,EAKL,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,OAAO,IAAI,IAAI,CAAC;IAChB,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,CA2EpF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createFrontendToolRegistry as j, subscribeCapabilityRuntimeV1 as B, createCapabilityClient as C, waitForCapabilityRuntimeV1 as S } from "@inupedia/spotlight-client";
|
|
2
|
+
const w = /* @__PURE__ */ Symbol("spotlight-capability-runtime");
|
|
3
|
+
let d;
|
|
4
|
+
function E() {
|
|
5
|
+
return d;
|
|
6
|
+
}
|
|
7
|
+
function M(t) {
|
|
8
|
+
const m = j(t.project), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
9
|
+
let u, a, b, l;
|
|
10
|
+
const I = (e) => a || (t.capabilities ? a = Promise.resolve(t.capabilities) : t.capabilityBuildInfo && t.openUploadStream ? a = Promise.resolve({ capabilityBuildInfo: t.capabilityBuildInfo, openUploadStream: t.openUploadStream }) : S(t.project.projectId, e)), i = Object.assign(
|
|
11
|
+
{
|
|
12
|
+
project: t.project,
|
|
13
|
+
async connect(e) {
|
|
14
|
+
const s = r.get(e.sessionId);
|
|
15
|
+
if (s) return s;
|
|
16
|
+
const g = n.get(e.sessionId);
|
|
17
|
+
if (g) return g.promise;
|
|
18
|
+
const o = new AbortController(), y = () => o.abort(e.signal?.reason);
|
|
19
|
+
e.signal?.aborted ? o.abort(e.signal.reason) : e.signal?.addEventListener("abort", y, { once: !0 });
|
|
20
|
+
const v = () => e.signal?.removeEventListener("abort", y), p = (async () => {
|
|
21
|
+
const c = await I(o.signal);
|
|
22
|
+
b ??= C({
|
|
23
|
+
endpoint: t.endpoint,
|
|
24
|
+
project: t.project,
|
|
25
|
+
registry: m,
|
|
26
|
+
buildInfo: c.capabilityBuildInfo,
|
|
27
|
+
openUploadStream: c.openUploadStream,
|
|
28
|
+
fetch: t.fetch,
|
|
29
|
+
createWebSocket: t.createWebSocket
|
|
30
|
+
});
|
|
31
|
+
const f = await b.connect({ ...e, signal: o.signal });
|
|
32
|
+
if (o.signal.aborted)
|
|
33
|
+
throw f.channel?.close(), new DOMException("Capability connect aborted.", "AbortError");
|
|
34
|
+
return r.set(e.sessionId, f), f;
|
|
35
|
+
})();
|
|
36
|
+
n.set(e.sessionId, { promise: p, controller: o, cleanup: v });
|
|
37
|
+
try {
|
|
38
|
+
return await p;
|
|
39
|
+
} finally {
|
|
40
|
+
const c = n.get(e.sessionId);
|
|
41
|
+
c?.promise === p && (c.cleanup(), n.delete(e.sessionId));
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
disconnect(e) {
|
|
45
|
+
n.get(e)?.controller.abort(new DOMException("Capability connect disconnected.", "AbortError")), r.get(e)?.channel?.close(), r.delete(e);
|
|
46
|
+
},
|
|
47
|
+
dispose() {
|
|
48
|
+
for (const e of r.values()) e.channel?.close();
|
|
49
|
+
r.clear();
|
|
50
|
+
for (const e of n.values())
|
|
51
|
+
e.controller.abort(new DOMException("Spotlight disposed.", "AbortError")), e.cleanup();
|
|
52
|
+
n.clear(), l?.(), l = void 0, d === i && (d = void 0);
|
|
53
|
+
},
|
|
54
|
+
pendingBuild: () => u,
|
|
55
|
+
notifyBuild(e) {
|
|
56
|
+
r.size > 0 || e.artifactDigest !== t.capabilityBuildInfo?.artifactDigest ? u = Object.freeze({ ...e }) : (a = void 0, b = void 0);
|
|
57
|
+
},
|
|
58
|
+
install(e) {
|
|
59
|
+
d = i, l?.(), l = B(t.project.projectId, (s) => i.notifyBuild(s)), e.provide(w, i);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return Object.freeze(i), i;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
w as SPOTLIGHT_CAPABILITY_RUNTIME_KEY,
|
|
67
|
+
M as createSpotlight,
|
|
68
|
+
E as getSpotlightCapabilityRuntime
|
|
69
|
+
};
|
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,EACr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B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAC1F,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,eAAe,EACpB,KAAK,yBAAyB,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,GAC1B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,EAChC,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,eAAe,EACf,gCAAgC,EAChC,KAAK,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,6 +1,13 @@
|
|
|
1
1
|
import type { HandlerApi } from "../store/pipeline/types.js";
|
|
2
2
|
import type { SpotlightPipelineRunOutcome } from "./types.js";
|
|
3
3
|
export declare function warmupSpotlightRemoteContext(signal?: AbortSignal): Promise<void>;
|
|
4
|
+
export declare function composeRunCapabilityPayload<T extends Record<string, unknown>>(legacyPayload: T, capability?: {
|
|
5
|
+
capabilitySnapshotId: string;
|
|
6
|
+
sessionBindingVersion: number;
|
|
7
|
+
}): Omit<T, "skills"> & {
|
|
8
|
+
capabilitySnapshotId?: string;
|
|
9
|
+
sessionBindingVersion?: number;
|
|
10
|
+
};
|
|
4
11
|
export declare function runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi): Promise<SpotlightPipelineRunOutcome>;
|
|
5
12
|
export declare function cancelRemoteSpotlightRun(runId: string): Promise<void>;
|
|
6
13
|
export declare function cancelRemoteSpotlightRunForSignal(signal?: AbortSignal): void;
|
|
@@ -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;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,aAAa,EAAE,CAAC,EAChB,UAAU,CAAC,EAAE;IAAE,oBAAoB,EAAE,MAAM,CAAC;IAAC,qBAAqB,EAAE,MAAM,CAAA;CAAE,GAC3E,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAAE,CAIvF;AA6DD,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
|
-
const
|
|
20
|
-
return e.setSteps([...e.getSteps(),
|
|
20
|
+
const l = { id: t, label: o, status: "pending" };
|
|
21
|
+
return e.setSteps([...e.getSteps(), l]), l;
|
|
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",
|
|
@@ -91,10 +92,10 @@ function p(e, t) {
|
|
|
91
92
|
const o = e.getSteps().find((s) => s.id === t);
|
|
92
93
|
!o || o.status === "active" || o.status === "done" || e.setStep(t, "active", o.content);
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function k(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:
|
|
116
|
-
s =
|
|
116
|
+
const { intent: l, misplacedPlanning: n } = H(s);
|
|
117
|
+
s = l, n.trim() && (c(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
|
|
117
118
|
r.tool,
|
|
118
119
|
n
|
|
119
120
|
));
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
+
c(e, o, k(o, t.label)), t.mode === "replace" ? e.setStep(
|
|
122
123
|
o,
|
|
123
|
-
e.getSteps().find((
|
|
124
|
+
e.getSteps().find((l) => l.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, k(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:
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
c(e, r.tool, "执行工具与回答");
|
|
181
|
+
const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: l } = M(o?.content ?? ""), n = t.content.trim(), a = l.trim();
|
|
182
|
+
a && n && (a === n || n.startsWith(
|
|
183
|
+
a.slice(0, Math.min(a.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
|
-
return { events: t.flatMap((
|
|
213
|
-
const n =
|
|
213
|
+
return { events: t.flatMap((l) => {
|
|
214
|
+
const n = l.split(/\n/u).find((a) => a.startsWith("data: "));
|
|
214
215
|
if (!n) return [];
|
|
215
216
|
try {
|
|
216
217
|
return [JSON.parse(n.slice(6))];
|
|
@@ -219,21 +220,31 @@ function X(e) {
|
|
|
219
220
|
}
|
|
220
221
|
}), rest: o };
|
|
221
222
|
}
|
|
222
|
-
async function
|
|
223
|
+
async function ft(e) {
|
|
223
224
|
await Promise.allSettled([
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
_(e),
|
|
226
|
+
D(e)
|
|
226
227
|
]);
|
|
227
228
|
}
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
function tt(e, t) {
|
|
230
|
+
if (!t) return e;
|
|
231
|
+
const { skills: o, ...s } = e;
|
|
232
|
+
return { ...s, ...t };
|
|
233
|
+
}
|
|
234
|
+
async function et(e, t) {
|
|
235
|
+
const o = R(), s = $(), l = L(), n = await _(t), a = U(), u = a ? await a.connect({
|
|
236
|
+
sessionId: o.sessionId,
|
|
237
|
+
browserInstanceId: w("spotlight.browser-instance", localStorage),
|
|
238
|
+
tabInstanceId: w("spotlight.tab-instance", sessionStorage),
|
|
239
|
+
signal: t
|
|
240
|
+
}) : void 0;
|
|
230
241
|
return {
|
|
231
242
|
hostManifest: n,
|
|
232
|
-
payload: {
|
|
233
|
-
projectId:
|
|
243
|
+
payload: tt({
|
|
244
|
+
projectId: W(),
|
|
234
245
|
sessionId: o.sessionId,
|
|
235
246
|
userQuestion: e,
|
|
236
|
-
uiContext:
|
|
247
|
+
uiContext: q().getUiContext?.() ?? {},
|
|
237
248
|
sessionState: {
|
|
238
249
|
sessionId: o.sessionId,
|
|
239
250
|
activeTaskId: o.activeTaskId,
|
|
@@ -245,7 +256,7 @@ async function Z(e, t) {
|
|
|
245
256
|
lastAssistantReply: o.getLastAssistantContent(),
|
|
246
257
|
invokedSkills: o.invokedSkills,
|
|
247
258
|
skillPermissionGrants: o.skillPermissionGrants,
|
|
248
|
-
memoryReadEnabled:
|
|
259
|
+
memoryReadEnabled: l.enabled,
|
|
249
260
|
memoryWriteEnabled: !0
|
|
250
261
|
},
|
|
251
262
|
runtimeState: {
|
|
@@ -256,18 +267,27 @@ async function Z(e, t) {
|
|
|
256
267
|
lastResolvedTarget: s.lastResolvedTarget
|
|
257
268
|
},
|
|
258
269
|
clientToolsManifestVersion: n.version,
|
|
259
|
-
skills:
|
|
260
|
-
}
|
|
270
|
+
skills: E(A())
|
|
271
|
+
}, u ? {
|
|
272
|
+
capabilitySnapshotId: u.handshake.capabilitySnapshotId,
|
|
273
|
+
sessionBindingVersion: u.handshake.sessionBindingVersion
|
|
274
|
+
} : void 0)
|
|
261
275
|
};
|
|
262
276
|
}
|
|
263
|
-
|
|
264
|
-
const o =
|
|
277
|
+
function w(e, t) {
|
|
278
|
+
const o = t.getItem(e);
|
|
279
|
+
if (o) return o;
|
|
280
|
+
const s = globalThis.crypto.randomUUID();
|
|
281
|
+
return t.setItem(e, s), s;
|
|
282
|
+
}
|
|
283
|
+
async function yt(e, t) {
|
|
284
|
+
const o = g(), s = t.getSignal(), { payload: l, hostManifest: n } = await et(
|
|
265
285
|
e,
|
|
266
286
|
s
|
|
267
|
-
),
|
|
287
|
+
), a = new Set(n.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
|
|
268
288
|
method: "POST",
|
|
269
289
|
headers: y(),
|
|
270
|
-
body: JSON.stringify(
|
|
290
|
+
body: JSON.stringify(l),
|
|
271
291
|
signal: s
|
|
272
292
|
});
|
|
273
293
|
if (!u.ok) {
|
|
@@ -280,7 +300,7 @@ async function dt(e, t) {
|
|
|
280
300
|
s && (h.set(s, m), s.addEventListener(
|
|
281
301
|
"abort",
|
|
282
302
|
() => {
|
|
283
|
-
|
|
303
|
+
P(m);
|
|
284
304
|
},
|
|
285
305
|
{ once: !0 }
|
|
286
306
|
));
|
|
@@ -293,37 +313,37 @@ async function dt(e, t) {
|
|
|
293
313
|
);
|
|
294
314
|
if (!f.ok || !f.body)
|
|
295
315
|
throw new Error(`Spotlight 后端事件流连接失败:${f.status}`);
|
|
296
|
-
const T = f.body.getReader(),
|
|
297
|
-
let S = "",
|
|
316
|
+
const T = f.body.getReader(), x = new TextDecoder();
|
|
317
|
+
let S = "", I = null;
|
|
298
318
|
try {
|
|
299
319
|
for (; ; ) {
|
|
300
320
|
const { done: d, value: N } = await T.read();
|
|
301
321
|
if (d) break;
|
|
302
|
-
S +=
|
|
303
|
-
const
|
|
304
|
-
S =
|
|
305
|
-
for (const
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
allowedHostNames:
|
|
309
|
-
hostEffect:
|
|
322
|
+
S += x.decode(N, { stream: !0 });
|
|
323
|
+
const C = v(S);
|
|
324
|
+
S = C.rest;
|
|
325
|
+
for (const i of C.events) {
|
|
326
|
+
if (i.type === "host_action_request") {
|
|
327
|
+
const b = await J(i.request.call, t, {
|
|
328
|
+
allowedHostNames: a,
|
|
329
|
+
hostEffect: i.request.hostEffect
|
|
310
330
|
});
|
|
311
|
-
|
|
331
|
+
K(t, i, b), await Z({
|
|
312
332
|
runId: m,
|
|
313
|
-
correlationId:
|
|
314
|
-
result:
|
|
333
|
+
correlationId: i.request.correlationId,
|
|
334
|
+
result: b,
|
|
315
335
|
signal: s
|
|
316
336
|
});
|
|
317
337
|
continue;
|
|
318
338
|
}
|
|
319
|
-
if (
|
|
320
|
-
throw new Error(
|
|
321
|
-
if (await
|
|
322
|
-
return
|
|
339
|
+
if (i.type === "run_error")
|
|
340
|
+
throw new Error(i.error);
|
|
341
|
+
if (await X(t, i), i.type === "run_completed")
|
|
342
|
+
return i.sessionPatch && R().applySessionPatch(i.sessionPatch), I = i, {
|
|
323
343
|
command: null,
|
|
324
|
-
usedLegacyFallback:
|
|
325
|
-
memoryReplay:
|
|
326
|
-
assistantReply:
|
|
344
|
+
usedLegacyFallback: i.usedQueryLoop,
|
|
345
|
+
memoryReplay: i.memoryReplay ?? null,
|
|
346
|
+
assistantReply: i.assistantReply
|
|
327
347
|
};
|
|
328
348
|
}
|
|
329
349
|
}
|
|
@@ -332,10 +352,10 @@ async function dt(e, t) {
|
|
|
332
352
|
}
|
|
333
353
|
return {
|
|
334
354
|
command: null,
|
|
335
|
-
usedLegacyFallback:
|
|
355
|
+
usedLegacyFallback: I?.usedQueryLoop ?? !0
|
|
336
356
|
};
|
|
337
357
|
}
|
|
338
|
-
async function
|
|
358
|
+
async function P(e) {
|
|
339
359
|
await fetch(
|
|
340
360
|
`${g()}/v1/runs/${encodeURIComponent(e)}`,
|
|
341
361
|
{
|
|
@@ -344,14 +364,15 @@ async function _(e) {
|
|
|
344
364
|
}
|
|
345
365
|
);
|
|
346
366
|
}
|
|
347
|
-
function
|
|
367
|
+
function St(e) {
|
|
348
368
|
if (!e) return;
|
|
349
369
|
const t = h.get(e);
|
|
350
|
-
t && (h.delete(e),
|
|
370
|
+
t && (h.delete(e), P(t));
|
|
351
371
|
}
|
|
352
372
|
export {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
373
|
+
P as cancelRemoteSpotlightRun,
|
|
374
|
+
St as cancelRemoteSpotlightRunForSignal,
|
|
375
|
+
tt as composeRunCapabilityPayload,
|
|
376
|
+
yt as runRemoteSpotlightPipeline,
|
|
377
|
+
ft as warmupSpotlightRemoteContext
|
|
357
378
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inupedia/spotlight-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
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.1",
|
|
99
|
+
"@inupedia/spotlight-protocol": "0.3.1"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@inspira-ui/plugins": "^0.0.2",
|