@inupedia/spotlight-vue 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/spotlight-vue.css +1 -1
- package/dist/components/SpotlightCommandPanel.vue.d.ts.map +1 -1
- package/dist/components/SpotlightCommandPanel.vue.js +2 -2
- package/dist/components/SpotlightCommandPanel2.vue.js +112 -97
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +96 -93
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +65 -63
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +23 -20
- package/dist/store/memoryPreferenceStore.d.ts +19 -0
- package/dist/store/memoryPreferenceStore.d.ts.map +1 -0
- package/dist/store/memoryPreferenceStore.js +43 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,39 +2,40 @@ import { SPOTLIGHT_CONFIG_KEY as e, defineSpotlightConfig as r } from "./config.
|
|
|
2
2
|
import { resolveSpotlightConfig as n } from "./resolveConfig.js";
|
|
3
3
|
import { defineSpotlightApp as S, readSpotlightEnv as l } from "./host/defineApp.js";
|
|
4
4
|
import { defineSpotlightHost as m } from "./host/defineHost.js";
|
|
5
|
-
import { normalizeSkillsOption as
|
|
5
|
+
import { normalizeSkillsOption as a } from "./host/normalizeSkills.js";
|
|
6
6
|
import { mergeSpotlightSkills as f } from "./host/mergeSkills.js";
|
|
7
|
-
import { SPOTLIGHT_HOST_ADAPTER_KEY as
|
|
7
|
+
import { SPOTLIGHT_HOST_ADAPTER_KEY as h, SPOTLIGHT_HTTP_KEY as u, SpotlightVue as E, getSpotlightConfig as _, getSpotlightHostAdapter as d, getSpotlightHttp as I } from "./plugin.js";
|
|
8
8
|
import { useSpotlightStore as C } from "./store/spotlightStore.js";
|
|
9
|
-
import { INVESTMENT_SUB_INTENT_LABELS as
|
|
10
|
-
import { useSpotlightRuntimeStore as
|
|
11
|
-
import { useAgentSessionStore as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
9
|
+
import { INVESTMENT_SUB_INTENT_LABELS as O, InvestmentSubIntent as c, PROGRESS_SUB_INTENT_LABELS as N, ProgressSubIntent as k, QUALITY_SUB_INTENT_LABELS as A, QualitySubIntent as w, SAFETY_SUB_INTENT_LABELS as R, SPOTLIGHT_INTENT_LABELS as b, SUB_INTENT_CONFIG as B, SafetySubIntent as H, SpotlightCommandDomain as M, SpotlightCommandScope as G, SpotlightIntent as F } from "./store/types.js";
|
|
10
|
+
import { useSpotlightRuntimeStore as y } from "./store/runtimeStore.js";
|
|
11
|
+
import { useAgentSessionStore as W } from "./session/agentSession.js";
|
|
12
|
+
import { readSpotlightMemoryEnabled as D, useSpotlightMemoryPreferenceStore as z } from "./store/memoryPreferenceStore.js";
|
|
13
|
+
import { getSkillsPoolForRun as Q, loadBundledSkillsFromGlob as J } from "./skills/index.js";
|
|
14
|
+
import { cancelRemoteSpotlightRunForSignal as j, runRemoteSpotlightPipeline as q, warmupSpotlightRemoteContext as X } from "./remote/runPipeline.js";
|
|
15
|
+
import { ensureSpotlightMeta as $, getSpotlightUiPrompts as tt } from "./remote/meta.js";
|
|
16
|
+
import { extractTranscriptionText as et, normalizeSpeakText as rt, spotlightSynthesizeSpeech as pt, spotlightTranscribeAudio as nt } from "./remote/audio.js";
|
|
17
|
+
import { getSpotlightJson as St, postSpotlightJson as lt } from "./remote/serverJson.js";
|
|
18
|
+
import { TOOL_NAMES as mt } from "./constants/toolNames.js";
|
|
19
|
+
import { TOOL_STEP_ANSWER_DELIMITER as at, composeToolStepContent as Tt, getIntentStepDisplayContent as ft, humanizeSpotlightStepContent as xt, isLoopPlanningChunk as ht, isToolExecutionStep as ut, sanitizeToolStepAnswerText as Et, splitIntentStepContent as _t, splitToolStepContent as dt } from "./store/pipeline/displayText.js";
|
|
20
|
+
import { isInternalKnowledgeEvidenceTool as Lt, isUserFacingKnowledgeTool as Ct, partitionToolCalls as Pt } from "./store/pipeline/toolDisplay.js";
|
|
21
|
+
import { SPOTLIGHT_PIPELINE_STEP_IDS as ct, SPOTLIGHT_PIPELINE_STEP_LABELS as Nt } from "./store/pipeline/constants.js";
|
|
22
|
+
import { formatSpotlightKnowledgeMarkdown as At, initSpotlightMarkdownPreview as wt, preprocessKnowledgeMarkdown as Rt } from "./store/pipeline/spotlightMarkdown.js";
|
|
23
|
+
import { formatToolFailure as Bt } from "./store/pipeline/errors.js";
|
|
24
|
+
import { getSuggestedQuestions as Mt } from "./store/capabilities.js";
|
|
25
|
+
import { useSpotlightPanelUi as Ft } from "./composables/useSpotlightPanelUi.js";
|
|
26
|
+
import { useSpotlightCommandShortcuts as yt } from "./composables/useSpotlightCommandShortcuts.js";
|
|
27
|
+
import { isGenericHostExecutionReply as Wt } from "./avatar/speech/live2dAnswerSpeechPolicy.js";
|
|
28
|
+
import { COMMON_WORKFLOW_STEPS as Dt, buildCommonSteps as zt, buildCommonWorkflowSteps as Yt } from "./workflow/shared.js";
|
|
29
|
+
import { runHostTool as Jt } from "./workflow/runHostTool.js";
|
|
30
|
+
import { buildOperateWorkflowSteps as jt, createOperateExecutor as qt, isOperateWorkflowContext as Xt } from "./workflow/operate.js";
|
|
31
|
+
import { createOperateDefinition as $t } from "./workflow/createOperateDefinition.js";
|
|
32
|
+
import { buildOperateCommandContext as oo, buildRepeatLastAnswerContext as eo, buildSessionControlWorkflowSteps as ro, createRunSessionHostTool as po, createSessionControlExecutor as no } from "./workflow/sessionControl.js";
|
|
33
|
+
import { formatSkillsWithinBudget as So } from "./skills/skillListing.js";
|
|
34
|
+
import { getBypassMatchedSkills as so, getModelInvokableSkills as mo } from "./skills/matching.js";
|
|
35
|
+
import { parseSpotlightSkillMarkdown as ao } from "./skills/parser.js";
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
Dt as COMMON_WORKFLOW_STEPS,
|
|
38
|
+
O as INVESTMENT_SUB_INTENT_LABELS,
|
|
38
39
|
c as InvestmentSubIntent,
|
|
39
40
|
N as PROGRESS_SUB_INTENT_LABELS,
|
|
40
41
|
k as ProgressSubIntent,
|
|
@@ -42,78 +43,80 @@ export {
|
|
|
42
43
|
w as QualitySubIntent,
|
|
43
44
|
R as SAFETY_SUB_INTENT_LABELS,
|
|
44
45
|
e as SPOTLIGHT_CONFIG_KEY,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
h as SPOTLIGHT_HOST_ADAPTER_KEY,
|
|
47
|
+
u as SPOTLIGHT_HTTP_KEY,
|
|
48
|
+
b as SPOTLIGHT_INTENT_LABELS,
|
|
49
|
+
ct as SPOTLIGHT_PIPELINE_STEP_IDS,
|
|
50
|
+
Nt as SPOTLIGHT_PIPELINE_STEP_LABELS,
|
|
51
|
+
B as SUB_INTENT_CONFIG,
|
|
52
|
+
H as SafetySubIntent,
|
|
52
53
|
M as SpotlightCommandDomain,
|
|
53
54
|
G as SpotlightCommandScope,
|
|
54
55
|
F as SpotlightIntent,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
E as SpotlightVue,
|
|
57
|
+
mt as TOOL_NAMES,
|
|
58
|
+
at as TOOL_STEP_ANSWER_DELIMITER,
|
|
59
|
+
zt as buildCommonSteps,
|
|
60
|
+
Yt as buildCommonWorkflowSteps,
|
|
61
|
+
oo as buildOperateCommandContext,
|
|
62
|
+
jt as buildOperateWorkflowSteps,
|
|
63
|
+
eo as buildRepeatLastAnswerContext,
|
|
64
|
+
ro as buildSessionControlWorkflowSteps,
|
|
65
|
+
j as cancelRemoteSpotlightRunForSignal,
|
|
66
|
+
Tt as composeToolStepContent,
|
|
67
|
+
$t as createOperateDefinition,
|
|
68
|
+
qt as createOperateExecutor,
|
|
69
|
+
po as createRunSessionHostTool,
|
|
70
|
+
no as createSessionControlExecutor,
|
|
70
71
|
S as defineSpotlightApp,
|
|
71
72
|
r as defineSpotlightConfig,
|
|
72
73
|
m as defineSpotlightHost,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
$ as ensureSpotlightMeta,
|
|
75
|
+
et as extractTranscriptionText,
|
|
76
|
+
So as formatSkillsWithinBudget,
|
|
77
|
+
At as formatSpotlightKnowledgeMarkdown,
|
|
78
|
+
Bt as formatToolFailure,
|
|
79
|
+
so as getBypassMatchedSkills,
|
|
80
|
+
ft as getIntentStepDisplayContent,
|
|
81
|
+
mo as getModelInvokableSkills,
|
|
82
|
+
Q as getSkillsPoolForRun,
|
|
82
83
|
_ as getSpotlightConfig,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
d as getSpotlightHostAdapter,
|
|
85
|
+
I as getSpotlightHttp,
|
|
86
|
+
St as getSpotlightJson,
|
|
87
|
+
tt as getSpotlightUiPrompts,
|
|
88
|
+
Mt as getSuggestedQuestions,
|
|
89
|
+
xt as humanizeSpotlightStepContent,
|
|
90
|
+
wt as initSpotlightMarkdownPreview,
|
|
91
|
+
Wt as isGenericHostExecutionReply,
|
|
92
|
+
Lt as isInternalKnowledgeEvidenceTool,
|
|
93
|
+
ht as isLoopPlanningChunk,
|
|
94
|
+
Xt as isOperateWorkflowContext,
|
|
95
|
+
ut as isToolExecutionStep,
|
|
96
|
+
Ct as isUserFacingKnowledgeTool,
|
|
97
|
+
J as loadBundledSkillsFromGlob,
|
|
97
98
|
f as mergeSpotlightSkills,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
a as normalizeSkillsOption,
|
|
100
|
+
rt as normalizeSpeakText,
|
|
101
|
+
ao as parseSpotlightSkillMarkdown,
|
|
102
|
+
Pt as partitionToolCalls,
|
|
103
|
+
lt as postSpotlightJson,
|
|
104
|
+
Rt as preprocessKnowledgeMarkdown,
|
|
104
105
|
l as readSpotlightEnv,
|
|
106
|
+
D as readSpotlightMemoryEnabled,
|
|
105
107
|
n as resolveSpotlightConfig,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
Jt as runHostTool,
|
|
109
|
+
q as runRemoteSpotlightPipeline,
|
|
110
|
+
Et as sanitizeToolStepAnswerText,
|
|
111
|
+
_t as splitIntentStepContent,
|
|
112
|
+
dt as splitToolStepContent,
|
|
113
|
+
pt as spotlightSynthesizeSpeech,
|
|
114
|
+
nt as spotlightTranscribeAudio,
|
|
115
|
+
W as useAgentSessionStore,
|
|
116
|
+
yt as useSpotlightCommandShortcuts,
|
|
117
|
+
z as useSpotlightMemoryPreferenceStore,
|
|
118
|
+
Ft as useSpotlightPanelUi,
|
|
119
|
+
y as useSpotlightRuntimeStore,
|
|
117
120
|
C as useSpotlightStore,
|
|
118
|
-
|
|
121
|
+
X as warmupSpotlightRemoteContext
|
|
119
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"
|
|
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;AAub9D,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAwCD,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,2BAA2B,CAAC,CAgGtC;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,MAAM,iBAQ3D;AAED,wBAAgB,iCAAiC,CAAC,MAAM,CAAC,EAAE,WAAW,QAMrE"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { serializeSkillsForRemote as x } from "@inupedia/spotlight-client";
|
|
2
2
|
import { getSkillsPoolForRun as E } from "../skills/index.js";
|
|
3
3
|
import { useAgentSessionStore as R } from "../session/agentSession.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useSpotlightMemoryPreferenceStore as A } from "../store/memoryPreferenceStore.js";
|
|
5
|
+
import { useSpotlightRuntimeStore as L } from "../store/runtimeStore.js";
|
|
5
6
|
import { SPOTLIGHT_PIPELINE_STEP_IDS as r } from "../store/pipeline/constants.js";
|
|
6
|
-
import { isLoopPlanningChunk as
|
|
7
|
+
import { isLoopPlanningChunk as $, splitIntentStepContent as O, splitToolStepContent as H, composeToolStepContent as M } from "../store/pipeline/displayText.js";
|
|
7
8
|
import { getSpotlightConfig as F } from "../plugin.js";
|
|
8
|
-
import { executeRemoteHostTool as
|
|
9
|
-
import { getSpotlightServerBase as h, buildSpotlightJsonHeaders as
|
|
10
|
-
import { ensureSpotlightMeta as
|
|
9
|
+
import { executeRemoteHostTool as q, ensureHostToolsManifest as _ } from "./hostToolRunner.js";
|
|
10
|
+
import { getSpotlightServerBase as h, buildSpotlightJsonHeaders as y, getSpotlightProjectId as J } from "./httpConfig.js";
|
|
11
|
+
import { ensureSpotlightMeta as W } from "./meta.js";
|
|
11
12
|
const g = /* @__PURE__ */ new WeakMap();
|
|
12
|
-
function
|
|
13
|
+
function D(e) {
|
|
13
14
|
return e.type !== "host_action_request" && e.type !== "run_completed" && e.type !== "run_error" && e.type !== "ping";
|
|
14
15
|
}
|
|
15
16
|
function a(e, t, o) {
|
|
16
|
-
const s = e.getSteps().find((
|
|
17
|
+
const s = e.getSteps().find((n) => n.id === t);
|
|
17
18
|
if (s) return s;
|
|
18
|
-
const
|
|
19
|
-
return e.setSteps([...e.getSteps(),
|
|
19
|
+
const l = { id: t, label: o, status: "pending" };
|
|
20
|
+
return e.setSteps([...e.getSteps(), l]), l;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function j() {
|
|
22
23
|
return new Promise((e) => {
|
|
23
24
|
requestAnimationFrame(() => e());
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function U(e) {
|
|
27
28
|
const t = e.summary?.trim();
|
|
28
29
|
if (t && t.length > 48 && !t.startsWith("{") && !t.startsWith("["))
|
|
29
30
|
return t;
|
|
@@ -35,8 +36,8 @@ function j(e) {
|
|
|
35
36
|
}
|
|
36
37
|
return t || "";
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
const t =
|
|
39
|
+
function z(e) {
|
|
40
|
+
const t = U(e.result);
|
|
40
41
|
return {
|
|
41
42
|
id: e.result.call.id,
|
|
42
43
|
name: e.result.call.name,
|
|
@@ -49,7 +50,7 @@ function U(e) {
|
|
|
49
50
|
status: e.result.success ? "done" : "error"
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function G(e) {
|
|
53
54
|
return {
|
|
54
55
|
id: e.call.id,
|
|
55
56
|
name: e.call.name,
|
|
@@ -58,7 +59,7 @@ function z(e) {
|
|
|
58
59
|
status: "running"
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function B(e, t) {
|
|
62
63
|
const o = t.success ? "前端操作已执行。" : t.error || "前端操作执行失败。";
|
|
63
64
|
return {
|
|
64
65
|
id: e.id,
|
|
@@ -72,13 +73,13 @@ function G(e, t) {
|
|
|
72
73
|
status: t.success ? "done" : "error"
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function Q(e) {
|
|
76
77
|
return e.startsWith("panel.") || e.startsWith("navigate.") || e.startsWith("session.");
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
-
if (!
|
|
79
|
+
function V(e, t, o) {
|
|
80
|
+
if (!Q(t.request.call.name)) return;
|
|
80
81
|
a(e, r.tool, "执行工具与回答");
|
|
81
|
-
const s =
|
|
82
|
+
const s = B(t.request.call, o);
|
|
82
83
|
e.appendToolCallsToStep(r.tool, [s]), e.setStep(
|
|
83
84
|
r.tool,
|
|
84
85
|
o.success ? "done" : "error",
|
|
@@ -93,7 +94,7 @@ function p(e, t) {
|
|
|
93
94
|
function w(e, t) {
|
|
94
95
|
return t || (e === r.tool ? "执行工具与回答" : e);
|
|
95
96
|
}
|
|
96
|
-
async function
|
|
97
|
+
async function Y(e, t) {
|
|
97
98
|
if (t.type !== "ping") {
|
|
98
99
|
if (t.type === "step_sync")
|
|
99
100
|
e.setSteps(
|
|
@@ -108,25 +109,25 @@ async function V(e, t) {
|
|
|
108
109
|
a(e, t.stepId, t.label ?? t.stepId), e.setStep(t.stepId, t.status, t.content);
|
|
109
110
|
else if (t.type === "step_content") {
|
|
110
111
|
let o = t.stepId, s = t.content;
|
|
111
|
-
if (o === r.intent &&
|
|
112
|
+
if (o === r.intent && $(s))
|
|
112
113
|
o = r.tool;
|
|
113
114
|
else if (o === r.intent && t.mode === "replace") {
|
|
114
|
-
const { intent:
|
|
115
|
-
s =
|
|
115
|
+
const { intent: l, misplacedPlanning: n } = O(s);
|
|
116
|
+
s = l, n.trim() && (a(e, r.tool, "执行工具与回答"), e.appendChunkToStep(
|
|
116
117
|
r.tool,
|
|
117
|
-
|
|
118
|
+
n
|
|
118
119
|
));
|
|
119
120
|
}
|
|
120
121
|
a(e, o, w(o, t.label)), t.mode === "replace" ? e.setStep(
|
|
121
122
|
o,
|
|
122
|
-
e.getSteps().find((
|
|
123
|
+
e.getSteps().find((l) => l.id === o)?.status ?? "active",
|
|
123
124
|
s
|
|
124
|
-
) : (p(e, o), e.appendChunkToStep(o, s), await
|
|
125
|
+
) : (p(e, o), e.appendChunkToStep(o, s), await j());
|
|
125
126
|
} else if (t.type === "step_artifact")
|
|
126
127
|
a(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);
|
|
127
128
|
else if (t.type === "tool_start")
|
|
128
129
|
a(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
129
|
-
|
|
130
|
+
G(t)
|
|
130
131
|
]);
|
|
131
132
|
else if (t.type === "tool_progress")
|
|
132
133
|
a(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
@@ -141,7 +142,7 @@ async function V(e, t) {
|
|
|
141
142
|
]);
|
|
142
143
|
else if (t.type === "tool_result")
|
|
143
144
|
a(e, r.tool, "执行工具与回答"), p(e, r.tool), e.appendToolCallsToStep(r.tool, [
|
|
144
|
-
|
|
145
|
+
z(t)
|
|
145
146
|
]), t.result.attachments?.length && e.appendAttachmentsToStep(
|
|
146
147
|
r.tool,
|
|
147
148
|
t.result.attachments
|
|
@@ -176,24 +177,24 @@ async function V(e, t) {
|
|
|
176
177
|
));
|
|
177
178
|
else if (t.type === "assistant_response") {
|
|
178
179
|
a(e, r.tool, "执行工具与回答");
|
|
179
|
-
const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer:
|
|
180
|
-
c &&
|
|
180
|
+
const o = e.getSteps().find((u) => u.id === r.tool), { planning: s, answer: l } = H(o?.content ?? ""), n = t.content.trim(), c = l.trim();
|
|
181
|
+
c && n && (c === n || n.startsWith(
|
|
181
182
|
c.slice(0, Math.min(c.length, 80))
|
|
182
183
|
)) ? e.setStep(r.tool, "done") : e.setStep(
|
|
183
184
|
r.tool,
|
|
184
185
|
"done",
|
|
185
|
-
|
|
186
|
+
M(s, n)
|
|
186
187
|
);
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
+
D(t) && e.appendExecutionEvent?.(t);
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
|
-
async function
|
|
192
|
+
async function K(e) {
|
|
192
193
|
await fetch(
|
|
193
194
|
`${h()}/v1/runs/${encodeURIComponent(e.runId)}/host-results`,
|
|
194
195
|
{
|
|
195
196
|
method: "POST",
|
|
196
|
-
headers:
|
|
197
|
+
headers: y(),
|
|
197
198
|
body: JSON.stringify({
|
|
198
199
|
correlationId: e.correlationId,
|
|
199
200
|
success: e.result.success,
|
|
@@ -206,30 +207,30 @@ async function Y(e) {
|
|
|
206
207
|
}
|
|
207
208
|
);
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
+
function X(e) {
|
|
210
211
|
const t = e.split(/\n\n/u), o = t.pop() ?? "";
|
|
211
|
-
return { events: t.flatMap((
|
|
212
|
-
const
|
|
213
|
-
if (!
|
|
212
|
+
return { events: t.flatMap((l) => {
|
|
213
|
+
const n = l.split(/\n/u).find((c) => c.startsWith("data: "));
|
|
214
|
+
if (!n) return [];
|
|
214
215
|
try {
|
|
215
|
-
return [JSON.parse(
|
|
216
|
+
return [JSON.parse(n.slice(6))];
|
|
216
217
|
} catch {
|
|
217
218
|
return [];
|
|
218
219
|
}
|
|
219
220
|
}), rest: o };
|
|
220
221
|
}
|
|
221
|
-
async function
|
|
222
|
+
async function ut(e) {
|
|
222
223
|
await Promise.allSettled([
|
|
223
224
|
_(e),
|
|
224
|
-
|
|
225
|
+
W(e)
|
|
225
226
|
]);
|
|
226
227
|
}
|
|
227
|
-
async function
|
|
228
|
-
const o = R(), s = A(), n = await _(t);
|
|
228
|
+
async function Z(e, t) {
|
|
229
|
+
const o = R(), s = L(), l = A(), n = await _(t);
|
|
229
230
|
return {
|
|
230
231
|
hostManifest: n,
|
|
231
232
|
payload: {
|
|
232
|
-
projectId:
|
|
233
|
+
projectId: J(),
|
|
233
234
|
sessionId: o.sessionId,
|
|
234
235
|
userQuestion: e,
|
|
235
236
|
uiContext: F().getUiContext?.() ?? {},
|
|
@@ -243,7 +244,8 @@ async function X(e, t) {
|
|
|
243
244
|
conversationHistory: o.conversationHistory,
|
|
244
245
|
lastAssistantReply: o.getLastAssistantContent(),
|
|
245
246
|
invokedSkills: o.invokedSkills,
|
|
246
|
-
skillPermissionGrants: o.skillPermissionGrants
|
|
247
|
+
skillPermissionGrants: o.skillPermissionGrants,
|
|
248
|
+
memoryEnabled: l.memoryEnabled
|
|
247
249
|
},
|
|
248
250
|
runtimeState: {
|
|
249
251
|
activeDomain: s.activeDomain,
|
|
@@ -257,14 +259,14 @@ async function X(e, t) {
|
|
|
257
259
|
}
|
|
258
260
|
};
|
|
259
261
|
}
|
|
260
|
-
async function
|
|
261
|
-
const o = h(), s = t.getSignal(), { payload:
|
|
262
|
+
async function dt(e, t) {
|
|
263
|
+
const o = h(), s = t.getSignal(), { payload: l, hostManifest: n } = await Z(
|
|
262
264
|
e,
|
|
263
265
|
s
|
|
264
|
-
), c = new Set(
|
|
266
|
+
), c = new Set(n.tools.map((d) => d.name)), u = await fetch(`${o}/v1/runs`, {
|
|
265
267
|
method: "POST",
|
|
266
|
-
headers:
|
|
267
|
-
body: JSON.stringify(
|
|
268
|
+
headers: y(),
|
|
269
|
+
body: JSON.stringify(l),
|
|
268
270
|
signal: s
|
|
269
271
|
});
|
|
270
272
|
if (!u.ok) {
|
|
@@ -284,28 +286,28 @@ async function ct(e, t) {
|
|
|
284
286
|
const f = await fetch(
|
|
285
287
|
`${o}/v1/runs/${encodeURIComponent(m)}/events`,
|
|
286
288
|
{
|
|
287
|
-
headers:
|
|
289
|
+
headers: y(),
|
|
288
290
|
signal: s
|
|
289
291
|
}
|
|
290
292
|
);
|
|
291
293
|
if (!f.ok || !f.body)
|
|
292
294
|
throw new Error(`Spotlight 后端事件流连接失败:${f.status}`);
|
|
293
295
|
const T = f.body.getReader(), P = new TextDecoder();
|
|
294
|
-
let
|
|
296
|
+
let S = "", k = null;
|
|
295
297
|
try {
|
|
296
298
|
for (; ; ) {
|
|
297
299
|
const { done: d, value: N } = await T.read();
|
|
298
300
|
if (d) break;
|
|
299
|
-
|
|
300
|
-
const C =
|
|
301
|
-
|
|
301
|
+
S += P.decode(N, { stream: !0 });
|
|
302
|
+
const C = X(S);
|
|
303
|
+
S = C.rest;
|
|
302
304
|
for (const i of C.events) {
|
|
303
305
|
if (i.type === "host_action_request") {
|
|
304
|
-
const I = await
|
|
306
|
+
const I = await q(i.request.call, t, {
|
|
305
307
|
allowedHostNames: c,
|
|
306
308
|
hostEffect: i.request.hostEffect
|
|
307
309
|
});
|
|
308
|
-
|
|
310
|
+
V(t, i, I), await K({
|
|
309
311
|
runId: m,
|
|
310
312
|
correlationId: i.request.correlationId,
|
|
311
313
|
result: I,
|
|
@@ -315,7 +317,7 @@ async function ct(e, t) {
|
|
|
315
317
|
}
|
|
316
318
|
if (i.type === "run_error")
|
|
317
319
|
throw new Error(i.error);
|
|
318
|
-
if (await
|
|
320
|
+
if (await Y(t, i), i.type === "run_completed")
|
|
319
321
|
return i.sessionPatch?.invokedSkills && R().setInvokedSkills(
|
|
320
322
|
i.sessionPatch.invokedSkills
|
|
321
323
|
), k = i, {
|
|
@@ -338,18 +340,18 @@ async function b(e) {
|
|
|
338
340
|
`${h()}/v1/runs/${encodeURIComponent(e)}`,
|
|
339
341
|
{
|
|
340
342
|
method: "DELETE",
|
|
341
|
-
headers:
|
|
343
|
+
headers: y()
|
|
342
344
|
}
|
|
343
345
|
);
|
|
344
346
|
}
|
|
345
|
-
function
|
|
347
|
+
function pt(e) {
|
|
346
348
|
if (!e) return;
|
|
347
349
|
const t = g.get(e);
|
|
348
350
|
t && (g.delete(e), b(t));
|
|
349
351
|
}
|
|
350
352
|
export {
|
|
351
353
|
b as cancelRemoteSpotlightRun,
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
354
|
+
pt as cancelRemoteSpotlightRunForSignal,
|
|
355
|
+
dt as runRemoteSpotlightPipeline,
|
|
356
|
+
ut as warmupSpotlightRemoteContext
|
|
355
357
|
};
|
package/dist/store/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { useSpotlightStore, SpotlightIntent, SPOTLIGHT_INTENT_LABELS, ProgressSu
|
|
|
2
2
|
export { SpotlightCommandDomain, SpotlightCommandScope, type SpotlightCommand, type SpotlightCommandAction, type SpotlightCommandTarget, type SpotlightVideoChannelId, } from "./types.js";
|
|
3
3
|
export { useSpotlightRuntimeStore } from "./runtimeStore.js";
|
|
4
4
|
export { useAgentSessionStore } from "../session/agentSession.js";
|
|
5
|
+
export { useSpotlightMemoryPreferenceStore, readSpotlightMemoryEnabled, } from "./memoryPreferenceStore.js";
|
|
5
6
|
//# 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"}
|
|
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"}
|
package/dist/store/index.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { useSpotlightStore as
|
|
2
|
-
import { INVESTMENT_SUB_INTENT_LABELS as
|
|
3
|
-
import { useSpotlightRuntimeStore as
|
|
4
|
-
import { useAgentSessionStore as
|
|
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 N, SPOTLIGHT_INTENT_LABELS as m, SUB_INTENT_CONFIG as p, SafetySubIntent as L, SpotlightCommandDomain as i, SpotlightCommandScope as u, SpotlightIntent as B } from "./types.js";
|
|
3
|
+
import { useSpotlightRuntimeStore as l } from "./runtimeStore.js";
|
|
4
|
+
import { useAgentSessionStore as A } from "../session/agentSession.js";
|
|
5
|
+
import { readSpotlightMemoryEnabled as f, useSpotlightMemoryPreferenceStore as h } from "./memoryPreferenceStore.js";
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
A as
|
|
21
|
-
|
|
7
|
+
r as INVESTMENT_SUB_INTENT_LABELS,
|
|
8
|
+
n as InvestmentSubIntent,
|
|
9
|
+
T as PROGRESS_SUB_INTENT_LABELS,
|
|
10
|
+
E as ProgressSubIntent,
|
|
11
|
+
I as QUALITY_SUB_INTENT_LABELS,
|
|
12
|
+
_ as QualitySubIntent,
|
|
13
|
+
N as SAFETY_SUB_INTENT_LABELS,
|
|
14
|
+
m as SPOTLIGHT_INTENT_LABELS,
|
|
15
|
+
p as SUB_INTENT_CONFIG,
|
|
16
|
+
L as SafetySubIntent,
|
|
17
|
+
i as SpotlightCommandDomain,
|
|
18
|
+
u as SpotlightCommandScope,
|
|
19
|
+
B as SpotlightIntent,
|
|
20
|
+
f as readSpotlightMemoryEnabled,
|
|
21
|
+
A as useAgentSessionStore,
|
|
22
|
+
h as useSpotlightMemoryPreferenceStore,
|
|
23
|
+
l as useSpotlightRuntimeStore,
|
|
24
|
+
S as useSpotlightStore
|
|
22
25
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** 用户是否启用 Gate + Agent 文件记忆(持久化到 localStorage)。 */
|
|
2
|
+
export declare const useSpotlightMemoryPreferenceStore: import("pinia").StoreDefinition<"spotlightMemoryPreference", Pick<{
|
|
3
|
+
enabled: import("vue").Ref<boolean, boolean>;
|
|
4
|
+
memoryEnabled: import("vue").ComputedRef<boolean>;
|
|
5
|
+
setEnabled(value: boolean): void;
|
|
6
|
+
toggle(): void;
|
|
7
|
+
}, "enabled">, Pick<{
|
|
8
|
+
enabled: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
memoryEnabled: import("vue").ComputedRef<boolean>;
|
|
10
|
+
setEnabled(value: boolean): void;
|
|
11
|
+
toggle(): void;
|
|
12
|
+
}, "memoryEnabled">, Pick<{
|
|
13
|
+
enabled: import("vue").Ref<boolean, boolean>;
|
|
14
|
+
memoryEnabled: import("vue").ComputedRef<boolean>;
|
|
15
|
+
setEnabled(value: boolean): void;
|
|
16
|
+
toggle(): void;
|
|
17
|
+
}, "toggle" | "setEnabled">>;
|
|
18
|
+
export declare function readSpotlightMemoryEnabled(): boolean;
|
|
19
|
+
//# sourceMappingURL=memoryPreferenceStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryPreferenceStore.d.ts","sourceRoot":"","sources":["../../src/store/memoryPreferenceStore.ts"],"names":[],"mappings":"AAeA,mDAAmD;AACnD,eAAO,MAAM,iCAAiC;;;sBAoBtB,OAAO;;;;;sBAAP,OAAO;;;;;sBAAP,OAAO;;4BAQ9B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD"}
|