@pulse-editor/react-api 0.1.1-alpha.7 → 0.1.1-alpha.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/hooks/agent/use-agent-tools.d.ts +6 -0
- package/dist/hooks/agent/use-agents.d.ts +5 -0
- package/dist/hooks/editor/use-file-view.d.ts +6 -0
- package/dist/hooks/editor/use-mic.d.ts +4 -0
- package/dist/hooks/editor/use-toolbar.d.ts +1 -0
- package/dist/hooks/extension/use-ext-command.d.ts +9 -0
- package/dist/hooks/modality/use-diffusion.d.ts +1 -0
- package/dist/hooks/modality/use-llm.d.ts +5 -0
- package/dist/hooks/modality/use-ocr.d.ts +3 -0
- package/dist/hooks/modality/use-speech2speech.d.ts +10 -0
- package/dist/hooks/modality/use-stt.d.ts +5 -0
- package/dist/hooks/modality/use-tts.d.ts +5 -0
- package/dist/main.d.ts +15 -7
- package/dist/main.js +1 -1
- package/package.json +2 -2
- package/dist/hooks/use-agent-tools.d.ts +0 -9
- package/dist/hooks/use-agents.d.ts +0 -6
- package/dist/hooks/use-file-view.d.ts +0 -6
- package/dist/hooks/use-orc.d.ts +0 -3
- /package/dist/hooks/{use-fetch.d.ts → editor/use-fetch.d.ts} +0 -0
- /package/dist/hooks/{use-notification.d.ts → editor/use-notification.d.ts} +0 -0
- /package/dist/hooks/{use-theme.d.ts → editor/use-theme.d.ts} +0 -0
- /package/dist/hooks/{use-terminal.d.ts → terminal/use-terminal.d.ts} +0 -0
- /package/dist/lib/{hooks/use-imc.d.ts → use-imc.d.ts} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LLMConfig } from "@pulse-editor/shared-utils";
|
|
2
|
+
export default function useAgents(): {
|
|
3
|
+
runAgentMethod: (agentName: string, methodName: string, parameters: Record<string, any>, abortSignal?: AbortSignal, llmConfig?: LLMConfig) => Promise<any>;
|
|
4
|
+
isReady: boolean;
|
|
5
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ViewModel } from "@pulse-editor/shared-utils";
|
|
2
|
+
export default function useFileView(): {
|
|
3
|
+
viewModel: ViewModel | undefined;
|
|
4
|
+
updateViewModel: (viewModel: ViewModel) => void;
|
|
5
|
+
setIsLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useToolbar(): {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExtensionCommandInfo } from "@pulse-editor/shared-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Register an extension command to listen to IMC messages from the core,
|
|
4
|
+
* and pass to the extension to handle.
|
|
5
|
+
*/
|
|
6
|
+
export default function useExtCommand(commandInfo: ExtensionCommandInfo, initialHandler?: (args: any) => Promise<string | void>): {
|
|
7
|
+
isReady: boolean;
|
|
8
|
+
updateHandler: (handler: (args: any) => Promise<string | void>) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useDiffusion(): {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use speech-to-speech API to listen to user input and read the output
|
|
3
|
+
* provided by you.
|
|
4
|
+
*/
|
|
5
|
+
export default function UseSpeech2Speech(): {
|
|
6
|
+
isReady: boolean;
|
|
7
|
+
userInput: string;
|
|
8
|
+
isUserStopped: boolean;
|
|
9
|
+
respondAndRead: (text: string) => Promise<void>;
|
|
10
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import useAgentTools from "./hooks/agent/use-agent-tools";
|
|
2
|
+
import useAgents from "./hooks/agent/use-agents";
|
|
3
|
+
import useFetch from "./hooks/editor/use-fetch";
|
|
4
|
+
import useFileView from "./hooks/editor/use-file-view";
|
|
5
|
+
import useNotification from "./hooks/editor/use-notification";
|
|
6
|
+
import useTheme from "./hooks/editor/use-theme";
|
|
7
|
+
import useToolbar from "./hooks/editor/use-toolbar";
|
|
8
|
+
import useExtCommand from "./hooks/extension/use-ext-command";
|
|
9
|
+
import useDiffusion from "./hooks/modality/use-diffusion";
|
|
10
|
+
import useLLM from "./hooks/modality/use-llm";
|
|
11
|
+
import useOCR from "./hooks/modality/use-ocr";
|
|
12
|
+
import useSTT from "./hooks/modality/use-stt";
|
|
13
|
+
import useTTS from "./hooks/modality/use-tts";
|
|
14
|
+
import useTerminal from "./hooks/terminal/use-terminal";
|
|
15
|
+
export { useAgentTools, useAgents, useFetch, useFileView, useNotification, useTheme, useToolbar, useDiffusion, useLLM, useOCR, useSTT, useTTS, useExtCommand, useTerminal, };
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{InterModuleCommunication as e,IMCMessageTypeEnum as n}from"@pulse-editor/shared-utils";import{useState as t,useEffect as i}from"react";function
|
|
1
|
+
import{InterModuleCommunication as e,IMCMessageTypeEnum as n}from"@pulse-editor/shared-utils";import{useState as t,useEffect as i}from"react";function r(r){const[o,a]=t(void 0),[s,c]=t(!1),[d,u]=t(!1),f=window.parent;return i((()=>(u(!0),()=>{u(!1),o?.close(),a(void 0)})),[]),i((()=>{if(!d)return;if(void 0!==o)return;const t=new e;t.initThisWindow(window),t.updateReceiverHandlerMap(r),t.initOtherWindow(f),a(t),t.sendMessage(n.ExtReady).then((()=>{c(!0)}))}),[d,o]),{imc:o,isReady:s}}function o(){return r(new Map),{}}function a(){const e=new Map,{imc:t,isReady:i}=r(e);return{runAgentMethod:async function(e,i,r,o,a){if(!t)throw new Error("IMC not initialized.");return await t.sendMessage(n.RunAgentMethod,{agentName:e,methodName:i,parameters:r,llmConfig:a},o).then((e=>e))},isReady:i}}function s(){const e=new Map,{imc:t}=r(e);return{fetch:function(e,i){if(!t)throw new Error("IMC is not initialized.");return t.sendMessage(n.Fetch,JSON.stringify({uri:e,options:i}))}}}function c(){const[e,o]=t(void 0),[a,s]=t(!1),c=new Map,{imc:d,isReady:u}=r(c);return i((()=>{u&&d?.sendMessage(n.RequestViewFile).then((e=>{o(e)}))}),[u]),i((()=>{a&&d?.sendMessage(n.Loaded)}),[a,d]),{viewModel:e,updateViewModel:function(e){d?.sendMessage(n.WriteViewFile,e)},setIsLoaded:s}}function d(){const e=new Map,{imc:t}=r(e);return{openNotification:function(e,i){if(!t)throw new Error("IMC is not initialized.");t.sendMessage(n.Notification,{text:e,type:i})}}}function u(){const[e,i]=t("light"),o=new Map;return o.set(n.ThemeChange,(async(e,n)=>{const t=n.payload;i((e=>t))})),r(o),{theme:e}}function f(){return{}}function w(e,o){const{isReady:a,imc:s}=r(u()),[c,d]=t(o);function u(){return new Map([[n.RunExtCommand,async(n,t)=>{if(!e)throw new Error("Extension command is not available");const{name:i,args:r}=t.payload;if(i===e.name){const n=e.parameters;if(Object.keys(r).length!==Object.keys(n).length)throw new Error(`Invalid number of parameters: expected ${Object.keys(n).length}, got ${Object.keys(r).length}`);for(const[n,t]of Object.entries(r)){if(void 0===e.parameters[n])throw new Error(`Invalid parameter: ${n}`);if(typeof t!==e.parameters[n].type)throw new Error(`Invalid type for parameter ${n}: expected ${e.parameters[n].type}, got ${typeof t}. Value received: ${t}`)}if(c){const e=await c(r);if(e)return e}}}]])}return i((()=>{s?.updateReceiverHandlerMap(u())}),[c,s]),{isReady:a,updateHandler:function(e){d((()=>e))}}}function p(){return{}}function m(){const e=new Map,{imc:t,isReady:i}=r(e);return{runLLM:async function(e,i){if(!t)throw new Error("IMC not initialized.");return await t.sendMessage(n.UseLLM,{prompt:e,llmConfig:i}).then((e=>e))},isReady:i}}function M(){const e=new Map,{imc:t}=r(e);return{recognizeText:async function(e){if(!t)throw new Error("IMC is not initialized.");return(await t.sendMessage(n.UseOCR,{image:e})).payload.text}}}function l(){const e=new Map,{imc:t,isReady:i}=r(e);return{runSTT:async function(e,i){if(!t)throw new Error("IMC not initialized.");return await t.sendMessage(n.UseSTT,{audio:e,sttConfig:i}).then((e=>e))},isReady:i}}function y(){const e=new Map,{imc:t,isReady:i}=r(e);return{runTTS:async function(e,i){if(!t)throw new Error("IMC not initialized.");return await t.sendMessage(n.UseTTS,{text:e,ttsConfig:i}).then((e=>e))},isReady:i}}function h(){const e=new Map,{imc:o,isReady:a}=r(e),[s,c]=t(void 0);return i((()=>{a&&o?.sendMessage(n.RequestTerminal).then((e=>{const{websocketUrl:t}=e;c(t),o.sendMessage(n.Loaded)}))}),[a]),{websocketUrl:s}}export{o as useAgentTools,a as useAgents,p as useDiffusion,w as useExtCommand,s as useFetch,c as useFileView,m as useLLM,d as useNotification,M as useOCR,l as useSTT,y as useTTS,h as useTerminal,u as useTheme,f as useToolbar};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulse-editor/react-api",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.9",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript-eslint": "^8.30.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@pulse-editor/shared-utils": "0.1.1-alpha.
|
|
41
|
+
"@pulse-editor/shared-utils": "0.1.1-alpha.9",
|
|
42
42
|
"react": "^19.0.0",
|
|
43
43
|
"react-dom": "^19.0.0"
|
|
44
44
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Agent } from "@pulse-editor/shared-utils";
|
|
2
|
-
export default function useAgents(): {
|
|
3
|
-
installAgent: (config: Agent) => Promise<void>;
|
|
4
|
-
runAgentMethod: (agentName: string, methodName: string, parameters: Record<string, any>, abortSignal?: AbortSignal) => Promise<Record<string, any>>;
|
|
5
|
-
isReady: boolean;
|
|
6
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FileViewModel } from "@pulse-editor/shared-utils";
|
|
2
|
-
export default function useFileView(): {
|
|
3
|
-
viewFile: FileViewModel | undefined;
|
|
4
|
-
updateViewFile: (file: FileViewModel) => void;
|
|
5
|
-
setIsLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
6
|
-
};
|
package/dist/hooks/use-orc.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|