@origonai/web-sdk 0.1.1 → 0.1.2
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/README.md +10 -7
- package/dist/index.d.ts +4 -4
- package/dist/origon-web-sdk.js +616 -575
- package/dist/origon-web-sdk.js.map +1 -1
- package/docs/contract.md +20 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ client.setCallbacks({
|
|
|
41
41
|
|
|
42
42
|
const { sessionId } = await client.startSession({ channel: 'chat' })
|
|
43
43
|
|
|
44
|
-
await client.sendMessage(sessionId, { text: 'Hello!' }) //
|
|
44
|
+
await client.sendMessage(sessionId, { text: 'Hello!' }) // participant server defaults audience to all
|
|
45
45
|
|
|
46
46
|
client.notifyTyping(sessionId) // call on each keystroke; SDK debounces
|
|
47
47
|
|
|
@@ -68,8 +68,8 @@ await client.endSession(sessionId)
|
|
|
68
68
|
- `getSession(sessionId)` — GET `/session/{id}` (transcript + control)
|
|
69
69
|
|
|
70
70
|
### Chat
|
|
71
|
-
- `sendMessage(sessionId, payload)` — post a message with optional `metadata: {audience}`; ordinary sends
|
|
72
|
-
- `notifyTyping(sessionId, metadata?)` — call on each keystroke; ordinary typing
|
|
71
|
+
- `sendMessage(sessionId, payload)` — post a message with optional `metadata: {audience}`; ordinary participant sends omit it and the server resolves the audience to `all`. The SDK fires `onMessageAdded` immediately with `status: 'sending'`, then `onMessageUpdated` with `'delivered'` or `'failed'` after the server acks
|
|
72
|
+
- `notifyTyping(sessionId, metadata?)` — call on each keystroke; ordinary participant typing omits metadata, and the SDK debounces (3s window) and emits typing on/off automatically
|
|
73
73
|
- `stopTyping(sessionId)` — flush typing-off immediately
|
|
74
74
|
|
|
75
75
|
### Attachments
|
|
@@ -130,10 +130,13 @@ consumer can host multiple sessions.
|
|
|
130
130
|
The outbound `payload.role` is a local-only hint for the provisional
|
|
131
131
|
`onMessageAdded` row; it's stripped before POST.
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
Message metadata is optional at both levels:
|
|
134
|
+
`metadata?: { audience?: 'internal' | 'all' }`. Missing/null containers remain
|
|
135
|
+
absent, while an explicitly present empty object remains `{}`; unknown
|
|
136
|
+
non-empty audiences are protocol failures. A
|
|
137
|
+
monitor client must always send an explicit known audience even though the
|
|
138
|
+
shared SDK type is optional. Typing callbacks retain required audience plus
|
|
139
|
+
participant identity; watchdogs are isolated by `participantId`.
|
|
137
140
|
|
|
138
141
|
## Errors
|
|
139
142
|
|
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare interface AudioWorkletStats {
|
|
|
39
39
|
|
|
40
40
|
export declare type Channel = 'chat' | 'voice';
|
|
41
41
|
|
|
42
|
-
/**
|
|
42
|
+
/** Closed audience vocabulary; the field holding it may be absent. */
|
|
43
43
|
export declare type ChatAudience = 'internal' | 'all';
|
|
44
44
|
|
|
45
45
|
export declare class ClientError extends Error {
|
|
@@ -189,7 +189,7 @@ export declare interface Message {
|
|
|
189
189
|
errorText?: string;
|
|
190
190
|
status: MessageStatus;
|
|
191
191
|
state: MessageState;
|
|
192
|
-
metadata
|
|
192
|
+
metadata?: MessageMetadata;
|
|
193
193
|
/**
|
|
194
194
|
* Lifecycle action for a `role:'system'` message — `'queued' | 'joined' |
|
|
195
195
|
* 'ended'` (kept an open `string`: the server may add more; a distinct
|
|
@@ -244,7 +244,7 @@ export declare interface MessageCard {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
export declare interface MessageMetadata {
|
|
247
|
-
audience
|
|
247
|
+
audience?: ChatAudience;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
export declare type MessageRole = 'ai' | 'external' | 'user' | 'system';
|
|
@@ -358,7 +358,7 @@ export declare interface SendMessagePayload {
|
|
|
358
358
|
text?: string;
|
|
359
359
|
html?: string;
|
|
360
360
|
attachments?: Attachment[];
|
|
361
|
-
/**
|
|
361
|
+
/** Optional for participant callers; monitor callers must supply an audience. */
|
|
362
362
|
metadata?: MessageMetadata;
|
|
363
363
|
/**
|
|
364
364
|
* Local-only hint for the provisional `onMessageAdded` role. Defaults to
|