@pulse-editor/react-api 0.1.1-alpha.6 → 0.1.1-alpha.7
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/use-agent-tools.d.ts +6 -1
- package/dist/hooks/use-agents.d.ts +1 -1
- package/dist/hooks/use-fetch.d.ts +1 -1
- package/dist/hooks/use-file-view.d.ts +1 -1
- package/dist/hooks/use-notification.d.ts +1 -1
- package/dist/hooks/use-orc.d.ts +1 -1
- package/dist/hooks/use-terminal.d.ts +1 -1
- package/dist/hooks/use-theme.d.ts +1 -1
- package/dist/lib/hooks/use-imc.d.ts +1 -1
- package/dist/main.js +1 -1
- package/package.json +3 -2
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { AgentTool } from "@pulse-editor/shared-utils";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Add or use agent tools in the editor.
|
|
4
|
+
* @param moduleName
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export default function useAgentTools(): {
|
|
3
8
|
installAgentTool: (tool: AgentTool) => Promise<void>;
|
|
4
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Agent } from "@pulse-editor/shared-utils";
|
|
2
|
-
export default function useAgents(
|
|
2
|
+
export default function useAgents(): {
|
|
3
3
|
installAgent: (config: Agent) => Promise<void>;
|
|
4
4
|
runAgentMethod: (agentName: string, methodName: string, parameters: Record<string, any>, abortSignal?: AbortSignal) => Promise<Record<string, any>>;
|
|
5
5
|
isReady: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileViewModel } from "@pulse-editor/shared-utils";
|
|
2
|
-
export default function useFileView(
|
|
2
|
+
export default function useFileView(): {
|
|
3
3
|
viewFile: FileViewModel | undefined;
|
|
4
4
|
updateViewFile: (file: FileViewModel) => void;
|
|
5
5
|
setIsLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
package/dist/hooks/use-orc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InterModuleCommunication } from "@pulse-editor/shared-utils";
|
|
2
2
|
import { ReceiverHandlerMap } from "@pulse-editor/shared-utils";
|
|
3
|
-
export default function useIMC(
|
|
3
|
+
export default function useIMC(handlerMap: ReceiverHandlerMap): {
|
|
4
4
|
imc: InterModuleCommunication | undefined;
|
|
5
5
|
isReady: boolean;
|
|
6
6
|
};
|
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 o(o
|
|
1
|
+
import{InterModuleCommunication as e,IMCMessageTypeEnum as n}from"@pulse-editor/shared-utils";import{useState as t,useEffect as i}from"react";function o(o){const[s,r]=t(void 0),[a,d]=t(!1),[c,u]=t(!1),w=window.parent;return i((()=>(u(!0),()=>{s?.close()})),[]),i((()=>{if(!c)return;if(void 0!==s)return;const t=new e;t.initThisWindow(window),t.updateReceiverHandlerMap(o),t.initOtherWindow(w),r(t),t.sendMessage(n.Ready).then((()=>{d(!0)}))}),[c,s]),{imc:s,isReady:a}}function s(){const[e,s]=t(void 0),[r,a]=t(!1),d=new Map,{imc:c,isReady:u}=o(d);return i((()=>{u&&c?.sendMessage(n.RequestViewFile).then((e=>{s(e)}))}),[u]),i((()=>{r&&c?.sendMessage(n.Loaded)}),[r,c]),{viewFile:e,updateViewFile:function(e){c?.sendMessage(n.WriteViewFile,e)},setIsLoaded:a}}function r(){const[e,i]=t("light"),s=new Map;return s.set(n.ThemeChange,(async(e,n)=>{const t=n.payload;i((e=>t))})),o(s),{theme:e}}function a(){const e=new Map,{imc:t}=o(e);return{openNotification:function(e,i){if(!t)throw new Error("IMC is not initialized.");t.sendMessage(n.Notification,{text:e,type:i})}}}function d(){const e=new Map,{imc:t,isReady:i}=o(e);return{installAgent:async function(e){if(!t)throw new Error("IMC not initialized.");await t.sendMessage(n.InstallAgent,e).catch((e=>{throw new Error(e)}))},runAgentMethod:async function(e,i,o,s){if(!t)throw new Error("IMC not initialized.");return await t.sendMessage(n.RunAgentMethod,{agentName:e,methodName:i,parameters:o},s).then((e=>e))},isReady:i}}function c(){const e=new Map,{imc:t}=o(e);return{recognizeText:async function(e){if(!t)throw new Error("IMC is not initialized.");return(await t.sendMessage(n.OCR,{uri:e})).payload.text}}}function u(){const e=new Map,{imc:s,isReady:r}=o(e),[a,d]=t(void 0);return i((()=>{r&&s?.sendMessage(n.RequestTerminal).then((e=>{const{websocketUrl:t}=e;d(t),s.sendMessage(n.Loaded)}))}),[r]),{websocketUrl:a}}export{d as useAgents,s as useFileView,a as useNotification,c as useOCR,u as useTerminal,r as useTheme};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulse-editor/react-api",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.7",
|
|
4
|
+
"main": "dist/main.js",
|
|
4
5
|
"files": [
|
|
5
6
|
"dist"
|
|
6
7
|
],
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"typescript-eslint": "^8.30.1"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@pulse-editor/shared-utils": "0.1.1-alpha.
|
|
41
|
+
"@pulse-editor/shared-utils": "0.1.1-alpha.7",
|
|
41
42
|
"react": "^19.0.0",
|
|
42
43
|
"react-dom": "^19.0.0"
|
|
43
44
|
}
|