@corti/sdk 0.7.0 → 0.8.0-rc.1
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 +2 -0
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/stream/client/Client.js +1 -1
- package/dist/cjs/api/resources/stream/client/Socket.js +3 -1
- package/dist/cjs/api/resources/transcribe/client/Client.js +1 -1
- package/dist/cjs/api/resources/transcribe/client/Socket.js +3 -1
- package/dist/cjs/api/types/AgentsMcpServerAuthorizationType.d.ts +3 -2
- package/dist/cjs/api/types/AgentsMcpServerAuthorizationType.js +2 -1
- package/dist/cjs/custom/CortiAuth.d.ts +29 -6
- package/dist/cjs/custom/CortiAuth.js +10 -4
- package/dist/cjs/custom/CortiClient.d.ts +16 -2
- package/dist/cjs/custom/CortiClient.js +24 -21
- package/dist/cjs/custom/CortiWebSocketProxyClient.d.ts +14 -0
- package/dist/cjs/custom/CortiWebSocketProxyClient.js +22 -0
- package/dist/cjs/custom/CustomStream.d.ts +8 -1
- package/dist/cjs/custom/CustomStream.js +13 -3
- package/dist/cjs/custom/CustomStreamSocket.d.ts +5 -0
- package/dist/cjs/custom/CustomStreamSocket.js +6 -0
- package/dist/cjs/custom/CustomTranscribe.d.ts +8 -1
- package/dist/cjs/custom/CustomTranscribe.js +13 -3
- package/dist/cjs/custom/CustomTranscribeSocket.d.ts +5 -0
- package/dist/cjs/custom/CustomTranscribeSocket.js +6 -0
- package/dist/cjs/custom/proxy/CustomProxyStream.d.ts +24 -0
- package/dist/cjs/custom/proxy/CustomProxyStream.js +57 -0
- package/dist/cjs/custom/proxy/CustomProxyTranscribe.d.ts +24 -0
- package/dist/cjs/custom/proxy/CustomProxyTranscribe.js +56 -0
- package/dist/cjs/custom/utils/getEnvironmentFromString.d.ts +1 -1
- package/dist/cjs/custom/utils/getEnvironmentFromString.js +1 -1
- package/dist/cjs/custom/utils/resolveClientOptions.js +31 -10
- package/dist/cjs/custom/utils/tokenRequest.d.ts +1 -0
- package/dist/cjs/custom/utils/tokenRequest.js +4 -1
- package/dist/cjs/environments.d.ts +2 -2
- package/dist/cjs/environments.js +2 -2
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/serialization/types/AgentsMcpServerAuthorizationType.d.ts +1 -1
- package/dist/cjs/serialization/types/AgentsMcpServerAuthorizationType.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/stream/client/Client.mjs +1 -1
- package/dist/esm/api/resources/stream/client/Socket.mjs +3 -1
- package/dist/esm/api/resources/transcribe/client/Client.mjs +1 -1
- package/dist/esm/api/resources/transcribe/client/Socket.mjs +3 -1
- package/dist/esm/api/types/AgentsMcpServerAuthorizationType.d.mts +3 -2
- package/dist/esm/api/types/AgentsMcpServerAuthorizationType.mjs +2 -1
- package/dist/esm/custom/CortiAuth.d.mts +29 -6
- package/dist/esm/custom/CortiAuth.mjs +10 -4
- package/dist/esm/custom/CortiClient.d.mts +16 -2
- package/dist/esm/custom/CortiClient.mjs +24 -21
- package/dist/esm/custom/CortiWebSocketProxyClient.d.mts +14 -0
- package/dist/esm/custom/CortiWebSocketProxyClient.mjs +18 -0
- package/dist/esm/custom/CustomStream.d.mts +8 -1
- package/dist/esm/custom/CustomStream.mjs +13 -3
- package/dist/esm/custom/CustomStreamSocket.d.mts +5 -0
- package/dist/esm/custom/CustomStreamSocket.mjs +6 -0
- package/dist/esm/custom/CustomTranscribe.d.mts +8 -1
- package/dist/esm/custom/CustomTranscribe.mjs +13 -3
- package/dist/esm/custom/CustomTranscribeSocket.d.mts +5 -0
- package/dist/esm/custom/CustomTranscribeSocket.mjs +6 -0
- package/dist/esm/custom/proxy/CustomProxyStream.d.mts +24 -0
- package/dist/esm/custom/proxy/CustomProxyStream.mjs +20 -0
- package/dist/esm/custom/proxy/CustomProxyTranscribe.d.mts +24 -0
- package/dist/esm/custom/proxy/CustomProxyTranscribe.mjs +19 -0
- package/dist/esm/custom/utils/getEnvironmentFromString.d.mts +1 -1
- package/dist/esm/custom/utils/getEnvironmentFromString.mjs +1 -1
- package/dist/esm/custom/utils/resolveClientOptions.mjs +31 -10
- package/dist/esm/custom/utils/tokenRequest.d.mts +1 -0
- package/dist/esm/custom/utils/tokenRequest.mjs +4 -1
- package/dist/esm/environments.d.mts +2 -2
- package/dist/esm/environments.mjs +2 -2
- package/dist/esm/index.d.mts +4 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/serialization/types/AgentsMcpServerAuthorizationType.d.mts +1 -1
- package/dist/esm/serialization/types/AgentsMcpServerAuthorizationType.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -68,56 +68,59 @@ export class CortiClient {
|
|
|
68
68
|
"User-Agent": `@corti/sdk/${SDK_VERSION}`,
|
|
69
69
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
70
70
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
71
|
-
}, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: "clientId" in _options.auth ? _options.auth.clientId : undefined, clientSecret: "clientSecret" in _options.auth ? _options.auth.clientSecret : undefined, token: "accessToken" in _options.auth ? _options.auth.accessToken : undefined, tenantName, environment: getEnvironment(environment) });
|
|
71
|
+
}, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: _options.auth && "clientId" in _options.auth ? _options.auth.clientId : undefined, clientSecret: _options.auth && "clientSecret" in _options.auth ? _options.auth.clientSecret : undefined, token: _options.auth && "accessToken" in _options.auth ? _options.auth.accessToken : undefined, tenantName, environment: getEnvironment(environment) });
|
|
72
72
|
/**
|
|
73
73
|
* Patch: if `clientId` is provided, use OAuthTokenProvider, otherwise use BearerProvider
|
|
74
|
+
* Only create token provider when auth is provided
|
|
74
75
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
if (_options.auth) {
|
|
77
|
+
this._oauthTokenProvider =
|
|
78
|
+
"clientId" in _options.auth
|
|
79
|
+
? new core.OAuthTokenProvider({
|
|
80
|
+
clientId: _options.auth.clientId,
|
|
81
|
+
clientSecret: _options.auth.clientSecret,
|
|
82
|
+
/**
|
|
83
|
+
* Patch: provide whole `options` object to the Auth client, since it depends on both tenantName and environment
|
|
84
|
+
*/
|
|
85
|
+
authClient: new Auth(this._options),
|
|
86
|
+
})
|
|
87
|
+
: new RefreshBearerProvider(Object.assign(Object.assign({}, _options.auth), { initialTokenResponse }));
|
|
88
|
+
}
|
|
86
89
|
}
|
|
87
90
|
get interactions() {
|
|
88
91
|
var _a;
|
|
89
|
-
return ((_a = this._interactions) !== null && _a !== void 0 ? _a : (this._interactions = new Interactions(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
92
|
+
return ((_a = this._interactions) !== null && _a !== void 0 ? _a : (this._interactions = new Interactions(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
90
93
|
}
|
|
91
94
|
get recordings() {
|
|
92
95
|
var _a;
|
|
93
|
-
return ((_a = this._recordings) !== null && _a !== void 0 ? _a : (this._recordings = new Recordings(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
96
|
+
return ((_a = this._recordings) !== null && _a !== void 0 ? _a : (this._recordings = new Recordings(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
94
97
|
}
|
|
95
98
|
get transcripts() {
|
|
96
99
|
var _a;
|
|
97
|
-
return ((_a = this._transcripts) !== null && _a !== void 0 ? _a : (this._transcripts = new Transcripts(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
100
|
+
return ((_a = this._transcripts) !== null && _a !== void 0 ? _a : (this._transcripts = new Transcripts(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
98
101
|
}
|
|
99
102
|
get facts() {
|
|
100
103
|
var _a;
|
|
101
|
-
return ((_a = this._facts) !== null && _a !== void 0 ? _a : (this._facts = new Facts(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
104
|
+
return ((_a = this._facts) !== null && _a !== void 0 ? _a : (this._facts = new Facts(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
102
105
|
}
|
|
103
106
|
get documents() {
|
|
104
107
|
var _a;
|
|
105
|
-
return ((_a = this._documents) !== null && _a !== void 0 ? _a : (this._documents = new Documents(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
108
|
+
return ((_a = this._documents) !== null && _a !== void 0 ? _a : (this._documents = new Documents(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
106
109
|
}
|
|
107
110
|
get templates() {
|
|
108
111
|
var _a;
|
|
109
|
-
return ((_a = this._templates) !== null && _a !== void 0 ? _a : (this._templates = new Templates(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
112
|
+
return ((_a = this._templates) !== null && _a !== void 0 ? _a : (this._templates = new Templates(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
110
113
|
}
|
|
111
114
|
get agents() {
|
|
112
115
|
var _a;
|
|
113
|
-
return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Agents(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
116
|
+
return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Agents(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
114
117
|
}
|
|
115
118
|
get stream() {
|
|
116
119
|
var _a;
|
|
117
|
-
return ((_a = this._stream) !== null && _a !== void 0 ? _a : (this._stream = new Stream(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
120
|
+
return ((_a = this._stream) !== null && _a !== void 0 ? _a : (this._stream = new Stream(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
118
121
|
}
|
|
119
122
|
get transcribe() {
|
|
120
123
|
var _a;
|
|
121
|
-
return ((_a = this._transcribe) !== null && _a !== void 0 ? _a : (this._transcribe = new Transcribe(Object.assign(Object.assign({}, this._options), { token: () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) }))));
|
|
124
|
+
return ((_a = this._transcribe) !== null && _a !== void 0 ? _a : (this._transcribe = new Transcribe(Object.assign(Object.assign({}, this._options), { token: this._oauthTokenProvider ? () => __awaiter(this, void 0, void 0, function* () { return yield this._oauthTokenProvider.getToken(); }) : undefined }))));
|
|
122
125
|
}
|
|
123
126
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patch: Lightweight proxy client with only WebSocket resources (stream and transcribe).
|
|
3
|
+
* Use this when you need direct WebSocket connections through your own proxy backend.
|
|
4
|
+
*
|
|
5
|
+
* No environment or tenantName required - proxy is required in connect().
|
|
6
|
+
*/
|
|
7
|
+
import { CustomProxyStream } from "./proxy/CustomProxyStream.mjs";
|
|
8
|
+
import { CustomProxyTranscribe } from "./proxy/CustomProxyTranscribe.mjs";
|
|
9
|
+
export declare class CortiWebSocketProxyClient {
|
|
10
|
+
private static _stream;
|
|
11
|
+
private static _transcribe;
|
|
12
|
+
static get stream(): CustomProxyStream;
|
|
13
|
+
static get transcribe(): CustomProxyTranscribe;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patch: Lightweight proxy client with only WebSocket resources (stream and transcribe).
|
|
3
|
+
* Use this when you need direct WebSocket connections through your own proxy backend.
|
|
4
|
+
*
|
|
5
|
+
* No environment or tenantName required - proxy is required in connect().
|
|
6
|
+
*/
|
|
7
|
+
import { CustomProxyStream } from "./proxy/CustomProxyStream.mjs";
|
|
8
|
+
import { CustomProxyTranscribe } from "./proxy/CustomProxyTranscribe.mjs";
|
|
9
|
+
export class CortiWebSocketProxyClient {
|
|
10
|
+
static get stream() {
|
|
11
|
+
var _a;
|
|
12
|
+
return ((_a = this._stream) !== null && _a !== void 0 ? _a : (this._stream = new CustomProxyStream()));
|
|
13
|
+
}
|
|
14
|
+
static get transcribe() {
|
|
15
|
+
var _a;
|
|
16
|
+
return ((_a = this._transcribe) !== null && _a !== void 0 ? _a : (this._transcribe = new CustomProxyTranscribe()));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -13,8 +13,15 @@ import { StreamSocket } from "./CustomStreamSocket.mjs";
|
|
|
13
13
|
export declare class Stream extends FernStream {
|
|
14
14
|
/**
|
|
15
15
|
* Patch: use custom connect method to support passing _options parameters
|
|
16
|
+
* Added optional `proxy` parameter for direct WebSocket connection (proxy scenarios)
|
|
16
17
|
*/
|
|
17
|
-
connect({ configuration, ...args }: Omit<FernStream.ConnectArgs, "token" | "tenantName"> & {
|
|
18
|
+
connect({ configuration, proxy, ...args }: Omit<FernStream.ConnectArgs, "token" | "tenantName"> & {
|
|
18
19
|
configuration?: api.StreamConfig;
|
|
20
|
+
/** Patch: Proxy connection options - bypasses normal URL construction */
|
|
21
|
+
proxy?: {
|
|
22
|
+
url: string;
|
|
23
|
+
protocols?: string[];
|
|
24
|
+
queryParameters?: Record<string, string>;
|
|
25
|
+
};
|
|
19
26
|
}): Promise<StreamSocket>;
|
|
20
27
|
}
|
|
@@ -33,15 +33,25 @@ import { StreamSocket } from "./CustomStreamSocket.mjs";
|
|
|
33
33
|
export class Stream extends FernStream {
|
|
34
34
|
/**
|
|
35
35
|
* Patch: use custom connect method to support passing _options parameters
|
|
36
|
+
* Added optional `proxy` parameter for direct WebSocket connection (proxy scenarios)
|
|
36
37
|
*/
|
|
37
38
|
connect(_a) {
|
|
38
39
|
const _super = Object.create(null, {
|
|
39
40
|
connect: { get: () => super.connect }
|
|
40
41
|
});
|
|
41
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
const
|
|
43
|
+
var _b, _c;
|
|
44
|
+
var { configuration, proxy } = _a, args = __rest(_a, ["configuration", "proxy"]);
|
|
45
|
+
const socket = proxy
|
|
46
|
+
? new core.ReconnectingWebSocket({
|
|
47
|
+
url: proxy.url,
|
|
48
|
+
protocols: proxy.protocols || [],
|
|
49
|
+
queryParameters: proxy.queryParameters || {},
|
|
50
|
+
headers: args.headers || {},
|
|
51
|
+
options: { debug: (_b = args.debug) !== null && _b !== void 0 ? _b : false, maxRetries: (_c = args.reconnectAttempts) !== null && _c !== void 0 ? _c : 30 },
|
|
52
|
+
})
|
|
53
|
+
: (yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || "", tenantName: yield core.Supplier.get(this._options.tenantName) }))).socket;
|
|
54
|
+
const ws = new StreamSocket({ socket });
|
|
45
55
|
if (!configuration) {
|
|
46
56
|
return ws;
|
|
47
57
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Patch: file patches disability of auto-generating binary data methods for sending data to the socket
|
|
3
3
|
*/
|
|
4
4
|
import { StreamSocket as FernStreamSocket } from "../api/resources/stream/client/Socket.mjs";
|
|
5
|
+
import { ReconnectingWebSocket } from "../core/index.mjs";
|
|
5
6
|
export declare class StreamSocket extends FernStreamSocket {
|
|
6
7
|
sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void;
|
|
7
8
|
/**
|
|
@@ -12,4 +13,8 @@ export declare class StreamSocket extends FernStreamSocket {
|
|
|
12
13
|
* Patch: added ability to remove event handlers
|
|
13
14
|
*/
|
|
14
15
|
off<T extends keyof FernStreamSocket.EventHandlers>(event: T, callback?: FernStreamSocket.EventHandlers[T]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Patch: expose underlying socket send method for direct access
|
|
18
|
+
*/
|
|
19
|
+
send(data: ReconnectingWebSocket.Message): void;
|
|
15
20
|
}
|
|
@@ -13,8 +13,15 @@ import { TranscribeSocket } from "./CustomTranscribeSocket.mjs";
|
|
|
13
13
|
export declare class Transcribe extends FernTranscribe {
|
|
14
14
|
/**
|
|
15
15
|
* Patch: use custom connect method to support passing _options parameters
|
|
16
|
+
* Added optional `proxy` parameter for direct WebSocket connection (proxy scenarios)
|
|
16
17
|
*/
|
|
17
|
-
connect({ configuration, ...args }?: Omit<FernTranscribe.ConnectArgs, "token" | "tenantName"> & {
|
|
18
|
+
connect({ configuration, proxy, ...args }?: Omit<FernTranscribe.ConnectArgs, "token" | "tenantName"> & {
|
|
18
19
|
configuration?: api.TranscribeConfig;
|
|
20
|
+
/** Patch: Proxy connection options - bypasses normal URL construction */
|
|
21
|
+
proxy?: {
|
|
22
|
+
url: string;
|
|
23
|
+
protocols?: string[];
|
|
24
|
+
queryParameters?: Record<string, string>;
|
|
25
|
+
};
|
|
19
26
|
}): Promise<TranscribeSocket>;
|
|
20
27
|
}
|
|
@@ -33,15 +33,25 @@ import { TranscribeSocket } from "./CustomTranscribeSocket.mjs";
|
|
|
33
33
|
export class Transcribe extends FernTranscribe {
|
|
34
34
|
/**
|
|
35
35
|
* Patch: use custom connect method to support passing _options parameters
|
|
36
|
+
* Added optional `proxy` parameter for direct WebSocket connection (proxy scenarios)
|
|
36
37
|
*/
|
|
37
38
|
connect() {
|
|
38
39
|
const _super = Object.create(null, {
|
|
39
40
|
connect: { get: () => super.connect }
|
|
40
41
|
});
|
|
41
42
|
return __awaiter(this, arguments, void 0, function* (_a = {}) {
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
const
|
|
43
|
+
var _b, _c;
|
|
44
|
+
var { configuration, proxy } = _a, args = __rest(_a, ["configuration", "proxy"]);
|
|
45
|
+
const socket = proxy
|
|
46
|
+
? new core.ReconnectingWebSocket({
|
|
47
|
+
url: proxy.url,
|
|
48
|
+
protocols: proxy.protocols || [],
|
|
49
|
+
queryParameters: proxy.queryParameters || {},
|
|
50
|
+
headers: args.headers || {},
|
|
51
|
+
options: { debug: (_b = args.debug) !== null && _b !== void 0 ? _b : false, maxRetries: (_c = args.reconnectAttempts) !== null && _c !== void 0 ? _c : 30 },
|
|
52
|
+
})
|
|
53
|
+
: (yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || "", tenantName: yield core.Supplier.get(this._options.tenantName) }))).socket;
|
|
54
|
+
const ws = new TranscribeSocket({ socket });
|
|
45
55
|
if (!configuration) {
|
|
46
56
|
return ws;
|
|
47
57
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Patch: file patches disability of auto-generating binary data methods for sending data to the socket
|
|
3
3
|
*/
|
|
4
4
|
import { TranscribeSocket as FernTranscribeSocket } from "../api/resources/transcribe/client/Socket.mjs";
|
|
5
|
+
import { ReconnectingWebSocket } from "../core/index.mjs";
|
|
5
6
|
export declare class TranscribeSocket extends FernTranscribeSocket {
|
|
6
7
|
sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void;
|
|
7
8
|
/**
|
|
@@ -12,4 +13,8 @@ export declare class TranscribeSocket extends FernTranscribeSocket {
|
|
|
12
13
|
* Patch: added ability to remove event handlers
|
|
13
14
|
*/
|
|
14
15
|
off<T extends keyof FernTranscribeSocket.EventHandlers>(event: T, callback?: FernTranscribeSocket.EventHandlers[T]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Patch: expose underlying socket send method for direct access
|
|
18
|
+
*/
|
|
19
|
+
send(data: ReconnectingWebSocket.Message): void;
|
|
15
20
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patch: Proxy-specific Stream wrapper that enforces `proxy` as required.
|
|
3
|
+
*
|
|
4
|
+
* Reuses the underlying CustomStream class to preserve the logic we added on top
|
|
5
|
+
* of generated sockets (e.g., sending configuration messages, handling responses).
|
|
6
|
+
*/
|
|
7
|
+
import * as api from "../../api/index.mjs";
|
|
8
|
+
import { StreamSocket } from "../CustomStreamSocket.mjs";
|
|
9
|
+
export type ProxyOptions = {
|
|
10
|
+
url: string;
|
|
11
|
+
protocols?: string[];
|
|
12
|
+
queryParameters?: Record<string, string>;
|
|
13
|
+
};
|
|
14
|
+
export declare class CustomProxyStream {
|
|
15
|
+
private _stream;
|
|
16
|
+
constructor();
|
|
17
|
+
connect(args: {
|
|
18
|
+
proxy: ProxyOptions;
|
|
19
|
+
configuration?: api.StreamConfig;
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
reconnectAttempts?: number;
|
|
23
|
+
}): Promise<StreamSocket>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patch: Proxy-specific Stream wrapper that enforces `proxy` as required.
|
|
3
|
+
*
|
|
4
|
+
* Reuses the underlying CustomStream class to preserve the logic we added on top
|
|
5
|
+
* of generated sockets (e.g., sending configuration messages, handling responses).
|
|
6
|
+
*/
|
|
7
|
+
import * as environments from "../../environments.mjs";
|
|
8
|
+
import { Stream } from "../CustomStream.mjs";
|
|
9
|
+
export class CustomProxyStream {
|
|
10
|
+
constructor() {
|
|
11
|
+
this._stream = new Stream({
|
|
12
|
+
environment: environments.CortiEnvironment.Eu,
|
|
13
|
+
tenantName: "",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
connect(args) {
|
|
17
|
+
// id is not used in proxy mode, but required by the underlying type
|
|
18
|
+
return this._stream.connect(Object.assign(Object.assign({}, args), { id: "" }));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patch: Proxy-specific Transcribe wrapper that enforces `proxy` as required.
|
|
3
|
+
*
|
|
4
|
+
* Reuses the underlying CustomTranscribe class to preserve the logic we added on top
|
|
5
|
+
* of generated sockets (e.g., sending configuration messages, handling responses).
|
|
6
|
+
*/
|
|
7
|
+
import * as api from "../../api/index.mjs";
|
|
8
|
+
import { TranscribeSocket } from "../CustomTranscribeSocket.mjs";
|
|
9
|
+
export type ProxyOptions = {
|
|
10
|
+
url: string;
|
|
11
|
+
protocols?: string[];
|
|
12
|
+
queryParameters?: Record<string, string>;
|
|
13
|
+
};
|
|
14
|
+
export declare class CustomProxyTranscribe {
|
|
15
|
+
private _transcribe;
|
|
16
|
+
constructor();
|
|
17
|
+
connect(args: {
|
|
18
|
+
proxy: ProxyOptions;
|
|
19
|
+
configuration?: api.TranscribeConfig;
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
reconnectAttempts?: number;
|
|
23
|
+
}): Promise<TranscribeSocket>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patch: Proxy-specific Transcribe wrapper that enforces `proxy` as required.
|
|
3
|
+
*
|
|
4
|
+
* Reuses the underlying CustomTranscribe class to preserve the logic we added on top
|
|
5
|
+
* of generated sockets (e.g., sending configuration messages, handling responses).
|
|
6
|
+
*/
|
|
7
|
+
import * as environments from "../../environments.mjs";
|
|
8
|
+
import { Transcribe } from "../CustomTranscribe.mjs";
|
|
9
|
+
export class CustomProxyTranscribe {
|
|
10
|
+
constructor() {
|
|
11
|
+
this._transcribe = new Transcribe({
|
|
12
|
+
environment: environments.CortiEnvironment.Eu,
|
|
13
|
+
tenantName: "",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
connect(args) {
|
|
17
|
+
return this._transcribe.connect(args);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -2,4 +2,4 @@ import * as core from "../../core/index.mjs";
|
|
|
2
2
|
import * as environments from "../../environments.mjs";
|
|
3
3
|
export type Environment = CortiInternalEnvironment | string;
|
|
4
4
|
export type CortiInternalEnvironment = core.Supplier<environments.CortiEnvironment | environments.CortiEnvironmentUrls>;
|
|
5
|
-
export declare function getEnvironment(environment
|
|
5
|
+
export declare function getEnvironment(environment?: Environment): CortiInternalEnvironment;
|
|
@@ -12,7 +12,7 @@ import { decodeToken } from "./decodeToken.mjs";
|
|
|
12
12
|
import { ParseError } from "../../core/schemas/index.mjs";
|
|
13
13
|
import { getEnvironment } from "./getEnvironmentFromString.mjs";
|
|
14
14
|
function isClientCredentialsOptions(options) {
|
|
15
|
-
return "clientId" in options.auth;
|
|
15
|
+
return !!options.auth && "clientId" in options.auth;
|
|
16
16
|
}
|
|
17
17
|
export function resolveClientOptions(options) {
|
|
18
18
|
if (isClientCredentialsOptions(options)) {
|
|
@@ -21,9 +21,22 @@ export function resolveClientOptions(options) {
|
|
|
21
21
|
environment: options.environment,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
// When auth is not provided (baseUrl-only or environment-object scenario), use provided values or defaults
|
|
25
|
+
if (!options.auth) {
|
|
26
|
+
return {
|
|
27
|
+
tenantName: options.tenantName || "",
|
|
28
|
+
environment: options.environment || "",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if ("accessToken" in options.auth) {
|
|
32
|
+
const decoded = decodeToken(options.auth.accessToken || "");
|
|
33
|
+
/**
|
|
34
|
+
* Do not throw an error when we have some proxying:
|
|
35
|
+
* baseUrl is set
|
|
36
|
+
* or
|
|
37
|
+
* environment is explicitly provided (not string-generated)
|
|
38
|
+
*/
|
|
39
|
+
if (!decoded && !options.baseUrl && typeof options.environment !== "object") {
|
|
27
40
|
throw new ParseError([
|
|
28
41
|
{
|
|
29
42
|
path: ["auth", "accessToken"],
|
|
@@ -32,8 +45,8 @@ export function resolveClientOptions(options) {
|
|
|
32
45
|
]);
|
|
33
46
|
}
|
|
34
47
|
return {
|
|
35
|
-
tenantName: options.tenantName || decoded.tenantName,
|
|
36
|
-
environment: options.environment || decoded.environment,
|
|
48
|
+
tenantName: options.tenantName || (decoded === null || decoded === void 0 ? void 0 : decoded.tenantName) || "",
|
|
49
|
+
environment: options.environment || (decoded === null || decoded === void 0 ? void 0 : decoded.environment) || "",
|
|
37
50
|
};
|
|
38
51
|
}
|
|
39
52
|
/**
|
|
@@ -46,10 +59,18 @@ export function resolveClientOptions(options) {
|
|
|
46
59
|
environment: options.environment,
|
|
47
60
|
};
|
|
48
61
|
}
|
|
62
|
+
// At this point, auth exists and has refreshAccessToken (BearerOptions without accessToken)
|
|
63
|
+
const auth = options.auth;
|
|
49
64
|
const tokenResponsePromise = (() => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const tokenResponse = yield core.Supplier.get(
|
|
65
|
+
const tokenResponse = yield core.Supplier.get(auth.refreshAccessToken);
|
|
51
66
|
const decoded = decodeToken(tokenResponse.accessToken);
|
|
52
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Do not throw an error when we have some proxying:
|
|
69
|
+
* baseUrl is set
|
|
70
|
+
* or
|
|
71
|
+
* environment is explicitly provided (not string-generated)
|
|
72
|
+
*/
|
|
73
|
+
if (!decoded && !options.baseUrl && typeof options.environment !== "object") {
|
|
53
74
|
throw new ParseError([
|
|
54
75
|
{
|
|
55
76
|
path: ["auth", "refreshAccessToken"],
|
|
@@ -59,8 +80,8 @@ export function resolveClientOptions(options) {
|
|
|
59
80
|
}
|
|
60
81
|
return {
|
|
61
82
|
tokenResponse,
|
|
62
|
-
tenantName: decoded.tenantName,
|
|
63
|
-
environment: decoded.environment,
|
|
83
|
+
tenantName: (decoded === null || decoded === void 0 ? void 0 : decoded.tenantName) || "",
|
|
84
|
+
environment: (decoded === null || decoded === void 0 ? void 0 : decoded.environment) || "",
|
|
64
85
|
};
|
|
65
86
|
}))();
|
|
66
87
|
return {
|
|
@@ -4,8 +4,11 @@ export const buildTokenRequestBody = (request) => {
|
|
|
4
4
|
unrecognizedObjectKeys: "strip",
|
|
5
5
|
omitUndefined: true,
|
|
6
6
|
});
|
|
7
|
+
// Build scope string: always include "openid", add any additional scopes
|
|
8
|
+
const allScopes = ["openid", ...(request.scopes || [])];
|
|
9
|
+
const scopeString = [...new Set(allScopes)].join(" ");
|
|
7
10
|
const tokenRequestBody = {
|
|
8
|
-
scope:
|
|
11
|
+
scope: scopeString,
|
|
9
12
|
grant_type: request.grantType || "client_credentials",
|
|
10
13
|
};
|
|
11
14
|
Object.entries(serializedRequest).forEach(([key, value]) => {
|
|
@@ -10,13 +10,13 @@ export interface CortiEnvironmentUrls {
|
|
|
10
10
|
export declare const CortiEnvironment: {
|
|
11
11
|
readonly Eu: {
|
|
12
12
|
readonly base: "https://api.eu.corti.app/v2";
|
|
13
|
-
readonly wss: "wss://api.eu.corti.app";
|
|
13
|
+
readonly wss: "wss://api.eu.corti.app/audio-bridge/v2";
|
|
14
14
|
readonly login: "https://auth.eu.corti.app/realms";
|
|
15
15
|
readonly agents: "https://api.eu.corti.app";
|
|
16
16
|
};
|
|
17
17
|
readonly Us: {
|
|
18
18
|
readonly base: "https://api.us.corti.app/v2";
|
|
19
|
-
readonly wss: "wss://api.us.corti.app";
|
|
19
|
+
readonly wss: "wss://api.us.corti.app/audio-bridge/v2";
|
|
20
20
|
readonly login: "https://auth.us.corti.app/realms";
|
|
21
21
|
readonly agents: "https://api.us.corti.app";
|
|
22
22
|
};
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
export const CortiEnvironment = {
|
|
5
5
|
Eu: {
|
|
6
6
|
base: "https://api.eu.corti.app/v2",
|
|
7
|
-
wss: "wss://api.eu.corti.app",
|
|
7
|
+
wss: "wss://api.eu.corti.app/audio-bridge/v2",
|
|
8
8
|
login: "https://auth.eu.corti.app/realms",
|
|
9
9
|
agents: "https://api.eu.corti.app",
|
|
10
10
|
},
|
|
11
11
|
Us: {
|
|
12
12
|
base: "https://api.us.corti.app/v2",
|
|
13
|
-
wss: "wss://api.us.corti.app",
|
|
13
|
+
wss: "wss://api.us.corti.app/audio-bridge/v2",
|
|
14
14
|
login: "https://auth.us.corti.app/realms",
|
|
15
15
|
agents: "https://api.us.corti.app",
|
|
16
16
|
},
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -5,6 +5,10 @@ export * as serialization from "./serialization/index.mjs";
|
|
|
5
5
|
* Patch: use custom CortiClient instead of the generated one.
|
|
6
6
|
*/
|
|
7
7
|
export { CortiClient } from "./custom/CortiClient.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Patch: lightweight proxy client with only WebSocket resources.
|
|
10
|
+
*/
|
|
11
|
+
export { CortiWebSocketProxyClient } from "./custom/CortiWebSocketProxyClient.mjs";
|
|
8
12
|
export { CortiEnvironment, CortiEnvironmentUrls } from "./environments.mjs";
|
|
9
13
|
/**
|
|
10
14
|
* Patch: added new export to provide Authorization code flow support.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5,6 +5,10 @@ export * as serialization from "./serialization/index.mjs";
|
|
|
5
5
|
* Patch: use custom CortiClient instead of the generated one.
|
|
6
6
|
*/
|
|
7
7
|
export { CortiClient } from "./custom/CortiClient.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Patch: lightweight proxy client with only WebSocket resources.
|
|
10
|
+
*/
|
|
11
|
+
export { CortiWebSocketProxyClient } from "./custom/CortiWebSocketProxyClient.mjs";
|
|
8
12
|
export { CortiEnvironment } from "./environments.mjs";
|
|
9
13
|
/**
|
|
10
14
|
* Patch: added new export to provide Authorization code flow support.
|
|
@@ -6,5 +6,5 @@ import * as Corti from "../../api/index.mjs";
|
|
|
6
6
|
import * as core from "../../core/index.mjs";
|
|
7
7
|
export declare const AgentsMcpServerAuthorizationType: core.serialization.Schema<serializers.AgentsMcpServerAuthorizationType.Raw, Corti.AgentsMcpServerAuthorizationType>;
|
|
8
8
|
export declare namespace AgentsMcpServerAuthorizationType {
|
|
9
|
-
type Raw = "none" | "
|
|
9
|
+
type Raw = "none" | "bearer" | "inherit" | "oauth2.0";
|
|
10
10
|
}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as core from "../../core/index.mjs";
|
|
5
|
-
export const AgentsMcpServerAuthorizationType = core.serialization.enum_(["none", "
|
|
5
|
+
export const AgentsMcpServerAuthorizationType = core.serialization.enum_(["none", "bearer", "inherit", "oauth2.0"]);
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.8.0-rc.1";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.8.0-rc.1";
|