@convai/web-sdk 1.8.0-beta.7 → 1.8.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/README.md +44 -194
- package/dist/core/ConvaiClient.d.ts +1 -190
- package/dist/core/ConvaiClient.d.ts.map +1 -1
- package/dist/core/ConvaiClient.js +286 -1306
- package/dist/core/ConvaiClient.js.map +1 -1
- package/dist/core/MessageHandler.d.ts +1 -19
- package/dist/core/MessageHandler.d.ts.map +1 -1
- package/dist/core/MessageHandler.js +27 -378
- package/dist/core/MessageHandler.js.map +1 -1
- package/dist/core/connectRequest.d.ts +4 -17
- package/dist/core/connectRequest.d.ts.map +1 -1
- package/dist/core/connectRequest.js +17 -28
- package/dist/core/connectRequest.js.map +1 -1
- package/dist/core/index.d.ts +1 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -7
- package/dist/core/index.js.map +1 -1
- package/dist/core/logicalTurn.d.ts +6 -4
- package/dist/core/logicalTurn.d.ts.map +1 -1
- package/dist/core/logicalTurn.js +4 -29
- package/dist/core/logicalTurn.js.map +1 -1
- package/dist/core/modelOutput.d.ts.map +1 -1
- package/dist/core/modelOutput.js +2 -2
- package/dist/core/modelOutput.js.map +1 -1
- package/dist/core/types.d.ts +22 -860
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/embed/chat-embed-v1.js +9 -10
- package/dist/embed/chat-embed-v1.js.map +4 -4
- package/dist/react/components/ConvaiWidget.d.ts.map +1 -1
- package/dist/react/components/ConvaiWidget.js +1 -6
- package/dist/react/components/ConvaiWidget.js.map +1 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js +1 -28
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +44 -39
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +49 -93
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +1 -1
- package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
- package/dist/react/hooks/useConvaiClient.js +2 -17
- package/dist/react/hooks/useConvaiClient.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/vanilla/AudioRenderer.d.ts +1 -3
- package/dist/vanilla/AudioRenderer.d.ts.map +1 -1
- package/dist/vanilla/AudioRenderer.js +2 -8
- package/dist/vanilla/AudioRenderer.js.map +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.js +300 -994
- package/dist/vanilla/ConvaiWidget.js.map +1 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts +1 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +1 -1
- package/dist/vanilla/WidgetEventSubscriptions.js +0 -5
- package/dist/vanilla/WidgetEventSubscriptions.js.map +1 -1
- package/dist/vanilla/icons.d.ts.map +1 -1
- package/dist/vanilla/icons.js +15 -62
- package/dist/vanilla/icons.js.map +1 -1
- package/dist/vanilla/index.d.ts +2 -4
- package/dist/vanilla/index.d.ts.map +1 -1
- package/dist/vanilla/index.js +1 -3
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vanilla/styles.d.ts +1 -18
- package/dist/vanilla/styles.d.ts.map +1 -1
- package/dist/vanilla/styles.js +29 -129
- package/dist/vanilla/styles.js.map +1 -1
- package/dist/vanilla/types.d.ts +0 -74
- package/dist/vanilla/types.d.ts.map +1 -1
- package/dist/vanilla/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +8 -13
- package/dist/core/CharacterRoster.d.ts +0 -84
- package/dist/core/CharacterRoster.d.ts.map +0 -1
- package/dist/core/CharacterRoster.js +0 -348
- package/dist/core/CharacterRoster.js.map +0 -1
- package/dist/core/CharacterVersionManager.d.ts +0 -100
- package/dist/core/CharacterVersionManager.d.ts.map +0 -1
- package/dist/core/CharacterVersionManager.js +0 -227
- package/dist/core/CharacterVersionManager.js.map +0 -1
- package/dist/core/ConvaiRoomError.d.ts +0 -48
- package/dist/core/ConvaiRoomError.d.ts.map +0 -1
- package/dist/core/ConvaiRoomError.js +0 -111
- package/dist/core/ConvaiRoomError.js.map +0 -1
- package/dist/core/SSESession.d.ts +0 -59
- package/dist/core/SSESession.d.ts.map +0 -1
- package/dist/core/SSESession.js +0 -289
- package/dist/core/SSESession.js.map +0 -1
- package/dist/core/characterReference.d.ts +0 -40
- package/dist/core/characterReference.d.ts.map +0 -1
- package/dist/core/characterReference.js +0 -72
- package/dist/core/characterReference.js.map +0 -1
- package/dist/core/rosterRequest.d.ts +0 -57
- package/dist/core/rosterRequest.d.ts.map +0 -1
- package/dist/core/rosterRequest.js +0 -210
- package/dist/core/rosterRequest.js.map +0 -1
- package/dist/utils/inlineMarkdown.d.ts +0 -38
- package/dist/utils/inlineMarkdown.d.ts.map +0 -1
- package/dist/utils/inlineMarkdown.js +0 -106
- package/dist/utils/inlineMarkdown.js.map +0 -1
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { isCharacterVersionSelector, parseCharacterReference, } from "./characterReference.js";
|
|
2
|
-
export const DEFAULT_CHARACTER_API_URL = "https://api2.convai.com";
|
|
3
|
-
/**
|
|
4
|
-
* Error raised when the Character REST platform answers with a non-2xx
|
|
5
|
-
* status. `status` carries the HTTP code; `detail` carries the parsed body
|
|
6
|
-
* (`{ detail: string }` for most failures, a validation list for 422).
|
|
7
|
-
*/
|
|
8
|
-
export class CharacterApiError extends Error {
|
|
9
|
-
constructor(message, status, detail) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = "CharacterApiError";
|
|
12
|
-
this.status = status;
|
|
13
|
-
this.detail = detail;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Authoring client for character versions.
|
|
18
|
-
*
|
|
19
|
-
* Every character has an editable **draft** and, once released, a set of
|
|
20
|
-
* immutable **tagged versions** (`1.0`, `1.1`, …). `latest` is a movable
|
|
21
|
-
* pointer that the runtime follows when a client connects without a
|
|
22
|
-
* selector. The lifecycle is:
|
|
23
|
-
*
|
|
24
|
-
* 1. edit the draft (Playground, `/character/update`, MCP);
|
|
25
|
-
* 2. {@link diff} the draft against `latest` to review the change;
|
|
26
|
-
* 3. {@link create} a tag from the draft, optionally making it latest;
|
|
27
|
-
* 4. {@link promote} an older tag to roll back, or {@link discardDraft} to
|
|
28
|
-
* throw unreleased edits away.
|
|
29
|
-
*
|
|
30
|
-
* Connect to any of these with `characterVersion` in `ConvaiConfig`.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const versions = new CharacterVersionManager({
|
|
35
|
-
* apiKey: 'YOUR_API_KEY',
|
|
36
|
-
* characterId: 'YOUR_CHARACTER_ID',
|
|
37
|
-
* });
|
|
38
|
-
* const { has_unpublished_changes } = await versions.list();
|
|
39
|
-
* if (has_unpublished_changes) {
|
|
40
|
-
* await versions.create('1.1', { makeLatest: true });
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export class CharacterVersionManager {
|
|
45
|
-
constructor(options) {
|
|
46
|
-
const { characterId, apiKey, personalAccessToken, baseUrl, workspaceId } = options;
|
|
47
|
-
if (!characterId) {
|
|
48
|
-
throw new Error("Character ID is required");
|
|
49
|
-
}
|
|
50
|
-
if (!apiKey && !personalAccessToken) {
|
|
51
|
-
throw new Error("Either apiKey or personalAccessToken is required");
|
|
52
|
-
}
|
|
53
|
-
// Accept a suffixed reference but talk to the API about the bare character.
|
|
54
|
-
this.characterId = parseCharacterReference(characterId)?.characterId ?? characterId;
|
|
55
|
-
this.apiKey = apiKey ?? null;
|
|
56
|
-
this.personalAccessToken = personalAccessToken ?? null;
|
|
57
|
-
this.baseUrl = (baseUrl || DEFAULT_CHARACTER_API_URL).replace(/\/$/, "");
|
|
58
|
-
this.workspaceId = workspaceId ?? null;
|
|
59
|
-
}
|
|
60
|
-
/** List released tags plus the current latest and draft revisions. */
|
|
61
|
-
async list() {
|
|
62
|
-
return this.request("GET", "/character/versions/list");
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Resolve a reference to the configuration snapshot the runtime would run.
|
|
66
|
-
* Omit `version` to resolve the effective latest, or pass `draft`,
|
|
67
|
-
* `latest`, or a tag.
|
|
68
|
-
*/
|
|
69
|
-
async resolve(version, options = {}) {
|
|
70
|
-
const reference = version ? `${this.characterId}-${this.assertSelector(version)}` : this.characterId;
|
|
71
|
-
return this.request("GET", "/character/versions/resolve", {
|
|
72
|
-
query: {
|
|
73
|
-
character_id: reference,
|
|
74
|
-
...(options.includeRuntimeSettings ? { include_runtime_settings: "true" } : {}),
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Give a character that predates versioning an editable draft. Safe to call
|
|
80
|
-
* repeatedly — `created` is false when a draft already existed.
|
|
81
|
-
*/
|
|
82
|
-
async bootstrap() {
|
|
83
|
-
return this.request("POST", "/character/versions/bootstrap");
|
|
84
|
-
}
|
|
85
|
-
async diff(from, to, options = {}) {
|
|
86
|
-
return this.request("GET", "/character/versions/diff", {
|
|
87
|
-
query: {
|
|
88
|
-
from: this.assertSelector(from),
|
|
89
|
-
to: this.assertSelector(to),
|
|
90
|
-
...(options.view ? { view: options.view } : {}),
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Release the current draft as an immutable tagged version.
|
|
96
|
-
* @param version - New tag, `major.minor` or `major.minor.patch`
|
|
97
|
-
*/
|
|
98
|
-
async create(version, options = {}) {
|
|
99
|
-
return this.request("POST", "/character/versions/create", {
|
|
100
|
-
body: {
|
|
101
|
-
version: this.assertTag(version),
|
|
102
|
-
...(options.makeLatest !== undefined ? { make_latest: options.makeLatest } : {}),
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/** Point `latest` at an already released tag — the way to roll back. */
|
|
107
|
-
async promote(version) {
|
|
108
|
-
return this.request("POST", "/character/versions/promote", {
|
|
109
|
-
body: { version: this.assertTag(version) },
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Discard every saved draft change and restore the draft from its released
|
|
114
|
-
* parent. Pass the draft revision you last saw so a concurrent edit is
|
|
115
|
-
* refused instead of silently thrown away.
|
|
116
|
-
*/
|
|
117
|
-
async discardDraft(expectedDraftRevisionId) {
|
|
118
|
-
if (!expectedDraftRevisionId) {
|
|
119
|
-
throw new Error("expectedDraftRevisionId is required");
|
|
120
|
-
}
|
|
121
|
-
return this.request("POST", "/character/versions/discard-draft", {
|
|
122
|
-
body: { expected_draft_revision_id: expectedDraftRevisionId },
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
/** Undo one semantic change in the draft, identified by a semantic diff's `change_id`. */
|
|
126
|
-
async revert(options) {
|
|
127
|
-
const { from, changeId, expectedDraftRevisionId } = options;
|
|
128
|
-
if (!changeId || !expectedDraftRevisionId) {
|
|
129
|
-
throw new Error("changeId and expectedDraftRevisionId are required");
|
|
130
|
-
}
|
|
131
|
-
return this.request("POST", "/character/versions/revert", {
|
|
132
|
-
body: {
|
|
133
|
-
from: this.assertSelector(from),
|
|
134
|
-
change_id: changeId,
|
|
135
|
-
expected_draft_revision_id: expectedDraftRevisionId,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/** Mark a tag deprecated, or restore it with `deprecated: false`. Deprecated tags stay connectable. */
|
|
140
|
-
async deprecate(version, deprecated = true) {
|
|
141
|
-
return this.request("POST", "/character/versions/deprecate", {
|
|
142
|
-
body: { version: this.assertTag(version), deprecated },
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Replace the draft with the contents of a released tag, to branch new work
|
|
147
|
-
* from an older version. `expectedDraftRevisionId` guards against clobbering
|
|
148
|
-
* a draft someone else just changed.
|
|
149
|
-
*/
|
|
150
|
-
async fork(version, expectedDraftRevisionId) {
|
|
151
|
-
return this.request("POST", "/character/versions/fork", {
|
|
152
|
-
body: {
|
|
153
|
-
version: this.assertTag(version),
|
|
154
|
-
...(expectedDraftRevisionId ? { expected_draft_revision_id: expectedDraftRevisionId } : {}),
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
assertSelector(value) {
|
|
159
|
-
if (!isCharacterVersionSelector(value)) {
|
|
160
|
-
throw new Error(`Expected "draft", "latest", or a major.minor[.patch] tag; received ${JSON.stringify(value)}`);
|
|
161
|
-
}
|
|
162
|
-
return value;
|
|
163
|
-
}
|
|
164
|
-
assertTag(value) {
|
|
165
|
-
if (!isCharacterVersionSelector(value) || value === "draft" || value === "latest") {
|
|
166
|
-
throw new Error(`Expected a major.minor[.patch] version tag; received ${JSON.stringify(value)}`);
|
|
167
|
-
}
|
|
168
|
-
return value;
|
|
169
|
-
}
|
|
170
|
-
async request(method, path, options = {}) {
|
|
171
|
-
const params = new URLSearchParams({
|
|
172
|
-
character_id: this.characterId,
|
|
173
|
-
...(this.workspaceId ? { workspace_id: this.workspaceId } : {}),
|
|
174
|
-
...options.query,
|
|
175
|
-
});
|
|
176
|
-
const url = `${this.baseUrl}${path}?${params.toString()}`;
|
|
177
|
-
const headers = { Accept: "application/json" };
|
|
178
|
-
if (this.personalAccessToken) {
|
|
179
|
-
headers["Authorization"] = `Bearer ${this.personalAccessToken}`;
|
|
180
|
-
}
|
|
181
|
-
else if (this.apiKey) {
|
|
182
|
-
headers["CONVAI-API-KEY"] = this.apiKey;
|
|
183
|
-
}
|
|
184
|
-
if (options.body !== undefined) {
|
|
185
|
-
headers["Content-Type"] = "application/json";
|
|
186
|
-
}
|
|
187
|
-
const response = await fetch(url, {
|
|
188
|
-
method,
|
|
189
|
-
headers,
|
|
190
|
-
...(options.body !== undefined ? { body: JSON.stringify(options.body) } : {}),
|
|
191
|
-
});
|
|
192
|
-
const text = await response.text();
|
|
193
|
-
let data = null;
|
|
194
|
-
if (text) {
|
|
195
|
-
try {
|
|
196
|
-
data = JSON.parse(text);
|
|
197
|
-
}
|
|
198
|
-
catch {
|
|
199
|
-
data = text;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (!response.ok) {
|
|
203
|
-
throw new CharacterApiError(describeFailure(response.status, data), response.status, data);
|
|
204
|
-
}
|
|
205
|
-
return data;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function describeFailure(status, data) {
|
|
209
|
-
const body = (data ?? null);
|
|
210
|
-
const detail = body?.detail;
|
|
211
|
-
if (typeof detail === "string")
|
|
212
|
-
return detail;
|
|
213
|
-
// Access denials use `{ error, message }` rather than `{ detail }`.
|
|
214
|
-
if (typeof body?.message === "string")
|
|
215
|
-
return body.message;
|
|
216
|
-
if (Array.isArray(detail)) {
|
|
217
|
-
const parts = detail
|
|
218
|
-
.map((e) => [e.loc?.join("."), e.msg].filter(Boolean).join(": "))
|
|
219
|
-
.filter(Boolean);
|
|
220
|
-
if (parts.length)
|
|
221
|
-
return parts.join("; ");
|
|
222
|
-
}
|
|
223
|
-
if (typeof data === "string" && data)
|
|
224
|
-
return `HTTP ${status}: ${data}`;
|
|
225
|
-
return `HTTP ${status}`;
|
|
226
|
-
}
|
|
227
|
-
//# sourceMappingURL=CharacterVersionManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CharacterVersionManager.js","sourceRoot":"","sources":["../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C","sourcesContent":["import type {\n CharacterDraftBootstrapResult,\n CharacterVersionDiff,\n CharacterVersionDiffOptions,\n CharacterVersionInfo,\n CharacterVersionList,\n CharacterVersionManagerOptions,\n CharacterVersionRawDiff,\n CharacterVersionSemanticDiff,\n CreateCharacterVersionOptions,\n DiscardCharacterDraftResult,\n ForkCharacterVersionResult,\n ResolveCharacterVersionOptions,\n ResolvedCharacterVersion,\n RevertCharacterChangeOptions,\n RevertCharacterChangeResult,\n} from \"./types\";\nimport {\n isCharacterVersionSelector,\n parseCharacterReference,\n type CharacterVersionSelector,\n} from \"./characterReference\";\n\nexport const DEFAULT_CHARACTER_API_URL = \"https://api2.convai.com\";\n\n/**\n * Error raised when the Character REST platform answers with a non-2xx\n * status. `status` carries the HTTP code; `detail` carries the parsed body\n * (`{ detail: string }` for most failures, a validation list for 422).\n */\nexport class CharacterApiError extends Error {\n readonly status: number;\n readonly detail: unknown;\n\n constructor(message: string, status: number, detail: unknown) {\n super(message);\n this.name = \"CharacterApiError\";\n this.status = status;\n this.detail = detail;\n }\n}\n\n/**\n * Authoring client for character versions.\n *\n * Every character has an editable **draft** and, once released, a set of\n * immutable **tagged versions** (`1.0`, `1.1`, …). `latest` is a movable\n * pointer that the runtime follows when a client connects without a\n * selector. The lifecycle is:\n *\n * 1. edit the draft (Playground, `/character/update`, MCP);\n * 2. {@link diff} the draft against `latest` to review the change;\n * 3. {@link create} a tag from the draft, optionally making it latest;\n * 4. {@link promote} an older tag to roll back, or {@link discardDraft} to\n * throw unreleased edits away.\n *\n * Connect to any of these with `characterVersion` in `ConvaiConfig`.\n *\n * @example\n * ```typescript\n * const versions = new CharacterVersionManager({\n * apiKey: 'YOUR_API_KEY',\n * characterId: 'YOUR_CHARACTER_ID',\n * });\n * const { has_unpublished_changes } = await versions.list();\n * if (has_unpublished_changes) {\n * await versions.create('1.1', { makeLatest: true });\n * }\n * ```\n */\nexport class CharacterVersionManager {\n private readonly apiKey: string | null;\n private readonly personalAccessToken: string | null;\n private readonly baseUrl: string;\n private readonly workspaceId: string | null;\n readonly characterId: string;\n\n constructor(options: CharacterVersionManagerOptions) {\n const { characterId, apiKey, personalAccessToken, baseUrl, workspaceId } = options;\n if (!characterId) {\n throw new Error(\"Character ID is required\");\n }\n if (!apiKey && !personalAccessToken) {\n throw new Error(\"Either apiKey or personalAccessToken is required\");\n }\n // Accept a suffixed reference but talk to the API about the bare character.\n this.characterId = parseCharacterReference(characterId)?.characterId ?? characterId;\n this.apiKey = apiKey ?? null;\n this.personalAccessToken = personalAccessToken ?? null;\n this.baseUrl = (baseUrl || DEFAULT_CHARACTER_API_URL).replace(/\\/$/, \"\");\n this.workspaceId = workspaceId ?? null;\n }\n\n /** List released tags plus the current latest and draft revisions. */\n async list(): Promise<CharacterVersionList> {\n return this.request<CharacterVersionList>(\"GET\", \"/character/versions/list\");\n }\n\n /**\n * Resolve a reference to the configuration snapshot the runtime would run.\n * Omit `version` to resolve the effective latest, or pass `draft`,\n * `latest`, or a tag.\n */\n async resolve(\n version?: CharacterVersionSelector | null,\n options: ResolveCharacterVersionOptions = {},\n ): Promise<ResolvedCharacterVersion> {\n const reference = version ? `${this.characterId}-${this.assertSelector(version)}` : this.characterId;\n return this.request<ResolvedCharacterVersion>(\"GET\", \"/character/versions/resolve\", {\n query: {\n character_id: reference,\n ...(options.includeRuntimeSettings ? { include_runtime_settings: \"true\" } : {}),\n },\n });\n }\n\n /**\n * Give a character that predates versioning an editable draft. Safe to call\n * repeatedly — `created` is false when a draft already existed.\n */\n async bootstrap(): Promise<CharacterDraftBootstrapResult> {\n return this.request<CharacterDraftBootstrapResult>(\"POST\", \"/character/versions/bootstrap\");\n }\n\n /**\n * Compare two references. Each side is `draft`, `latest`, or a tag.\n * The raw view lists JSON paths; the semantic view groups them into\n * labelled changes that {@link revert} can undo one at a time.\n */\n diff(from: string, to: string, options?: { view?: \"raw\" }): Promise<CharacterVersionRawDiff>;\n diff(from: string, to: string, options: { view: \"semantic\" }): Promise<CharacterVersionSemanticDiff>;\n async diff(from: string, to: string, options: CharacterVersionDiffOptions = {}): Promise<CharacterVersionDiff> {\n return this.request<CharacterVersionDiff>(\"GET\", \"/character/versions/diff\", {\n query: {\n from: this.assertSelector(from),\n to: this.assertSelector(to),\n ...(options.view ? { view: options.view } : {}),\n },\n });\n }\n\n /**\n * Release the current draft as an immutable tagged version.\n * @param version - New tag, `major.minor` or `major.minor.patch`\n */\n async create(version: string, options: CreateCharacterVersionOptions = {}): Promise<CharacterVersionInfo> {\n return this.request<CharacterVersionInfo>(\"POST\", \"/character/versions/create\", {\n body: {\n version: this.assertTag(version),\n ...(options.makeLatest !== undefined ? { make_latest: options.makeLatest } : {}),\n },\n });\n }\n\n /** Point `latest` at an already released tag — the way to roll back. */\n async promote(version: string): Promise<CharacterVersionInfo> {\n return this.request<CharacterVersionInfo>(\"POST\", \"/character/versions/promote\", {\n body: { version: this.assertTag(version) },\n });\n }\n\n /**\n * Discard every saved draft change and restore the draft from its released\n * parent. Pass the draft revision you last saw so a concurrent edit is\n * refused instead of silently thrown away.\n */\n async discardDraft(expectedDraftRevisionId: string): Promise<DiscardCharacterDraftResult> {\n if (!expectedDraftRevisionId) {\n throw new Error(\"expectedDraftRevisionId is required\");\n }\n return this.request<DiscardCharacterDraftResult>(\"POST\", \"/character/versions/discard-draft\", {\n body: { expected_draft_revision_id: expectedDraftRevisionId },\n });\n }\n\n /** Undo one semantic change in the draft, identified by a semantic diff's `change_id`. */\n async revert(options: RevertCharacterChangeOptions): Promise<RevertCharacterChangeResult> {\n const { from, changeId, expectedDraftRevisionId } = options;\n if (!changeId || !expectedDraftRevisionId) {\n throw new Error(\"changeId and expectedDraftRevisionId are required\");\n }\n return this.request<RevertCharacterChangeResult>(\"POST\", \"/character/versions/revert\", {\n body: {\n from: this.assertSelector(from),\n change_id: changeId,\n expected_draft_revision_id: expectedDraftRevisionId,\n },\n });\n }\n\n /** Mark a tag deprecated, or restore it with `deprecated: false`. Deprecated tags stay connectable. */\n async deprecate(version: string, deprecated = true): Promise<CharacterVersionInfo> {\n return this.request<CharacterVersionInfo>(\"POST\", \"/character/versions/deprecate\", {\n body: { version: this.assertTag(version), deprecated },\n });\n }\n\n /**\n * Replace the draft with the contents of a released tag, to branch new work\n * from an older version. `expectedDraftRevisionId` guards against clobbering\n * a draft someone else just changed.\n */\n async fork(version: string, expectedDraftRevisionId?: string): Promise<ForkCharacterVersionResult> {\n return this.request<ForkCharacterVersionResult>(\"POST\", \"/character/versions/fork\", {\n body: {\n version: this.assertTag(version),\n ...(expectedDraftRevisionId ? { expected_draft_revision_id: expectedDraftRevisionId } : {}),\n },\n });\n }\n\n private assertSelector(value: string): string {\n if (!isCharacterVersionSelector(value)) {\n throw new Error(\n `Expected \"draft\", \"latest\", or a major.minor[.patch] tag; received ${JSON.stringify(value)}`,\n );\n }\n return value;\n }\n\n private assertTag(value: string): string {\n if (!isCharacterVersionSelector(value) || value === \"draft\" || value === \"latest\") {\n throw new Error(\n `Expected a major.minor[.patch] version tag; received ${JSON.stringify(value)}`,\n );\n }\n return value;\n }\n\n private async request<T>(\n method: \"GET\" | \"POST\",\n path: string,\n options: { query?: Record<string, string>; body?: unknown } = {},\n ): Promise<T> {\n const params = new URLSearchParams({\n character_id: this.characterId,\n ...(this.workspaceId ? { workspace_id: this.workspaceId } : {}),\n ...options.query,\n });\n const url = `${this.baseUrl}${path}?${params.toString()}`;\n\n const headers: Record<string, string> = { Accept: \"application/json\" };\n if (this.personalAccessToken) {\n headers[\"Authorization\"] = `Bearer ${this.personalAccessToken}`;\n } else if (this.apiKey) {\n headers[\"CONVAI-API-KEY\"] = this.apiKey;\n }\n if (options.body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n const response = await fetch(url, {\n method,\n headers,\n ...(options.body !== undefined ? { body: JSON.stringify(options.body) } : {}),\n });\n\n const text = await response.text();\n let data: unknown = null;\n if (text) {\n try {\n data = JSON.parse(text);\n } catch {\n data = text;\n }\n }\n\n if (!response.ok) {\n throw new CharacterApiError(describeFailure(response.status, data), response.status, data);\n }\n return data as T;\n }\n}\n\nfunction describeFailure(status: number, data: unknown): string {\n const body = (data ?? null) as { detail?: unknown; message?: unknown; error?: unknown } | null;\n const detail = body?.detail;\n if (typeof detail === \"string\") return detail;\n // Access denials use `{ error, message }` rather than `{ detail }`.\n if (typeof body?.message === \"string\") return body.message;\n if (Array.isArray(detail)) {\n const parts = detail\n .map((e: { loc?: unknown[]; msg?: string }) =>\n [e.loc?.join(\".\"), e.msg].filter(Boolean).join(\": \"),\n )\n .filter(Boolean);\n if (parts.length) return parts.join(\"; \");\n }\n if (typeof data === \"string\" && data) return `HTTP ${status}: ${data}`;\n return `HTTP ${status}`;\n}\n"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed failure from a room-topology request (`connect()` with a roster, or
|
|
3
|
-
* `joinRoom()`).
|
|
4
|
-
*
|
|
5
|
-
* The runtime answers these with a named code and a `request_trace_id`, and the
|
|
6
|
-
* backend's whole troubleshooting procedure starts from that trace id — it
|
|
7
|
-
* correlates API logs, room records, membership rows, actor logs and LiveKit.
|
|
8
|
-
* A plain `Error` throws it away, so this class carries it through to the
|
|
9
|
-
* caller alongside the status and the machine-readable code.
|
|
10
|
-
*/
|
|
11
|
-
export declare class ConvaiRoomError extends Error {
|
|
12
|
-
readonly status: number;
|
|
13
|
-
/** Named code such as `ROSTER_FINGERPRINT_MISMATCH`, or null when the body carried none. */
|
|
14
|
-
readonly code: string | null;
|
|
15
|
-
/** Quote this to backend support; it correlates every log for the request. */
|
|
16
|
-
readonly requestTraceId: string | null;
|
|
17
|
-
/** The parsed response body, or the raw text when it was not JSON. */
|
|
18
|
-
readonly detail: unknown;
|
|
19
|
-
constructor(message: string, status: number, code: string | null, requestTraceId: string | null, detail: unknown);
|
|
20
|
-
/**
|
|
21
|
-
* True when retrying the identical payload can plausibly succeed.
|
|
22
|
-
*
|
|
23
|
-
* Only the two "still working on it" conflicts qualify. A fingerprint
|
|
24
|
-
* mismatch means the topology genuinely differs, and a capacity or
|
|
25
|
-
* entitlement rejection will not change on its own — retrying those just
|
|
26
|
-
* burns the room's provisioning window.
|
|
27
|
-
*/
|
|
28
|
-
get isRetryable(): boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Pull a named code out of a parsed error body.
|
|
32
|
-
*
|
|
33
|
-
* The runtime is not consistent about where it puts one: some rejections carry
|
|
34
|
-
* `{ code }`, some put the name in `detail` as a bare string, and some nest it
|
|
35
|
-
* under `detail.code`. A code is never synthesised from the status — callers
|
|
36
|
-
* branch on it, and inventing `"CONFLICT"` for every 409 would make
|
|
37
|
-
* `ROSTER_FINGERPRINT_MISMATCH` and `ROSTER_PROVISIONING_IN_PROGRESS`
|
|
38
|
-
* indistinguishable, which is exactly the distinction that decides whether to
|
|
39
|
-
* retry.
|
|
40
|
-
*/
|
|
41
|
-
export declare function extractRoomErrorCode(body: unknown): string | null;
|
|
42
|
-
/** Pull the trace id out of a parsed body, wherever the layer put it. */
|
|
43
|
-
export declare function extractRequestTraceId(body: unknown): string | null;
|
|
44
|
-
/** Human-readable message from a body, falling back to the status. */
|
|
45
|
-
export declare function extractRoomErrorMessage(body: unknown, status: number): string;
|
|
46
|
-
/** Build a `ConvaiRoomError` from a response status and its parsed body. */
|
|
47
|
-
export declare function roomErrorFromResponse(status: number, body: unknown): ConvaiRoomError;
|
|
48
|
-
//# sourceMappingURL=ConvaiRoomError.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConvaiRoomError.d.ts","sourceRoot":"","sources":["../../src/core/ConvaiRoomError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,MAAM,EAAE,OAAO;IAUjB;;;;;;;OAOG;IACH,IAAI,WAAW,IAAI,OAAO,CAMzB;CACF;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgBjE;AAUD,yEAAyE;AACzE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAUlE;AAED,sEAAsE;AACtE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAc7E;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GACZ,eAAe,CAQjB"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed failure from a room-topology request (`connect()` with a roster, or
|
|
3
|
-
* `joinRoom()`).
|
|
4
|
-
*
|
|
5
|
-
* The runtime answers these with a named code and a `request_trace_id`, and the
|
|
6
|
-
* backend's whole troubleshooting procedure starts from that trace id — it
|
|
7
|
-
* correlates API logs, room records, membership rows, actor logs and LiveKit.
|
|
8
|
-
* A plain `Error` throws it away, so this class carries it through to the
|
|
9
|
-
* caller alongside the status and the machine-readable code.
|
|
10
|
-
*/
|
|
11
|
-
export class ConvaiRoomError extends Error {
|
|
12
|
-
constructor(message, status, code, requestTraceId, detail) {
|
|
13
|
-
super(message);
|
|
14
|
-
this.name = "ConvaiRoomError";
|
|
15
|
-
this.status = status;
|
|
16
|
-
this.code = code;
|
|
17
|
-
this.requestTraceId = requestTraceId;
|
|
18
|
-
this.detail = detail;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* True when retrying the identical payload can plausibly succeed.
|
|
22
|
-
*
|
|
23
|
-
* Only the two "still working on it" conflicts qualify. A fingerprint
|
|
24
|
-
* mismatch means the topology genuinely differs, and a capacity or
|
|
25
|
-
* entitlement rejection will not change on its own — retrying those just
|
|
26
|
-
* burns the room's provisioning window.
|
|
27
|
-
*/
|
|
28
|
-
get isRetryable() {
|
|
29
|
-
if (this.status !== 409)
|
|
30
|
-
return false;
|
|
31
|
-
return (this.code === "ROSTER_PROVISIONING_IN_PROGRESS" ||
|
|
32
|
-
this.code === "CONNECT_ATTEMPT_IN_PROGRESS");
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** Response bodies differ by layer; a code can arrive under any of these. */
|
|
36
|
-
const CODE_KEYS = ["code", "error_code", "detail_code"];
|
|
37
|
-
/**
|
|
38
|
-
* Pull a named code out of a parsed error body.
|
|
39
|
-
*
|
|
40
|
-
* The runtime is not consistent about where it puts one: some rejections carry
|
|
41
|
-
* `{ code }`, some put the name in `detail` as a bare string, and some nest it
|
|
42
|
-
* under `detail.code`. A code is never synthesised from the status — callers
|
|
43
|
-
* branch on it, and inventing `"CONFLICT"` for every 409 would make
|
|
44
|
-
* `ROSTER_FINGERPRINT_MISMATCH` and `ROSTER_PROVISIONING_IN_PROGRESS`
|
|
45
|
-
* indistinguishable, which is exactly the distinction that decides whether to
|
|
46
|
-
* retry.
|
|
47
|
-
*/
|
|
48
|
-
export function extractRoomErrorCode(body) {
|
|
49
|
-
if (typeof body === "string")
|
|
50
|
-
return looksLikeCode(body) ? body : null;
|
|
51
|
-
if (typeof body !== "object" || body === null)
|
|
52
|
-
return null;
|
|
53
|
-
const record = body;
|
|
54
|
-
for (const key of CODE_KEYS) {
|
|
55
|
-
const value = record[key];
|
|
56
|
-
if (typeof value === "string" && value)
|
|
57
|
-
return value;
|
|
58
|
-
}
|
|
59
|
-
const detail = record.detail;
|
|
60
|
-
if (typeof detail === "string")
|
|
61
|
-
return looksLikeCode(detail) ? detail : null;
|
|
62
|
-
if (typeof detail === "object" && detail !== null) {
|
|
63
|
-
return extractRoomErrorCode(detail);
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* A code is SCREAMING_SNAKE_CASE. `detail` is also where human prose lands
|
|
69
|
-
* ("Human room capacity reached"), so shape is what tells the two apart.
|
|
70
|
-
*/
|
|
71
|
-
function looksLikeCode(value) {
|
|
72
|
-
return /^[A-Z][A-Z0-9_]{2,}$/.test(value.trim());
|
|
73
|
-
}
|
|
74
|
-
/** Pull the trace id out of a parsed body, wherever the layer put it. */
|
|
75
|
-
export function extractRequestTraceId(body) {
|
|
76
|
-
if (typeof body !== "object" || body === null)
|
|
77
|
-
return null;
|
|
78
|
-
const record = body;
|
|
79
|
-
const direct = record.request_trace_id;
|
|
80
|
-
if (typeof direct === "string" && direct)
|
|
81
|
-
return direct;
|
|
82
|
-
const detail = record.detail;
|
|
83
|
-
if (typeof detail === "object" && detail !== null) {
|
|
84
|
-
return extractRequestTraceId(detail);
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
/** Human-readable message from a body, falling back to the status. */
|
|
89
|
-
export function extractRoomErrorMessage(body, status) {
|
|
90
|
-
if (typeof body === "string" && body.trim())
|
|
91
|
-
return body.trim();
|
|
92
|
-
if (typeof body === "object" && body !== null) {
|
|
93
|
-
const record = body;
|
|
94
|
-
for (const key of ["message", "detail", "error"]) {
|
|
95
|
-
const value = record[key];
|
|
96
|
-
if (typeof value === "string" && value.trim())
|
|
97
|
-
return value.trim();
|
|
98
|
-
if (typeof value === "object" && value !== null) {
|
|
99
|
-
const nested = extractRoomErrorMessage(value, status);
|
|
100
|
-
if (!nested.startsWith("Room request failed"))
|
|
101
|
-
return nested;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return `Room request failed with HTTP ${status}`;
|
|
106
|
-
}
|
|
107
|
-
/** Build a `ConvaiRoomError` from a response status and its parsed body. */
|
|
108
|
-
export function roomErrorFromResponse(status, body) {
|
|
109
|
-
return new ConvaiRoomError(extractRoomErrorMessage(body, status), status, extractRoomErrorCode(body), extractRequestTraceId(body), body);
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=ConvaiRoomError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConvaiRoomError.js","sourceRoot":"","sources":["../../src/core/ConvaiRoomError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IASxC,YACE,OAAe,EACf,MAAc,EACd,IAAmB,EACnB,cAA6B,EAC7B,MAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,WAAW;QACb,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QACtC,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,iCAAiC;YAC/C,IAAI,CAAC,IAAI,KAAK,6BAA6B,CAC5C,CAAC;IACJ,CAAC;CACF;AAED,6EAA6E;AAC7E,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,aAAa,CAAU,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAa;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,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om()`).\n *\n * The runtime answers these with a named code and a `request_trace_id`, and the\n * backend's whole troubleshooting procedure starts from that trace id — it\n * correlates API logs, room records, membership rows, actor logs and LiveKit.\n * A plain `Error` throws it away, so this class carries it through to the\n * caller alongside the status and the machine-readable code.\n */\nexport class ConvaiRoomError extends Error {\n readonly status: number;\n /** Named code such as `ROSTER_FINGERPRINT_MISMATCH`, or null when the body carried none. */\n readonly code: string | null;\n /** Quote this to backend support; it correlates every log for the request. */\n readonly requestTraceId: string | null;\n /** The parsed response body, or the raw text when it was not JSON. */\n readonly detail: unknown;\n\n constructor(\n message: string,\n status: number,\n code: string | null,\n requestTraceId: string | null,\n detail: unknown,\n ) {\n super(message);\n this.name = \"ConvaiRoomError\";\n this.status = status;\n this.code = code;\n this.requestTraceId = requestTraceId;\n this.detail = detail;\n }\n\n /**\n * True when retrying the identical payload can plausibly succeed.\n *\n * Only the two \"still working on it\" conflicts qualify. A fingerprint\n * mismatch means the topology genuinely differs, and a capacity or\n * entitlement rejection will not change on its own — retrying those just\n * burns the room's provisioning window.\n */\n get isRetryable(): boolean {\n if (this.status !== 409) return false;\n return (\n this.code === \"ROSTER_PROVISIONING_IN_PROGRESS\" ||\n this.code === \"CONNECT_ATTEMPT_IN_PROGRESS\"\n );\n }\n}\n\n/** Response bodies differ by layer; a code can arrive under any of these. */\nconst CODE_KEYS = [\"code\", \"error_code\", \"detail_code\"] as const;\n\n/**\n * Pull a named code out of a parsed error body.\n *\n * The runtime is not consistent about where it puts one: some rejections carry\n * `{ code }`, some put the name in `detail` as a bare string, and some nest it\n * under `detail.code`. A code is never synthesised from the status — callers\n * branch on it, and inventing `\"CONFLICT\"` for every 409 would make\n * `ROSTER_FINGERPRINT_MISMATCH` and `ROSTER_PROVISIONING_IN_PROGRESS`\n * indistinguishable, which is exactly the distinction that decides whether to\n * retry.\n */\nexport function extractRoomErrorCode(body: unknown): string | null {\n if (typeof body === \"string\") return looksLikeCode(body) ? body : null;\n if (typeof body !== \"object\" || body === null) return null;\n\n const record = body as Record<string, unknown>;\n for (const key of CODE_KEYS) {\n const value = record[key];\n if (typeof value === \"string\" && value) return value;\n }\n\n const detail = record.detail;\n if (typeof detail === \"string\") return looksLikeCode(detail) ? detail : null;\n if (typeof detail === \"object\" && detail !== null) {\n return extractRoomErrorCode(detail);\n }\n return null;\n}\n\n/**\n * A code is SCREAMING_SNAKE_CASE. `detail` is also where human prose lands\n * (\"Human room capacity reached\"), so shape is what tells the two apart.\n */\nfunction looksLikeCode(value: string): boolean {\n return /^[A-Z][A-Z0-9_]{2,}$/.test(value.trim());\n}\n\n/** Pull the trace id out of a parsed body, wherever the layer put it. */\nexport function extractRequestTraceId(body: unknown): string | null {\n if (typeof body !== \"object\" || body === null) return null;\n const record = body as Record<string, unknown>;\n const direct = record.request_trace_id;\n if (typeof direct === \"string\" && direct) return direct;\n const detail = record.detail;\n if (typeof detail === \"object\" && detail !== null) {\n return extractRequestTraceId(detail);\n }\n return null;\n}\n\n/** Human-readable message from a body, falling back to the status. */\nexport function extractRoomErrorMessage(body: unknown, status: number): string {\n if (typeof body === \"string\" && body.trim()) return body.trim();\n if (typeof body === \"object\" && body !== null) {\n const record = body as Record<string, unknown>;\n for (const key of [\"message\", \"detail\", \"error\"]) {\n const value = record[key];\n if (typeof value === \"string\" && value.trim()) return value.trim();\n if (typeof value === \"object\" && value !== null) {\n const nested = extractRoomErrorMessage(value, status);\n if (!nested.startsWith(\"Room request failed\")) return nested;\n }\n }\n }\n return `Room request failed with HTTP ${status}`;\n}\n\n/** Build a `ConvaiRoomError` from a response status and its parsed body. */\nexport function roomErrorFromResponse(\n status: number,\n body: unknown,\n): ConvaiRoomError {\n return new ConvaiRoomError(\n extractRoomErrorMessage(body, status),\n status,\n extractRoomErrorCode(body),\n extractRequestTraceId(body),\n body,\n );\n}\n"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { ConvaiConfig } from "./types.js";
|
|
2
|
-
export interface SSESessionOptions {
|
|
3
|
-
interactionApiUrl: string;
|
|
4
|
-
authorization: string;
|
|
5
|
-
characterId: string;
|
|
6
|
-
getCharacterSessionId: () => string | null;
|
|
7
|
-
onCharacterSessionId: (characterSessionId: string) => void;
|
|
8
|
-
endUserId?: string;
|
|
9
|
-
endUserMetadata?: Record<string, unknown>;
|
|
10
|
-
takeStateOfMind: () => string | null;
|
|
11
|
-
enableEmotion?: ConvaiConfig["enableEmotion"];
|
|
12
|
-
emotionConfig?: ConvaiConfig["emotionConfig"];
|
|
13
|
-
actionConfig?: ConvaiConfig["actionConfig"];
|
|
14
|
-
capabilities?: ConvaiConfig["capabilities"];
|
|
15
|
-
dynamicInfo?: ConvaiConfig["dynamicInfo"];
|
|
16
|
-
keepInContext?: ConvaiConfig["keepInContext"];
|
|
17
|
-
narrativeTemplateKeys?: ConvaiConfig["narrativeTemplateKeys"];
|
|
18
|
-
sceneDescription?: ConvaiConfig["sceneDescription"];
|
|
19
|
-
respondModes?: ConvaiConfig["respondModes"];
|
|
20
|
-
debug?: boolean;
|
|
21
|
-
useResponseLifecycleContract?: boolean;
|
|
22
|
-
invocationMetadata?: ConvaiConfig["invocationMetadata"];
|
|
23
|
-
onMessage: (payload: Uint8Array) => void;
|
|
24
|
-
onError: (error: unknown) => void;
|
|
25
|
-
}
|
|
26
|
-
export interface SSEMessage {
|
|
27
|
-
type: string;
|
|
28
|
-
data: unknown;
|
|
29
|
-
id?: string;
|
|
30
|
-
}
|
|
31
|
-
/** Text-only interaction transport. One POST/SSE stream is used per message. */
|
|
32
|
-
export declare class SSESession {
|
|
33
|
-
private readonly options;
|
|
34
|
-
private static readonly BOT_LLM_TEXT_FLUSH_MS;
|
|
35
|
-
private connected;
|
|
36
|
-
private abortController;
|
|
37
|
-
private queue;
|
|
38
|
-
private pendingBotLlmText;
|
|
39
|
-
private botLlmTextFlushTimer;
|
|
40
|
-
private pendingMessages;
|
|
41
|
-
constructor(options: SSESessionOptions);
|
|
42
|
-
get isConnected(): boolean;
|
|
43
|
-
connect(): void;
|
|
44
|
-
sendMessage(type: string, data: unknown, id?: string): void;
|
|
45
|
-
sendMessages(messages: SSEMessage[]): void;
|
|
46
|
-
/** Update request-scoped dynamic context without opening a control-only request. */
|
|
47
|
-
updateDynamicInfo(dynamicInfo: string): void;
|
|
48
|
-
getDynamicInfo(): string | undefined;
|
|
49
|
-
/** Carry a silent control update into the next stateless interaction request. */
|
|
50
|
-
queueMessage(type: string, data: unknown): void;
|
|
51
|
-
disconnect(): Promise<void>;
|
|
52
|
-
private sendInteraction;
|
|
53
|
-
private readEvents;
|
|
54
|
-
private consumeReader;
|
|
55
|
-
private queueBotLlmText;
|
|
56
|
-
private flushBotLlmText;
|
|
57
|
-
private clearPendingBotLlmText;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=SSESession.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SSESession.d.ts","sourceRoot":"","sources":["../../src/core/SSESession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAO5C,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC3C,oBAAoB,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,eAAe,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE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