@pulse-editor/react-api 0.1.1-alpha.2 → 0.1.1-alpha.21

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.
Files changed (52) hide show
  1. package/dist/hooks/agent/use-agent-tools.d.ts +6 -0
  2. package/dist/hooks/agent/use-agents.d.ts +5 -0
  3. package/dist/hooks/{use-fetch.d.ts → editor/use-fetch.d.ts} +1 -1
  4. package/dist/hooks/editor/use-file-view.d.ts +5 -0
  5. package/dist/hooks/editor/use-loading.d.ts +4 -0
  6. package/dist/hooks/editor/use-mic.d.ts +4 -0
  7. package/dist/hooks/{use-notification.d.ts → editor/use-notification.d.ts} +1 -1
  8. package/dist/hooks/editor/use-theme.d.ts +3 -0
  9. package/dist/hooks/editor/use-toolbar.d.ts +1 -0
  10. package/dist/hooks/extension/use-ext-command.d.ts +9 -0
  11. package/dist/hooks/modality/use-image-gen.d.ts +8 -0
  12. package/dist/hooks/modality/use-llm.d.ts +5 -0
  13. package/dist/hooks/modality/use-ocr.d.ts +3 -0
  14. package/dist/hooks/modality/use-speech2speech.d.ts +10 -0
  15. package/dist/hooks/modality/use-stt.d.ts +5 -0
  16. package/dist/hooks/modality/use-tts.d.ts +5 -0
  17. package/dist/hooks/modality/use-video-gen.d.ts +8 -0
  18. package/dist/hooks/terminal/use-terminal.d.ts +4 -0
  19. package/dist/lib/{hooks/use-imc.d.ts → use-imc.d.ts} +1 -1
  20. package/dist/main.d.ts +17 -7
  21. package/dist/main.js +1 -1
  22. package/package.json +8 -5
  23. package/dist/cjs/hooks/use-agents.js +0 -1
  24. package/dist/cjs/hooks/use-file-view.js +0 -1
  25. package/dist/cjs/hooks/use-notification.js +0 -1
  26. package/dist/cjs/hooks/use-orc.js +0 -1
  27. package/dist/cjs/hooks/use-terminal.js +0 -1
  28. package/dist/cjs/hooks/use-theme.js +0 -1
  29. package/dist/cjs/lib/hooks/use-imc.js +0 -1
  30. package/dist/cjs/main.js +0 -1
  31. package/dist/esm/hooks/use-agents.js +0 -1
  32. package/dist/esm/hooks/use-file-view.js +0 -1
  33. package/dist/esm/hooks/use-notification.js +0 -1
  34. package/dist/esm/hooks/use-orc.js +0 -1
  35. package/dist/esm/hooks/use-terminal.js +0 -1
  36. package/dist/esm/hooks/use-theme.js +0 -1
  37. package/dist/esm/lib/hooks/use-imc.js +0 -1
  38. package/dist/esm/main.js +0 -1
  39. package/dist/hooks/use-agent-tools.d.ts +0 -4
  40. package/dist/hooks/use-agents.d.ts +0 -6
  41. package/dist/hooks/use-agents.js +0 -1
  42. package/dist/hooks/use-file-view.d.ts +0 -6
  43. package/dist/hooks/use-file-view.js +0 -1
  44. package/dist/hooks/use-notification.js +0 -1
  45. package/dist/hooks/use-orc.d.ts +0 -3
  46. package/dist/hooks/use-orc.js +0 -1
  47. package/dist/hooks/use-terminal.d.ts +0 -3
  48. package/dist/hooks/use-terminal.js +0 -1
  49. package/dist/hooks/use-theme.d.ts +0 -3
  50. package/dist/hooks/use-theme.js +0 -1
  51. package/dist/lib/hooks/use-imc.js +0 -1
  52. package/dist/main.es.js +0 -1
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Add or use agent tools in the editor.
3
+ * @param moduleName
4
+ * @returns
5
+ */
6
+ export default function useAgentTools(): {};
@@ -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
+ };
@@ -1,3 +1,3 @@
1
- export default function useFetch(moduleName: string): {
1
+ export default function useFetch(): {
2
2
  fetch: (uri: string, options?: RequestInit) => Promise<Response>;
3
3
  };
@@ -0,0 +1,5 @@
1
+ import { ViewModel } from "@pulse-editor/shared-utils";
2
+ export default function useFileView(): {
3
+ viewModel: ViewModel | undefined;
4
+ updateViewModel: (viewModel: ViewModel) => void;
5
+ };
@@ -0,0 +1,4 @@
1
+ export default function useLoading(): {
2
+ isReady: boolean;
3
+ toggleLoading: (isLoading: boolean) => void;
4
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Use the microphone to record audio. (WIP)
3
+ */
4
+ export default function useMic(): void;
@@ -1,4 +1,4 @@
1
1
  import { NotificationTypeEnum } from "@pulse-editor/shared-utils";
2
- export default function useNotification(moduleName: string): {
2
+ export default function useNotification(): {
3
3
  openNotification: (text: string, type: NotificationTypeEnum) => void;
4
4
  };
@@ -0,0 +1,3 @@
1
+ export default function useTheme(): {
2
+ theme: string;
3
+ };
@@ -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,8 @@
1
+ import { ImageModelConfig } from "@pulse-editor/shared-utils";
2
+ export default function useImageGen(): {
3
+ runImageGen: (textPrompt?: string, imagePrompt?: string | ArrayBuffer, imageModelConfig?: ImageModelConfig) => Promise<{
4
+ arrayBuffer?: ArrayBuffer;
5
+ url?: string;
6
+ }>;
7
+ isReady: boolean;
8
+ };
@@ -0,0 +1,5 @@
1
+ import { LLMConfig } from "@pulse-editor/shared-utils";
2
+ export default function useLLM(): {
3
+ runLLM: (prompt: string, llmConfig?: LLMConfig) => Promise<string>;
4
+ isReady: boolean;
5
+ };
@@ -0,0 +1,3 @@
1
+ export default function useOCR(): {
2
+ recognizeText: (image: string) => Promise<string>;
3
+ };
@@ -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
+ };
@@ -0,0 +1,5 @@
1
+ import { STTConfig } from "@pulse-editor/shared-utils";
2
+ export default function useSTT(): {
3
+ runSTT: (audio: Uint8Array, sttConfig?: STTConfig) => Promise<string>;
4
+ isReady: boolean;
5
+ };
@@ -0,0 +1,5 @@
1
+ import { TTSConfig } from "@pulse-editor/shared-utils";
2
+ export default function useTTS(): {
3
+ runTTS: (text: string, ttsConfig?: TTSConfig) => Promise<Uint8Array>;
4
+ isReady: boolean;
5
+ };
@@ -0,0 +1,8 @@
1
+ import { VideoModelConfig } from "@pulse-editor/shared-utils";
2
+ export default function useVideoGen(): {
3
+ runVideoGen: (duration: number, textPrompt?: string, imagePrompt?: string | ArrayBuffer, videoModelConfig?: VideoModelConfig) => Promise<{
4
+ url?: string;
5
+ arrayBuffer?: ArrayBuffer;
6
+ }>;
7
+ isReady: boolean;
8
+ };
@@ -0,0 +1,4 @@
1
+ export default function useTerminal(): {
2
+ websocketUrl: string | undefined;
3
+ projectHomePath: string | undefined;
4
+ };
@@ -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(moduleName: string, handlerMap: ReceiverHandlerMap): {
3
+ export default function useIMC(handlerMap: ReceiverHandlerMap): {
4
4
  imc: InterModuleCommunication | undefined;
5
5
  isReady: boolean;
6
6
  };
package/dist/main.d.ts CHANGED
@@ -1,7 +1,17 @@
1
- import useFileView from "./hooks/use-file-view";
2
- import useTheme from "./hooks/use-theme";
3
- import useNotification from "./hooks/use-notification";
4
- import useAgents from "./hooks/use-agents";
5
- import useOCR from "./hooks/use-orc";
6
- import useTerminal from "./hooks/use-terminal";
7
- export { useFileView, useTheme, useNotification, useAgents, useOCR, useTerminal, };
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 useLoading from "./hooks/editor/use-loading";
6
+ import useNotification from "./hooks/editor/use-notification";
7
+ import useTheme from "./hooks/editor/use-theme";
8
+ import useToolbar from "./hooks/editor/use-toolbar";
9
+ import useExtCommand from "./hooks/extension/use-ext-command";
10
+ import useImageGen from "./hooks/modality/use-image-gen";
11
+ import useLLM from "./hooks/modality/use-llm";
12
+ import useOCR from "./hooks/modality/use-ocr";
13
+ import useSTT from "./hooks/modality/use-stt";
14
+ import useTTS from "./hooks/modality/use-tts";
15
+ import useVideoGen from "./hooks/modality/use-video-gen";
16
+ import useTerminal from "./hooks/terminal/use-terminal";
17
+ export { useAgentTools, useAgents, useFetch, useFileView, useNotification, useTheme, useToolbar, useImageGen, useVideoGen, useLLM, useOCR, useSTT, useTTS, useExtCommand, useTerminal, useLoading, };
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- export{default as useFileView}from"./hooks/use-file-view.js";export{default as useTheme}from"./hooks/use-theme.js";export{default as useNotification}from"./hooks/use-notification.js";export{default as useAgents}from"./hooks/use-agents.js";export{default as useOCR}from"./hooks/use-orc.js";export{default as useTerminal}from"./hooks/use-terminal.js";
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((()=>{!async function(){if(!d)return;if(void 0!==o)return;const t=new e;t.initThisWindow(window),t.updateReceiverHandlerMap(r),await 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=new Map,{imc:s,isReady:c}=r(a);return i((()=>{c&&s?.sendMessage(n.RequestViewFile).then((e=>{o(e)}))}),[c]),{viewModel:e,updateViewModel:function(e){s?.sendMessage(n.WriteViewFile,e)}}}function d(){const e=new Map,{imc:o,isReady:a}=r(e),[s,c]=t(!0);return i((()=>{a&&o?.sendMessage(n.UseLoading,{isLoading:s})}),[s]),{isReady:a,toggleLoading:function(e){c((n=>e))}}}function u(){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 f(){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 w(){return{}}function m(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(){const e=new Map,{imc:t,isReady:i}=r(e);return{runImageGen:async function(e,i,r){if(!t)throw new Error("IMC not initialized.");if(!e&&!i)throw new Error("At least one of textPrompt or imagePrompt is required.");return await t.sendMessage(n.UseImageGen,{textPrompt:e,imagePrompt:i,imageModelConfig:r}).then((e=>e))},isReady:i}}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 g(){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:t,isReady:i}=r(e);return{runVideoGen:async function(e,i,r,o){if(!t)throw new Error("IMC not initialized.");if(!i&&!r)throw new Error("At least one of textPrompt or imagePrompt is required.");return await t.sendMessage(n.UseVideoGen,{duration:e,textPrompt:i,imagePrompt:r,videoModelConfig:o}).then((e=>e))},isReady:i}}function R(){const e=new Map,{imc:o,isReady:a}=r(e),[s,c]=t(void 0),[d,u]=t(void 0);return i((()=>{a&&o?.sendMessage(n.RequestTerminal).then((e=>{const{websocketUrl:n,projectHomePath:t}=e;c(n),u(t)}))}),[a]),{websocketUrl:s,projectHomePath:d}}export{o as useAgentTools,a as useAgents,m as useExtCommand,s as useFetch,c as useFileView,p as useImageGen,M as useLLM,d as useLoading,u as useNotification,g as useOCR,l as useSTT,y as useTTS,R as useTerminal,f as useTheme,w as useToolbar,h as useVideoGen};
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "@pulse-editor/react-api",
3
- "version": "0.1.1-alpha.2",
3
+ "version": "0.1.1-alpha.21",
4
4
  "main": "dist/main.js",
5
- "type": "module",
6
5
  "files": [
7
6
  "dist"
8
7
  ],
9
8
  "publishConfig": {
10
9
  "access": "public"
11
10
  },
11
+ "types": "dist/main.d.ts",
12
+ "type": "module",
12
13
  "scripts": {
13
- "build": "rollup -c",
14
- "lint": "eslint ."
14
+ "build": "npm run clean && rollup -c",
15
+ "lint": "eslint .",
16
+ "clean": "rimraf dist"
15
17
  },
16
18
  "devDependencies": {
17
19
  "@babel/core": "^7.26.10",
@@ -29,13 +31,14 @@
29
31
  "npm": "^11.3.0",
30
32
  "react": "^19.1.0",
31
33
  "react-dom": "^19.1.0",
34
+ "rimraf": "^3.0.2",
32
35
  "rollup": "^4.40.0",
33
36
  "rollup-plugin-peer-deps-external": "^2.2.4",
34
37
  "typescript": "^5.8.3",
35
38
  "typescript-eslint": "^8.30.1"
36
39
  },
37
40
  "peerDependencies": {
38
- "@pulse-editor/shared-utils": "0.1.1-alpha.2",
41
+ "@pulse-editor/shared-utils": "0.1.1-alpha.21",
39
42
  "react": "^19.0.0",
40
43
  "react-dom": "^19.0.0"
41
44
  }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pulse-editor/shared-utils"),t=require("../lib/hooks/use-imc.js");exports.default=function(n){const r=new Map,{imc:s,isReady:a}=t.default(n,r);return{installAgent:async function(t){if(!s)throw new Error("IMC not initialized.");await s.sendMessage(e.IMCMessageTypeEnum.InstallAgent,t).catch((e=>{throw new Error(e)}))},runAgentMethod:async function(t,n,r,a){if(!s)throw new Error("IMC not initialized.");return await s.sendMessage(e.IMCMessageTypeEnum.RunAgentMethod,{agentName:t,methodName:n,parameters:r},a).then((e=>e))},isReady:a}};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pulse-editor/shared-utils"),s=require("react"),t=require("../lib/hooks/use-imc.js");exports.default=function(i){const[u,a]=s.useState(void 0),[r,d]=s.useState(!1),n=new Map,{imc:o,isReady:l}=t.default(i,n);return s.useEffect((()=>{l&&o?.sendMessage(e.IMCMessageTypeEnum.RequestViewFile).then((e=>{a(e)}))}),[l]),s.useEffect((()=>{r&&o?.sendMessage(e.IMCMessageTypeEnum.Loaded)}),[r,o]),{viewFile:u,updateViewFile:function(s){o?.sendMessage(e.IMCMessageTypeEnum.WriteViewFile,s)},setIsLoaded:d}};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pulse-editor/shared-utils"),t=require("../lib/hooks/use-imc.js");exports.default=function(i){const o=new Map,{imc:r}=t.default(i,o);return{openNotification:function(t,i){if(!r)throw new Error("IMC is not initialized.");r.sendMessage(e.IMCMessageTypeEnum.Notification,{text:t,type:i})}}};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pulse-editor/shared-utils"),r=require("../lib/hooks/use-imc.js");exports.default=function(t){const i=new Map,{imc:s}=r.default(t,i);return{recognizeText:async function(r){if(!s)throw new Error("IMC is not initialized.");return(await s.sendMessage(e.IMCMessageTypeEnum.OCR,{uri:r})).payload.text}}};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pulse-editor/shared-utils"),s=require("../lib/hooks/use-imc.js"),t=require("react");exports.default=function(r){const u=new Map,{imc:a,isReady:i}=s.default(r,u),[o,n]=t.useState(void 0);return t.useEffect((()=>{i&&a?.sendMessage(e.IMCMessageTypeEnum.RequestTerminal).then((s=>{const{websocketUrl:t}=s;n(t),a.sendMessage(e.IMCMessageTypeEnum.Loaded)}))}),[i]),{websocketUrl:o}};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pulse-editor/shared-utils"),t=require("react"),s=require("../lib/hooks/use-imc.js");exports.default=function(r){const[u,a]=t.useState("light"),i=new Map;return i.set(e.IMCMessageTypeEnum.ThemeChange,(async(e,t)=>{const s=t.payload;a((e=>s))})),s.default(r,i),{theme:u}};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pulse-editor/shared-utils"),t=require("react");exports.default=function(i,n){const[r,s]=t.useState(void 0),[u,o]=t.useState(!1),a=window.parent;return t.useEffect((()=>{const t=new e.InterModuleCommunication(i);return t.initThisWindow(window),t.updateReceiverHandlerMap(n),t.initOtherWindow(a),s(t),t.sendMessage(e.IMCMessageTypeEnum.Ready).then((()=>{o(!0)})),()=>{t.close()}}),[]),{imc:r,isReady:u}};
package/dist/cjs/main.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var e=require("./hooks/use-file-view.js"),s=require("./hooks/use-theme.js"),u=require("./hooks/use-notification.js"),o=require("./hooks/use-agents.js"),r=require("./hooks/use-orc.js"),t=require("./hooks/use-terminal.js");exports.useFileView=e.default,exports.useTheme=s.default,exports.useNotification=u.default,exports.useAgents=o.default,exports.useOCR=r.default,exports.useTerminal=t.default;
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import t from"../lib/hooks/use-imc.js";function n(n){const r=new Map,{imc:i,isReady:a}=t(n,r);return{installAgent:async function(t){if(!i)throw new Error("IMC not initialized.");await i.sendMessage(e.InstallAgent,t).catch((e=>{throw new Error(e)}))},runAgentMethod:async function(t,n,r,a){if(!i)throw new Error("IMC not initialized.");return await i.sendMessage(e.RunAgentMethod,{agentName:t,methodName:n,parameters:r},a).then((e=>e))},isReady:a}}export{n as default};
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import{useState as i,useEffect as s}from"react";import t from"../lib/hooks/use-imc.js";function o(o){const[d,r]=i(void 0),[a,n]=i(!1),u=new Map,{imc:l,isReady:m}=t(o,u);return s((()=>{m&&l?.sendMessage(e.RequestViewFile).then((e=>{r(e)}))}),[m]),s((()=>{a&&l?.sendMessage(e.Loaded)}),[a,l]),{viewFile:d,updateViewFile:function(i){l?.sendMessage(e.WriteViewFile,i)},setIsLoaded:n}}export{o as default};
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as i}from"@pulse-editor/shared-utils";import t from"../lib/hooks/use-imc.js";function o(o){const e=new Map,{imc:n}=t(o,e);return{openNotification:function(t,o){if(!n)throw new Error("IMC is not initialized.");n.sendMessage(i.Notification,{text:t,type:o})}}}export{o as default};
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import i from"../lib/hooks/use-imc.js";function t(t){const r=new Map,{imc:o}=i(t,r);return{recognizeText:async function(i){if(!o)throw new Error("IMC is not initialized.");return(await o.sendMessage(e.OCR,{uri:i})).payload.text}}}export{t as default};
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import s from"../lib/hooks/use-imc.js";import{useState as o,useEffect as t}from"react";function r(r){const i=new Map,{imc:a,isReady:n}=s(r,i),[d,m]=o(void 0);return t((()=>{n&&a?.sendMessage(e.RequestTerminal).then((s=>{const{websocketUrl:o}=s;m(o),a.sendMessage(e.Loaded)}))}),[n]),{websocketUrl:d}}export{r as default};
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import{useState as t}from"react";import o from"../lib/hooks/use-imc.js";function r(r){const[s,a]=t("light"),i=new Map;return i.set(e.ThemeChange,(async(e,t)=>{const o=t.payload;a((e=>o))})),o(r,i),{theme:s}}export{r as default};
@@ -1 +0,0 @@
1
- import{InterModuleCommunication as e,IMCMessageTypeEnum as i}from"@pulse-editor/shared-utils";import{useState as t,useEffect as n}from"react";function r(r,o){const[d,s]=t(void 0),[a,c]=t(!1),p=window.parent;return n((()=>{const t=new e(r);return t.initThisWindow(window),t.updateReceiverHandlerMap(o),t.initOtherWindow(p),s(t),t.sendMessage(i.Ready).then((()=>{c(!0)})),()=>{t.close()}}),[]),{imc:d,isReady:a}}export{r as default};
package/dist/esm/main.js DELETED
@@ -1 +0,0 @@
1
- export{default as useFileView}from"./hooks/use-file-view.js";export{default as useTheme}from"./hooks/use-theme.js";export{default as useNotification}from"./hooks/use-notification.js";export{default as useAgents}from"./hooks/use-agents.js";export{default as useOCR}from"./hooks/use-orc.js";export{default as useTerminal}from"./hooks/use-terminal.js";
@@ -1,4 +0,0 @@
1
- import { AgentTool } from "@pulse-editor/shared-utils";
2
- export default function useAgentTools(moduleName: string): {
3
- installAgentTool: (tool: AgentTool) => Promise<void>;
4
- };
@@ -1,6 +0,0 @@
1
- import { Agent } from "@pulse-editor/shared-utils";
2
- export default function useAgents(moduleName: string): {
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 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import t from"../lib/hooks/use-imc.js";function n(n){const r=new Map,{imc:i,isReady:a}=t(n,r);return{installAgent:async function(t){if(!i)throw new Error("IMC not initialized.");await i.sendMessage(e.InstallAgent,t).catch((e=>{throw new Error(e)}))},runAgentMethod:async function(t,n,r,a){if(!i)throw new Error("IMC not initialized.");return await i.sendMessage(e.RunAgentMethod,{agentName:t,methodName:n,parameters:r},a).then((e=>e))},isReady:a}}export{n as default};
@@ -1,6 +0,0 @@
1
- import { FileViewModel } from "@pulse-editor/shared-utils";
2
- export default function useFileView(moduleName: string): {
3
- viewFile: FileViewModel | undefined;
4
- updateViewFile: (file: FileViewModel) => void;
5
- setIsLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
6
- };
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import{useState as i,useEffect as s}from"react";import t from"../lib/hooks/use-imc.js";function o(o){const[d,r]=i(void 0),[a,n]=i(!1),u=new Map,{imc:l,isReady:m}=t(o,u);return s((()=>{m&&l?.sendMessage(e.RequestViewFile).then((e=>{r(e)}))}),[m]),s((()=>{a&&l?.sendMessage(e.Loaded)}),[a,l]),{viewFile:d,updateViewFile:function(i){l?.sendMessage(e.WriteViewFile,i)},setIsLoaded:n}}export{o as default};
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as i}from"@pulse-editor/shared-utils";import t from"../lib/hooks/use-imc.js";function o(o){const e=new Map,{imc:n}=t(o,e);return{openNotification:function(t,o){if(!n)throw new Error("IMC is not initialized.");n.sendMessage(i.Notification,{text:t,type:o})}}}export{o as default};
@@ -1,3 +0,0 @@
1
- export default function useOCR(moduleName: string): {
2
- recognizeText: (uri: string) => Promise<string>;
3
- };
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import i from"../lib/hooks/use-imc.js";function t(t){const r=new Map,{imc:o}=i(t,r);return{recognizeText:async function(i){if(!o)throw new Error("IMC is not initialized.");return(await o.sendMessage(e.OCR,{uri:i})).payload.text}}}export{t as default};
@@ -1,3 +0,0 @@
1
- export default function useTerminal(moduleName: string): {
2
- websocketUrl: string | undefined;
3
- };
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import s from"../lib/hooks/use-imc.js";import{useState as o,useEffect as t}from"react";function r(r){const i=new Map,{imc:a,isReady:n}=s(r,i),[d,m]=o(void 0);return t((()=>{n&&a?.sendMessage(e.RequestTerminal).then((s=>{const{websocketUrl:o}=s;m(o),a.sendMessage(e.Loaded)}))}),[n]),{websocketUrl:d}}export{r as default};
@@ -1,3 +0,0 @@
1
- export default function useTheme(moduleName: string): {
2
- theme: string;
3
- };
@@ -1 +0,0 @@
1
- import{IMCMessageTypeEnum as e}from"@pulse-editor/shared-utils";import{useState as t}from"react";import o from"../lib/hooks/use-imc.js";function r(r){const[s,a]=t("light"),i=new Map;return i.set(e.ThemeChange,(async(e,t)=>{const o=t.payload;a((e=>o))})),o(r,i),{theme:s}}export{r as default};
@@ -1 +0,0 @@
1
- import{InterModuleCommunication as e,IMCMessageTypeEnum as i}from"@pulse-editor/shared-utils";import{useState as t,useEffect as n}from"react";function r(r,o){const[d,s]=t(void 0),[a,c]=t(!1),p=window.parent;return n((()=>{const t=new e(r);return t.initThisWindow(window),t.updateReceiverHandlerMap(o),t.initOtherWindow(p),s(t),t.sendMessage(i.Ready).then((()=>{c(!0)})),()=>{t.close()}}),[]),{imc:d,isReady:a}}export{r as default};
package/dist/main.es.js DELETED
@@ -1 +0,0 @@
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,s){const[a,r]=t(void 0),[d,c]=t(!1),w=window.parent;return i((()=>{const t=new e(o);return t.initThisWindow(window),t.updateReceiverHandlerMap(s),t.initOtherWindow(w),r(t),t.sendMessage(n.Ready).then((()=>{c(!0)})),()=>{t.close()}}),[]),{imc:a,isReady:d}}function s(e){const[s,a]=t(void 0),[r,d]=t(!1),c=new Map,{imc:w,isReady:u}=o(e,c);return i((()=>{u&&w?.sendMessage(n.RequestViewFile).then((e=>{a(e)}))}),[u]),i((()=>{r&&w?.sendMessage(n.Loaded)}),[r,w]),{viewFile:s,updateViewFile:function(e){w?.sendMessage(n.WriteViewFile,e)},setIsLoaded:d}}function a(e){const[i,s]=t("light"),a=new Map;return a.set(n.ThemeChange,(async(e,n)=>{const t=n.payload;s((e=>t))})),o(e,a),{theme:i}}function r(e){const t=new Map,{imc:i}=o(e,t);return{openNotification:function(e,t){if(!i)throw new Error("IMC is not initialized.");i.sendMessage(n.Notification,{text:e,type:t})}}}function d(e){const t=new Map,{imc:i,isReady:s}=o(e,t);return{installAgent:async function(e){if(!i)throw new Error("IMC not initialized.");await i.sendMessage(n.InstallAgent,e).catch((e=>{throw new Error(e)}))},runAgentMethod:async function(e,t,o,s){if(!i)throw new Error("IMC not initialized.");return await i.sendMessage(n.RunAgentMethod,{agentName:e,methodName:t,parameters:o},s).then((e=>e))},isReady:s}}function c(e){const t=new Map,{imc:i}=o(e,t);return{recognizeText:async function(e){if(!i)throw new Error("IMC is not initialized.");return(await i.sendMessage(n.OCR,{uri:e})).payload.text}}}function w(e){const s=new Map,{imc:a,isReady:r}=o(e,s),[d,c]=t(void 0);return i((()=>{r&&a?.sendMessage(n.RequestTerminal).then((e=>{const{websocketUrl:t}=e;c(t),a.sendMessage(n.Loaded)}))}),[r]),{websocketUrl:d}}export{d as useAgents,s as useFileView,r as useNotification,c as useOCR,w as useTerminal,a as useTheme};