@inupedia/spotlight-vue 0.1.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/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/_virtual/_plugin-vue_export-helper.js.map +1 -0
- package/dist/assets/spotlight-vue.css +1 -0
- package/dist/avatar/config.d.ts +16 -0
- package/dist/avatar/config.d.ts.map +1 -0
- package/dist/avatar/config.js +22 -0
- package/dist/avatar/config.js.map +1 -0
- package/dist/avatar/speech/live2dAnswerSpeechPolicy.d.ts +3 -0
- package/dist/avatar/speech/live2dAnswerSpeechPolicy.d.ts.map +1 -0
- package/dist/avatar/speech/live2dAnswerSpeechPolicy.js +16 -0
- package/dist/avatar/speech/live2dAnswerSpeechPolicy.js.map +1 -0
- package/dist/avatar/speech/live2dBriefingSummarizer.d.ts +11 -0
- package/dist/avatar/speech/live2dBriefingSummarizer.d.ts.map +1 -0
- package/dist/avatar/speech/live2dBriefingSummarizer.js +92 -0
- package/dist/avatar/speech/live2dBriefingSummarizer.js.map +1 -0
- package/dist/avatar/speech/live2dStreamSpeech.d.ts +14 -0
- package/dist/avatar/speech/live2dStreamSpeech.d.ts.map +1 -0
- package/dist/avatar/speech/live2dStreamSpeech.js +5 -0
- package/dist/avatar/speech/live2dStreamSpeech.js.map +1 -0
- package/dist/avatar/speech/live2dTtsPipeline.d.ts +34 -0
- package/dist/avatar/speech/live2dTtsPipeline.d.ts.map +1 -0
- package/dist/avatar/speech/live2dTtsPlayback.d.ts +3 -0
- package/dist/avatar/speech/live2dTtsPlayback.d.ts.map +1 -0
- package/dist/avatar/speech/live2dTtsPlayback.js +24 -0
- package/dist/avatar/speech/live2dTtsPlayback.js.map +1 -0
- package/dist/avatar/speech/llmUtils.d.ts +3 -0
- package/dist/avatar/speech/llmUtils.d.ts.map +1 -0
- package/dist/avatar/speech/llmUtils.js +19 -0
- package/dist/avatar/speech/llmUtils.js.map +1 -0
- package/dist/avatar/speech/spotlightSpeech.d.ts +24 -0
- package/dist/avatar/speech/spotlightSpeech.d.ts.map +1 -0
- package/dist/avatar/speech/spotlightSpeech.js +94 -0
- package/dist/avatar/speech/spotlightSpeech.js.map +1 -0
- package/dist/avatar/spine/live2dApp.d.ts +11 -0
- package/dist/avatar/spine/live2dApp.d.ts.map +1 -0
- package/dist/avatar/spine/live2dApp.js +28 -0
- package/dist/avatar/spine/live2dApp.js.map +1 -0
- package/dist/avatar/spine/spineAvatar.d.ts +14 -0
- package/dist/avatar/spine/spineAvatar.d.ts.map +1 -0
- package/dist/avatar/spine/spineAvatar.js +101 -0
- package/dist/avatar/spine/spineAvatar.js.map +1 -0
- package/dist/avatar/spine/spineLipSync.d.ts +13 -0
- package/dist/avatar/spine/spineLipSync.d.ts.map +1 -0
- package/dist/avatar/spine/spineLipSync.js +48 -0
- package/dist/avatar/spine/spineLipSync.js.map +1 -0
- package/dist/components/InspiraCardSpotlight.js +5 -0
- package/dist/components/InspiraCardSpotlight.js.map +1 -0
- package/dist/components/InspiraCardSpotlight.vue.d.ts +28 -0
- package/dist/components/InspiraCardSpotlight.vue.d.ts.map +1 -0
- package/dist/components/InspiraCardSpotlight.vue.js +53 -0
- package/dist/components/InspiraCardSpotlight.vue.js.map +1 -0
- package/dist/components/Live2dPanel.vue.d.ts +4 -0
- package/dist/components/Live2dPanel.vue.d.ts.map +1 -0
- package/dist/components/Live2dPanel.vue.js +8 -0
- package/dist/components/Live2dPanel.vue.js.map +1 -0
- package/dist/components/Live2dPanel2.vue.js +67 -0
- package/dist/components/Live2dPanel2.vue.js.map +1 -0
- package/dist/components/OfficialBorderBeam.js +8 -0
- package/dist/components/OfficialBorderBeam.js.map +1 -0
- package/dist/components/OfficialBorderBeam.vue.d.ts +21 -0
- package/dist/components/OfficialBorderBeam.vue.d.ts.map +1 -0
- package/dist/components/OfficialBorderBeam.vue.js +30 -0
- package/dist/components/OfficialBorderBeam.vue.js.map +1 -0
- package/dist/components/SpotlightCommandPanel.vue.d.ts +18 -0
- package/dist/components/SpotlightCommandPanel.vue.d.ts.map +1 -0
- package/dist/components/SpotlightCommandPanel.vue.js +8 -0
- package/dist/components/SpotlightCommandPanel.vue.js.map +1 -0
- package/dist/components/SpotlightCommandPanel2.vue.js +217 -0
- package/dist/components/SpotlightCommandPanel2.vue.js.map +1 -0
- package/dist/components/SpotlightMarkdownPreview.vue.d.ts +12 -0
- package/dist/components/SpotlightMarkdownPreview.vue.d.ts.map +1 -0
- package/dist/components/SpotlightMarkdownPreview.vue.js +39 -0
- package/dist/components/SpotlightMarkdownPreview.vue.js.map +1 -0
- package/dist/components/SpotlightMarkdownPreview2.vue.js +5 -0
- package/dist/components/SpotlightMarkdownPreview2.vue.js.map +1 -0
- package/dist/components/SpotlightRoot.vue.d.ts +26 -0
- package/dist/components/SpotlightRoot.vue.d.ts.map +1 -0
- package/dist/components/SpotlightRoot.vue.js +58 -0
- package/dist/components/SpotlightRoot.vue.js.map +1 -0
- package/dist/components/SpotlightRoot2.vue.js +5 -0
- package/dist/components/SpotlightRoot2.vue.js.map +1 -0
- package/dist/components/SpotlightShell.vue.d.ts +9 -0
- package/dist/components/SpotlightShell.vue.d.ts.map +1 -0
- package/dist/components/SpotlightShell.vue.js +5 -0
- package/dist/components/SpotlightShell.vue.js.map +1 -0
- package/dist/components/SpotlightShell2.vue.js +312 -0
- package/dist/components/SpotlightShell2.vue.js.map +1 -0
- package/dist/components/SpotlightThinking.vue.d.ts +59 -0
- package/dist/components/SpotlightThinking.vue.d.ts.map +1 -0
- package/dist/components/SpotlightThinking.vue.js +8 -0
- package/dist/components/SpotlightThinking.vue.js.map +1 -0
- package/dist/components/SpotlightThinking2.vue.js +893 -0
- package/dist/components/SpotlightThinking2.vue.js.map +1 -0
- package/dist/composables/useSpotlightCommandShortcuts.d.ts +13 -0
- package/dist/composables/useSpotlightCommandShortcuts.d.ts.map +1 -0
- package/dist/composables/useSpotlightCommandShortcuts.js +30 -0
- package/dist/composables/useSpotlightCommandShortcuts.js.map +1 -0
- package/dist/composables/useSpotlightPanelUi.d.ts +15 -0
- package/dist/composables/useSpotlightPanelUi.d.ts.map +1 -0
- package/dist/composables/useSpotlightPanelUi.js +9 -0
- package/dist/composables/useSpotlightPanelUi.js.map +1 -0
- package/dist/config.d.ts +59 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -0
- package/dist/constants/toolNames.d.ts +12 -0
- package/dist/constants/toolNames.d.ts.map +1 -0
- package/dist/constants/toolNames.js +15 -0
- package/dist/constants/toolNames.js.map +1 -0
- package/dist/host/defineApp.d.ts +16 -0
- package/dist/host/defineApp.d.ts.map +1 -0
- package/dist/host/defineApp.js +27 -0
- package/dist/host/defineApp.js.map +1 -0
- package/dist/host/defineHost.d.ts +55 -0
- package/dist/host/defineHost.d.ts.map +1 -0
- package/dist/host/defineHost.js +55 -0
- package/dist/host/defineHost.js.map +1 -0
- package/dist/host/mergeSkills.d.ts +4 -0
- package/dist/host/mergeSkills.d.ts.map +1 -0
- package/dist/host/mergeSkills.js +12 -0
- package/dist/host/mergeSkills.js.map +1 -0
- package/dist/host/normalizeSkills.d.ts +4 -0
- package/dist/host/normalizeSkills.d.ts.map +1 -0
- package/dist/host/normalizeSkills.js +11 -0
- package/dist/host/normalizeSkills.js.map +1 -0
- package/dist/host/skillExecution.d.ts +9 -0
- package/dist/host/skillExecution.d.ts.map +1 -0
- package/dist/host/skillExecution.js +14 -0
- package/dist/host/skillExecution.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/mountShell.d.ts +5 -0
- package/dist/mountShell.d.ts.map +1 -0
- package/dist/mountShell.js +24 -0
- package/dist/mountShell.js.map +1 -0
- package/dist/plugin.d.ts +16 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +51 -0
- package/dist/plugin.js.map +1 -0
- package/dist/remote/audio.d.ts +13 -0
- package/dist/remote/audio.d.ts.map +1 -0
- package/dist/remote/audio.js +56 -0
- package/dist/remote/audio.js.map +1 -0
- package/dist/remote/hostToolRunner.d.ts +11 -0
- package/dist/remote/hostToolRunner.d.ts.map +1 -0
- package/dist/remote/hostToolRunner.js +25 -0
- package/dist/remote/hostToolRunner.js.map +1 -0
- package/dist/remote/httpConfig.d.ts +5 -0
- package/dist/remote/httpConfig.d.ts.map +1 -0
- package/dist/remote/httpConfig.js +20 -0
- package/dist/remote/httpConfig.js.map +1 -0
- package/dist/remote/index.d.ts +8 -0
- package/dist/remote/index.d.ts.map +1 -0
- package/dist/remote/index.js +27 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/meta.d.ts +12 -0
- package/dist/remote/meta.d.ts.map +1 -0
- package/dist/remote/meta.js +59 -0
- package/dist/remote/meta.js.map +1 -0
- package/dist/remote/runPipeline.d.ts +7 -0
- package/dist/remote/runPipeline.d.ts.map +1 -0
- package/dist/remote/runPipeline.js +342 -0
- package/dist/remote/runPipeline.js.map +1 -0
- package/dist/remote/serverJson.d.ts +3 -0
- package/dist/remote/serverJson.d.ts.map +1 -0
- package/dist/remote/serverJson.js +12 -0
- package/dist/remote/serverJson.js.map +1 -0
- package/dist/remote/types.d.ts +6 -0
- package/dist/remote/types.d.ts.map +1 -0
- package/dist/resolveConfig.d.ts +21 -0
- package/dist/resolveConfig.d.ts.map +1 -0
- package/dist/resolveConfig.js +14 -0
- package/dist/resolveConfig.js.map +1 -0
- package/dist/session/agentSession.d.ts +46 -0
- package/dist/session/agentSession.d.ts.map +1 -0
- package/dist/session/agentSession.js +150 -0
- package/dist/session/agentSession.js.map +1 -0
- package/dist/skills/index.d.ts +9 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +23 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/matching.d.ts +11 -0
- package/dist/skills/matching.d.ts.map +1 -0
- package/dist/skills/matching.js +33 -0
- package/dist/skills/matching.js.map +1 -0
- package/dist/skills/parser.d.ts +3 -0
- package/dist/skills/parser.d.ts.map +1 -0
- package/dist/skills/parser.js +17 -0
- package/dist/skills/parser.js.map +1 -0
- package/dist/skills/skillFrontmatterParse.d.ts +3 -0
- package/dist/skills/skillFrontmatterParse.d.ts.map +1 -0
- package/dist/skills/skillFrontmatterParse.js +203 -0
- package/dist/skills/skillFrontmatterParse.js.map +1 -0
- package/dist/skills/skillListing.d.ts +9 -0
- package/dist/skills/skillListing.d.ts.map +1 -0
- package/dist/skills/skillListing.js +45 -0
- package/dist/skills/skillListing.js.map +1 -0
- package/dist/skills/skillPaths.d.ts +4 -0
- package/dist/skills/skillPaths.d.ts.map +1 -0
- package/dist/skills/skillPaths.js +22 -0
- package/dist/skills/skillPaths.js.map +1 -0
- package/dist/store/capabilities.d.ts +7 -0
- package/dist/store/capabilities.d.ts.map +1 -0
- package/dist/store/capabilities.js +12 -0
- package/dist/store/capabilities.js.map +1 -0
- package/dist/store/constants.d.ts +8 -0
- package/dist/store/constants.d.ts.map +1 -0
- package/dist/store/constants.js +6 -0
- package/dist/store/constants.js.map +1 -0
- package/dist/store/live2dOverlayStore.d.ts +20 -0
- package/dist/store/live2dOverlayStore.d.ts.map +1 -0
- package/dist/store/live2dOverlayStore.js +19 -0
- package/dist/store/live2dOverlayStore.js.map +1 -0
- package/dist/store/live2dSpeechStore.d.ts +29 -0
- package/dist/store/live2dSpeechStore.d.ts.map +1 -0
- package/dist/store/live2dSpeechStore.js +19 -0
- package/dist/store/live2dSpeechStore.js.map +1 -0
- package/dist/store/live2dVoiceChannelStore.d.ts +21 -0
- package/dist/store/live2dVoiceChannelStore.d.ts.map +1 -0
- package/dist/store/live2dVoiceChannelStore.js +22 -0
- package/dist/store/live2dVoiceChannelStore.js.map +1 -0
- package/dist/store/pipeline/api.d.ts +5 -0
- package/dist/store/pipeline/api.d.ts.map +1 -0
- package/dist/store/pipeline/api.js +86 -0
- package/dist/store/pipeline/api.js.map +1 -0
- package/dist/store/pipeline/constants.d.ts +18 -0
- package/dist/store/pipeline/constants.d.ts.map +1 -0
- package/dist/store/pipeline/constants.js +17 -0
- package/dist/store/pipeline/constants.js.map +1 -0
- package/dist/store/pipeline/displayText.d.ts +32 -0
- package/dist/store/pipeline/displayText.d.ts.map +1 -0
- package/dist/store/pipeline/displayText.js +93 -0
- package/dist/store/pipeline/displayText.js.map +1 -0
- package/dist/store/pipeline/errors.d.ts +5 -0
- package/dist/store/pipeline/errors.d.ts.map +1 -0
- package/dist/store/pipeline/errors.js +30 -0
- package/dist/store/pipeline/errors.js.map +1 -0
- package/dist/store/pipeline/spotlightMarkdown.d.ts +6 -0
- package/dist/store/pipeline/spotlightMarkdown.d.ts.map +1 -0
- package/dist/store/pipeline/spotlightMarkdown.js +86 -0
- package/dist/store/pipeline/spotlightMarkdown.js.map +1 -0
- package/dist/store/pipeline/steps.d.ts +11 -0
- package/dist/store/pipeline/steps.d.ts.map +1 -0
- package/dist/store/pipeline/steps.js +102 -0
- package/dist/store/pipeline/steps.js.map +1 -0
- package/dist/store/pipeline/toolDisplay.d.ts +14 -0
- package/dist/store/pipeline/toolDisplay.d.ts.map +1 -0
- package/dist/store/pipeline/toolDisplay.js +65 -0
- package/dist/store/pipeline/toolDisplay.js.map +1 -0
- package/dist/store/pipeline/types.d.ts +53 -0
- package/dist/store/pipeline/types.d.ts.map +1 -0
- package/dist/store/pipeline/typing.d.ts +4 -0
- package/dist/store/pipeline/typing.d.ts.map +1 -0
- package/dist/store/pipeline/typing.js +32 -0
- package/dist/store/pipeline/typing.js.map +1 -0
- package/dist/store/recent.d.ts +4 -0
- package/dist/store/recent.d.ts.map +1 -0
- package/dist/store/recent.js +27 -0
- package/dist/store/recent.js.map +1 -0
- package/dist/store/runtime/types.d.ts +140 -0
- package/dist/store/runtime/types.d.ts.map +1 -0
- package/dist/store/runtimeStore.d.ts +18 -0
- package/dist/store/runtimeStore.d.ts.map +1 -0
- package/dist/store/runtimeStore.js +25 -0
- package/dist/store/runtimeStore.js.map +1 -0
- package/dist/store/spotlightStore.d.ts +2787 -0
- package/dist/store/spotlightStore.d.ts.map +1 -0
- package/dist/store/spotlightStore.js +361 -0
- package/dist/store/spotlightStore.js.map +1 -0
- package/dist/store/storeSink.d.ts +16 -0
- package/dist/store/storeSink.d.ts.map +1 -0
- package/dist/store/storeSink.js +127 -0
- package/dist/store/storeSink.js.map +1 -0
- package/dist/store/types.d.ts +199 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +87 -0
- package/dist/store/types.js.map +1 -0
- package/dist/types/session.d.ts +5 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/toolResult.d.ts +11 -0
- package/dist/types/toolResult.d.ts.map +1 -0
- package/dist/utils/devConsole.d.ts +2 -0
- package/dist/utils/devConsole.d.ts.map +1 -0
- package/dist/utils/devConsole.js +6 -0
- package/dist/utils/devConsole.js.map +1 -0
- package/dist/utils/requestTimeout.d.ts +5 -0
- package/dist/utils/requestTimeout.d.ts.map +1 -0
- package/dist/utils/requestTimeout.js +12 -0
- package/dist/utils/requestTimeout.js.map +1 -0
- package/dist/workflow/createOperateDefinition.d.ts +22 -0
- package/dist/workflow/createOperateDefinition.d.ts.map +1 -0
- package/dist/workflow/createOperateDefinition.js +32 -0
- package/dist/workflow/createOperateDefinition.js.map +1 -0
- package/dist/workflow/operate.d.ts +23 -0
- package/dist/workflow/operate.d.ts.map +1 -0
- package/dist/workflow/operate.js +96 -0
- package/dist/workflow/operate.js.map +1 -0
- package/dist/workflow/runHostTool.d.ts +4 -0
- package/dist/workflow/runHostTool.d.ts.map +1 -0
- package/dist/workflow/runHostTool.js +13 -0
- package/dist/workflow/runHostTool.js.map +1 -0
- package/dist/workflow/sessionControl.d.ts +30 -0
- package/dist/workflow/sessionControl.d.ts.map +1 -0
- package/dist/workflow/sessionControl.js +113 -0
- package/dist/workflow/sessionControl.js.map +1 -0
- package/dist/workflow/shared.d.ts +6 -0
- package/dist/workflow/shared.d.ts.map +1 -0
- package/dist/workflow/shared.js +15 -0
- package/dist/workflow/shared.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AgentRegistryBridgeDeps } from "@inupedia/spotlight-client";
|
|
2
|
+
import type { AgentUiContext, SpotlightCommandCatalog, SpotlightCommandCatalogVideoChannel, SpotlightSkill } from "@inupedia/spotlight-protocol";
|
|
3
|
+
import type { SpotlightHostRegistration } from "../resolveConfig.js";
|
|
4
|
+
import type { SpotlightQuickPanelActions } from "../config.js";
|
|
5
|
+
import type { SpotlightUiPrompts } from "../remote/meta.js";
|
|
6
|
+
import { type SpotlightSkillExecutionOptions } from "./skillExecution.js";
|
|
7
|
+
import { type OperateWorkflowDefinition } from "../workflow/operate.js";
|
|
8
|
+
import { type SessionControlHooksFactory, type SessionControlWorkflowHooks } from "../workflow/sessionControl.js";
|
|
9
|
+
import { type SpotlightHostSkillsOption } from "./normalizeSkills.js";
|
|
10
|
+
export type SpotlightHostSkillsInput = {
|
|
11
|
+
/**
|
|
12
|
+
* Vite glob map of SKILL.md raw markdown under `.inupedia/skills/`.
|
|
13
|
+
* Use import.meta.glob with eager + ?raw at module top level.
|
|
14
|
+
*/
|
|
15
|
+
bundled?: Record<string, string>;
|
|
16
|
+
/** Inline skills from `registerSpotlightSkill` or a custom list. */
|
|
17
|
+
inline?: SpotlightSkill[] | (() => SpotlightSkill[]);
|
|
18
|
+
};
|
|
19
|
+
export type DefineSpotlightHostOptions = AgentRegistryBridgeDeps & {
|
|
20
|
+
/** Vite glob map, or `{ bundled, inline }`. Pass glob Record directly as shorthand. */
|
|
21
|
+
skills?: SpotlightHostSkillsOption;
|
|
22
|
+
/** Host extensions for session continue/stop. Pass factory to receive operate executor. */
|
|
23
|
+
sessionControl?: SessionControlWorkflowHooks | SessionControlHooksFactory;
|
|
24
|
+
/** Domain operate workflow definition (tunnel patrol, panels, etc.). */
|
|
25
|
+
operate?: OperateWorkflowDefinition;
|
|
26
|
+
getUiContext?: () => AgentUiContext;
|
|
27
|
+
catalogOverlay?: () => SpotlightCommandCatalog | null | undefined;
|
|
28
|
+
videoChannels?: SpotlightCommandCatalogVideoChannel[];
|
|
29
|
+
onVideoChannelsLoaded?: (channels: SpotlightCommandCatalogVideoChannel[]) => void;
|
|
30
|
+
uiPromptsFallback?: SpotlightUiPrompts;
|
|
31
|
+
quickPanelActions?: SpotlightQuickPanelActions;
|
|
32
|
+
getSuggestedQuestions?: SpotlightHostRegistration["getSuggestedQuestions"];
|
|
33
|
+
/** 宿主 skill 脚本执行(注册 skill.runScript;浏览器需自建 runScript) */
|
|
34
|
+
skillExecution?: SpotlightSkillExecutionOptions;
|
|
35
|
+
};
|
|
36
|
+
export type SpotlightHostFactory = () => SpotlightHostRegistration;
|
|
37
|
+
/**
|
|
38
|
+
* One-call host registration: agent registry → tools bridge, skills merge, optional workflows.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import '@/service/agent/tools';
|
|
43
|
+
*
|
|
44
|
+
* export default defineSpotlightHost({
|
|
45
|
+
* listTools,
|
|
46
|
+
* getToolExecutionTarget,
|
|
47
|
+
* runTool,
|
|
48
|
+
* skills: { bundled: skillModules, inline: listSpotlightSkills },
|
|
49
|
+
* sessionControl: mySessionHooks,
|
|
50
|
+
* getUiContext: () => getAgentUiContext(),
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function defineSpotlightHost(options: DefineSpotlightHostOptions): SpotlightHostFactory;
|
|
55
|
+
//# sourceMappingURL=defineHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineHost.d.ts","sourceRoot":"","sources":["../../src/host/defineHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,mCAAmC,EACnC,cAAc,EACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EACjC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,oEAAoE;IACpE,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,cAAc,EAAE,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG;IACjE,uFAAuF;IACvF,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,2FAA2F;IAC3F,cAAc,CAAC,EACX,2BAA2B,GAC3B,0BAA0B,CAAC;IAC/B,wEAAwE;IACxE,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,cAAc,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,uBAAuB,GAAG,IAAI,GAAG,SAAS,CAAC;IAClE,aAAa,CAAC,EAAE,mCAAmC,EAAE,CAAC;IACtD,qBAAqB,CAAC,EAAE,CACtB,QAAQ,EAAE,mCAAmC,EAAE,KAC5C,IAAI,CAAC;IACV,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IACvC,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,qBAAqB,CAAC,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;IAC3E,yDAAyD;IACzD,cAAc,CAAC,EAAE,8BAA8B,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,yBAAyB,CAAC;AAkBnE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,oBAAoB,CA2DtB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineToolsFromAgentRegistry as u } from "@inupedia/spotlight-client";
|
|
2
|
+
import { wireSkillExecution as a } from "./skillExecution.js";
|
|
3
|
+
import { loadBundledSkillsFromGlob as c } from "../skills/index.js";
|
|
4
|
+
import { createOperateExecutor as d } from "../workflow/operate.js";
|
|
5
|
+
import { createRunSessionHostTool as f, createSessionControlExecutor as g } from "../workflow/sessionControl.js";
|
|
6
|
+
import { mergeSpotlightSkills as m } from "./mergeSkills.js";
|
|
7
|
+
import { normalizeSkillsOption as k } from "./normalizeSkills.js";
|
|
8
|
+
function S(e) {
|
|
9
|
+
return e ? typeof e == "function" ? e() : e : [];
|
|
10
|
+
}
|
|
11
|
+
function i(e) {
|
|
12
|
+
if (!e) return [];
|
|
13
|
+
const t = S(e.inline), r = e.bundled ? c(e.bundled) : [];
|
|
14
|
+
return m(t, r);
|
|
15
|
+
}
|
|
16
|
+
function y(e) {
|
|
17
|
+
const { tools: t, runHostTool: r } = u({
|
|
18
|
+
listTools: e.listTools,
|
|
19
|
+
getToolExecutionTarget: e.getToolExecutionTarget,
|
|
20
|
+
runTool: e.runTool
|
|
21
|
+
}), l = e.operate ? d(e.operate) : void 0;
|
|
22
|
+
let n;
|
|
23
|
+
if (e.sessionControl) {
|
|
24
|
+
const s = typeof e.sessionControl == "function" ? e.operate && l ? e.sessionControl(l) : (() => {
|
|
25
|
+
throw new Error(
|
|
26
|
+
"Spotlight host: sessionControl factory requires `operate` definition"
|
|
27
|
+
);
|
|
28
|
+
})() : e.sessionControl;
|
|
29
|
+
n = f(
|
|
30
|
+
g(s)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const o = k(e.skills);
|
|
34
|
+
return e.skillExecution && o && a(
|
|
35
|
+
e.skillExecution,
|
|
36
|
+
() => i(o)
|
|
37
|
+
), () => ({
|
|
38
|
+
tools: t,
|
|
39
|
+
runHostTool: r,
|
|
40
|
+
runSessionHostTool: n,
|
|
41
|
+
executeOperateWorkflow: l,
|
|
42
|
+
skills: o ? () => i(o) : void 0,
|
|
43
|
+
getUiContext: e.getUiContext,
|
|
44
|
+
catalogOverlay: e.catalogOverlay,
|
|
45
|
+
videoChannels: e.videoChannels,
|
|
46
|
+
onVideoChannelsLoaded: e.onVideoChannelsLoaded,
|
|
47
|
+
uiPromptsFallback: e.uiPromptsFallback,
|
|
48
|
+
quickPanelActions: e.quickPanelActions,
|
|
49
|
+
getSuggestedQuestions: e.getSuggestedQuestions
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
y as defineSpotlightHost
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=defineHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineHost.js","sources":["../../src/host/defineHost.ts"],"sourcesContent":["import { defineToolsFromAgentRegistry } from \"@inupedia/spotlight-client\";\nimport type { AgentRegistryBridgeDeps } from \"@inupedia/spotlight-client\";\nimport type {\n AgentUiContext,\n SpotlightCommandCatalog,\n SpotlightCommandCatalogVideoChannel,\n SpotlightSkill,\n} from \"@inupedia/spotlight-protocol\";\nimport type { RemoteHostToolCall } from \"@inupedia/spotlight-protocol\";\nimport type { SessionHostToolHandler } from \"@inupedia/spotlight-client\";\nimport type { SpotlightHostRegistration } from \"../resolveConfig.js\";\nimport type { SpotlightQuickPanelActions } from \"../config.js\";\nimport type { SpotlightUiPrompts } from \"../remote/meta.js\";\nimport type { HandlerApi } from \"../store/pipeline/types.js\";\nimport type { ToolResult } from \"../types/toolResult.js\";\nimport {\n wireSkillExecution,\n type SpotlightSkillExecutionOptions,\n} from \"./skillExecution.js\";\nimport { loadBundledSkillsFromGlob } from \"../skills/index.js\";\nimport {\n createOperateExecutor,\n type OperateWorkflowDefinition,\n} from \"../workflow/operate.js\";\nimport {\n createRunSessionHostTool,\n createSessionControlExecutor,\n type SessionControlHooksFactory,\n type SessionControlWorkflowHooks,\n} from \"../workflow/sessionControl.js\";\nimport { mergeSpotlightSkills } from \"./mergeSkills.js\";\nimport {\n normalizeSkillsOption,\n type SpotlightHostSkillsOption,\n} from \"./normalizeSkills.js\";\n\nexport type SpotlightHostSkillsInput = {\n /**\n * Vite glob map of SKILL.md raw markdown under `.inupedia/skills/`.\n * Use import.meta.glob with eager + ?raw at module top level.\n */\n bundled?: Record<string, string>;\n /** Inline skills from `registerSpotlightSkill` or a custom list. */\n inline?: SpotlightSkill[] | (() => SpotlightSkill[]);\n};\n\nexport type DefineSpotlightHostOptions = AgentRegistryBridgeDeps & {\n /** Vite glob map, or `{ bundled, inline }`. Pass glob Record directly as shorthand. */\n skills?: SpotlightHostSkillsOption;\n /** Host extensions for session continue/stop. Pass factory to receive operate executor. */\n sessionControl?:\n | SessionControlWorkflowHooks\n | SessionControlHooksFactory;\n /** Domain operate workflow definition (tunnel patrol, panels, etc.). */\n operate?: OperateWorkflowDefinition;\n getUiContext?: () => AgentUiContext;\n catalogOverlay?: () => SpotlightCommandCatalog | null | undefined;\n videoChannels?: SpotlightCommandCatalogVideoChannel[];\n onVideoChannelsLoaded?: (\n channels: SpotlightCommandCatalogVideoChannel[],\n ) => void;\n uiPromptsFallback?: SpotlightUiPrompts;\n quickPanelActions?: SpotlightQuickPanelActions;\n getSuggestedQuestions?: SpotlightHostRegistration[\"getSuggestedQuestions\"];\n /** 宿主 skill 脚本执行(注册 skill.runScript;浏览器需自建 runScript) */\n skillExecution?: SpotlightSkillExecutionOptions;\n};\n\nexport type SpotlightHostFactory = () => SpotlightHostRegistration;\n\nfunction resolveInlineSkills(\n inline: SpotlightHostSkillsInput[\"inline\"],\n): SpotlightSkill[] {\n if (!inline) return [];\n return typeof inline === \"function\" ? inline() : inline;\n}\n\nfunction resolveSkillsPool(skills?: SpotlightHostSkillsInput): SpotlightSkill[] {\n if (!skills) return [];\n const inline = resolveInlineSkills(skills.inline);\n const bundled = skills.bundled\n ? loadBundledSkillsFromGlob(skills.bundled)\n : [];\n return mergeSpotlightSkills(inline, bundled);\n}\n\n/**\n * One-call host registration: agent registry → tools bridge, skills merge, optional workflows.\n *\n * @example\n * ```ts\n * import '@/service/agent/tools';\n *\n * export default defineSpotlightHost({\n * listTools,\n * getToolExecutionTarget,\n * runTool,\n * skills: { bundled: skillModules, inline: listSpotlightSkills },\n * sessionControl: mySessionHooks,\n * getUiContext: () => getAgentUiContext(),\n * });\n * ```\n */\nexport function defineSpotlightHost(\n options: DefineSpotlightHostOptions,\n): SpotlightHostFactory {\n const { tools, runHostTool } = defineToolsFromAgentRegistry({\n listTools: options.listTools,\n getToolExecutionTarget: options.getToolExecutionTarget,\n runTool: options.runTool,\n });\n\n const executeOperate = options.operate\n ? createOperateExecutor(options.operate)\n : undefined;\n\n let runSessionHostTool:\n | ((\n call: RemoteHostToolCall,\n api: HandlerApi,\n ) => Promise<Awaited<ReturnType<SessionHostToolHandler>>>)\n | undefined;\n\n if (options.sessionControl) {\n const sessionHooks =\n typeof options.sessionControl === \"function\"\n ? options.operate && executeOperate\n ? options.sessionControl(executeOperate)\n : (() => {\n throw new Error(\n \"Spotlight host: sessionControl factory requires `operate` definition\",\n );\n })()\n : options.sessionControl;\n runSessionHostTool = createRunSessionHostTool(\n createSessionControlExecutor(sessionHooks),\n );\n }\n\n const skillsInput = normalizeSkillsOption(options.skills);\n\n if (options.skillExecution && skillsInput) {\n wireSkillExecution(options.skillExecution, () =>\n resolveSkillsPool(skillsInput),\n );\n }\n\n return () => ({\n tools,\n runHostTool: runHostTool as (\n name: string,\n input: Record<string, unknown>,\n ) => Promise<ToolResult<unknown>>,\n runSessionHostTool,\n executeOperateWorkflow: executeOperate,\n skills: skillsInput ? () => resolveSkillsPool(skillsInput) : undefined,\n getUiContext: options.getUiContext,\n catalogOverlay: options.catalogOverlay,\n videoChannels: options.videoChannels,\n onVideoChannelsLoaded: options.onVideoChannelsLoaded,\n uiPromptsFallback: options.uiPromptsFallback,\n quickPanelActions: options.quickPanelActions,\n getSuggestedQuestions: options.getSuggestedQuestions,\n });\n}\n"],"names":["resolveInlineSkills","inline","resolveSkillsPool","skills","bundled","loadBundledSkillsFromGlob","mergeSpotlightSkills","defineSpotlightHost","options","tools","runHostTool","defineToolsFromAgentRegistry","executeOperate","createOperateExecutor","runSessionHostTool","sessionHooks","createRunSessionHostTool","createSessionControlExecutor","skillsInput","normalizeSkillsOption","wireSkillExecution"],"mappings":";;;;;;;AAsEA,SAASA,EACPC,GACkB;AAClB,SAAKA,IACE,OAAOA,KAAW,aAAaA,EAAA,IAAWA,IAD7B,CAAA;AAEtB;AAEA,SAASC,EAAkBC,GAAqD;AAC9E,MAAI,CAACA,EAAQ,QAAO,CAAA;AACpB,QAAMF,IAASD,EAAoBG,EAAO,MAAM,GAC1CC,IAAUD,EAAO,UACnBE,EAA0BF,EAAO,OAAO,IACxC,CAAA;AACJ,SAAOG,EAAqBL,GAAQG,CAAO;AAC7C;AAmBO,SAASG,EACdC,GACsB;AACtB,QAAM,EAAE,OAAAC,GAAO,aAAAC,EAAA,IAAgBC,EAA6B;AAAA,IAC1D,WAAWH,EAAQ;AAAA,IACnB,wBAAwBA,EAAQ;AAAA,IAChC,SAASA,EAAQ;AAAA,EAAA,CAClB,GAEKI,IAAiBJ,EAAQ,UAC3BK,EAAsBL,EAAQ,OAAO,IACrC;AAEJ,MAAIM;AAOJ,MAAIN,EAAQ,gBAAgB;AAC1B,UAAMO,IACJ,OAAOP,EAAQ,kBAAmB,aAC9BA,EAAQ,WAAWI,IACjBJ,EAAQ,eAAeI,CAAc,KACpC,MAAM;AACL,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ,GAAA,IACFJ,EAAQ;AACd,IAAAM,IAAqBE;AAAA,MACnBC,EAA6BF,CAAY;AAAA,IAAA;AAAA,EAE7C;AAEA,QAAMG,IAAcC,EAAsBX,EAAQ,MAAM;AAExD,SAAIA,EAAQ,kBAAkBU,KAC5BE;AAAA,IAAmBZ,EAAQ;AAAA,IAAgB,MACzCN,EAAkBgB,CAAW;AAAA,EAAA,GAI1B,OAAO;AAAA,IACZ,OAAAT;AAAA,IACA,aAAAC;AAAA,IAIA,oBAAAI;AAAA,IACA,wBAAwBF;AAAA,IACxB,QAAQM,IAAc,MAAMhB,EAAkBgB,CAAW,IAAI;AAAA,IAC7D,cAAcV,EAAQ;AAAA,IACtB,gBAAgBA,EAAQ;AAAA,IACxB,eAAeA,EAAQ;AAAA,IACvB,uBAAuBA,EAAQ;AAAA,IAC/B,mBAAmBA,EAAQ;AAAA,IAC3B,mBAAmBA,EAAQ;AAAA,IAC3B,uBAAuBA,EAAQ;AAAA,EAAA;AAEnC;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SpotlightSkill } from "@inupedia/spotlight-protocol";
|
|
2
|
+
/** Merge bundled (.inupedia) and inline registry skills; inline wins on name conflict. */
|
|
3
|
+
export declare function mergeSpotlightSkills(inlineSkills: SpotlightSkill[], bundledSkills: SpotlightSkill[]): SpotlightSkill[];
|
|
4
|
+
//# sourceMappingURL=mergeSkills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeSkills.d.ts","sourceRoot":"","sources":["../../src/host/mergeSkills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,cAAc,EAAE,EAC9B,aAAa,EAAE,cAAc,EAAE,GAC9B,cAAc,EAAE,CAOlB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function l(r, n) {
|
|
2
|
+
const o = /* @__PURE__ */ new Map();
|
|
3
|
+
for (const e of n) o.set(e.name, e);
|
|
4
|
+
for (const e of r) o.set(e.name, e);
|
|
5
|
+
return Array.from(o.values()).sort(
|
|
6
|
+
(e, t) => e.name.localeCompare(t.name)
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
l as mergeSpotlightSkills
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=mergeSkills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeSkills.js","sources":["../../src/host/mergeSkills.ts"],"sourcesContent":["import type { SpotlightSkill } from \"@inupedia/spotlight-protocol\";\n\n/** Merge bundled (.inupedia) and inline registry skills; inline wins on name conflict. */\nexport function mergeSpotlightSkills(\n inlineSkills: SpotlightSkill[],\n bundledSkills: SpotlightSkill[],\n): SpotlightSkill[] {\n const merged = new Map<string, SpotlightSkill>();\n for (const skill of bundledSkills) merged.set(skill.name, skill);\n for (const skill of inlineSkills) merged.set(skill.name, skill);\n return Array.from(merged.values()).sort((a, b) =>\n a.name.localeCompare(b.name),\n );\n}\n"],"names":["mergeSpotlightSkills","inlineSkills","bundledSkills","merged","skill","a","b"],"mappings":"AAGO,SAASA,EACdC,GACAC,GACkB;AAClB,QAAMC,wBAAa,IAAA;AACnB,aAAWC,KAASF,EAAe,CAAAC,EAAO,IAAIC,EAAM,MAAMA,CAAK;AAC/D,aAAWA,KAASH,EAAc,CAAAE,EAAO,IAAIC,EAAM,MAAMA,CAAK;AAC9D,SAAO,MAAM,KAAKD,EAAO,OAAA,CAAQ,EAAE;AAAA,IAAK,CAACE,GAAGC,MAC1CD,EAAE,KAAK,cAAcC,EAAE,IAAI;AAAA,EAAA;AAE/B;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SpotlightHostSkillsInput } from "./defineHost.js";
|
|
2
|
+
export type SpotlightHostSkillsOption = SpotlightHostSkillsInput | Record<string, string>;
|
|
3
|
+
export declare function normalizeSkillsOption(skills?: SpotlightHostSkillsOption): SpotlightHostSkillsInput | undefined;
|
|
4
|
+
//# sourceMappingURL=normalizeSkills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeSkills.d.ts","sourceRoot":"","sources":["../../src/host/normalizeSkills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,MAAM,yBAAyB,GACjC,wBAAwB,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAQ3B,wBAAgB,qBAAqB,CACnC,MAAM,CAAC,EAAE,yBAAyB,GACjC,wBAAwB,GAAG,SAAS,CAItC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeSkills.js","sources":["../../src/host/normalizeSkills.ts"],"sourcesContent":["import type { SpotlightHostSkillsInput } from \"./defineHost.js\";\n\nexport type SpotlightHostSkillsOption =\n | SpotlightHostSkillsInput\n | Record<string, string>;\n\nfunction isStructuredSkillsInput(\n value: SpotlightHostSkillsOption,\n): value is SpotlightHostSkillsInput {\n return \"bundled\" in value || \"inline\" in value;\n}\n\nexport function normalizeSkillsOption(\n skills?: SpotlightHostSkillsOption,\n): SpotlightHostSkillsInput | undefined {\n if (!skills) return undefined;\n if (isStructuredSkillsInput(skills)) return skills;\n return { bundled: skills };\n}\n"],"names":["isStructuredSkillsInput","value","normalizeSkillsOption","skills"],"mappings":"AAMA,SAASA,EACPC,GACmC;AACnC,SAAO,aAAaA,KAAS,YAAYA;AAC3C;AAEO,SAASC,EACdC,GACsC;AACtC,MAAKA;AACL,WAAIH,EAAwBG,CAAM,IAAUA,IACrC,EAAE,SAASA,EAAA;AACpB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SpotlightSkill } from "@inupedia/spotlight-protocol";
|
|
2
|
+
import { type SkillScriptRunner } from "@inupedia/spotlight-client";
|
|
3
|
+
export type SpotlightSkillExecutionOptions = {
|
|
4
|
+
projectDir: string;
|
|
5
|
+
runScript: SkillScriptRunner;
|
|
6
|
+
};
|
|
7
|
+
/** Register skill.runScript host tool once per app. */
|
|
8
|
+
export declare function wireSkillExecution(options: SpotlightSkillExecutionOptions, getSkills: () => SpotlightSkill[]): void;
|
|
9
|
+
//# sourceMappingURL=skillExecution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillExecution.d.ts","sourceRoot":"","sources":["../../src/host/skillExecution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AAGpC,MAAM,MAAM,8BAA8B,GAAG;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAIF,uDAAuD;AACvD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,8BAA8B,EACvC,SAAS,EAAE,MAAM,cAAc,EAAE,GAChC,IAAI,CASN"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { registerSkillScriptTool as l } from "@inupedia/spotlight-client";
|
|
2
|
+
import { resolveSkillRoot as o } from "../skills/skillPaths.js";
|
|
3
|
+
let e = !1;
|
|
4
|
+
function S(r, i) {
|
|
5
|
+
e || (e = !0, l({
|
|
6
|
+
projectDir: r.projectDir,
|
|
7
|
+
runScript: r.runScript,
|
|
8
|
+
getSkillRoot: (t) => o(t, i(), r.projectDir)
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
S as wireSkillExecution
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=skillExecution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillExecution.js","sources":["../../src/host/skillExecution.ts"],"sourcesContent":["import type { SpotlightSkill } from \"@inupedia/spotlight-protocol\";\nimport {\n registerSkillScriptTool,\n type SkillScriptRunner,\n} from \"@inupedia/spotlight-client\";\nimport { resolveSkillRoot } from \"../skills/skillPaths.js\";\n\nexport type SpotlightSkillExecutionOptions = {\n projectDir: string;\n runScript: SkillScriptRunner;\n};\n\nlet skillScriptToolRegistered = false;\n\n/** Register skill.runScript host tool once per app. */\nexport function wireSkillExecution(\n options: SpotlightSkillExecutionOptions,\n getSkills: () => SpotlightSkill[],\n): void {\n if (skillScriptToolRegistered) return;\n skillScriptToolRegistered = true;\n registerSkillScriptTool({\n projectDir: options.projectDir,\n runScript: options.runScript,\n getSkillRoot: (skillName) =>\n resolveSkillRoot(skillName, getSkills(), options.projectDir),\n });\n}\n"],"names":["skillScriptToolRegistered","wireSkillExecution","options","getSkills","registerSkillScriptTool","skillName","resolveSkillRoot"],"mappings":";;AAYA,IAAIA,IAA4B;AAGzB,SAASC,EACdC,GACAC,GACM;AACN,EAAIH,MACJA,IAA4B,IAC5BI,EAAwB;AAAA,IACtB,YAAYF,EAAQ;AAAA,IACpB,WAAWA,EAAQ;AAAA,IACnB,cAAc,CAACG,MACbC,EAAiBD,GAAWF,EAAA,GAAaD,EAAQ,UAAU;AAAA,EAAA,CAC9D;AACH;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { defineSpotlightConfig, SPOTLIGHT_CONFIG_KEY, type SpotlightConfig, type SpotlightConfigInput, type SpotlightHostServicesRegistration, type SpotlightQuickPanelActions, type SpotlightVuePluginOptions, } from "./config.js";
|
|
2
|
+
export { resolveSpotlightConfig, type SpotlightHostRegistration } from "./resolveConfig.js";
|
|
3
|
+
export { defineSpotlightApp, readSpotlightEnv, type DefineSpotlightAppOptions, type SpotlightEnvDefaults, } from "./host/defineApp.js";
|
|
4
|
+
export { defineSpotlightHost, type DefineSpotlightHostOptions, type SpotlightHostFactory, type SpotlightHostSkillsInput, } from "./host/defineHost.js";
|
|
5
|
+
export { normalizeSkillsOption, type SpotlightHostSkillsOption, } from "./host/normalizeSkills.js";
|
|
6
|
+
export { mergeSpotlightSkills } from "./host/mergeSkills.js";
|
|
7
|
+
export { getSpotlightConfig, getSpotlightHostAdapter, getSpotlightHttp, resetSpotlightRuntimeForTests, SpotlightVue, SPOTLIGHT_HOST_ADAPTER_KEY, SPOTLIGHT_HTTP_KEY, } from "./plugin.js";
|
|
8
|
+
export { useSpotlightStore, SpotlightIntent, SPOTLIGHT_INTENT_LABELS, ProgressSubIntent, PROGRESS_SUB_INTENT_LABELS, InvestmentSubIntent, INVESTMENT_SUB_INTENT_LABELS, QualitySubIntent, QUALITY_SUB_INTENT_LABELS, SafetySubIntent, SAFETY_SUB_INTENT_LABELS, SUB_INTENT_CONFIG, type AgentStep, type IntentWithReason, type SubIntentConfig, type SpotlightSkillPermissionRequest, } from "./store/spotlightStore.js";
|
|
9
|
+
export { SpotlightCommandDomain, SpotlightCommandScope, type SpotlightCommand, type SpotlightCommandAction, type SpotlightCommandTarget, } from "./store/types.js";
|
|
10
|
+
export { useSpotlightRuntimeStore } from "./store/runtimeStore.js";
|
|
11
|
+
export { useAgentSessionStore } from "./session/agentSession.js";
|
|
12
|
+
export { getSkillsPoolForRun, loadBundledSkillsFromGlob, parseSpotlightSkillMarkdown, formatSkillsWithinBudget, getBypassMatchedSkills, getModelInvokableSkills, } from "./skills/index.js";
|
|
13
|
+
export { cancelRemoteSpotlightRunForSignal, runRemoteSpotlightPipeline, warmupSpotlightRemoteContext, ensureSpotlightMeta, getSpotlightUiPrompts, resetSpotlightMetaCacheForTests, spotlightSynthesizeSpeech, spotlightTranscribeAudio, extractTranscriptionText, normalizeSpeakText, postSpotlightJson, getSpotlightJson, type SpotlightUiPrompts, type SpotlightPipelineRunOutcome, } from "./remote/index.js";
|
|
14
|
+
export { TOOL_NAMES } from "./constants/toolNames.js";
|
|
15
|
+
export { getIntentStepDisplayContent, humanizeSpotlightStepContent, isToolExecutionStep, sanitizeToolStepAnswerText, splitToolStepContent, composeToolStepContent, isLoopPlanningChunk, splitIntentStepContent, } from "./store/pipeline/displayText.js";
|
|
16
|
+
export { partitionToolCalls } from "./store/pipeline/toolDisplay.js";
|
|
17
|
+
export { isInternalKnowledgeEvidenceTool, isUserFacingKnowledgeTool, } from "./store/pipeline/toolDisplay.js";
|
|
18
|
+
export { TOOL_STEP_ANSWER_DELIMITER } from "./store/pipeline/displayText.js";
|
|
19
|
+
export { SPOTLIGHT_PIPELINE_STEP_IDS, SPOTLIGHT_PIPELINE_STEP_LABELS, } from "./store/pipeline/constants.js";
|
|
20
|
+
export { initSpotlightMarkdownPreview } from "./store/pipeline/spotlightMarkdown.js";
|
|
21
|
+
export { formatSpotlightKnowledgeMarkdown, preprocessKnowledgeMarkdown, } from "./store/pipeline/spotlightMarkdown.js";
|
|
22
|
+
export { formatToolFailure } from "./store/pipeline/errors.js";
|
|
23
|
+
export { getSuggestedQuestions } from "./store/capabilities.js";
|
|
24
|
+
export { useSpotlightPanelUi } from "./composables/useSpotlightPanelUi.js";
|
|
25
|
+
export { useSpotlightCommandShortcuts } from "./composables/useSpotlightCommandShortcuts.js";
|
|
26
|
+
export { isGenericHostExecutionReply } from "./avatar/speech/live2dAnswerSpeechPolicy.js";
|
|
27
|
+
export type { SpotlightAvatarConfig } from "./avatar/config.js";
|
|
28
|
+
export { buildCommonWorkflowSteps, buildCommonSteps, COMMON_WORKFLOW_STEPS, } from "./workflow/shared.js";
|
|
29
|
+
export { runHostTool } from "./workflow/runHostTool.js";
|
|
30
|
+
export { buildOperateWorkflowSteps, createOperateExecutor, isOperateWorkflowContext, type OperateToolCall, type OperateWorkflowDefinition, } from "./workflow/operate.js";
|
|
31
|
+
export { createOperateDefinition, type CreateOperateDefinitionOptions, type OperateActionBinding, } from "./workflow/createOperateDefinition.js";
|
|
32
|
+
export { buildRepeatLastAnswerContext, buildOperateCommandContext, buildSessionControlWorkflowSteps, createRunSessionHostTool, createSessionControlExecutor, type ExecuteOperateWorkflow, type SessionControlHooksFactory, type SessionControlWorkflowHooks, } from "./workflow/sessionControl.js";
|
|
33
|
+
export type { ToolResult, ToolTraceEvent } from "./types/toolResult.js";
|
|
34
|
+
export type { SessionControlIntent } from "./types/session.js";
|
|
35
|
+
export type { HandlerApi, SpotlightContext } from "./store/pipeline/types.js";
|
|
36
|
+
export type { SpotlightVideoChannelId } from "./store/types.js";
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,EAAE,sBAAsB,EAAE,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,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,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,6BAA6B,EAC7B,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,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,2BAA2B,CAAC;AAEnC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,iCAAiC,EACjC,0BAA0B,EAC1B,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,EACrB,+BAA+B,EAC/B,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,GACjC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EACL,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { SPOTLIGHT_CONFIG_KEY as r, defineSpotlightConfig as p } from "./config.js";
|
|
2
|
+
import { resolveSpotlightConfig as n } from "./resolveConfig.js";
|
|
3
|
+
import { defineSpotlightApp as l, readSpotlightEnv as s } from "./host/defineApp.js";
|
|
4
|
+
import { defineSpotlightHost as g } from "./host/defineHost.js";
|
|
5
|
+
import { normalizeSkillsOption as a } from "./host/normalizeSkills.js";
|
|
6
|
+
import { mergeSpotlightSkills as x } from "./host/mergeSkills.js";
|
|
7
|
+
import { SPOTLIGHT_HOST_ADAPTER_KEY as u, SPOTLIGHT_HTTP_KEY as E, SpotlightVue as _, getSpotlightConfig as I, getSpotlightHostAdapter as d, getSpotlightHttp as L, resetSpotlightRuntimeForTests as C } from "./plugin.js";
|
|
8
|
+
import { useSpotlightStore as P } from "./store/spotlightStore.js";
|
|
9
|
+
import { INVESTMENT_SUB_INTENT_LABELS as N, InvestmentSubIntent as k, PROGRESS_SUB_INTENT_LABELS as A, ProgressSubIntent as w, QUALITY_SUB_INTENT_LABELS as R, QualitySubIntent as B, SAFETY_SUB_INTENT_LABELS as H, SPOTLIGHT_INTENT_LABELS as b, SUB_INTENT_CONFIG as M, SafetySubIntent as F, SpotlightCommandDomain as G, SpotlightCommandScope as U, SpotlightIntent as K } from "./store/types.js";
|
|
10
|
+
import { useSpotlightRuntimeStore as v } from "./store/runtimeStore.js";
|
|
11
|
+
import { useAgentSessionStore as D } from "./session/agentSession.js";
|
|
12
|
+
import { getSkillsPoolForRun as Y, loadBundledSkillsFromGlob as Q } from "./skills/index.js";
|
|
13
|
+
import { cancelRemoteSpotlightRunForSignal as V, runRemoteSpotlightPipeline as j, warmupSpotlightRemoteContext as q } from "./remote/runPipeline.js";
|
|
14
|
+
import "@inupedia/spotlight-client";
|
|
15
|
+
import { ensureSpotlightMeta as Z, getSpotlightUiPrompts as $, resetSpotlightMetaCacheForTests as tt } from "./remote/meta.js";
|
|
16
|
+
import { extractTranscriptionText as et, normalizeSpeakText as rt, spotlightSynthesizeSpeech as pt, spotlightTranscribeAudio as it } 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 Tt, composeToolStepContent as at, getIntentStepDisplayContent as ft, humanizeSpotlightStepContent as xt, isLoopPlanningChunk as ht, isToolExecutionStep as ut, sanitizeToolStepAnswerText as Et, splitIntentStepContent as _t, splitToolStepContent as It } from "./store/pipeline/displayText.js";
|
|
20
|
+
import { isInternalKnowledgeEvidenceTool as Lt, isUserFacingKnowledgeTool as Ct, partitionToolCalls as Ot } 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 Ht } from "./store/pipeline/errors.js";
|
|
24
|
+
import { getSuggestedQuestions as Mt } from "./store/capabilities.js";
|
|
25
|
+
import { useSpotlightPanelUi as Gt } from "./composables/useSpotlightPanelUi.js";
|
|
26
|
+
import { useSpotlightCommandShortcuts as Kt } from "./composables/useSpotlightCommandShortcuts.js";
|
|
27
|
+
import { isGenericHostExecutionReply as vt } 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 io } 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 To } from "./skills/parser.js";
|
|
36
|
+
export {
|
|
37
|
+
Dt as COMMON_WORKFLOW_STEPS,
|
|
38
|
+
N as INVESTMENT_SUB_INTENT_LABELS,
|
|
39
|
+
k as InvestmentSubIntent,
|
|
40
|
+
A as PROGRESS_SUB_INTENT_LABELS,
|
|
41
|
+
w as ProgressSubIntent,
|
|
42
|
+
R as QUALITY_SUB_INTENT_LABELS,
|
|
43
|
+
B as QualitySubIntent,
|
|
44
|
+
H as SAFETY_SUB_INTENT_LABELS,
|
|
45
|
+
r as SPOTLIGHT_CONFIG_KEY,
|
|
46
|
+
u as SPOTLIGHT_HOST_ADAPTER_KEY,
|
|
47
|
+
E 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
|
+
M as SUB_INTENT_CONFIG,
|
|
52
|
+
F as SafetySubIntent,
|
|
53
|
+
G as SpotlightCommandDomain,
|
|
54
|
+
U as SpotlightCommandScope,
|
|
55
|
+
K as SpotlightIntent,
|
|
56
|
+
_ as SpotlightVue,
|
|
57
|
+
mt as TOOL_NAMES,
|
|
58
|
+
Tt 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
|
+
V as cancelRemoteSpotlightRunForSignal,
|
|
66
|
+
at as composeToolStepContent,
|
|
67
|
+
$t as createOperateDefinition,
|
|
68
|
+
qt as createOperateExecutor,
|
|
69
|
+
po as createRunSessionHostTool,
|
|
70
|
+
io as createSessionControlExecutor,
|
|
71
|
+
l as defineSpotlightApp,
|
|
72
|
+
p as defineSpotlightConfig,
|
|
73
|
+
g as defineSpotlightHost,
|
|
74
|
+
Z as ensureSpotlightMeta,
|
|
75
|
+
et as extractTranscriptionText,
|
|
76
|
+
So as formatSkillsWithinBudget,
|
|
77
|
+
At as formatSpotlightKnowledgeMarkdown,
|
|
78
|
+
Ht as formatToolFailure,
|
|
79
|
+
so as getBypassMatchedSkills,
|
|
80
|
+
ft as getIntentStepDisplayContent,
|
|
81
|
+
mo as getModelInvokableSkills,
|
|
82
|
+
Y as getSkillsPoolForRun,
|
|
83
|
+
I as getSpotlightConfig,
|
|
84
|
+
d as getSpotlightHostAdapter,
|
|
85
|
+
L as getSpotlightHttp,
|
|
86
|
+
St as getSpotlightJson,
|
|
87
|
+
$ as getSpotlightUiPrompts,
|
|
88
|
+
Mt as getSuggestedQuestions,
|
|
89
|
+
xt as humanizeSpotlightStepContent,
|
|
90
|
+
wt as initSpotlightMarkdownPreview,
|
|
91
|
+
vt as isGenericHostExecutionReply,
|
|
92
|
+
Lt as isInternalKnowledgeEvidenceTool,
|
|
93
|
+
ht as isLoopPlanningChunk,
|
|
94
|
+
Xt as isOperateWorkflowContext,
|
|
95
|
+
ut as isToolExecutionStep,
|
|
96
|
+
Ct as isUserFacingKnowledgeTool,
|
|
97
|
+
Q as loadBundledSkillsFromGlob,
|
|
98
|
+
x as mergeSpotlightSkills,
|
|
99
|
+
a as normalizeSkillsOption,
|
|
100
|
+
rt as normalizeSpeakText,
|
|
101
|
+
To as parseSpotlightSkillMarkdown,
|
|
102
|
+
Ot as partitionToolCalls,
|
|
103
|
+
lt as postSpotlightJson,
|
|
104
|
+
Rt as preprocessKnowledgeMarkdown,
|
|
105
|
+
s as readSpotlightEnv,
|
|
106
|
+
tt as resetSpotlightMetaCacheForTests,
|
|
107
|
+
C as resetSpotlightRuntimeForTests,
|
|
108
|
+
n as resolveSpotlightConfig,
|
|
109
|
+
Jt as runHostTool,
|
|
110
|
+
j as runRemoteSpotlightPipeline,
|
|
111
|
+
Et as sanitizeToolStepAnswerText,
|
|
112
|
+
_t as splitIntentStepContent,
|
|
113
|
+
It as splitToolStepContent,
|
|
114
|
+
pt as spotlightSynthesizeSpeech,
|
|
115
|
+
it as spotlightTranscribeAudio,
|
|
116
|
+
D as useAgentSessionStore,
|
|
117
|
+
Kt as useSpotlightCommandShortcuts,
|
|
118
|
+
Gt as useSpotlightPanelUi,
|
|
119
|
+
v as useSpotlightRuntimeStore,
|
|
120
|
+
P as useSpotlightStore,
|
|
121
|
+
q as warmupSpotlightRemoteContext
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type App } from "vue";
|
|
2
|
+
import type { SpotlightVuePluginOptions } from "./config.js";
|
|
3
|
+
export declare function mountSpotlightShell(app: App, options: SpotlightVuePluginOptions): Promise<void>;
|
|
4
|
+
export declare function unmountSpotlightShellForTests(): void;
|
|
5
|
+
//# sourceMappingURL=mountShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mountShell.d.ts","sourceRoot":"","sources":["../src/mountShell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAKpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAI7D,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED,wBAAgB,6BAA6B,IAAI,IAAI,CAKpD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createVNode as i, render as l } from "vue";
|
|
2
|
+
import { SPOTLIGHT_AVATAR_CONFIG_KEY as d } from "./avatar/config.js";
|
|
3
|
+
let t = null;
|
|
4
|
+
async function m(n, e) {
|
|
5
|
+
if (e.enabled === !1) return;
|
|
6
|
+
const a = {
|
|
7
|
+
...e.avatar ?? {}
|
|
8
|
+
};
|
|
9
|
+
n.provide(d, a);
|
|
10
|
+
const { default: r } = await import("./components/SpotlightShell.vue.js");
|
|
11
|
+
t = document.createElement("div"), t.id = "inupedia-spotlight-root", document.body.appendChild(t);
|
|
12
|
+
const o = i(r, {
|
|
13
|
+
avatarEnabled: e.avatarEnabled === !0
|
|
14
|
+
});
|
|
15
|
+
o.appContext = n._context, l(o, t);
|
|
16
|
+
}
|
|
17
|
+
function p() {
|
|
18
|
+
t && (l(null, t), t.remove(), t = null);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
m as mountSpotlightShell,
|
|
22
|
+
p as unmountSpotlightShellForTests
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=mountShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mountShell.js","sources":["../src/mountShell.ts"],"sourcesContent":["import { createVNode, render, type App } from \"vue\";\nimport {\n SPOTLIGHT_AVATAR_CONFIG_KEY,\n type SpotlightAvatarConfig,\n} from \"./avatar/config.js\";\nimport type { SpotlightVuePluginOptions } from \"./config.js\";\n\nlet shellContainer: HTMLElement | null = null;\n\nexport async function mountSpotlightShell(\n app: App,\n options: SpotlightVuePluginOptions,\n): Promise<void> {\n if (options.enabled === false) return;\n\n const avatarConfig: SpotlightAvatarConfig = {\n ...(options.avatar ?? {}),\n };\n app.provide(SPOTLIGHT_AVATAR_CONFIG_KEY, avatarConfig);\n\n const { default: SpotlightShell } = await import(\n \"./components/SpotlightShell.vue\"\n );\n\n shellContainer = document.createElement(\"div\");\n shellContainer.id = \"inupedia-spotlight-root\";\n document.body.appendChild(shellContainer);\n\n const vnode = createVNode(SpotlightShell, {\n avatarEnabled: options.avatarEnabled === true,\n });\n vnode.appContext = app._context;\n render(vnode, shellContainer);\n}\n\nexport function unmountSpotlightShellForTests(): void {\n if (!shellContainer) return;\n render(null, shellContainer);\n shellContainer.remove();\n shellContainer = null;\n}\n"],"names":["shellContainer","mountSpotlightShell","app","options","avatarConfig","SPOTLIGHT_AVATAR_CONFIG_KEY","SpotlightShell","vnode","createVNode","render","unmountSpotlightShellForTests"],"mappings":";;AAOA,IAAIA,IAAqC;AAEzC,eAAsBC,EACpBC,GACAC,GACe;AACf,MAAIA,EAAQ,YAAY,GAAO;AAE/B,QAAMC,IAAsC;AAAA,IAC1C,GAAID,EAAQ,UAAU,CAAA;AAAA,EAAC;AAEzB,EAAAD,EAAI,QAAQG,GAA6BD,CAAY;AAErD,QAAM,EAAE,SAASE,MAAmB,MAAM,OACxC,oCACF;AAEA,EAAAN,IAAiB,SAAS,cAAc,KAAK,GAC7CA,EAAe,KAAK,2BACpB,SAAS,KAAK,YAAYA,CAAc;AAExC,QAAMO,IAAQC,EAAYF,GAAgB;AAAA,IACxC,eAAeH,EAAQ,kBAAkB;AAAA,EAAA,CAC1C;AACD,EAAAI,EAAM,aAAaL,EAAI,UACvBO,EAAOF,GAAOP,CAAc;AAC9B;AAEO,SAASU,IAAsC;AACpD,EAAKV,MACLS,EAAO,MAAMT,CAAc,GAC3BA,EAAe,OAAA,GACfA,IAAiB;AACnB;"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { App, InjectionKey } from "vue";
|
|
2
|
+
import { type SpotlightHostAdapter, type SpotlightHttp } from "@inupedia/spotlight-client";
|
|
3
|
+
import { defineSpotlightConfig, SPOTLIGHT_CONFIG_KEY, type SpotlightConfig, type SpotlightVuePluginOptions } from "./config.js";
|
|
4
|
+
import type { SpotlightAvatarConfig } from "./avatar/config.js";
|
|
5
|
+
export declare const SPOTLIGHT_HTTP_KEY: InjectionKey<SpotlightHttp>;
|
|
6
|
+
export declare const SPOTLIGHT_HOST_ADAPTER_KEY: InjectionKey<SpotlightHostAdapter>;
|
|
7
|
+
export declare function getSpotlightConfig(): SpotlightConfig;
|
|
8
|
+
export declare function getSpotlightHttp(): SpotlightHttp;
|
|
9
|
+
export declare function getSpotlightHostAdapter(): SpotlightHostAdapter;
|
|
10
|
+
/** Reset singletons (tests / HMR). */
|
|
11
|
+
export declare function resetSpotlightRuntimeForTests(): void;
|
|
12
|
+
export declare const SpotlightVue: {
|
|
13
|
+
install(app: App, options: SpotlightVuePluginOptions): void;
|
|
14
|
+
};
|
|
15
|
+
export { defineSpotlightConfig, SPOTLIGHT_CONFIG_KEY, type SpotlightConfig, type SpotlightVuePluginOptions, type SpotlightAvatarConfig, };
|
|
16
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAC7C,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC/B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,aAAa,CACjC,CAAC;AAC3B,eAAO,MAAM,0BAA0B,EAAE,YAAY,CAAC,oBAAoB,CACxC,CAAC;AAMnC,wBAAgB,kBAAkB,IAAI,eAAe,CAOpD;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAMhD;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,CAM9D;AAED,sCAAsC;AACtC,wBAAgB,6BAA6B,IAAI,IAAI,CAKpD;AAED,eAAO,MAAM,YAAY;iBACV,GAAG,WAAW,yBAAyB,GAAG,IAAI;CAuB5D,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,GAC3B,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createSpotlightHttp as s, createSpotlightHostAdapter as g } from "@inupedia/spotlight-client";
|
|
2
|
+
import { defineSpotlightConfig as f, SPOTLIGHT_CONFIG_KEY as h } from "./config.js";
|
|
3
|
+
import { mountSpotlightShell as p, unmountSpotlightShellForTests as u } from "./mountShell.js";
|
|
4
|
+
const c = /* @__PURE__ */ Symbol("spotlight-http"), S = /* @__PURE__ */ Symbol("spotlight-host-adapter");
|
|
5
|
+
let n = null, l = null, e = null;
|
|
6
|
+
function a() {
|
|
7
|
+
if (!n)
|
|
8
|
+
throw new Error(
|
|
9
|
+
"Spotlight is not installed. Call app.use(SpotlightVue, { config }) in main.ts"
|
|
10
|
+
);
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
function H() {
|
|
14
|
+
if (!l) {
|
|
15
|
+
const t = a();
|
|
16
|
+
l = s(t);
|
|
17
|
+
}
|
|
18
|
+
return l;
|
|
19
|
+
}
|
|
20
|
+
function E() {
|
|
21
|
+
if (!e) {
|
|
22
|
+
const t = a();
|
|
23
|
+
e = g({ tools: t.tools });
|
|
24
|
+
}
|
|
25
|
+
return e;
|
|
26
|
+
}
|
|
27
|
+
function b() {
|
|
28
|
+
u(), n = null, l = null, e = null;
|
|
29
|
+
}
|
|
30
|
+
const A = {
|
|
31
|
+
install(t, i) {
|
|
32
|
+
const o = f(i.config), r = typeof o.tools == "function" ? o.tools() : o.tools;
|
|
33
|
+
if (!Array.isArray(r) || r.length === 0)
|
|
34
|
+
throw new Error(
|
|
35
|
+
"Spotlight config: at least one host tool is required after tools() resolves"
|
|
36
|
+
);
|
|
37
|
+
n = o, l = s(o), e = g({ tools: o.tools }), t.provide(h, o), t.provide(c, l), t.provide(S, e), t.config.globalProperties.$spotlightEnabled = i.enabled !== !1, t.config.globalProperties.$spotlightAvatarEnabled = i.avatarEnabled === !0, p(t, i);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
h as SPOTLIGHT_CONFIG_KEY,
|
|
42
|
+
S as SPOTLIGHT_HOST_ADAPTER_KEY,
|
|
43
|
+
c as SPOTLIGHT_HTTP_KEY,
|
|
44
|
+
A as SpotlightVue,
|
|
45
|
+
f as defineSpotlightConfig,
|
|
46
|
+
a as getSpotlightConfig,
|
|
47
|
+
E as getSpotlightHostAdapter,
|
|
48
|
+
H as getSpotlightHttp,
|
|
49
|
+
b as resetSpotlightRuntimeForTests
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../src/plugin.ts"],"sourcesContent":["import type { App, InjectionKey } from \"vue\";\nimport {\n createSpotlightHostAdapter,\n createSpotlightHttp,\n type SpotlightHostAdapter,\n type SpotlightHttp,\n} from \"@inupedia/spotlight-client\";\nimport {\n defineSpotlightConfig,\n SPOTLIGHT_CONFIG_KEY,\n type SpotlightConfig,\n type SpotlightVuePluginOptions,\n} from \"./config.js\";\nimport { mountSpotlightShell, unmountSpotlightShellForTests } from \"./mountShell.js\";\nimport type { SpotlightAvatarConfig } from \"./avatar/config.js\";\n\nexport const SPOTLIGHT_HTTP_KEY: InjectionKey<SpotlightHttp> =\n Symbol(\"spotlight-http\");\nexport const SPOTLIGHT_HOST_ADAPTER_KEY: InjectionKey<SpotlightHostAdapter> =\n Symbol(\"spotlight-host-adapter\");\n\nlet installedConfig: SpotlightConfig | null = null;\nlet installedHttp: SpotlightHttp | null = null;\nlet installedAdapter: SpotlightHostAdapter | null = null;\n\nexport function getSpotlightConfig(): SpotlightConfig {\n if (!installedConfig) {\n throw new Error(\n \"Spotlight is not installed. Call app.use(SpotlightVue, { config }) in main.ts\",\n );\n }\n return installedConfig;\n}\n\nexport function getSpotlightHttp(): SpotlightHttp {\n if (!installedHttp) {\n const config = getSpotlightConfig();\n installedHttp = createSpotlightHttp(config);\n }\n return installedHttp;\n}\n\nexport function getSpotlightHostAdapter(): SpotlightHostAdapter {\n if (!installedAdapter) {\n const config = getSpotlightConfig();\n installedAdapter = createSpotlightHostAdapter({ tools: config.tools });\n }\n return installedAdapter;\n}\n\n/** Reset singletons (tests / HMR). */\nexport function resetSpotlightRuntimeForTests(): void {\n unmountSpotlightShellForTests();\n installedConfig = null;\n installedHttp = null;\n installedAdapter = null;\n}\n\nexport const SpotlightVue = {\n install(app: App, options: SpotlightVuePluginOptions): void {\n const config = defineSpotlightConfig(options.config);\n const resolvedTools =\n typeof config.tools === \"function\" ? config.tools() : config.tools;\n if (!Array.isArray(resolvedTools) || resolvedTools.length === 0) {\n throw new Error(\n \"Spotlight config: at least one host tool is required after tools() resolves\",\n );\n }\n installedConfig = config;\n installedHttp = createSpotlightHttp(config);\n installedAdapter = createSpotlightHostAdapter({ tools: config.tools });\n\n app.provide(SPOTLIGHT_CONFIG_KEY, config);\n app.provide(SPOTLIGHT_HTTP_KEY, installedHttp);\n app.provide(SPOTLIGHT_HOST_ADAPTER_KEY, installedAdapter);\n\n app.config.globalProperties.$spotlightEnabled = options.enabled !== false;\n app.config.globalProperties.$spotlightAvatarEnabled =\n options.avatarEnabled === true;\n\n mountSpotlightShell(app, options);\n },\n};\n\nexport {\n defineSpotlightConfig,\n SPOTLIGHT_CONFIG_KEY,\n type SpotlightConfig,\n type SpotlightVuePluginOptions,\n type SpotlightAvatarConfig,\n};\n"],"names":["SPOTLIGHT_HTTP_KEY","SPOTLIGHT_HOST_ADAPTER_KEY","installedConfig","installedHttp","installedAdapter","getSpotlightConfig","getSpotlightHttp","config","createSpotlightHttp","getSpotlightHostAdapter","createSpotlightHostAdapter","resetSpotlightRuntimeForTests","unmountSpotlightShellForTests","SpotlightVue","app","options","defineSpotlightConfig","resolvedTools","SPOTLIGHT_CONFIG_KEY","mountSpotlightShell"],"mappings":";;;AAgBO,MAAMA,2BACJ,gBAAgB,GACZC,2BACJ,wBAAwB;AAEjC,IAAIC,IAA0C,MAC1CC,IAAsC,MACtCC,IAAgD;AAE7C,SAASC,IAAsC;AACpD,MAAI,CAACH;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAGJ,SAAOA;AACT;AAEO,SAASI,IAAkC;AAChD,MAAI,CAACH,GAAe;AAClB,UAAMI,IAASF,EAAA;AACf,IAAAF,IAAgBK,EAAoBD,CAAM;AAAA,EAC5C;AACA,SAAOJ;AACT;AAEO,SAASM,IAAgD;AAC9D,MAAI,CAACL,GAAkB;AACrB,UAAMG,IAASF,EAAA;AACf,IAAAD,IAAmBM,EAA2B,EAAE,OAAOH,EAAO,OAAO;AAAA,EACvE;AACA,SAAOH;AACT;AAGO,SAASO,IAAsC;AACpD,EAAAC,EAAA,GACAV,IAAkB,MAClBC,IAAgB,MAChBC,IAAmB;AACrB;AAEO,MAAMS,IAAe;AAAA,EAC1B,QAAQC,GAAUC,GAA0C;AAC1D,UAAMR,IAASS,EAAsBD,EAAQ,MAAM,GAC7CE,IACJ,OAAOV,EAAO,SAAU,aAAaA,EAAO,UAAUA,EAAO;AAC/D,QAAI,CAAC,MAAM,QAAQU,CAAa,KAAKA,EAAc,WAAW;AAC5D,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAGJ,IAAAf,IAAkBK,GAClBJ,IAAgBK,EAAoBD,CAAM,GAC1CH,IAAmBM,EAA2B,EAAE,OAAOH,EAAO,OAAO,GAErEO,EAAI,QAAQI,GAAsBX,CAAM,GACxCO,EAAI,QAAQd,GAAoBG,CAAa,GAC7CW,EAAI,QAAQb,GAA4BG,CAAgB,GAExDU,EAAI,OAAO,iBAAiB,oBAAoBC,EAAQ,YAAY,IACpED,EAAI,OAAO,iBAAiB,0BAC1BC,EAAQ,kBAAkB,IAE5BI,EAAoBL,GAAKC,CAAO;AAAA,EAClC;AACF;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function normalizeSpeakText(input: string): string;
|
|
2
|
+
export declare function extractTranscriptionText(payload: unknown): string;
|
|
3
|
+
export type SpotlightTranscriptionPayload = {
|
|
4
|
+
file: string;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
filename: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function spotlightTranscribeAudio(payload: SpotlightTranscriptionPayload, signal?: AbortSignal): Promise<unknown>;
|
|
9
|
+
export declare function spotlightSynthesizeSpeech(text: string, signal?: AbortSignal): Promise<{
|
|
10
|
+
blob: Blob;
|
|
11
|
+
spokenText: string;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/remote/audio.ts"],"names":[],"mappings":"AAUA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASxD;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAMjE;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,6BAA6B,EACtC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B7C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { withRequestTimeout as s } from "../utils/requestTimeout.js";
|
|
2
|
+
import { getSpotlightServerBase as p, buildSpotlightJsonHeaders as u } from "./httpConfig.js";
|
|
3
|
+
import { postSpotlightJson as T } from "./serverJson.js";
|
|
4
|
+
const l = 3e4, f = 45e3;
|
|
5
|
+
function S(t) {
|
|
6
|
+
return t.replace(/```[\s\S]*?```/g, " ").replace(/`([^`]+)`/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/[#>*_-]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 3e3);
|
|
7
|
+
}
|
|
8
|
+
function w(t) {
|
|
9
|
+
if (typeof t == "string") return t.trim();
|
|
10
|
+
if (!t || typeof t != "object") return "";
|
|
11
|
+
const e = t.text;
|
|
12
|
+
return typeof e == "string" ? e.trim() : "";
|
|
13
|
+
}
|
|
14
|
+
async function b(t, e) {
|
|
15
|
+
const r = s(l, e);
|
|
16
|
+
try {
|
|
17
|
+
return await T(
|
|
18
|
+
"/v1/audio/transcriptions",
|
|
19
|
+
t,
|
|
20
|
+
r.signal
|
|
21
|
+
);
|
|
22
|
+
} finally {
|
|
23
|
+
r.cleanup();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function E(t, e) {
|
|
27
|
+
const r = S(t);
|
|
28
|
+
if (!r)
|
|
29
|
+
throw new Error("TTS 输入为空。");
|
|
30
|
+
const i = s(f, e);
|
|
31
|
+
try {
|
|
32
|
+
const c = p(), n = await fetch(`${c}/v1/audio/speech`, {
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: u(),
|
|
35
|
+
body: JSON.stringify({ input: r }),
|
|
36
|
+
signal: i.signal
|
|
37
|
+
});
|
|
38
|
+
if (!n.ok) {
|
|
39
|
+
const a = await n.text().catch(() => "");
|
|
40
|
+
throw new Error(a || `HTTP ${n.status}`);
|
|
41
|
+
}
|
|
42
|
+
const o = await n.blob();
|
|
43
|
+
if (o.size <= 0)
|
|
44
|
+
throw new Error("TTS 返回空音频。");
|
|
45
|
+
return { blob: o, spokenText: r };
|
|
46
|
+
} finally {
|
|
47
|
+
i.cleanup();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
w as extractTranscriptionText,
|
|
52
|
+
S as normalizeSpeakText,
|
|
53
|
+
E as spotlightSynthesizeSpeech,
|
|
54
|
+
b as spotlightTranscribeAudio
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.js","sources":["../../src/remote/audio.ts"],"sourcesContent":["import { withRequestTimeout } from \"../utils/requestTimeout.js\";\nimport {\n buildSpotlightJsonHeaders,\n getSpotlightServerBase,\n} from \"./httpConfig.js\";\nimport { postSpotlightJson } from \"./serverJson.js\";\n\nconst STT_REQUEST_TIMEOUT_MS = 30_000;\nconst TTS_REQUEST_TIMEOUT_MS = 45_000;\n\nexport function normalizeSpeakText(input: string): string {\n return input\n .replace(/```[\\s\\S]*?```/g, \" \")\n .replace(/`([^`]+)`/g, \"$1\")\n .replace(/\\[(.*?)\\]\\((.*?)\\)/g, \"$1\")\n .replace(/[#>*_-]+/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim()\n .slice(0, 3000);\n}\n\nexport function extractTranscriptionText(payload: unknown): string {\n if (typeof payload === \"string\") return payload.trim();\n if (!payload || typeof payload !== \"object\") return \"\";\n const text = (payload as { text?: unknown }).text;\n if (typeof text === \"string\") return text.trim();\n return \"\";\n}\n\nexport type SpotlightTranscriptionPayload = {\n file: string;\n mimeType: string;\n filename: string;\n};\n\nexport async function spotlightTranscribeAudio(\n payload: SpotlightTranscriptionPayload,\n signal?: AbortSignal,\n): Promise<unknown> {\n const request = withRequestTimeout(STT_REQUEST_TIMEOUT_MS, signal);\n try {\n return await postSpotlightJson<unknown>(\n \"/v1/audio/transcriptions\",\n payload,\n request.signal,\n );\n } finally {\n request.cleanup();\n }\n}\n\nexport async function spotlightSynthesizeSpeech(\n text: string,\n signal?: AbortSignal,\n): Promise<{ blob: Blob; spokenText: string }> {\n const spokenText = normalizeSpeakText(text);\n if (!spokenText) {\n throw new Error(\"TTS 输入为空。\");\n }\n\n const request = withRequestTimeout(TTS_REQUEST_TIMEOUT_MS, signal);\n try {\n const base = getSpotlightServerBase();\n const response = await fetch(`${base}/v1/audio/speech`, {\n method: \"POST\",\n headers: buildSpotlightJsonHeaders(),\n body: JSON.stringify({ input: spokenText }),\n signal: request.signal,\n });\n\n if (!response.ok) {\n const detail = await response.text().catch(() => \"\");\n throw new Error(detail || `HTTP ${response.status}`);\n }\n\n const blob = await response.blob();\n if (blob.size <= 0) {\n throw new Error(\"TTS 返回空音频。\");\n }\n return { blob, spokenText };\n } finally {\n request.cleanup();\n }\n}\n"],"names":["STT_REQUEST_TIMEOUT_MS","TTS_REQUEST_TIMEOUT_MS","normalizeSpeakText","input","extractTranscriptionText","payload","text","spotlightTranscribeAudio","signal","request","withRequestTimeout","postSpotlightJson","spotlightSynthesizeSpeech","spokenText","base","getSpotlightServerBase","response","buildSpotlightJsonHeaders","detail","blob"],"mappings":";;;AAOA,MAAMA,IAAyB,KACzBC,IAAyB;AAExB,SAASC,EAAmBC,GAAuB;AACxD,SAAOA,EACJ,QAAQ,mBAAmB,GAAG,EAC9B,QAAQ,cAAc,IAAI,EAC1B,QAAQ,uBAAuB,IAAI,EACnC,QAAQ,aAAa,GAAG,EACxB,QAAQ,QAAQ,GAAG,EACnB,KAAA,EACA,MAAM,GAAG,GAAI;AAClB;AAEO,SAASC,EAAyBC,GAA0B;AACjE,MAAI,OAAOA,KAAY,SAAU,QAAOA,EAAQ,KAAA;AAChD,MAAI,CAACA,KAAW,OAAOA,KAAY,SAAU,QAAO;AACpD,QAAMC,IAAQD,EAA+B;AAC7C,SAAI,OAAOC,KAAS,WAAiBA,EAAK,KAAA,IACnC;AACT;AAQA,eAAsBC,EACpBF,GACAG,GACkB;AAClB,QAAMC,IAAUC,EAAmBV,GAAwBQ,CAAM;AACjE,MAAI;AACF,WAAO,MAAMG;AAAA,MACX;AAAA,MACAN;AAAA,MACAI,EAAQ;AAAA,IAAA;AAAA,EAEZ,UAAA;AACE,IAAAA,EAAQ,QAAA;AAAA,EACV;AACF;AAEA,eAAsBG,EACpBN,GACAE,GAC6C;AAC7C,QAAMK,IAAaX,EAAmBI,CAAI;AAC1C,MAAI,CAACO;AACH,UAAM,IAAI,MAAM,WAAW;AAG7B,QAAMJ,IAAUC,EAAmBT,GAAwBO,CAAM;AACjE,MAAI;AACF,UAAMM,IAAOC,EAAA,GACPC,IAAW,MAAM,MAAM,GAAGF,CAAI,oBAAoB;AAAA,MACtD,QAAQ;AAAA,MACR,SAASG,EAAA;AAAA,MACT,MAAM,KAAK,UAAU,EAAE,OAAOJ,GAAY;AAAA,MAC1C,QAAQJ,EAAQ;AAAA,IAAA,CACjB;AAED,QAAI,CAACO,EAAS,IAAI;AAChB,YAAME,IAAS,MAAMF,EAAS,OAAO,MAAM,MAAM,EAAE;AACnD,YAAM,IAAI,MAAME,KAAU,QAAQF,EAAS,MAAM,EAAE;AAAA,IACrD;AAEA,UAAMG,IAAO,MAAMH,EAAS,KAAA;AAC5B,QAAIG,EAAK,QAAQ;AACf,YAAM,IAAI,MAAM,YAAY;AAE9B,WAAO,EAAE,MAAAA,GAAM,YAAAN,EAAA;AAAA,EACjB,UAAA;AACE,IAAAJ,EAAQ,QAAA;AAAA,EACV;AACF;"}
|