@pulse-editor/react-api 0.1.1-alpha.8 → 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/main.d.ts CHANGED
@@ -11,4 +11,5 @@ import useLLM from "./hooks/modality/use-llm";
11
11
  import useOCR from "./hooks/modality/use-ocr";
12
12
  import useSTT from "./hooks/modality/use-stt";
13
13
  import useTTS from "./hooks/modality/use-tts";
14
- export { useAgentTools, useAgents, useFetch, useFileView, useNotification, useTheme, useToolbar, useDiffusion, useLLM, useOCR, useSTT, useTTS, useExtCommand, };
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 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}}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,u as useTheme,f as useToolbar};
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.8",
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.8",
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
  }