Skip to content

Commit 6585eb0

Browse files
authored
Merge pull request #60 from ClayPulse/add-canvas
Update canvas, menu commands, command viewer, managed cloud agents in command viewer (text-to-text)
2 parents 420923e + b82fe5b commit 6585eb0

File tree

77 files changed

+5875
-3618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5875
-3618
lines changed

.changeset/fluffy-poems-cover.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pulse-editor/shared-utils": patch
3+
"@pulse-editor/react-api": patch
4+
---
5+
6+
Update commands

.changeset/full-beans-stop.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pulse-editor/shared-utils": patch
3+
"@pulse-editor/react-api": patch
4+
---
5+
6+
Add IMC receiver error handling

.changeset/petite-memes-fix.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pulse-editor/shared-utils": patch
3+
"@pulse-editor/react-api": patch
4+
---
5+
6+
Update agent object format

.changeset/pre.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
"dirty-swans-rescue",
2525
"early-pumas-listen",
2626
"few-wasps-beam",
27+
"fluffy-poems-cover",
2728
"fruity-goats-look",
29+
"full-beans-stop",
2830
"hot-symbols-fry",
2931
"large-moose-tap",
3032
"lazy-zebras-mate",
3133
"mighty-ghosts-crash",
34+
"petite-memes-fix",
3235
"polite-lines-dance",
3336
"polite-worms-fix",
3437
"real-knives-rest",
@@ -39,6 +42,7 @@
3942
"social-donkeys-cross",
4043
"stale-groups-poke",
4144
"tender-jeans-occur",
45+
"true-suits-fly",
4246
"wicked-spoons-fry"
4347
]
4448
}

.changeset/true-suits-fly.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pulse-editor/shared-utils": patch
3+
"@pulse-editor/react-api": patch
4+
---
5+
6+
Update useCommand callbacks

npm-packages/react-api/CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# @pulse-editor/react-api
22

3+
## 0.1.1-alpha.30
4+
5+
### Patch Changes
6+
7+
- Update agent object format
8+
- Updated dependencies
9+
- @pulse-editor/shared-utils@0.1.1-alpha.30
10+
11+
## 0.1.1-alpha.29
12+
13+
### Patch Changes
14+
15+
- Update useCommand callbacks
16+
- Updated dependencies
17+
- @pulse-editor/shared-utils@0.1.1-alpha.29
18+
19+
## 0.1.1-alpha.28
20+
21+
### Patch Changes
22+
23+
- Add IMC receiver error handling
24+
- Updated dependencies
25+
- @pulse-editor/shared-utils@0.1.1-alpha.28
26+
27+
## 0.1.1-alpha.27
28+
29+
### Patch Changes
30+
31+
- Update commands
32+
- Updated dependencies
33+
- @pulse-editor/shared-utils@0.1.1-alpha.27
34+
335
## 0.1.1-alpha.26
436

537
### Patch Changes

npm-packages/react-api/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pulse-editor/react-api",
3-
"version": "0.1.1-alpha.26",
3+
"version": "0.1.1-alpha.30",
44
"main": "dist/main.js",
55
"files": [
66
"dist"
@@ -38,7 +38,7 @@
3838
"typescript-eslint": "^8.30.1"
3939
},
4040
"peerDependencies": {
41-
"@pulse-editor/shared-utils": "0.1.1-alpha.26",
41+
"@pulse-editor/shared-utils": "0.1.1-alpha.30",
4242
"react": "^19.0.0",
4343
"react-dom": "^19.0.0"
4444
}

npm-packages/react-api/src/hooks/extension/use-ext-command.ts renamed to npm-packages/react-api/src/hooks/editor/use-command.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
ExtensionCommandInfo,
2+
CommandInfo,
33
IMCMessage,
44
IMCMessageTypeEnum,
55
ReceiverHandler,
@@ -10,20 +10,20 @@ import { useEffect, useState } from "react";
1010
/**
1111
* Register an extension command to listen to IMC messages from the core,
1212
* and pass to the extension to handle.
13+
*
14+
* @param commandInfo Command information to register.
15+
* @param callbackHandler Callback handler function to handle the command.
16+
*
1317
*/
14-
export default function useExtCommand(
15-
commandInfo: ExtensionCommandInfo,
16-
initialHandler?: (args: any) => Promise<string | void>
18+
export default function useCommand(
19+
commandInfo: CommandInfo,
20+
callbackHandler?: (args: any) => Promise<string | void>
1721
) {
1822
const { isReady, imc } = useIMC(getReceiverHandlerMap());
1923

2024
const [handler, setHandler] = useState<
21-
((args: any) => Promise<string | void>) | undefined
22-
>(initialHandler);
23-
24-
useEffect(() => {
25-
imc?.updateReceiverHandlerMap(getReceiverHandlerMap());
26-
}, [handler, imc]);
25+
((args: any) => Promise<any>) | undefined
26+
>(undefined);
2727

2828
function getReceiverHandlerMap() {
2929
const receiverHandlerMap = new Map<IMCMessageTypeEnum, ReceiverHandler>([
@@ -81,17 +81,15 @@ export default function useExtCommand(
8181
return receiverHandlerMap;
8282
}
8383

84-
/**
85-
*
86-
* @param handler Function to handle the command. Return a string in the handler to let
87-
* Pulse Editor assistant to read it out.
88-
*/
89-
function updateHandler(handler: (args: any) => Promise<string | void>) {
90-
setHandler(() => handler);
91-
}
84+
useEffect(() => {
85+
imc?.updateReceiverHandlerMap(getReceiverHandlerMap());
86+
}, [handler, imc]);
87+
88+
useEffect(() => {
89+
setHandler(() => callbackHandler);
90+
}, [callbackHandler]);
9291

9392
return {
9493
isReady,
95-
updateHandler,
9694
};
9795
}

npm-packages/react-api/src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import useLoading from "./hooks/editor/use-loading";
55
import useNotification from "./hooks/editor/use-notification";
66
import useTheme from "./hooks/editor/use-theme";
77
import useToolbar from "./hooks/editor/use-toolbar";
8-
import useExtCommand from "./hooks/extension/use-ext-command";
8+
import useCommand from "./hooks/editor/use-command";
99

1010
import useImageGen from "./hooks/ai-modality/use-image-gen";
1111
import useLLM from "./hooks/ai-modality/use-llm";
@@ -28,7 +28,7 @@ export {
2828
useOCR,
2929
useSTT,
3030
useTTS,
31-
useExtCommand,
31+
useCommand,
3232
useTerminal,
3333
useLoading,
3434
};

npm-packages/shared-utils/CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# @pulse-editor/shared-utils
22

3+
## 0.1.1-alpha.30
4+
5+
### Patch Changes
6+
7+
- Update agent object format
8+
9+
## 0.1.1-alpha.29
10+
11+
### Patch Changes
12+
13+
- Update useCommand callbacks
14+
15+
## 0.1.1-alpha.28
16+
17+
### Patch Changes
18+
19+
- Add IMC receiver error handling
20+
21+
## 0.1.1-alpha.27
22+
23+
### Patch Changes
24+
25+
- Update commands
26+
327
## 0.1.1-alpha.26
428

529
### Patch Changes

0 commit comments

Comments
 (0)