@convai/web-sdk 1.8.0-beta.4 → 1.8.0-beta.6
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 +64 -3
- package/dist/core/CharacterRoster.d.ts +84 -0
- package/dist/core/CharacterRoster.d.ts.map +1 -0
- package/dist/core/CharacterRoster.js +348 -0
- package/dist/core/CharacterRoster.js.map +1 -0
- package/dist/core/CharacterVersionManager.d.ts +100 -0
- package/dist/core/CharacterVersionManager.d.ts.map +1 -0
- package/dist/core/CharacterVersionManager.js +227 -0
- package/dist/core/CharacterVersionManager.js.map +1 -0
- package/dist/core/ConvaiClient.d.ts +109 -1
- package/dist/core/ConvaiClient.d.ts.map +1 -1
- package/dist/core/ConvaiClient.js +642 -49
- package/dist/core/ConvaiClient.js.map +1 -1
- package/dist/core/ConvaiRoomError.d.ts +48 -0
- package/dist/core/ConvaiRoomError.d.ts.map +1 -0
- package/dist/core/ConvaiRoomError.js +111 -0
- package/dist/core/ConvaiRoomError.js.map +1 -0
- package/dist/core/MessageHandler.d.ts +14 -0
- package/dist/core/MessageHandler.d.ts.map +1 -1
- package/dist/core/MessageHandler.js +111 -5
- package/dist/core/MessageHandler.js.map +1 -1
- package/dist/core/SSESession.d.ts +15 -0
- package/dist/core/SSESession.d.ts.map +1 -1
- package/dist/core/SSESession.js +92 -3
- package/dist/core/SSESession.js.map +1 -1
- package/dist/core/characterReference.d.ts +40 -0
- package/dist/core/characterReference.d.ts.map +1 -0
- package/dist/core/characterReference.js +72 -0
- package/dist/core/characterReference.js.map +1 -0
- package/dist/core/connectRequest.d.ts +1 -0
- package/dist/core/connectRequest.d.ts.map +1 -1
- package/dist/core/connectRequest.js +11 -0
- package/dist/core/connectRequest.js.map +1 -1
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/rosterRequest.d.ts +57 -0
- package/dist/core/rosterRequest.d.ts.map +1 -0
- package/dist/core/rosterRequest.js +210 -0
- package/dist/core/rosterRequest.js.map +1 -0
- package/dist/core/types.d.ts +717 -7
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.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 +39 -44
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -1
- package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
- package/dist/react/hooks/useConvaiClient.js +15 -2
- package/dist/react/hooks/useConvaiClient.js.map +1 -1
- package/dist/utils/inlineMarkdown.d.ts +38 -0
- package/dist/utils/inlineMarkdown.d.ts.map +1 -0
- package/dist/utils/inlineMarkdown.js +106 -0
- package/dist/utils/inlineMarkdown.js.map +1 -0
- package/dist/vanilla/AudioRenderer.d.ts.map +1 -1
- package/dist/vanilla/AudioRenderer.js +6 -0
- package/dist/vanilla/AudioRenderer.js.map +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.js +71 -57
- package/dist/vanilla/ConvaiWidget.js.map +1 -1
- package/dist/vanilla/index.d.ts +2 -0
- package/dist/vanilla/index.d.ts.map +1 -1
- package/dist/vanilla/index.js +2 -0
- package/dist/vanilla/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { CharacterDraftBootstrapResult, CharacterVersionInfo, CharacterVersionList, CharacterVersionManagerOptions, CharacterVersionRawDiff, CharacterVersionSemanticDiff, CreateCharacterVersionOptions, DiscardCharacterDraftResult, ForkCharacterVersionResult, ResolveCharacterVersionOptions, ResolvedCharacterVersion, RevertCharacterChangeOptions, RevertCharacterChangeResult } from "./types.js";
|
|
2
|
+
import { type CharacterVersionSelector } from "./characterReference.js";
|
|
3
|
+
export declare const DEFAULT_CHARACTER_API_URL = "https://api2.convai.com";
|
|
4
|
+
/**
|
|
5
|
+
* Error raised when the Character REST platform answers with a non-2xx
|
|
6
|
+
* status. `status` carries the HTTP code; `detail` carries the parsed body
|
|
7
|
+
* (`{ detail: string }` for most failures, a validation list for 422).
|
|
8
|
+
*/
|
|
9
|
+
export declare class CharacterApiError extends Error {
|
|
10
|
+
readonly status: number;
|
|
11
|
+
readonly detail: unknown;
|
|
12
|
+
constructor(message: string, status: number, detail: unknown);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Authoring client for character versions.
|
|
16
|
+
*
|
|
17
|
+
* Every character has an editable **draft** and, once released, a set of
|
|
18
|
+
* immutable **tagged versions** (`1.0`, `1.1`, …). `latest` is a movable
|
|
19
|
+
* pointer that the runtime follows when a client connects without a
|
|
20
|
+
* selector. The lifecycle is:
|
|
21
|
+
*
|
|
22
|
+
* 1. edit the draft (Playground, `/character/update`, MCP);
|
|
23
|
+
* 2. {@link diff} the draft against `latest` to review the change;
|
|
24
|
+
* 3. {@link create} a tag from the draft, optionally making it latest;
|
|
25
|
+
* 4. {@link promote} an older tag to roll back, or {@link discardDraft} to
|
|
26
|
+
* throw unreleased edits away.
|
|
27
|
+
*
|
|
28
|
+
* Connect to any of these with `characterVersion` in `ConvaiConfig`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const versions = new CharacterVersionManager({
|
|
33
|
+
* apiKey: 'YOUR_API_KEY',
|
|
34
|
+
* characterId: 'YOUR_CHARACTER_ID',
|
|
35
|
+
* });
|
|
36
|
+
* const { has_unpublished_changes } = await versions.list();
|
|
37
|
+
* if (has_unpublished_changes) {
|
|
38
|
+
* await versions.create('1.1', { makeLatest: true });
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class CharacterVersionManager {
|
|
43
|
+
private readonly apiKey;
|
|
44
|
+
private readonly personalAccessToken;
|
|
45
|
+
private readonly baseUrl;
|
|
46
|
+
private readonly workspaceId;
|
|
47
|
+
readonly characterId: string;
|
|
48
|
+
constructor(options: CharacterVersionManagerOptions);
|
|
49
|
+
/** List released tags plus the current latest and draft revisions. */
|
|
50
|
+
list(): Promise<CharacterVersionList>;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve a reference to the configuration snapshot the runtime would run.
|
|
53
|
+
* Omit `version` to resolve the effective latest, or pass `draft`,
|
|
54
|
+
* `latest`, or a tag.
|
|
55
|
+
*/
|
|
56
|
+
resolve(version?: CharacterVersionSelector | null, options?: ResolveCharacterVersionOptions): Promise<ResolvedCharacterVersion>;
|
|
57
|
+
/**
|
|
58
|
+
* Give a character that predates versioning an editable draft. Safe to call
|
|
59
|
+
* repeatedly — `created` is false when a draft already existed.
|
|
60
|
+
*/
|
|
61
|
+
bootstrap(): Promise<CharacterDraftBootstrapResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Compare two references. Each side is `draft`, `latest`, or a tag.
|
|
64
|
+
* The raw view lists JSON paths; the semantic view groups them into
|
|
65
|
+
* labelled changes that {@link revert} can undo one at a time.
|
|
66
|
+
*/
|
|
67
|
+
diff(from: string, to: string, options?: {
|
|
68
|
+
view?: "raw";
|
|
69
|
+
}): Promise<CharacterVersionRawDiff>;
|
|
70
|
+
diff(from: string, to: string, options: {
|
|
71
|
+
view: "semantic";
|
|
72
|
+
}): Promise<CharacterVersionSemanticDiff>;
|
|
73
|
+
/**
|
|
74
|
+
* Release the current draft as an immutable tagged version.
|
|
75
|
+
* @param version - New tag, `major.minor` or `major.minor.patch`
|
|
76
|
+
*/
|
|
77
|
+
create(version: string, options?: CreateCharacterVersionOptions): Promise<CharacterVersionInfo>;
|
|
78
|
+
/** Point `latest` at an already released tag — the way to roll back. */
|
|
79
|
+
promote(version: string): Promise<CharacterVersionInfo>;
|
|
80
|
+
/**
|
|
81
|
+
* Discard every saved draft change and restore the draft from its released
|
|
82
|
+
* parent. Pass the draft revision you last saw so a concurrent edit is
|
|
83
|
+
* refused instead of silently thrown away.
|
|
84
|
+
*/
|
|
85
|
+
discardDraft(expectedDraftRevisionId: string): Promise<DiscardCharacterDraftResult>;
|
|
86
|
+
/** Undo one semantic change in the draft, identified by a semantic diff's `change_id`. */
|
|
87
|
+
revert(options: RevertCharacterChangeOptions): Promise<RevertCharacterChangeResult>;
|
|
88
|
+
/** Mark a tag deprecated, or restore it with `deprecated: false`. Deprecated tags stay connectable. */
|
|
89
|
+
deprecate(version: string, deprecated?: boolean): Promise<CharacterVersionInfo>;
|
|
90
|
+
/**
|
|
91
|
+
* Replace the draft with the contents of a released tag, to branch new work
|
|
92
|
+
* from an older version. `expectedDraftRevisionId` guards against clobbering
|
|
93
|
+
* a draft someone else just changed.
|
|
94
|
+
*/
|
|
95
|
+
fork(version: string, expectedDraftRevisionId?: string): Promise<ForkCharacterVersionResult>;
|
|
96
|
+
private assertSelector;
|
|
97
|
+
private assertTag;
|
|
98
|
+
private request;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=CharacterVersionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CharacterVersionManager.d.ts","sourceRoot":"","sources":["../../src/core/CharacterVersionManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAG7B,oBAAoB,EACpB,oBAAoB,EACpB,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,EAC1B,8BAA8B,EAC9B,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC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AAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;IASzF,0FAA0F;IACpF,MAAM,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAczF,uGAAuG;IACjG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAMlF;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,uBAAuB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IASlG,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,SAAS;YASH,OAAO;CA2CtB"}
|
|
@@ -0,0 +1,227 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CharacterVersionManager.js","sourceRoot":"","sources":["../../src/core/CharacterVersionManager.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GAExB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAI1C,YAAY,OAAe,EAAE,MAAc,EAAE,MAAe;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,uBAAuB;IAOlC,YAAY,O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KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,oEAAoE;IACpE,IAAI,OAAO,IAAI,EAAE,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC;IAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,MAAM;aACjB,GAAG,CAAC,CAAC,CAAoC,EAAE,EAAE,CAC5C,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACrD;aACA,MAAM,CAAC,OAAO,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI;QAAE,OAAO,QAAQ,MAAM,KAAK,IAAI,EAAE,CAAC;IACvE,OAAO,QAAQ,MAAM,EAAE,CAAC;AAC1B,CAAC","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,8 +1,10 @@
|
|
|
1
1
|
import { Room } from "livekit-client";
|
|
2
|
-
import { ConvaiConfig, ConvaiClientState, ChatMessage, IConvaiClient, AudioControls, VideoControls, ScreenShareControls, DynamicInfo, ContextUpdateOptions, UploadFileOptions, WebSocketSessionFactory, RespondModeUpdateOptions, UpdateSceneMetadataOptions, VisionStatusOptions, VisionTriggerOptions, ConnectionData, SendUserTextMessageOptions } from "./types.js";
|
|
2
|
+
import { ConvaiConfig, ConvaiClientState, ChatMessage, IConvaiClient, AudioControls, VideoControls, ScreenShareControls, DynamicInfo, ContextUpdateOptions, UploadFileOptions, WebSocketSessionFactory, RespondModeUpdateOptions, UpdateSceneMetadataOptions, VisionStatusOptions, VisionTriggerOptions, ConnectionData, SendUserTextMessageOptions, ConvaiCharacterInstance, ConvaiRoomSession, JoinRoomOptions, ActiveCharacterChange, CharacterRosterChange, UpdateCharacterRosterOptions, AppendMessageOptions } from "./types.js";
|
|
3
3
|
import { EventEmitter } from "./EventEmitter.js";
|
|
4
4
|
import { BlendshapeQueue } from "./BlendshapeQueue.js";
|
|
5
5
|
import { MemoryManager } from "./MemoryManager.js";
|
|
6
|
+
import { CharacterVersionManager } from "./CharacterVersionManager.js";
|
|
7
|
+
import { type CharacterVersionSelector } from "./characterReference.js";
|
|
6
8
|
/**
|
|
7
9
|
* Main Convai client class for managing AI voice assistant connections
|
|
8
10
|
* Provides complete interface for connecting to Convai's voice assistants,
|
|
@@ -46,7 +48,16 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
46
48
|
private _apiKey;
|
|
47
49
|
private _authToken;
|
|
48
50
|
private _characterId;
|
|
51
|
+
private _characterVersion;
|
|
52
|
+
private _characterReference;
|
|
53
|
+
private _characterVersionManager;
|
|
54
|
+
private _characterVersionManagerKey;
|
|
49
55
|
private _characterSessionId;
|
|
56
|
+
/** Roster state for multi-character rooms. Empty for single-character sessions. */
|
|
57
|
+
private _roster;
|
|
58
|
+
/** Roster commands awaiting their ack, keyed by command id. */
|
|
59
|
+
private _pendingRosterCommands;
|
|
60
|
+
private _rosterCommandSeq;
|
|
50
61
|
private _isBotReady;
|
|
51
62
|
private _participantSid;
|
|
52
63
|
private _audioSettings;
|
|
@@ -88,10 +99,39 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
88
99
|
get apiKey(): string | null;
|
|
89
100
|
get authToken(): string | null;
|
|
90
101
|
get characterId(): string | null;
|
|
102
|
+
get characterVersion(): CharacterVersionSelector | null;
|
|
103
|
+
get characterReference(): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Character version manager for the configured character. Built from the
|
|
106
|
+
* live connection when there is one, otherwise from the stored config, so
|
|
107
|
+
* versions can be listed and released before connecting. Null without an
|
|
108
|
+
* API key (the Character REST platform does not accept realtime auth tokens).
|
|
109
|
+
*/
|
|
110
|
+
get characterVersions(): CharacterVersionManager | null;
|
|
91
111
|
get room(): Room;
|
|
92
112
|
get chatMessages(): ChatMessage[];
|
|
93
113
|
get userTranscription(): string;
|
|
94
114
|
get characterSessionId(): string | null;
|
|
115
|
+
/**
|
|
116
|
+
* Server-owned snapshot of a multi-character room, or null for a
|
|
117
|
+
* single-character session. Carries the room id, epochs and roster.
|
|
118
|
+
*/
|
|
119
|
+
get roomSession(): ConvaiRoomSession | null;
|
|
120
|
+
/**
|
|
121
|
+
* Character instances in a multi-character room, in roster order. Empty for a
|
|
122
|
+
* single-character session, so `length` distinguishes the two.
|
|
123
|
+
*/
|
|
124
|
+
get characters(): ConvaiCharacterInstance[];
|
|
125
|
+
/** Membership currently receiving user turns, or null. */
|
|
126
|
+
get activeMembershipId(): string | null;
|
|
127
|
+
/**
|
|
128
|
+
* Start or stop the server streaming per-turn usage/cost breakdowns as
|
|
129
|
+
* `usageUpdate` events. Informational only; server-side usage tracking and
|
|
130
|
+
* billing are unaffected either way.
|
|
131
|
+
*/
|
|
132
|
+
toggleUsageUpdates(enabled: boolean): void;
|
|
133
|
+
/** Insert a transcript line locally. Nothing is sent; nothing is billed. */
|
|
134
|
+
appendMessage(message: AppendMessageOptions): ChatMessage;
|
|
95
135
|
get isBotReady(): boolean;
|
|
96
136
|
get audioControls(): AudioControls;
|
|
97
137
|
get videoControls(): VideoControls;
|
|
@@ -147,6 +187,74 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
147
187
|
* await client.connectWithConnectionData(data)
|
|
148
188
|
*/
|
|
149
189
|
connectWithConnectionData(data: ConnectionData, config?: ConvaiConfig): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* How long to wait for a roster command's ack.
|
|
192
|
+
*
|
|
193
|
+
* A timeout is *not* a failure. Every character participant observes the
|
|
194
|
+
* broadcast and duplicate forwards are response-suppressed after one actor
|
|
195
|
+
* answers, so a lost ack is an expected outcome. The contract's rule is to
|
|
196
|
+
* treat it as unknown and reconcile from the next authoritative snapshot,
|
|
197
|
+
* which is what the rejection below tells the caller to do.
|
|
198
|
+
*/
|
|
199
|
+
private static readonly ROSTER_COMMAND_TIMEOUT_MS;
|
|
200
|
+
/** Correlate roster acks back to the promise that issued the command. */
|
|
201
|
+
private _handleRosterServerResponse;
|
|
202
|
+
/**
|
|
203
|
+
* Settle every in-flight roster command.
|
|
204
|
+
*
|
|
205
|
+
* Without this a caller who disconnects mid-command keeps a live 10s timer
|
|
206
|
+
* and gets a rejection long after the session ended -- an unhandled rejection
|
|
207
|
+
* if they stopped awaiting when they tore the client down. The roster is
|
|
208
|
+
* reset alongside, so the command could not be applied meaningfully anyway.
|
|
209
|
+
*/
|
|
210
|
+
private _failPendingRosterCommands;
|
|
211
|
+
private _pushRosterState;
|
|
212
|
+
/** Publish a roster command and settle when its ack arrives. */
|
|
213
|
+
private _sendRosterCommand;
|
|
214
|
+
/**
|
|
215
|
+
* Route subsequent user turns to a different character instance.
|
|
216
|
+
*
|
|
217
|
+
* Pass null to close every gate, so no member consumes the user until a
|
|
218
|
+
* target is set again.
|
|
219
|
+
*/
|
|
220
|
+
setInteractionTarget(membershipId: string | null): Promise<ActiveCharacterChange>;
|
|
221
|
+
/** Add or remove character instances on a live room, without reconnecting. */
|
|
222
|
+
updateCharacterRoster(options: UpdateCharacterRosterOptions): Promise<CharacterRosterChange>;
|
|
223
|
+
/** Default bounded retry while a roster room is still provisioning. */
|
|
224
|
+
private static readonly ROSTER_RETRY_ATTEMPTS;
|
|
225
|
+
private static readonly ROSTER_RETRY_INITIAL_MS;
|
|
226
|
+
/**
|
|
227
|
+
* Run a room request, retrying only the conflicts that mean "still working".
|
|
228
|
+
*
|
|
229
|
+
* The runtime answers a create that collides with an in-flight identical
|
|
230
|
+
* create with 409 `ROSTER_PROVISIONING_IN_PROGRESS`, and the documented
|
|
231
|
+
* recovery is to retry the same key with bounded backoff. Left to callers,
|
|
232
|
+
* every integration reimplements that, usually without a cap. The payload is
|
|
233
|
+
* replayed verbatim -- changing it would turn the retry into a fingerprint
|
|
234
|
+
* mismatch.
|
|
235
|
+
*/
|
|
236
|
+
private _withProvisioningRetry;
|
|
237
|
+
/**
|
|
238
|
+
* Join a multi-character room that already exists.
|
|
239
|
+
*
|
|
240
|
+
* A join supplies a locator and the joining human, and nothing else: the
|
|
241
|
+
* roster is server-owned, so resending topology is rejected. It never spawns,
|
|
242
|
+
* removes or repairs a character -- only room creation does that.
|
|
243
|
+
*
|
|
244
|
+
* Capacity counts distinct speakers derived from `endUserId`, and defaults to
|
|
245
|
+
* one, so raise `maxNumParticipants` at creation before expecting a second
|
|
246
|
+
* human to get in.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```ts
|
|
250
|
+
* const client = new ConvaiClient({ apiKey: 'YOUR_API_KEY' })
|
|
251
|
+
* await client.joinRoom({
|
|
252
|
+
* roomSessionId: 'the-room-session-id',
|
|
253
|
+
* endUserId: 'player-99',
|
|
254
|
+
* })
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
joinRoom(options: JoinRoomOptions): Promise<void>;
|
|
150
258
|
/**
|
|
151
259
|
* Add default URL, apply RTVI-logging config, and validate that either an
|
|
152
260
|
* API key or auth token plus a character ID are present.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvaiClient.d.ts","sourceRoot":"","sources":["../../src/core/ConvaiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAML,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EAEX,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EAIjB,uBAAuB,EACvB,wBAAwB,EAExB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EAGpB,cAAc,EACd,0BAA0B,
|
|
1
|
+
{"version":3,"file":"ConvaiClient.d.ts","sourceRoot":"","sources":["../../src/core/ConvaiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAML,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EAEX,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EAIjB,uBAAuB,EACvB,wBAAwB,EAExB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EAGpB,cAAc,EACd,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EAEf,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAE5B,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAgBjB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAqC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,YAAa,SAAQ,YAAa,YA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