@pmate/chat-sdk 0.1.20 → 0.2.0
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/lib/components/ChatInputDesktop.js +11 -6
- package/lib/components/ChatInputMobile.js +4 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/services/{agentSdkASRClient.d.ts → functionASRClient.d.ts} +7 -7
- package/lib/services/{agentSdkASRClient.js → functionASRClient.js} +2 -2
- package/lib/types/chatInput.d.ts +1 -0
- package/package.json +18 -16
- package/dist/assets/ChatInput.stories-pjQKncGw.js +0 -1644
- package/dist/assets/Color-AVL7NMMY-CKkkQz33.js +0 -1
- package/dist/assets/DocsRenderer-PQXLIZUC-CVx0v9rK.js +0 -1243
- package/dist/assets/client-CMlGEQEC.js +0 -9
- package/dist/assets/iframe-4FbYaDjf.css +0 -1
- package/dist/assets/iframe-Bo_J3UyC.js +0 -1071
- package/dist/assets/index-D9myAQ7a.js +0 -1
- package/dist/assets/preload-helper-PPVm8Dsz.js +0 -1
- package/dist/assets/react-18-CVKdgGic.js +0 -1
- package/dist/favicon-wrapper.svg +0 -46
- package/dist/favicon.svg +0 -1
- package/dist/iframe.html +0 -687
- package/dist/index.html +0 -148
- package/dist/index.json +0 -1
- package/dist/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/nunito-sans-bold.woff2 +0 -0
- package/dist/nunito-sans-italic.woff2 +0 -0
- package/dist/nunito-sans-regular.woff2 +0 -0
- package/dist/project.json +0 -1
- package/dist/sb-addons/docs-1/manager-bundle.js +0 -151
- package/dist/sb-addons/docs-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -971
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/favicon-wrapper.svg +0 -46
- package/dist/sb-common-assets/favicon.svg +0 -1
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/globals-module-info.js +0 -799
- package/dist/sb-manager/globals-runtime.js +0 -69791
- package/dist/sb-manager/globals.js +0 -34
- package/dist/sb-manager/runtime.js +0 -13198
- package/dist/vite-inject-mocker-entry.js +0 -2
- package/lib/recorder-processor.js +0 -20
- package/lib/stories/ChatInput.stories.d.ts +0 -15
- package/lib/stories/ChatInput.stories.js +0 -38
- package/lib/tests/agentSdkASRClient.test.d.ts +0 -1
- package/lib/tests/agentSdkASRClient.test.js +0 -39
- package/lib/tests/defaultTokens.test.d.ts +0 -1
- package/lib/tests/defaultTokens.test.js +0 -16
- package/lib/tests/transcriptComposer.test.d.ts +0 -1
- package/lib/tests/transcriptComposer.test.js +0 -10
|
@@ -213,11 +213,14 @@ function DesktopInner(props) {
|
|
|
213
213
|
flexDirection: "column",
|
|
214
214
|
gap: 12,
|
|
215
215
|
}, children: [_jsx(TextComposer, { ref: textComposerRef, tokens: tokens, value: state.text, rows: 3, placeholder: "Message PMate", onPaste: handlePaste, onDrop: props.onDrop, onKeyDown: (event) => {
|
|
216
|
-
if (event.key
|
|
217
|
-
event.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
if (event.key !== "Enter" ||
|
|
217
|
+
event.shiftKey ||
|
|
218
|
+
event.nativeEvent.isComposing ||
|
|
219
|
+
event.keyCode === 229)
|
|
220
|
+
return;
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
if (state.text.trim() || state.attachments.length > 0)
|
|
223
|
+
void onSend();
|
|
221
224
|
}, onChange: (event) => {
|
|
222
225
|
state.setText(event.target.value);
|
|
223
226
|
state.setStatus(event.target.value.trim() ? "typing" : "idle");
|
|
@@ -280,7 +283,9 @@ function DesktopInner(props) {
|
|
|
280
283
|
display: "flex",
|
|
281
284
|
alignItems: "center",
|
|
282
285
|
}, children: _jsx(TextComposer, { ref: textComposerRef, tokens: tokens, value: state.text, rows: 1, placeholder: "Message PMate", onPaste: handlePaste, onDrop: props.onDrop, onKeyDown: (event) => {
|
|
283
|
-
if (event.key !== "Enter"
|
|
286
|
+
if (event.key !== "Enter" ||
|
|
287
|
+
event.nativeEvent.isComposing ||
|
|
288
|
+
event.keyCode === 229) {
|
|
284
289
|
return;
|
|
285
290
|
}
|
|
286
291
|
const shouldSend = props.submitShortcut === "meta-enter" ? event.metaKey || event.ctrlKey : !event.shiftKey;
|
|
@@ -553,7 +553,10 @@ function MobileInner(props) {
|
|
|
553
553
|
setRecordingChoice("send");
|
|
554
554
|
voice.cancelRecording();
|
|
555
555
|
} }) })) : (_jsx(TextComposer, { ref: textComposerRef, tokens: tokens, value: state.text, rows: 1, wrap: "off", placeholder: "Message", enterKeyHint: "send", onPaste: handlePaste, onDrop: props.onDrop, onKeyDown: (event) => {
|
|
556
|
-
if (event.key === "Enter" &&
|
|
556
|
+
if (event.key === "Enter" &&
|
|
557
|
+
!event.shiftKey &&
|
|
558
|
+
!event.nativeEvent.isComposing &&
|
|
559
|
+
event.keyCode !== 229) {
|
|
557
560
|
event.preventDefault();
|
|
558
561
|
if (state.text.trim()) {
|
|
559
562
|
void onSend();
|
package/lib/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from "./hooks/useAttachmentState";
|
|
|
14
14
|
export * from "./hooks/useChatInputState";
|
|
15
15
|
export * from "./hooks/useTranscriptComposer";
|
|
16
16
|
export * from "./hooks/useVoiceInputController";
|
|
17
|
-
export * from "./services/
|
|
17
|
+
export * from "./services/functionASRClient";
|
|
18
18
|
export * from "./services/authTokenResolver";
|
|
19
19
|
export * from "./runtime/botAuth";
|
|
20
20
|
export * from "./runtime/botKey";
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export * from "./hooks/useAttachmentState";
|
|
|
14
14
|
export * from "./hooks/useChatInputState";
|
|
15
15
|
export * from "./hooks/useTranscriptComposer";
|
|
16
16
|
export * from "./hooks/useVoiceInputController";
|
|
17
|
-
export * from "./services/
|
|
17
|
+
export * from "./services/functionASRClient";
|
|
18
18
|
export * from "./services/authTokenResolver";
|
|
19
19
|
export * from "./runtime/botAuth";
|
|
20
20
|
export * from "./runtime/botKey";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncStream } from "./AsyncStream";
|
|
2
|
-
export type
|
|
2
|
+
export type FunctionStreamLike = {
|
|
3
3
|
stream<TFinal = unknown, TChunk = Blob>(request: {
|
|
4
|
-
|
|
4
|
+
functionId: string;
|
|
5
5
|
stream: AsyncStream<TChunk>;
|
|
6
6
|
params?: Record<string, unknown>;
|
|
7
7
|
minChunkSizeBytes?: number;
|
|
@@ -9,17 +9,17 @@ export type AgentSdkStreamLike = {
|
|
|
9
9
|
finish(): Promise<TFinal | null>;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
13
|
-
client:
|
|
14
|
-
|
|
12
|
+
export type FunctionASRClientOptions = {
|
|
13
|
+
client: FunctionStreamLike;
|
|
14
|
+
functionId: string;
|
|
15
15
|
tokenResolver?: {
|
|
16
16
|
getToken(): string;
|
|
17
17
|
};
|
|
18
18
|
minChunkSizeBytes?: number;
|
|
19
19
|
};
|
|
20
|
-
export declare class
|
|
20
|
+
export declare class FunctionASRClient {
|
|
21
21
|
private readonly options;
|
|
22
|
-
constructor(options:
|
|
22
|
+
constructor(options: FunctionASRClientOptions);
|
|
23
23
|
transcribe(blob: Blob, input?: {
|
|
24
24
|
lang?: string;
|
|
25
25
|
}): Promise<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncStream } from "./AsyncStream";
|
|
2
|
-
export class
|
|
2
|
+
export class FunctionASRClient {
|
|
3
3
|
options;
|
|
4
4
|
constructor(options) {
|
|
5
5
|
this.options = options;
|
|
@@ -8,7 +8,7 @@ export class AgentSdkASRClient {
|
|
|
8
8
|
const token = this.options.tokenResolver?.getToken() ?? "";
|
|
9
9
|
const stream = new AsyncStream();
|
|
10
10
|
const task = this.options.client.stream({
|
|
11
|
-
|
|
11
|
+
functionId: this.options.functionId,
|
|
12
12
|
stream,
|
|
13
13
|
params: {
|
|
14
14
|
lang: input?.lang ?? "auto",
|
package/lib/types/chatInput.d.ts
CHANGED
|
@@ -141,5 +141,6 @@ export type ChatInputMobileProps = ChatInputBaseProps & {
|
|
|
141
141
|
voiceModeDefault?: ChatInputMode;
|
|
142
142
|
};
|
|
143
143
|
export type ChatInputDesktopProps = ChatInputBaseProps & {
|
|
144
|
+
/** Defaults to Enter to send and Shift+Enter to insert a newline. */
|
|
144
145
|
submitShortcut?: "enter" | "meta-enter";
|
|
145
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pmate/chat-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Cross-platform PMate chat input components, voice input primitives, and ASR helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -29,10 +29,18 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "rimraf lib",
|
|
34
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json && cp src/voice/recorder-processor.js lib/voice/recorder-processor.js",
|
|
35
|
+
"prepack": "pnpm run build",
|
|
36
|
+
"npm:publish": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"storybook": "storybook dev -p 6009",
|
|
39
|
+
"build-storybook": "storybook build --output-dir dist"
|
|
40
|
+
},
|
|
32
41
|
"dependencies": {
|
|
33
42
|
"@emoji-mart/data": "^1.2.1",
|
|
34
43
|
"@emoji-mart/react": "^1.1.1",
|
|
35
|
-
"@pmate/agent-sdk": "^1.1.2",
|
|
36
44
|
"@msgpack/msgpack": "^3.1.2",
|
|
37
45
|
"jotai": "^2.16.1"
|
|
38
46
|
},
|
|
@@ -43,21 +51,15 @@
|
|
|
43
51
|
"devDependencies": {
|
|
44
52
|
"@storybook/addon-docs": "^9.0.17",
|
|
45
53
|
"@storybook/react-vite": "9.0.17",
|
|
46
|
-
"@tailwindcss/vite": "
|
|
47
|
-
"@types/react": "
|
|
48
|
-
"@types/react-dom": "
|
|
49
|
-
"react": "
|
|
50
|
-
"react-dom": "
|
|
54
|
+
"@tailwindcss/vite": "catalog:",
|
|
55
|
+
"@types/react": "catalog:",
|
|
56
|
+
"@types/react-dom": "catalog:",
|
|
57
|
+
"react": "catalog:",
|
|
58
|
+
"react-dom": "catalog:",
|
|
59
|
+
"rimraf": "^6.1.2",
|
|
51
60
|
"storybook": "^9.0.17",
|
|
52
|
-
"tailwindcss": "
|
|
61
|
+
"tailwindcss": "catalog:",
|
|
53
62
|
"typescript": "5.9.2",
|
|
54
63
|
"vitest": "^4.0.17"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"build": "tsc -p tsconfig.build.json && cp src/voice/recorder-processor.js lib/voice/recorder-processor.js",
|
|
58
|
-
"npm:publish": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
|
|
59
|
-
"test": "vitest run",
|
|
60
|
-
"storybook": "storybook dev -p 6009",
|
|
61
|
-
"build-storybook": "storybook build --output-dir dist"
|
|
62
64
|
}
|
|
63
|
-
}
|
|
65
|
+
}
|